Ejemplo n.º 1
0
 /**
  * 
  */
 public function getListResultsAction()
 {
     $params = $this->getRequest()->getParams();
     $inspectors = InspectorQuery::create()->innerJoinPerson()->addColumns(array('Inspector.*', 'User.*', 'Person.*'))->filter($params)->page($params['page'], $this->getMaxPerPage())->find();
     print_r(json_encode($inspectors->toArray()));
     die;
 }
Ejemplo n.º 2
0
 /**
  *
  * @return array
  */
 public function editAction()
 {
     $id = $this->getRequest()->getParam('id');
     //$id = '14';
     $inspection = InspectionQuery::create()->findByPKOrThrow($id, $this->i18n->_("It does not exist the Inspection with id {$id}"));
     $this->view->setTpl("New");
     $inspectors = \Application\Query\InspectorQuery::create()->innerJoinPerson()->addColumns(array('Inspector.*', 'Person.*'))->whereAdd('User.' . \Application\Model\Bean\User::STATUS, \Application\Model\Bean\User::$Status['Active'])->find();
     $inspectors = $inspectors->map(function (Inspector $inspector) {
         return array($inspector->getIdInspector() => $inspector->getFullName());
     });
     $address = AddressQuery::create()->findByPK($inspection->getIdAddress());
     $this->view->inspection = $inspection;
     $this->view->inspectionsTypes = $inspectionsTypes;
     $this->view->inspectorsSelected = $inspection->getIdInspector();
     $this->view->address = $address;
     $this->view->inspectors = $inspectors;
     $this->view->action = 'update';
     $this->view->selectedTypes = $selectedTypes = InspectionQuery::create()->innerJoinType()->addColumns(array('Type.type'))->whereAdd('Type.id_inspection', $inspection->getIdInspection())->fetchCol();
 }