Beispiel #1
0
 /**
  *
  * @return Requester
  */
 public function getRequester()
 {
     if (!$this->aRequester instanceof Requester) {
         $this->aRequester = RequesterPeer::retrieveByPK($this->getRequesterId());
     }
     return $this->aRequester;
 }
Beispiel #2
0
             <div class="t"></div>
             <div class="c">[detailed information]</div>
             <div class="b"></div>
           </div>-->
         <?php 
 //endif
 ?>
       </dd>
       <dt>Requester:</dt>
       <dd>
         <a href="#">
           <?php 
 if ($itinerary->getRequesterId()) {
     ?>
             <?php 
     $requester = RequesterPeer::retrieveByPK($itinerary->getRequesterId());
     ?>
             <?php 
     if (isset($requester)) {
         $rperson = PersonPeer::retrieveByPK($requester->getPersonId());
     }
     ?>
             <?php 
     if (isset($rperson)) {
         ?>
                 <?php 
         echo $rperson->getTitle() . ' . ' . $rperson->getFirstName() . ' ' . $rperson->getLastName();
         ?>
             <?php 
     }
     ?>
Beispiel #3
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(RequesterPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     }
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria(RequesterPeer::DATABASE_NAME);
         $criteria->add(RequesterPeer::ID, $pks, Criteria::IN);
         $objs = RequesterPeer::doSelect($criteria, $con);
     }
     return $objs;
 }
Beispiel #4
0
        }
        ?>
 name="coordinator_mail[]" />
              </div>
              <div class="leglabel">Email: </div>
              <div class="leg_filed">
                  <?php 
        if ($coordinator->getMember()) {
            echo $coordinator->getMember()->getPerson()->getEmail();
        }
        ?>
              </div>
          </div>
          <?php 
    }
    $other_requester_id = RequesterPeer::retrieveByPK($mission_list->getOtherRequesterId());
    if ($other_requester_id) {
        ?>
          <div class="legemail_box">
              <div class="heading">Requester : <?php 
        echo $other_requester_id->getPerson()->getFirstName();
        ?>
 <?php 
        echo $requester->getPerson()->getLastName();
        ?>
 </div>
              <div class="chbox">
                  <input type="checkbox" <?php 
        if (isset($other_requester_id) && $other_requester_id->getPerson() && $other_requester_id->getPerson()->getEmail()) {
            ?>
 value="<?php 
Beispiel #5
0
 public function executeAutoComplete1()
 {
     $this->name = $this->getRequestParameter('requester_a');
     $this->requesters = RequesterPeer::getByKeyword($this->name);
 }
Beispiel #6
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;
 }
Beispiel #7
0
 /**
  * Get the associated Requester object
  *
  * @param      PropelPDO Optional Connection object.
  * @return     Requester The associated Requester object.
  * @throws     PropelException
  */
 public function getRequester(PropelPDO $con = null)
 {
     if ($this->aRequester === null && $this->requester_id !== null) {
         $c = new Criteria(RequesterPeer::DATABASE_NAME);
         $c->add(RequesterPeer::ID, $this->requester_id);
         $this->aRequester = RequesterPeer::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->aRequester->addPassengers($this);
         		 */
     }
     return $this->aRequester;
 }
Beispiel #8
0
 /**
  * Mission
  * CODE:mission_create
  */
 public function executeEdit(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->mission = MissionPeer::retrieveByPK($request->getParameter('id'));
     }
     //ziyed edited
     $itine = ItineraryPeer::retrieveByPk($this->mission->getItineraryId());
     $this->itine = $itine;
     $this->passenger = PassengerPeer::retrieveByPK($this->mission->getPassengerId());
     $this->passenger_a = $this->passenger && $this->passenger->getPerson() ? $this->passenger->getPerson()->getName() : '';
     $this->requester = RequesterPeer::retrieveByPK($this->mission->getRequesterId());
     $this->requester_a = $this->requester && $this->requester->getPerson() ? $this->requester->getPerson()->getName() : '';
     $this->agency = AgencyPeer::retrieveByPK($this->mission->getAgencyId());
     $this->agencyName = $this->agency ? $this->agency->getName() : '';
     $this->camp = CampPeer::retrieveByPK($this->mission->getCampId());
     $this->campName = $this->camp ? $this->camp->getCampName() : '';
     //end of ziyed
     $this->form = new MissionForm($this->mission);
     $this->referer = $request->getReferer();
     if ($request->isMethod('post')) {
         $this->form->bind($request->getParameter('mission_edit'));
         $this->referer = $request->getReferer();
         /*$errors = $this->form->getErrorSchema()->getErrors();
           if (count($errors) > 0)
           echo 'List of Errors:' . '<br>';
           {
           foreach ($errors as $name => $error)
           {
           echo $name . ': ' . $error . '<BR>';
           }
           }*/
         if ($this->form->isValid()) {
             $this->mission->setMissionTypeId($this->form->getValue('mission_type_id'));
             $this->mission->setMissionDate($this->form->getValue('mission_date'));
             $this->mission->setDateRequested($this->form->getValue('date_requested'));
             $pass = PassengerPeer::retrieveByPK($this->form->getValue('passenger_id'));
             if (isset($pass)) {
                 $this->mission->setPassengerId($pass->getId());
             }
             $req = RequesterPeer::retrieveByPK($this->form->getValue('requester_id'));
             if ($req) {
                 $this->mission->setRequesterId($req->getId());
             }
             if ($this->form->getValue('agency_id') == 0) {
                 $this->mission->setAgencyId(null);
             } else {
                 $this->mission->setAgencyId($this->form->getValue('agency_id'));
             }
             if ($this->form->getValue('camp_id') == 0) {
                 $this->mission->setCampId(null);
             } else {
                 $this->mission->setCampId($this->form->getValue('camp_id'));
             }
             $coor = CoordinatorPeer::retrieveByPK($this->form->getValue('coordinator_id'));
             if (isset($coor)) {
                 $this->mission->setCoordinatorId($coor->getId());
             }
             $itId = ItineraryPeer::retrieveByPK($this->mission->getItineraryId());
             $mLeg = MissionLegPeer::getAllMissionLegByMissionId($request->getParameter('id'));
             $countLeg = MissionLegPeer::getMissionLegByMissionIdCount($request->getParameter('id'));
             $this->mission->setApptDate($this->form->getValue('appt_date'));
             $this->mission->setFlightTime($this->form->getValue('flight_time'));
             $this->mission->setTreatment($this->form->getValue('treatment'));
             $this->mission->setComment($this->form->getValue('comment'));
             $this->mission->setAppointment($this->form->getValue('appointment'));
             $this->mission->setMissionSpecificComments($this->form->getValue('mission_specific_comments'));
             if ($this->form->getValue('cancel_mission') == 0) {
                 if (isset($countLeg)) {
                     foreach ($mLeg as $ml) {
                         $ml->setCancelMissionLeg(0);
                         $ml->save();
                     }
                 }
             }
             $this->mission->setCancelMission($this->form->getValue('cancel_mission'));
             $this->mission->save();
             $this->getUser()->setFlash('success', 'Mission has succesfully edited!');
             $this->redirect('@mission_view?id=' . $this->mission->getId());
         }
     }
 }
