當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。