/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = TrashRecycle::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_short', $this->name_short])->andFilterWhere(['like', 'name_eng', $this->name_eng])->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'name_short_eng', $this->name_short_eng]);
     return $dataProvider;
 }
 /**
  * Finds the TrashRecycle model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return TrashRecycle the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = TrashRecycle::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Exemplo n.º 3
0
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>
 public function actionTables()
 {
     $params = Yii::$app->request->queryParams;
     $region = 1;
     if (!empty($params['MainSearch']['region'])) {
         $region = $params['MainSearch']['region'];
     }
     if (empty($params['excel'])) {
         $params['excel'] = false;
     }
     $data = Main::getMainData($region);
     if ($region == -1) {
         $regionWhere = [];
     } else {
         $regionWhere = ['region' => $region];
     }
     $cityIds = ArrayHelper::map($data, 'city', 'city');
     $regionWhere['id'] = array_values($cityIds);
     $cities = ArrayHelper::map(City::find()->where($regionWhere)->orderBy('id')->all(), 'id', 'nameBoth');
     $types = ArrayHelper::map(Type::find()->orderBy('id')->all(), 'id', 'nameBoth');
     $trashPlaceArm = ArrayHelper::map(TrashPlace::find()->orderBy('id')->all(), 'id', 'name');
     $trashPlaceEng = ArrayHelper::map(TrashPlace::find()->orderBy('id')->all(), 'id', 'name_eng');
     $trashManArm = ArrayHelper::map(TrashMan::find()->orderBy('id')->all(), 'id', 'name');
     $trashManEng = ArrayHelper::map(TrashMan::find()->orderBy('id')->all(), 'id', 'name_eng');
     $trashRelationArm = ArrayHelper::map(TrashRelation::find()->orderBy('id')->all(), 'id', 'name');
     $trashRelationEng = ArrayHelper::map(TrashRelation::find()->orderBy('id')->all(), 'id', 'name_eng');
     $trashRecycleArm = ArrayHelper::map(TrashRecycle::find()->orderBy('id')->all(), 'id', 'name');
     $trashRecycleEng = ArrayHelper::map(TrashRecycle::find()->orderBy('id')->all(), 'id', 'name_eng');
     $trashCountSummerArm = ArrayHelper::map(TrashCountSummer::find()->orderBy('id')->all(), 'id', 'name');
     $trashCountSummerEng = ArrayHelper::map(TrashCountSummer::find()->orderBy('id')->all(), 'id', 'name_eng');
     $trashCountWinterArm = ArrayHelper::map(TrashCountWinter::find()->orderBy('id')->all(), 'id', 'name');
     $trashCountWinterEng = ArrayHelper::map(TrashCountWinter::find()->orderBy('id')->all(), 'id', 'name_eng');
     return $this->render('tables', ['data' => $data, 'region' => $region, 'cities' => $cities, 'types' => $types, 'trashPlaceArm' => $trashPlaceArm, 'trashPlaceEng' => $trashPlaceEng, 'trashManArm' => $trashManArm, 'trashManEng' => $trashManEng, 'trashRelationArm' => $trashRelationArm, 'trashRelationEng' => $trashRelationEng, 'trashRecycleArm' => $trashRecycleArm, 'trashRecycleEng' => $trashRecycleEng, 'trashCountSummerArm' => $trashCountSummerArm, 'trashCountSummerEng' => $trashCountSummerEng, 'trashCountWinterArm' => $trashCountWinterArm, 'trashCountWinterEng' => $trashCountWinterEng, 'excel' => $params['excel']]);
 }
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getTrashRecycle()
 {
     return $this->hasOne(TrashRecycle::className(), ['id' => 'trash_recycle_id']);
 }
Exemplo n.º 6
0
    </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>

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

    <div class="clearfix"></div>
    <hr>
    </div>

    <?php 
Exemplo n.º 7
0
 public function getTrashRecycles()
 {
     return $this->hasMany(TrashRecycle::className(), ['id' => 'trash_recycle_id'])->viaTable('main_trash_recycle', ['main_id' => 'id']);
 }