Example #1
0
 public function configure()
 {
     //    unset($this['id']);
     $wings = WingPeer::getForSelectParent();
     $states = sfConfig::get('app_states', array('AL' => 'Alabama', 'AK' => 'Alaska'));
     $disable = 'disabled';
     if ($this->getObject()->isNew()) {
         $disable = '';
     }
     # Fields
     $this->widgetSchema['ident'] = new sfWidgetFormInput(array(), array('class' => 'text airport-new'));
     $this->widgetSchema['name'] = new sfWidgetFormInput(array(), array('class' => 'text airport-new'));
     $this->widgetSchema['city'] = new sfWidgetFormInput(array(), array('class' => 'text airport-new', 'disabled' => $disable));
     $this->widgetSchema['state'] = new sfWidgetFormSelect(array('choices' => $states), array('class' => 'text narrow airport-new', 'disabled' => $disable));
     $this->widgetSchema['latitude'] = new sfWidgetFormInput(array(), array('class' => 'text airport-new', 'disabled' => $disable));
     $this->widgetSchema['longitude'] = new sfWidgetFormInput(array(), array('class' => 'text airport-new', 'disabled' => $disable));
     $this->widgetSchema['runway_length'] = new sfWidgetFormInput(array(), array('class' => 'text airport-new', 'disabled' => $disable));
     $this->widgetSchema['wing_id'] = new sfWidgetFormChoice(array('choices' => $wings), array('class' => 'text narrow airport-new', 'disabled' => $disable));
     $this->widgetSchema['gmt_offset'] = new sfWidgetFormInput(array(), array('class' => 'text airport-new', 'disabled' => $disable));
     $this->widgetSchema['dst_offset'] = new sfWidgetFormInput(array(), array('class' => 'text airport-new', 'disabled' => $disable));
     $this->widgetSchema['zipcode'] = new widgetFormInputZipcode(array(), array('class' => 'text narrow airport-new', 'disabled' => $disable));
     $this->widgetSchema['closed'] = new sfWidgetFormInputCheckbox(array(), array('value' => 1, 'disabled' => $disable));
     $this->widgetSchema->setLabels(array('ident' => 'Ident'));
     $this->widgetSchema->setLabels(array('name' => 'Name'));
     $this->widgetSchema->setLabels(array('city' => 'City'));
     $this->widgetSchema->setLabels(array('state' => 'State'));
     $this->widgetSchema->setLabels(array('latitude' => 'Latitude'));
     $this->widgetSchema->setLabels(array('longitude' => 'Longitude'));
     $this->widgetSchema->setLabels(array('runway_length' => 'Runway length'));
     $this->widgetSchema->setLabels(array('wing_id' => 'Wing'));
     $this->widgetSchema->setLabels(array('gmt_offset' => 'GMT offset'));
     $this->widgetSchema->setLabels(array('dst_offset' => 'DST offset'));
     $this->widgetSchema->setLabels(array('zipcode' => 'Zipcode'));
     $this->widgetSchema->setLabels(array('closed' => 'Closed'));
     $this->validatorSchema['ident'] = new sfValidatorString(array('required' => false));
     $this->validatorSchema['name'] = new sfValidatorString(array('required' => false));
     $this->validatorSchema['city'] = new sfValidatorString(array('required' => false));
     $this->validatorSchema['state'] = new sfValidatorString(array('required' => false));
     $this->validatorSchema['latitude'] = new sfValidatorNumber(array('required' => false));
     $this->validatorSchema['longitude'] = new sfValidatorNumber(array('required' => false));
     $this->validatorSchema['runway_length'] = new sfValidatorInteger(array('required' => false), array('invalid' => 'Runway length must be in numner format !'));
     $this->validatorSchema['wing_id'] = new sfValidatorInteger(array('required' => false));
     $this->validatorSchema['gmt_offset'] = new sfValidatorInteger(array('required' => false), array('invalid' => 'GMT offset must be in numner format !'));
     $this->validatorSchema['dst_offset'] = new sfValidatorInteger(array('required' => false), array('invalid' => 'DST offset must be in numner format !'));
     $this->validatorSchema['zipcode'] = new validatorZipcode(array('required' => false), array('max_length' => 10, 'min_length' => 5));
     $this->validatorSchema['closed'] = new sfValidatorInteger(array('required' => false));
     $this->widgetSchema->setNameFormat('airp[%s]');
 }
