当前位置: 首页>>代码示例>>PHP>>正文


PHP Event::model方法代码示例

本文整理汇总了PHP中Event::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Event::model方法的具体用法?PHP Event::model怎么用?PHP Event::model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Event的用法示例。


在下文中一共展示了Event::model方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: run

 public function run($isTab = false)
 {
     /** @var TourBuilderForm $tourForm */
     $tourForm = Yii::app()->user->getState('tourForm');
     $eventId = $tourForm->eventId;
     $startCities = Yii::app()->user->getState('startCities');
     $currentStartCityIndex = Yii::app()->user->getState('startCitiesIndex') - 1;
     $currentStartCity = City::model()->findByPk($startCities[$currentStartCityIndex]->id);
     $startCityId = $currentStartCity->id;
     $event = Event::model()->findByPk($eventId);
     $tripStorage = new TripStorage();
     $order = $tripStorage->saveOrder($event, $startCityId, 'Тур для события "' . $event->title . '" из ' . $currentStartCity->caseGen);
     $eventOrder = new EventOrder();
     $eventOrder->startCityId = $startCityId;
     $eventOrder->orderId = $order->id;
     $eventOrder->eventId = $event->id;
     $eventOrder->save();
     $eventPrice = EventPrice::model()->findByAttributes(array('eventId' => $eventId, 'cityId' => $startCityId));
     if (!$eventPrice) {
         $eventPrice = new EventPrice();
     }
     $eventPrice->eventId = $event->id;
     $eventPrice->cityId = $startCityId;
     $eventPrice->bestPrice = $tripStorage->getPrice();
     if (!$eventPrice->save()) {
         throw new CHttpException('Could not save price for event - city.' . CVarDumper::dumpAsString($eventPrice));
     }
     $this->controller->redirect($this->controller->createUrl('showEventTrip'));
 }
开发者ID:niranjan2m,项目名称:Voyanga,代码行数:29,代码来源:SaveTourAction.php

示例2: getRows

 /**
  * Get the table rows that need to be printed in the pdf
  * 
  * @return array
  */
 public function getRows()
 {
     if (empty($this->_rows)) {
         foreach ($this->calendars as $calendar) {
             $row = array('name' => $calendar->name);
             //				foreach($this->categories as $category){
             $findParams = \GO\Base\Db\FindParams::newInstance()->ignoreAcl()->select('COUNT(*) as count, category_id')->group('category_id');
             //					$findParams->ignoreAcl();							// Only count items that are visible for this user.
             //				$findParams->group('calendar_id');
             $findCriteria = \GO\Base\Db\FindCriteria::newInstance();
             $findCriteria->addCondition('calendar_id', $calendar->id);
             $findCriteria->addCondition('start_time', strtotime($this->startDate), '>');
             $findCriteria->addCondition('end_time', strtotime($this->endDate), '<');
             $findParams->criteria($findCriteria);
             $catRecord = array();
             foreach (Event::model()->find($findParams) as $record) {
                 $catRecord[intval($record->category_id)] = $record->count;
             }
             foreach ($this->categories as $category) {
                 $row[] = isset($catRecord[$category->id]) ? $catRecord[$category->id] : 0;
             }
             $this->_rows[] = $row;
         }
         //			}
     }
     return $this->_rows;
 }
开发者ID:ajaboa,项目名称:crmpuan,代码行数:32,代码来源:PrintCategoryCount.php

示例3: getForEventId

 /**
  * Convenience wrapper to retrieve the API relevant to the given event id
  *
  * @param $event_id
  * @return BaseAPI|bool
  */
 public function getForEventId($event_id)
 {
     if ($event = Event::model()->with('eventType')->findByPk($event_id)) {
         return $this->get($event->eventType->class_name);
     }
     return false;
 }
开发者ID:openeyes,项目名称:openeyes,代码行数:13,代码来源:ModuleAPI.php

