Beispiel #1
0
 /**
  * Finds the Logo model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Logo the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Slider::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Beispiel #2
0
 public function search($params)
 {
     $query = Slider::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id]);
     $query->andFilterWhere(['like', 'image', $this->image]);
     return $dataProvider;
 }
 public function actionIndex()
 {
     //页面左侧分类
     $bigCate = Category::find()->where(['is_nav' => \common\models\YesNo::YES])->orderBy(['sort_order' => SORT_ASC])->all();
     //首页轮播图
     $slider = Slider::find()->where(['place' => 0])->orderBy(['ord' => SORT_ASC])->all();
     //师生风采
     $teachers = \common\models\Album::find()->orderBy(['id' => SORT_DESC])->limit(5)->all();
     //友情链接
     $friendLink = \common\models\Friendlink::find()->where(['isshow' => \common\models\YesNo::YES])->orderBy(['ord' => SORT_ASC])->all();
     return $this->render('index', ['bigCate' => $bigCate, 'slider' => $slider, 'teachers' => $teachers, 'friendlink' => $friendLink]);
 }
Beispiel #4
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Slider::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, 'created_date' => $this->created_date, 'updated_date' => $this->updated_date]);
     $query->andFilterWhere(['like', 'image', $this->image])->andFilterWhere(['like', 'title_en', $this->title_en])->andFilterWhere(['like', 'title_ru', $this->title_ru])->andFilterWhere(['like', 'title_am', $this->title_am])->andFilterWhere(['like', 'description_en', $this->description_en])->andFilterWhere(['like', 'description_ru', $this->description_ru])->andFilterWhere(['like', 'description_am', $this->description_am])->andFilterWhere(['like', 'active', $this->active]);
     return $dataProvider;
 }
Beispiel #5
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Slider::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $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->andFilterWhere(['id' => $this->id, 'place' => $this->place, 'ord' => $this->ord, 'updated_at' => $this->updated_at, 'created_at' => $this->created_at]);
     $query->andFilterWhere(['like', 'thumb', $this->thumb])->andFilterWhere(['like', 'intro', $this->intro])->andFilterWhere(['like', 'url', $this->url]);
     return $dataProvider;
 }
Beispiel #6
0
 public function actionIndex()
 {
     $session = Yii::$app->session;
     $session->remove('category');
     $this->is_home_page = true;
     $this->slider = Slider::find()->select('photo, name,link')->all();
     $search_params = Yii::$app->request->get('SEARCH');
     if (!empty($search_params)) {
         $searchModel = new ProductSearch();
         $search_params = strip_tags($search_params);
         $products = $searchModel->search($search_params);
     } else {
         $products = Product::find()->select('id, image, name, original_url, price')->indexBy('id')->orderBy('created_ts DESC')->limit(40)->all();
     }
     return $this->render('index', ['products' => $products, 'search' => false, 'slider' => $this->slider]);
 }
 public function actionIndex()
 {
     //轮播图
     $slider = Slider::find()->where(['place' => 0])->orderBy(['ord' => SORT_ASC])->all();
     //微课
     $weike = \common\models\Video::find()->where(['and', ['status' => \common\models\Status::STATUS_REC]])->limit(6)->all();
     //教案
     $jiaoan = \common\models\Resource::find()->where(['and', ['type' => 0], ['status' => \common\models\Status::STATUS_REC]])->limit(3)->all();
     //课件
     $kejian = \common\models\Resource::find()->where(['and', ['type' => 1], ['status' => \common\models\Status::STATUS_REC]])->limit(3)->all();
     //试题
     $shiti = \common\models\Resource::find()->where(['and', ['type' => 2], ['status' => \common\models\Status::STATUS_REC]])->limit(3)->all();
     //新闻公告
     $news = \common\models\News::find()->where(['and', 'status>' . \common\models\Status::STATUS_INACTIVE])->orderBy(['id' => SORT_DESC])->limit(3)->all();
     //推荐下载
     $recdown = \common\models\Resource::find()->where(['and', ['status' => \common\models\Status::STATUS_REC]])->orderBy(['id' => SORT_DESC])->limit(4)->all();
     //最新评价
     $pinglun = \common\models\Pinglun::find()->where(['and', 'status>' . \common\models\Status::STATUS_INACTIVE])->orderBy(['id' => SORT_DESC])->limit(6)->all();
     //学霸必备
     $xueba = \common\models\Resource::find()->where(['and', 'status>' . \common\models\Status::STATUS_REC])->orderBy(['rand()' => SORT_DESC])->limit(10)->all();
     //友情链接
     $friendLink = \common\models\Friendlink::find()->where(['isshow' => \common\models\YesNo::YES])->orderBy(['ord' => SORT_ASC])->all();
     return $this->render('index', ['slider' => $slider, 'weike' => $weike, 'jiaoan' => $jiaoan, 'kejian' => $kejian, 'shiti' => $shiti, 'news' => $news, 'recdown' => $recdown, 'pinglun' => $pinglun, 'xueba' => $xueba, 'friendlink' => $friendLink]);
 }
 public function actionIndex()
 {
     //首页轮播图
     $slider = \common\models\Slider::find()->where(['place' => 1])->orderBy(['ord' => SORT_ASC])->all();
     return $this->render('index', ['slider' => $slider]);
 }
Beispiel #9
0
 public function run()
 {
     $slides = Slider::find()->where(['active' => '1'])->all();
     //var_dump($slides); exit;
     return $this->render('sliderView', ['slides' => $slides]);
 }
Beispiel #10
0
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use common\models\Slider;
/* @var $this yii\web\View */
/* @var $model common\models\Slider */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="slider-form">

    <?php 
$form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]);
?>

    <?php 
echo $form->field($model, 'place')->dropDownList(Slider::places());
?>

    <?php 
echo $form->field($model, 'imageFile')->fileInput();
?>
    <?php 
//= $form->field($model, 'thumb')->hiddenInput()
?>

    <?php 
echo $form->field($model, 'intro')->textarea(['rows' => 2]);
?>

    <?php 
echo $form->field($model, 'url')->textInput(['maxlength' => 100]);
Beispiel #11
0
 public function actionIndex()
 {
     $slides = Slider::find()->all();
     $featured = \common\models\Post::featured(12);
     return $this->render('index', ['slides' => $slides, 'featured' => $featured]);
 }