new.php 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php /** @var string $act */
  2. if (!$logged_me_in_successfully234) {
  3. return;
  4. }
  5. require 'tmc/functions.php';
  6. use app\models\entity\Accounts;
  7. use app\models\entity\Storage;
  8. use app\models\entity\Tmc;
  9. use app\models\entity\TmcStatus;
  10. use yii\db\Query;
  11. $query = new Query();
  12. $query->select('t.id, t.title, t.tmc_type, t.status, t.employee, ta.name, ts.title as storage')
  13. ->from(Tmc::tableName() . ' t')
  14. ->leftJoin(Accounts::tableName() . ' ta', 'ta.id = t.employee')
  15. ->leftJoin(Storage::tableName() . ' ts', 'ts.id = t.storage')
  16. ;
  17. $tmcs = $query->all();
  18. list($cameras, $phones, $oilMeters) = sortTmc($tmcs);
  19. $query = new Query();
  20. $statuses = $query->select('id, title')
  21. ->from(TmcStatus::tableName())
  22. ->indexBy('id')
  23. ->all()
  24. ;
  25. include "tmc_list.php";
  26. switch ($act) {
  27. case 'tmc/new':
  28. require (dirname(__DIR__) . '/tmc/forms/new.php');
  29. break;
  30. case 'tmc/detail/added':
  31. require (dirname(__DIR__) . '/tmc/forms/added.php');
  32. break;
  33. }