Example #1
0
 /**
  *
  * @return array
  */
 public function editAction()
 {
     $id = $this->getRequest()->getParam('id');
     $inspector = InspectorQuery::create()->findByPKOrThrow($id, $this->i18n->_("It does not exist the Inspector with id {$id}"));
     $person = PersonQuery::create()->findByPK($inspector->getIdPerson());
     $this->view->viewAction = 'update';
     $this->view->setTpl("Form");
     $this->view->inspector = $inspector;
     $this->view->person = $person;
 }
Example #2
0
 /**
  *
  */
 protected function initIdPersonElement()
 {
     $element = new \Zend_Form_Element_Select('id_person');
     $options = \Application\Query\PersonQuery::create()->find()->toCombo();
     $element->addMultiOptions($options);
     $element->setLabel($this->getTranslator()->_('IdPerson'));
     $element->addValidator($this->validator->getFor('id_person'));
     $element->addFilter($this->filter->getFor('id_person'));
     $element->setRequired(true);
     $this->addElement($element);
     $this->elements['id_person'] = $element;
 }
Example #3
0
 /**
  *
  * @return array
  */
 public function listAction()
 {
     $this->view->page = $page = $this->getRequest()->getParam('page') ?: 1;
     if ($this->getRequest()->isPost()) {
         $this->view->post = $post = $this->getRequest()->getParams();
     }
     $total = ContactQuery::create()->filter($post)->count();
     $this->view->contacts = $contacts = ContactQuery::create()->filter($post)->page($page, $this->getMaxPerPage())->find();
     $this->view->paginator = $this->createPaginator($total, $page);
     $this->view->people = \Application\Query\PersonQuery::create()->find()->toCombo();
     $this->view->companies = \Application\Query\CompanyQuery::create()->find()->toCombo();
 }
Example #4
0
 /**
  * @module User
  * @action List
  * @return array
  */
 public function listAction()
 {
     $this->view->page = $page = $this->getRequest()->getParam('page') ?: 1;
     $this->view->form = $form = $this->getFilterForm();
     $this->view->post = $post = $this->getRequest()->getParams();
     $this->view->filter = $this->createFilterForUrl($post);
     if (!empty($post['username'])) {
         $post['username'] = '******' . $post['username'] . '%';
     }
     $total = UserQuery::create()->filter($post)->count();
     $this->view->users = $users = UserQuery::create()->filter($post)->page($page, $this->getMaxPerPage())->find();
     $this->view->contentTitle = 'Users List';
     $this->view->paginator = $this->createPaginator($total, $page);
     $this->view->accessRoles = array('' => $this->i18n->_('All')) + \Application\Query\AccessRoleQuery::create()->find()->toCombo();
     $this->view->people = \Application\Query\PersonQuery::create()->find()->toCombo();
     $this->view->statuses = array('' => $this->i18n->_('All')) + ($statuses = User::$StatusCombo);
 }
Example #5
0
 /**
  * build fromArray
  * @param Query $query
  * @param array $fields
  * @param string $prefix
  */
 public static function build(Query $query, $fields, $prefix = 'Contact')
 {
     parent::build($query, $fields);
     $criteria = $query->where();
     $criteria->prefix($prefix);
     if (isset($fields['id_contact']) && !empty($fields['id_contact'])) {
         $criteria->add(Contact::ID_CONTACT, $fields['id_contact']);
     }
     if (isset($fields['id_person']) && !empty($fields['id_person'])) {
         $criteria->add(Contact::ID_PERSON, $fields['id_person']);
     }
     if (isset($fields['id_company']) && !empty($fields['id_company'])) {
         $criteria->add(Contact::ID_COMPANY, $fields['id_company']);
     }
     if (isset($fields['position']) && !empty($fields['position'])) {
         $criteria->add(Contact::POSITION, $fields['position']);
     }
     $criteria->endPrefix();
 }
Example #6
0
 /**
  * build fromArray
  * @param Query $query
  * @param array $fields
  * @param string $prefix
  */
 public static function build(Query $query, $fields, $prefix = 'User')
 {
     parent::build($query, $fields);
     $criteria = $query->where();
     $criteria->prefix($prefix);
     if (isset($fields['id_user']) && !empty($fields['id_user'])) {
         $criteria->add(User::ID_USER, $fields['id_user']);
     }
     if (isset($fields['id_access_role']) && !empty($fields['id_access_role'])) {
         $criteria->add(User::ID_ACCESS_ROLE, $fields['id_access_role']);
     }
     if (isset($fields['id_person']) && !empty($fields['id_person'])) {
         $criteria->add(User::ID_PERSON, $fields['id_person']);
     }
     if (isset($fields['username']) && !empty($fields['username'])) {
         $criteria->add(User::USERNAME, $fields['username']);
     }
     if (isset($fields['password']) && !empty($fields['password'])) {
         $criteria->add(User::PASSWORD, $fields['password']);
     }
     if (isset($fields['status']) && !empty($fields['status'])) {
         $criteria->add(User::STATUS, $fields['status']);
     }
     if (isset($fields['notifications']) && !empty($fields['notifications'])) {
         $criteria->add(User::NOTIFICATIONS, $fields['notifications']);
     }
     $criteria->endPrefix();
 }