/** * * @return Requester */ public function getRequester() { if (!$this->aRequester instanceof Requester) { $this->aRequester = RequesterPeer::retrieveByPK($this->getRequesterId()); } return $this->aRequester; }
<?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 }
<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 } ?>
} ?> 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
/** * TODO: Check related records. * CODE: requester_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'); } if ($request->isMethod('delete')) { $request->checkCSRFProtection(); $requester = RequesterPeer::retrieveByPK($request->getParameter('id')); $this->forward404Unless($requester); //FK Constraint check //1.passenger if ($requester->countPassengers() > 0) { $this->getUser()->setFlash('warning', 'Requester has passengers.In order to delete, please delete related passenger information before!'); return $this->redirect('@requester'); } //2-mission if ($requester->countMissionsRelatedByRequesterId() > 0 or $requester->countMissionsRelatedByOtherRequesterId() > 0) { $this->getUser()->setFlash('warning', 'Requester has missions as requester or as other requester. In order to delete, please delete related mission information before!'); $this->redirect('@requester'); } $requester->delete(); $this->getUser()->setFlash('success', 'Requester information has been successfully deleted!'); } if ($request->getReferer()) { $back = $request->getReferer(); } else { $back = '@requester'; } return $this->redirect($back); }
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; }
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'); } } }
/** * 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()); } } }