public function configure() { unset($this['facility'], $this['lodging'], $this['dest_city'], $this['dest_state'], $this['orgin_city'], $this['orgin_state'], $this['passenger_id'], $this['requester_id'], $this['id'], $this['agency_id'], $this['camp_id'], $this['leg_id'], $this['_csrf_token'], $this['mission_request_id'], $this['waiver_need'], $this['need_medical_release']); $mission_types = MissionTypePeer::getNames(); // $passengers= PassengerPeer::getForSelectParent(); // $requesters= RequesterPeer::getForSelectParent(); $appoints = array_merge(array('' => 'Unspecified'), sfConfig::get('app_appoints', array('morning' => 'Morning', 'noon' => 'Noon', 'afternoon' => 'Afternoon', 'evening' => 'Evening', 'exact_time' => 'Exact Time'))); $states = sfConfig::get('app_states', array('AL' => 'Alabama', 'AK' => 'Alaska', 'AZ' => 'Arizona', 'AR' => 'Arkansas', 'CA' => 'California', 'CO' => 'Colorado', 'CT' => 'Connecticut', 'DE' => 'Delaware')); $timetypes = array('am' => 'am', 'pm' => 'pm'); $this->widgetSchema['date_requested'] = new widgetFormDate(array('change_year' => true, 'change_month' => true, 'format_date' => array('js' => 'mm/dd/yy', 'php' => 'm/d/Y')), array('class' => 'text narrow')); $this->widgetSchema['mission_type_id'] = new sfWidgetFormSelect(array('choices' => $mission_types), array('class' => 'text narrow')); $this->widgetSchema['apoint_time'] = new sfWidgetFormSelect(array('choices' => $appoints), array('class' => 'text', 'style' => 'width: 90px;', 'onchange' => 'selectTimes()')); $this->widgetSchema['timetype'] = new sfWidgetFormSelect(array('choices' => $timetypes), array('class' => 'text', 'style' => 'width: 50px;')); // $this->widgetSchema['passenger_id'] = new sfWidgetFormSelect(array('choices'=>$passengers),array('class'=>'text narrow')); // $this->widgetSchema['requester_id'] = new sfWidgetFormSelect(array('choices'=>$requesters),array('class'=>'text narrow')); // $this->widgetSchema['facility'] = new sfWidgetFormInput(array(), array('class' => 'text')); // $this->widgetSchema['lodging'] = new sfWidgetFormInput(array(), array('class' => 'text')); // $this->widgetSchema['orgin_city'] = new sfWidgetFormInput(array(), array('class' => 'text narrow')); // $this->widgetSchema['orgin_state'] = new sfWidgetFormSelect(array('choices'=>$states),array('class'=>'text narrow')); // $this->widgetSchema['dest_city'] = new sfWidgetFormInput(array(), array('class' => 'text narrow')); // $this->widgetSchema['dest_state'] = new sfWidgetFormSelect(array('choices'=>$states),array('class'=>'text narrow')); //echo (bool) $this->getObject()->getWaiverNeed(); //die() ; //$this->widgetSchema['waiver_need'] = new sfWidgetFormInputCheckbox(array(), array('value' => 1)); //$this->widgetSchema['need_medical_release'] =new sfWidgetFormInputCheckbox(array(), array('value' => 1)); $this->widgetSchema['comment'] = new sfWidgetFormTextarea(array(), array('class' => 'text')); $this->widgetSchema['cancel_itinerary'] = new sfWidgetFormChoice(array('choices' => array("Yes", "No"), 'expanded' => true)); $this->widgetSchema->setLabels(array('date_requested' => 'Date Requested:')); $this->widgetSchema->setLabels(array('mission_type_id' => 'Mission Type:')); $this->widgetSchema->setLabels(array('apoint_time' => 'Appointment Time:')); // $this->widgetSchema->setLabels(array('passenger_id' => 'Passenger')); // $this->widgetSchema->setLabels(array('requester_id' => 'Requester')); // $this->widgetSchema->setLabels(array('facility' => 'Facility')); // $this->widgetSchema->setLabels(array('lodging' => 'Lodging')); // $this->widgetSchema->setLabels(array('orgin_city' => 'Orgin City')); // $this->widgetSchema->setLabels(array('orgin_state' => 'Orgin State')); // $this->widgetSchema->setLabels(array('dest_city' => 'Dest City')); // $this->widgetSchema->setLabels(array('dest_state' => 'Dest State')); //$this->widgetSchema->setLabels(array('waiver_need' => 'Waiver required from pilot?')); //$this->widgetSchema->setLabels(array('need_medical_release' => 'Medical release needed?')); $this->widgetSchema->setLabels(array('comment' => 'Comment')); $this->widgetSchema->setLabels(array('cancel_itinerary' => 'Cancel Itinerary')); $this->validatorSchema['date_requested'] = new sfValidatorDate(array('required' => true), array('invalid' => 'Requested Date is invalid !.', 'required' => 'Please confirm date requested !')); $this->validatorSchema['mission_type_id'] = new sfValidatorString(array('required' => true), array('required' => 'Please choose Mission Type !')); $this->validatorSchema['apoint_time'] = new sfValidatorString(array('required' => false), array('required' => 'Please choose appoint time !')); $this->validatorSchema['cancel_itinerary'] = new sfValidatorInteger(array('required' => false)); // $this->validatorSchema['passenger_id'] = new sfValidatorString(array('required' => true),array('required'=>'Please choice Passenger !')); // $this->validatorSchema['requester_id'] = new sfValidatorString(array('required' => true),array('required'=>'Please choice Requester !')); // $this->validatorSchema['facility'] = new sfValidatorString(array('required' => false)); // $this->validatorSchema['lodging'] = new sfValidatorString(array('required' => false)); // $this->validatorSchema['orgin_city'] = new sfValidatorString(array('required' => false)); // $this->validatorSchema['orgin_state'] = new sfValidatorString(array('required' => false)); // $this->validatorSchema['dest_city'] = new sfValidatorString(array('required' => false)); // $this->validatorSchema['dest_state'] = new sfValidatorString(array('required' => false)); //$this->validatorSchema['waiver_need'] = new sfValidatorString(array('required' => false)); //$this->validatorSchema['need_medical_release'] = new sfValidatorString(array('required' => false)); $this->setDefault('date_requested', date("m/d/y")); $this->widgetSchema->setNameFormat('itine[%s]'); }
/** * Searches for missions by filter */ private function processFilter(sfWebRequest $request) { $params = $this->getUser()->getAttribute('mission', array(), 'person'); if (!isset($params['miss_id'])) { $params['miss_id'] = null; } if (!isset($params['miss_type'])) { $params['miss_type'] = null; } if (!isset($params['miss_date1'])) { $params['miss_date1'] = null; } if (!isset($params['miss_date2'])) { $params['miss_date2'] = null; } if (!isset($params['pass_fname'])) { $params['pass_fname'] = null; } if (!isset($params['pass_lname'])) { $params['pass_lname'] = null; } if (!isset($params['mreq_fname'])) { $params['mreq_fname'] = null; } if (!isset($params['mreq_lname'])) { $params['mreq_lname'] = null; } $this->max_array = array(5, 10, 20, 30); $this->types = MissionTypePeer::getOnlyNames(); if (in_array($request->getParameter('max'), $this->max_array)) { $params['max'] = $request->getParameter('max'); } else { if (!isset($params['max'])) { $params['max'] = sfConfig::get('app_max_person_per_page', 10); } } if ($request->hasParameter('filter')) { $params['miss_id'] = $request->getParameter('miss_id'); $params['miss_type'] = in_array($request->getParameter('miss_type'), array_keys($this->types)) ? $request->getParameter('miss_type') : ''; $params['miss_date1'] = $request->getParameter('miss_date1'); $params['miss_date2'] = $request->getParameter('miss_date2'); $params['pass_fname'] = $request->getParameter('pass_fname'); $params['pass_lname'] = $request->getParameter('pass_lname'); $params['mreq_fname'] = $request->getParameter('mreq_fname'); $params['mreq_lname'] = $request->getParameter('mreq_lname'); } $this->page = $page = $request->getParameter('page', 1); $this->max = $params['max']; $this->miss_id = $params['miss_id']; $this->miss_type = $params['miss_type']; $this->miss_date1 = $params['miss_date1']; $this->miss_date2 = $params['miss_date2']; $this->pass_fname = $params['pass_fname']; $this->pass_lname = $params['pass_lname']; $this->mreq_fname = $params['mreq_fname']; $this->mreq_lname = $params['mreq_lname']; $this->getUser()->setAttribute('mission', $params, 'person'); }
/** * Selects a collection of MissionTypeWingStats objects pre-filled with all related objects except Wing. * * @param Criteria $c * @param PropelPDO $con * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN * @return array Array of MissionTypeWingStats objects. * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public static function doSelectJoinAllExceptWing(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) { foreach (sfMixer::getCallables('BaseMissionTypeWingStatsPeer:doSelectJoinAllExcept:doSelectJoinAllExcept') as $callable) { call_user_func($callable, 'BaseMissionTypeWingStatsPeer', $c, $con); } $c = clone $c; // Set the correct dbName if it has not been overridden // $c->getDbName() will return the same object if not set to another value // so == check is okay and faster if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } MissionTypeWingStatsPeer::addSelectColumns($c); $startcol2 = MissionTypeWingStatsPeer::NUM_COLUMNS - MissionTypeWingStatsPeer::NUM_LAZY_LOAD_COLUMNS; MissionTypePeer::addSelectColumns($c); $startcol3 = $startcol2 + (MissionTypePeer::NUM_COLUMNS - MissionTypePeer::NUM_LAZY_LOAD_COLUMNS); $c->addJoin(array(MissionTypeWingStatsPeer::MISSION_TYPE_ID), array(MissionTypePeer::ID), $join_behavior); $stmt = BasePeer::doSelect($c, $con); $results = array(); while ($row = $stmt->fetch(PDO::FETCH_NUM)) { $key1 = MissionTypeWingStatsPeer::getPrimaryKeyHashFromRow($row, 0); if (null !== ($obj1 = MissionTypeWingStatsPeer::getInstanceFromPool($key1))) { // We no longer rehydrate the object, since this can cause data loss. // See http://propel.phpdb.org/trac/ticket/509 // $obj1->hydrate($row, 0, true); // rehydrate } else { $omClass = MissionTypeWingStatsPeer::getOMClass(); $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1); $obj1 = new $cls(); $obj1->hydrate($row); MissionTypeWingStatsPeer::addInstanceToPool($obj1, $key1); } // if obj1 already loaded // Add objects for joined MissionType rows $key2 = MissionTypePeer::getPrimaryKeyHashFromRow($row, $startcol2); if ($key2 !== null) { $obj2 = MissionTypePeer::getInstanceFromPool($key2); if (!$obj2) { $omClass = MissionTypePeer::getOMClass(); $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1); $obj2 = new $cls(); $obj2->hydrate($row, $startcol2); MissionTypePeer::addInstanceToPool($obj2, $key2); } // if $obj2 already loaded // Add the $obj1 (MissionTypeWingStats) to the collection in $obj2 (MissionType) $obj2->addMissionTypeWingStats($obj1); } // if joined row is not null $results[] = $obj1; } $stmt->closeCursor(); return $results; }
/** * Get the associated MissionType object * * @param PropelPDO Optional Connection object. * @return MissionType The associated MissionType object. * @throws PropelException */ public function getMissionType(PropelPDO $con = null) { if ($this->aMissionType === null && $this->mission_type_id !== null) { $c = new Criteria(MissionTypePeer::DATABASE_NAME); $c->add(MissionTypePeer::ID, $this->mission_type_id); $this->aMissionType = MissionTypePeer::doSelectOne($c, $con); /* The following can be used additionally to guarantee the related object contains a reference to this object. This level of coupling may, however, be undesirable since it could result in an only partially populated collection in the referenced object. $this->aMissionType->addUserFilterMissionTypess($this); */ } return $this->aMissionType; }
</div> <h3>Itinerary #<?php echo $itinerary->getId(); ?> Details:</h3> <fieldset> <div class="mission-dtls"> <dl> <dt>Mission Type:</dt> <dd> <?php if ($itinerary->getMissionTypeId()) { ?> <?php $mission_type = MissionTypePeer::retrieveByPK($itinerary->getMissionTypeId()); ?> <?php if ($mission_type) { ?> <?php echo $mission_type->getName(); ?> <?php } ?> <?php } ?> </dd> <dt>Origin:</dt>
/** * Populates the object using an array. * * This is particularly useful when populating an object from one of the * request arrays (e.g. $_POST). This method goes through the column * names, checking to see whether a matching key exists in populated * array. If so the setByName() method is called for that column. * * You can specify the key type of the array by additionally passing one * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. * The default key type is the column's phpname (e.g. 'AuthorId') * * @param array $arr An array to populate the object from. * @param string $keyType The type of keys the array uses. * @return void */ public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = MissionTypePeer::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) { $this->setId($arr[$keys[0]]); } if (array_key_exists($keys[1], $arr)) { $this->setName($arr[$keys[1]]); } if (array_key_exists($keys[2], $arr)) { $this->setStatCount($arr[$keys[2]]); } if (array_key_exists($keys[3], $arr)) { $this->setColor($arr[$keys[3]]); } }
/** * 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 = ""; } }
public function executeAutoAddMissionsOnCamp(sfWebRequest $request) { // see if there is airport exist with this name $airport_name = $request->getParameter('airportname'); $airport = AirportPeer::getBySpecificAirportName($airport_name); // If there is no airport then insert it into airport table if (!$airport) { // @TODO Set default airport fields values $airport = new Airport(); $airport->setName($airport_name); $airport->save(); } $pass_id = $request->getParameter('passenger'); $camp_id = $request->getParameter('camp_id'); $camp_passenger = new CampPassenger(); $camp_passenger->setCampId($camp_id); $camp_passenger->setPassengerId($pass_id); if (CampPassengerPeer::doCount($camp_passenger->buildCriteria())) { $passenger = PassengerPeer::retrieveByPK($pass_id); $this->getUser()->setFlash('warning', 'Passenger "' . $passenger->getPerson()->getName() . '" has already been added!'); return $this->redirect('camp/view?id=' . $request->getParameter('camp_id')); } $camp = CampPeer::retrieveByPK($camp_id); $this->forward404Unless($camp); $note = $request->getParameter('note'); //$camp_passenger->setAirportId($camp->getAirportId ()); // Camp Location Id $camp_passenger->setNote($note); //if ($camp_passenger->save()){ //return $this->renderText($airport->getId()); //} $mission_type = MissionTypePeer::getByName('normal'); if (!$mission_type instanceof MissionType) { $mission_type = MissionTypePeer::doSelectOne(new Criteria()); $this->forward404Unless($mission_type); } $airport = AirportPeer::getBySpecificAirportName($airport_name); $camp_location = $camp->getAirport(); $itinerary = new Itinerary(); $itinerary->setCampId($camp->getId()); $itinerary->setPassengerId($pass_id); $itinerary->setDateRequested(time()); $itinerary->setApointTime('unspecified'); $itinerary->setMissionTypeId($mission_type->getId()); $itinerary->setAgencyId($camp->getAgencyId()); $itinerary->setCancelItinerary(1); $itinerary->save(); // Mission 1 $mission1 = new Mission(); $mission1->setItineraryId($itinerary->getId()); $mission1->setCampId($camp->getId()); $mission1->setCancelMission(1); $mission1->setPassengerId($pass_id); $mission1->setMissionCount(1); $mission1->setDateRequested(time()); $mission1->setExternalId($this->getLatestExternalId()); $mission1->setMissionTypeId($mission_type->getId()); $mission1->save(); $camp_passenger->setReturnAirportId(NULL); // this indicates that return airport id would be camp airport id $camp_passenger->setAirportId($airport->getId()); $camp_passenger->setMissionId($mission1->getId()); $camp_passenger->save(); $mission1_leg1 = new MissionLeg(); $mission1_leg1->setFromAirportId($airport->getId()); $mission1_leg1->setLegNumber(1); $mission1_leg1->setMissionId($mission1->getId()); if ($camp_location) { $mission1_leg1->setToAirportId($camp_location->getId()); } else { $mission1_leg1->setToAirportId(NULL); } $mission1_leg1->setCancelMissionLeg(1); $mission1_leg1->save(); // Mission 2 $mission2 = new Mission(); $mission2->setItineraryId($itinerary->getId()); $mission2->setCampId($camp->getId()); $mission2->setCancelMission(1); $mission2->setPassengerId($pass_id); $mission2->setMissionCount(2); // From treatment to hme $mission2->setDateRequested(time()); $mission2->setExternalId($this->getLatestExternalId()); $mission2->setMissionTypeId($mission_type->getId()); $mission2->save(); $camp_passenger2 = new CampPassenger(); $camp_passenger2->setCampId($camp_id); $camp_passenger2->setPassengerId($pass_id); $camp_passenger2->setMissionId($mission2->getId()); $camp_passenger2->setAirportId(NULL); // this indicates that return airport id would be camp airport id $camp_passenger2->setReturnAirportId($airport->getId()); $camp_passenger2->setNote($note); $camp_passenger2->save(); $mission2_leg2 = new MissionLeg(); if ($camp_location) { $mission2_leg2->setFromAirportId($camp_location->getId()); } else { $mission2_leg2->setFromAirportId(NULL); } $mission2_leg2->setLegNumber(1); $mission2_leg2->setMissionId($mission2->getId()); $mission2_leg2->setToAirportId($airport->getId()); $mission2_leg2->setCancelMissionLeg(1); $mission2_leg2->save(); return $this->redirect('camp/view?id=' . $camp->getId()); }
/** * Selects a collection of Mission objects pre-filled with all related objects except Coordinator. * * @param Criteria $c * @param PropelPDO $con * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN * @return array Array of Mission objects. * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public static function doSelectJoinAllExceptCoordinator(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) { $c = clone $c; // Set the correct dbName if it has not been overridden // $c->getDbName() will return the same object if not set to another value // so == check is okay and faster if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } MissionPeer::addSelectColumns($c); $startcol2 = MissionPeer::NUM_COLUMNS - MissionPeer::NUM_LAZY_LOAD_COLUMNS; MissionRequestPeer::addSelectColumns($c); $startcol3 = $startcol2 + (MissionRequestPeer::NUM_COLUMNS - MissionRequestPeer::NUM_LAZY_LOAD_COLUMNS); ItineraryPeer::addSelectColumns($c); $startcol4 = $startcol3 + (ItineraryPeer::NUM_COLUMNS - ItineraryPeer::NUM_LAZY_LOAD_COLUMNS); MissionTypePeer::addSelectColumns($c); $startcol5 = $startcol4 + (MissionTypePeer::NUM_COLUMNS - MissionTypePeer::NUM_LAZY_LOAD_COLUMNS); PassengerPeer::addSelectColumns($c); $startcol6 = $startcol5 + (PassengerPeer::NUM_COLUMNS - PassengerPeer::NUM_LAZY_LOAD_COLUMNS); RequesterPeer::addSelectColumns($c); $startcol7 = $startcol6 + (RequesterPeer::NUM_COLUMNS - RequesterPeer::NUM_LAZY_LOAD_COLUMNS); AgencyPeer::addSelectColumns($c); $startcol8 = $startcol7 + (AgencyPeer::NUM_COLUMNS - AgencyPeer::NUM_LAZY_LOAD_COLUMNS); RequesterPeer::addSelectColumns($c); $startcol9 = $startcol8 + (RequesterPeer::NUM_COLUMNS - RequesterPeer::NUM_LAZY_LOAD_COLUMNS); AgencyPeer::addSelectColumns($c); $startcol10 = $startcol9 + (AgencyPeer::NUM_COLUMNS - AgencyPeer::NUM_LAZY_LOAD_COLUMNS); CampPeer::addSelectColumns($c); $startcol11 = $startcol10 + (CampPeer::NUM_COLUMNS - CampPeer::NUM_LAZY_LOAD_COLUMNS); $c->addJoin(array(MissionPeer::REQUEST_ID), array(MissionRequestPeer::ID), $join_behavior); $c->addJoin(array(MissionPeer::ITINERARY_ID), array(ItineraryPeer::ID), $join_behavior); $c->addJoin(array(MissionPeer::MISSION_TYPE_ID), array(MissionTypePeer::ID), $join_behavior); $c->addJoin(array(MissionPeer::PASSENGER_ID), array(PassengerPeer::ID), $join_behavior); $c->addJoin(array(MissionPeer::REQUESTER_ID), array(RequesterPeer::ID), $join_behavior); $c->addJoin(array(MissionPeer::AGENCY_ID), array(AgencyPeer::ID), $join_behavior); $c->addJoin(array(MissionPeer::OTHER_REQUESTER_ID), array(RequesterPeer::ID), $join_behavior); $c->addJoin(array(MissionPeer::OTHER_AGENCY_ID), array(AgencyPeer::ID), $join_behavior); $c->addJoin(array(MissionPeer::CAMP_ID), array(CampPeer::ID), $join_behavior); $stmt = BasePeer::doSelect($c, $con); $results = array(); while ($row = $stmt->fetch(PDO::FETCH_NUM)) { $key1 = MissionPeer::getPrimaryKeyHashFromRow($row, 0); if (null !== ($obj1 = MissionPeer::getInstanceFromPool($key1))) { // We no longer rehydrate the object, since this can cause data loss. // See http://propel.phpdb.org/trac/ticket/509 // $obj1->hydrate($row, 0, true); // rehydrate } else { $omClass = MissionPeer::getOMClass(); $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1); $obj1 = new $cls(); $obj1->hydrate($row); MissionPeer::addInstanceToPool($obj1, $key1); } // if obj1 already loaded // Add objects for joined MissionRequest rows $key2 = MissionRequestPeer::getPrimaryKeyHashFromRow($row, $startcol2); if ($key2 !== null) { $obj2 = MissionRequestPeer::getInstanceFromPool($key2); if (!$obj2) { $omClass = MissionRequestPeer::getOMClass(); $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1); $obj2 = new $cls(); $obj2->hydrate($row, $startcol2); MissionRequestPeer::addInstanceToPool($obj2, $key2); } // if $obj2 already loaded // Add the $obj1 (Mission) to the collection in $obj2 (MissionRequest) $obj2->addMission($obj1); } // if joined row is not null // Add objects for joined Itinerary rows $key3 = ItineraryPeer::getPrimaryKeyHashFromRow($row, $startcol3); if ($key3 !== null) { $obj3 = ItineraryPeer::getInstanceFromPool($key3); if (!$obj3) { $omClass = ItineraryPeer::getOMClass(); $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1); $obj3 = new $cls(); $obj3->hydrate($row, $startcol3); ItineraryPeer::addInstanceToPool($obj3, $key3); } // if $obj3 already loaded // Add the $obj1 (Mission) to the collection in $obj3 (Itinerary) $obj3->addMission($obj1); } // if joined row is not null // Add objects for joined MissionType rows $key4 = MissionTypePeer::getPrimaryKeyHashFromRow($row, $startcol4); if ($key4 !== null) { $obj4 = MissionTypePeer::getInstanceFromPool($key4); if (!$obj4) { $omClass = MissionTypePeer::getOMClass(); $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1); $obj4 = new $cls(); $obj4->hydrate($row, $startcol4); MissionTypePeer::addInstanceToPool($obj4, $key4); } // if $obj4 already loaded // Add the $obj1 (Mission) to the collection in $obj4 (MissionType) $obj4->addMission($obj1); } // if joined row is not null // Add objects for joined Passenger rows $key5 = PassengerPeer::getPrimaryKeyHashFromRow($row, $startcol5); if ($key5 !== null) { $obj5 = PassengerPeer::getInstanceFromPool($key5); if (!$obj5) { $omClass = PassengerPeer::getOMClass(); $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1); $obj5 = new $cls(); $obj5->hydrate($row, $startcol5); PassengerPeer::addInstanceToPool($obj5, $key5); } // if $obj5 already loaded // Add the $obj1 (Mission) to the collection in $obj5 (Passenger) $obj5->addMission($obj1); } // if joined row is not null // Add objects for joined Requester rows $key6 = RequesterPeer::getPrimaryKeyHashFromRow($row, $startcol6); if ($key6 !== null) { $obj6 = RequesterPeer::getInstanceFromPool($key6); if (!$obj6) { $omClass = RequesterPeer::getOMClass(); $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1); $obj6 = new $cls(); $obj6->hydrate($row, $startcol6); RequesterPeer::addInstanceToPool($obj6, $key6); } // if $obj6 already loaded // Add the $obj1 (Mission) to the collection in $obj6 (Requester) $obj6->addMissionRelatedByRequesterId($obj1); } // if joined row is not null // Add objects for joined Agency rows $key7 = AgencyPeer::getPrimaryKeyHashFromRow($row, $startcol7); if ($key7 !== null) { $obj7 = AgencyPeer::getInstanceFromPool($key7); if (!$obj7) { $omClass = AgencyPeer::getOMClass(); $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1); $obj7 = new $cls(); $obj7->hydrate($row, $startcol7); AgencyPeer::addInstanceToPool($obj7, $key7); } // if $obj7 already loaded // Add the $obj1 (Mission) to the collection in $obj7 (Agency) $obj7->addMissionRelatedByAgencyId($obj1); } // if joined row is not null // Add objects for joined Requester rows $key8 = RequesterPeer::getPrimaryKeyHashFromRow($row, $startcol8); if ($key8 !== null) { $obj8 = RequesterPeer::getInstanceFromPool($key8); if (!$obj8) { $omClass = RequesterPeer::getOMClass(); $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1); $obj8 = new $cls(); $obj8->hydrate($row, $startcol8); RequesterPeer::addInstanceToPool($obj8, $key8); } // if $obj8 already loaded // Add the $obj1 (Mission) to the collection in $obj8 (Requester) $obj8->addMissionRelatedByOtherRequesterId($obj1); } // if joined row is not null // Add objects for joined Agency rows $key9 = AgencyPeer::getPrimaryKeyHashFromRow($row, $startcol9); if ($key9 !== null) { $obj9 = AgencyPeer::getInstanceFromPool($key9); if (!$obj9) { $omClass = AgencyPeer::getOMClass(); $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1); $obj9 = new $cls(); $obj9->hydrate($row, $startcol9); AgencyPeer::addInstanceToPool($obj9, $key9); } // if $obj9 already loaded // Add the $obj1 (Mission) to the collection in $obj9 (Agency) $obj9->addMissionRelatedByOtherAgencyId($obj1); } // if joined row is not null // Add objects for joined Camp rows $key10 = CampPeer::getPrimaryKeyHashFromRow($row, $startcol10); if ($key10 !== null) { $obj10 = CampPeer::getInstanceFromPool($key10); if (!$obj10) { $omClass = CampPeer::getOMClass(); $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1); $obj10 = new $cls(); $obj10->hydrate($row, $startcol10); CampPeer::addInstanceToPool($obj10, $key10); } // if $obj10 already loaded // Add the $obj1 (Mission) to the collection in $obj10 (Camp) $obj10->addMission($obj1); } // if joined row is not null $results[] = $obj1; } $stmt->closeCursor(); return $results; }
?> <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(); ?>
/** * Searches for missions by filter */ private function processFilter(sfWebRequest $request) { $params = $this->getUser()->getAttribute('emailQueueList', array(), 'person'); if (!isset($params['subject'])) { $params['subject'] = null; } if (!isset($params['priority'])) { $params['priority'] = null; } if (!isset($params['request_date'])) { $params['request_date'] = null; } if (!isset($params['send_date'])) { $params['send_date'] = null; } $this->max_array = array(5, 10, 20, 30); $this->types = MissionTypePeer::getOnlyNames(); if (in_array($request->getParameter('max'), $this->max_array)) { $params['max'] = $request->getParameter('max'); } else { if (!isset($params['max'])) { $params['max'] = sfConfig::get('app_max_person_per_page', 10); } } if ($request->hasParameter('filter')) { $params['subject'] = $request->getParameter('subject'); $params['priority'] = $request->getParameter('priority'); $params['request_date'] = $request->getParameter('request_date'); $params['send_date'] = $request->getParameter('send_date'); } $this->page = $page = $request->getParameter('page', 1); $this->max = $params['max']; $this->subject = $params['subject']; $this->request_date = $params['request_date']; $this->send_date = $params['send_date']; $this->priority = $params['priority']; $this->getUser()->setAttribute('emailQueueList', $params, 'person'); }
public function configure() { unset($this['external_id'], $this['request_id'], $this['itinerary_id'], $this['other_requester_id'], $this['other_agency_id']); $miss_types = MissionTypePeer::getNames(); //$passes = PassengerPeer::getForSelectParent(); //$reqs = RequesterPeer::getForSelectParent(); //$agencies = AgencyPeer::getForSelectParent(); //$camps = CampPeer::getForSelectParent(); $coors = CoordinatorPeer::getForSelectParent(); //return person_id # Fields $this->widgetSchema['mission_type_id'] = new sfWidgetFormSelect(array('choices' => $miss_types)); $this->widgetSchema['mission_date'] = new widgetFormDate(array('change_year' => true, 'change_month' => true, 'format_date' => array('js' => 'mm/dd/yy', 'php' => 'm/d/Y')), array('class' => 'text narrow')); $this->widgetSchema['date_requested'] = new sfWidgetFormInput(array(), array('class' => 'text', 'class' => 'text narrow')); //$this->widgetSchema['passenger_id'] = new sfWidgetFormSelect(array('choices'=>$passes)); // $this->widgetSchema['requester_id'] = new sfWidgetFormSelect(array('choices'=>$reqs)); // $this->widgetSchema['agency_id'] = new sfWidgetFormSelect(array('choices'=>$agencies)); // $this->widgetSchema['camp_id'] = new sfWidgetFormSelect(array('choices'=>$camps)); $this->widgetSchema['coordinator_id'] = new sfWidgetFormSelect(array('choices' => $coors)); $this->widgetSchema['appt_date'] = new widgetFormDate(array('change_year' => true, 'change_month' => true, 'format_date' => array('js' => 'mm/dd/yy', 'php' => 'm/d/Y')), array('class' => 'text narrow')); $this->widgetSchema['flight_time'] = new sfWidgetFormInput(array(), array('class' => 'text narrow')); $this->widgetSchema['treatment'] = new sfWidgetFormInput(array(), array('class' => 'text narrow')); $this->widgetSchema['comment'] = new sfWidgetFormInput(array(), array('class' => 'text narrow')); $this->widgetSchema['appointment'] = new sfWidgetFormInput(array(), array('class' => 'text narrow')); $this->widgetSchema['mission_specific_comments'] = new sfWidgetFormTextarea(array(), array('class' => 'text')); $this->widgetSchema['cancel_mission'] = new sfWidgetFormChoice(array('choices' => array("cancel", "activate"), 'expanded' => true)); # Labels $this->widgetSchema->setLabels(array('mission_type_id' => 'Mission type')); $this->widgetSchema->setLabels(array('mission_date' => 'Mission Date')); $this->widgetSchema->setLabels(array('date_requested' => 'Date Requested')); //$this->widgetSchema->setLabels(array('passenger_id' => 'Passenger')); //$this->widgetSchema->setLabels(array('requester_id' => 'Requester')); // $this->widgetSchema->setLabels(array('agency_id' => 'Agency')); //$this->widgetSchema->setLabels(array('camp_id' => 'Camp')); $this->widgetSchema->setLabels(array('coordinator_id' => 'Coordinator')); $this->widgetSchema->setLabels(array('appt_date' => 'Appointment Date')); $this->widgetSchema->setLabels(array('flight_time' => 'Flight Time')); $this->widgetSchema->setLabels(array('treatment' => 'Treatment')); $this->widgetSchema->setLabels(array('comment' => 'Comment')); $this->widgetSchema->setLabels(array('appointment' => 'Appointment')); $this->widgetSchema->setLabels(array('mission_specific_comments' => 'Specific Comment')); $this->widgetSchema->setLabels(array('cancel_mission' => 'Cancel Mission')); # Validation $this->validatorSchema['mission_type_id'] = new sfValidatorString(array('required' => true), array('required' => 'Please choice Mission Type !')); $this->validatorSchema['mission_date'] = new sfValidatorString(array('required' => false)); $this->validatorSchema['date_requested'] = new sfValidatorString(array('required' => true), array('required' => 'Please confirm date requested !')); //$this->validatorSchema['passenger_id'] = new sfValidatorInteger(array('required' => false)); //$this->validatorSchema['requester_id'] = new sfValidatorInteger(array('required' => false)); // $this->validatorSchema['agency_id'] = new sfValidatorInteger(array('required' => false)); //$this->validatorSchema['camp_id'] = new sfValidatorInteger(array('required' => false)); $this->validatorSchema['coordinator_id'] = new sfValidatorInteger(array('required' => false)); $this->validatorSchema['appt_date'] = new sfValidatorDate(array('required' => false), array('invalid' => 'Date of birth is invalid !.')); $this->validatorSchema['flight_time'] = new sfValidatorString(array('required' => false)); $this->validatorSchema['treatment'] = new sfValidatorString(array('required' => false)); $this->validatorSchema['comment'] = new sfValidatorString(array('required' => false)); $this->validatorSchema['appointment'] = new sfValidatorString(array('required' => false)); $this->validatorSchema['mission_specific_comments'] = new sfValidatorString(array('required' => false)); $this->validatorSchema['cancel_mission'] = new sfValidatorInteger(array('required' => false)); # Descriptive message $this->widgetSchema->setNameFormat('mission_edit[%s]'); $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema); }
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 }
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'; }
/** * 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; }
public static function doSelectJoinCustom(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) { foreach (sfMixer::getCallables('MissionPeer:doSelectJoinCustom:doSelectJoinCustom') as $callable) { call_user_func($callable, 'MissionPeer', $c, $con); } $c = clone $c; // Set the correct dbName if it has not been overridden if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } MissionPeer::addSelectColumns($c); $startcol2 = MissionPeer::NUM_COLUMNS - MissionPeer::NUM_LAZY_LOAD_COLUMNS; ItineraryPeer::addSelectColumns($c); $startcol3 = $startcol2 + (ItineraryPeer::NUM_COLUMNS - ItineraryPeer::NUM_LAZY_LOAD_COLUMNS); MissionTypePeer::addSelectColumns($c); $startcol4 = $startcol3 + (MissionTypePeer::NUM_COLUMNS - MissionTypePeer::NUM_LAZY_LOAD_COLUMNS); PassengerPeer::addSelectColumns($c); $startcol5 = $startcol4 + (PassengerPeer::NUM_COLUMNS - PassengerPeer::NUM_LAZY_LOAD_COLUMNS); MissionLegPeer::addSelectColumns($c); $startcol6 = $startcol5 + (MissionLegPeer::NUM_COLUMNS - MissionLegPeer::NUM_LAZY_LOAD_COLUMNS); $c->addJoin(array(MissionPeer::ITINERARY_ID), array(ItineraryPeer::ID), $join_behavior); $c->addJoin(array(MissionPeer::MISSION_TYPE_ID), array(MissionTypePeer::ID), $join_behavior); $c->addJoin(array(MissionPeer::PASSENGER_ID), array(PassengerPeer::ID), $join_behavior); $c->addJoin(array(MissionPeer::ID), array(MissionLegPeer::MISSION_ID), $join_behavior); $stmt = BasePeer::doSelect($c, $con); $results = array(); while ($row = $stmt->fetch(PDO::FETCH_NUM)) { $key1 = MissionPeer::getPrimaryKeyHashFromRow($row, 0); if (null !== ($obj1 = MissionPeer::getInstanceFromPool($key1))) { // We no longer rehydrate the object, since this can cause data loss. // See http://propel.phpdb.org/trac/ticket/509 // $obj1->hydrate($row, 0, true); // rehydrate } else { $omClass = MissionPeer::getOMClass(); $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1); $obj1 = new $cls(); $obj1->hydrate($row); MissionPeer::addInstanceToPool($obj1, $key1); } // if obj1 already loaded // Add objects for joined Itinerary rows $key2 = ItineraryPeer::getPrimaryKeyHashFromRow($row, $startcol2); if ($key2 !== null) { $obj2 = ItineraryPeer::getInstanceFromPool($key2); if (!$obj2) { $omClass = ItineraryPeer::getOMClass(); $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1); $obj2 = new $cls(); $obj2->hydrate($row, $startcol2); ItineraryPeer::addInstanceToPool($obj2, $key2); } // if obj2 loaded // Add the $obj1 (Mission) to the collection in $obj3 (Itinerary) $obj2->addMission($obj1); } // if joined row not null // Add objects for joined MissionType rows $key3 = MissionTypePeer::getPrimaryKeyHashFromRow($row, $startcol3); if ($key3 !== null) { $obj3 = MissionTypePeer::getInstanceFromPool($key3); if (!$obj3) { $omClass = MissionTypePeer::getOMClass(); $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1); $obj3 = new $cls(); $obj3->hydrate($row, $startcol3); MissionTypePeer::addInstanceToPool($obj3, $key3); } // if obj3 loaded // Add the $obj1 (Mission) to the collection in $obj3 (MissionType) $obj3->addMission($obj1); } // if joined row not null // Add objects for joined Passenger rows $key4 = PassengerPeer::getPrimaryKeyHashFromRow($row, $startcol4); if ($key4 !== null) { $obj4 = PassengerPeer::getInstanceFromPool($key4); if (!$obj4) { $omClass = PassengerPeer::getOMClass(); $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1); $obj4 = new $cls(); $obj4->hydrate($row, $startcol4); PassengerPeer::addInstanceToPool($obj4, $key4); } // if obj4 loaded // Add the $obj1 (Mission) to the collection in $obj4 (Passenger) $obj4->addMission($obj1); } // if joined row not null // Add objects for joined MissionLeg rows $key5 = MissionLegPeer::getPrimaryKeyHashFromRow($row, $startcol5); if ($key5 !== null) { $obj5 = MissionLegPeer::getInstanceFromPool($key5); if (!$obj5) { $omClass = MissionLegPeer::getOMClass(); $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1); $obj5 = new $cls(); $obj5->hydrate($row, $startcol5); MissionLegPeer::addInstanceToPool($obj5, $key5); } // if obj5 loaded // Add the $obj1 (Mission) to the collection in $obj5 (MissionLeg) $obj5->setMission($obj1); } // if joined row not null $results[] = $obj1; } $stmt->closeCursor(); return $results; }
foreach ($mission_list as $miss) { ?> <tr> <td class="cell-1"> <?php if ($miss->getApptDate()) { echo $miss->getApptDate('m/d/y'); } ?> </td> <td class="cell-2"> <?php if ($miss->getMissionTypeId()) { ?> <?php $type = MissionTypePeer::retrieveByPK($miss->getMissionTypeId()); if ($type) { echo $type->getName(); } ?> <?php } ?> </td> <td class="cell-1"> <?php if ($miss->getRequesterId()) { ?> <?php $requester = RequesterPeer::retrieveByPK($miss->getRequesterId()); ?>
private function processFilterVisual(sfWebRequest $request) { $params = $this->getUser()->getAttribute('missionvisual', array(), 'person'); if (!isset($params['miss_type'])) { $params['miss_type'] = null; } if (!isset($params['miss_date1'])) { $params['miss_date1'] = null; } if (!isset($params['miss_date2'])) { $params['miss_date2'] = null; } if (!isset($params['orgin_airport'])) { $params['orgin_airport'] = null; } if (!isset($params['dest_airport'])) { $params['dest_airport'] = null; } $this->types = MissionTypePeer::getOnlyNames(); if ($request->hasParameter('filter')) { $params['miss_type'] = in_array($request->getParameter('miss_type'), array_keys($this->types)) ? $request->getParameter('miss_type') : ''; $params['miss_date1'] = $request->getParameter('miss_date1'); $params['miss_date2'] = $request->getParameter('miss_date2'); $params['orgin_airport'] = $request->getParameter('orgin_airport'); $params['dest_airport'] = $request->getParameter('dest_airport'); } $this->miss_type = $params['miss_type']; $this->miss_date1 = $params['miss_date1']; $this->miss_date2 = $params['miss_date2']; $this->orgin_airport = $params['orgin_airport']; $this->dest_airport = $params['dest_airport']; $this->getUser()->setAttribute('missionvisual', $params, 'person'); }