Esempio n. 1
0
 /**
  * Retrieve multiple objects by pkey.
  *
  * @param      array $pks List of primary keys
  * @param      PropelPDO $con the connection to use
  * @throws     PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function retrieveByPKs($pks, PropelPDO $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(MissionTypePeer::DATABASE_NAME, Propel::CONNECTION_READ);
     }
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria(MissionTypePeer::DATABASE_NAME);
         $criteria->add(MissionTypePeer::ID, $pks, Criteria::IN);
         $objs = MissionTypePeer::doSelect($criteria, $con);
     }
     return $objs;
 }
Esempio n. 2
0
?>
              <label for="form-item-7">IFR Backup</label>
            </li>
            </ul>
              <strong>Show:</strong>
              <a href="#" class="all-missions" name="all_types" id="all_types" onclick="javascript:jQuery('#mtypes').css('display','block');">
                  <label id="types_text">All Mission Types</label></a>
              <div id="mtypes" class="all-mtype">
		<div class="holder">
                    <div class="bg">
                  <a href="#" class="all-missions" name="c_all_types" id="c_all_types">All/None</a>
                  <input type="hidden" name="checkflag" value="0"/>
                  <br/>
                  <table>
                    <?php 
$mission_types = MissionTypePeer::doSelect(new Criteria());
?>
                    <?php 
foreach ($mission_types as $mission_type) {
    ?>
                    <tr>
                      <td>
                        <?php 
    echo checkbox_tag('selected_types[]', $mission_type->getId(), in_array($mission_type->getId(), $selected_types), array("id" => "ru" . $mission_type->getId()));
    ?>
                        <label for="<?php 
    echo "ru" . $mission_type->getId();
    ?>
"><?php 
    echo $mission_type->getName();
    ?>
Esempio n. 3
0
 public function executeAvailableMissions(sfWebRequest $request)
 {
     $pilot = PilotPeer::retrieveByPK($this->getUser()->getPilotId());
     if (!$pilot instanceof Pilot) {
         return sfView::NONE;
     }
     if ($pilot->getPrimaryAirportId()) {
         $this->mission_legs = MissionLegPeer::getPilotNear($pilot->getPrimaryAirportId());
     } else {
         $this->mission_legs = array();
     }
     $this->home_airport = $pilot->getAirport();
     $ids = array();
     foreach ($this->mission_legs as $leg) {
         $ids[] = $leg->getId();
     }
     $c = new Criteria();
     $c->add(MissionLegPeer::TRANSPORTATION, 'air_mission');
     $c->add(MissionLegPeer::ID, $ids, Criteria::NOT_IN);
     $c->add(MissionLegPeer::CANCELLED, null, Criteria::ISNULL);
     $c1 = $c->getNewCriterion(MissionLegPeer::PILOT_ID, null, Criteria::ISNULL);
     $c2 = $c->getNewCriterion(MissionLegPeer::COPILOT_ID, null, Criteria::ISNULL);
     $c->add($c1->addOr($c2));
     $c->setLimit(50);
     $this->interest_legs = MissionLegPeer::doSelectJoinMission($c);
     $c->clear();
     $c->addJoin(MissionLegPeer::ID, PilotRequestPeer::LEG_ID, Criteria::LEFT_JOIN);
     $c->add(PilotRequestPeer::ACCEPTED, 1, Criteria::NOT_EQUAL);
     $c->add(MissionLegPeer::TRANSPORTATION, 'air_mission');
     //$c->addAscendingOrderByColumn();
     $c->setLimit(50);
     $this->pending_legs = MissionLegPeer::doSelectJoinMission($c);
     //ziyed
     // validity
     $person = PersonPeer::retrieveByPK($this->getUser()->getId());
     //$this->forward404Unless($person);
     $member = $person->getMember();
     //$this->forward404Unless($member);
     if ($member) {
         $pilot = $member->getPilot();
     } else {
         $pilot = null;
     }
     // filter related
     $this->date_widget = new widgetFormDate(array('format_date' => array('js' => 'mm/dd/yy', 'php' => 'm/d/Y')), array('class' => 'text'));
     if ($pilot) {
         $this->personal_flights = $pilot->getPersonalFlights();
     } else {
         $this->personal_flights = array();
     }
     $this->wings = WingPeer::doSelect(new Criteria());
     $this->idents = AirportPeer::doSelect(new Criteria());
     $this->states = sfConfig::get('app_short_states');
     $this->mission_types = MissionTypePeer::doSelect(new Criteria());
     $this->member = $member;
     $this->pilot = $pilot;
     if ($pilot) {
         $this->airport = $pilot->getAirport();
     } else {
         $this->airport = null;
     }
     if ($request) {
         $this->processFilterForm($request);
     }
     if ($request->getParameter('needs') == 1) {
         $this->needs_pilot = 1;
     }
     $this->pager = MissionPeer::getPilotAvailablePager($this->max, $this->airport, $this->page, $this->sort_by, $this->date_range1, $this->date_range2, $this->weekdays, $this->wing_id, $this->ident, $this->city, $this->state, $this->zip, $this->origin, $this->dest, $this->needs_pilot, $this->co_pilot, $this->ifr, $this->selected_types, $this->filled, $this->open, $this->max_pass, $this->max_weight, $this->max_distance, $this->min_efficiency, false, $this->ignore_availability);
     $this->miss_array = $this->pager->getResults();
     $this->total_mission_available = $this->pager->getNbResults();
     $this->missions = MissionPeer::getByMayInterested($this->airport, $this->min_efficiency);
     $ident = $request->getParameter('airport_ident');
     if (!empty($ident)) {
         $this->airport_ident = $request->getParameter('airport_ident');
     } else {
         $this->airport_ident = "";
     }
     //end ziyed
 }
Esempio n. 4
0
 public function executePilotRequestAcceptedView(sfWebRequest $request)
 {
     #security
     if (!$this->getUser()->hasCredential(array('Administrator', 'Pilot', 'Staff', '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->forward404Unless($person);
     $member = $person->getMember();
     if ($member) {
         $pilot = $member->getPilot();
     } else {
         $pilot = null;
     }
     $this->date_widget = new widgetFormDate(array('format_date' => array('js' => 'mm/dd/yy', 'php' => 'm/d/Y')), array('class' => 'text'));
     if ($pilot) {
         $this->personal_flights = $pilot->getPersonalFlights();
     } else {
         $this->personal_flights = array();
     }
     $this->wings = WingPeer::doSelect(new Criteria());
     $this->idents = AirportPeer::doSelect(new Criteria());
     $this->states = sfConfig::get('app_short_states');
     $this->mission_types = MissionTypePeer::doSelect(new Criteria());
     $this->member = $member;
     $this->pilot = $pilot;
     if ($pilot) {
         $this->airport = $pilot->getAirport();
     } else {
         $this->airport = null;
     }
     if ($request->getParameter('needs') == 1) {
         $this->needs_pilot = 1;
     }
     $c = new Criteria();
     $c->add(PilotRequestPeer::ACCEPTED, 1);
     $c->add(PilotRequestPeer::MEMBER_ID, $member->getId());
     $c->addJoin(PilotRequestPeer::LEG_ID, MissionLegPeer::ID);
     $c->addJoin(MissionLegPeer::MISSION_ID, MissionPeer::ID);
     //$this->result = MissionPeer::doSelect($c);
     $this->page = $request->getParameter("page", 1);
     $this->max = $request->getParameter("max", 10);
     $this->pager = new sfPropelPager('MissionLeg', $this->max);
     $this->pager->setCriteria($c);
     $this->pager->setPage($this->page);
     $this->pager->init();
     $this->miss_legs = $this->pager->getResults();
     $this->url = 'pilotRequestAcceptedView';
 }
Esempio n. 5
0
 /**
  * Available missions for a pilot
  * CODE: mission_view
  * CODE: mission_available
  */
 public function executeRequestLegs(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->getUri());
         $this->redirect('dashboard/index');
     }
     // validity
     $person = PersonPeer::retrieveByPK($this->getUser()->getId());
     $this->forward404Unless($person);
     $member = $person->getMember();
     //$this->forward404Unless($member);
     if ($member) {
         $pilot = $member->getPilot();
     } else {
         $pilot = null;
     }
     // filter related
     $this->date_widget = new widgetFormDate(array('format_date' => array('js' => 'mm/dd/yy', 'php' => 'm/d/Y')), array('class' => 'text'));
     if ($pilot) {
         $this->personal_flights = $pilot->getPersonalFlights();
     } else {
         $this->personal_flights = array();
     }
     $this->wings = WingPeer::doSelect(new Criteria());
     $this->idents = AirportPeer::doSelect(new Criteria());
     $this->states = sfConfig::get('app_short_states');
     $this->mission_types = MissionTypePeer::doSelect(new Criteria());
     $this->member = $member;
     $this->pilot = $pilot;
     if ($pilot) {
         $this->airport = $pilot->getAirport();
     } else {
         $this->airport = null;
     }
     $this->processFilterForm($request);
     if ($request->getParameter('needs') == 1) {
         $this->needs_pilot = 1;
     }
     $this->pager = MissionPeer::getPilotAvailablePager($this->max, $this->airport, $this->page, $this->sort_by, $this->date_range1, $this->date_range2, $this->weekdays, $this->wing_id, $this->ident, $this->city, $this->state, $this->zip, $this->origin, $this->dest, $this->needs_pilot, $this->co_pilot, $this->ifr, $this->selected_types, $this->filled, $this->open, $this->max_pass, $this->max_weight, $this->max_distance, $this->min_efficiency, false, $this->ignore_availability);
     // $this->pager = MissionPeer::getMissionsAvailable();
     $this->miss_array = $this->pager->getResults();
     //echo "<pre>";
     //print_r($this->miss_array);exit;
     $this->missions = MissionPeer::getByMayInterested($this->airport, $this->min_efficiency);
     $ident = $request->getParameter('airport_ident');
     if (!empty($ident)) {
         $this->airport_ident = $request->getParameter('airport_ident');
     } else {
         $this->airport_ident = "";
     }
 }