Example #2
0
 /**
  * Searches for airports by filter
  */
 private function processFilter(sfWebRequest $request)
 {
     $params = $this->getUser()->getAttribute('airport', array(), 'airport');
     if (!isset($params['ident'])) {
         $params['ident'] = null;
     }
     if (!isset($params['name'])) {
         $params['name'] = null;
     }
     if (!isset($params['city'])) {
         $params['city'] = null;
     }
     if (!isset($params['state'])) {
         $params['state'] = null;
     }
     if (!isset($params['wing_name'])) {
         $params['wing_name'] = null;
     }
     if (!isset($params['closed'])) {
         $params['closed'] = null;
     }
     $this->max_array = array(5, 10, 20, 30);
     $this->wings = WingPeer::getOnlyNames();
     if (in_array($request->getParameter('max'), $this->max_array)) {
         $params['max'] = $request->getParameter('max');
     } else {
         if (!isset($params['max'])) {
             $params['max'] = sfConfig::get('app_max_person_per_page', 10);
         }
     }
     if ($request->hasParameter('filter')) {
         $params['ident'] = $request->getParameter('ident');
         $params['name'] = $request->getParameter('name');
         $params['city'] = $request->getParameter('city');
         $params['state'] = $request->getParameter('state');
         $params['wing_name'] = in_array($request->getParameter('wing_name'), array_keys($this->wings)) ? $request->getParameter('wing_name') : '';
         $params['closed'] = $request->getParameter('closed');
     }
     $this->page = $page = $request->getParameter('page', 1);
     $this->max = $params['max'];
     $this->ident = $params['ident'];
     $this->name = $params['name'];
     $this->city = $params['city'];
     $this->state = $params['state'];
     $this->wing_name = $params['wing_name'];
     $this->closed = $params['closed'];
     $this->getUser()->setAttribute('airport', $params, 'airport');
 }
Example #3
0
 public function configure()
 {
     unset($this['id'], $this['person_id'], $this['external_id'], $this['master_member_id'], $this['active'], $this['inactive_reason'], $this['inactive_comment'], $this['contact'], $this['renewed_date'], $this['renewal_date'], $this['renewal_notice1'], $this['renewal_notice2'], $this['renewal_notice3'], $this['renewal_notice4'], $this['review_done'], $this['ed_new_member_notify'], $this['wn_new_memberN_ntify'], $this['hold_harmless_received'], $this['member_welcomed'], $this['badge_made'], $this['notebook_sent'], $this['clothing_sent'], $this['s_mod_member_notify'], $this['w_mod_member_notify'], $this['renew_mark'], $this['renewal_sent_date'], $this['s_late_renewal_notify'], $this['w_late_renewal_notify'], $this['s_inactive_notify'], $this['w_inactive_notify'], $this['w_not_oriented_notify_date1'], $this['w_not_oriented_notify_date2'], $this['no_wing_contact_ack']);
     $wings = WingPeer::getForSelectParent();
     $flight_statuses = sfConfig::get('app_flight_statuses', array('Command pilot' => 'Command pilot'));
     # Fields
     $this->widgetSchema['date_of_birth'] = new widgetFormDate(array('change_year' => true, 'change_month' => true, 'format_date' => array('js' => 'mm/dd/yy', 'php' => 'm/d/Y')), array('class' => 'text narrow'));
     $this->widgetSchema['weight'] = new sfWidgetFormInput(array(), array('class' => 'text narrow'));
     $this->widgetSchema['languages'] = new sfWidgetFormInput(array(), array('class' => 'text'));
     $this->widgetSchema['wing_id'] = new sfWidgetFormChoice(array('choices' => $wings), array('class' => 'text narrow'));
     $this->widgetSchema['secondary_wing_id'] = new sfWidgetFormChoice(array('choices' => $wings), array('class' => 'text narrow'));
     $this->widgetSchema['join_date'] = new widgetFormDate(array('format_date' => array('js' => 'mm/dd/yy', 'php' => 'm/d/Y')), array('class' => 'text narrow'));
     $this->widgetSchema['member_class_id'] = new sfWidgetFormPropelChoice(array('model' => 'MemberClass', 'add_empty' => '-- select --'), array('class' => 'text narrow'));
     $this->widgetSchema['spouse_name'] = new sfWidgetFormInput(array(), array('class' => 'text'));
     $this->widgetSchema['coordinator_notes'] = new sfWidgetFormTextarea(array(), array('class' => 'text'));
     $this->widgetSchema['flight_status'] = new sfWidgetFormSelect(array('choices' => $flight_statuses), array('class' => 'text narrow'));
     $this->widgetSchema['co_pilot'] = new sfWidgetFormInputCheckbox(array(), array('value' => 1));
     # Labels
     $this->widgetSchema->setLabels(array('date_of_birth' => 'Date of birth'));
     $this->widgetSchema->setLabels(array('weight' => 'Weight'));
     $this->widgetSchema->setLabels(array('languages' => 'Languages'));
     $this->widgetSchema->setLabels(array('wing_id' => 'Wing'));
     $this->widgetSchema->setLabels(array('secondary_wing_id' => 'Secondary Wing'));
     $this->widgetSchema->setLabels(array('join_date' => 'Join Date'));
     $this->widgetSchema->setLabels(array('member_class_id' => 'Class'));
     $this->widgetSchema->setLabels(array('spouse_name' => 'Spouse/Emergency Name'));
     $this->widgetSchema->setLabels(array('coordinator_notes' => 'Coordinator\'s Notes'));
     $this->widgetSchema->setLabels(array('flight_status' => 'Flight Status'));
     $this->widgetSchema->setLabels(array('co_pilot' => 'Co-Pilot'));
     # Validation
     $this->validatorSchema['date_of_birth'] = new sfValidatorDate(array('max' => time(), 'required' => false), array('invalid' => 'Date of birth is invalid !.'));
     $this->validatorSchema['weight'] = new sfValidatorInteger(array('required' => false), array('required' => 'Please confirm first name !.', 'invalid' => 'Weight is must be in number format!.'));
     $this->validatorSchema['languages'] = new sfValidatorString(array('required' => false), array('required' => 'Please confirm last name !'));
     $this->validatorSchema['wing_id'] = new sfValidatorString(array('required' => false));
     $this->validatorSchema['secondary_wing_id'] = new sfValidatorString(array('required' => false));
     $this->validatorSchema['join_date'] = new sfValidatorDate(array('max' => time(), 'required' => true), array('invalid' => 'Join date is invalid !'));
     $this->validatorSchema['member_class_id'] = new sfValidatorInteger(array('required' => true), array('required' => 'Please choice member class!'));
     $this->validatorSchema['spouse_name'] = new sfValidatorString(array('required' => false));
     $this->validatorSchema['coordinator_notes'] = new sfValidatorString(array('required' => false));
     $this->validatorSchema['flight_status'] = new sfValidatorString(array('required' => true), array('required' => 'Please choice flight status !'));
     $this->validatorSchema['co_pilot'] = new sfValidatorInteger(array('required' => false));
     # Descriptive message
     $this->setDefault('join_date', date("m/d/y"));
     #help
     $this->widgetSchema->setHelp('weight', 'lbs.');
     $this->widgetSchema->setNameFormat('mem[%s]');
 }
