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


PHP Event::findOne方法代码示例

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


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

示例1: findModel

 protected function findModel($id)
 {
     if (($model = Event::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
开发者ID:bderevyaga,项目名称:IT-Revolution-2015,代码行数:8,代码来源:EventController.php

示例2: loadModel

 /**
  * Загружает запись модели текущего контроллера по айдишнику
  * @param $id
  * @return null|static
  * @throws \yii\web\HttpException
  */
 public function loadModel($id)
 {
     $model = Event::findOne($id);
     if ($model === null) {
         throw new \yii\web\HttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
开发者ID:roman1970,项目名称:lis,代码行数:14,代码来源:EventController.php

示例3: actionSend

 public function actionSend()
 {
     //      //broadcast semua
     //      $email = new Email();
     //     if ($email->load(Yii::$app->request->post()) && $email->validate()) {
     //      $peserta = Peserta::find()->all();
     //      foreach($peserta as $key){
     //          $temp = $key->email;
     // echo $temp;
     //          $content_template = $email->content;
     //          //mengambil subjek dari email yang akan dikirimkan
     //          $subject_template = $email->subject;
     //          $subject = str_replace("{nama}", $key->nama, $subject_template);
     //          $content = str_replace("{nama}", $key->nama, $content_template);
     //          echo "</br>";
     //          Yii::$app->mailer
     //                   ->compose()
     //                   ->setFrom(Yii::$app->params['adminEmail'])
     //                   ->setHtmlBody($content)
     //                   ->setSubject($subject)
     //                   ->setTo($temp)
     //                   ->send();
     //          }
     //      }
     //send per event
     $email = new Email();
     if ($email->load(Yii::$app->request->post()) && $email->validate()) {
         //mengambil event yang dipilih
         $event = Event::findOne($email->id_event);
         //mengambil content dari email yang akan dikirimkan
         $content_template = $email->content;
         //mengambil subjek dari email yang akan dikirimkan
         $subject_template = $email->subject;
         foreach ($event->absensis as $absensi) {
             $temp = $absensi->idPeserta->email;
             echo $temp;
             // echo $absensi->idPeserta->email;
             echo "</br>";
             $subject = str_replace("{nama}", $absensi->idPeserta->nama, $subject_template);
             $subject = str_replace("{nama_seminar}", $event->nama, $subject);
             $subject = str_replace("{jadwal}", $event->jadwal, $subject);
             $content = str_replace("{nama}", $absensi->idPeserta->nama, $content_template);
             $content = str_replace("{nama_seminar}", $event->nama, $content);
             $content = str_replace("{jadwal}", $event->jadwal, $content);
             Yii::$app->mailer->compose()->setFrom(Yii::$app->params['adminEmail'])->setHtmlBody($content)->setSubject($subject)->setTo($temp)->send();
         }
     }
 }
开发者ID:henrybagus,项目名称:seminar,代码行数:48,代码来源:EmailController.php

示例4: foreach

<?php

use app\models\Event;
use app\models\Cart;
$_event = Event::findOne(2);
$carts = Cart::findAll(['status' => Cart::CART_SOLD]);
$sold_tickets = [];
foreach ($carts as $cart) {
    $items = $cart->items;
    foreach ($items as $i) {
        if (!isset($sold_tickets[$i->ticket_id])) {
            $sold_tickets[$i->ticket_id] = 0;
        }
        $sold_tickets[$i->ticket_id] += $i->quantity;
    }
}
$sold_total = 0;
$total_tickets_sold = 0;
$this->title = Yii::t('app', 'Event Summary');
?>
<div class="foxden-default-index">
    <h1><?php 
echo $this->title;
?>
</h1>
    <?php 
foreach ($_event->ticketGroups as $group) {
    if (sizeof($_event->ticketGroups) > 1) {
        ?>
<h2><?php 
        echo $group->name;
开发者ID:yodathedark,项目名称:moltis-tickets,代码行数:31,代码来源:index.php

示例5: findModelBySlug

 /**
  * Finds the Event model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param string $slug
  * @return Event the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModelBySlug($slug)
 {
     if (($model = Event::findOne(['slug' => $slug])) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
开发者ID:yodathedark,项目名称:moltis-tickets,代码行数:15,代码来源:EventsController.php

示例6: actionEntry

 public function actionEntry()
 {
     $model = new AbsensiForm();
     $data = Event::find()->all();
     if ($model->load(Yii::$app->request->get()) && $model->validate()) {
         $event = Event::findOne($model->id_event);
         return $this->render('absensi-confirm', ['event' => $event]);
     } else {
         return $this->render('absensi', ['model' => $model, 'data' => $data]);
     }
 }
开发者ID:henrybagus,项目名称:seminar,代码行数:11,代码来源:AbsensiController.php

示例7: actionSearch

 /**
  * Поиск Sphinx айтемов и событий
  * @return string
  */
 function actionSearch()
 {
     if (Yii::$app->getRequest()->getQueryParam('user')) {
         $user = MarkUser::findOne(Yii::$app->getRequest()->getQueryParam('user'));
         if (!$user) {
             return 'Доступ запрещен!';
         }
         if (Yii::$app->getRequest()->getQueryParam('text')) {
             $items_records = [];
             $events_records = [];
             $query = new Query();
             // $search_result = $query_search->from('siteSearch')->match($q)->all();  // поиск осуществляется по средством метода match с переданной поисковой фразой.
             $query_items_ids = $query->from('items')->match(Yii::$app->getRequest()->getQueryParam('text'))->all();
             foreach ($query_items_ids as $arr_item_rec) {
                 foreach ($arr_item_rec as $id) {
                     $items_records[] = Items::findOne((int) $id);
                 }
             }
             //return $this->renderPartial('searched', ['items_rows' => $items_records, 'events_rows' => 2]);
             $query_events_ids = $query->from('events')->match(Yii::$app->getRequest()->getQueryParam('text'))->all();
             foreach ($query_events_ids as $arr_event_rec) {
                 foreach ($arr_event_rec as $id) {
                     $events_records[] = Event::findOne((int) $id);
                 }
             }
             //var_dump($events_records); exit;
             sort($events_records);
             krsort($events_records);
             return $this->renderPartial('searched', ['items_rows' => is_array($items_records) && !empty($items_records) && $items_records ? $items_records : 'Ничего не найдено', 'events_rows' => is_array($events_records) && !empty($events_records) && $events_records ? $events_records : 'Ничего не найдено']);
         }
         return $this->renderPartial('search_form');
     }
 }
开发者ID:roman1970,项目名称:lis,代码行数:37,代码来源:DefaultController.php


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