public function configure()
 {
     unset($this['id'], $this['person_id'], $this['agency_id']);
     $agencies = AgencyPeer::getForSelectParent();
     # Fields
     //    $this->widgetSchema['agency_id'] = new sfWidgetFormSelect(array('choices' => $agencies),array('class'=>'text narrow'));
     $this->widgetSchema['title'] = new sfWidgetFormInput(array(), array('class' => 'text'));
     $this->widgetSchema['how_find_af'] = new sfWidgetFormTextarea(array(), array('class' => 'text'));
     # Labels
     //    $this->widgetSchema->setLabels(array('agency_id' => 'Agency'));
     $this->widgetSchema->setLabels(array('title' => 'Title'));
     $this->widgetSchema->setLabels(array('how_find_af' => 'How find AF'));
     # Validation
     //    $this->validatorSchema['agency_id'] = new sfValidatorInteger(array('required' => false));
     $this->validatorSchema['title'] = new sfValidatorString(array('required' => false));
     $this->validatorSchema['how_find_af'] = new sfValidatorString(array('required' => false));
     #help
     $this->widgetSchema->setNameFormat('reqs[%s]');
 }
Exemple #2
0
 /**
  * Get the associated Agency object
  *
  * @param      PropelPDO Optional Connection object.
  * @return     Agency The associated Agency object.
  * @throws     PropelException
  */
 public function getAgency(PropelPDO $con = null)
 {
     if ($this->aAgency === null && $this->agency_id !== null) {
         $c = new Criteria(AgencyPeer::DATABASE_NAME);
         $c->add(AgencyPeer::ID, $this->agency_id);
         $this->aAgency = AgencyPeer::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->aAgency->addCamps($this);
         		 */
     }
     return $this->aAgency;
 }
