/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer $id the ID of the model to be loaded * @return Equipment the loaded model * @throws CHttpException */ public function loadEquipment($id) { $model = Equipment::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
public function init() { $this->equipments = Equipment::model()->findMyEquipments(); }
public function sortEquipments($position) { $i = 1; foreach ($position as $id) { $model = Equipment::model()->findByPk($id); $model->position = $i; $model->save(); $i++; } }
<ul id='treeview' class='filetree'> <?php $ul = ""; $projectId = 0; $componentId = 0; foreach ($query as $q) { $pname = $q['pname']; $pid = $q['pid']; $cname = $q['cname']; $cid = $q['cid']; $ename = $q['ename']; $eid = $q['eid']; $project = Project::model()->findByPk($pid); $component = Components::model()->findByPk($cid); $travelers = Equipment::model()->findByPk($eid)->travelers; if ($projectId != $pid) { $projectId = $pid; $componentId = 0; $status = 0; echo "{$ul}{$ul}"; $ul = ""; if ($project->hide) { $style = ""; } else { $style = "style='display:none'"; } ?> <li class="p<?php echo $pid; ?>