public static function retrieveByCodes($member_codes, $con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } $objs = null; if (empty($member_codes)) { $objs = array(); } else { $criteria = new Criteria(); $criteria->add(MemberPeer::CODE, $member_codes, Criteria::IN); $objs = MemberPeer::doSelect($criteria, $con); } return $objs; }
/** * Executes index action * * @param sfRequest $request A request object */ public function executeIndex(sfWebRequest $request) { # for navigation menu sfContext::getInstance()->getConfiguration()->loadHelpers('Partial'); slot('nav_menu', array('instrument', '')); #security /* if( !$this->getUser()->hasCredential(array('Administrator','Staff','Pilot','Member','Coordinator','Volunteer'), false)){ $this->getUser()->setFlash("warning", 'You don\'t have permission to access this url '.$request->getReferer()); $this->redirect('dashboard/index'); }*/ if ($request->getParameter('type')) { $this->flag = 1; } if ($request->hasParameter('return')) { $this->pilot_request = 1; } if ($request->hasParameter('avail')) { $this->window_loc = 'avail'; } if ($request->hasParameter('window_loc_visual')) { $this->window_loc_visual = 'window_loc_visual'; } $member_id = $this->getUser()->getMemberId(); $member = MemberPeer::retrieveByPK($member_id); $pilot = $member->getPilot(); if ($request->getParameter('first') == 1) { if ($pilot) { $first_airport = AirportPeer::retrieveByPK($pilot->getPrimaryAirportId()); $this->orgin_airport = $first_airport->getIdent(); } $this->types = MissionTypePeer::getOnlyNames(); $this->dest_airport = null; $this->miss_type = null; $this->miss_date1 = null; $this->miss_date2 = null; } else { $this->processFilterVisual($request); } $this->airport_list = AirportPeer::getMappable(); $this->legs = MissionLegPeer::getMappable($this->orgin_airport, $this->dest_airport, $this->miss_type, $this->miss_date1, $this->miss_date2); $this->date_widget = new widgetFormDate(array('format_date' => array('js' => 'mm/dd/yy', 'php' => 'm/d/Y')), array('class' => 'text')); }
?> </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)) { ?> <?php echo $person->getTitle() . $person->getFirstName() . ' ' . $person->getLastName() . '<br/>'; ?> <?php if ($person->getEmail()) {
public function countMembers($criteria = null, $distinct = false, $con = null) { include_once 'lib/model/om/BaseMemberPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } $criteria->add(MemberPeer::MEMBER_DETAIL_ID, $this->getId()); return MemberPeer::doCount($criteria, $distinct, $con); }
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(); } if ($mleg->getFboId()) { $fbo = FboPeer::retrieveByPK($mleg->getFboId()); if ($fbo->getAirportId()) { $fbo_airport = AirportPeer::retrieveByPK($fbo->getAirportId()); } } $is_air = $mleg->getTransportation() == 'air_mission'; if ($is_air) { $to_airport = $mleg->getAirportRelatedByToAirportId(); $from_airport = $mleg->getAirportRelatedByFromAirportId(); } //// FBO information if ($mleg->getFboId()) {
foreach ($sc as $k => $v) { $v = explode('#', $v); if ($v[0] == 'year') { $yr = date('Y'); if (strlen($yr) <= $v[1]) { $no_reg .= str_pad($yr, $v[1], '0', STR_PAD_LEFT); } else { $no_reg .= substr($yr, strlen($yr) - $v[1]); } $no_reg_len += $v[1]; } elseif ($v[0] == 'seq') { $c = new Criteria(); $c->add(MemberPeer::NO_REG, $no_reg . '%', Criteria::LIKE); $c->addDescendingOrderByColumn(MemberPeer::NO_REG); $c->setLimit(1); $last_employee = MemberPeer::doSelectOne($c); if ($last_employee) { $las = $last_employee->getNoReg(); $las = substr_replace($las, '', 0, $no_reg_len); $las = substr($las, 0, $v[1]); $las++; $no_reg .= str_pad($las, $v[1], '0', STR_PAD_LEFT); } else { $no_reg .= str_pad(1, $v[1], '0', STR_PAD_LEFT); break; } } $sc[$k] = $v; } echo object_input_tag($member, 'getNoReg', array('size' => 12, 'readonly' => false), $no_reg); ?>
protected function processStep3Check(sfWebRequest $request) { $default_airport = AirportPeer::getByIdent(sfConfig::get('app_default_airport_ident')); $this->forward404Unless($default_airport); $app = $this->application_temp; $person = $this->person; if (!$person instanceof Person) { $person = new Person(); } /* @var $app ApplicationTemp */ /* @var $person Person */ // Person $tmp_arr = $app->toArray(BasePeer::TYPE_FIELDNAME); $tmp_arr['evening_phone'] = $tmp_arr['eve_phone']; $tmp_arr['evening_comment'] = $tmp_arr['eve_comment']; unset($tmp_arr['id']); $person->fromArray($tmp_arr, BasePeer::TYPE_FIELDNAME); $person->save(); // Member $member = MemberPeer::retrieveByPK($app->getMemberId()); if (!$member instanceof Member) { $member = new Member(); } $member->setActive(1); $member->setCoPilot($app->getApplicantCopilot()); $member->setContact('By Email'); $member->setDateOfBirth($app->getDateOfBirth()); $member->setDriversLicenseState($app->getDriversLicenseState()); $member->setDriversLicenseNumber($app->getDriversLicenseNumber()); $member->setEmergencyContactName($app->getEmergencyContactName()); $member->setEmergencyContactPhone($app->getEmergencyContactPhone()); $member->setFlightStatus($app->getApplicantPilot() ? 'Verify Orientation' : 'Non-pilot'); //$member->setJoinDate(time()); $member->setLanguages($app->getLanguagesSpoken()); //Farazi //$member->setMasterMemberId($app->getMasterMemberId()); // Get Last renewal date $this->member = MemberPeer::retrieveByPK($app->getMemberId()); $lastRenewalDate = strtotime($this->member->getRenewalDate()); $member->setMemberClassId($app->getMemberClassId()); $member->setPersonId($person->getId()); $member->setRenewedDate(time()); ///Farazi Renewal Date From Memberclass if ($app->getMemberClassId()) { $memclass = MemberClassPeer::retrieveByPK($app->getMemberClassId()); $renewal_period = $memclass->getRenewalPeriod(); $renewalTime = strtotime('+' . $renewal_period . ' month', $lastRenewalDate); //echo $renewalTime; $member->setRenewalDate($renewalTime); //$member->setRenewalDate(strtotime('+'.$renewal_period.' month')); } // Farazi End //$member->setRenewalDate(strtotime('+1 year')); $member->setSpouseName($app->getSpouseFirstName() . ' ' . $app->getSpouseLastName()); $member->setWeight($app->getWeight()); $member->setWingId($app->getWingId()); $member->save(); // Pilot if ($app->getApplicantPilot()) { $pilot = $member->getPilot(); if (!$pilot instanceof Pilot) { $pilot = new Pilot(); } if ($pilot->isNew()) { // remove aircrafts foreach ($member->getPilotAircrafts() as $p_a) { PilotAircraftPeer::doDelete($p_a); } } $pilot->setMemberId($member->getId()); $airport = AirportPeer::getByIdent($app->getHomeBase()); if (!$airport instanceof Airport) { $airport = $default_airport; } $pilot->setPrimaryAirportId($airport->getId()); $pilot->setTotalHours($app->getTotalHours()); $pilot->setLicenseType('Private'); foreach (sfConfig::get('app_pilot_license_types') as $key => $val) { if (stripos($app->getRatings(), $key) !== false) { $pilot->setLicenseType($key); } } $pilot->setIfr(stripos($app->getRatings(), 'ifr') !== false ? 1 : 0); $pilot->setMultiEngine(stripos($app->getRatings(), 'multi') !== false ? 1 : 0); $pilot->setSeInstructor('No'); // @see ApplicationForm foreach (sfConfig::get('app_pilot_se_instructor') as $key => $val) { if (stripos($app->getRatings(), $key) !== false) { $pilot->setSeInstructor($key); } } $pilot->setMeInstructor($pilot->getSeInstructor()); $pilot->save(); // Availability $availability = $member->getAvailability(); if (!$availability instanceof Availability) { $availability = new Availability(); } $availability->setMemberId($member->getId()); $availability->setNotAvailable(0); $availability->setNoWeekday($app->getAvailabilityWeekdays() == 0); $availability->setNoNight($app->getAvailabilityWeeknights() == 0); $availability->setLastMinute($app->getAvailabilityLastMinute()); $availability->setAsMissionMssistant($app->getAvailabilityCopilot()); $availability->setNoWeekend($app->getAvailabilityWeekends() == 0); $availability->save(); //Farazi //Delete all aircrafts $pilot_aircrafts = PilotAircraftPeer::getByMemberId($member->getId()); foreach ($pilot_aircrafts as $pilot_aircraft) { $pilot_aircraft->delete(); } // Primary aircraft if ($app->getAircraftPrimaryId() && ($aircraft = AircraftPeer::retrieveByPK($app->getAircraftPrimaryId()))) { $pilot_aircraft = new PilotAircraft(); $pilot_aircraft->setMemberId($member->getId()); $pilot_aircraft->setAircraftId($aircraft->getId()); $pilot_aircraft->setNNumber($app->getAircraftPrimaryNNumber()); $pilot_aircraft->setOwn($app->getAircraftPrimaryOwn()); $pilot_aircraft->setSeats($app->getAircraftPrimarySeats()); $pilot_aircraft->setKnownIce($app->getAircraftPrimaryIce()); $pilot_aircraft->save(); } // Secondary aircraft if ($app->getAircraftSecondaryId() && ($aircraft = AircraftPeer::retrieveByPK($app->getAircraftSecondaryId()))) { $pilot_aircraft = new PilotAircraft(); $pilot_aircraft->setMemberId($member->getId()); $pilot_aircraft->setAircraftId($aircraft->getId()); $pilot_aircraft->setNNumber($app->getAircraftSecondaryNNumber()); $pilot_aircraft->setOwn($app->getAircraftSecondaryOwn()); $pilot_aircraft->setSeats($app->getAircraftSecondarySeats()); $pilot_aircraft->setKnownIce($app->getAircraftSecondaryIce()); $pilot_aircraft->save(); } // Third aircraft if ($app->getAircraftThirdId() && ($aircraft = AircraftPeer::retrieveByPK($app->getAircraftThirdId()))) { $pilot_aircraft = new PilotAircraft(); $pilot_aircraft->setMemberId($member->getId()); $pilot_aircraft->setAircraftId($aircraft->getId()); $pilot_aircraft->setNNumber($app->getAircraftThirdNNumber()); $pilot_aircraft->setOwn($app->getAircraftThirdOwn()); $pilot_aircraft->setSeats($app->getAircraftThirdSeats()); $pilot_aircraft->setKnownIce($app->getAircraftThirdIce()); $pilot_aircraft->save(); } } // Application_temp $app->setPersonId($person->getId()); $app->setMemberId($member->getId()); $app->setProcessedDate(time()); $app->save(); // Application $tmp_arr = $app->toArray(BasePeer::TYPE_FIELDNAME); $tmp_arr['date'] = $tmp_arr['application_date']; $tmp_arr['company'] = $tmp_arr['company_name']; foreach (sfConfig::get('app_pilot_license_types') as $key => $val) { if (stripos($tmp_arr['ratings'], $key) !== false) { $tmp_arr['license_type'] = $key; } } $tmp_arr['ifr'] = stripos($tmp_arr['ratings'], 'ifr') !== false ? 1 : 0; $tmp_arr['multi_engine'] = stripos($tmp_arr['ratings'], 'multi') !== false ? 1 : 0; $tmp_arr['se_instructor'] = 'No'; // @see ApplicationForm foreach (sfConfig::get('app_pilot_se_instructor') as $key => $val) { if (stripos($tmp_arr['ratings'], $key) !== false) { $tmp_arr['se_instructor'] = $key; } } $tmp_arr['me_instructor'] = $tmp_arr['se_instructor']; $tmp_arr['other_ratings'] = $tmp_arr['ratings']; $tmp_arr['fbo'] = $tmp_arr['fbo_name']; $tmp_arr['member_meetings'] = 0; $tmp_arr['executive_board'] = 0; $tmp_arr['dues_amount_paid'] = $tmp_arr['dues_amount_paid'] ? $tmp_arr['dues_amount_paid'] : 0; $tmp_arr['donation_amount_paid'] = $tmp_arr['donation_amount_paid'] ? $tmp_arr['donation_amount_paid'] : 0; unset($tmp_arr['id']); $application = new Application(); $application->fromArray($tmp_arr, BasePeer::TYPE_FIELDNAME); $application->save(); $this->getUser()->setFlash('success', 'Membership renewal completed successfully.'); //$this->redirect('renewal/processComplete?id='.$member->getId()); $this->redirect('renewal/processStep3?id=' . $this->application_temp->getId()); //$this->redirect('renewal/index?id='.$member->getId()); }
/** * If this collection has already been initialized with * an identical criteria, it returns the collection. * Otherwise if this Person is new, it will return * an empty collection; or if this Person has previously * been saved, it will retrieve related Members from storage. * * This method is protected by default in order to keep the public * api reasonable. You can provide public methods for those you * actually need in Person. */ public function getMembersJoinMemberRelatedByMasterMemberId($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) { if ($criteria === null) { $criteria = new Criteria(PersonPeer::DATABASE_NAME); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } if ($this->collMembers === null) { if ($this->isNew()) { $this->collMembers = array(); } else { $criteria->add(MemberPeer::PERSON_ID, $this->id); $this->collMembers = MemberPeer::doSelectJoinMemberRelatedByMasterMemberId($criteria, $con, $join_behavior); } } else { // the following code is to determine if a new query is // called for. If the criteria is the same as the last // one, just return the collection. $criteria->add(MemberPeer::PERSON_ID, $this->id); if (!isset($this->lastMemberCriteria) || !$this->lastMemberCriteria->equals($criteria)) { $this->collMembers = MemberPeer::doSelectJoinMemberRelatedByMasterMemberId($criteria, $con, $join_behavior); } } $this->lastMemberCriteria = $criteria; return $this->collMembers; }
protected function processForm(sfWebRequest $request, sfForm $form) { $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName())); if ($form->isValid()) { $application = $form->save(); $this->getUser()->setFlash('success', 'Application have successfully saved!'); $this->redirect('@default?module=application&action=view&id=' . $application->getId()); } $this->member = MemberPeer::retrieveByPK($form['member_id']->getValue()); $this->forward404Unless($this->member); $this->person = $this->member->getPerson(); }
foreach ($sc as $k => $v) { $v = explode('#', $v); if ($v[0] == 'year') { $yr = date('Y'); if (strlen($yr) <= $v[1]) { $no_reg .= str_pad($yr, $v[1], '0', STR_PAD_LEFT); } else { $no_reg .= substr($yr, strlen($yr) - $v[1]); } $no_reg_len += $v[1]; } elseif ($v[0] == 'seq') { $c = new Criteria(); $c->add(MemberPeer::NO_REG, $no_reg . '%', Criteria::LIKE); $c->addDescendingOrderByColumn(MemberPeer::NO_REG); $c->setLimit(1); $last_student = MemberPeer::doSelectOne($c); if ($last_student) { $las = $last_student->getNoReg(); $las = substr_replace($las, '', 0, $no_reg_len); $las = substr($las, 0, $v[1]); $las++; $no_reg .= str_pad($las, $v[1], '0', STR_PAD_LEFT); } else { $no_reg .= str_pad(1, $v[1], '0', STR_PAD_LEFT); break; } } $sc[$k] = $v; } echo object_input_tag($member, 'getNoReg', array('size' => 12, 'readonly' => false), $no_reg); ?>
public static function doSelectJoinAllExceptStudentDetail(Criteria $c, $con = null) { $c = clone $c; if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } VStudentActivePeer::addSelectColumns($c); $startcol2 = VStudentActivePeer::NUM_COLUMNS - VStudentActivePeer::NUM_LAZY_LOAD_COLUMNS + 1; CurriculumPeer::addSelectColumns($c); $startcol3 = $startcol2 + CurriculumPeer::NUM_COLUMNS; AcademicCalendarPeer::addSelectColumns($c); $startcol4 = $startcol3 + AcademicCalendarPeer::NUM_COLUMNS; ClassGroupPeer::addSelectColumns($c); $startcol5 = $startcol4 + ClassGroupPeer::NUM_COLUMNS; TestApplicantPeer::addSelectColumns($c); $startcol6 = $startcol5 + TestApplicantPeer::NUM_COLUMNS; MemberPeer::addSelectColumns($c); $startcol7 = $startcol6 + MemberPeer::NUM_COLUMNS; $c->addJoin(VStudentActivePeer::CURRICULUM_ID, CurriculumPeer::ID); $c->addJoin(VStudentActivePeer::ACADEMIC_CALENDAR_ID, AcademicCalendarPeer::ID); $c->addJoin(VStudentActivePeer::CLASS_GROUP_ID, ClassGroupPeer::ID); $c->addJoin(VStudentActivePeer::TEST_APPLICANT_ID, TestApplicantPeer::ID); $c->addJoin(VStudentActivePeer::MEMBER_ID, MemberPeer::ID); $rs = BasePeer::doSelect($c, $con); $results = array(); while ($rs->next()) { $omClass = VStudentActivePeer::getOMClass(); $cls = Propel::import($omClass); $obj1 = new $cls(); $obj1->hydrate($rs); $omClass = CurriculumPeer::getOMClass(); $cls = Propel::import($omClass); $obj2 = new $cls(); $obj2->hydrate($rs, $startcol2); $newObject = true; for ($j = 0, $resCount = count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; $temp_obj2 = $temp_obj1->getCurriculum(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addVStudentActive($obj1); break; } } if ($newObject) { $obj2->initVStudentActives(); $obj2->addVStudentActive($obj1); } $omClass = AcademicCalendarPeer::getOMClass(); $cls = Propel::import($omClass); $obj3 = new $cls(); $obj3->hydrate($rs, $startcol3); $newObject = true; for ($j = 0, $resCount = count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; $temp_obj3 = $temp_obj1->getAcademicCalendar(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; $temp_obj3->addVStudentActive($obj1); break; } } if ($newObject) { $obj3->initVStudentActives(); $obj3->addVStudentActive($obj1); } $omClass = ClassGroupPeer::getOMClass(); $cls = Propel::import($omClass); $obj4 = new $cls(); $obj4->hydrate($rs, $startcol4); $newObject = true; for ($j = 0, $resCount = count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; $temp_obj4 = $temp_obj1->getClassGroup(); if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { $newObject = false; $temp_obj4->addVStudentActive($obj1); break; } } if ($newObject) { $obj4->initVStudentActives(); $obj4->addVStudentActive($obj1); } $omClass = TestApplicantPeer::getOMClass(); $cls = Propel::import($omClass); $obj5 = new $cls(); $obj5->hydrate($rs, $startcol5); $newObject = true; for ($j = 0, $resCount = count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; $temp_obj5 = $temp_obj1->getTestApplicant(); if ($temp_obj5->getPrimaryKey() === $obj5->getPrimaryKey()) { $newObject = false; $temp_obj5->addVStudentActive($obj1); break; } } if ($newObject) { $obj5->initVStudentActives(); $obj5->addVStudentActive($obj1); } $omClass = MemberPeer::getOMClass(); $cls = Propel::import($omClass); $obj6 = new $cls(); $obj6->hydrate($rs, $startcol6); $newObject = true; for ($j = 0, $resCount = count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; $temp_obj6 = $temp_obj1->getMember(); if ($temp_obj6->getPrimaryKey() === $obj6->getPrimaryKey()) { $newObject = false; $temp_obj6->addVStudentActive($obj1); break; } } if ($newObject) { $obj6->initVStudentActives(); $obj6->addVStudentActive($obj1); } $results[] = $obj1; } return $results; }
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 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; }
<?php include_once dirname(__FILE__) . '/../../bootstrap/unit.php'; include_once dirname(__FILE__) . '/../../bootstrap/database.php'; $t = new lime_test(null, new lime_output_color()); //------------------------------------------------------------ $t->diag('Member::getProfiles()'); $member = MemberPeer::retrieveByPK(1); $t->isa_ok($member->getProfiles(), 'array', 'getProfiles() returns array'); //------------------------------------------------------------ $t->diag('Member::getProfile()'); $t->cmp_ok($member->getProfile('sex'), '===', 1, 'getProfile() returns a value'); $t->cmp_ok($member->getProfile('self_intro'), '===', 'よろしくお願いします。', 'getProfile() returns a value'); $t->cmp_ok($member->getProfile('example'), '===', NULL, 'getProfile() returns NULL if profileName is not registerd by member'); $t->cmp_ok($member->getProfile('unknown'), '===', NULL, 'getProfile() returns NULL if profileName does not exist');
public function executeFreeCard3() { $id = $this->getRequestParameter('id'); $this->valid_until = $this->getRequestParameter('valid_until'); $this->forward404Unless($id); $this->member = MemberPeer::retrieveByPK($id); $this->forward404Unless($this->member); }
public function executeNewPassword(sfWebRequest $request) { if ($request->isMethod('post')) { $request->checkCSRFProtection(); $member_Extar_id = $request->getParameter('member_id2'); $username = $request->getParameter('usernamee'); $password = $request->getParameter('passwordd'); $confirm = $request->getParameter('corfirm_passwordd'); $lastname = $request->getParameter('lastname'); $zipcode = $request->getParameter('zipcode'); $password_len = strlen($password); $required_len = sfConfig::get('app_password_minimum_length'); # validate form if (strlen($username) > 0 && $password_len > 0 && strlen($confirm) > 0) { if ($password_len < $required_len) { $this->error_msg = 'Password must be at least ' . $required_len . ' characters'; } else { if ($password == $confirm) { $member = MemberPeer::getByExternalId($member_Extar_id); if ($member) { $person = $member->getPerson(); if ($person instanceof Person) { if ($person->getUsername() == null && $person->getUsername() == null) { $person->setUsername($username); if ($password == $confirm) { $person->setPassword($password); } $person->save(); $this->signIn($person, $request); $this->getUser()->setFlash('success', 'Your password has been successfully created!'); $this->redirect('/dashboard/index'); } elseif ($person->getLastName() == $lastname && $person->getZipcode() == $zipcode) { if ($person->getUsername() == $username) { # set new password $person->setPassword($password); $person->save(); $this->signIn($person, $request); $this->getUser()->setFlash('success', 'Your password has been successfully changed!'); $this->redirect('@homepage'); } else { $this->error_msg = 'You typed incorrect username!'; } } elseif ($person->getUsername() != null && $person->getUsername() != null) { $this->signIn($person, $request); $this->getUser()->setFlash('success', 'Person has already username and password! Please use following form to login.If you forget password can renew it!'); $this->redirect('@login'); } else { # invalid hidden field info $this->redirect('secure/retrievePassword'); } } else { # invalid hidden field info $this->redirect('secure/retrievePassword'); } } else { # invalid hidden field info $this->redirect('secure/retrievePassword'); } } else { $this->error_msg = 'Passwords don\'t match!'; } } } else { $this->error_msg = 'Please fill all fields!'; } } $this->executeCreatePassword($request); $this->setTemplate('createPassword'); }
/** * Get the associated Member object * * @param PropelPDO Optional Connection object. * @return Member The associated Member object. * @throws PropelException */ public function getMember(PropelPDO $con = null) { if ($this->aMember === null && $this->member_id !== null) { $c = new Criteria(MemberPeer::DATABASE_NAME); $c->add(MemberPeer::ID, $this->member_id); $this->aMember = MemberPeer::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->aMember->addMemberWingJobs($this); */ } return $this->aMember; }
<br/> <?php $count = 0; ?> <div id="mas" style="display:none"> <?php if (isset($mission_assistants)) { ?> <?php $li = 0; ?> <?php foreach ($mission_assistants as $mission_assistant) { ?> <?php $member = MemberPeer::retrieveByPK($mission_assistant->getMemberId()); ?> <?php if ($member->getPersonId()) { ?> <?php $m_person = $member->getPerson(); ?> <?php $m_pass = PassengerPeer::getByPersonId($m_person->getId()); ?> <?php } ?> <?php if (isset($m_person)) {
public function executeSaveAvailability(sfWebRequest $request) { $member_id = $this->getUser()->getMemberId(); if ($member_id) { $member = MemberPeer::retrieveByPK($member_id); } else { $this->forward404(); } $availability = $member->getAvailability(); if (!$availability instanceof Availability) { $availability = new Availability(); $availability->setMemberId($member_id); } $availability->setNotAvailable($request->getParameter('available') != 1); if ($availability->getNotAvailable()) { if ($request->getParameter('option') == 'dates') { $availability->setFirstDate($request->getParameter('start_date')); $availability->setLastDate($request->getParameter('end_date')); } else { $availability->setFirstDate(null); $availability->setLastDate(null); } } $availability->setNoWeekday($request->getParameter('weekdays') != 1); $availability->setNoNight($request->getParameter('nights') != 1); $availability->setNoWeekend($request->getParameter('weekends') != 1); $availability->setLastMinute($request->getParameter('last_minute')); $availability->setAsMissionMssistant($request->getParameter('assistant')); $availability->setAvailabilityComment($request->getParameter('comment')); $availability->save(); return sfView::NONE; }
public static function doSelectJoinAllExceptColSource(Criteria $c, $con = null) { $c = clone $c; if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } ColItemPeer::addSelectColumns($c); $startcol2 = ColItemPeer::NUM_COLUMNS - ColItemPeer::NUM_LAZY_LOAD_COLUMNS + 1; CatalogPeer::addSelectColumns($c); $startcol3 = $startcol2 + CatalogPeer::NUM_COLUMNS; ColStatusPeer::addSelectColumns($c); $startcol4 = $startcol3 + ColStatusPeer::NUM_COLUMNS; ColConditionPeer::addSelectColumns($c); $startcol5 = $startcol4 + ColConditionPeer::NUM_COLUMNS; MemberPeer::addSelectColumns($c); $startcol6 = $startcol5 + MemberPeer::NUM_COLUMNS; ColLocationPeer::addSelectColumns($c); $startcol7 = $startcol6 + ColLocationPeer::NUM_COLUMNS; $c->addJoin(ColItemPeer::CATALOG_ID, CatalogPeer::ID); $c->addJoin(ColItemPeer::COL_STATUS_ID, ColStatusPeer::ID); $c->addJoin(ColItemPeer::COL_CONDITION_ID, ColConditionPeer::ID); $c->addJoin(ColItemPeer::MEMBER_ID, MemberPeer::ID); $c->addJoin(ColItemPeer::COL_LOCATION_ID, ColLocationPeer::ID); $rs = BasePeer::doSelect($c, $con); $results = array(); while ($rs->next()) { $omClass = ColItemPeer::getOMClass(); $cls = Propel::import($omClass); $obj1 = new $cls(); $obj1->hydrate($rs); $omClass = CatalogPeer::getOMClass(); $cls = Propel::import($omClass); $obj2 = new $cls(); $obj2->hydrate($rs, $startcol2); $newObject = true; for ($j = 0, $resCount = count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; $temp_obj2 = $temp_obj1->getCatalog(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addColItem($obj1); break; } } if ($newObject) { $obj2->initColItems(); $obj2->addColItem($obj1); } $omClass = ColStatusPeer::getOMClass(); $cls = Propel::import($omClass); $obj3 = new $cls(); $obj3->hydrate($rs, $startcol3); $newObject = true; for ($j = 0, $resCount = count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; $temp_obj3 = $temp_obj1->getColStatus(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; $temp_obj3->addColItem($obj1); break; } } if ($newObject) { $obj3->initColItems(); $obj3->addColItem($obj1); } $omClass = ColConditionPeer::getOMClass(); $cls = Propel::import($omClass); $obj4 = new $cls(); $obj4->hydrate($rs, $startcol4); $newObject = true; for ($j = 0, $resCount = count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; $temp_obj4 = $temp_obj1->getColCondition(); if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { $newObject = false; $temp_obj4->addColItem($obj1); break; } } if ($newObject) { $obj4->initColItems(); $obj4->addColItem($obj1); } $omClass = MemberPeer::getOMClass(); $cls = Propel::import($omClass); $obj5 = new $cls(); $obj5->hydrate($rs, $startcol5); $newObject = true; for ($j = 0, $resCount = count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; $temp_obj5 = $temp_obj1->getMember(); if ($temp_obj5->getPrimaryKey() === $obj5->getPrimaryKey()) { $newObject = false; $temp_obj5->addColItem($obj1); break; } } if ($newObject) { $obj5->initColItems(); $obj5->addColItem($obj1); } $omClass = ColLocationPeer::getOMClass(); $cls = Propel::import($omClass); $obj6 = new $cls(); $obj6->hydrate($rs, $startcol6); $newObject = true; for ($j = 0, $resCount = count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; $temp_obj6 = $temp_obj1->getColLocation(); if ($temp_obj6->getPrimaryKey() === $obj6->getPrimaryKey()) { $newObject = false; $temp_obj6->addColItem($obj1); break; } } if ($newObject) { $obj6->initColItems(); $obj6->addColItem($obj1); } $results[] = $obj1; } return $results; }
} ?> </dd> </dl> </td> <td class="cell-3"> <?php if ($req->getDate()) { echo $req->getDate('m/d/Y'); } ?> </td> <td class="cell-4"> <?php if ($req->getMemberId()) { $member = MemberPeer::retrieveByPK($req->getMemberId()); if (isset($member)) { $person = $member->getPerson(); if (isset($person)) { echo $person->getTitle() . ', ' . $person->getLastName() . ' ' . $person->getFirstName(); echo ' '; if ($member->getFlightStatus()) { echo $member->getFlightStatus(); } } } } ?> </td> <td class="cell-5"> <?php
public function executeShow() { $member = MemberPeer::retrieveByPk($this->getRequestParameter('visitor_id')); $this->forward404Unless($member); $this->subtitle = $member->toString() . ' - id:' . $member->getId(); $this->member = $member; }
/** * Selects a collection of PilotAircraft objects pre-filled with all related objects except Aircraft. * * @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 PilotAircraft objects. * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public static function doSelectJoinAllExceptAircraft(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); } PilotAircraftPeer::addSelectColumns($c); $startcol2 = PilotAircraftPeer::NUM_COLUMNS - PilotAircraftPeer::NUM_LAZY_LOAD_COLUMNS; MemberPeer::addSelectColumns($c); $startcol3 = $startcol2 + (MemberPeer::NUM_COLUMNS - MemberPeer::NUM_LAZY_LOAD_COLUMNS); $c->addJoin(array(PilotAircraftPeer::MEMBER_ID), array(MemberPeer::ID), $join_behavior); $stmt = BasePeer::doSelect($c, $con); $results = array(); while ($row = $stmt->fetch(PDO::FETCH_NUM)) { $key1 = PilotAircraftPeer::getPrimaryKeyHashFromRow($row, 0); if (null !== ($obj1 = PilotAircraftPeer::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 = PilotAircraftPeer::getOMClass(); $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1); $obj1 = new $cls(); $obj1->hydrate($row); PilotAircraftPeer::addInstanceToPool($obj1, $key1); } // if obj1 already loaded // Add objects for joined Member rows $key2 = MemberPeer::getPrimaryKeyHashFromRow($row, $startcol2); if ($key2 !== null) { $obj2 = MemberPeer::getInstanceFromPool($key2); if (!$obj2) { $omClass = MemberPeer::getOMClass(); $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1); $obj2 = new $cls(); $obj2->hydrate($row, $startcol2); MemberPeer::addInstanceToPool($obj2, $key2); } // if $obj2 already loaded // Add the $obj1 (PilotAircraft) to the collection in $obj2 (Member) $obj2->addPilotAircraft($obj1); } // if joined row is not null $results[] = $obj1; } $stmt->closeCursor(); return $results; }
public function executeUpdate() { $i18n = new sfI18N(); $i18n->initialize($this->getContext()); $i18n->setCulture($this->getUser()->getCulture()); $action_i18n = $i18n->globalMessageFormat->format('save as new'); $action_type = $this->getRequestParameter('action_type'); // add or update student_detail if ($action_type == $action_i18n || !$this->getRequestParameter('student_detail_id')) { $student_detail = new StudentDetail(); } else { $student_detail = StudentDetailPeer::retrieveByPk($this->getRequestParameter('student_detail_id')); $this->forward404Unless($student_detail); } $student_detail->setId($this->getRequestParameter('student_detail_id')); $student_detail->setShortName($this->getRequestParameter('short_name')); $student_detail->setSex($this->getRequestParameter('sex')); $student_detail->setPob($this->getRequestParameter('pob')); if ($this->getRequestParameter('dob')) { $student_detail->setDob($this->getRequestParameter('dob')); } $student_detail->setReligionId($this->getRequestParameter('religion_id')); $student_detail->setNationality($this->getRequestParameter('nationality')); $student_detail->setSiblingsStatus($this->getRequestParameter('siblings_status')); $student_detail->setBloodSiblings($this->getRequestParameter('blood_siblings')); $student_detail->setStepSiblings($this->getRequestParameter('step_siblings')); $student_detail->setAdoptSiblings($this->getRequestParameter('adopt_siblings')); $student_detail->setNativeLanguage($this->getRequestParameter('native_language')); $student_detail->setBloodType($this->getRequestParameter('blood_type')); $student_detail->setIsAlazhar($this->getRequestParameter('is_alazhar')); $student_detail->setSchoolOfOrigin($this->getRequestParameter('school_of_origin')); $student_detail->setSchoolOfOriginAddress($this->getRequestParameter('school_of_origin_address')); if ($this->getRequestParameter('graduation_date')) { $student_detail->setGraduationDate($this->getRequestParameter('graduation_date')); } $student_detail->setAcceptanceClass($this->getRequestParameter('acceptance_class')); $student_detail->setResidenceStatus($this->getRequestParameter('residence_status')); $student_detail->setAddress($this->getRequestParameter('address')); $student_detail->setVillage($this->getRequestParameter('village')); $student_detail->setSubDistrict($this->getRequestParameter('sub_district')); $student_detail->setDistrict($this->getRequestParameter('district')); $student_detail->setPostCode($this->getRequestParameter('post_code')); $student_detail->setPhone($this->getRequestParameter('phone')); $student_detail->setHomeDistance($this->getRequestParameter('home_distance')); $student_detail->save(); if ($action_type == $action_i18n || !$this->getRequestParameter('member_detail_id')) { $member_detail = new MemberDetail(); } else { $member_detail = MemberDetailPeer::retrieveByPk($this->getRequestParameter('member_detail_id')); $this->forward404Unless($member_detail); } $member_detail->setId($this->getRequestParameter('member_detail_id')); $member_detail->setShortName($this->getRequestParameter('short_name')); $member_detail->setSex($this->getRequestParameter('sex')); $member_detail->setPob($this->getRequestParameter('pob')); if ($this->getRequestParameter('dob')) { $member_detail->setDob($this->getRequestParameter('dob')); } $member_detail->setReligionId($this->getRequestParameter('religion_id')); $member_detail->setNationality($this->getRequestParameter('nationality')); $member_detail->setBloodSiblings($this->getRequestParameter('blood_siblings')); $member_detail->setStepSiblings($this->getRequestParameter('step_siblings')); $member_detail->setAdoptSiblings($this->getRequestParameter('adopt_siblings')); $member_detail->setNativeLanguage($this->getRequestParameter('native_language')); $member_detail->setSchoolOfOrigin($this->getRequestParameter('school_of_origin')); $member_detail->setResidenceStatus($this->getRequestParameter('residence_status')); $member_detail->setAddress($this->getRequestParameter('address')); $member_detail->setPostCode($this->getRequestParameter('post_code')); $member_detail->setPhone($this->getRequestParameter('phone')); $member_detail->setHomeDistance($this->getRequestParameter('home_distance')); $member_detail->save(); if ($action_type == $action_i18n || !$this->getRequestParameter('member_id')) { $member = new Member(); } else { $member = MemberPeer::retrieveByPk($this->getRequestParameter('member_id')); $this->forward404Unless($member); } $member->setId($this->getRequestParameter('member_id')); $member->setCode($this->getRequestParameter('code')); $member->setName($this->getRequestParameter('name')); $member->setType('1'); $member->setStatus($this->getRequestParameter('status')); $member->setMemberDetail($member_detail); $member->save(); if ($action_type == $action_i18n || !$this->getRequestParameter('id')) { $student = new Student(); } else { $student = StudentPeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($student); } $student->setId($this->getRequestParameter('id')); $student->setCode($this->getRequestParameter('code')); $student->setCode2($this->getRequestParameter('code2')); $student->setCode3($this->getRequestParameter('code3')); $student->setNik($this->getRequestParameter('nik')); $student->setName($this->getRequestParameter('name')); $student->setClassName($this->getRequestParameter('class_name')); $student->setAcademicCalendarId($this->getRequestParameter('academic_calendar_id')); $student->setClassGroupId($this->getRequestParameter('class_group_id')); $student->setTestApplicantId($this->getRequestParameter('test_applicant_id')); #$old_status = $student->getStatus(); #$student->setStatus($this->getRequestParameter('status')); $student->setYear($this->getRequestParameter('year')); $student->setStudentDetail($student_detail); $student->setMember($member); if ($this->getRequestParameter('password') != null && strlen($this->getRequestParameter('password')) > 0) { // password set $crypted = sha1(sfConfig::get('app_salt') . $this->getRequestParameter('password')); if ($student->getPassword() != $crypted && strlen($this->getRequestParameter('password')) > 0) { // password changed $student->setPassword($crypted); } } elseif ($student->getPassword() == null || $student->getPassword() == '') { // create $crypted = sha1(sfConfig::get('app_salt') . $student_detail->getDob('dmY')); $student->setPassword($crypted); } $student->save(); // save photo $photo_dir = sfConfig::get('sf_data_dir') . DIRECTORY_SEPARATOR . 'photos' . DIRECTORY_SEPARATOR; if ($this->hasRequestParameter('photoFile') && $this->getRequestParameter('photoFile') != '' && $this->getRequestParameter('photoFile') != null) { // get photo content $photo_file = $photo_dir . 'tmp' . DIRECTORY_SEPARATOR . $this->getRequestParameter('photoFile'); $content = file_get_contents($photo_file); $im = imagecreatefromstring($content); list($w, $h) = getimagesize($photo_file); // generate photo $photo = imagecreatetruecolor(150, 195); imagecopyresized($photo, $im, 0, 0, 0, 0, 150, 195, $w, $h); // generate thumbnail $thumb = imagecreatetruecolor(100, 130); imagecopyresized($thumb, $im, 0, 0, 0, 0, 100, 130, $w, $h); // get photo record $c = new Criteria(); $c->add(StudentPhotoPeer::STUDENT_ID, $student->getId()); $student_photo = StudentPhotoPeer::doSelectOne($c); if ($student_photo == null) { $student_photo = new StudentPhoto(); $student_photo->setStudent($student); } // save photo imagepng($photo, $photo_file); $student_photo->setPhoto(base64_encode(file_get_contents($photo_file))); imagepng($thumb, $photo_file); $student_photo->setThumbnail(base64_encode(file_get_contents($photo_file))); $student_photo->save(); unlink($photo_dir . 'tmp' . DIRECTORY_SEPARATOR . $this->getRequestParameter('photoFile')); } // save member photo $photo_dir = sfConfig::get('sf_data_dir') . DIRECTORY_SEPARATOR . 'photos' . DIRECTORY_SEPARATOR; if ($this->hasRequestParameter('photoFile') && $this->getRequestParameter('photoFile') != '' && $this->getRequestParameter('photoFile') != null) { // get photo content $photo_file = $photo_dir . 'tmp' . DIRECTORY_SEPARATOR . $this->getRequestParameter('photoFile'); $content = file_get_contents($photo_file); $im = imagecreatefromstring($content); list($w, $h) = getimagesize($photo_file); // generate photo $photo = imagecreatetruecolor(150, 200); imagecopyresized($photo, $im, 0, 0, 0, 0, 150, 200, $w, $h); // generate thumbnail $thumb = imagecreatetruecolor(100, 150); imagecopyresized($thumb, $im, 0, 0, 0, 0, 100, 150, $w, $h); // get photo record $c = new Criteria(); $c->add(MemberPhotoPeer::MEMBER_ID, $member->getId()); $member_photo = MemberPhotoPeer::doSelectOne($c); if ($member_photo == null) { $member_photo = new MemberPhoto(); $member_photo->setMember($member); } // save photo imagepng($photo, $photo_file); $member_photo->setPhoto(base64_encode(file_get_contents($photo_file))); imagepng($thumb, $photo_file); $member_photo->setThumbnail(base64_encode(file_get_contents($photo_file))); $member_photo->save(); unlink($photo_dir . 'tmp' . DIRECTORY_SEPARATOR . $this->getRequestParameter('photoFile')); } return $this->redirect('scholar/editParent?id=' . $student->getId()); }
public static function doSelectJoinAll(Criteria $c, $con = null) { $c = clone $c; if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } MemberPhotoPeer::addSelectColumns($c); $startcol2 = MemberPhotoPeer::NUM_COLUMNS - MemberPhotoPeer::NUM_LAZY_LOAD_COLUMNS + 1; MemberPeer::addSelectColumns($c); $startcol3 = $startcol2 + MemberPeer::NUM_COLUMNS; $c->addJoin(MemberPhotoPeer::MEMBER_ID, MemberPeer::ID); $rs = BasePeer::doSelect($c, $con); $results = array(); while ($rs->next()) { $omClass = MemberPhotoPeer::getOMClass(); $cls = Propel::import($omClass); $obj1 = new $cls(); $obj1->hydrate($rs); $omClass = MemberPeer::getOMClass(); $cls = Propel::import($omClass); $obj2 = new $cls(); $obj2->hydrate($rs, $startcol2); $newObject = true; for ($j = 0, $resCount = count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; $temp_obj2 = $temp_obj1->getMember(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addMemberPhoto($obj1); break; } } if ($newObject) { $obj2->initMemberPhotos(); $obj2->addMemberPhoto($obj1); } $results[] = $obj1; } return $results; }
<h4>Lead Coordinator</h4> <?php $is_lead = CoordinatorPeer::retrieveByPK($coor->getId()); ?> <?php if ($is_lead) { ?> <?php $leader = CoordinatorPeer::retrieveByPK($coor->getId()); ?> <?php if (isset($leader)) { } ?> <?php $member = MemberPeer::retrieveByPK($leader->getMemberId()); ?> <?php $p = $member->getPerson(); ?> <?php if (isset($member)) { $person = $member->getPerson(); ?> <?php if (isset($person)) { echo $person->getTitle() . ' ' . $person->getFirstName() . ' ' . $person->getLastName(); } ?> <?php }
/** * 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(MemberPeer::DATABASE_NAME, Propel::CONNECTION_READ); } $objs = null; if (empty($pks)) { $objs = array(); } else { $criteria = new Criteria(MemberPeer::DATABASE_NAME); $criteria->add(MemberPeer::ID, $pks, Criteria::IN); $objs = MemberPeer::doSelect($criteria, $con); } return $objs; }
/** * @return Member */ public function getMember() { $c = new Criteria(); $c->add(MemberPeer::PERSON_ID, $this->getId()); return MemberPeer::doSelectOne($c); }
public function getMember($con = null) { include_once 'lib/model/om/BaseMemberPeer.php'; if ($this->aMember === null && $this->member_id !== null) { $this->aMember = MemberPeer::retrieveByPK($this->member_id, $con); } return $this->aMember; }
?> disabled="disabled" <?php } ?> name="backup_copilot_mail[]" /> </div> <div class="leglabel">Email: </div> <div class="leg_filed"> <?php echo $backup_copilot_id->getPerson()->getEmail(); ?> </div> </div> <?php } $backup_miss_assis_id = MemberPeer::retrieveByPK($miss_leg->getBackupMissAssisId()); if ($backup_miss_assis_id) { ?> <div class="legemail_box"> <div class="heading">Backup Co Pilot: <?php echo $backup_miss_assis_id->getPerson()->getFirstName(); ?> <?php echo $backup_miss_assis_id->getPerson()->getLastName(); ?> </div> <div class="chbox"> <input type="checkbox" <?php if ($backup_miss_assis_id->getPerson() && $backup_miss_assis_id->getPerson()->getEmail()) { ?> value="<?php