예제 #1
0
 private function getParticipantFormValues()
 {
     $formValues = array();
     try {
         $formValues['location'] = Location::rideShareLogGetUserLocation();
     } catch (\Exception $e) {
         return $this->handleRideShareLogError($e, 'Unable to retrieve Location for form.');
     }
     try {
         $formValues['methodTypes'] = MethodType::rideShareLogGetAll();
     } catch (\Exception $e) {
         return $this->handleRideShareLogError($e, 'Unable to retrieve Method Type for form.');
     }
     try {
         $formValues['passengerTypes'] = PassengerType::rideShareLogGetAll();
     } catch (\Exception $e) {
         return $this->handleRideShareLogError($e, 'Unable to retrieve Passenger Type for form.');
     }
     try {
         $formValues['lmpCombinations'] = LmpCombination::rideShareLogGetAll();
     } catch (\Exception $e) {
         return $this->handleRideShareLogError($e, 'Unable to retrieve L.M.P. Combinations for form.');
     }
     try {
         $formValues['additionalFields'] = AdditionalField::rideShareLogGetAll();
     } catch (\Exception $e) {
         return $this->handleRideShareLogError($e, 'Unable to retrieve Additional Field for form.');
     }
     try {
         $formValues['additionalFieldDependencies'] = AdditionalFieldDependency::rideShareLogGetAll();
     } catch (\Exception $e) {
         return $this->handleRideShareLogError($e, 'Unable to retrieve Additional Field Dependency for form.');
     }
     try {
         $formValues['submissions'] = Submission::rideShareLogGetAll();
     } catch (\Exception $e) {
         return $this->handleRideShareLogError($e, 'Unable to retrieve Submission for form.');
     }
     try {
         $formValues['additionalFieldSubmissions'] = AdditionalFieldSubmission::rideShareLogGetAll();
     } catch (\Exception $e) {
         return $this->handleRideShareLogError($e, 'Unable to retrieve Additional Field Submission for form.');
     }
     try {
         $formValues['user'] = User::rideShareLogGetField('display_name');
     } catch (\Exception $e) {
         return $this->handleRideShareLogError($e, 'Unable to retrieve User for form.');
     }
     try {
         $formValues['today'] = date('Y-m-d');
         /* Today = 2015-03-16 */
     } catch (\Exception $e) {
         return $this->handleRideShareLogError($e, 'Unable to retrieve Date for form.');
     }
     return json_encode($formValues, JSON_NUMERIC_CHECK);
 }
예제 #2
0
 /**
  * Add or edit passenger type
  * CODE: passenger_type_create
  */
 public function executeUpdateType(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');
     }
     if ($request->getParameter('id')) {
         $type = PassengerTypePeer::retrieveByPK($request->getParameter('id'));
         $this->forward404Unless($type);
         $this->title = 'Edit passenger type';
         $success = 'Passenger type information has been successfully changed!';
     } else {
         $type = new PassengerType();
         $this->title = 'Add new passenger type';
         $success = 'Passenger type information has been successfully created!';
     }
     $this->form = new PassengerTypeForm($type);
     if ($request->isMethod('post')) {
         $this->referer = $request->getParameter('referer');
         $this->form->bind($request->getParameter('pType'));
         if ($this->form->isValid()) {
             $type->setName($this->form->getValue('name'));
             if ($type->isNew()) {
                 $content = $this->getUser()->getName() . ' added new Passenger type: ' . $type->getName();
                 ActivityPeer::log($content);
             }
             $type->save();
             $this->getUser()->setFlash('success', $success);
             $this->redirect('@ptype');
         }
     } else {
         # Set referer URL
         $this->referer = $request->getReferer() ? $request->getReferer() : '@ptype';
     }
     $this->type = $type;
 }
 /**
  * Remove the specified passengertype from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     try {
         PassengerType::deactivate($id);
     } catch (\Exception $e) {
         return $this->handleError($e);
     }
     return Redirect::route('passenger_types.index');
 }
예제 #4
0
 /**
  * Declares an association between this object and a PassengerType object.
  *
  * @param      PassengerType $v
  * @return     Passenger The current object (for fluent API support)
  * @throws     PropelException
  */
 public function setPassengerType(PassengerType $v = null)
 {
     if ($v === null) {
         $this->setPassengerTypeId(NULL);
     } else {
         $this->setPassengerTypeId($v->getId());
     }
     $this->aPassengerType = $v;
     // Add binding for other direction of this n:n relationship.
     // If this object has already been added to the PassengerType object, it will not be re-added.
     if ($v !== null) {
         $v->addPassenger($this);
     }
     return $this;
 }
예제 #5
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      PassengerType $value A PassengerType object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool(PassengerType $obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getId();
         }
         // if key === null
         self::$instances[$key] = $obj;
     }
 }