/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Line::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, 'type_id' => $this->type_id]); $query->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'status', $this->status])->andFilterWhere(['like', 'picture', $this->picture])->andFilterWhere(['like', 'title', $this->title]); return $dataProvider; }
use yii\widgets\ActiveForm; use app\models\Line; use yii\helpers\ArrayHelper; /* @var $this yii\web\View */ /* @var $model app\models\Product */ /* @var $form yii\widgets\ActiveForm */ ?> <div class="product-form"> <?php $form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'line_id')->DropDownList(ArrayHelper::map(Line::find()->all(), 'id', 'title')); ?> <?php echo $form->field($model, 'title')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'description')->textarea(['rows' => 6]); ?> <?php echo $form->field($model, 'price')->textInput(['maxlength' => true]); ?> <?php
<?php use yii\helpers\Html; use yii\bootstrap\Nav; use yii\bootstrap\NavBar; use yii\widgets\Breadcrumbs; use app\assets\AppAsset; use yii\web\View; use yii\helpers\Url; use app\models\Line; use app\models\City; /* @var $this \yii\web\View */ /* @var $content string */ $lines = Line::find()->where(['status' => 'ACTIVE'])->all(); $cities = City::find()->all(); $script = '$(document).ready(function() { $("#menu-chaide").click(function(){ $(this).toggleClass("active"); $("#menu-mobile").toggleClass("menu-active"); $("#general").toggleClass("general-active"); }); }); (function(){ var widget_id = "QcMOZSFvGS"; var s = document.createElement("script"); s.type = "text/javascript"; s.async = true; s.src = "//code.jivosite.com/script/widget/"+widget_id; var ss = document.getElementsByTagName("script")[0]; ss.parentNode.insertBefore(s, ss);})(); '; $this->registerJs($script, View::POS_END); AppAsset::register($this); $this->beginPage(); ?> <!DOCTYPE html> <html lang="<?php echo Yii::$app->language;