Example #4
0
 /**
  * Wing delete
  * CODE:wing_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');
     }
     $request->checkCSRFProtection();
     try {
         $wing = WingPeer::retrieveByPK($request->getParameter('id'));
         $this->forward404Unless($wing);
         $wing->delete();
         $this->getUser()->setFlash('success', "Successfully deleted.");
     } catch (Exception $e) {
         $this->getUser()->setFlash('warning', "There are related persons to this wing. Please remove them first.");
     }
     $this->redirect('wing/index');
 }
Example #5
0
           ?>
     <?php 
           $person = PersonPeer::retrieveByPK($person_id);
           ?>
 <?php 
       }
       ?>
 
 <?php 
       $wing_id = $member->getWingId();
       ?>
 <?php 
       if ($wing_id) {
           ?>
     <?php 
           $wing = WingPeer::retrieveByPK($wing_id);
           ?>
 <?php 
       }
       ?>
 
 <tr>
   <td class="cell-1">
       <?php 
       if (isset($member)) {
           echo $member->getExternalId();
       }
       ?>
   </td>
   <td class="cell-1">
       <?php 
Example #6
0
 private function processFilterNew(sfWebRequest $request)
 {
     $params = $this->getUser()->getAttribute('event');
     //set max
     if (!isset($params['max'])) {
         $params['max'] = 10;
     }
     $this->max_array = array(5, 10, 20, 30);
     if (in_array($request->getParameter('max'), $this->max_array)) {
         $params['max'] = $request->getParameter('max');
     }
     //set page
     if (!isset($params['page'])) {
         $params['page'] = 1;
     }
     if ($request->getParameter('page')) {
         $params['page'] = $request->getParameter('page');
     }
     //set wing id & wing name
     if (!isset($params['wing_id'])) {
         $params['wing_id'] = 0;
     }
     if (!isset($params['wingname'])) {
         $params['wingname'] = 0;
     }
     if ($request->hasParameter('filter')) {
         $name = $request->getParameter('wing_name');
         if (empty($name)) {
             $params['wing_id'] = 0;
             $params['wingname'] = 0;
         } else {
             $wing_obj = WingPeer::getByName($request->getParameter('wing_name'));
             $wing_id = $wing_obj->getId();
             $params['wing_id'] = $wing_id;
             $params['wingname'] = $name;
         }
     }
     //Reset all
     if ($request->getParameter('reset')) {
         $params['wing_id'] = 0;
     }
     //value set for pager
     $this->page = $params['page'];
     $this->max = $params['max'];
     $this->wing_id = $params['wing_id'];
     $this->wingname = $params['wingname'];
     $this->getUser()->setAttribute('event', $params);
 }
Example #7
0
          <?php 
echo $form['long_desc'];
?>
        </td>
      </tr>
      <tr>         
        <th><?php 
echo "Participating Wings";
//echo $form['wing_id']
?>
</th>
        <td>
          <ul class="checkbox_list">
              <?php 
$wing = new Criteria();
$wings = WingPeer::doSelect($wing);
foreach ($wings as $wing_list) {
    ?>
              <li>
                  <input type="checkbox" <?php 
    if ($form->getObject()->getId() != '') {
        foreach ($ch as $ch_list) {
            if ($ch_list->getWingId() == $wing_list->getId()) {
                echo 'checked="checked"';
            }
        }
    }
    ?>
 id="event_wing_id_<?php 
    echo $wing_list->getId();
    ?>
Example #8
0
 /**
  * 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 = WingPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setId($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setName($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setNewsletterAbbreviation($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setDisplayName($arr[$keys[3]]);
     }
     if (array_key_exists($keys[4], $arr)) {
         $this->setState($arr[$keys[4]]);
     }
 }
Example #9
0
 /**
  * Get the associated Wing object
  *
  * @param      PropelPDO Optional Connection object.
  * @return     Wing The associated Wing object.
  * @throws     PropelException
  */
 public function getWing(PropelPDO $con = null)
 {
     if ($this->aWing === null && $this->wing_id !== null) {
         $c = new Criteria(WingPeer::DATABASE_NAME);
         $c->add(WingPeer::ID, $this->wing_id);
         $this->aWing = WingPeer::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->aWing->addEmailLists($this);
         		 */
     }
     return $this->aWing;
 }