Exemple #3
0
 /**
  * Selects a collection of Requester objects pre-filled with all related objects except Person.
  *
  * @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 Requester objects.
  * @throws     PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function doSelectJoinAllExceptPerson(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN)
 {
     foreach (sfMixer::getCallables('BaseRequesterPeer:doSelectJoinAllExcept:doSelectJoinAllExcept') as $callable) {
         call_user_func($callable, 'BaseRequesterPeer', $c, $con);
     }
     $c = clone $c;
     // Set the correct dbName if it has not been overridden
     // $c->getDbName() will return the same object if not set to another value
     // so == check is okay and faster
     if ($c->getDbName() == Propel::getDefaultDB()) {
         $c->setDbName(self::DATABASE_NAME);
     }
     RequesterPeer::addSelectColumns($c);
     $startcol2 = RequesterPeer::NUM_COLUMNS - RequesterPeer::NUM_LAZY_LOAD_COLUMNS;
     AgencyPeer::addSelectColumns($c);
     $startcol3 = $startcol2 + (AgencyPeer::NUM_COLUMNS - AgencyPeer::NUM_LAZY_LOAD_COLUMNS);
     $c->addJoin(array(RequesterPeer::AGENCY_ID), array(AgencyPeer::ID), $join_behavior);
     $stmt = BasePeer::doSelect($c, $con);
     $results = array();
     while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
         $key1 = RequesterPeer::getPrimaryKeyHashFromRow($row, 0);
         if (null !== ($obj1 = RequesterPeer::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 = RequesterPeer::getOMClass();
             $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
             $obj1 = new $cls();
             $obj1->hydrate($row);
             RequesterPeer::addInstanceToPool($obj1, $key1);
         }
         // if obj1 already loaded
         // Add objects for joined Agency rows
         $key2 = AgencyPeer::getPrimaryKeyHashFromRow($row, $startcol2);
         if ($key2 !== null) {
             $obj2 = AgencyPeer::getInstanceFromPool($key2);
             if (!$obj2) {
                 $omClass = AgencyPeer::getOMClass();
                 $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
                 $obj2 = new $cls();
                 $obj2->hydrate($row, $startcol2);
                 AgencyPeer::addInstanceToPool($obj2, $key2);
             }
             // if $obj2 already loaded
             // Add the $obj1 (Requester) to the collection in $obj2 (Agency)
             $obj2->addRequester($obj1);
         }
         // if joined row is not null
         $results[] = $obj1;
     }
     $stmt->closeCursor();
     return $results;
 }
Exemple #4
0
           $person_id = $requester->getPersonId();
           ?>
 <?php 
       }
       ?>
 <?php 
       if ($person_id) {
           ?>
       <?php 
           $person = PersonPeer::retrieveByPK($person_id);
           ?>
 <?php 
       }
       ?>
 <?php 
       $agency = AgencyPeer::retrieveByPK($requester->getAgencyId());
       ?>
 <?php 
       if (isset($agency)) {
           ?>
       <?php 
           $a_name = $agency->getName();
           ?>
 <?php 
       }
       ?>
 <tr>
   <td class="cell-1">
       <?php 
       if (isset($person)) {
           echo $person->getFirstName() . ' ' . $person->getLastName();
Exemple #5
0
?>
">
        <input type="hidden" name="id" value="<?php 
echo $itinerary->getId();
?>
">
      <?php 
//echo input_hidden_tag('leg_id', $mission_leg->getId());
if ($itinerary->getPassengerId()) {
    $passenger = PassengerPeer::retrieveByPK($itinerary->getPassengerId());
}
if ($itinerary->getRequesterId()) {
    $requester = RequesterPeer::retrieveByPK($itinerary->getRequesterId());
}
if ($itinerary->getAgencyId()) {
    $agency = AgencyPeer::retrieveByPK($itinerary->getAgencyId());
}
?>
        <div class="passenger-form">
    <div class="box full">
        <div id="show-alert" style="display: none; color: red">please select emails checkbox for sending mail</div>
      <div class="wrap">
          <h1>Send To:</h1>
      </div>
      <div class="wrap">
          <div class="legemail_box">
              <div class="heading">Passenger : <?php 
if ($itinerary->getPassengerId()) {
    echo $passenger->getPerson()->getFirstName();
}
?>
Exemple #6
0
 /**
  * Add or edit requester 
  * CODE: requester_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');
     }
     if ($request->getParameter('person_id')) {
         $this->person = PersonPeer::retrieveByPK($request->getParameter('person_id'));
     }
     if ($request->getParameter('id')) {
         $requester = RequesterPeer::retrieveByPK($request->getParameter('id'));
         $this->forward404Unless($requester);
         if (isset($requester)) {
             if ($requester->getAgencyId()) {
                 $agency = AgencyPeer::retrieveByPK($requester->getAgencyId());
                 if (isset($agency)) {
                     $this->agency_id = $agency->getId();
                 }
             }
         }
         $this->title = 'Edit requester';
         $success = 'Requester information has been successfully edited!';
         $this->person = PersonPeer::retrieveByPK($requester->getPersonId());
     } else {
         $requester = new Requester();
         if ($request->getParameter('agency_id')) {
             $this->agency_id = $request->getParameter('agency_id');
         }
         $this->title = 'Add requester';
         $success = 'Requester information has been successfully created!';
     }
     $this->agency = trim($this->getRequestParameter('agency', '*')) == '' ? '*' : trim($this->getRequestParameter('agency', '*'));
     #Agency PopUp Form
     $agency = new Agency();
     $this->form_a = new AgencyForm($agency);
     $this->a_referer = $request->getReferer();
     # requester Form
     $this->form = new RequesterForm($requester);
     $this->back = $request->getReferer();
     $this->requester = $requester;
     if (strstr($request->getReferer(), 'person/view')) {
         $this->f_back = 1;
     }
     if ($request->hasParameter('last')) {
         if ($request->getParameter('f_back')) {
             $this->f_back = 1;
         }
     }
     if ($request->isMethod('post')) {
         $this->referer = $request->getReferer();
         $this->form->bind($request->getParameter('reqs'));
         if ($this->form->isValid() && $request->getParameter('agency')) {
             if ($request->getParameter('agency')) {
                 $agency = AgencyPeer::getByName($request->getParameter('agency'));
             }
             if ($request->getParameter('person_id')) {
                 $person = PersonPeer::retrieveByPK($request->getParameter('person_id'));
                 $requester->setPersonId($person->getId());
             }
             if (isset($agency) && $agency instanceof Agency) {
                 $requester->setAgencyId($agency->getId());
             }
             $requester->setTitle($this->form->getValue('title'));
             $requester->setHowFindAf($this->form->getValue('how_find_af'));
             $requester->save();
             $this->getUser()->setFlash('success', $success);
             $last = $request->getParameter('back');
             $back_url = $last;
             if (strstr($last, '/requester')) {
                 $back_url = 'requester';
             } elseif (strstr($last, '/person/view')) {
                 $back_url = '@person_view?id=' . $person->getId();
             }
             if ($request->getParameter('last') == 1) {
                 $back_url = '@person_view?id=' . $person->getId();
             }
             $this->redirect($back_url);
         } else {
             $this->getUser()->setFlash('success', 'Please select an Agency!');
         }
     } else {
         # Set referer URL
         $this->referer = $request->getReferer() ? $request->getReferer() : '@requester';
     }
     $this->requester = $requester;
 }
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
 /**
  * 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());
         }
     }
 }
Exemple #9
0
    </div><!--bg-->
   </div><!--holder-->
  </div><!--addairport-popup-->
  <?php 
end_slot();
?>
  
<script type="text/javascript">
//<![CDATA[
jQuery(document).ready(function() {
  //Airport Form Check Ident Is used
  <?php 
$names = array();
$cities = array();
$count = 0;
$agencies = AgencyPeer::getNames();
//  $size = sizeof($names);
foreach ($agencies as $id => $name) {
    $names[$id] = $name;
}
foreach ($airports as $airport) {
    if ($airport->getIdent() && $airport->getCity()) {
        $cities[$airport->getIdent()] = $airport->getCity();
    }
}
?>

  var names = <?php 
echo json_encode($names);
?>
;
Exemple #10
0
 /**
  * missionRequests save all data into corresponding tables
  * CODE:mission_request_create
  */
 public function executeSave(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');
     }
     $miss_req_session = $this->getUser()->getAttribute('miss_req');
     if (!$miss_req_session) {
         return $this->forward('passenger', 'step3');
     }
     //set Requester Person
     $req_person = new Person();
     $req_person->setFirstName($miss_req_session->getReqFirstname());
     $req_person->setLastName($miss_req_session->getReqLastname());
     $req_person->setAddress1($miss_req_session->getReqAddress1());
     $req_person->setAddress2($miss_req_session->getReqAddress2());
     $req_person->setCity($miss_req_session->getReqCity());
     $req_person->setCounty($miss_req_session->getReqCounty());
     $req_person->setState($miss_req_session->getReqState());
     $req_person->setCountry($miss_req_session->getReqCountry());
     $req_person->setZipcode($miss_req_session->getReqZipcode());
     $req_person->setEmail($miss_req_session->getReqEmail());
     $req_person->setSecondaryEmail($miss_req_session->getReqSecondaryEmail());
     $req_person->setPagerEmail($miss_req_session->getReqPagerEmail());
     $req_person->setDayPhone($miss_req_session->getReqDayPhone());
     $req_person->setDayComment($miss_req_session->getReqDayComment());
     $req_person->setEveningPhone($miss_req_session->getReqEvePhone());
     $req_person->setEveningComment($miss_req_session->getReqEveComment());
     $req_person->setMobilePhone($miss_req_session->getReqMobilePhone());
     $req_person->setMobileComment($miss_req_session->getReqMobileComment());
     $req_person->setPagerPhone($miss_req_session->getReqPagerPhone());
     $req_person->setPagerComment($miss_req_session->getReqPagerComment());
     $req_person->setOtherPhone($miss_req_session->getReqOtherPhone());
     $req_person->setOtherComment($miss_req_session->getReqOtherComment());
     $req_person->save();
     //end of Requester Person
     // set Requester Agency
     $agency = AgencyPeer::getByNamePhone(trim($miss_req_session->getAgencyName()));
     if ($agency) {
         # nothing
     } else {
         $agency = new Agency();
         $agency->setName(trim($miss_req_session->getAgencyName()));
         $agency->save();
     }
     //set Requester
     $requester = new Requester();
     $requester->setPersonId($req_person->getId());
     $requester->setAgencyId($agency->getId());
     //$requester->setDischarge($miss_req_session->getReqDischarge());
     $requester->save();
     if (isset($miss_req_session->passenger_id)) {
         $passenger = PassengerPeer::retrieveByPK($miss_req_session->passenger_id);
         if (!$passenger instanceof Passenger) {
             $passenger = new Passenger();
         }
     } else {
         $passenger = new Passenger();
     }
     if ($passenger->isNew()) {
         $person = new Person();
     } else {
         $person = $passenger->getPerson();
     }
     //set Person to Passenger
     $person->setTitle($miss_req_session->getPassTitle());
     $person->setFirstName($miss_req_session->getPassFirstName());
     $person->setLastName($miss_req_session->getPassLastName());
     $person->setGender($miss_req_session->getPassGender());
     $person->setAddress1($miss_req_session->getPassAddress1());
     $person->setAddress2($miss_req_session->getPassAddress2());
     $person->setCity($miss_req_session->getPassCity());
     $person->setState($miss_req_session->getPassState());
     $person->setZipcode($miss_req_session->getPassZipcode());
     $person->setCountry($miss_req_session->getPassCountry());
     $person->setEmail($miss_req_session->getPassEmail());
     $person->setDayPhone($miss_req_session->getPassDayPhone());
     $person->setDayComment($miss_req_session->getPassDayComment());
     $person->setEveningPhone($miss_req_session->getPassEvePhone());
     $person->setEveningComment($miss_req_session->getPassEveComment());
     $person->setMobilePhone($miss_req_session->getPassMobilePhone());
     $person->setMobileComment($miss_req_session->getPassMobileComment());
     $person->setPagerPhone($miss_req_session->getPassPagerPhone());
     $person->setPagerComment($miss_req_session->getPassPagerComment());
     $person->setOtherPhone($miss_req_session->getPassOtherPhone());
     $person->setOtherComment($miss_req_session->getPassOtherComment());
     $person->save();
     //set Passenger
     $passenger->setPersonId($person->getId());
     $passenger->setPassengerTypeId($miss_req_session->getPassType());
     $passenger->setDateOfBirth($miss_req_session->getPassDateOfBirth());
     $passenger->setIllness($miss_req_session->getIllness());
     $passenger->setFinancial($miss_req_session->getFinancial());
     $passenger->setPublicConsiderations($miss_req_session->getPassPublicCons());
     $passenger->setPrivateConsiderations($miss_req_session->getPassPrivateCons());
     $passenger->setReleasingPhysician($miss_req_session->getReleasingPhysician());
     $passenger->setReleasingPhone($miss_req_session->getReleasePhone());
     $passenger->setReleasingFax1($miss_req_session->getReleaseFax());
     $passenger->setReleasingFax1Comment($miss_req_session->getReleaseFaxComment());
     $passenger->setLodgingName($miss_req_session->getLodgingName());
     $passenger->setLodgingPhone($miss_req_session->getLodgingPhone());
     $passenger->setLodgingPhoneComment($miss_req_session->getLodgingPhoneComment());
     $passenger->setFacilityName($miss_req_session->getFacilityName());
     $passenger->setFacilityPhone($miss_req_session->getFacilityPhone());
     $passenger->setFacilityPhoneComment($miss_req_session->getFacilityPhoneComment());
     $passenger->setReleasingEmail($miss_req_session->getReleaseEmail());
     $passenger->setTreatingPhysician($miss_req_session->getTreatingPhysician());
     $passenger->setTreatingPhone($miss_req_session->getTreatingPhone());
     $passenger->setTreatingFax1($miss_req_session->getTreatingFax());
     $passenger->setTreatingFax1Comment($miss_req_session->getTreatingFaxComment());
     $passenger->setTreatingEmail($miss_req_session->getTreatingEmail());
     $passenger->setLanguageSpoken($miss_req_session->getPassLanguage());
     $passenger->setBestContactMethod($miss_req_session->getBestContact());
     $passenger->setEmergencyContactName($miss_req_session->getEmergencyName());
     $passenger->setEmergencyContactPrimaryPhone($miss_req_session->getEmergencyPhone1());
     $passenger->setEmergencyContactPrimaryComment($miss_req_session->getEmergencyPhone1Comment());
     $passenger->setEmergencyContactSecondaryPhone($miss_req_session->getEmergencyPhone2());
     $passenger->setEmergencyContactSecondaryComment($miss_req_session->getEmergencyPhone2Comment());
     $passenger->setNeedMedicalRelease($miss_req_session->getPassMedical());
     $passenger->save();
     //set Companions
     if ($passenger && $miss_req_session->getCom1Name()) {
         $person = new Person();
         $names[] = split(" ", $miss_req_session->getCom1Name());
         //echo var_dump($names); die();
         $person->setFirstName($names[0][0]);
         $person->setLastName($names[0][1]);
         $person->setDayPhone($miss_req_session->getCom1Phone());
         $person->setDayComment($miss_req_session->getCom1Comment());
         $person->save();
         $companion = new Companion();
         $companion->setPassengerId($passenger->getId());
         $companion->setName($miss_req_session->getCom1Name());
         $companion->setRelationship($miss_req_session->getCom1Relationship());
         $companion->setDateOfBirth($miss_req_session->getCom1DateOfBirth());
         $companion->setWeight($miss_req_session->getCom1Weigth());
         $companion->setCompanionPhone($miss_req_session->getCom1Phone());
         $companion->setCompanionPhoneComment($miss_req_session->getCom1Comment());
         $companion->setPersonId($person->getId());
         $companion->save();
     }
     if ($passenger && $miss_req_session->getCom2Name()) {
         $person = new Person();
         $names[] = split(" ", $miss_req_session->getCom2Name());
         //echo var_dump($names); die();
         $person->setFirstName($names[0][0]);
         $person->setLastName($names[0][1]);
         $person->setDayPhone($miss_req_session->getCom2Phone());
         $person->setDayComment($miss_req_session->getCom2Comment());
         $person->save();
         $companion = new Companion();
         $companion->setPassengerId($passenger->getId());
         $companion->setName($miss_req_session->getCom2Name());
         $companion->setRelationship($miss_req_session->getCom2Relationship());
         $companion->setDateOfBirth($miss_req_session->getCom2DateOfBirth());
         $companion->setWeight($miss_req_session->getCom2Weigth());
         $companion->setCompanionPhone($miss_req_session->getCom2Phone());
         $companion->setCompanionPhoneComment($miss_req_session->getCom2Comment());
         $companion->setPersonId($person->getId());
         $companion->save();
     }
     if ($passenger && $miss_req_session->getCom3Name()) {
         $person = new Person();
         $names[] = split(" ", $miss_req_session->getCom3Name());
         //echo var_dump($names); die();
         $person->setFirstName($names[0][0]);
         $person->setLastName($names[0][1]);
         $person->setDayPhone($miss_req_session->getCom3Phone());
         $person->setDayComment($miss_req_session->getCom3Comment());
         $person->save();
         $companion = new Companion();
         $companion->setPassengerId($passenger->getId());
         $companion->setName($miss_req_session->getCom3Name());
         $companion->setRelationship($miss_req_session->getCom3Relationship());
         $companion->setDateOfBirth($miss_req_session->getCom3DateOfBirth());
         $companion->setWeight($miss_req_session->getCom3Weigth());
         $companion->setCompanionPhone($miss_req_session->getCom3Phone());
         $companion->setCompanionPhoneComment($miss_req_session->getCom3Comment());
         $companion->setPersonId($person->getId());
         $companion->save();
     }
     if ($passenger && $miss_req_session->getCom4Name()) {
         $person = new Person();
         $names[] = split(" ", $miss_req_session->getCom4Name());
         //echo var_dump($names); die();
         $person->setFirstName($names[0][0]);
         $person->setLastName($names[0][1]);
         $person->setDayPhone($miss_req_session->getCom4Phone());
         $person->setDayComment($miss_req_session->getCom4Comment());
         $person->save();
         $companion = new Companion();
         $companion->setPassengerId($passenger->getId());
         $companion->setName($miss_req_session->getCom4Name());
         $companion->setRelationship($miss_req_session->getCom4Relationship());
         $companion->setDateOfBirth($miss_req_session->getCom4DateOfBirth());
         $companion->setWeight($miss_req_session->getCom4Weigth());
         $companion->setCompanionPhone($miss_req_session->getCom4Phone());
         $companion->setCompanionPhoneComment($miss_req_session->getCom4Comment());
         $companion->setPersonId($person->getId());
         $companion->save();
     }
     if ($passenger && $miss_req_session->getCom5Name()) {
         $person = new Person();
         $names[] = split(" ", $miss_req_session->getCom5Name());
         //echo var_dump($names); die();
         $person->setFirstName($names[0][0]);
         $person->setLastName($names[0][1]);
         $person->setDayPhone($miss_req_session->getCom5Phone());
         $person->setDayComment($miss_req_session->getCom5Comment());
         $person->save();
         $companion = new Companion();
         $companion->setPassengerId($passenger->getId());
         $companion->setName($miss_req_session->getCom5Name());
         $companion->setRelationship($miss_req_session->getCom5Relationship());
         $companion->setDateOfBirth($miss_req_session->getCom5DateOfBirth());
         $companion->setWeight($miss_req_session->getCom5Weigth());
         $companion->setCompanionPhone($miss_req_session->getCom5Phone());
         $companion->setCompanionPhoneComment($miss_req_session->getCom5Comment());
         $companion->setPersonId($person->getId());
         $companion->save();
     }
     //set Itinerary
     $itinerary = ItineraryPeer::getByMissReqId($miss_req_session->getId());
     if (!$itinerary) {
         $new_itinerary = new Itinerary();
         $new_itinerary->setDateRequested(date('m/d/Y'));
         $new_itinerary->setMissionRequestId($miss_req_session->getId());
         $new_itinerary->setMissionTypeId($miss_req_session->getMissionRequestTypeId());
         $new_itinerary->setApointTime($miss_req_session->getApptDate());
         $new_itinerary->setPassengerId($passenger->getId());
         $new_itinerary->setRequesterId($requester->getId());
         $new_itinerary->setFacility($miss_req_session->getFacilityName());
         $new_itinerary->setLodging($miss_req_session->getLodgingName());
         $new_itinerary->setOrginCity($miss_req_session->getOrginCity());
         $new_itinerary->setOrginState($miss_req_session->getOrginState());
         $new_itinerary->setDestCity($miss_req_session->getDestCity());
         $new_itinerary->setDestState($miss_req_session->getDestState());
         $new_itinerary->setWaiverNeed(0);
         $new_itinerary->setNeedMedicalRelease($miss_req_session->getPassMedical());
         $new_itinerary->setComment($miss_req_session->getComment());
         $new_itinerary->setAgencyId($agency->getId());
         $new_itinerary->save();
     }
     //set default Mission to Mission table
     //get Passenger
     //$passenger = PassengerPeer::getByPersonId($person->getId());
     $misson = new Mission();
     $misson->setRequestId($miss_req_session->getId());
     $misson->setItineraryId($new_itinerary->getId());
     $misson->setMissionTypeId($miss_req_session->getMissionRequestTypeId());
     $misson->setDateRequested($miss_req_session->getRequesterDate());
     if ($passenger) {
         $misson->setPassengerId($passenger->getId());
     }
     if ($requester) {
         $misson->setRequesterId($requester->getId());
     }
     if ($agency) {
         $misson->setAgencyId($agency->getId());
     }
     // Farazi Mission 1 externa ID
     $c = new Criteria();
     $c->add(MissionPeer::EXTERNAL_ID, NULL, Criteria::ISNOTNULL);
     $c->addDescendingOrderByColumn(MissionPeer::ID);
     $external_mission = MissionPeer::doSelectOne($c);
     $external_id = $external_mission->getExternalId();
     $currentExternalId = $external_id + 1;
     $misson->setExternalId($currentExternalId);
     $misson->setApptDate($miss_req_session->getApptDate());
     $misson->setFlightTime($miss_req_session->getFlightTime());
     $misson->setMissionDate($miss_req_session->getMissionDate());
     $misson->setMissionCount(1);
     $misson->save();
     $missLeg = new MissionLeg();
     $missLeg->setMissionId($misson->getId());
     $missLeg->setLegNumber(1);
     if ($miss_req_session->getOrginState() && $miss_req_session->getOrginZipcode()) {
         //echo $miss_req_session->getOrginState().'-'.$miss_req_session->getOrginZipcode();die();
         $fromairport = AirportPeer::getAirportByStateAndZipcode($miss_req_session->getOrginState(), $miss_req_session->getOrginZipcode());
         if ($fromairport) {
             $missLeg->setFromAirportId($fromairport->getId());
         }
     }
     if ($miss_req_session->getDestState() && $miss_req_session->getDestZipcode()) {
         //echo $miss_req_session->getDestState().'--'.$miss_req_session->getDestZipcode();die();
         $toairport = AirportPeer::getAirportByStateAndZipcode($miss_req_session->getDestState(), $miss_req_session->getDestZipcode());
         if ($toairport) {
             $missLeg->setToAirportId($toairport->getId());
         }
     }
     //echo "oder";die();
     $missLeg->setPassOnBoard(0);
     $missLeg->setWebCoordinated(0);
     $missLeg->setTransportation('air_mission');
     $missLeg->save();
     //end set Mission
     $this->getUser()->setFlash('success', 'New mission has successfully created!');
     $miss_req_session->setProcessedDate(time());
     $miss_req_session->save();
     $this->getUser()->setAttribute('miss_req', null);
     //$this->redirect('miss_req');
     //$this->getUser()->setFlash('success',$success);
     //$request->getParameter('back')
     $this->redirect('/itinerary/detail/' . $new_itinerary->getId());
 }
