/**
  * Selects a collection of CampPassenger objects pre-filled with all related objects except Passenger.
  *
  * @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 CampPassenger objects.
  * @throws     PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function doSelectJoinAllExceptPassenger(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);
     }
     CampPassengerPeer::addSelectColumns($c);
     $startcol2 = CampPassengerPeer::NUM_COLUMNS - CampPassengerPeer::NUM_LAZY_LOAD_COLUMNS;
     CampPeer::addSelectColumns($c);
     $startcol3 = $startcol2 + (CampPeer::NUM_COLUMNS - CampPeer::NUM_LAZY_LOAD_COLUMNS);
     $c->addJoin(array(CampPassengerPeer::CAMP_ID), array(CampPeer::ID), $join_behavior);
     $stmt = BasePeer::doSelect($c, $con);
     $results = array();
     while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
         $key1 = CampPassengerPeer::getPrimaryKeyHashFromRow($row, 0);
         if (null !== ($obj1 = CampPassengerPeer::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 = CampPassengerPeer::getOMClass();
             $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
             $obj1 = new $cls();
             $obj1->hydrate($row);
             CampPassengerPeer::addInstanceToPool($obj1, $key1);
         }
         // if obj1 already loaded
         // Add objects for joined Camp rows
         $key2 = CampPeer::getPrimaryKeyHashFromRow($row, $startcol2);
         if ($key2 !== null) {
             $obj2 = CampPeer::getInstanceFromPool($key2);
             if (!$obj2) {
                 $omClass = CampPeer::getOMClass();
                 $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
                 $obj2 = new $cls();
                 $obj2->hydrate($row, $startcol2);
                 CampPeer::addInstanceToPool($obj2, $key2);
             }
             // if $obj2 already loaded
             // Add the $obj1 (CampPassenger) to the collection in $obj2 (Camp)
             $obj2->addCampPassenger($obj1);
         }
         // if joined row is not null
         $results[] = $obj1;
     }
     $stmt->closeCursor();
     return $results;
 }
Exemple #2
0
 /**
  * If this collection has already been initialized with
  * an identical criteria, it returns the collection.
  * Otherwise if this Agency is new, it will return
  * an empty collection; or if this Agency has previously
  * been saved, it will retrieve related Camps from storage.
  *
  * This method is protected by default in order to keep the public
  * api reasonable.  You can provide public methods for those you
  * actually need in Agency.
  */
 public function getCampsJoinFbo($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
 {
     if ($criteria === null) {
         $criteria = new Criteria(AgencyPeer::DATABASE_NAME);
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collCamps === null) {
         if ($this->isNew()) {
             $this->collCamps = array();
         } else {
             $criteria->add(CampPeer::AGENCY_ID, $this->id);
             $this->collCamps = CampPeer::doSelectJoinFbo($criteria, $con, $join_behavior);
         }
     } else {
         // 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(CampPeer::AGENCY_ID, $this->id);
         if (!isset($this->lastCampCriteria) || !$this->lastCampCriteria->equals($criteria)) {
             $this->collCamps = CampPeer::doSelectJoinFbo($criteria, $con, $join_behavior);
         }
     }
     $this->lastCampCriteria = $criteria;
     return $this->collCamps;
 }
<?php

$mission = $mission_leg->getMission();
$passenger = $mission->getPassenger();
// Camp information
if ($mission->getCampId()) {
    $camp = CampPeer::retrieveByPK($mission->getCampId());
}
// Passenger Information
$pass_person = PersonPeer::retrieveByPK($passenger->getPersonId());
//Requester
$requester = RequesterPeer::retrieveByPK($mission->getRequesterId());
$req_person = PersonPeer::retrieveByPK($requester->getPersonId());
$req_passenger = PassengerPeer::getByPersonId($requester->getPersonId());
//Mission Coordinator
if ($mission->getCoordinatorId()) {
    $misscoordinator = CoordinatorPeer::retrieveByPK($mission->getCoordinatorId());
    if ($misscoordinator->getMemberId()) {
        $missCoordiPerson = PersonPeer::retrieveByPK($misscoordinator->getMember()->getPersonId());
    }
}
//Coordinator
if ($mission_leg->getCoordinatorId()) {
    $coordinator = CoordinatorPeer::retrieveByPK($mission_leg->getCoordinatorId());
    if ($coordinator->getMemberId()) {
        $coordiPerson = PersonPeer::retrieveByPK($coordinator->getMember()->getPersonId());
    }
}
$baggageWeight = $mission_leg->getBaggageWeight();
$baggageDesc = $mission_leg->getBaggageDesc();
if ($mission_leg->getFboId()) {
Exemple #4
0
 /**
  * Get the associated Camp object
  *
  * @param      PropelPDO Optional Connection object.
  * @return     Camp The associated Camp object.
  * @throws     PropelException
  */
 public function getCamp(PropelPDO $con = null)
 {
     if ($this->aCamp === null && $this->group_camp_id !== null) {
         $c = new Criteria(CampPeer::DATABASE_NAME);
         $c->add(CampPeer::ID, $this->group_camp_id);
         $this->aCamp = CampPeer::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->aCamp->addPilotRequests($this);
         		 */
     }
     return $this->aCamp;
 }
Exemple #5
0
 /**
  * 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 = CampPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setId($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setAgencyId($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setAirportId($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setFboId($arr[$keys[3]]);
     }
     if (array_key_exists($keys[4], $arr)) {
         $this->setCampName($arr[$keys[4]]);
     }
     if (array_key_exists($keys[5], $arr)) {
         $this->setCampPhone($arr[$keys[5]]);
     }
     if (array_key_exists($keys[6], $arr)) {
         $this->setSession($arr[$keys[6]]);
     }
     if (array_key_exists($keys[7], $arr)) {
         $this->setCampPhoneComment($arr[$keys[7]]);
     }
     if (array_key_exists($keys[8], $arr)) {
         $this->setLodgingName($arr[$keys[8]]);
     }
     if (array_key_exists($keys[9], $arr)) {
         $this->setLodgingPhone($arr[$keys[9]]);
     }
     if (array_key_exists($keys[10], $arr)) {
         $this->setLodgingPhoneComment($arr[$keys[10]]);
     }
     if (array_key_exists($keys[11], $arr)) {
         $this->setArrivalDate($arr[$keys[11]]);
     }
     if (array_key_exists($keys[12], $arr)) {
         $this->setArrivalComment($arr[$keys[12]]);
     }
     if (array_key_exists($keys[13], $arr)) {
         $this->setDepartureDate($arr[$keys[13]]);
     }
     if (array_key_exists($keys[14], $arr)) {
         $this->setDepartureComment($arr[$keys[14]]);
     }
     if (array_key_exists($keys[15], $arr)) {
         $this->setComment($arr[$keys[15]]);
     }
     if (array_key_exists($keys[16], $arr)) {
         $this->setGroupedMission($arr[$keys[16]]);
     }
     if (array_key_exists($keys[17], $arr)) {
         $this->setFlightInformation($arr[$keys[17]]);
     }
 }
Exemple #6
0
 public function executeAutoComplete_1(sfWebRequest $request)
 {
     $this->name = $this->getRequestParameter('camp');
     $this->camps = CampPeer::getByName($this->name);
 }
Exemple #7
0
 /**
  * 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;
 }
Exemple #8
0
 /**
  * Agency delete 
  * Check related records and if noting has related it will deleted
  * CODE:airport_delete
  */
 public function executeDelete(sfWebRequest $request)
 {
     # security
     if (!$this->getUser()->hasCredential(array('Administrator'), false)) {
         $this->getUser()->setFlash("warning", 'You don\'t have permission to access this url ' . $request->getReferer());
         $this->redirect('dashboard/index');
     }
     if ($request->isMethod('post')) {
         $this->airport = AirportPeer::retrieveByPK($request->getParameter('id'));
         $is_in_camp = CampPeer::getByAirportId($this->airport->getId());
         $is_in_fbo = FboPeer::getByAirportId($this->airport->getId());
         $is_in_pilot = PilotPeer::getByAirportId($this->airport->getId());
         if ($this->airport->getWingId() || $is_in_camp || $is_in_fbo || $is_in_pilot) {
             if ($is_in_camp) {
                 $reason = 'Camp';
             } elseif ($is_in_fbo) {
                 $reason = 'FBO';
             } elseif ($is_in_pilot) {
                 $reason = 'Pilot';
             }
             $this->getUser()->setFlash('success', 'Can not delete the airport! There is using data in the  ' . $reason . '.');
         } else {
             $this->forward404Unless($this->airport);
             $this->getUser()->setFlash('success', 'Airport information has been successfully deleted!');
             $this->airport->delete();
         }
     }
     return $this->redirect('@airport');
 }
Exemple #9
0
 public function executeIndex(sfWebRequest $request)
 {
     $text = $request->getParameter('search_by');
     $this->results = array();
     $this->messages = array();
     $this->uris = array();
     //person search
     if ($this->getUser()->hasRights('person_index')) {
         $c = new Criteria();
         $c1 = $c->getNewCriterion(PersonPeer::FIRST_NAME, $text . '%', Criteria::LIKE);
         $c2 = $c->getNewCriterion(PersonPeer::LAST_NAME, $text . '%', Criteria::LIKE);
         //$c->setDistinct(PersonPeer::FIRST_NAME);
         //$c->setDistinct(PersonPeer::LAST_NAME);
         $c->add($c1->addOr($c2));
         $this->results['person'] = PersonPeer::doCount($c);
         $this->messages['person'] = ' person results';
         $this->uris['person'] = 'person/index?filter=1&findperson=1&firstname=' . $text;
     }
     //passenger search
     if ($this->getUser()->hasRights('passenger_index')) {
         $c = new Criteria();
         $c->addJoin(PassengerPeer::PERSON_ID, PersonPeer::ID, Criteria::LEFT_JOIN);
         $c->add(PersonPeer::FIRST_NAME, $text . '%', Criteria::LIKE);
         $this->results['passenger'] = PassengerPeer::doCount($c);
         $this->messages['passenger'] = ' passenger results';
         $this->uris['passenger'] = 'passenger/index?filter=1&firstname=' . $text;
     }
     //companion search
     if ($this->getUser()->hasRights('companion_index')) {
         $c = new Criteria();
         $c->add(CompanionPeer::NAME, $text . '%', Criteria::LIKE);
         $this->results['companion'] = CompanionPeer::doCount($c);
         $this->messages['companion'] = ' companion results';
         $this->uris['companion'] = 'companion/index?filter=1&name=' . $text;
     }
     //mission search
     if ($this->getUser()->hasRights('mission_index')) {
         $c = new Criteria();
         if (is_numeric($text)) {
             $c->add(MissionPeer::ID, $text . '%', Criteria::LIKE);
             $this->results['mission'] = MissionPeer::doCount($c);
             $this->uris['mission'] = 'mission/index?filter=1&miss_id=' . $text;
         } else {
             $c->addJoin(MissionPeer::PASSENGER_ID, PassengerPeer::ID, Criteria::LEFT_JOIN);
             $c->addJoin(PassengerPeer::PERSON_ID, PersonPeer::ID, Criteria::LEFT_JOIN);
             $c->add(PersonPeer::FIRST_NAME, $text . '%', Criteria::LIKE);
             $this->results['mission'] = MissionPeer::doCount($c);
             $this->uris['mission'] = 'mission/index?filter=1&pass_fname=' . $text;
         }
         $this->messages['mission'] = ' mission results';
     }
     //leg search
     if ($this->getUser()->hasRights('leg_index')) {
         $c = new Criteria();
         $c->addJoin(MissionLegPeer::MISSION_ID, MissionPeer::ID, Criteria::LEFT_JOIN);
         $c->addJoin(MissionPeer::PASSENGER_ID, PassengerPeer::ID, Criteria::LEFT_JOIN);
         $c->addJoin(PassengerPeer::PERSON_ID, PersonPeer::ID, Criteria::LEFT_JOIN);
         $c->add(PersonPeer::FIRST_NAME, $text . '%', Criteria::LIKE);
         $this->results['leg'] = MissionLegPeer::doCount($c);
         $this->messages['leg'] = ' mission leg results';
         $this->uris['leg'] = 'missionLeg/index?filter=1&pass_fname=' . $text;
     }
     //requester search
     if ($this->getUser()->hasRights('requester_index')) {
         $c = new Criteria();
         $c->addJoin(RequesterPeer::PERSON_ID, PersonPeer::ID, Criteria::LEFT_JOIN);
         $c->add(PersonPeer::FIRST_NAME, $text . '%', Criteria::LIKE);
         $this->results['requester'] = RequesterPeer::doCount($c);
         $this->messages['requester'] = ' requester results';
         $this->uris['requester'] = 'requester/index?filter=1&firstname=' . $text;
     }
     //agency search
     if ($this->getUser()->hasRights('agency_index')) {
         $c = new Criteria();
         $c->add(AgencyPeer::NAME, $text . '%', Criteria::LIKE);
         $this->results['agency'] = AgencyPeer::doCount($c);
         $this->messages['agency'] = ' agency results';
         $this->uris['agency'] = 'agency/index?filter=1&name=' . $text;
     }
     //coordinator search
     if ($this->getUser()->hasRights('coordinator_index')) {
         $c = new Criteria();
         $c->addJoin(CoordinatorPeer::MEMBER_ID, MemberPeer::ID);
         $c->addJoin(PersonPeer::ID, MemberPeer::PERSON_ID);
         $c->add(PersonPeer::FIRST_NAME, $text . '%', Criteria::LIKE);
         $this->results['coordinator'] = CoordinatorPeer::doCount($c);
         $this->messages['coordinator'] = ' coordinator results';
         $this->uris['coordinator'] = 'coordinator/index?filter=1&firstname=' . $text;
     }
     //camp search
     if ($this->getUser()->hasRights('camp_index')) {
         $c = new Criteria();
         $c->add(CampPeer::CAMP_NAME, $text . '%', Criteria::LIKE);
         $this->results['camp'] = CampPeer::doCount($c);
         $this->messages['camp'] = ' camp results';
         $this->uris['camp'] = 'camp/index?filter=1&camp_name=' . $text;
     }
     //airport search
     if ($this->getUser()->hasRights('airport_index')) {
         $c = new Criteria();
         $c->add(AirportPeer::NAME, $text . '%', Criteria::LIKE);
         $this->results['airport'] = AirportPeer::doCount($c);
         $this->messages['airport'] = ' airport results';
         $this->uris['airport'] = 'airport/index?filter=1&name=' . $text;
     }
     //member search
     if ($this->getUser()->hasRights('member_index')) {
         $c = new Criteria();
         if (is_numeric($text)) {
             $c->add(MemberPeer::ID, $text . '%', Criteria::LIKE);
             $this->results['member'] = MemberPeer::doCount($c);
             $this->uris['member'] = 'member/index?filter=1&member_id=' . $text;
         } else {
             $c->addJoin(MemberPeer::PERSON_ID, PersonPeer::ID, Criteria::LEFT_JOIN);
             $c->add(PersonPeer::FIRST_NAME, $text . '%', Criteria::LIKE);
             $this->results['member'] = MemberPeer::doCount($c);
             $this->uris['member'] = 'member/index?filter=1&firstname=' . $text;
         }
         $this->messages['member'] = ' member results';
     }
     //pilot search
     if ($this->getUser()->hasRights('pilot_index')) {
         $c = new Criteria();
         $c->addJoin(PilotPeer::MEMBER_ID, MemberPeer::ID, Criteria::LEFT_JOIN);
         $c->addJoin(MemberPeer::PERSON_ID, PersonPeer::ID, Criteria::LEFT_JOIN);
         $c->add(PersonPeer::FIRST_NAME, $text . '%', Criteria::LIKE);
         $this->results['pilot'] = PilotPeer::doCount($c);
         $this->messages['pilot'] = ' pilot results';
         $this->uris['pilot'] = 'pilot/index?filter=1&firstname=' . $text;
     }
     //pilot request search
     if ($this->getUser()->hasRights('mission_available_list')) {
         $c = new Criteria();
         if ($text) {
             $c->add(PilotRequestPeer::DATE, date('Y-m-d', strtotime($text)), Criteria::GREATER_EQUAL);
         }
         $this->results['pilotRequest'] = PilotRequestPeer::doCount($c);
         $this->messages['pilotRequest'] = ' pilot request results';
         $this->uris['pilotRequest'] = 'pilotRequest/index?filter=1&req_date2=' . $text;
     }
     //mission request search
     if ($this->getUser()->hasRights('mission_request_index')) {
         $c = new Criteria();
         if ($text) {
             $c->add(MissionRequestPeer::REQUESTER_DATE, date('Y-m-d', strtotime($text)), Criteria::GREATER_EQUAL);
         }
         $this->results['missionRequest'] = MissionRequestPeer::doCount($c);
         $this->messages['missionRequest'] = ' missionRequest results';
         $this->uris['missionRequest'] = 'missionRequest/index?filter=1&request_date2=' . $text;
     }
     //mission report search
     if ($this->getUser()->hasRights('mission_report_review')) {
         $c = new Criteria();
         $c->add(MissionReportPeer::COPILOT_NAME, $text . '%', Criteria::LIKE);
         $this->results['missionReport'] = MissionReportPeer::doCount($c);
         $this->messages['missionReport'] = ' missionReport results';
         $this->uris['missionReport'] = 'mission_report/review?filter=1&pilot_name=' . $text;
     }
     //role search
     if (1 == 1) {
         $c = new Criteria();
         if (isset($text)) {
             $c->add(RolePeer::TITLE, $text . '%', Criteria::LIKE);
         }
         $this->results['role'] = RolePeer::doCount($c);
         $this->messages['role'] = ' role results';
         $this->uris['role'] = 'role_permission/index?search_by=' . $text;
     }
     $this->text = $text;
 }
Exemple #10
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(CampPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     }
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria(CampPeer::DATABASE_NAME);
         $criteria->add(CampPeer::ID, $pks, Criteria::IN);
         $objs = CampPeer::doSelect($criteria, $con);
     }
     return $objs;
 }