Example #10
0
 public function executePilotRequestAcceptedView(sfWebRequest $request)
 {
     #security
     if (!$this->getUser()->hasCredential(array('Administrator', 'Pilot', 'Staff', 'Coordinator', 'Volunteer'), false)) {
         $this->getUser()->setFlash("warning", 'You don\'t have permission to access this url ' . $request->getReferer());
         $this->redirect('dashboard/index');
     }
     $person = PersonPeer::retrieveByPK($this->getUser()->getId());
     $this->forward404Unless($person);
     $member = $person->getMember();
     if ($member) {
         $pilot = $member->getPilot();
     } else {
         $pilot = null;
     }
     $this->date_widget = new widgetFormDate(array('format_date' => array('js' => 'mm/dd/yy', 'php' => 'm/d/Y')), array('class' => 'text'));
     if ($pilot) {
         $this->personal_flights = $pilot->getPersonalFlights();
     } else {
         $this->personal_flights = array();
     }
     $this->wings = WingPeer::doSelect(new Criteria());
     $this->idents = AirportPeer::doSelect(new Criteria());
     $this->states = sfConfig::get('app_short_states');
     $this->mission_types = MissionTypePeer::doSelect(new Criteria());
     $this->member = $member;
     $this->pilot = $pilot;
     if ($pilot) {
         $this->airport = $pilot->getAirport();
     } else {
         $this->airport = null;
     }
     if ($request->getParameter('needs') == 1) {
         $this->needs_pilot = 1;
     }
     $c = new Criteria();
     $c->add(PilotRequestPeer::ACCEPTED, 1);
     $c->add(PilotRequestPeer::MEMBER_ID, $member->getId());
     $c->addJoin(PilotRequestPeer::LEG_ID, MissionLegPeer::ID);
     $c->addJoin(MissionLegPeer::MISSION_ID, MissionPeer::ID);
     //$this->result = MissionPeer::doSelect($c);
     $this->page = $request->getParameter("page", 1);
     $this->max = $request->getParameter("max", 10);
     $this->pager = new sfPropelPager('MissionLeg', $this->max);
     $this->pager->setCriteria($c);
     $this->pager->setPage($this->page);
     $this->pager->init();
     $this->miss_legs = $this->pager->getResults();
     $this->url = 'pilotRequestAcceptedView';
 }
Example #11
0
 public function executeAutoCompleteRegion()
 {
     $this->region_name = $this->getRequestParameter('mop_regions_served');
     $this->wing_names = WingPeer::getResionServedNames($this->region_name);
 }
