/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Paper::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', $this->name])->andFilterWhere(['like', 'name_eng', $this->name_eng]);
     return $dataProvider;
 }
echo Html::submitButton('Գեներացնել (Generate)', ['class' => 'btn btn-primary']);
?>


<?php 
ActiveForm::end();
?>

<div class="site-index" style="width: 3500px;">

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\ActionColumn', 'template' => '{update}{delete}', 'urlCreator' => function ($action, $model, $key, $index) {
    if ($action === 'update') {
        $arrayParams = ['MainSearch' => ['region' => $model->region]];
        $arrayParams['id'] = $model->id;
        $params = array_merge(["site/main"], $arrayParams);
        $url = Yii::$app->urlManager->createUrl($params);
        return $url;
    }
    if ($action === 'delete') {
        $arrayParams = ['MainSearch' => ['region' => $model->region], 'id' => $model->id];
        $params = array_merge(["site/delete"], $arrayParams);
        $url = Yii::$app->urlManager->createUrl($params);
        return $url;
    }
}], ['class' => 'yii\\grid\\SerialColumn'], ['attribute' => 'city', 'value' => 'city0.nameBothShort', 'filter' => Html::activeDropDownList($searchModel, 'city', ArrayHelper::map(City::find()->all(), 'id', 'nameBothShort'), ['class' => 'form-control', 'prompt' => 'Select Category'])], ['attribute' => 'type', 'value' => 'type0.nameBothShort', 'filter' => Html::activeDropDownList($searchModel, 'type', ArrayHelper::map(Type::find()->all(), 'id', 'nameBothShort'), ['class' => 'form-control', 'prompt' => 'Select Category'])], 'resident', 'children', 'employee', 'retiree', ['attribute' => 'dominant', 'value' => 'dominant0.nameBothShort', 'filter' => Html::activeDropDownList($searchModel, 'retiree', ArrayHelper::map(Dominant::find()->all(), 'id', 'nameBothShort'), ['class' => 'form-control', 'prompt' => 'Select Category'])], ['attribute' => 'mainTrashPlaces.trash_place_id', 'value' => 'trashPlaceMulti', 'filter' => Html::activeDropDownList($searchModel, 'mainTrashPlaces.trash_place_id', ArrayHelper::map(TrashPlace::find()->all(), 'id', 'nameBothShort'), ['class' => 'form-control', 'prompt' => 'Select Category']), 'contentOptions' => ['style' => 'width: ' . $width . ';']], ['attribute' => 'mainTrashMen.trash_man_id', 'value' => 'trashManMulti', 'filter' => Html::activeDropDownList($searchModel, 'mainTrashMen.trash_man_id', ArrayHelper::map(TrashMan::find()->all(), 'id', 'nameBothShort'), ['class' => 'form-control', 'prompt' => 'Select Category']), 'contentOptions' => ['style' => 'width: ' . $width . ';']], ['attribute' => 'filter_trash_out', 'value' => 'trash_out', 'filter' => Html::activeDropDownList($searchModel, 'filter_trash_out', array('1' => '1-5', '2' => '6-10', '3' => '11-20', '4' => '20+'), ['class' => 'form-control', 'prompt' => 'Select Category'])], ['attribute' => 'filter_trash_count', 'value' => 'trash_count', 'filter' => Html::activeDropDownList($searchModel, 'filter_trash_count', array('1' => '1-5', '2' => '6-10', '3' => '11-20', '4' => '20+'), ['class' => 'form-control', 'prompt' => 'Select Category'])], ['attribute' => 'filter_summer_1', 'value' => 'summer_count_1', 'filter' => Html::activeDropDownList($searchModel, 'filter_summer_1', array('1' => '1-5', '2' => '6-10', '3' => '11-20', '4' => '20+'), ['class' => 'form-control', 'prompt' => 'Select Category'])], ['attribute' => 'filter_summer_2', 'value' => 'summer_count_2', 'filter' => Html::activeDropDownList($searchModel, 'filter_summer_2', array('1' => '1-5', '2' => '6-10', '3' => '11-20', '4' => '20+'), ['class' => 'form-control', 'prompt' => 'Select Category'])], ['attribute' => 'filter_summer_3', 'value' => 'summer_count_3', 'filter' => Html::activeDropDownList($searchModel, 'filter_summer_3', array('1' => '1-5', '2' => '6-10', '3' => '11-20', '4' => '20+'), ['class' => 'form-control', 'prompt' => 'Select Category'])], ['attribute' => 'filter_summer_4', 'value' => 'summer_count_4', 'filter' => Html::activeDropDownList($searchModel, 'filter_summer_4', array('1' => '1-5', '2' => '6-10', '3' => '11-20', '4' => '20+'), ['class' => 'form-control', 'prompt' => 'Select Category'])], ['attribute' => 'filter_winter_1', 'value' => 'winter_count_1', 'filter' => Html::activeDropDownList($searchModel, 'filter_winter_1', array('1' => '1-5', '2' => '6-10', '3' => '11-20', '4' => '20+'), ['class' => 'form-control', 'prompt' => 'Select Category'])], ['attribute' => 'filter_winter_2', 'value' => 'winter_count_2', 'filter' => Html::activeDropDownList($searchModel, 'filter_winter_2', array('1' => '1-5', '2' => '6-10', '3' => '11-20', '4' => '20+'), ['class' => 'form-control', 'prompt' => 'Select Category'])], ['attribute' => 'filter_winter_3', 'value' => 'winter_count_3', 'filter' => Html::activeDropDownList($searchModel, 'filter_winter_3', array('1' => '1-5', '2' => '6-10', '3' => '11-20', '4' => '20+'), ['class' => 'form-control', 'prompt' => 'Select Category'])], ['attribute' => 'filter_winter_4', 'value' => 'winter_count_4', 'filter' => Html::activeDropDownList($searchModel, 'filter_winter_4', array('1' => '1-5', '2' => '6-10', '3' => '11-20', '4' => '20+'), ['class' => 'form-control', 'prompt' => 'Select Category'])], ['attribute' => 'paper', 'value' => 'paper0.nameBothShort', 'filter' => Html::activeDropDownList($searchModel, 'paper', ArrayHelper::map(Paper::find()->all(), 'id', 'nameBothShort'), ['class' => 'form-control', 'prompt' => 'Select Category']), 'contentOptions' => ['style' => 'width: ' . $width . ';']], ['attribute' => 'mainTrashRelations.trash_relation_id', 'value' => 'trashRelationMulti', 'filter' => Html::activeDropDownList($searchModel, 'mainTrashRelations.trash_relation_id', ArrayHelper::map(TrashRelation::find()->all(), 'id', 'nameBothShort'), ['class' => 'form-control', 'prompt' => 'Select Category']), 'contentOptions' => ['style' => 'width: ' . $width . ';']], ['attribute' => 'mainTrashRecycles.trash_recycle_id', 'value' => 'trashRecycleMulti', 'filter' => Html::activeDropDownList($searchModel, 'mainTrashRecycles.trash_recycle_id', ArrayHelper::map(TrashRecycle::find()->all(), 'id', 'nameBothShort'), ['class' => 'form-control', 'prompt' => 'Select Category'])], ['attribute' => 'mainRubberItems.rubber_item_id', 'value' => 'rubberItemsMulti', 'filter' => Html::activeDropDownList($searchModel, 'mainRubberItems.rubber_item_id', ArrayHelper::map(RubberItems::find()->all(), 'id', 'nameBoth'), ['class' => 'form-control', 'prompt' => 'Select Category'])], 'answer_count', 'woman_count', ['attribute' => 'person', 'value' => 'person0.nameBothShort', 'filter' => Html::activeDropDownList($searchModel, 'person', ArrayHelper::map(Person::find()->all(), 'id', 'nameBothShort'), ['class' => 'form-control', 'prompt' => 'Select Category'])], 'date', 'interrogatory']]);
?>