示例4: actionRss

 public function actionRss()
 {
     // disabling web log
     foreach (Yii::app()->log->routes as $route) {
         if ($route instanceof CWebLogRoute) {
             $route->enabled = false;
         }
     }
     Yii::import('ext.feed.*');
     $feed = new EFeed();
     $feed->title = Yii::app()->name . ' | ' . Yii::t('eventModule.common', 'Événements');
     $feed->description = Yii::app()->name . ' | ' . Yii::t('eventModule.common', 'meta_description');
     $feed->addChannelTag('language', Yii::app()->language);
     $feed->addChannelTag('pubDate', date(DATE_RSS, time()));
     $feed->addChannelTag('link', $this->createAbsoluteUrl('index'));
     if ($events = Event::model()->findAll(array('order' => 'date_start ASC, date_end ASC', 'limit' => 25, 'condition' => "date_end >= '" . date('Y-m-d H:i:s') . "' AND section_id = " . Yii::app()->cms->currentSectionId))) {
         foreach ($events as $event) {
             $item = $feed->createNewItem();
             $item->title = $event->title;
             $item->link = $this->createAbsoluteUrl('detail', array('n' => $event->title_url));
             $item->date = $event->date_created;
             if (!empty($event->image)) {
                 $item->description = '<div style="margin-bottom: 1em;"><img src="' . Yii::app()->request->hostInfo . Yii::app()->request->baseUrl . '/' . $event->imageHandler->dir . '/' . Helper::encodeFileName(Helper::fileSuffix($event->image, 's')) . '" alt="' . CHtml::encode($event->title) . '" /></div><div>' . CHtml::encode($event->summary) . '</div>';
             } else {
                 $item->description = CHtml::encode($event->summary);
             }
             $feed->addItem($item);
         }
     }
     $feed->generateFeed();
     Yii::app()->end();
 }
开发者ID:kostya1017,项目名称:our,代码行数:32,代码来源:DefaultController.php

示例5: actionPayment

 /**
  * 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');
     }
 }
开发者ID:aaronestrada,项目名称:EventiTest,代码行数:28,代码来源:SiteController.php

示例6: actionCreate

 /**
  * Handle the selection of a booking for creating an op note.
  *
  * (non-phpdoc)
  *
  * @see parent::actionCreate()
  */
 public function actionCreate()
 {
     $errors = array();
     // if we are after the submit we need to check if any event is selected
     if (preg_match('/^biometry([0-9]+)$/', Yii::app()->request->getPost('SelectBiometry'), $m)) {
         $importedEvent = OphInBiometry_Imported_Events::model()->findByPk($m[1]);
         $this->updateImportedEvent(Event::model()->findByPk($importedEvent->event_id), $importedEvent);
         $this->redirect(array('/OphInBiometry/default/view/' . $importedEvent->event_id . '?autosaved=1'));
     }
     $criteria = new CDbCriteria();
     // we are looking for the unlinked imported events in the database
     $criteria->addCondition('patient_id = :patient_id');
     $criteria->addCondition('is_linked = 0');
     $criteria->addCondition('event.deleted = 0');
     $criteria->params = array(':patient_id' => $this->patient->id);
     $unlinkedEvents = OphInBiometry_Imported_Events::model()->with(array('patient', 'event'))->findAll($criteria);
     // if we have 0 unlinked event we follow the manual process
     if (sizeof($unlinkedEvents) == 0 || Yii::app()->request->getQuery('force_manual') == '1') {
         Yii::app()->user->setFlash('issue.formula', $this->flash_message);
         parent::actionCreate();
     } else {
         // if we have more than 1 event we render the selection screen
         $this->title = 'Please Select a Biometry Report';
         $this->event_tabs = array(array('label' => 'The following Biometry reports are available for this patient:', 'active' => true));
         $cancel_url = $this->episode ? '/patient/episode/' . $this->episode->id : '/patient/episodes/' . $this->patient->id;
         $this->event_actions = array(EventAction::link('Cancel', Yii::app()->createUrl($cancel_url), null, array('class' => 'button small warning')));
         $this->render('select_imported_event', array('errors' => $errors, 'imported_events' => $unlinkedEvents));
     }
 }
开发者ID:openeyes,项目名称:openeyes,代码行数:36,代码来源:DefaultController.php