Example #12
0
 private function processRosterFilter(sfWebRequest $request)
 {
     $params = $this->getUser()->getAttribute('member_roster', array(), 'person');
     if (!isset($params['pilot_status'])) {
         $params['pilot_status'] = null;
     }
     if (!isset($params['wing_id'])) {
         $params['wing_id'] = 0;
     }
     if (!isset($params['ifr'])) {
         $params['ifr'] = null;
     }
     if (!isset($params['multi'])) {
         $params['multi'] = null;
     }
     if (!isset($params['instructor'])) {
         $params['instructor'] = null;
     }
     if (!isset($params['board_member'])) {
         $params['board_member'] = null;
     }
     if (!isset($params['coordinator'])) {
         $params['coordinator'] = null;
     }
     if (!isset($params['orientation_pilot'])) {
         $params['orientation_pilot'] = null;
     }
     if (!isset($params['state'])) {
         $params['state'] = null;
     }
     if (!isset($params['home_base'])) {
         $params['home_base'] = null;
     }
     if (!isset($params['area_code'])) {
         $params['area_code'] = null;
     }
     if (!isset($params['email'])) {
         $params['email'] = null;
     }
     if (!isset($params['wing_job1'])) {
         $params['wing_job1'] = null;
     }
     $this->pilot_statuses = array_merge(array('' => 'All'), sfConfig::get('app_flight_statuses', array()));
     $this->wings = array_merge(array(0 => 'All'), WingPeer::getNames());
     if ($request->hasParameter('filter')) {
         $params['wing_id'] = in_array($request->getParameter('wing_id'), array_keys($this->wings)) ? $request->getParameter('wing_id') : 0;
         $params['pilot_status'] = in_array($request->getParameter('pilot_status'), array_keys($this->pilot_statuses)) ? $request->getParameter('pilot_status') : '';
         $params['ifr'] = $request->getParameter('ifr');
         $params['multi'] = $request->getParameter('multi');
         $params['instructor'] = $request->getParameter('instructor');
         $params['board_member'] = $request->getParameter('board_member');
         $params['coordinator'] = $request->getParameter('coordinator');
         $params['orientation_pilot'] = $request->getParameter('orientation_pilot');
         $params['state'] = $request->getParameter('state');
         $params['home_base'] = $request->getParameter('home_base');
         $params['area_code'] = $request->getParameter('area_code');
         $params['email'] = $request->getParameter('email');
         $params['wing_job1'] = $request->getParameter('wing_job1');
     }
     $this->page = $page = $request->getParameter('page', 1);
     $this->max = sfConfig::get('app_max_member_roster_per_pager');
     $this->pilot_status = $params['pilot_status'];
     $this->wing_id = $params['wing_id'];
     $this->ifr = $params['ifr'];
     $this->multi = $params['multi'];
     $this->instructor = $params['instructor'];
     $this->board_member = $params['board_member'];
     $this->coordinator = $params['coordinator'];
     $this->orientation_pilot = $params['orientation_pilot'];
     $this->state = $params['state'];
     $this->home_base = $params['home_base'];
     $this->area_code = $params['area_code'];
     $this->email = $params['email'];
     $this->wing_job1 = $params['wing_job1'];
     $this->getUser()->setAttribute('member_roster', $params, 'person');
 }
