Example #1
0
 /**
  * Display list of available missions for Staff members
  */
 public function executeStaffAvailable(sfWebRequest $request)
 {
     $this->getUser()->setFlash("warning", 'This link not available url ' . $request->getUri());
     $this->redirect('dashboard/index');
     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');
     }
     $person = PersonPeer::retrieveByPK($this->getUser()->getId());
     $this->date_range1 = '';
     $this->date_range2 = '';
     $this->date_widget = new widgetFormDate(array('format_date' => array('js' => 'mm/dd/yy', 'php' => 'm/d/Y')), array('class' => 'text'));
     $this->wings = WingPeer::getForSelectParentNew();
     $this->states = sfConfig::get('app_short_states');
     $this->has_filters = UserFilterPeer::getByPersonId($person->getId());
     if (isset($this->has_filters) && $this->has_filters instanceof UserFilter) {
         $this->f_person_id = $this->has_filters->getId();
     }
     $this->mission_legs = MissionLegPeer::doSelect(new Criteria());
     #get Missions Pilot may interested
     $this->missions = MissionPeer::getByMayInterested();
     //$this->mission_types = MissionTypePeer::doSelect(new Criteria());
     $this->miss_pre = array();
     $this->miss_array = array();
     $this->miss_ids = array();
     $count_pre = 0;
     $count = 0;
     $check = 0;
     foreach ($this->mission_legs as $leg) {
         $this->miss_ids[$leg->getMissionId()] = $leg->getMissionId();
     }
     foreach ($this->mission_legs as $leg) {
         if ($this->miss_ids[$leg->getMissionId()] == $leg->getMissionId()) {
             $this->miss_array[$leg->getMissionId()] = $leg->getMissionId();
             $count++;
         }
     }
     //      if($pilot->getPrimaryAirportId() == null && isset($pilot)){
     //        $this->getUser()->setFlash('success','Pilot has not confirm Primary Airport!!');
     //        $this->redirect('@pilot_view?id='.$pilot->getId());
     //      }
     //      $this->getUser()->setFlash('success','You are not Pilot yet!');
     //      $this->redirect($request->getReferer());
 }