示例7: actionView

 /**
  * Display page by url.
  * Example url: /page/some-page-url
  * @param string $url page url
  */
 public function actionView($url)
 {
     $model = Event::model()->withUrl($url)->find(array('limit' => 1));
     if (!$model) {
         throw new CHttpException(404, Yii::t('EventsModule.core', 'Страница не найдена.'));
     }
     $this->render('view', array('model' => $model));
 }
开发者ID:bahdall,项目名称:karbella_event,代码行数:13,代码来源:EventsController.php

示例8: actionDelete

 public function actionDelete($id)
 {
     if (null === ($model = Event::model()->findByPk($id))) {
         throw new CHttpException(404);
     }
     if (!$model->delete()) {
         throw new CException('Cannot delete event');
     }
 }
开发者ID:Bodya91,项目名称:yii-rest,代码行数:9,代码来源:EventController.php

示例9: updateForks

 public function updateForks($src_type)
 {
     $time = StatTime::create(__METHOD__);
     $events = Event::model()->with(['events', 'forks'])->findAllByAttributes(['src_type' => Event::SRCTYPE_COMBINE]);
     foreach ($events as $event) {
         /* @var $event Event */
         $event->updateForks();
     }
     $time->saveTime();
 }
开发者ID:tdimdimich,项目名称:wililhill.com,代码行数:10,代码来源:EventCommand.php

示例10: findAll

 public function findAll($attributes = '', $values = array())
 {
     // because we are working with a view, we should present the event as the last Biometry from the view
     // we need the patient ID and the last_modified date of the current event
     // $attributes == "event_id = ?" in this case
     $eventData = Event::model()->findByPk($values[0]);
     $episodeData = Episode::model()->findByPk($eventData->episode_id);
     $latestData = $this->findAllBySql("\n\t\t\t\t\t\tSELECT eob.*, '" . $values[0] . "' AS event_id FROM et_ophtroperationnote_biometry eob\n\t\t\t\t\t\t\t\t\t\tWHERE eob.patient_id=" . $episodeData->patient_id . "\n\t\t\t\t\t\t\t\t\t\tAND eob.last_modified_date <= '" . $eventData->last_modified_date . "'\n\t\t\t\t\t\t\t\t\t\tORDER BY eob.last_modified_date\n\t\t\t\t\t\t\t\t\t\tDESC LIMIT 1; ");
     return $latestData;
 }
开发者ID:openeyes,项目名称:openeyes,代码行数:10,代码来源:Element_OphTrOperationnote_Biometry.php

示例11: run

 public function run()
 {
     Yii::app()->clientScript->registerCssFile(Yii::app()->getAssetManager()->publish(Yii::getPathOfAlias('event.assets'), false, -1, YII_DEBUG) . '/css/event.css');
     if ($this->sectionId === null) {
         $events = Event::model()->findAll(array('order' => 'date_start ASC, date_end ASC', 'limit' => $this->maxNbrEntries));
     } else {
         $events = Event::model()->findAll(array('order' => 'date_start ASC, date_end ASC', 'condition' => 'section_id = ' . $this->sectionId, 'limit' => $this->maxNbrEntries));
     }
     $this->render('recentEventsWidget', array('events' => $events));
 }
开发者ID:kostya1017,项目名称:our,代码行数:10,代码来源:RecentEventsWidget.php