Example #13
0
 /**
  * Available missions for a pilot
  * CODE: mission_view
  * CODE: mission_available
  */
 public function executeRequestLegs(sfWebRequest $request)
 {
     #security
     if (!$this->getUser()->hasCredential(array('Administrator', 'Staff', 'Pilot', 'Coordinator', 'Volunteer'), false)) {
         $this->getUser()->setFlash("warning", 'You don\'t have permission to access this url ' . $request->getUri());
         $this->redirect('dashboard/index');
     }
     // validity
     $person = PersonPeer::retrieveByPK($this->getUser()->getId());
     $this->forward404Unless($person);
     $member = $person->getMember();
     //$this->forward404Unless($member);
     if ($member) {
         $pilot = $member->getPilot();
     } else {
         $pilot = null;
     }
     // filter related
     $this->date_widget = new widgetFormDate(array('format_date' => array('js' => 'mm/dd/yy', 'php' => 'm/d/Y')), array('class' => 'text'));
     if ($pilot) {
         $this->personal_flights = $pilot->getPersonalFlights();
     } else {
         $this->personal_flights = array();
     }
     $this->wings = WingPeer::doSelect(new Criteria());
     $this->idents = AirportPeer::doSelect(new Criteria());
     $this->states = sfConfig::get('app_short_states');
     $this->mission_types = MissionTypePeer::doSelect(new Criteria());
     $this->member = $member;
     $this->pilot = $pilot;
     if ($pilot) {
         $this->airport = $pilot->getAirport();
     } else {
         $this->airport = null;
     }
     $this->processFilterForm($request);
     if ($request->getParameter('needs') == 1) {
         $this->needs_pilot = 1;
     }
     $this->pager = MissionPeer::getPilotAvailablePager($this->max, $this->airport, $this->page, $this->sort_by, $this->date_range1, $this->date_range2, $this->weekdays, $this->wing_id, $this->ident, $this->city, $this->state, $this->zip, $this->origin, $this->dest, $this->needs_pilot, $this->co_pilot, $this->ifr, $this->selected_types, $this->filled, $this->open, $this->max_pass, $this->max_weight, $this->max_distance, $this->min_efficiency, false, $this->ignore_availability);
     // $this->pager = MissionPeer::getMissionsAvailable();
     $this->miss_array = $this->pager->getResults();
     //echo "<pre>";
     //print_r($this->miss_array);exit;
     $this->missions = MissionPeer::getByMayInterested($this->airport, $this->min_efficiency);
     $ident = $request->getParameter('airport_ident');
     if (!empty($ident)) {
         $this->airport_ident = $request->getParameter('airport_ident');
     } else {
         $this->airport_ident = "";
     }
 }
Example #14
0
 /**
  * Missing waivers
  * CODE:missing_waivers
  * TODO:
 */
 public function executeMissingWaivers(sfWebRequest $request)
 {
     #security
     if (!$this->getUser()->hasCredential(array('Administrator', 'Staff', 'Pilot', 'Coordinator', 'Volunteer'), false)) {
         $this->getUser()->setFlash("warning", 'You don\'t have permission to access this url ' . $request->getReferer());
         $this->redirect('dashboard/index');
     }
     # filter
     $this->processMissingWaiversFilter($request);
     $this->pager = MissionLegPeer::getMissingWaiversPager($this->max, $this->page, $this->mission_date1, $this->mission_date2, $this->pass_name, $this->pilot_name, $this->wing);
     $this->leg_list = $this->pager->getResults();
     $this->wings = WingPeer::doSelect(new Criteria());
     $this->date_widget = new widgetFormDate(array('format_date' => array('js' => 'mm/dd/yy', 'php' => 'm/d/Y')), array('class' => 'text'));
 }
Example #15
0
 public function executeEditPilot(sfWebRequest $request)
 {
     $member = MemberPeer::retrieveByPK($this->getUser()->getMemberId());
     $this->forward404Unless($member);
     $pilot = $member->getPilot();
     $this->forward404Unless($pilot);
     $this->flight_status = $member->getFlightStatus();
     $this->co_pilot = $member->getCoPilot();
     $this->license_type = $pilot->getLicenseType();
     $this->wing_id = $member->getWingId();
     $this->primary_airport_id = $pilot->getPrimaryAirportId();
     $this->secondary_airport_id = $pilot->getPrimaryAirportId();
     // TODO change to secondary
     $this->flight_statuses = sfConfig::get('app_flight_statuses', array());
     $this->license_types = sfConfig::get('app_pilot_license_types', array());
     $this->wings = WingPeer::getNames();
 }
