Exemple #1
0
 /**
  * Gets an array of MissionLeg 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 MissionReport has previously been saved, it will retrieve
  * related MissionLegs from storage. If this MissionReport 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 MissionLeg[]
  * @throws     PropelException
  */
 public function getMissionLegs($criteria = null, PropelPDO $con = null)
 {
     if ($criteria === null) {
         $criteria = new Criteria(MissionReportPeer::DATABASE_NAME);
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collMissionLegs === null) {
         if ($this->isNew()) {
             $this->collMissionLegs = array();
         } else {
             $criteria->add(MissionLegPeer::MISSION_REPORT_ID, $this->id);
             MissionLegPeer::addSelectColumns($criteria);
             $this->collMissionLegs = MissionLegPeer::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(MissionLegPeer::MISSION_REPORT_ID, $this->id);
             MissionLegPeer::addSelectColumns($criteria);
             if (!isset($this->lastMissionLegCriteria) || !$this->lastMissionLegCriteria->equals($criteria)) {
                 $this->collMissionLegs = MissionLegPeer::doSelect($criteria, $con);
             }
         }
     }
     $this->lastMissionLegCriteria = $criteria;
     return $this->collMissionLegs;
 }
Exemple #2
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());
 }
Exemple #3
0
 /**
  * Gets an array of MissionLeg 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 Member has previously been saved, it will retrieve
  * related MissionLegsRelatedByBackupCopilotId from storage. If this Member 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 MissionLeg[]
  * @throws     PropelException
  */
 public function getMissionLegsRelatedByBackupCopilotId($criteria = null, PropelPDO $con = null)
 {
     if ($criteria === null) {
         $criteria = new Criteria(MemberPeer::DATABASE_NAME);
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collMissionLegsRelatedByBackupCopilotId === null) {
         if ($this->isNew()) {
             $this->collMissionLegsRelatedByBackupCopilotId = array();
         } else {
             $criteria->add(MissionLegPeer::BACKUP_COPILOT_ID, $this->id);
             MissionLegPeer::addSelectColumns($criteria);
             $this->collMissionLegsRelatedByBackupCopilotId = MissionLegPeer::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(MissionLegPeer::BACKUP_COPILOT_ID, $this->id);
             MissionLegPeer::addSelectColumns($criteria);
             if (!isset($this->lastMissionLegRelatedByBackupCopilotIdCriteria) || !$this->lastMissionLegRelatedByBackupCopilotIdCriteria->equals($criteria)) {
                 $this->collMissionLegsRelatedByBackupCopilotId = MissionLegPeer::doSelect($criteria, $con);
             }
         }
     }
     $this->lastMissionLegRelatedByBackupCopilotIdCriteria = $criteria;
     return $this->collMissionLegsRelatedByBackupCopilotId;
 }
 /**
  * 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(MissionLegPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     }
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria(MissionLegPeer::DATABASE_NAME);
         $criteria->add(MissionLegPeer::ID, $pks, Criteria::IN);
         $objs = MissionLegPeer::doSelect($criteria, $con);
     }
     return $objs;
 }