/** * Shows payment action */ public function actionPayment() { $eventFound = false; $request = Yii::app()->getRequest(); $eventId = $request->getParam('id', null); $eventLocationId = $request->getParam('evloc', null); $tickets = $request->getParam('tickets', null); if ($eventId !== null && is_numeric($eventId)) { $event = Event::model()->find('id = :id', array(':id' => $eventId)); if ($event !== null) { if ($eventLocationId !== null && is_numeric($eventLocationId)) { $eventLocation = EventLocation::model()->find('id = :id', array(':id' => $eventLocationId)); if ($eventLocation !== null) { if ($tickets !== null && is_numeric($tickets) && $tickets > 0) { $this->render('payment', array('event' => $event, 'eventLocation' => $eventLocation, 'tickets' => $tickets)); $eventFound = true; } } } } } if (!$eventFound) { $this->redirect('/site/search'); } }
public function getMinPriceForEvent($event_id) { $criteria = new CDbCriteria(); $criteria->select = 'MIN(price) AS price'; $criteria->addCondition('event_id = :eid'); $criteria->params = array(':eid' => $event_id); $objEventLocation = parent::model()->find($criteria); return $objEventLocation !== null ? $objEventLocation->price : 0; }
/** * Store a newly created inventory in storage. * * @return Response */ public function store() { $validator = Validator::make($data = Input::all(), EventLocation::$rules); if ($validator->fails()) { return Redirect::back()->withErrors($validator)->withInput(); } EventLocation::create($data); return Redirect::route('events.index'); }
/** * Store a newly created inventory in storage. * * @return Response */ public function store() { $validator = Validator::make($data = Input::all(), EventDate::$rules); if ($validator->fails()) { return Redirect::back()->withErrors($validator)->withInput(); } $data['startdate'] = strtotime($data['startdate']); $data['calldate'] = strtotime($data['calldate']); $data['enddate'] = strtotime($data['enddate']); $data['strikedate'] = strtotime($data['strikedate']); $location = $data['name']; unset($data['name']); $date = EventDate::create($data); EventLocation::create(['date_id' => $date->id, 'name' => $location]); return Redirect::route('events.index'); }
/** * @param EventLocation $location * @return void */ public function registerLocation(EventLocation $location) { $this->City = $location->getCity(); if ($location->getState()) { $this->State = $location->getState(); } $this->Country = $location->getCountry(); list($lat, $lng) = $location->getCoordinates(); $this->Lat = $lat; $this->Lng = $lng; }
public function updateCMSFields(FieldList $fields) { $locations = function () { return EventLocation::get()->map()->toArray(); }; $dropdown = DropdownField::create('LocationID', _t('EventLocations.LOCATION', 'Location'), $locations())->setHasEmptyDefault(true); if (class_exists('QuickAddNewExtension')) { $dropdown->useAddNew('EventLocation', $locations); } if ($this->owner->hasField('Capacity')) { Requirements::javascript(THIRDPARTY_DIR . '/jquery-metadata/jquery.metadata.js'); Requirements::add_i18n_javascript('eventlocations/javascript/lang'); Requirements::javascript('eventlocations/javascript/LocationDateTimeCms.js'); $capacities = array(); foreach ($locations as $location) { if ($location->Capacity) { $capacities[$location->ID] = (int) $location->Capacity; } } $dropdown->addExtraClass('{ capacities: ' . Convert::array2json($capacities) . ' }'); } $fields->insertBefore($dropdown, 'StartDate'); }