function testSavesLocalChangesToDB()
 {
     $db = $this->getMock('TZDBWrapper');
     $dbRow = array('uid' => 123, 'availability_type' => Availability::AVAILABLE, 'start_time' => 1308865500, 'end_time' => 1308897900, 'local_changes' => 0);
     $a = new Availability($dbRow, $db);
     $a->setLocalChanges();
     $expected_db_row = $dbRow;
     $expected_db_row['local_changes'] = 1;
     $db->expects($this->once())->method('writeRecord')->with($this->equalTo('tzavailability'), $this->equalTo($expected_db_row));
     $a->save();
 }
Example #2
0
 public function afterSave($created, $options)
 {
     // If users are absent for this event, add them as "absent" automatically
     App::uses('Availability', 'Model');
     $AvailabilityModel = new Availability();
     $params = array();
     $params['recursive'] = 1;
     $params['fields'] = array('Availability.id', 'Availability.user_id', 'Availability.comment');
     $params['contain']['User'] = array();
     $params['conditions']['start <='] = $this->data['Event']['time_start'];
     $params['conditions']['end >='] = $this->data['Event']['time_start'];
     if ($availabilities = $AvailabilityModel->find('all', $params)) {
         App::uses('Character', 'Model');
         $CharacterModel = new Character();
         foreach ($availabilities as $availability) {
             $params = array();
             $params['recursive'] = -1;
             $params['fields'] = array('Character.id', 'Character.game_id', 'Character.level', 'Character.default_role_id');
             $params['group'] = 'game_id';
             $params['conditions']['user_id'] = $availability['Availability']['user_id'];
             $params['conditions']['game_id'] = $this->data['Event']['game_id'];
             $params['conditions']['main'] = 1;
             if ($characters = $CharacterModel->find('all', $params)) {
                 App::uses('EventsCharacter', 'Model');
                 $EventsCharacterModel = new EventsCharacter();
                 foreach ($characters as $character) {
                     // If already registered to this event, update it
                     $paramsEventsCharacter = array();
                     $paramsEventsCharacter['recursive'] = -1;
                     $paramsEventsCharacter['fields'] = array('id');
                     $paramsEventsCharacter['conditions']['event_id'] = $this->data['Event']['id'];
                     $paramsEventsCharacter['conditions']['user_id'] = $availability['Availability']['user_id'];
                     if ($eventCharacter = $EventsCharacterModel->find('first', $paramsEventsCharacter)) {
                         $eventCharacter['EventsCharacter']['status'] = 0;
                         $EventsCharacterModel->save($eventCharacter['EventsCharacter']);
                     } else {
                         $toSave = array();
                         $toSave['event_id'] = $this->data['Event']['id'];
                         $toSave['user_id'] = $availability['Availability']['user_id'];
                         $toSave['character_id'] = $character['Character']['id'];
                         $toSave['raids_role_id'] = $character['Character']['default_role_id'];
                         $toSave['comment'] = $availability['Availability']['comment'];
                         $toSave['status'] = 0;
                         $EventsCharacterModel->__add($toSave);
                     }
                 }
             }
         }
     }
 }
Example #3
0
 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());
 }
Example #4
0
	}

	if(!isset($_SESSION['booking_step_01_completed']) && $_SESSION['booking_step_01_completed'] != true){
		die(header('Location: ' . DOMAIN . "bookings/$hotel->seo_url/step-02"));
	}

	if(!isset($_POST['csrf']) || $_POST['csrf'] != '4d29198183ee43770967919813d915f0'){
		die(header('Location: ' . $_SESSION['page_url']));
	}else{
		$checkIn = $_POST['check_in'];
		$checkOut = $_POST['check_out'];
		if(isset($_POST['hotel']) && is_numeric($_POST['hotel'])){
			$hotelId = intval($_POST['hotel']);
		}else{
			$_SESSION['booking_nav_error'] = 'Looks like you want to start again.';
			die(header('Location: ' . $_SESSION['page_url']));
		}

		$hotel = new Hotel();
		$bookedDate = new BookedDate();
		$availability = new Availability();

		$hotel = $hotel->find($hotelId);
		$avRooms = $availability->where('hotel_id', '=', $hotelId)
			->whereRaw('no_of_rooms > booked_rooms')
			->get(['room_id']);

		$_SESSION['booking_step_01_completed'] = true;
		die(header('Location: ' . DOMAIN . "bookings/$hotel->seo_url/step-02"));
	}
