Exemplo n.º 1
0
 /**
  * Searches for Itinerary
  * CODE: itinerary_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');
     }
     $id = $request->getParameter('id');
     if ($id) {
         $itinerary = ItineraryPeer::retrieveByPK($id);
         if ($itinerary) {
             if ($itinerary->getCancelItinerary() == 1) {
                 $this->redirect('@itinerary_detail?id=' . $itinerary->getId());
             } else {
                 $this->getUser()->setFlash('success', 'The itinerary is cancelled so mission could not be created under this itinerary');
                 $this->redirect('itinerary');
             }
         } else {
             $this->getUser()->setFlash('warning', 'Itinerary #' . $id . ' not found!');
         }
     }
     # filter
     $this->processFilter($request);
     if ($request->isMethod('post') || $request->getParameter('page')) {
         $this->pager = ItineraryPeer::getPager($this->max, $this->page, $this->date_req, $this->pass_name, $this->req_name, $this->pass_lname, $this->req_lname);
         $this->itinerary_list = $this->pager->getResults();
     }
     $this->date_widget = new widgetFormDate(array('format_date' => array('js' => 'mm/dd/yy', 'php' => 'm/d/Y')), array('class' => 'text'));
 }