コード例 #1
0
 /**
  * Finds the Event model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Event the loaded model
  * @throws HttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Event::findOne($id)) !== null) {
         return $model;
     } else {
         throw new HttpException(404, 'The requested page does not exist.');
     }
 }
コード例 #2
0
 /**
  * @return Event|null
  */
 protected function getEvent()
 {
     if ($this->_event === null) {
         $this->_event = Event::findOne($this->event_id);
     }
     return $this->_event;
 }
コード例 #3
0
 /**
  * @return null|Event
  */
 public function getEvent()
 {
     if (!$this->_event) {
         $this->_event = Event::findOne($this->event_id);
     }
     return $this->_event;
 }
コード例 #4
0
 /**
  **在地图上显示一个事件中所有节点,并按照节点发生时间先后顺序绘出节点间轨迹图,打开地图时地图中心位置节点为起始节点,轨迹尾端为发生时间最晚节点.
  * @param $id
  * @return \yii\web\Response
  */
 public function actionViewRouteOnMap($id)
 {
     $event = Event::findOne($id);
     if ($event) {
         $name = substr(hash('md5', $id), 0, 10);
         return $this->redirect("http://forfreedomandlove.com/maps/{$name}.html");
     }
     return $this->redirect(['/find/event/event/' . $id]);
 }