Exemple #11
0
 public function executePrintMissionLeg(sfWebRequest $request)
 {
     #Security
     if (!$this->getUser()->hasCredential(array('Administrator', 'Staff', 'Coordinator'), false)) {
         $this->getUser()->setFlash("warning", 'You don\'t have permission to access this url ' . $request->getReferer());
         $this->redirect('dashboard/index');
     }
     if ($request->getParameter('id')) {
         $this->leg = MissionLegPeer::retrieveByPK($request->getParameter('id'));
         if (isset($this->leg)) {
             $this->mission = MissionPeer::retrieveByPK($this->leg->getMissionId());
             $this->requester = RequesterPeer::retrieveByPK($this->mission->getRequesterId());
             $this->req_person = $this->requester->getPerson();
             $this->agency = $this->requester->getAgency();
             // Camp information
             if ($this->mission->getCampId()) {
                 $this->camp = CampPeer::retrieveByPK($this->mission->getCampId());
             }
             //Coordinator
             if ($this->mission->getCoordinatorId()) {
                 $this->coordinator = CoordinatorPeer::retrieveByPK($this->mission->getCoordinatorId());
                 $this->coordiPerson = PersonPeer::retrieveByPK($this->coordinator->getMember()->getPersonId());
             }
             if (isset($this->mission)) {
                 $this->itinerary = ItineraryPeer::retrieveByPK($this->mission->getItineraryId());
                 $pass = PassengerPeer::retrieveByPK($this->mission->getPassengerId());
                 //Companions information
                 $this->companions = CompanionPeer::getByPassId($this->mission->getPassengerId());
                 if (isset($pass) && $pass instanceof Passenger) {
                     $this->pass = $pass;
                     //print_r($this->pass);
                     //die();
                     $this->person = PersonPeer::retrieveByPK($pass->getPersonId());
                     $this->itinerary = $this->mission->getItinerary();
                     // Pre-define addresses for ground missions
                     $this->ground_addresses = array('patient' => '', 'facility' => '', 'lodging' => '', 'airport' => '');
                     $this->ground_addr_sel = sfConfig::get('app_ground_address_type', array());
                     if ($this->itinerary) {
                         //$this->ground_addresses['lodging'] = $this->ground_addresses['facility'] = $this->itinerary->getDestCity().', '.$this->itinerary->getDestState();
                     }
                 } else {
                     unset($this->passenger);
                 }
             }
         }
         if (isset($this->leg) && $this->leg instanceof MissionLeg) {
             if ($this->leg->getPilotId()) {
                 $this->pilot = PilotPeer::retrieveByPK($this->leg->getPilotId());
                 $this->pilot_member = MemberPeer::retrieveByPK($this->pilot->getMemberId());
                 $this->copilot = PilotPeer::retrieveByPK($this->leg->getCoPilotId());
                 $this->mission_assistant = PilotPeer::getByMemberId($this->leg->getMissAssisId());
                 $this->back_up_mission_assistant = PilotPeer::retrieveByPK($this->leg->getBackupMissAssisId());
             }
         }
         if ($this->getUser()->hasAttribute('pilotAddToLegview')) {
             $this->getUser()->setFlash("success", 'Pilot is added to this mission leg successfully !');
             $this->getUser()->getAttributeHolder()->remove('pilotAddToLegview');
         }
     }
 }