示例12: loadData

 /**
  * Collate the data and persist it to the table.
  *
  * @param $id
  *
  * @throws CHttpException
  * @throws Exception
  */
 public function loadData($id)
 {
     $booking = Element_OphTrOperationbooking_Operation::model()->find('event_id=?', array($id));
     $eye = Eye::model()->findByPk($booking->eye_id);
     if ($eye->name === 'Both') {
         throw new CHttpException(400, 'Can\'t display whiteboard for dual eye bookings');
     }
     $eyeLabel = strtolower($eye->name);
     $event = Event::model()->findByPk($id);
     $episode = Episode::model()->findByPk($event->episode_id);
     $patient = Patient::model()->findByPk($episode->patient_id);
     $contact = Contact::model()->findByPk($patient->contact_id);
     $biometryCriteria = new CDbCriteria();
     $biometryCriteria->addCondition('patient_id = :patient_id');
     $biometryCriteria->params = array('patient_id' => $patient->id);
     $biometryCriteria->order = 'last_modified_date DESC';
     $biometryCriteria->limit = 1;
     $biometry = Element_OphTrOperationnote_Biometry::model()->find($biometryCriteria);
     $examination = $event->getPreviousInEpisode(EventType::model()->findByAttributes(array('name' => 'Examination'))->id);
     //$management = new \OEModule\OphCiExamination\models\Element_OphCiExamination_Management();
     //$anterior = new \OEModule\OphCiExamination\models\Element_OphCiExamination_AnteriorSegment();
     $risks = new \OEModule\OphCiExamination\models\Element_OphCiExamination_HistoryRisk();
     if ($examination) {
         //$management = $management->findByAttributes(array('event_id' => $examination->id));
         //$anterior = $anterior->findByAttributes(array('event_id' => $examination->id));
         $risks = $risks->findByAttributes(array('event_id' => $examination->id));
     }
     $labResult = Element_OphInLabResults_Inr::model()->findPatientResultByType($patient->id, '1');
     $allergies = Yii::app()->db->createCommand()->select('a.name as name')->from('patient_allergy_assignment pas')->leftJoin('allergy a', 'pas.allergy_id = a.id')->where("pas.patient_id = {$episode->patient_id}")->order('a.name')->queryAll();
     $allergyString = 'None';
     if ($allergies) {
         $allergyString = implode(',', array_column($allergies, 'name'));
     }
     $operation = Yii::app()->db->createCommand()->select('proc.term as term')->from('et_ophtroperationbooking_operation op')->leftJoin('ophtroperationbooking_operation_procedures_procedures opp', 'opp.element_id = op.id')->leftJoin('proc', 'opp.proc_id = proc.id')->where("op.event_id = {$id}")->queryAll();
     $this->event_id = $id;
     $this->booking = $booking;
     $this->eye_id = $eye->id;
     $this->eye = $eye;
     $this->predicted_additional_equipment = $booking->special_equipment_details;
     $this->comments = '';
     $this->patient_name = $contact['title'] . ' ' . $contact['first_name'] . ' ' . $contact['last_name'];
     $this->date_of_birth = $patient['dob'];
     $this->hos_num = $patient['hos_num'];
     $this->procedure = implode(',', array_column($operation, 'term'));
     $this->allergies = $allergyString;
     $this->iol_model = $biometry ? $biometry->attributes['lens_description_' . $eyeLabel] : 'Unknown';
     $this->iol_power = $biometry ? $biometry->attributes['iol_power_' . $eyeLabel] : 'none';
     $this->predicted_refractive_outcome = $biometry ? $biometry->attributes['predicted_refraction_' . $eyeLabel] : 'Unknown';
     $this->alpha_blockers = $patient->hasRisk('Alpha blockers');
     $this->anticoagulants = $patient->hasRisk('Anticoagulants');
     $this->alpha_blocker_name = $risks ? $risks->alpha_blocker_name : '';
     $this->anticoagulant_name = $risks ? $risks->anticoagulant_name : '';
     $this->inr = $labResult ? $labResult : 'None';
     $this->save();
 }
开发者ID:openeyes,项目名称:openeyes,代码行数:63,代码来源:OphTrOperationbooking_Whiteboard.php

示例13: saveEvents

 private function saveEvents($events)
 {
     foreach ($events as $item) {
         $event = Event::model()->findByAttributes(['src_type' => Event::SRCTYPE_PINNACLESPORTS, 'int_id' => $item['int_id']]);
         $event = $event ? $event : new Event();
         /* @var $event Event */
         $event->dropEventIdIfChanged($item);
         $event->setAttributes($item, false);
         $event->save();
     }
 }
开发者ID:tdimdimich,项目名称:wililhill.com,代码行数:11,代码来源:EventPNSCommand.php