?>
Example #5
0
 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;
 }
Example #6
0
<?php

require_once '../includes/header.php';
$a = new Availability();
if (Input::exists('get')) {
    try {
        $delete = $a->edit(['deleted' => 1], [['id', '=', Input::get('id')], ['cid', '=', $user->data()->id]]);
        if ($delete === true) {
            Session::flash('success', 'Availability deleted.');
        } else {
            Session::flash('error', 'Unable to delete availability.');
        }
    } catch (Exception $e) {
        Session::flash('error', $e->getMessage());
    }
    Redirect::to('./availability.php');
}
Example #7
0
<?php

$pagetitle = "Edit Availability";
require_once 'includes/header.php';
$a = new Availability();
if (Input::exists('post')) {
    try {
        $validate = new Validate();
        $validation = $validate->check($_POST, array('date' => array('field_name' => 'Date', 'required' => true), 'from' => array('field_name' => 'Time', 'required' => true), 'to' => array('field_name' => 'Time Until', 'required' => true)));
        if ($validation->passed()) {
            $test = $a->edit(array('date' => Input::get('date'), 'time_from' => Input::get('from') . ':00', 'time_until' => Input::get('to') . ':00'), [['id', '=', Input::get('id')], ['cid', '=', $user->data()->id]]);
            Session::flash('success', 'Availability edtited.');
            Redirect::to('./availability.php#myavailability');
        }
    } catch (Exception $e) {
        echo $e->getMessage();
    }
}
$availability = $a->get(['id' => Input::get('id')])[0];
?>
<div class="row">
<div class="col-md-10 col-md-offset-1">
 <h3 class="text-center">My Availability</h3><br>
    <div class="panel panel-default">
      <div class="panel-heading">Edit Availability</div>
      <div class="panel-body">

        <div class="col-md-8 col-md-offset-2">
        <form class="form-horizontal" action="" method="post">
          <fieldset>
            <div class="form-group">
Example #8
0
<?php

$pagetitle = 'All Available Students';
require_once "../includes/header.php";
echo '<h3 class="text-center">All Availablities</h3><br>';
try {
    $a = new Availability();
    if (Input::get('cid')) {
        $availables = $a->get(['student' => Input::get('cid')]);
    } else {
        $availables = $a->get(['deleted' => 0]);
    }
    ?>
<div class="row">
	<div class="col-md-10 col-md-offset-1">
		<div class="panel panel-default">
			<div class="panel-heading">
				<h3 class="panel-title"><?php 
    echo Input::get('cid') ? 'Student\'s Availability' : 'All available students';
    ?>
</h3>
			</div>
			<div class="panel-body" style="padding:0px;">
					<?php 
    try {
        if (!empty($availables)) {
            ?>
           <table class="table table-condensed table-striped">
			<tr>
				<td>
					<strong>Name</strong>
Example #9
0
 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());
     }
 }
Example #10
0
<?php

