public function executeAjaxFilterAirportByName(sfWebRequest $request) { $airportname = trim($request->getParameter('airportname')); if (empty($airportname)) { return sfView::NONE; } $c = new Criteria(); $c->add(AirportPeer::NAME, "{$airportname}%", Criteria::LIKE); $c->setLimit(10); $this->airports = AirportPeer::doSelect($c); }
echo url_for($back); ?> " class="cancel">Cancel</a> </div> </div><!--box alt--> </form> </div><!--airport_form--> <script type="text/javascript"> //<![CDATA[ jQuery(document).ready(function() { <?php $idents = array(); $count = 0; $airpots = AirportPeer::doSelect(new Criteria()); $size = sizeof($airpots); for ($ii = 0; $ii < $size; $ii++) { $idents[] = "{$count} : '{$airpots[$ii]->getIdent()}'"; $count++; } ?> var sizeOf = <?php echo sizeof($idents); ?> ; var idents = {<?php echo join(',', $idents); ?> };
/** * Add or edit fbo * CODE:fbo_create */ public function executeFboUpdate(sfWebRequest $request) { # security if (!$this->getUser()->hasCredential(array('Administrator', 'Staff', 'Coordinator', 'Volunteer'), false)) { $this->getUser()->setFlash("warning", 'You don\'t have permission to access this url ' . $request->getReferer()); $this->redirect('dashboard/index'); } //$this->airports=""; sfContext::getInstance()->getConfiguration()->loadHelpers('Partial'); $this->airport = trim($this->getRequestParameter('airport', '*')) == '' ? '*' : trim($this->getRequestParameter('airport', '*')); if ($request->getParameter('leg')) { $this->leg_id = $request->getParameter('leg'); } if ($request->getParameter('id')) { $this->fbo = FboPeer::retrieveByPK($request->getParameter('id')); $this->forward404Unless($this->fbo); $this->title = 'Edit Fbo'; $success = 'FBO information has successfully edited!'; slot('nav_menu', array('reference', '')); if ($this->fbo->getAirportId()) { $this->airport_id = $this->fbo->getAirportId(); } $this->airports = AirportPeer::doSelect(new Criteria()); } else { $this->fbo = new Fbo(); $this->title = 'Add Fbo'; $success = 'FBO information has successfully created!'; slot('nav_menu', array('reference', 'add-fbo')); } //Aiport PopUp Form $airport = new Airport(); $this->form_airport = new AirportForm($airport); $this->airport_referer = $request->getReferer(); $this->form = new FboForm($this->fbo); if ($request->isMethod('post')) { $this->referer = $request->getParameter('referer'); $this->form->bind($request->getParameter('fbo')); if ($this->form->isValid() && $request->getParameter('airport') && $this->form->getValue('name')) { if ($request->getParameter('airport')) { $airport = AirportPeer::getByIdent($request->getParameter('airport')); } if (isset($airport) && $airport instanceof Airport) { $this->fbo->setAirportId($airport->getId()); } $this->fbo->setName($this->form->getValue('name')); $this->fbo->setAddress($this->form->getValue('address')); $this->fbo->setVoicePhone($this->form->getValue('voice_phone')); $this->fbo->setFaxPhone($this->form->getValue('fax_phone')); $this->fbo->setDiscountAmount($this->form->getValue('discount_amount')); if ($this->form->getValue('fuel_discount') == null || $this->form->getValue('discount_amount') == 0) { $this->fbo->setFuelDiscount(0); } else { $this->fbo->setFuelDiscount($this->form->getValue('fuel_discount')); } if ($this->fbo->isNew()) { $ext = ''; if (isset($airport) && $airport instanceof Airport) { $ext = ' for ' . $airport->getIdent(); } $content = $this->getUser()->getName() . ' added new FBO' . $ext . ': ' . $this->fbo->getName(); ActivityPeer::log($content); } $this->fbo->save(); $this->getUser()->setFlash('success', $success); $back = '@fbo'; if ($request->getParameter('leg_id')) { $set_leg = MissionLegPeer::retrieveByPK($request->getParameter('leg_id')); if (isset($set_leg) && $set_leg instanceof MissionLeg) { $set_leg->setFboId($this->fbo->getId()); $set_leg->save(); } $back = '@leg_edit?id=' . $request->getParameter('leg_id'); } $this->redirect($back); } else { if ($request->getParameter('airport') == NULL) { $this->errairport = 1; } if ($request->getParameter('airport') == NULL && $this->form->getValue('name')) { $this->getUser()->setFlash('error', 'Please Provide An Airport Name!'); } else { if ($request->getParameter('airport') && $this->form->getValue('name') == NULL) { $this->getUser()->setFlash('error', 'Please Provide A Name!'); } else { $this->getUser()->setFlash('error', 'Please Provide Airport and Name!'); } } } } else { # Set referer URL $this->referer = $request->getReferer() ? $request->getReferer() : '@fbo'; } $this->fbo = $this->fbo; }
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'; }
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 }
/** * Add/edit a pilot * CODE: pilot_create */ public function executeUpdate(sfWebRequest $request) { 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'); } if ($request->getParameter('member_id')) { $this->member = MemberPeer::retrieveByPK($request->getParameter('member_id')); $pilot = new Pilot(); $this->title = 'Add Pilot'; } if ($request->getParameter('id')) { $pilot = PilotPeer::retrieveByPK($request->getParameter('id')); $this->forward404Unless($pilot); ///ziyed//// $this->url = $request->getReferer(); if (strstr($this->url, '/pilot/mopAdd')) { $this->title = 'Add mop pilot'; $success = 'MOP information has been successfully added!'; } else { $this->title = 'Edit pilot'; $success = 'Pilot information has been successfully changed!'; $this->current_region = $pilot->getMopRegionsServed(); $this->mopservedby = $pilot->getMopServedBy(); } ////end////// $this->member = MemberPeer::retrieveByPK($pilot->getMemberId()); if ($pilot->getPrimaryAirportId()) { $this->airport_id = $pilot->getPrimaryAirportId(); } $this->airports = AirportPeer::doSelect(new Criteria()); } else { $pilot = new Pilot(); $this->title = 'Add Pilot'; $success = 'Pilot information has been successfully created!'; } $this->airport = trim($this->getRequestParameter('airport', '*')) == '' ? '*' : trim($this->getRequestParameter('airport', '*')); if ($request->getParameter('leg')) { $this->leg_id = $request->getParameter('leg'); } if ($request->getParameter('back')) { $this->backup = $request->getParameter('back'); } if ($request->getParameter('co')) { $this->backup_co = $request->getParameter('co'); } if ($request->getParameter('member')) { $this->member = MemberPeer::retrieveByPK($request->getParameter('member')); } $this->form = new PilotForm($pilot); $this->pilot = $pilot; $this->back = $request->getReferer(); ///////////////////Update /////////// if ($request->isMethod('post')) { $this->referer = $request->getReferer(); $this->form->bind($request->getParameter('pilo')); if ($this->form->isValid() && $this->form->getValue('license_type')) { if ($request->getParameter('member_id')) { $pilot->setMemberId($request->getParameter('member_id')); } //TODO:Set Member Flight status to command pilot $set_member = MemberPeer::retrieveByPK($request->getParameter('member_id')); if ($set_member) { $set_member->setFlightStatus('Command pilot'); $set_member->save(); } if ($request->getParameter('airport') != null) { $airport = AirportPeer::getByIdent($request->getParameter('airport')); if (isset($airport) && $airport instanceof Airport) { $pilot->setPrimaryAirportId($airport->getId()); } } else { $pilot->setPrimaryAirportId(null); $member = MemberPeer::retrieveByPK($request->getParameter('member_id')); $member->setFlightStatus('Non-pilot'); $member->save(); } $pilot->setSecondaryHomeBases($this->form->getValue('secondary_home_bases')); $pilot->setTotalHours($this->form->getValue('total_hours')); $pilot->setLicenseType($this->form->getValue('license_type')); if ($this->form->getValue('ifr') == null) { $pilot->setIfr(0); } else { $pilot->setIfr($this->form->getValue('ifr')); } if ($this->form->getValue('multi_engine') == null) { $pilot->setMultiEngine(0); } else { $pilot->setMultiEngine($this->form->getValue('multi_engine')); } $pilot->setSeInstructor($this->form->getValue('se_instructor')); $pilot->setMeInstructor($this->form->getValue('me_instructor')); $pilot->setOtherRatings($this->form->getValue('other_ratings')); $pilot->setInsuranceReceived($this->form->getValue('insurance_received')); //ziyed task $pilot->setOrientedDate($this->form->getValue('oriented_date')); $pilot->setMopOrientedDate($this->form->getValue('mop_oriented_date')); if ($request->getParameter('pilot_name')) { $pilot->setMopServedBy($request->getParameter('pilot_name')); } else { $pilot->setMopServedBy(NULL); } // $pilot->setMopRegionsServed($request->getParameter('mop_regions_served')); if ($request->getParameter('mop_regions_served')) { $pilot->setMopRegionsServed($request->getParameter('mop_regions_served')); } else { $a = null; $pilot->setMopRegionsServed($a); } //$pilot->setOrientedMemberId($this->form->getValue('oriented_member_id')); //$pilot->setOrientedMemberId($this->form->getValue('mop_oriented_member_id')); //$pilot->setMopQualifications($this->form->getValue('mop_qualifications')); $pilot->setHseats($this->form->getValue('hseats')); if ($this->form->getValue('transplant') == 1) { $pilot->setTransplant(1); } else { $pilot->setTransplant(0); } $pilot->save(); $this->getUser()->setFlash('success', $success); $last = $request->getParameter('back'); $back_url = 'pilot'; if (strstr($last, 'member/view')) { $back_url = '@member_view?id=' . $request->getParameter('member_id'); } elseif (strstr($last, 'pilot/view')) { $back_url = '@pilot_view?id=' . $pilot->getId(); } elseif (strstr($last, 'pilot/edit')) { $back_url = '@pilot_view?id=' . $pilot->getId(); } elseif (strstr($last, 'pilot/mopAdd')) { $back_url = '/pilot/mopAdd'; } if ($request->getParameter('leg_id')) { $back_url = '@leg_edit?id=' . $request->getParameter('leg_id'); } if ($request->getParameter('leg_id')) { if ($request->getParameter('leg_id') && !$request->getParameter('backup')) { $set_leg = MissionLegPeer::retrieveByPK($request->getParameter('leg_id')); if (isset($set_leg) && $set_leg instanceof MissionLeg) { $set_leg->setPilotId($pilot->getId()); $set_leg->save(); $this->getUser()->setFlash('success', 'Mission Leg #' . $set_leg->getId() . ' \\s Pilot has been set!'); } $back_url = '@leg_edit?id=' . $request->getParameter('leg_id'); } } if ($request->getParameter('leg_id')) { if ($request->getParameter('leg_id') && $request->getParameter('backup')) { $set_leg = MissionLegPeer::retrieveByPK($request->getParameter('leg_id')); if (isset($set_leg) && $set_leg instanceof MissionLeg) { $set_leg->setBackupPilotId($pilot->getId()); $set_leg->save(); $this->getUser()->setFlash('success', 'Mission Leg #' . $set_leg->getId() . ' \\s Backup Pilot has been set!'); } $back_url = '@leg_edit?id=' . $request->getParameter('leg_id'); } } if ($request->getParameter('leg_id')) { if ($request->getParameter('leg_id') && $request->getParameter('backup_co')) { $set_leg = MissionLegPeer::retrieveByPK($request->getParameter('leg_id')); if (isset($set_leg) && $set_leg instanceof MissionLeg) { $set_leg->setBackupCopilotId($request->getParameter('member_id')); $set_leg->save(); $this->getUser()->setFlash('success', 'Mission Leg #' . $set_leg->getId() . ' \\s Backup Co-Pilot has been set!'); } $back_url = '@leg_edit?id=' . $request->getParameter('leg_id'); } } return $this->redirect($back_url); } else { if (!$request->getParameter('id')) { $info = 'Please confirm License type and choose Member !'; } else { $info = 'Please confirm License type !'; } $this->getUser()->setFlash('success', $info); } } else { # Set referer URL $this->referer = $request->getReferer() ? $request->getReferer() : '@pilot'; } $this->pilot = $pilot; }
/** * 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(AirportPeer::DATABASE_NAME, Propel::CONNECTION_READ); } $objs = null; if (empty($pks)) { $objs = array(); } else { $criteria = new Criteria(AirportPeer::DATABASE_NAME); $criteria->add(AirportPeer::ID, $pks, Criteria::IN); $objs = AirportPeer::doSelect($criteria, $con); } return $objs; }
/** * 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 = ""; } }
/** * 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++; } } } }*/ }
/** * Gets an array of Airport objects which contain a foreign key that references this object. * * If this collection has already been initialized with an identical Criteria, it returns the collection. * Otherwise if this Wing has previously been saved, it will retrieve * related Airports from storage. If this Wing is new, it will return * an empty collection or the current collection, the criteria is ignored on a new object. * * @param PropelPDO $con * @param Criteria $criteria * @return array Airport[] * @throws PropelException */ public function getAirports($criteria = null, PropelPDO $con = null) { if ($criteria === null) { $criteria = new Criteria(WingPeer::DATABASE_NAME); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } if ($this->collAirports === null) { if ($this->isNew()) { $this->collAirports = array(); } else { $criteria->add(AirportPeer::WING_ID, $this->id); AirportPeer::addSelectColumns($criteria); $this->collAirports = AirportPeer::doSelect($criteria, $con); } } else { // criteria has no effect for a new object if (!$this->isNew()) { // the following code is to determine if a new query is // called for. If the criteria is the same as the last // one, just return the collection. $criteria->add(AirportPeer::WING_ID, $this->id); AirportPeer::addSelectColumns($criteria); if (!isset($this->lastAirportCriteria) || !$this->lastAirportCriteria->equals($criteria)) { $this->collAirports = AirportPeer::doSelect($criteria, $con); } } } $this->lastAirportCriteria = $criteria; return $this->collAirports; }