Beispiel #9
0
    /**
     * Displays a person information
     * CODE: person_view
     * @param sfWebRequest $request
     * @return unknown_type
     */
    public function executeView(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');
        }
        $this->person = PersonPeer::retrieveByPK($request->getParameter('id'));
        $this->forward404Unless($this->person);
        $this->requester = RequesterPeer::getByPersonId($this->person->getId());
        $this->camp_id = $request->getParameter('camp_id');
        if ($this->getUser()->hasCredential(array('Administrator', 'Staff', 'Pilot', 'Coordinator', 'Volunteer'), false)) {
            # get all roles
            $roles = RolePeer::getForSelect();
            # get assigned roles
            $person_roles = PersonRolePeer::getByPersonId($this->person->getId());
            $assoc_roles = array();
            foreach ($person_roles as $person_role) {
                $assoc_roles[] = $person_role->getRoleId();
            }
            $this->assoc_roles = $assoc_roles;
            # prepare widget
            $this->widget = new sfWidgetFormSelectDoubleList(array('choices' => $roles, 'label_unassociated' => 'Full List', 'label_associated' => 'Assigned Roles', 'associate' => 'lt;', 'associate_class' => 'btn-right', 'unassociate' => 'gt;', 'unassociate_class' => 'btn-left', 'template' => <<<EOF
<div class="%class%" style="padding-top: 0px;">
  <div class="holder">
    <h4>%label_unassociated%</h4>
    %unassociated%
  </div>
  <ul class="btn-switch">
    <li>%associate%</li>
    <li>%unassociate%</li>
  </ul>
  <div class="holder">
    <h4>%label_associated%</h4>
    %associated%
  </div>
    
  <br style="clear: both" />
  <script type="text/javascript">
    sfDoubleList.init(document.getElementById('%id%'), '%class_select%');
  </script>
</div>
EOF
));
            $this->form = new PersonForm();
        }
        # email lists associated to the person
        $this->email_lists = EmailListPeer::doSelect(new Criteria());
        $this->subscribed_list = EmailListPersonPeer::getEmailListIdsByPersonId($this->person->getId());
    }
