Exemplo n.º 1
0
 public function getBlocks($page)
 {
     $sort = explode(',', $page->sort);
     $html = '';
     foreach ($sort as $p) {
         if ($p[0] == 'i') {
             $blockId = explode('_', $p);
             $blockId = $blockId[1];
             $block = Block::find()->where(['id' => $blockId])->one();
             $html .= $block->code;
         }
         if ($p == 'sub') {
         }
         if ($p == 'des') {
             /*$html .= "<div class='description'>$page->description</div>";*/
         }
         if ($p[0] == 'y') {
             $blockId = explode('_', $p);
             $blockId = $blockId[1];
             $block = Block::find()->where(['id' => $blockId])->one();
             $html .= $block->code;
         }
     }
     return eval('?>' . $html . '<?php;');
 }
Exemplo n.º 2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Block::find()->where(['type' => '']);
     $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]);
     $query->andFilterWhere(['like', 'key', $this->key])->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'code', $this->code])->andFilterWhere(['like', 'style', $this->style])->andFilterWhere(['like', 'img', $this->img]);
     return $dataProvider;
 }
Exemplo n.º 3
0
 public function actionSave_block_form()
 {
     $blockId = $_POST['blockId'];
     $blockStyle = $_POST['blockStyle'];
     $blockCode = $_POST['blockCode'];
     $modelBlock = Block::find()->where(['id' => $blockId])->one();
     $modelBlock->code = $blockCode;
     $modelBlock->style = $blockStyle;
     $modelBlock->save();
 }