Exemple #12
0
 /**
  * Request a group Missions 
  * CODE:mission_request_group_create
  */
 public function executeRequestGroupMission(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');
     }
     $camp = CampPeer::retrieveByPK($request->getParameter('id'));
     if (isset($camp) && $camp instanceof Camp) {
         $this->camp_id = $camp->getId();
         $missions = MissionPeer::getByCampId($camp->getId());
     }
     $this->dates = array();
     $this->home_base = null;
     $this->number_of_seats = null;
     $this->total_carry = null;
     $this->multi_pick = null;
     $this->date_choice = null;
     $this->comment = null;
     $this->request_as = null;
     $this->acc_cre = null;
     $this->pilot_ma = null;
     $this->IFR = null;
     $this->aircraft = null;
     $this->tail = null;
     $this->other_pilot = null;
     $miss_dates = array();
     //$appt_dates = array();
     //$count = 0;
     //$count2 = 0;
     foreach ($missions as $mission) {
         if ($mission->getMissionDate()) {
             $miss_dates[$mission->getMissionDate('m/d/Y')] = $mission->getMissionDate();
             //$count++;
             //it may change
             $this->mission_date = $mission->getMissionDate();
             $this->appt_date = $mission->getApptDate();
             //
         }
         /*
               if($mission->getApptDate()){
                 $appt_dates[$count2] = $mission->getApptDate();
                 $count2++;
               }*/
         $miss_id = $mission->getId();
     }
     $this->mission_dates = array();
     $this->mission_dates = $miss_dates;
     if (isset($miss_id)) {
         $legs = MissionLegPeer::getbyMissId($miss_id);
         $this->mission = MissionPeer::retrieveByPK($miss_id);
         foreach ($legs as $leg) {
             if ($leg->getToAirportId()) {
                 $this->leg = $leg;
                 $airport = AirportPeer::retrieveByPK($leg->getToAirportId());
                 if (isset($airport) && $airport instanceof Airport) {
                     $this->destination_airport = $airport;
                 }
             }
         }
     }
     /*
     if(isset($miss_dates[$count-1])){
       $this->mission_date = $miss_dates[$count-1];
     }
     if(isset($appt_dates[$count2-1])){
       $this->appt_date = $appt_dates[$count2-1];
     }
     */
     //$this->mission_leg = MissionLegPeer::retrieveByPK($request->getParameter('id'));
     $member = MemberPeer::getByPersonId($this->getUser()->getId());
     if (isset($member)) {
         $this->pilot = PilotPeer::getByMemberId($member->getId());
         $this->pilot_aircrafts = PilotAircraftPeer::getByMemberId($member->getId());
         $this->pre_requests = PilotRequestPeer::getByMemnerIdLegIdCamp($member->getId(), $this->leg->getId());
     }
     if ($request->isMethod('post')) {
         if ($request->getParameter('id')) {
             //set post variables
             $this->dates = $request->getParameter('dates[]', array());
             $this->home_base = $request->getParameter('home_base');
             $this->number_of_seats = $request->getParameter('number_of_seats');
             $this->total_carry = $request->getParameter('total_carry');
             $this->multi_pick = $request->getParameter('multi_pick');
             $this->date_choice = $request->getParameter('date_choice');
             $this->comment = $request->getParameter('comment');
             $this->request_as = $request->getParameter('request_as');
             $this->acc_cre = $request->getParameter('acc_cre');
             $this->pilot_ma = $request->getParameter('pilot_ma');
             $this->IFR = $request->getParameter('IFR');
             $this->aircraft = $request->getParameter('aircraft');
             $this->tail = $request->getParameter('tail');
             $this->other_pilot = $request->getParameter('other_pilot');
             if (count($this->dates) > 0 && $request->getParameter('home_base') && $request->getParameter('number_of_seats') && $request->getParameter('total_carry')) {
                 //check if this pilot requested this camp already?
                 $c = $has_requested = PilotRequestPeer::getByMemberIdCampId($member->getId(), $request->getParameter('camp_id'));
                 if (!$has_requested) {
                     $pilot_request = new PilotRequest();
                     if ($member) {
                         $pilot_request->setMemberId($member->getId());
                     }
                     $pilot_request->setGroupCampId($request->getParameter('camp_id'));
                     if ($request->getParameter('home_base')) {
                         $airport_hb = AirportPeer::getByIdent($request->getParameter('home_base'));
                         if (isset($airport_hb) && $airport_hb instanceof Airport) {
                             $pilot_request->setHomeBase($airport_hb->getIdent());
                         } else {
                             $this->getUser()->setFlash('warning', 'Home Base is not found!');
                             $this->redirect($request->getReferer());
                         }
                     }
                     if ($request->getParameter('number_of_seats')) {
                         if (is_integer((int) $request->getParameter('number_of_seats'))) {
                             $pilot_request->setNumberSeats((int) $request->getParameter('number_of_seats'));
                         } else {
                             $this->getUser()->setFlash('warning', 'Number of seats is in wrong format!');
                             $this->redirect($request->getReferer());
                         }
                     }
                     if ($request->getParameter('total_carry')) {
                         if (is_int((int) $request->getParameter('total_carry'))) {
                             $pilot_request->setTotalWeight((int) $request->getParameter('total_carry'));
                         } else {
                             $this->getUser()->setFlash('success', 'Total of carry value is in wrong format!');
                             $this->redirect($request->getReferer());
                         }
                     }
                     $pilot_request->setMultiplePick($request->getParameter('multi_pick'));
                     $pilot_request->save();
                     if (count($this->dates) > 0) {
                         #check is has Pilot Date
                         //$has_pilot_date = PilotDatePeer::getByMemberId($member->getId());
                         for ($y = 0; $y < count($this->dates); $y++) {
                             $pilot_date = new PilotDate();
                             $pilot_date->setMemberId($member->getId());
                             $pilot_date->setDate($this->dates[$y]);
                             $pilot_date->setPilotRequestId($pilot_request->getId());
                             $pilot_date->save();
                         }
                     }
                     if (count($this->dates) == 0) {
                         $pilot_request->setDate($this->dates[0]);
                     }
                     $pilot_request->setNumberDateAssign($request->getParameter('date_choice', 1));
                     $pilot_request->setPilotType($request->getParameter('request_as'));
                     $pilot_request->setComment($request->getParameter('comment'));
                     $pilot_request->setAircraftId($request->getParameter('aircraft'));
                     $pilot_request->setTail($request->getParameter('tail'));
                     //check pilot_type
                     if ($request->getParameter('other_pilot') == 1) {
                         ////mission assistant,earth angel
                         $pilot_request->setMissionAssistantWanted(0);
                         $pilot_request->setIfrBackupWanted(0);
                         $pilot_request->setAccepted(0);
                         $pilot_request->setProcessed(0);
                         $pilot_request->setOnHold(0);
                     } else {
                         ////command pilot
                         $pilot_request->setProcessed(1);
                         if ($request->getParameter('acc_cre') == 1) {
                             $pilot_request->setMissionAssistantWanted(0);
                             #set pilot as mission assistant
                             if ($member->getPerson()) {
                                 $pilot_request->setMissionAssistantName($member->getPerson()->getLastName() . ' ' . $member->getPerson()->getFirstName());
                             }
                         } else {
                             $pilot_request->setMissionAssistantWanted(0);
                             #set pilot's mission assistant as mission assistant
                             if ($request->getParameter('pilot_ma')) {
                                 $pilot_request->setMissionAssistantName($request->getParameter('pilot_ma'));
                             }
                         }
                         if ($request->getParameter('IFR') == 0) {
                             $pilot_request->setIfrBackupWanted(0);
                         } else {
                             $pilot_request->setIfrBackupWanted(1);
                         }
                     }
                     $pilot_request->setCreatedAt(date('m/d/y'));
                     $pilot_request->save();
                     $this->getUser()->setFlash('success', 'Your request has been saved on Camp ID#' . $request->getParameter('camp_id'));
                     //            $this->redirect('@pilot_thanks?id='.$request->getParameter('id'));
                 } else {
                     $this->getUser()->setFlash('success', 'You have already requested this Camp Mission!');
                     //            $this->redirect('@pilot_thanks?id='.$request->getParameter('id'));
                 }
             } else {
                 if (count($this->dates) < 1) {
                     $this->date_other_e = 1;
                     $this->type = $request->getParameter('request_as');
                 }
                 if (!$request->getParameter('home_base')) {
                     $this->home = 1;
                 }
                 if (!$request->getParameter('number_of_seats')) {
                     $this->number_of = 1;
                 }
                 if (!$request->getParameter('total_carry')) {
                     $this->carry = 1;
                 }
             }
         }
     }
 }