Beispiel #10
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;
 }
 public static function getEmailAddressesOfPersonsRelatedToMission(Mission $mission)
 {
     $receivers = array();
     // Get Passenger email address
     $passenger = PassengerPeer::retrieveByPK($mission->getPassengerId());
     if ($passenger) {
         $passenger = $passenger->getPerson()->getEmail();
         if (!empty($passenger)) {
             //            $receivers['passenger_'.$mission->getId()] = $passenger;
             if (preg_match('/^[_a-z0-9-]+(\\.[_a-z0-9-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,3})$/', $passenger)) {
                 $receivers[] = $passenger;
             }
         }
     }
     unset($passenger);
     // Get Requester email address
     $requestr = RequesterPeer::retrieveByPK($mission->getRequesterId());
     if ($requestr) {
         $requestr = $requestr->getPerson()->getEmail();
         if (!empty($requestr)) {
             //            $receivers['requestr_'.$mission->getId()] = $requestr;
             if (preg_match('/^[_a-z0-9-]+(\\.[_a-z0-9-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,3})$/', $requestr)) {
                 $receivers[] = $requestr;
             }
         }
     }
     unset($requestr);
     // Get Coordinator email address
     $coordinator = CoordinatorPeer::retrieveByPK($mission->getCoordinatorId());
     if ($coordinator && ($coordinator = $coordinator->getMember())) {
         $coordinator = $coordinator->getPerson()->getEmail();
         if (!empty($coordinator)) {
             //            $receivers['coordinator_'.$mission->getId()] = $coordinator;
             if (preg_match('/^[_a-z0-9-]+(\\.[_a-z0-9-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,3})$/', $coordinator)) {
                 $receivers[] = $coordinator;
             }
         }
     }
     unset($coordinator);
     // Get Other Requester email address
     $other_requestr = RequesterPeer::retrieveByPK($mission->getOtherRequesterId());
     if ($other_requestr) {
         $other_requestr = $other_requestr->getPerson()->getEmail();
         if (!empty($other_requestr)) {
             //            $receivers['other_requestr_'.$mission->getId()] = $other_requestr;
             if (preg_match('/^[_a-z0-9-]+(\\.[_a-z0-9-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,3})$/', $other_requestr)) {
                 $receivers[] = $other_requestr;
             }
         }
     }
     unset($other_requestr);
     // Get Other Agency email address
     $other_agency = AgencyPeer::retrieveByPK($mission->getOtherAgencyId());
     if ($other_agency) {
         $other_agency = $other_agency->getEmail();
         if (!empty($other_requestr)) {
             //            $receivers['other_agency_'.$mission->getId()] = $other_agency;
             if (preg_match('/^[_a-z0-9-]+(\\.[_a-z0-9-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,3})$/', $other_agency)) {
                 $receivers[] = $other_agency;
             }
         }
     }
     unset($other_agency);
     // Get Agency email address
     $agency = AgencyPeer::retrieveByPK($mission->getAgencyId());
     if ($agency) {
         $agency = $agency->getEmail();
         if (!empty($agency)) {
             //            $receivers['agency_'.$mission->getId()] = $agency;
             if (preg_match('/^[_a-z0-9-]+(\\.[_a-z0-9-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,3})$/', $agency)) {
                 $receivers[] = $agency;
             }
         }
     }
     unset($agency);
     return $receivers;
 }
Beispiel #12
0
 /**
  * Selects a collection of Passenger objects pre-filled with all related objects except PassengerIllnessCategory.
  *
  * @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 Passenger objects.
  * @throws     PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function doSelectJoinAllExceptPassengerIllnessCategory(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);
     }
     PassengerPeer::addSelectColumns($c);
     $startcol2 = PassengerPeer::NUM_COLUMNS - PassengerPeer::NUM_LAZY_LOAD_COLUMNS;
     PersonPeer::addSelectColumns($c);
     $startcol3 = $startcol2 + (PersonPeer::NUM_COLUMNS - PersonPeer::NUM_LAZY_LOAD_COLUMNS);
     PassengerTypePeer::addSelectColumns($c);
     $startcol4 = $startcol3 + (PassengerTypePeer::NUM_COLUMNS - PassengerTypePeer::NUM_LAZY_LOAD_COLUMNS);
     RequesterPeer::addSelectColumns($c);
     $startcol5 = $startcol4 + (RequesterPeer::NUM_COLUMNS - RequesterPeer::NUM_LAZY_LOAD_COLUMNS);
     $c->addJoin(array(PassengerPeer::PERSON_ID), array(PersonPeer::ID), $join_behavior);
     $c->addJoin(array(PassengerPeer::PASSENGER_TYPE_ID), array(PassengerTypePeer::ID), $join_behavior);
     $c->addJoin(array(PassengerPeer::REQUESTER_ID), array(RequesterPeer::ID), $join_behavior);
     $stmt = BasePeer::doSelect($c, $con);
     $results = array();
     while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
         $key1 = PassengerPeer::getPrimaryKeyHashFromRow($row, 0);
         if (null !== ($obj1 = PassengerPeer::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 = PassengerPeer::getOMClass();
             $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
             $obj1 = new $cls();
             $obj1->hydrate($row);
             PassengerPeer::addInstanceToPool($obj1, $key1);
         }
         // if obj1 already loaded
         // Add objects for joined Person rows
         $key2 = PersonPeer::getPrimaryKeyHashFromRow($row, $startcol2);
         if ($key2 !== null) {
             $obj2 = PersonPeer::getInstanceFromPool($key2);
             if (!$obj2) {
                 $omClass = PersonPeer::getOMClass();
                 $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
                 $obj2 = new $cls();
                 $obj2->hydrate($row, $startcol2);
                 PersonPeer::addInstanceToPool($obj2, $key2);
             }
             // if $obj2 already loaded
             // Add the $obj1 (Passenger) to the collection in $obj2 (Person)
             $obj2->addPassenger($obj1);
         }
         // if joined row is not null
         // Add objects for joined PassengerType rows
         $key3 = PassengerTypePeer::getPrimaryKeyHashFromRow($row, $startcol3);
         if ($key3 !== null) {
             $obj3 = PassengerTypePeer::getInstanceFromPool($key3);
             if (!$obj3) {
                 $omClass = PassengerTypePeer::getOMClass();
                 $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
                 $obj3 = new $cls();
                 $obj3->hydrate($row, $startcol3);
                 PassengerTypePeer::addInstanceToPool($obj3, $key3);
             }
             // if $obj3 already loaded
             // Add the $obj1 (Passenger) to the collection in $obj3 (PassengerType)
             $obj3->addPassenger($obj1);
         }
         // if joined row is not null
         // Add objects for joined Requester rows
         $key4 = RequesterPeer::getPrimaryKeyHashFromRow($row, $startcol4);
         if ($key4 !== null) {
             $obj4 = RequesterPeer::getInstanceFromPool($key4);
             if (!$obj4) {
                 $omClass = RequesterPeer::getOMClass();
                 $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
                 $obj4 = new $cls();
                 $obj4->hydrate($row, $startcol4);
                 RequesterPeer::addInstanceToPool($obj4, $key4);
             }
             // if $obj4 already loaded
             // Add the $obj1 (Passenger) to the collection in $obj4 (Requester)
             $obj4->addPassenger($obj1);
         }
         // if joined row is not null
         $results[] = $obj1;
     }
     $stmt->closeCursor();
     return $results;
 }
Beispiel #13
0
 /**
  * Add or create agency
  * CODE: agency_create
  */
 public function executeUpdate(sfWebRequest $request)
 {
     #security
     if (!$this->getUser()->hasCredential(array('Administrator', 'Staff', 'Coordinator', 'Volunteer'), false)) {
         $this->getUser()->setFlash("warning", 'You don\'t have permission to access this url ' . $request->getReferer());
         $this->redirect('dashboard/index');
     }
     sfContext::getInstance()->getConfiguration()->loadHelpers('Partial');
     $this->requesters = null;
     if ($request->getParameter('id')) {
         $agency_id = $request->getParameter('id');
         $agency = AgencyPeer::retrieveByPK($agency_id);
         $this->title = 'Edit Agency';
         $this->requesters = RequesterPeer::getByAgency($agency_id);
         slot('nav_menu', array('mission_coord', ''));
     } else {
         $agency = new Agency();
         $this->title = 'Add Agency';
         slot('nav_menu', array('mission_coord', 'add-agency'));
     }
     $this->form = new AgencyForm($agency);
     $this->back = $request->getReferer();
     if ($request->isMethod('post')) {
         $this->referer = $request->getReferer();
         $this->processForm($request, $this->form);
     } else {
         # Set referer URL
         $this->referer = $request->getReferer() ? $request->getReferer() : '@agency';
     }
     $this->agency = $agency;
 }
