get_issued_user_devices.php 1003 B

1234567891011121314151617181920212223242526
  1. <?php /** Created by Anton on 04.02.2020. */
  2. require '../yiiInit.php';
  3. $userId = Yii::$app->request->get('userId');
  4. $query = new \yii\db\Query();
  5. $query->select('tlog.tmc, t.employee as user, ttmc.title, tlog.issue_date')
  6. ->from(\app\models\entity\UserDevice::tableName() . ' t')
  7. ->leftJoin(\app\models\entity\Log::tableName() . ' tlog', 't.phone = tlog.id or t.camera = tlog.id or t.oil_meter = tlog.id')
  8. ->leftJoin(\app\models\entity\Tmc::tableName() . ' ttmc', 'ttmc.id = tlog.tmc')
  9. ->where(['t.employee' => $userId])
  10. ;
  11. $devices = $query->all();
  12. ?>
  13. <br>
  14. <h5>Выданные устройства:</h5>
  15. <?php if (!$devices): ?>
  16. <p><t class="loco_grey">Пользователю не выдано устройств</t></p>
  17. <?php endif; ?>
  18. <?php foreach ($devices as $device): ?>
  19. <p>
  20. <t class="loco_grey"><?= $device['title'] ?></t>
  21. <t class="loco_grey" style="float:right"><?= $device['issue_date'] ?></t>
  22. </p>
  23. <?php endforeach;