Exemple #11
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;
 }
Exemple #13
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(AgencyPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     }
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria(AgencyPeer::DATABASE_NAME);
         $criteria->add(AgencyPeer::ID, $pks, Criteria::IN);
         $objs = AgencyPeer::doSelect($criteria, $con);
     }
     return $objs;
 }
Exemple #14
0
 public function executeAutoComplete()
 {
     $this->keyword = $this->getRequestParameter('agency');
     $this->agencies = AgencyPeer::getByFirstLetter($this->keyword);
 }
Exemple #15
0
    <td>Action</td>
  </tr>
</thead>
<tbody>
  <?php 
    foreach ($camps as $camp) {
        ?>
  
  <?php 
        $agency_id = $camp->getAgencyId();
        ?>
  <?php 
        if ($agency_id) {
            ?>
      <?php 
            $agency = AgencyPeer::retrieveByPK($agency_id);
            ?>
  <?php 
        }
        ?>
  
  <?php 
        $airport_id = $camp->getAirportId();
        ?>
  <?php 
        if ($airport_id) {
            ?>
      <?php 
            $airport = AirportPeer::retrieveByPK($airport_id);
            ?>
  <?php 
Exemple #16
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 = AgencyPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setId($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setName($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setAddress1($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setAddress2($arr[$keys[3]]);
     }
     if (array_key_exists($keys[4], $arr)) {
         $this->setCity($arr[$keys[4]]);
     }
     if (array_key_exists($keys[5], $arr)) {
         $this->setCounty($arr[$keys[5]]);
     }
     if (array_key_exists($keys[6], $arr)) {
         $this->setState($arr[$keys[6]]);
     }
     if (array_key_exists($keys[7], $arr)) {
         $this->setCountry($arr[$keys[7]]);
     }
     if (array_key_exists($keys[8], $arr)) {
         $this->setZipcode($arr[$keys[8]]);
     }
     if (array_key_exists($keys[9], $arr)) {
         $this->setPhone($arr[$keys[9]]);
     }
     if (array_key_exists($keys[10], $arr)) {
         $this->setComment($arr[$keys[10]]);
     }
     if (array_key_exists($keys[11], $arr)) {
         $this->setFaxPhone($arr[$keys[11]]);
     }
     if (array_key_exists($keys[12], $arr)) {
         $this->setFaxComment($arr[$keys[12]]);
     }
     if (array_key_exists($keys[13], $arr)) {
         $this->setEmail($arr[$keys[13]]);
     }
 }
Exemple #17
0
 /**
  * Searches for camps
  * CODE:camp_create
  */
 public function executeUpdate(sfWebRequest $request)
 {
     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');
     }
     sfContext::getInstance()->getConfiguration()->loadHelpers('Partial');
     $this->agencies = AgencyPeer::getForSelectParent();
     $this->agency = trim($this->getRequestParameter('agency', '*')) == '' ? '*' : trim($this->getRequestParameter('agency', '*'));
     $this->airport = trim($this->getRequestParameter('airport', '*')) == '' ? '*' : trim($this->getRequestParameter('airport', '*'));
     $this->airports = AirportPeer::doSelect(new Criteria());
     if ($request->getParameter('id')) {
         $camp = CampPeer::retrieveByPK($request->getParameter('id'));
         $this->forward404Unless($camp);
         if (isset($camp)) {
             if ($camp->getAgencyId()) {
                 $agency = AgencyPeer::retrieveByPK($camp->getAgencyId());
                 if (isset($agency)) {
                     $this->agency_id = $agency->getId();
                 }
             }
             if ($camp->getAirportId()) {
                 $airport = AirportPeer::retrieveByPK($camp->getAirportId());
                 if (isset($airport)) {
                     $this->airport_id = $airport->getId();
                 }
             }
         }
         $this->title = 'Edit camp';
         $success = 'Camp information has been successfully changed!';
         slot('nav_menu', array('mission_coord', ''));
     } else {
         $camp = new Camp();
         if ($request->getParameter('agency_id')) {
             $this->agency_id = $request->getParameter('agency_id');
         }
         $this->title = 'Add new camp';
         $success = 'Camp information has been successfully created!';
         slot('nav_menu', array('mission_coord', 'add-camp'));
     }
     //Agency PopUp Form
     $agency = new Agency();
     $this->form_a = new AgencyForm($agency);
     $this->a_referer = $request->getReferer();
     //Aiport PopUp Form
     $airport = new Airport();
     $this->form_airport = new AirportForm($airport);
     $this->airport_referer = $request->getReferer();
     $this->form = new CampForm($camp);
     if ($request->isMethod('post')) {
         $this->referer = $request->getParameter('referer');
         $this->form->bind($request->getParameter('camp'));
         $ma = '';
         foreach ($this->form as $pass_key => $pass_data) {
             $ma .= $pass_data . '|';
         }
         if ($this->form->isValid() && $request->getParameter('agency') != null) {
             if ($request->getParameter('agency')) {
                 $agency = AgencyPeer::getByName($request->getParameter('agency'));
             }
             if (isset($agency) && $agency instanceof Agency) {
                 $camp->setAgencyId($agency->getId());
             }
             //$aId = $camp->getAirportId();
             //$aInd = $request->getParameter('airport');
             $airport = AirportPeer::getByIdent($request->getParameter('airport'));
             /*if(!empty($aId)){
                 if(!empty($aInd)){
                     $camp->setAirportId($airport->getId());
                 }
                 else{
                     $camp->setAirportId($aId);
                 }
               }else{
                 if($airport) $camp->setAirportId($airport->getId());
               }*/
             /*if($request->getParameter('airport')){
                 $camp->setAirportId(null);
               }else{
                 $airport = AirportPeer::getByIdent($request->getParameter('airport'));
                 if(isset($airport) instanceof Airport){
                   $camp->setAirportId($airport->getId());
                 }
               }*/
             //$camp->setAirport($request->getParameter('airport_name'));
             $camp->setAirport($airport);
             $camp->setSession($this->form->getValue('session'));
             $camp->setCampName($this->form->getValue('camp_name'));
             $camp->setArrivalDate($this->form->getValue('arrival_date'));
             $camp->setDepartureDate($this->form->getValue('departure_date'));
             $camp->setArrivalComment($this->form->getValue('arrival_comment'));
             $camp->setDepartureComment($this->form->getValue('departure_comment'));
             $camp->setComment($this->form->getValue('comment'));
             if ($camp->isNew()) {
                 $content = $this->getUser()->getName() . ' added new Camp: ' . $camp->getCampName();
                 ActivityPeer::log($content);
             }
             $camp->save();
             $this->getUser()->setFlash('success', $success);
             if ($this->form->isNew()) {
                 $this->redirect('camp/view?id=' . $camp->getId());
             } else {
                 $this->redirect('camp/index?showlist=true');
             }
             //add passengers to camp then create new mission, legs
             //missions assocated with camps that will be a group mission
         } else {
             if ($request->getParameter('agency_id') == null) {
                 $this->getUser()->setFlash('warning', 'Please choose Agency!');
             }
         }
     } else {
         # Set referer URL
         $this->referer = $request->getReferer() ? $request->getReferer() : '@camp';
         //echo $this->referer;      exit ();
     }
     $this->camp = $camp;
 }