/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Cemeteries::find();
     // add conditions that should always apply here
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     // grid filtering conditions
     $query->andFilterWhere(['id' => $this->id, 'latitude' => $this->latitude, 'longitude' => $this->longitude, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at]);
     $query->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'description', $this->description]);
     return $dataProvider;
 }
 /**
  * Finds the Cemeteries model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param string $id
  * @return Cemeteries the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Cemeteries::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Exemple #3
0
 public function getCemetery()
 {
     return Cemeteries::findOne($this->cemetery_id);
 }
Exemple #4
0
                    <span class="glyphicon glyphicon-chevron-left"></span>
                </a>
                <a href="#image-slider" class="right carousel-control" data-slide="next">
                    <span class="glyphicon glyphicon-chevron-right"></span>
                </a>                
                <?php 
}
?>
            </div>
        </div>
<!----------------------------- cemetery ----------------------------------------->
        <div class="tab-pane" id="cemetery">
            <?php 
echo '<div class="main-box" style="height: 550px;">';
if ($model->cemetery_id != null) {
    $cemetery = Cemeteries::findOne($model->cemetery_id);
    echo '<p>' . Html::a($cemetery->title, '/cemeteries/view?id=' . $cemetery->id, ['title' => $cemetery->description]) . '</p>';
    if ($model->hasGraveCoordinates()) {
        echo '<script type="text/javascript" async defer
                        src="http://maps.googleapis.com/maps/api/js?key=AIzaSyATK26QBNg6wgXq4Kk4rwQ8r21qi5BQ_Mo&sensor=false&callback=initialize">
                        </script>
                        <style type="text/css">
                        #map_canvas { height: 100%; }  
                    </style>';
        echo '<script type="text/javascript">
                        function initialize() 
                        {
                            var lat = ' . $model->grave_lat . ';
                            var lon = ' . $model->grave_lon . ';
                            var name = "' . $model->getFullName() . '";
                            var image = "/pics/icons/headstone.png";