示例14: run

 public function run()
 {
     if ($this->sectionId !== null && isset($_POST['eventsCalendarWidgetDate']) && (!isset($_POST['eventsCalendarWidgetSectionId']) || $_POST['eventsCalendarWidgetSectionId'] != $this->sectionId)) {
         return;
     }
     Yii::app()->clientScript->registerCssFile(Yii::app()->getAssetManager()->publish(Yii::getPathOfAlias('event.assets'), false, -1, YII_DEBUG) . '/css/events-calendar-widget.css');
     if (Yii::app()->request->isAjaxRequest && isset($_POST['eventsCalendarWidgetDate'])) {
         $date = getdate(strtotime($_POST['eventsCalendarWidgetDate']));
     } else {
         $date = getdate();
     }
     $dateSqlStart = $date['year'] . '-' . str_pad($date['mon'], 2, '0', STR_PAD_LEFT) . '-01';
     $nextMonth = getDate(mktime(0, 0, 0, $date['mon'] + 1, 1, $date['year']));
     $dateSqlEnd = $date['year'] . '-' . str_pad($nextMonth['mon'], 2, '0', STR_PAD_LEFT) . '-01';
     if ($this->sectionId !== null) {
         $eventModels = Event::model()->findAll(array('condition' => 't.date_start < :dateend AND t.date_end >= :datestart AND t.section_id = :sectionId', 'params' => array(':datestart' => $dateSqlStart, ':dateend' => $dateSqlEnd, ':sectionId' => $this->sectionId)));
     } else {
         $eventModels = Event::model()->findAll(array('condition' => 't.date_start < :dateend AND t.date_end >= :datestart', 'params' => array(':datestart' => $dateSqlStart, ':dateend' => $dateSqlEnd)));
     }
     $events = array();
     foreach ($eventModels as $eventModel) {
         $monthStart = substr($eventModel->date_start, 5, 2);
         $yearStart = substr($eventModel->date_start, 0, 4);
         $dayStart = substr($eventModel->date_start, 8, 2);
         $dayEnd = substr($eventModel->date_end, 8, 2);
         $monthEnd = substr($eventModel->date_end, 5, 2);
         $yearEnd = substr($eventModel->date_end, 0, 4);
         if ($monthStart == $monthEnd && $yearStart == $yearEnd) {
             $dayEnd = substr($eventModel->date_end, 8, 2);
         } elseif (($monthStart < $monthEnd || $yearStart < $yearEnd) && ($date['mon'] == $monthEnd && $date['year'] == $yearEnd)) {
             $dayStart = 1;
         } elseif (($monthStart < $monthEnd || $yearStart < $yearEnd) && ($date['mon'] == $monthStart && $date['year'] == $yearStart)) {
             $dayEnd = 31;
         } else {
             $dayStart = 1;
             $dayEnd = 31;
         }
         for ($i = (int) $dayStart; $i <= $dayEnd; $i++) {
             if (!isset($events[$i])) {
                 $events[$i] = array();
             }
             $events[$i][] = $eventModel;
         }
     }
     $render = $this->render('eventsCalendarWidget', array('events' => $events, 'date' => $date), true);
     if (Yii::app()->request->isAjaxRequest) {
         echo "\n" . '<div id="events-calendar-widget-render">' . "\n";
         echo $render;
         echo "\n" . '</div>' . "\n";
         Yii::app()->end();
     } else {
         echo $render;
     }
 }
开发者ID:kostya1017,项目名称:our,代码行数:54,代码来源:EventsCalendarWidget.php

示例15: run

 public function run()
 {
     $criteria = new CDbCriteria();
     $count = Event::model()->count($criteria);
     $pages = new CPagination($count);
     // results per page
     $pages->pageSize = $this->count;
     $pages->applyLimit($criteria);
     $events = Event::model()->findAll($criteria);
     $this->provider = new CActiveDataProvider('Event', array('id' => false, 'pagination' => array('pageSize' => $this->count)));
     $this->render($this->view, array('events' => $events, 'pages' => $pages, 'provider' => $this->provider));
 }
开发者ID:bahdall,项目名称:karbella_event,代码行数:12,代码来源:LastEvents.php


注:本文中的Event::model方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。