Example #16
0
 /**
  * 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(WingPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     }
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria(WingPeer::DATABASE_NAME);
         $criteria->add(WingPeer::ID, $pks, Criteria::IN);
         $objs = WingPeer::doSelect($criteria, $con);
     }
     return $objs;
 }
Example #17
0
 public function executeAvailableMissions(sfWebRequest $request)
 {
     $pilot = PilotPeer::retrieveByPK($this->getUser()->getPilotId());
     if (!$pilot instanceof Pilot) {
         return sfView::NONE;
     }
     if ($pilot->getPrimaryAirportId()) {
         $this->mission_legs = MissionLegPeer::getPilotNear($pilot->getPrimaryAirportId());
     } else {
         $this->mission_legs = array();
     }
     $this->home_airport = $pilot->getAirport();
     $ids = array();
     foreach ($this->mission_legs as $leg) {
         $ids[] = $leg->getId();
     }
     $c = new Criteria();
     $c->add(MissionLegPeer::TRANSPORTATION, 'air_mission');
     $c->add(MissionLegPeer::ID, $ids, Criteria::NOT_IN);
     $c->add(MissionLegPeer::CANCELLED, null, Criteria::ISNULL);
     $c1 = $c->getNewCriterion(MissionLegPeer::PILOT_ID, null, Criteria::ISNULL);
     $c2 = $c->getNewCriterion(MissionLegPeer::COPILOT_ID, null, Criteria::ISNULL);
     $c->add($c1->addOr($c2));
     $c->setLimit(50);
     $this->interest_legs = MissionLegPeer::doSelectJoinMission($c);
     $c->clear();
     $c->addJoin(MissionLegPeer::ID, PilotRequestPeer::LEG_ID, Criteria::LEFT_JOIN);
     $c->add(PilotRequestPeer::ACCEPTED, 1, Criteria::NOT_EQUAL);
     $c->add(MissionLegPeer::TRANSPORTATION, 'air_mission');
     //$c->addAscendingOrderByColumn();
     $c->setLimit(50);
     $this->pending_legs = MissionLegPeer::doSelectJoinMission($c);
     //ziyed
     // validity
     $person = PersonPeer::retrieveByPK($this->getUser()->getId());
     //$this->forward404Unless($person);
     $member = $person->getMember();
     //$this->forward404Unless($member);
     if ($member) {
         $pilot = $member->getPilot();
     } else {
         $pilot = null;
     }
     // filter related
     $this->date_widget = new widgetFormDate(array('format_date' => array('js' => 'mm/dd/yy', 'php' => 'm/d/Y')), array('class' => 'text'));
     if ($pilot) {
         $this->personal_flights = $pilot->getPersonalFlights();
     } else {
         $this->personal_flights = array();
     }
     $this->wings = WingPeer::doSelect(new Criteria());
     $this->idents = AirportPeer::doSelect(new Criteria());
     $this->states = sfConfig::get('app_short_states');
     $this->mission_types = MissionTypePeer::doSelect(new Criteria());
     $this->member = $member;
     $this->pilot = $pilot;
     if ($pilot) {
         $this->airport = $pilot->getAirport();
     } else {
         $this->airport = null;
     }
     if ($request) {
         $this->processFilterForm($request);
     }
     if ($request->getParameter('needs') == 1) {
         $this->needs_pilot = 1;
     }
     $this->pager = MissionPeer::getPilotAvailablePager($this->max, $this->airport, $this->page, $this->sort_by, $this->date_range1, $this->date_range2, $this->weekdays, $this->wing_id, $this->ident, $this->city, $this->state, $this->zip, $this->origin, $this->dest, $this->needs_pilot, $this->co_pilot, $this->ifr, $this->selected_types, $this->filled, $this->open, $this->max_pass, $this->max_weight, $this->max_distance, $this->min_efficiency, false, $this->ignore_availability);
     $this->miss_array = $this->pager->getResults();
     $this->total_mission_available = $this->pager->getNbResults();
     $this->missions = MissionPeer::getByMayInterested($this->airport, $this->min_efficiency);
     $ident = $request->getParameter('airport_ident');
     if (!empty($ident)) {
         $this->airport_ident = $request->getParameter('airport_ident');
     } else {
         $this->airport_ident = "";
     }
     //end ziyed
 }
Example #18
0
 /**
  * Selects a collection of Member objects pre-filled with all related objects except MemberRelatedByMasterMemberId.
  *
  * @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 Member objects.
  * @throws     PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function doSelectJoinAllExceptMemberRelatedByMasterMemberId(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);
     }
     MemberPeer::addSelectColumns($c);
     $startcol2 = MemberPeer::NUM_COLUMNS - MemberPeer::NUM_LAZY_LOAD_COLUMNS;
     PersonPeer::addSelectColumns($c);
     $startcol3 = $startcol2 + (PersonPeer::NUM_COLUMNS - PersonPeer::NUM_LAZY_LOAD_COLUMNS);
     WingPeer::addSelectColumns($c);
     $startcol4 = $startcol3 + (WingPeer::NUM_COLUMNS - WingPeer::NUM_LAZY_LOAD_COLUMNS);
     MemberClassPeer::addSelectColumns($c);
     $startcol5 = $startcol4 + (MemberClassPeer::NUM_COLUMNS - MemberClassPeer::NUM_LAZY_LOAD_COLUMNS);
     $c->addJoin(array(MemberPeer::PERSON_ID), array(PersonPeer::ID), $join_behavior);
     $c->addJoin(array(MemberPeer::WING_ID), array(WingPeer::ID), $join_behavior);
     $c->addJoin(array(MemberPeer::MEMBER_CLASS_ID), array(MemberClassPeer::ID), $join_behavior);
     $stmt = BasePeer::doSelect($c, $con);
     $results = array();
     while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
         $key1 = MemberPeer::getPrimaryKeyHashFromRow($row, 0);
         if (null !== ($obj1 = MemberPeer::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 = MemberPeer::getOMClass();
             $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
             $obj1 = new $cls();
             $obj1->hydrate($row);
             MemberPeer::addInstanceToPool($obj1, $key1);
         }
         // if obj1 already loaded
         // Add objects for joined Person rows
         $key2 = PersonPeer::getPrimaryKeyHashFromRow($row, $startcol2);
         if ($key2 !== null) {
             $obj2 = PersonPeer::getInstanceFromPool($key2);
             if (!$obj2) {
                 $omClass = PersonPeer::getOMClass();
                 $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
                 $obj2 = new $cls();
                 $obj2->hydrate($row, $startcol2);
                 PersonPeer::addInstanceToPool($obj2, $key2);
             }
             // if $obj2 already loaded
             // Add the $obj1 (Member) to the collection in $obj2 (Person)
             $obj2->addMember($obj1);
         }
         // if joined row is not null
         // Add objects for joined Wing rows
         $key3 = WingPeer::getPrimaryKeyHashFromRow($row, $startcol3);
         if ($key3 !== null) {
             $obj3 = WingPeer::getInstanceFromPool($key3);
             if (!$obj3) {
                 $omClass = WingPeer::getOMClass();
                 $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
                 $obj3 = new $cls();
                 $obj3->hydrate($row, $startcol3);
                 WingPeer::addInstanceToPool($obj3, $key3);
             }
             // if $obj3 already loaded
             // Add the $obj1 (Member) to the collection in $obj3 (Wing)
             $obj3->addMember($obj1);
         }
         // if joined row is not null
         // Add objects for joined MemberClass rows
         $key4 = MemberClassPeer::getPrimaryKeyHashFromRow($row, $startcol4);
         if ($key4 !== null) {
             $obj4 = MemberClassPeer::getInstanceFromPool($key4);
             if (!$obj4) {
                 $omClass = MemberClassPeer::getOMClass();
                 $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
                 $obj4 = new $cls();
                 $obj4->hydrate($row, $startcol4);
                 MemberClassPeer::addInstanceToPool($obj4, $key4);
             }
             // if $obj4 already loaded
             // Add the $obj1 (Member) to the collection in $obj4 (MemberClass)
             $obj4->addMember($obj1);
         }
         // if joined row is not null
         $results[] = $obj1;
     }
     $stmt->closeCursor();
     return $results;
 }
Example #19
0
 /**
  * Selects a collection of EmailList objects pre-filled with all related objects.
  *
  * @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 EmailList objects.
  * @throws     PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function doSelectJoinAll(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN)
 {
     foreach (sfMixer::getCallables('BaseEmailListPeer:doSelectJoinAll:doSelectJoinAll') as $callable) {
         call_user_func($callable, 'BaseEmailListPeer', $c, $con);
     }
     $c = clone $c;
     // Set the correct dbName if it has not been overridden
     if ($c->getDbName() == Propel::getDefaultDB()) {
         $c->setDbName(self::DATABASE_NAME);
     }
     EmailListPeer::addSelectColumns($c);
     $startcol2 = EmailListPeer::NUM_COLUMNS - EmailListPeer::NUM_LAZY_LOAD_COLUMNS;
     WingPeer::addSelectColumns($c);
     $startcol3 = $startcol2 + (WingPeer::NUM_COLUMNS - WingPeer::NUM_LAZY_LOAD_COLUMNS);
     $c->addJoin(array(EmailListPeer::WING_ID), array(WingPeer::ID), $join_behavior);
     $stmt = BasePeer::doSelect($c, $con);
     $results = array();
     while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
         $key1 = EmailListPeer::getPrimaryKeyHashFromRow($row, 0);
         if (null !== ($obj1 = EmailListPeer::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 = EmailListPeer::getOMClass();
             $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
             $obj1 = new $cls();
             $obj1->hydrate($row);
             EmailListPeer::addInstanceToPool($obj1, $key1);
         }
         // if obj1 already loaded
         // Add objects for joined Wing rows
         $key2 = WingPeer::getPrimaryKeyHashFromRow($row, $startcol2);
         if ($key2 !== null) {
             $obj2 = WingPeer::getInstanceFromPool($key2);
             if (!$obj2) {
                 $omClass = WingPeer::getOMClass();
                 $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
                 $obj2 = new $cls();
                 $obj2->hydrate($row, $startcol2);
                 WingPeer::addInstanceToPool($obj2, $key2);
             }
             // if obj2 loaded
             // Add the $obj1 (EmailList) to the collection in $obj2 (Wing)
             $obj2->addEmailList($obj1);
         }
         // if joined row not null
         $results[] = $obj1;
     }
     $stmt->closeCursor();
     return $results;
 }