_item.php 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?
  2. use yii\web\View;
  3. $assetDir = Yii::$app->assetManager->getPublishedUrl('@vendor/almasaeed2010/adminlte/dist');
  4. foreach($users as $userid => $data){
  5. $op = ( $userid == $id )?0.5:1;
  6. $mark = ( time()-$data['time'] < $obj::sleep )?'fas fa-user-check':'fas fa-mug-hot';
  7. $mark = ( time()-$data['time'] < $obj::dead )?$mark:'fas fa-bed';
  8. $markd = ( time()-$data['time'] < $obj::sleep )?'text-success':'text-warning';
  9. $markd = ( time()-$data['time'] < $obj::dead )?$markd:'text-danger';
  10. if( time()-$data['time'] < $obj::kill ) {
  11. $photo = "/images/users/".$userid."_norm.jpg";
  12. if( !file_exists( Yii::getAlias('@webroot').$photo ) ){
  13. $photo = $assetDir."/img/user1-128x128.jpg";
  14. }
  15. $authorname = $data['name'];
  16. $authornews = [];
  17. $bb_date = date("Y-m-d 00:00:00", time());
  18. $eb_date = date("Y-m-d 23:59:59", time());
  19. $sql = "select * from `news` WHERE `dt_pub` BETWEEN '".$bb_date."' AND '".$eb_date."' and editors like '$authorname%' order by dt_pub";
  20. $authornews = Yii::$app->db->createCommand( $sql )->queryAll();
  21. $authornewsp = [];
  22. $ebn_date = date("Y-m-d H:i:00", time());
  23. $sql = "select * from `news` WHERE `dt_pub` BETWEEN '".$bb_date."' AND '".$ebn_date."' and `news`.active = 'Y' and editors like '$authorname%' order by dt_pub";
  24. $authornewsn = Yii::$app->db->createCommand( $sql )->queryAll();
  25. ?>
  26. <div class="col-md-3">
  27. <div class="card card-primary card-outline">
  28. <div class="card-body box-profile">
  29. <div class="text-center">
  30. <img class="profile-user-img img-fluid img-circle" src="<?=$photo?>" alt="User profile picture">
  31. </div>
  32. <h3 class="profile-username text-center"><?=$data['name']?></h3>
  33. <p class="text-muted text-center"><?=$data['name']?></p>
  34. <ul class="list-group list-group-unbordered mb-3">
  35. <li class="list-group-item">
  36. <b>Неактивен: </b> <i class="far fa-clock mr-1"></i> <?=date("i:s", time()-$data['time'])?><span class="float-right text-sm <?=$markd?>"><i class="<?=$mark?>"></i></span>
  37. </li>
  38. <li class="list-group-item">
  39. <b>Публикаций</b> <a class="float-right"><?=count( $authornews )?></a>
  40. </li>
  41. <li class="list-group-item">
  42. <b>Выпущено</b> <a class="float-right"><?=count( $authornewsn )?></a>
  43. </li>
  44. </ul>
  45. </div>
  46. </div>
  47. </div>
  48. <div class="dropdown-divider"></div>
  49. <?
  50. }
  51. }