Beispiel #14
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');
         }
     }
 }
Beispiel #15
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 Requesters 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 getRequestersJoinPerson($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->collRequesters === null) {
         if ($this->isNew()) {
             $this->collRequesters = array();
         } else {
             $criteria->add(RequesterPeer::AGENCY_ID, $this->id);
             $this->collRequesters = RequesterPeer::doSelectJoinPerson($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(RequesterPeer::AGENCY_ID, $this->id);
         if (!isset($this->lastRequesterCriteria) || !$this->lastRequesterCriteria->equals($criteria)) {
             $this->collRequesters = RequesterPeer::doSelectJoinPerson($criteria, $con, $join_behavior);
         }
     }
     $this->lastRequesterCriteria = $criteria;
     return $this->collRequesters;
 }
Beispiel #16
0
 /**
  * Add or edit Itinerary
  * CODE: itinerary_create
  */
 public function executeUpdate(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');
     }
     $this->current_facility = "";
     $this->current_lodging = "";
     $this->current_facility_city = "";
     $this->current_facility_state = "";
     $this->current_facility_phone = "";
     $this->current_facility_phone_comment = "";
     $this->current_lodging_city = "";
     $this->current_lodging_state = "";
     $this->current_lodging_phone = "";
     $this->current_lodging_phone_comment = "";
     $this->mis2bn = false;
     $this->passenger_a = trim($this->getRequestParameter('passenger_a', '*')) == '' ? '*' : trim($this->getRequestParameter('passenger_a', '*'));
     $this->facility = trim($this->getRequestParameter('facility', '*')) == '' ? '*' : trim($this->getRequestParameter('facility', '*'));
     $this->lodging = trim($this->getRequestParameter('lodging', '*')) == '' ? '*' : trim($this->getRequestParameter('lodging', '*'));
     $this->requester_p = trim($this->getRequestParameter('requester_p', '*')) == '' ? '*' : trim($this->getRequestParameter('requester_p', '*'));
     $this->person_a = trim($this->getRequestParameter('person_a', '*')) == '' ? '*' : trim($this->getRequestParameter('person_a', '*'));
     $this->person_a_req = trim($this->getRequestParameter('person_a_req', '*')) == '' ? '*' : trim($this->getRequestParameter('person_a_req', '*'));
     $this->agency = trim($this->getRequestParameter('agency', '*')) == '' ? '*' : trim($this->getRequestParameter('agency', '*'));
     $this->hour = $request->getParameter('hour');
     $this->minut = $request->getParameter('minut');
     $this->b_weight = "";
     $this->b_type = "";
     $this->b_desc = "";
     if ($request->getParameter('id')) {
         $itine = ItineraryPeer::retrieveByPk($request->getParameter('id'));
         $mis = MissionPeer::getMissionByItineraryId($request->getParameter('id'), 1);
         $mis2 = MissionPeer::getMissionByItineraryId($request->getParameter('id'), 2);
         if (isset($mis)) {
             $this->b_weight = $mis->getBWeight();
         }
         if (isset($mis)) {
             $this->b_type = $mis->getBType();
         }
         if (isset($mis)) {
             $this->b_desc = $mis->getBDesc();
         }
         if ($mis2) {
             $this->mis2bn = true;
         } else {
             $mis2 = new Mission();
         }
         //$pp = $itine->getPassenger();
         if (isset($itine)) {
             $this->passenger_name = $itine->getPassenger()->getPerson()->getName();
             $this->current_pass_id = $itine->getPassengerId();
             $this->current_facility = $itine->getPassenger()->getFacilityName();
             $this->current_lodging = $itine->getPassenger()->getLodgingName();
             $this->companions = $itine->getPassenger()->getCompanions();
             $this->selected_companions = array();
             foreach ($mis->getMissionCompanions() as $mis_comp) {
                 $this->selected_companions[] = $mis_comp->getCompanionId();
             }
             //print_r($this->selected_companions);
         }
         $this->title = 'Edit Itinerary';
         $success = 'Itinerary has been succesfuly edited!';
         $editpassengerfac = PassengerDestPeer::getFacilityByPassengerId($this->current_pass_id, $this->current_facility);
         $editpassengerlod = PassengerDestPeer::getLodgingByPassengerId($this->current_pass_id, $this->current_lodging);
         if ($editpassengerfac) {
             $this->current_facility_city = $editpassengerfac->getFacilityCity();
             $this->current_facility_state = $editpassengerfac->getFacilityState();
             $this->current_facility_phone = $editpassengerfac->getFacPhone();
             $this->current_facility_phone_comment = $editpassengerfac->getFacilityPhoneComment();
         }
         if ($editpassengerlod) {
             $this->current_lodging_city = $editpassengerlod->getFacilityCity();
             $this->current_lodging_state = $editpassengerlod->getFacilityState();
             $this->current_lodging_phone = $editpassengerlod->getLodPhone();
             $this->current_lodging_phone_comment = $editpassengerlod->getLodPhoneComment();
         }
         if (isset($itine)) {
             $point_time = $itine->getPointTime();
             if ($point_time) {
                 $split_time = split(':', $point_time);
                 $this->hour = $split_time[0];
                 $this->minut = $split_time[1];
             }
         }
     } else {
         $itine = new Itinerary();
         $mis = new Mission();
         $mis2 = new Mission();
         //$passIti = new Passenger();
         //$itine->setWaiverNeed(1);
         //$itine->setNeedMedicalRelease(1);
         $this->title = 'Add Itinerary';
         $success = 'Itinerary has been succesfully created!';
     }
     $this->requester_a = "";
     $this->itine = $itine;
     if ($request->hasParameter('requester_a')) {
         $this->requester_a = trim($this->getRequestParameter('requester_a', '*')) == '' ? '*' : trim($this->getRequestParameter('requester_a', '*'));
     } else {
         if (isset($itine)) {
             $requester = $itine->getRequester();
             if ($requester) {
                 $this->requester_a = $requester->getPerson()->getName();
                 if ($requester->getAgency()->getName()) {
                     $this->requester_a .= ', ' . $requester->getAgency()->getName();
                 }
                 if ($requester->getTitle()) {
                     $this->requester_a .= ', ' . $requester->getTitle();
                 }
             }
         }
     }
     $this->form = new ItineraryForm($itine);
     $this->missionform1 = new MissionSmallForm($mis);
     $this->missionform2 = new MissionSmallForm($mis2);
     //$this->formI = new PassengerItiForm($passIti);
     $facandlod = new PassengerDest();
     $this->form6 = new PassengerDestForm($facandlod);
     $passenger = new Passenger();
     $this->passenger = $passenger;
     //passengers,requester uses when edit
     $c = new Criteria();
     $c->setLimit(50);
     $this->all_passengers = PassengerPeer::doSelect($c);
     $this->all_requesters = RequesterPeer::doSelect($c);
     //Passenger Form1
     $this->form1 = new PassengerPopUpForm1($passenger);
     $this->sub_title = 'Add New Passenger';
     //Passenger Form 2
     $this->form2 = new PassengerPopUpForm2();
     //Passenger Form 3
     $this->form3 = new PassengerPopUpForm3();
     //Passenger Form 4
     $this->form4 = new PassengerPopUpForm4();
     //Passenger Form 5
     $this->form5 = new PassengerPopUpForm5();
     //Requester PopUp Form  - Not Requester Passenger
     $this->persons = PersonPeer::getNotInRequester();
     $requester = new Requester();
     $this->form_req = new RequesterForm($requester);
     $companion = new Companion();
     $this->form_com = new CompanionForm($companion);
     $this->req_referer = $request->getReferer();
     $this->states = sfConfig::get('app_states');
     $this->errors = array();
     if ($request->isMethod('post')) {
         $this->form->bind($request->getParameter('itine'));
         $this->referer = $request->getReferer();
         $k = $this->form->isValid();
         if ($k && $request->getParameter('passenger_id') && $request->getParameter('requester_id')) {
             $itine->setPassengerId($request->getParameter('passenger_id'));
             $itine->setRequesterId($request->getParameter('requester_id'));
             $itine->setDateRequested($this->form->getValue('date_requested'));
             $itine->setMissionTypeId($this->form->getValue('mission_type_id'));
             $itine->setApointTime($this->form->getValue('apoint_time'));
             if ($request->getParameter('facility')) {
                 $itine->setFacility($request->getParameter('facility'));
             }
             if ($request->getParameter('lodging')) {
                 $itine->setLodging($request->getParameter('lodging'));
             }
             if ($request->getParameter('hour') && $request->getParameter('minut') && $request->getParameter('hour') != '---' && $request->getParameter('minut') != '---') {
                 $itine->setPointTime($request->getParameter('hour') . ':' . $request->getParameter('minut') . ':00');
                 $itine->setTimetype($this->form->getValue('timetype'));
             }
             $passengerItine = PassengerPeer::retrieveByPK($request->getParameter('passenger_id'));
             if ($passengerItine instanceof Passenger) {
                 $personpasItine = $passengerItine->getPerson();
                 $origin_city = $personpasItine->getCity();
                 $origin_state = $personpasItine->getState();
                 $dest_city = $passengerItine->getFacilityCity();
                 $dest_state = $passengerItine->getFacilityState();
                 //$passengerItine->setBWeight($request->getParameter('b_weight'));
                 //$passengerItine->setBType($request->getParameter('b_type'));
                 //$passengerItine->setBDesc($request->getParameter('b_desc'));
                 $passengerItine->save();
                 //check
             }
             $itine->setOrginCity($origin_city ? $origin_city : "");
             $itine->setOrginState($origin_state ? $origin_state : "");
             $itine->setDestCity($dest_city ? $dest_city : "");
             $itine->setDestState($dest_state ? $dest_state : "");
             //$itine->setBWeight($this->form->getValue('b_weight'));
             //$itine->setBType($this->form->getValue('b_type'));
             //$itine->setBDesc($this->form->getValue('b_desc'));
             //$itine->setWaiverNeed($this->form->getValue('waiver_need'));
             //$itine->setNeedMedicalRelease($this->form->getValue('need_medical_release'));
             $itine->setComment($this->form->getValue('comment'));
             $newIti = false;
             if ($itine->isNew()) {
                 $newIti = true;
                 $itine->setCancelItinerary(1);
             }
             $itine->save();
             $companions = (array) $request->getParameter('companions');
             if (count($companions)) {
                 $c = new Criteria();
                 $c->add(CompanionPeer::ID, $companions, Criteria::IN);
                 $c->add(CompanionPeer::PASSENGER_ID, $request->getParameter('passenger_id'));
                 if (CompanionPeer::doCount($c) != count($companions)) {
                     $this->errors[] = 'Some companions not found';
                 }
             }
             $mis->setItineraryId($itine->getId());
             $mis->setMissionTypeId($this->form->getValue('mission_type_id'));
             $mis->setDateRequested($this->form->getValue('date_requested'));
             $mis->setPassengerId($request->getParameter('passenger_id'));
             $mis->setRequesterId($request->getParameter('requester_id'));
             $mis->setMissionDate($request->getParameter('mis1'));
             $mis->setBWeight($request->getParameter('b_weight'));
             $mis->setBType($request->getParameter('b_type'));
             $mis->setBDesc($request->getParameter('b_desc'));
             /*if($itine->isNew()){
                   echo $countMission; exit;
                   if(isset($countMission)){
                           foreach($misall as $misc){
                               $mLeg = MissionLegPeer::getAllMissionLegByMissionId($misc->getId());
                               $countLeg = MissionLegPeer::getMissionLegByMissionIdCount($misc->getId());
                               if(isset($countLeg)){
                                   foreach($mLeg as $ml){
                                       $ml->setCancelMissionLeg(1);
                                       $ml->save();
                                   }
                               }
                               $misc->setCancelMission(1);
                               $misc->save();
                           }
                   }
               }*/
             if ($request->getParameter('missionSelect') == 1) {
                 $mis->setApptDate($request->getParameter('appdate1'));
                 $mis->setApointTime($this->form->getValue('apoint_time'));
                 $mis->setStart(1);
             } else {
                 $mis->setStart(2);
             }
             if ($itine->getCancelItinerary() == 1) {
                 $mis->setCancelMission(1);
             }
             if (!$request->getParameter('id')) {
                 //Mission 1 externa ID
                 $c = new Criteria();
                 $c->add(MissionPeer::EXTERNAL_ID, NULL, Criteria::ISNOTNULL);
                 $c->addDescendingOrderByColumn(MissionPeer::EXTERNAL_ID);
                 $external_mission = MissionPeer::doSelectOne($c);
                 $external_id = $external_mission->getExternalId();
                 $currentExternalId = $external_id + 1;
                 $mis->setExternalId($currentExternalId);
                 // die();
             }
             $mis->setMissionCount(1);
             $mis->save();
             if ($request->getParameter('yes_no') == 1) {
                 //Mission 2 externa ID
                 if (!$request->getParameter('id')) {
                     $c = new Criteria();
                     $c->add(MissionPeer::EXTERNAL_ID, NULL, Criteria::ISNOTNULL);
                     $c->addDescendingOrderByColumn(MissionPeer::EXTERNAL_ID);
                     $external_mission = MissionPeer::doSelectOne($c);
                     $external_id = $external_mission->getExternalId();
                     $currentExternalId = $external_id + 1;
                     $mis2->setExternalId($currentExternalId);
                     // die();
                 }
                 $mis2->setItineraryId($itine->getId());
                 $mis2->setMissionTypeId($this->form->getValue('mission_type_id'));
                 $mis2->setDateRequested($this->form->getValue('date_requested'));
                 $mis2->setPassengerId($request->getParameter('passenger_id'));
                 $mis2->setRequesterId($request->getParameter('requester_id'));
                 $mis2->setMissionDate($request->getParameter('mis2'));
                 $mis2->setBWeight($request->getParameter('b_weight'));
                 $mis2->setBType($request->getParameter('b_type'));
                 $mis2->setBDesc($request->getParameter('b_desc'));
                 $mis2->setCancelMission(1);
                 if ($request->getParameter('missionSelect') == 1) {
                     $mis2->setStart(2);
                 } else {
                     $mis2->setStart(1);
                 }
                 $mis2->setMissionCount(2);
                 if ($itine->getCancelItinerary() == 1) {
                     $mis2->setCancelMission(1);
                 }
                 $mis2->save();
             }
             if (count($this->errors)) {
                 # error in form
                 switch ($request->getParameter('transportation')) {
                     case 'air_mission':
                         $this->origin_idents = $origin_airports;
                         $this->dest_idents = $dest_airports;
                         break;
                     case 'ground_mission':
                         break;
                     case 'commercial_mission':
                         break;
                 }
                 $this->selected_companions = $companions;
             } else {
                 $c->clear();
                 $c->add(MissionCompanionPeer::MISSION_ID, $mis->getId());
                 MissionCompanionPeer::doDelete($c);
                 foreach ($companions as $id) {
                     $mission_companion = new MissionCompanion();
                     $mission_companion->setMissionId($mis->getId());
                     $mission_companion->setCompanionId($id);
                     $mission_companion->save();
                 }
             }
             //die();
             $this->selected_companions = $companions;
             //print_r($this->selected_companions);
             //die();
             //$team_note = TeamNotePeer::retrieveByPK($id);
             //if(!$team_note) {
             //$team_note = new TeamNote();
             //}
             //$team_note->setRoleId($id);
             //$team_note->setNote(strip_tags($note, sfConfig::get('app_allowed_note_tags')));
             //$team_note->save();
             $this->getUser()->setFlash('success', $success);
             //$request->getParameter('back')
             $this->redirect('/itinerary/detail/' . $itine->getId());
         } else {
             if (!$request->getParameter('passenger_id')) {
                 $this->need_pass = 1;
             }
             if (!$request->getParameter('requester_id')) {
                 $this->need_requester_id = 1;
             }
             //if(!$request->getParameter('facility')){
             //$this->need_facility= 1;
             //}
             //if(!$request->getParameter('lodging')){
             //$this->need_lodging = 1;
             //}
             $this->referer = $request->getParameter('back');
         }
     } else {
         # Set referer URL
         $this->referer = $request->getReferer() ? $request->getReferer() : '@itinerary';
     }
     // Block from Add person
     if ($request->getParameter('add_pass') == 'yes') {
         $this->person = new Person();
         $this->person_title = 'Step 1 : Add person';
         if ($request->getParameter('camp_id')) {
             $this->camp_id = $request->getParameter('camp_id');
         }
         $this->stepped = 1;
     }
     if ($request->getParameter('add_pass_iti') == 'yes') {
         $this->person = new Person();
         $this->person_title = 'Step 1 : Add person';
         $this->person_itine = 1;
     }
     if ($request->getParameter('add_cont') == 'yes') {
         $this->person = new Person();
         $this->person_title = 'Step 1 : Add person';
         $this->contact = 1;
     }
     if ($request->getParameter('id')) {
         $this->person = PersonPeer::retrieveByPK($request->getParameter('id'));
         $this->person_title = 'Edit person';
     } else {
         $this->person = new Person();
         $this->person_title = 'Add person';
     }
     $companion = new Companion();
     $this->form_a = new CompanionForm($companion);
     # Person Form
     $this->person_form = new PersonForm($this->person);
     $this->back = $request->getReferer();
     //session
     $this->key = $request->getParameter('key');
     if (!$this->key) {
         $this->key = rand(1000, 9999);
     }
     # Agency Form
     $agency = new Agency();
     $this->agency_title = 'Add Agency';
     $this->agency_form = new AgencyForm($agency);
     if (strstr($request->getReferer(), 'person/view')) {
         if ($this->person) {
             //session
             $referer_session = $this->getUser()->getAttribute('ref');
             if (!$referer_session) {
                 $referer_session = array($this->key => array());
                 $this->getUser()->setAttribute('ref', $referer_session);
             } elseif (!isset($referer_session[$this->key])) {
                 $a = '@person_view?id=' . $this->person->getId();
                 $referer_session[$this->key] = array('referer' => $a);
                 $this->getUser()->setAttribute('ref', $referer_session[$this->key]);
             }
         }
     }
     $this->person_referer = $request->getParameter('referer');
     if ($request->isMethod('post')) {
         $this->person_referer = $request->getParameter('referer');
         $this->person_form->bind($request->getParameter('per'));
         if ($this->person_form->isValid() && $this->person_form->getValue('first_name') && $this->person_form->getValue('last_name')) {
             $this->person->setTitle($this->person_form->getValue('title'));
             $this->person->setFirstName($this->person_form->getValue('first_name'));
             $this->person->setLastName($this->person_form->getValue('last_name'));
             $this->person->setAddress1($this->person_form->getValue('address1'));
             $this->person->setAddress2($this->person_form->getValue('address2'));
             $this->person->setCity($this->person_form->getValue('city'));
             $this->person->setCounty($this->person_form->getValue('county'));
             $this->person->setState($this->person_form->getValue('state'));
             $this->person->setCountry($this->person_form->getValue('country'));
             $this->person->setZipcode($this->person_form->getValue('zipcode'));
             $this->person->setDayPhone($this->person_form->getValue('day_phone'));
             $this->person->setDayComment($this->person_form->getValue('day_comment'));
             $this->person->setEveningPhone($this->person_form->getValue('evening_phone'));
             $this->person->setEveningComment($this->person_form->getValue('evening_comment'));
             $this->person->setMobilePhone($this->person_form->getValue('mobile_phone'));
             $this->person->setMobileComment($this->person_form->getValue('mobile_comment'));
             $this->person->setPagerPhone($this->person_form->getValue('paper_phone'));
             $this->person->setPagerComment($this->person_form->getValue('paper_comment'));
             $this->person->setOtherPhone($this->person_form->getValue('other_phone'));
             $this->person->setOtherComment($this->person_form->getValue('other_comment'));
             $this->person->setFaxPhone1($this->person_form->getValue('fax_phone1'));
             $this->person->setFaxComment1($this->person_form->getValue('fax_comment1'));
             $this->person->setAutoFax($this->person_form->getValue('auto_fax'));
             $this->person->setFaxPhone2($this->person_form->getValue('fax_phone2'));
             $this->person->setFaxComment2($this->person_form->getValue('fax_comment2'));
             $this->person->setEmail($this->person_form->getValue('email'));
             $this->person->setEmailTextOnly($this->person_form->getValue('email_text_only'));
             $this->person->setEmailBlocked($this->person_form->getValue('email_blocked'));
             $this->person->setComment($this->person_form->getValue('comment'));
             //$this->person->setBlockMailings($this->person_form->getValue('block_mailings')==0?null:$this->person_form->getValue('block_mailings'));
             $this->person->setBlockMailings($this->person_form->getValue('block_mailings'));
             $this->person->setNewsletter($this->person_form->getValue('newsletter'));
             $this->person->setGender($this->person_form->getValue('gender'));
             $this->person->setDeceased($this->person_form->getValue('deceased'));
             $this->person->setDeceasedComment($this->person_form->getValue('deceased_comment'));
             $this->person->setSecondaryEmail($this->person_form->getValue('secondary_email'));
             $this->person->setDeceasedDate($this->person_form->getValue('deceased_date'));
             $this->person->setMiddleName($this->person_form->getValue('middle_name'));
             $this->person->setSuffix($this->person_form->getValue('suffix'));
             $this->person->setNickname($this->person_form->getValue('nickname'));
             $this->person->setVeteran($this->person_form->getValue('veteran'));
             if ($this->person->isNew()) {
                 $content = $this->getUser()->getName() . ' added new Person: ' . $this->person->getFirstName();
                 ActivityPeer::log($content);
             }
             $this->person->save();
             if ($this->person->getId()) {
                 $c = new Criteria();
                 $c->add(RoleNotificationPeer::MID, 5);
                 $c->add(RoleNotificationPeer::NOTIFICATION, 1);
                 $c->addOr(RoleNotificationPeer::NOTIFICATION, 3);
                 $c->addJoin(RoleNotificationPeer::ROLE_ID, PersonRolePeer::ROLE_ID);
                 $c->addJoin(PersonRolePeer::PERSON_ID, PersonPeer::ID);
                 $personemail = PersonPeer::doSelect($c);
                 $allemail = array();
                 $pindex = 0;
                 foreach ($personemail as $getEmail) {
                     if (strlen($getEmail->getEmail()) > 0) {
                         $allemail[$pindex++] = $getEmail->getEmail();
                     } else {
                         if (strlen($getEmail->getSecondaryEmail()) > 0) {
                             $allemail[$pindex++] = $getEmail->getSecondaryEmail();
                         }
                     }
                 }
                 //$allemail[$pindex]="*****@*****.**";
                 $email['subject'] = "New Person added";
                 $link = $request->getHost() . "/person/view/" . $this->person->getId();
                 $body = "A new person added in " . $request->getHost() . "\r\n" . $this->person->getFirstName() . " " . $this->person->getLastName() . "\r\n Profile Link: " . $link;
                 $email['body'] = $body;
                 $email['sender_email'] = "*****@*****.**";
                 $this->getComponent('mail', 'sendBulk', array('subject' => $email['subject'], 'recievers' => $allemail, 'sender' => $email['sender_email'], 'body' => $email['body']));
             }
             if ($request->hasParameter('has')) {
                 $data = '';
                 if ($request->getParameter('camp_id')) {
                     $data = '&camp_id=' . $request->getParameter('camp_id');
                 }
                 $this->getUser()->setFlash('success', 'Step 1 : New Person information has been successfully created! Now you can add passenger!');
                 $this->redirect('@passenger_create?add_pass='******'has') . '&p_id=' . $this->person->getId() . $data);
             }
             if ($request->hasParameter('iti')) {
                 $this->getUser()->setFlash('success', 'Step 1 : New Person information has been successfully created! Now you can add passenger!');
                 $this->redirect('@passenger_create?add_pass_iti=' . $request->getParameter('iti') . '&p_id=' . $this->person->getId());
             }
             if ($request->hasParameter('contact')) {
                 $this->getUser()->setFlash('success', 'Step 1 : New Person information has been successfully created! Now you can add contact!');
                 $this->redirect('@contact_create?person_id=' . $this->person->getId());
             }
             $this->getUser()->setFlash('success', 'Person information has been successfully saved!');
             $last = $request->getParameter('back');
             $referer_session = $this->getUser()->getAttribute('ref');
             $back_url = '@person_view?id=' . $this->person->getId();
             $this->redirect($back_url);
         }
     } else {
         # Set referer URL
         $this->person_referer = $request->getReferer() ? $request->getReferer() : '@person';
     }
 }
Beispiel #17
0
     <?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());
     ?>
 <?php 
     if ($requester) {
         ?>
    <?php 
         $person = PersonPeer::retrieveByPK($requester->getPersonId());
         if ($person) {
             echo ($person->getTitle() ? $person->getTitle() . ' . ' : "") . $person->getFirstName() . ' ' . $person->getLastName();
         }
         ?>
 <?php 
     }
     ?>
 <?php 
 }
Beispiel #18
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 = RequesterPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setId($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setPersonId($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setAgencyId($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setTitle($arr[$keys[3]]);
     }
     if (array_key_exists($keys[4], $arr)) {
         $this->setHowFindAf($arr[$keys[4]]);
     }
 }