예제 #1
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 
예제 #2
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();
}
?>
예제 #3
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();
예제 #4
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;
 }
예제 #5
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;
 }
 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;
 }
예제 #7
0
 /**
  * TODO: Check related records.
  * CODE:agency_delete
  */
 public function executeDelete(sfWebRequest $request)
 {
     # security
     if (!$this->getUser()->hasCredential(array('Administrator', 'Staff'), false)) {
         $this->getUser()->setFlash("warning", 'You don\'t have permission to access this url ' . $request->getReferer());
         $this->redirect('dashboard/index');
     }
     try {
         $agency = AgencyPeer::retrieveByPK($request->getParameter('id'));
         $this->forward404Unless($agency);
         $agency->delete();
         $this->getUser()->setFlash('success', 'Agency information has been successfully deleted!');
     } catch (Exception $e) {
         $this->getUser()->setFlash('warning', "There are related persons to this agency. Please remove them first.");
     }
     return $this->redirect('@agency');
 }
예제 #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());
         }
     }
 }