public function executeIndex(sfWebRequest $request) { $this->person = PersonPeer::retrieveByPK($this->getUser()->getId()); if ($pilot_id = $this->getUser()->getPilotId()) { $this->pilot = PilotPeer::retrieveByPK($pilot_id); } else { $this->pilot = null; } if ($member_id = $this->getUser()->getMemberId()) { $this->member = MemberPeer::retrieveByPK($member_id); // Farazi Renewal date calculation $date_now = strtotime("NOW"); $date_ren = strtotime($this->member->getRenewalDate()); $sub = $date_ren - $date_now; $preday = 0; if ($sub >= 86400) { $pday = $sub / 86400; $preday = explode('.', $pday); } else { $pday = $sub / 86400; $preday = explode('.', $pday); } $this->due_day = $preday[0]; //End Farazi Renewal date calculation } else { $this->member = null; } if ($this->member !== null && $this->pilot !== null) { $this->availability = $this->member->getAvailability(); } if (!$this->availability instanceof Availability) { $this->availability = new Availability(); } $this->email_lists = EmailListPeer::doSelect(new Criteria()); $this->subscribed_list = EmailListPersonPeer::getEmailListIdsByPersonId($this->person->getId()); }
?> <?php } ?> <?php } ?> </div> </td> <td class="cell-4"> <div class="s-list"> <?php if ($leg->getPilotId()) { ?> <?php $pilot = PilotPeer::retrieveByPK($leg->getPilotId()); ?> <?php if (isset($pilot)) { ?> <?php $member = MemberPeer::retrieveByPK($pilot->getMemberId()); ?> <?php if (isset($member)) { ?> <?php $person = PersonPeer::retrieveByPK($member->getPersonId()); ?> <?php if (isset($person)) {
if ($mission_legs) { $index = 0; $totabaggage = 0; foreach ($mission_legs as $mleg) { $totabaggage += $mleg->getBaggageWeight(); if ($mleg->getPilotId()) { $pilot_info = PilotPeer::retrieveByPK($mleg->getPilotId()); $pilot_person = $pilot_info->getMember()->getPerson(); $pilot_aircrafts = PilotAircraftPeer::getByMemberId($pilot_info->getMember()->getId()); } if ($mleg->getMissAssisId()) { $memberMiss = MemberPeer::retrieveByPK($mleg->getMissAssisId()); $miss_assi_persopn = $memberMiss->getPerson(); } if ($mleg->getBackupPilotId()) { $backup_pilot_info = PilotPeer::retrieveByPK($mleg->getPilotId()); $backupPilot_person = $backup_pilot_info->getMember()->getPerson(); } if ($mleg->getCoordinatorId()) { $coordinator = CoordinatorPeer::retrieveByPK($mleg->getCoordinatorId()); if ($coordinator->getMemberId()) { $coordiPerson = $coordinator->getMember()->getPerson(); } } if ($mleg->getMissAssisId()) { $memberMiss = MemberPeer::retrieveByPK($mleg->getMissAssisId()); $miss_assi_persopn = $memberMiss->getPerson(); } if ($mleg->getMissAssisId()) { $memberMiss = MemberPeer::retrieveByPK($mleg->getMissAssisId()); $miss_assi_persopn = $memberMiss->getPerson();
/** * Fills steps other than step1 * @param ApplicationTemp $app */ private function fillStepsRemaining(ApplicationTemp $app) { $app->setRenewal(1); $app->setPersonId($this->getUser()->getId()); $app->setPremiumChoice(1); $app->setPremiumSize(0); $member = MemberPeer::retrieveByPK($this->getUser()->getMemberId()); if ($member) { $app->setMemberId($member->getId()); $v = explode(' ', $member->getSpouseName()); $app->setSpouseFirstName((string) $v[0]); $app->setSpouseLastName((string) $v[1]); $app->setEmergencyContactName($member->getEmergencyContactName()); $app->setEmergencyContactPhone($member->getEmergencyContactPhone()); $app->setApplicantCopilot($member->getCoPilot()); $app->setLanguagesSpoken($member->getLanguages()); $app->setDateOfBirth($member->getDateOfBirth()); $app->setDriversLicenseNumber($member->getDriversLicenseNumber()); $app->setDriversLicenseState($member->getDriversLicenseState()); $app->setWeight($member->getWeight()); $app->setWingId($member->getWingId()); $app->setMemberClassId($member->getMemberClassId()); $pilot = PilotPeer::retrieveByPK($this->getUser()->getPilotId()); if ($pilot) { $airport = $pilot->getAirport(); $app->setHomeBase($airport->getIdent()); $v = array(); foreach ($airport->getFbos() as $fbo) { $v[] = $fbo->getName(); } $app->setFboName(implode(', ', $v)); $v = array(); if ($pilot->getIfr()) { $v[] = 'IFR'; } if ($pilot->getMultiEngine()) { $v[] = 'multi'; } if ($pilot->getOtherRatings()) { $v[] = 'other'; } if ($pilot->getSeInstructor()) { $v[] = $pilot->getSeInstructor(); } if ($pilot->getSeInstructor()) { $v[] = $pilot->getMeInstructor(); } if ($pilot->getLicenseType()) { $v[] = $pilot->getLicenseType(); } $app->setRatings(implode(', ', $v)); $app->setTotalHours($pilot->getTotalHours()); } $availability = $member->getAvailability(); if ($availability) { $app->setAvailabilityWeekdays($availability->getNoWeekday() ? 0 : 1); $app->setAvailabilityWeeknights($availability->getNoNight() ? 0 : 1); $app->setAvailabilityWeekends($availability->getNoWeekend() ? 0 : 1); $app->setAvailabilityLastMinute($availability->getLastMinute()); $app->setAvailabilityCopilot($availability->getAsMissionMssistant()); } $pilot_aircrafts = $member->getPilotAircrafts(); /* @var $p_a PilotAircraft */ if (isset($pilot_aircrafts[0])) { $p_a = $pilot_aircrafts[0]; $app->setAircraftPrimaryId($p_a->getAircraftId()); $app->setAircraftPrimaryOwn($p_a->getOwn()); $app->setAircraftPrimarySeats($p_a->getSeats()); $app->setAircraftPrimaryIce($p_a->getKnownIce()); $app->setAircraftPrimaryNNumber($p_a->getNNumber()); } if (isset($pilot_aircrafts[1])) { $p_a = $pilot_aircrafts[1]; $app->setAircraftSecondaryId($p_a->getAircraftId()); $app->setAircraftSecondaryOwn($p_a->getOwn()); $app->setAircraftSecondarySeats($p_a->getSeats()); $app->setAircraftSecondaryIce($p_a->getKnownIce()); $app->setAircraftSecondaryNNumber($p_a->getNNumber()); } if (isset($pilot_aircrafts[2])) { $p_a = $pilot_aircrafts[2]; $app->setAircraftThirdId($p_a->getAircraftId()); $app->setAircraftThirdOwn($p_a->getOwn()); $app->setAircraftThirdSeats($p_a->getSeats()); $app->setAircraftThirdIce($p_a->getKnownIce()); $app->setAircraftThirdNNumber($p_a->getNNumber()); } $application = $member->getLastApplication(); if ($application) { $app->setPremiumChoice($application->getPremiumChoice()); $app->setMissionOrientation($application->getMissionOrientation()); $app->setMissionCoordination($application->getMissionCoordination()); $app->setPilotRecruitment($application->getPilotRecruitment()); $app->setFundRaising($application->getFundRaising()); $app->setCelebrityContacts($application->getCelebrityContacts()); $app->setGraphicArts($application->getGraphicArts()); $app->setHospitalOutreach($application->getHospitalOutreach()); $app->setEventPlanning($application->getEventPlanning()); $app->setMediaRelations($application->getMediaRelations()); $app->setTelephoneWork($application->getTelephoneWork()); $app->setComputers($application->getComputers()); $app->setClerical($application->getClerical()); $app->setPrinting($application->getPrinting()); $app->setWriting($application->getWriting()); $app->setSpeakersBureau($application->getSpeakersBureau()); $app->setWingTeam($application->getWingTeam()); $app->setWebInternet($application->getWebInternet()); $app->setFoundationContacts($application->getFoundationContacts()); $app->setAviationContacts($application->getAviationContacts()); $app->setMemberAopa($application->getMemberAopa()); $app->setMemberKiwanis($application->getMemberKiwanis()); $app->setMemberRotary($application->getMemberRotary()); $app->setMemberLions($application->getMemberLions()); $app->setMember99s($application->getMember99s()); $app->setMemberWia($application->getMemberWia()); $app->setCompanyName($application->getCompany()); $app->setCompanyPosition($application->getCompanyPosition()); $app->setCompanyMatchFunds($application->getCompanyMatchFunds()); $app->setHeight($application->getHeight()); $app->setPilotCertificate($application->getPilotCertificate()); $app->setMedicalClass($application->getMedicalClass()); } } }
?> disabled="disabled" <?php } ?> name="miss_assis_mail[]" /> </div> <div class="leglabel">Email: </div> <div class="leg_filed"> <?php echo $miss_assis_id->getPerson()->getEmail(); ?> </div> </div> <?php } $backup_pilot_id = PilotPeer::retrieveByPK($miss_leg->getBackupPilotId()); if ($backup_pilot_id) { ?> <div class="legemail_box"> <div class="heading">Backup Pilot: <?php echo $backup_pilot_id->getMember()->getPerson()->getFirstName(); ?> <?php echo $backup_pilot_id->getMember()->getPerson()->getLastName(); ?> </div> <div class="chbox"> <input type="checkbox" <?php if (isset($backup_pilot_id) && $backup_pilot_id->getMember() && $backup_pilot_id->getMember()->getPerson() && $backup_pilot_id->getMember()->getPerson()->getEmail()) { ?> value="<?php
<?php } ?> <?php } ?> <?php } ?> </td> <td class="cell-1"> <?php if ($mission_leg->getCoPilotId()) { ?> <?php $cpilot = PilotPeer::retrieveByPK($mission_leg->getPilotId()); ?> <?php if (isset($cpilot)) { ?> <?php $cmember = MemberPeer::retrieveByPK($cpilot->getMemberId()); ?> <?php if (isset($cmember)) { ?> <?php $cperson = PersonPeer::retrieveByPK($cmember->getPersonId()); ?> <?php if (isset($cperson)) {
public static function getEmailAddressesOfPersonsRelatedToMissionLeg(MissionLeg $mission_leg) { $receivers = array(); // Get Coordinator email address $coordinator = CoordinatorPeer::retrieveByPK($mission_leg->getCoordinatorId()); if ($coordinator && ($coordinator = $coordinator->getMember())) { $coordinator = $coordinator->getPerson()->getEmail(); if (!empty($coordinator)) { // $receivers['coordinator_'.$mission_leg->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 Pilot email address $pilot = PilotPeer::retrieveByPK($mission_leg->getPilotId()); if ($pilot && ($pilot = $pilot->getMember())) { $pilot = $pilot->getPerson()->getEmail(); if (!empty($pilot)) { // $receivers['pilot_'.$mission_leg->getId()] = $pilot; if (preg_match('/^[_a-z0-9-]+(\\.[_a-z0-9-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,3})$/', $pilot)) { $receivers[] = $pilot; } } } unset($pilot); // Get Backup Pilot email address $backup_pilot = PilotPeer::retrieveByPK($mission_leg->getBackupPilotId()); if ($backup_pilot && ($backup_pilot = $backup_pilot->getMember())) { $backup_pilot = $backup_pilot->getPerson()->getEmail(); if (!empty($backup_pilot)) { // $receivers['backup_pilot_'.$mission_leg->getId()] = $backup_pilot; if (preg_match('/^[_a-z0-9-]+(\\.[_a-z0-9-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,3})$/', $backup_pilot)) { $receivers[] = $backup_pilot; } } } unset($backup_pilot); // Get Co-Pilot which is relate to Member $co_pilot = MemberPeer::retrieveByPK($mission_leg->getCopilotId()); if ($co_pilot) { $co_pilot = $co_pilot->getPerson()->getEmail(); if (!empty($co_pilot)) { // $receivers['co_pilot_'.$mission_leg->getId()] = $co_pilot; if (preg_match('/^[_a-z0-9-]+(\\.[_a-z0-9-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,3})$/', $co_pilot)) { $receivers[] = $co_pilot; } } } unset($co_pilot); // Get Backup Co-pilot email address $backup_co_pilot = MemberPeer::retrieveByPK($mission_leg->getBackupCopilotId()); if ($backup_co_pilot) { $backup_co_pilot = $backup_co_pilot->getPerson()->getEmail(); if (!empty($backup_co_pilot)) { // $receivers['backup_co_pilot_'.$mission_leg->getId()] = $backup_co_pilot; if (preg_match('/^[_a-z0-9-]+(\\.[_a-z0-9-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,3})$/', $backup_co_pilot)) { $receivers[] = $backup_co_pilot; } } } unset($backup_co_pilot); // Get mission assist email address $mission_assist = MemberPeer::retrieveByPK($mission_leg->getMissAssisId()); if ($mission_assist) { $mission_assist = $mission_assist->getPerson()->getEmail(); if (!empty($mission_assist)) { // $receivers['mission_assist_'.$mission_leg->getId()] = $mission_assist; if (preg_match('/^[_a-z0-9-]+(\\.[_a-z0-9-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,3})$/', $mission_assist)) { $receivers[] = $mission_assist; } } } unset($mission_assist); // Get Backup mission assist email address $backup_mission_assist = MemberPeer::retrieveByPK($mission_leg->getBackupMissAssisId()); if ($backup_mission_assist) { $backup_mission_assist = $backup_mission_assist->getPerson()->getEmail(); if (!empty($backup_mission_assist)) { // $receivers['backup_mission_assist_'.$mission_leg->getId()] = $backup_mission_assist; if (preg_match('/^[_a-z0-9-]+(\\.[_a-z0-9-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,3})$/', $backup_mission_assist)) { $receivers[] = $backup_mission_assist; } } } unset($backup_mission_assist); // Get Pilot Aircraft email address $pilot_aircraft = PilotAircraftPeer::retrieveByPK($mission_leg->getPilotAircraftId()); if ($pilot_aircraft && ($pilot_aircraft = $pilot_aircraft->getMember())) { $pilot_aircraft = $pilot_aircraft->getPerson()->getEmail(); if (!empty($pilot_aircraft)) { // $receivers['pilot_aircraft_'.$mission_leg->getId()] = $pilot_aircraft; if (preg_match('/^[_a-z0-9-]+(\\.[_a-z0-9-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,3})$/', $pilot_aircraft)) { $receivers[] = $pilot_aircraft; } } } unset($pilot_aircraft); // Get Share AFA ORG email address $afa_org = AfaOrgPeer::retrieveByPK($mission_leg->getShareAfaOrgId()); if ($afa_org) { $afa_org = $afa_org->getRefContactEmail(); if (!empty($afa_org)) { // $receivers['afa_org_'.$mission_leg->getId()] = $afa_org; if (preg_match('/^[_a-z0-9-]+(\\.[_a-z0-9-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,3})$/', $afa_org)) { $receivers[] = $afa_org; } } } unset($afa_org); return $receivers; }
/** * Removes the related airport. * CODE: airport_create */ public function executeUnlinkAirport(sfWebRequest $request) { # security if (!$this->getUser()->hasCredential(array('Administrator'), false)) { $this->getUser()->setFlash("warning", 'You don\'t have permission to access this url ' . $request->getReferer()); $this->redirect('dashboard/index'); } $pilot = PilotPeer::retrieveByPK($request->getParameter('id')); $this->forward404Unless($pilot); $pilot->setPrimaryAirportId(null); $pilot->save(); $this->getUser()->setFlash('success', 'Primary Airport information have successfully removed!'); $this->redirect('@pilot_view?id=' . $pilot->getId()); }
public function executeInstrumentNotication(sfWebRequest $request) { $c = new Criteria(); $c->add(PersonRolePeer::PERSON_ID, $this->getUser()->getId()); $c->addJoin(PersonRolePeer::ROLE_ID, RoleNotificationPeer::ROLE_ID); $personNotification = RoleNotificationPeer::doSelect($c); $this->mid = 0; foreach ($personNotification as $key => $value) { $this->mid = $value->getMid(); $this->notification = $value->getNotification(); //5. person add if ($this->mid == 5 && ($this->notification == 2 || $this->notification == 3)) { $c = new Criteria(); $c->addDescendingOrderByColumn(PersonPeer::ID); $c->setLimit(5); $this->newperson = PersonPeer::doSelect($c); } } $this->host = $request->getHost(); $this->memberId = $this->getUser()->getMemberId(); //$query = "SELECT COUNT(pilot_request.accepted) FROM pilot_request "; //$query .="WHERE pilot_request.accepted = 1 AND pilot_request.processed = 1 AND pilot_request.member_id = ".$this->memberId; //$con = Propel::getConnection(); //$stmt = $con->prepare($query); //$stmt->execute(); /*if($rs = $stmt->fetch(PDO::FETCH_NUM)) { $count = (int)$rs[0]; }else{ $count = 0; }*/ $c = new Criteria(); $c->add(PilotRequestPeer::ACCEPTED, 1); $c->add(PilotRequestPeer::PROCESSED, 1); $c->add(PilotRequestPeer::MEMBER_ID, $this->memberId); $this->totalAccepted = PilotRequestPeer::doCount($c); /* $this->memberId = $this->getUser()->getMemberId(); $query = "SELECT COUNT(pilot_request.accepted) FROM pilot_request "; $query .="WHERE pilot_request.accepted = 0 AND pilot_request.member_id = $this->memberId"; $con = Propel::getConnection(); $stmt = $con->prepare($query); $stmt->execute(); if($rs = $stmt->fetch(PDO::FETCH_NUM)) { $count = (int)$rs[0]; }else{ $count = 0; }*/ $c = new Criteria(); $c->add(PilotRequestPeer::ACCEPTED, 0); $c->add(PilotRequestPeer::MEMBER_ID, $this->memberId); $this->totaldeclined = PilotRequestPeer::doCount($c); $c = new Criteria(); $c->add(MissionLegPeer::PILOT_ID, $this->getUser()->getPilotId()); $c->add(MissionLegPeer::CANCEL_MISSION_LEG, 0); $this->totalMissionCancellation = MissionLegPeer::doCount($c); //total signup events count $pilot_id = $this->getUser()->getPilotId(); if ($pilot_id) { $pilot = PilotPeer::retrieveByPK($pilot_id); $member_id = $pilot->getMemberId(); $date = date('Y-m-d'); $c = new Criteria(); $c->add(EventReservationPeer::MEMBER_ID, $member_id, Criteria::EQUAL); $c->addJoin(EventPeer::ID, EventReservationPeer::EVENT_ID); $c->add(EventPeer::EVENT_DATE, $date, Criteria::GREATER_EQUAL); $this->totalSignupEvents = EventReservationPeer::doCount($c); } // }
} //Pilot if ($mission_leg->getPilotId()) { $pilot = PilotPeer::retrieveByPK($mission_leg->getPilotId()); $pilotMember = $pilot->getMember(); $pilot_person = PersonPeer::retrieveByPK($pilotMember->getPersonId()); $pilot_aircrafts = PilotAircraftPeer::getByMemberId($pilot->getMemberId()); } // Mission Assistant if ($mission_leg->getMissAssisId()) { $mission_assistant = MemberPeer::retrieveByPK($mission_leg->getMissAssisId()); $miss_assi_persopn = PersonPeer::retrieveByPK($mission_assistant->getPersonId()); } // Backup Pilot if ($mission_leg->getBackupPilotId()) { $backupPilot = PilotPeer::retrieveByPK($mission_leg->getBackupPilotId()); $backupPilotMember = $pilot->getMember(); $backupPilot_person = PersonPeer::retrieveByPK($backupPilotMember->getPersonId()); } /* echo "<pre>"; print_r($pilotMember); die(); //*/ //Companions information $companions = CompanionPeer::getByPassId($passenger->getId()); if ($passenger) { $passenger_type = $passenger->getPassengerType(); } $is_air = $mission_leg->getTransportation() == 'air_mission'; if ($is_air) {
public function executePilotSignupEventDetail(sfWebRequest $request) { $pilot_id = $this->getUser()->getPilotId(); $pilot = PilotPeer::retrieveByPK($pilot_id); $member_id = $pilot->getMemberId(); $this->processFilterNew($request); $this->pager = EventPeer::getsignupPager($this->max, $this->page, $member_id); $this->events = $this->pager->getResults(); $this->total = $this->pager->getNbResults(); }
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'); } } }
public function executeDeactive(sfWebRequest $request) { $pilot = PilotPeer::retrieveByPK($request->getParameter('id')); $pilot->setMopActiveStatus(0); $pilot->save(); return sfView::NONE; }