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


PHP Event::load方法代码示例

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


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

示例1: actionCreate

 /**
  * Creates a new Event model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Event();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->id]);
     }
     return $this->render('create', ['model' => $model, 'users' => $this->getUsers(), 'typeEvents' => $this->getTypeEvents(), 'events' => $this->getEvents(), 'defaultEvent' => $this->getDefaultEvent()]);
 }
开发者ID:vitalik74,项目名称:event-app,代码行数:13,代码来源:EventController.php

示例2: actionCreate

 public function actionCreate()
 {
     $model = new Event();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
开发者ID:bderevyaga,项目名称:IT-Revolution-2015,代码行数:9,代码来源:EventController.php

示例3: actionCreate

 public function actionCreate()
 {
     $model = new Event();
     if ($model->load(Yii::$app->request->post())) {
         $model->save();
         //var_dump($model->getErrors()); die;
     }
     return $this->render('create', array('model' => $model));
 }
开发者ID:rahaldr,项目名称:hello-world,代码行数:9,代码来源:EventController.php

示例4: actionCreate

 /**
  * Creates a new Event model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Event();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model, 'zal' => Zal::find()->asArray()->orderBy('name_zal')->all(), 'client' => Client::find()->asArray()->orderBy('name_client')->all(), 'users' => Users::find()->asArray()->where(['status' => 10])->orderBy('username')->all()]);
     }
 }
开发者ID:savers,项目名称:arenda,代码行数:14,代码来源:EventController.php

示例5: actionCreate

 /**
  * Creates a new Event model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate($date)
 {
     if (Yii::$app->user->can('admin')) {
         $model = new Event();
         $model->created_date = $date;
         if ($model->load(Yii::$app->request->post()) && $model->save()) {
             return $this->redirect(['index', 'id' => $model->id]);
         } else {
             return $this->renderAjax('create', ['model' => $model]);
         }
     }
 }
开发者ID:filimonchuk93,项目名称:monitoring.my,代码行数:17,代码来源:EventController.php

示例6: save

 /**
  * Save event data in the database
  *
  * @param array $data
  * @throws \Exception
  */
 public function save(array $data)
 {
     // Check event type
     if (!$this->hasValidEventType($data)) {
         throw new \Exception(\Yii::t("app", "Event has a invalid type: Should not be recorded."));
     }
     // Prepare the data for the model validation
     $eventData = ['Event' => $data];
     // New Event Model
     $eventModel = new Event();
     // Populate Event Model and Save (with validation)
     if (!$eventModel->load($eventData) || !$eventModel->save()) {
         throw new \Exception(Yii::t("app", "Error saving Event Model"));
     }
 }
开发者ID:ramialcheikh,项目名称:quickforms,代码行数:21,代码来源:Storage.php

示例7: actionCreate

 /**
  * Creates a new Event model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate($date)
 {
     $model = new Event();
     $model->user_id = Yii::$app->user->id;
     $model->date = $date;
     if ($model->load(Yii::$app->request->post())) {
         //var_dump($model);
         $model->shared_with = implode(',', $model->shared_with);
         if ($model->save()) {
             Yii::$app->notification->notify($model->title, $model, $model->user, Yii::$app->controller->id, $model->shared_with);
         }
         return $this->redirect(['view', 'id' => $model->id]);
     } elseif (Yii::$app->request->isAjax) {
         return $this->renderAjax('_form', ['model' => $model]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
开发者ID:livingdreams,项目名称:kidcrossing,代码行数:23,代码来源:EventController.php

示例8: actionCreate

 /**
  * Creates a new Event model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     if (\Yii::$app->user->isGuest) {
         return $this->redirect('/site/denied/');
     }
     $user = \Yii::$app->user->identity;
     if (!$user->admin && count($user->organisations) == 0) {
         return $this->redirect('/site/denied/');
     }
     $model = new Event();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
开发者ID:yodathedark,项目名称:moltis-tickets,代码行数:21,代码来源:EventsController.php


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