Esempio n. 1
0
 /**
  * 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;
 }