/** * Get the associated Aircraft object * * @param PropelPDO Optional Connection object. * @return Aircraft The associated Aircraft object. * @throws PropelException */ public function getAircraftThird(PropelPDO $con = null) { if ($this->aAircraftThird === null && $this->aircraft_third_id !== null) { $c = new Criteria(AircraftPeer::DATABASE_NAME); $c->add(AircraftPeer::ID, $this->aircraft_third_id); $this->aAircraftThird = AircraftPeer::doSelectOne($c, $con); } return $this->aAircraftThird; }
public function configure() { $aircrafts = AircraftPeer::getForSelectParent(); $this->widgetSchema['member_id'] = new sfWidgetFormInputHidden(); $this->widgetSchema['aircraft_id'] = new sfWidgetFormChoice(array('choices' => $aircrafts), array('class' => 'text narrow')); $this->widgetSchema['n_number'] = new sfWidgetFormInput(array(), array('class' => 'text narrow')); $this->widgetSchema['own'] = new sfWidgetFormInputCheckbox(array(), array('value' => 1)); $this->widgetSchema['seats'] = new sfWidgetFormInput(array(), array('class' => 'text narrow')); $this->widgetSchema['known_ice'] = new sfWidgetFormInputCheckbox(array(), array('value' => 1)); $this->widgetSchema->setLabels(array('aircraft_id' => 'Aircraft')); $this->widgetSchema->setLabels(array('n_number' => 'Tail Number')); $this->widgetSchema->setLabels(array('own' => 'Own')); $this->widgetSchema->setLabels(array('seats' => 'Seats')); $this->widgetSchema->setLabels(array('known_ice' => 'Known Ice')); unset($aircrafts[0]); $this->validatorSchema['aircraft_id'] = new sfValidatorChoice(array('choices' => array_keys($aircrafts))); $this->validatorSchema['own'] = new sfValidatorInteger(array('required' => false)); $this->validatorSchema['known_ice'] = new sfValidatorInteger(array('required' => false)); $this->validatorSchema['n_number'] = new sfValidatorString(array('required' => false), array('required' => 'required!!!')); $this->validatorSchema['seats'] = new sfValidatorInteger(array('required' => false), array('required' => "required!!!", 'invalid' => 'not number')); $this->widgetSchema->setNameFormat('pilot_aircraft[%s]'); }
<th>Own</th> <th>Seats</th> <th>Known Ice</th> </tr> </thead> <tbody> <?php foreach ($ids as $id) { ?> <tr> <?php $pilot_air = PilotAircraftPeer::retrieveByPK($id); ?> <?php if (isset($pilot_air) && $pilot_air instanceof PilotAircraft) { $air = AircraftPeer::retrieveByPK($pilot_air->getAircraftId()); } ?> <td> <?php echo $air->getId(); ?> </td> <td> <?php echo $id; ?> <input type="hidden" id="all_pilot_ids" name="all_pilot_ids[]" value="<?php echo $pilot_air->getId(); ?> "/>
/** * Get the associated Aircraft object * * @param PropelPDO Optional Connection object. * @return Aircraft The associated Aircraft object. * @throws PropelException */ public function getAircraft(PropelPDO $con = null) { if ($this->aAircraft === null && $this->aircraft_id !== null) { $c = new Criteria(AircraftPeer::DATABASE_NAME); $c->add(AircraftPeer::ID, $this->aircraft_id); $this->aAircraft = AircraftPeer::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->aAircraft->addMissionReports($this); */ } return $this->aAircraft; }
/** * Selects a collection of PilotAircraft objects pre-filled with all related objects except Member. * * @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 doSelectJoinAllExceptMember(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) { foreach (sfMixer::getCallables('BasePilotAircraftPeer:doSelectJoinAllExcept:doSelectJoinAllExcept') as $callable) { call_user_func($callable, 'BasePilotAircraftPeer', $c, $con); } $c = clone $c; // Set the correct dbName if it has not been overridden // $c->getDbName() will return the same object if not set to another value // so == check is okay and faster if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } PilotAircraftPeer::addSelectColumns($c); $startcol2 = PilotAircraftPeer::NUM_COLUMNS - PilotAircraftPeer::NUM_LAZY_LOAD_COLUMNS; AircraftPeer::addSelectColumns($c); $startcol3 = $startcol2 + (AircraftPeer::NUM_COLUMNS - AircraftPeer::NUM_LAZY_LOAD_COLUMNS); $c->addJoin(array(PilotAircraftPeer::AIRCRAFT_ID), array(AircraftPeer::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 Aircraft rows $key2 = AircraftPeer::getPrimaryKeyHashFromRow($row, $startcol2); if ($key2 !== null) { $obj2 = AircraftPeer::getInstanceFromPool($key2); if (!$obj2) { $omClass = AircraftPeer::getOMClass(); $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1); $obj2 = new $cls(); $obj2->hydrate($row, $startcol2); AircraftPeer::addInstanceToPool($obj2, $key2); } // if $obj2 already loaded // Add the $obj1 (PilotAircraft) to the collection in $obj2 (Aircraft) $obj2->addPilotAircraft($obj1); } // if joined row is not null $results[] = $obj1; } $stmt->closeCursor(); return $results; }
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()); }
<table> <tr> <td> <?php if (count($pilot_aircrafts)) { ?> <label>Select Your Aircraft</label> <select id="aircraft" name="aircraft" class="text"> <?php foreach ($pilot_aircrafts as $paircraft) { ?> <?php if ($paircraft->getAircraftId()) { ?> <?php $paircraft = AircraftPeer::retrieveByPK($paircraft->getAircraftId()); ?> <?php } ?> <?php if (isset($paircraft)) { ?> <option value='<?php echo $paircraft->getId(); ?> ' <?php echo $aircraft == $paircraft->getId() ? 'selected' : ''; ?> >; <?php
} ?> <br /> <?php if (isset($pilot)) { ?> <?php $has_p_aircrafts = PilotAircraftPeer::getByMemberId($pilot_member->getId()); ?> <?php $aircrafts = array(); $c = 0; if (isset($has_p_aircrafts)) { foreach ($has_p_aircrafts as $pilot_aircraft) { if ($pilot_aircraft->getAircraftId()) { $aircrafts[$c] = AircraftPeer::retrieveByPK($pilot_aircraft->getAircraftId()); $c++; } } } ?> <?php if (count($aircrafts)) { ?> <br/> <?php for ($i = 0; $i < count($aircrafts); $i++) { ?> <?php echo 'Make : ' . $aircrafts[$i]->getMake() . ' / Model : ' . $aircrafts[$i]->getModel() . ' /Name : ' . $aircrafts[$i]->getName();
/** * Populates the object using an array. * * This is particularly useful when populating an object from one of the * request arrays (e.g. $_POST). This method goes through the column * names, checking to see whether a matching key exists in populated * array. If so the setByName() method is called for that column. * * You can specify the key type of the array by additionally passing one * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. * The default key type is the column's phpname (e.g. 'AuthorId') * * @param array $arr An array to populate the object from. * @param string $keyType The type of keys the array uses. * @return void */ public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = AircraftPeer::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) { $this->setId($arr[$keys[0]]); } if (array_key_exists($keys[1], $arr)) { $this->setMake($arr[$keys[1]]); } if (array_key_exists($keys[2], $arr)) { $this->setModel($arr[$keys[2]]); } if (array_key_exists($keys[3], $arr)) { $this->setName($arr[$keys[3]]); } if (array_key_exists($keys[4], $arr)) { $this->setTail($arr[$keys[4]]); } if (array_key_exists($keys[5], $arr)) { $this->setFaa($arr[$keys[5]]); } if (array_key_exists($keys[6], $arr)) { $this->setEngines($arr[$keys[6]]); } if (array_key_exists($keys[7], $arr)) { $this->setDefSeats($arr[$keys[7]]); } if (array_key_exists($keys[8], $arr)) { $this->setSpeed($arr[$keys[8]]); } if (array_key_exists($keys[9], $arr)) { $this->setPressurized($arr[$keys[9]]); } if (array_key_exists($keys[10], $arr)) { $this->setCost($arr[$keys[10]]); } if (array_key_exists($keys[11], $arr)) { $this->setRange($arr[$keys[11]]); } if (array_key_exists($keys[12], $arr)) { $this->setAcLoad($arr[$keys[12]]); } }
/** * 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(AircraftPeer::DATABASE_NAME, Propel::CONNECTION_READ); } $objs = null; if (empty($pks)) { $objs = array(); } else { $criteria = new Criteria(AircraftPeer::DATABASE_NAME); $criteria->add(AircraftPeer::ID, $pks, Criteria::IN); $objs = AircraftPeer::doSelect($criteria, $con); } return $objs; }
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::getByPersonId($person->getId()); if (!$member instanceof Member) { $member = new Member(); } // Generate external id using last member is and external id $c = new Criteria(); $c->add(MemberPeer::EXTERNAL_ID, NULL, Criteria::ISNOTNULL); $c->addDescendingOrderByColumn(MemberPeer::ID); $external_member = MemberPeer::doSelectOne($c); $external_id = $external_member->getExternalId(); $currentExternalId = $external_id + 1; //print_r($external_id); //print_r($currentExternalId); $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()); //$member->setMasterMemberId($app->getMasterMemberId()); $member->setMemberClassId($app->getMemberClassId()); $member->setPersonId($person->getId()); $member->setRenewedDate(time()); $member->setRenewalDate(strtotime('+1 year')); $member->setSpouseName($app->getSpouseFirstName() . ' ' . $app->getSpouseLastName()); //external_id generate $member->setExternalId($currentExternalId); $member->setWingId($app->getWingId()); $member->save(); // Pilot if ($app->getApplicantPilot()) { $pilot = new Pilot(); $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 = 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); try { $availability->save(); } catch (Exception $e) { } // 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; unset($tmp_arr['id']); $application = new Application(); $application->fromArray($tmp_arr, BasePeer::TYPE_FIELDNAME); $application->save(); $where = $request->getParameter('step3_redirect'); //Ziyed save default role for new member $appTemp = $this->application_temp; if ($appTemp->getPersonId()) { $person_role = new PersonRole(); $person_role->setPersonId($appTemp->getPersonId()); if ($appTemp->getApplicantPilot() == 1) { $person_role->setRoleId(27); } else { $person_role->setRoleId(31); } $person_role->save(); } //Ziyed end save if ($where == 1) { $this->redirect('@member_view?id=' . $member->getId()); } else { /* if ($application->getEmail()) { # send email failure to payment $this->getComponent('mail', 'memberApplicationProcessed', array('email' => $application->getEmail(),'member_id'=>$member->getId(), 'name' => $application->getFirstName() . ' ' . $application->getLastName())); }*/ $this->redirect('pending_member/processComplete?id=' . $member->getId()); } }
/** * TODO: Check related records. * CODE:aircraft_delete */ public function executeDelete(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'); } if ($request->isMethod('delete')) { $request->checkCSRFProtection(); $aircraft = AircraftPeer::retrieveByPK($request->getParameter('id')); $this->forward404Unless($aircraft); $this->getUser()->setFlash('success', 'Aircraft information has been successfully deleted!'); $aircraft->delete(); } return $this->redirect('@aircraft'); }
public function executeFindModel(sfWebRequest $request) { //... $name = $request->getParameter('name'); $this->models = AircraftPeer::getOnlyModels($name); }