/** * Searches for coordinators * CODE: coordinator_index, coordinator_create */ public function executeIndex(sfWebRequest $request) { # security if (!$this->getUser()->hasCredential(array('Administrator', 'Staff', 'Pilot', 'Coordinator', 'Volunteer'), false)) { $this->getUser()->setFlash("warning", 'You don\'t have permission to access this url ' . $request->getReferer()); $this->redirect('dashboard/index'); } $this->getUser()->addRecentItem('Coordinator', 'Coordinator', 'coordinator/index'); # for navigation menu sfContext::getInstance()->getConfiguration()->loadHelpers('Partial'); slot('nav_menu', array('mission_coord', '')); if ($request->hasParameter('coor_for') && $this->getUser()->hasCredential(array('Administrator', 'Staff'), false)) { $this->coor_for = CoordinatorPeer::retrieveByPK($request->getParameter('coor_for')); } else { $this->coor_for = null; } $exclude_ids = array(); if ($this->master_for) { $exclude_ids[] = $this->master_for->getId(); } # filter $this->processFilter($request); $this->pager = CoordinatorPeer::getPager($this->max, $this->page, $this->firstname, $this->lastname, $this->city, $this->state, $this->country, $this->coor_of_week, $exclude_ids); $this->coordinators = $this->pager->getResults(); # one result with coordinator_id search will go to coordinator view if (count($this->coordinators) == 1) { if ($this->coor_for) { $url_add = '&coor_for=' . $this->coor_for->getId(); } else { $url_add = ''; } $this->redirect('@coordinator_view?id=' . $this->coordinators[0]->getId() . $url_add); } }