</div>
 /**
  * Finds the Paper model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Paper the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Paper::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Example #4
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getPapers()
 {
     return $this->hasMany(Paper::className(), ['Topic_id' => 'id']);
 }
echo $form->field($model, 'summer_count_3', ['options' => ['class' => 'form-inline col-sm-7']])->textInput(['class' => 'col-sm-4 form-control'])->label(LanguageHelper::getSummerWinterNames(3, 'summer'), ['class' => 'col-sm-8']);
?>
        <?php 
echo $form->field($model, 'winter_count_3', ['options' => ['class' => 'form-inline col-sm-3']])->textInput(['class' => 'form-control'])->label(false);
?>

        <?php 
echo $form->field($model, 'summer_count_4', ['options' => ['class' => 'form-inline col-sm-7']])->textInput(['class' => 'col-sm-4 form-control'])->label(LanguageHelper::getSummerWinterNames(4, 'summer'), ['class' => 'col-sm-8']);
?>
        <?php 
echo $form->field($model, 'winter_count_4', ['options' => ['class' => 'form-inline col-sm-3']])->textInput(['class' => 'form-control'])->label(false);
?>
    </div>

    <?php 
echo $form->field($model, 'paper', ['options' => ['class' => 'form-inline col-sm-10']])->radioList(ArrayHelper::map(Paper::find()->all(), 'id', 'nameBoth'), ['class' => 'radio col-sm-6', 'separator' => '<span style="padding-left: 30px;"></span>'])->label(null, ['class' => 'col-sm-4']);
?>

    <div class="clearfix"></div>
    <hr>
    <?php 
echo $form->field($model, 'relations', ['options' => ['class' => 'form-inline col-sm-12']])->checkboxList(ArrayHelper::map(TrashRelation::find()->all(), 'id', 'nameBoth'), ['class' => 'radio col-sm-8', 'separator' => '<br>'])->label(null, ['class' => 'col-sm-4']);
?>

    <div class="clearfix"></div>
    <hr>
    <?php 
echo $form->field($model, 'recycles', ['options' => ['class' => 'form-inline col-sm-12']])->checkboxList(TrashRecycle::getOrderedList(), ['class' => 'radio col-sm-12', 'separator' => ''])->label(null, ['class' => 'col-sm-12']);
?>

    <div class="clearfix"></div>
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getPaper0()
 {
     return $this->hasOne(Paper::className(), ['id' => 'paper']);
 }