$pagetitle = "Schedule a Session";
require_once "../includes/header.php";
$a = new Availability();
if (Input::exists('post')) {
    try {
        $validate = new Validate();
        $validation = $validate->check($_POST, array('type' => array('field_name' => 'Report Type', 'required' => true), 'position' => array('field_name' => 'Position', 'required' => true), 'from' => array('field_name' => 'Time From', 'required' => true, 'time_less' => 'until', 'time_same' => 'until'), 'until' => array('field_name' => 'Time Until', 'required' => true)));
        if ($validation->passed()) {
            $from = new DateTime(Input::get('from'));
            $start = Input::get('date') . ' ' . $from->format("H:i:s");
            $until = new DateTime(Input::get('until'));
            $finish = Input::get('date') . ' ' . $until->format("H:i:s");
            $s->add(array('student' => Input::get('student'), 'mentor' => $user->data()->id, 'position_id' => Input::get('position'), 'report_type' => Input::get('type'), 'start' => $start, 'finish' => $finish));
            $a->edit(['deleted' => 1], [['id', '=', Input::get('availability_id')]]);
            Session::flash('success', 'Session added.');
            Redirect::to('./');
        } else {
            echo '<div class="row">
			<div class="col-md-6 col-md-offset-3">
				<div class="panel panel-danger">
				  <div class="panel-heading">
				    <h3 class="panel-title">The following errors occured:</h3>
				  </div>
				  <div class="panel-body">';
            foreach ($validation->errors() as $error) {
                echo $error . '<br>';
            }
            echo '</div>
				</div>
Example #11
0
    echo '<div class="panel-footer text-right"><a href="my_sessions.php">View All</a></div>';
}
?>
		</div>
	</div>
</div>
<div class="row">
	<div class="col-md-6">
		<div class="panel panel-default">
			<div class="panel-heading">
				<h3 class="panel-title">Available Students</h3>
			</div>
			<div class="panel-body">
				<?php 
try {
    $a = new Availability();
    $availabilities = $a->get(array('limit' => 5));
    $all = $a->get(['deleted' => 0]);
    if (!empty($availabilities)) {
        ?>
           <table class="table table-condensed table-striped">
			<tr>
				<td>
					<strong>Name</strong>
				</td>
				<td>
					<strong>Programme</strong>
				</td>
				<td>
					<strong>Date</strong>
				</td>
Example #12
0
 /**
  * Adds an object to the instance pool.
  *
  * Propel keeps cached copies of objects in an instance pool when they are retrieved
  * from the database.  In some cases -- especially when you override doSelect*()
  * methods in your stub classes -- you may need to explicitly add objects
  * to the cache in order to ensure that the same objects are always returned by doSelect*()
  * and retrieveByPK*() calls.
  *
  * @param      Availability $value A Availability object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool(Availability $obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getId();
         }
         // if key === null
         self::$instances[$key] = $obj;
     }
 }
Example #13
0
<?php

$pagetitle = "My Availability";
require_once 'includes/header.php';
$a = new Availability();
if (Input::exists()) {
    try {
        $validate = new Validate();
        $validation = $validate->check($_POST, array('date' => array('field_name' => 'Date', 'required' => true), 'from' => array('field_name' => 'Time From', 'required' => true, 'time_less' => 'to', 'time_same' => 'to'), 'to' => array('field_name' => 'Time Until', 'required' => true)));
        if ($validation->passed()) {
            $a->add(array('cid' => $user->data()->id, 'date' => Input::get('date'), 'time_from' => Input::get('from') . ':00', 'time_until' => Input::get('to') . ':00'));
            Session::flash('success', 'Availability added.');
            Redirect::to('./availability.php');
        } else {
            echo '<div class="row">
            <div class="col-md-6 col-md-offset-3">
              <div class="panel panel-danger">
                <div class="panel-heading">
                  <h3 class="panel-title">The following errors occured:</h3>
                </div>
                <div class="panel-body">';
            foreach ($validation->errors() as $error) {
                echo $error . '<br>';
            }
            echo '</div>
              </div>
            </div></div>
      ';
        }
    } catch (Exception $e) {
        echo $e->getMessage();
 private function buildAvailability($start_time, $end_time, $type = TZAvailabilityType::AVAILABLE)
 {
     $availability = new Availability();
     $availability->setStartTime($start_time);
     $availability->setEndTime($end_time);
     $availability->setType($type);
     return $availability;
 }