Esempio n. 1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Autocat::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]);
     $query->andFilterWhere(['like', 'name_ru', $this->name_ru])->andFilterWhere(['like', 'name_en', $this->name_en])->andFilterWhere(['like', 'name_az', $this->name_az])->andFilterWhere(['like', 'maxpas', $this->maxpas])->andFilterWhere(['like', 'photo', $this->photo]);
     return $dataProvider;
 }
Esempio n. 2
0
File: Auto.php Progetto: t4le/365
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getIdcat0()
 {
     return $this->hasOne(Autocat::className(), ['id' => 'idcat']);
 }
Esempio n. 3
0
 public function actionAccardion()
 {
     $auto = Autocat::find()->joinWith('autos')->orderBy(['autocat.id' => SORT_ASC])->asArray()->all();
     return $this->renderPartial('accardion', ['auto' => $auto]);
 }
Esempio n. 4
0
 /**
  * Finds the Autocat model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Autocat the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Autocat::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Esempio n. 5
0
File: _form.php Progetto: t4le/365
use yii\widgets\ActiveForm;
use common\models\Autocat;
use yii\helpers\ArrayHelper;
/* @var $this yii\web\View */
/* @var $model common\models\Auto */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="auto-form">

    <?php 
$form = ActiveForm::begin();
?>

    <?php 
echo $form->field($model, 'idcat')->dropDownList(ArrayHelper::map(Autocat::find()->all(), 'id', 'name_az'), ['prompt' => ''])->label(false);
?>

    <?php 
echo $form->field($model, 'name')->textInput(['maxlength' => true]);
?>

    <?php 
echo $form->field($model, 'photo')->textInput(['maxlength' => true]);
?>

    <?php 
echo $form->field($model, 'carnumber')->textInput(['maxlength' => true]);
?>

    <div class="form-group">