示例#1
0
 /**
  * Search companions
  * CODE: companion_index
  */
 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->companion_list = CompanionPeer::doSelect(new Criteria());
     # for navigation menu
     sfContext::getInstance()->getConfiguration()->loadHelpers('Partial');
     slot('nav_menu', array('mission_coord', ''));
     # filter
     $this->processFilter($request);
     if ($request->isMethod('post') || $request->getParameter('page')) {
         $this->pager = CompanionPeer::getPager($this->max, $this->page, $this->firstname, $this->lastname, $this->name, $this->relationship);
         $this->companions = $this->pager->getResults();
     }
     $this->getUser()->addRecentItem('Companions', 'companions', 'companions/index');
 }