time.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <?php
  2. use yii\helpers\Html;
  3. use yii\widgets\DetailView;
  4. use dektrium\user\models\Profile;
  5. /** @var yii\web\View $this */
  6. /** @var manager\models\CommentsFilter $model */
  7. $user = $id;
  8. $cache = Yii::$app->memcache;
  9. $profile_name = Profile::findOne($id)->name;
  10. $this->title = 'Мониторинг сна: '.$profile_name."";
  11. $this->params['breadcrumbs'][] = ['label' => $this->title, 'url' => ['index']];
  12. $mduser = $id;
  13. $uactive = $cache->get($obj::keylist);
  14. if( $uactive ){
  15. $uactive = unserialize($uactive);
  16. }
  17. $ukey ='userlog_'.$id;
  18. $ulog = $cache->get( $ukey );
  19. if( $ulog ){
  20. $ulog = unserialize($ulog);
  21. }else{
  22. $ulog = [];
  23. }
  24. $tstats = ['start' => 'Начало работы', 'good' => 'Работа<br>...', 'sleep' => 'Лёгий сон', 'dead' => 'Глубокий сон', 'norm' => 'Работа<br>...'];
  25. $mstats = ['start' => 'bg-soft-primary text-primary', 'good' => 'bg-soft-success text-success', 'sleep' => 'bg-soft-warning text-warning', 'dead' => 'bg-soft-danger text-danger', 'norm' => 'bg-soft-success text-success'];
  26. ?>
  27. <style>
  28. .hori-timeline .events {
  29. border-top: 3px solid #e9ecef;
  30. }
  31. .hori-timeline .events .event-list {
  32. display: block;
  33. position: relative;
  34. text-align: center;
  35. padding-top: 70px;
  36. margin-right: 0;
  37. }
  38. .hori-timeline .events .event-list:before {
  39. content: "";
  40. position: absolute;
  41. height: 36px;
  42. border-right: 2px dashed #dee2e6;
  43. top: 0;
  44. }
  45. .hori-timeline .events .event-list .event-date {
  46. position: absolute;
  47. top: 38px;
  48. left: 0;
  49. right: 0;
  50. width: 75px;
  51. margin: 0 auto;
  52. border-radius: 4px;
  53. padding: 2px 4px;
  54. }
  55. @media (min-width: 1140px) {
  56. .hori-timeline .events .event-list {
  57. display: inline-block;
  58. min-width: 7%;
  59. max-width:100px;
  60. padding-top: 45px;
  61. }
  62. .hori-timeline .events .event-list .event-date {
  63. top: -12px;
  64. }
  65. }
  66. .bg-soft-primary {
  67. background-color: rgba(64,144,203,.3)!important;
  68. }
  69. .bg-soft-success {
  70. background-color: rgba(71,189,154,.3)!important;
  71. }
  72. .bg-soft-danger {
  73. background-color: rgba(231,76,94,.3)!important;
  74. }
  75. .bg-soft-warning {
  76. background-color: rgba(249,213,112,.3)!important;
  77. }
  78. </style>
  79. <div class="row">
  80. <div class="col-lg-12">
  81. <div class="hori-timeline" dir="ltr">
  82. <ul class="list-inline events">
  83. <?
  84. $dt = strtotime( date('Y-m-d 00:00:00') );
  85. foreach( $ulog as $time => $data ){
  86. if( $time < $dt ) continue;
  87. ?>
  88. <li class="list-inline-item event-list">
  89. <div class="px-4 align-top">
  90. <div class="event-date <?=$mstats[$data['stat']]?> align-top"><?=date("H:i", $time)?></div>
  91. <h5 class="font-size-16"><?=$tstats[$data['stat']]?></h5>
  92. </div>
  93. </li>
  94. <?
  95. }
  96. ?>
  97. </ul>
  98. </div>
  99. <!-- end card -->
  100. </div>
  101. </div>