Esempio n. 1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = ImageSlider::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id]);
     $query->andFilterWhere(['like', 'name', $this->name]);
     return $dataProvider;
 }
Esempio n. 2
0
 public function init()
 {
     parent::init();
     if ($this->source == 'photo') {
         $this->model = Photo::find()->all();
         $this->path = '/upload/multy-thumbs/';
         //vd($this->model);
     }
     if ($this->source == 'slider') {
         $this->model = ImageSlider::find()->where(['status' => '0'])->all();
         $this->path = '/upload/slider-thumbs/';
     }
 }
Esempio n. 3
0
 public function actionChangeActivety()
 {
     $arrResult = [];
     $id = Yii::$app->request->post('id');
     $state = Yii::$app->request->post('state');
     //vd( $id .': ' .$state );
     if ($state == 'true') {
         $status = 0;
     } else {
         $status = 1;
     }
     if ($id) {
         $model = ImageSlider::find()->where(['id' => $id])->one();
         $model->status = $status;
         $model->updateAttributes(['status']);
     }
     Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
     $arrResult['state'] = $status;
     $arrResult['id'] = $id;
     return $arrResult;
 }
Esempio n. 4
0
<?php

use yii\helpers\Html;
use frontend\assets\AppAsset;
use common\models\ImageSlider;
/* @var $this \yii\web\View */
/* @var $content string */
AppAsset::register($this);
$model = ImageSlider::find()->where(['status' => '0'])->all();
$this->beginPage();
?>
<!DOCTYPE html>
<html lang="<?php 
echo Yii::$app->language;
?>
">
    <head>


        <link rel="icon" href="/favicon.ico" type="image/x-icon" />
        <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />

        <meta charset="<?php 
echo Yii::$app->charset;
?>
"/>
        <meta name="viewport" content="width=device-width, initial-scale=1">
<?php 
echo Html::csrfMetaTags();
?>
        <title><?php