public function index() { $search = array('user_account' => true); if (!empty($_GET['department_id'])) { $search['department_id'] = $_GET['department_id']; } $table = new PersonTable(); $people = $table->find($search); $this->template->blocks[] = new Block('users/userList.inc', array('userList' => $people)); }
/** * Find and choose people * * The user can come here from somewhere they need a person * Choosing a person should send them back where they came from, * with the chosen person appended to the url * * @param GET return_url */ public function index() { $this->template->setFilename('people'); if (isset($_REQUEST['callback'])) { $this->template->title = 'Choose Person'; } // Look for anything that the user searched for $search = array(); $fields = array('firstname', 'lastname', 'email', 'organization', 'department_id'); foreach ($fields as $field) { if (isset($_GET[$field]) && $_GET[$field]) { $value = trim($_GET[$field]); if ($value) { $search[$field] = $value; } } } // Display the search form and any results if ($this->template->outputFormat == 'html') { $searchForm = new Block('people/searchForm.inc'); $this->template->blocks['left'][] = $searchForm; } if (count($search)) { if (isset($_GET['setOfPeople'])) { switch ($_GET['setOfPeople']) { case 'staff': $search['user_account'] = true; break; case 'public': $search['user_account'] = false; break; } } $table = new PersonTable(); $personList = $table->search($search); $searchResults = new Block('people/searchResults.inc', array('personList' => $personList)); $this->template->blocks[] = $searchResults; } }
/** * @return PersonList */ public function getPeople() { if ($this->getId()) { $table = new PersonTable(); return $table->find(['department_id' => $this->getId()]); } }
/** * @return Zend\Db\ResultSet */ public function getReportedByPeople() { if ($this->getId()) { $table = new PersonTable(); return $table->find(['reportedTicket_id' => $this->getId()]); } }