select('t.id, t.title, t.tmc_type, t.status, t.employee, ta.name, ts.title as storage') ->from(Tmc::tableName() . ' t') ->leftJoin(Accounts::tableName() . ' ta', 'ta.id = t.employee') ->leftJoin(Storage::tableName() . ' ts', 'ts.id = t.storage') ; $tmcs = $query->all(); list($cameras, $phones, $oilMeters) = sortTmc($tmcs); $query = new Query(); $statuses = $query->select('id, title') ->from(TmcStatus::tableName()) ->indexBy('id') ->all() ; include "tmc_list.php"; switch ($act) { case 'tmc/new': require (dirname(__DIR__) . '/tmc/forms/new.php'); break; case 'tmc/detail/added': require (dirname(__DIR__) . '/tmc/forms/added.php'); break; }