Esempio n. 6
0
 /**
  * Mission Available with camps Pilot view
  * CODE:mission_available_camp
  */
 public function executeAvailableCamp(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');
     }
     // validity
     $person = PersonPeer::retrieveByPK($this->getUser()->getId());
     $this->forward404Unless($person);
     $member = $person->getMember();
     //      $this->forward404Unless($member);
     if ($member) {
         $pilot = $member->getPilot();
     } else {
         $pilot = null;
     }
     //      $this->forward404Unless($pilot);
     if ($pilot && $pilot->getPrimaryAirportId() === null) {
         $this->getUser()->setFlash('warning', 'Please confirm Primary Airport!');
         $this->redirect('account/index');
     }
     // filter related
     $this->date_widget = new widgetFormDate(array('format_date' => array('js' => 'mm/dd/yy', 'php' => 'm/d/Y')), array('class' => 'text'));
     if ($pilot) {
         $this->personal_flights = $pilot->getPersonalFlights();
     } else {
         $this->personal_flights = array();
     }
     $this->wings = WingPeer::doSelect(new Criteria());
     $this->idents = AirportPeer::doSelect(new Criteria());
     $this->states = sfConfig::get('app_short_states');
     $this->mission_types = MissionTypePeer::doSelect(new Criteria());
     if ($member) {
         $this->av = $member->getAvailability();
     } else {
         $this->av = null;
     }
     $this->member = $member;
     $this->pilot = $pilot;
     if ($pilot) {
         $this->primary_airport_id = $pilot->getPrimaryAirportId();
     } else {
         $this->primary_airport_id = null;
     }
     if ($pilot) {
         $this->airport = $pilot->getAirport();
     } else {
         $this->airport = null;
     }
     $this->processFilterForm($request);
     $this->pager = MissionPeer::getPilotAvailablePager($this->max, $this->airport, $this->page, $this->sort_by, $this->date_range1, $this->date_range2, $this->weekdays, $this->wing_id, $this->ident, $this->city, $this->state, $this->zip, $this->origin, $this->dest, $this->needs_pilot, $this->co_pilot, $this->ifr, $this->selected_types, $this->filled, $this->open, $this->max_pass, $this->max_weight, $this->max_distance, $this->min_efficiency, true, $this->ignore_availability);
     $this->miss_array = $this->pager->getResults();
     $this->missions = MissionPeer::getByMayInterested();
     /*
     
             if(isset($pilot) && $pilot->getPrimaryAirportId() != null && $pilot instanceof Pilot){
     
               #get the Pilot's nearest Mission Legs with camps
               $this->mission_legs = MissionLegPeer::getPilotNearWithCamp($pilot->getPrimaryAirportId());
     
               echo var_dump($this->mission_legs);die();
               
               $this->missions = array();
               $this->camps = array();
               $count=0;
     
               foreach ($this->mission_legs as $leg){
                 if($leg->getToAirportId()){
                   $this->destination_airport = $leg->getToAirportId();
                 }
                 $this->missions[$count] = MissionPeer::retrieveByPK($leg->getMissionId());
                 $this->camps[$count] = CampPeer::retrieveByPK(MissionPeer::retrieveByPK($leg->getMissionId())->getCampId());
                 $count++;
               }
     
               #get Missions Pilot may interested
               $this->imissions = MissionPeer::getByMayInterested();
     
               $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++;
                 }
               }
             }else{
               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());
             }
           }else{
             $this->mission_legs = MissionLegPeer::doSelect(new Criteria());
     
             $this->missions = MissionPeer::getByMayInterested();
     
             $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++;
               }
             }
           }
         }*/
 }