/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Info::find(); $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; } $query->andFilterWhere(['id' => $this->id, 'status' => $this->status, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at]); $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'images', $this->images])->andFilterWhere(['like', 'facebook', $this->facebook])->andFilterWhere(['like', 'fanpagefb', $this->fanpagefb])->andFilterWhere(['like', 'skype', $this->skype])->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['like', 'phonenumber', $this->phonenumber])->andFilterWhere(['like', 'andress', $this->andress])->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'website', $this->website]); return $dataProvider; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params = []) { $query = Info::find(); $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => self::ITEMS_PER_PAGE], 'sort' => ['attributes' => ['key' => ['asc' => ['message' => SORT_ASC], 'desc' => ['message' => SORT_DESC]], 'value' => ['asc' => ['value' => SORT_ASC], 'desc' => ['value' => SORT_DESC]], 'clientEmail' => ['asc' => [ClientUsers::tableName() . '.email' => SORT_ASC], 'desc' => [ClientUsers::tableName() . '.email' => SORT_DESC]]]]]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->joinWith(['client' => function (ActiveQuery $query) { $query->andFilterWhere(['like', ClientUsers::tableName() . '.email', $this->clientEmail]); }]); $query->andFilterWhere(['like', 'key', $this->key])->andFilterWhere(['like', 'value', $this->value]); return $dataProvider; }
<?php use app\models\Info; $info = Info::find()->one(); ?> <footer id="footer"> <div class="container"> <div class="column-one-fourth"> <h5 class="line"><span>Contact.</span></h5> <p>Name : <?php echo $info['name']; ?> </p> <p>Email : <?php echo $info['email']; ?> </p> <p>Skype : <?php echo $info['skype']; ?> </p> </div> <div class="column-two-fourth"> <h5 class="line"><span>About.</span></h5> <p>About : <?php echo $info['description']; ?> </p> </div>
public function actionIndex() { $query = Info::find(); $infos = $query->orderBy('title')->all(); return $this->render('index', ['infos' => $infos]); }
<?php use app\models\Info; $fb = Info::find()->one(); ?> <div class="column-one-third"> <div class="sidebar"> <h5 class="line"><span>Facebook.</span></h5> <iframe src="http://www.facebook.com/plugins/likebox.php?href=<?php echo $fb['facebook']; ?> &width=298&height=258&show_faces=true&colorscheme=light&stream=false&border_color=%23BCBCBC&header=false" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:298px; height:258px;" allowTransparency="true"></iframe> </div> </div>
public static function indexFocus() { $data = Info::find()->where(['key' => 'index', 'type' => self::TYPE_FOCUS])->asArray()->all(); }
/** * Lists all Info models. * @return mixed */ public function actionIndex() { $dataProvider = new ActiveDataProvider(['query' => Info::find()]); return $this->render('index', ['dataProvider' => $dataProvider]); }