예제 #1
0
 public function actionView($id)
 {
     $questionSearchModel = new QuestionSearch();
     $questionSearchParams = Yii::$app->request->queryParams + ['QuestionSearch' => ['id_ank' => $id]];
     $questionDataProvider = $questionSearchModel->search($questionSearchParams);
     $questionDataProvider->setPagination(['pagesize' => 10]);
     return $this->render('view', ['model' => $this->findModel($id), 'questionSearchModel' => $questionSearchModel, 'questionDataProvider' => $questionDataProvider]);
 }
 /**
  * Lists all Question models.
  * @return mixed
  */
 public function actionIndex()
 {
     $searchModel = new QuestionSearch();
     if (isset($_GET['pageSize'])) {
         Yii::$app->session->set('pageSize', (int) $_GET['pageSize']);
         unset($_GET['pageSize']);
     }
     $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
     return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]);
 }
예제 #3
0
 public function search($params)
 {
     $query = QuestionSearch::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_q' => $this->id_q, 'id_ank' => $this->id_ank, 'npp' => $this->npp, 'q_type' => $this->q_type, 'answ_min' => $this->answ_min, 'answ_max' => $this->answ_max, 'isRandom' => $this->isRandom, 'bbPresent' => $this->bbPresent, 'ivPresent' => $this->ivPresent, 'openQuestionAnswerMaxLength' => $this->openQuestionAnswerMaxLength]);
     $query->andFilterWhere(['like', 'name_ua', $this->name_ua])->andFilterWhere(['like', 'name_ru', $this->name_ru]);
     return $dataProvider;
 }
 /**
  * Lists all Question models.
  * @return mixed
  */
 public function actionIndex()
 {
     $searchModel = new QuestionSearch();
     $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
     return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]);
 }
예제 #5
0
<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use yii\helpers\ArrayHelper;
use kartik\grid\GridView;
use app\models\search\QuestionSearch;
use app\assets\QuestionAddAsset;
QuestionAddAsset::register($this);
$searchModel = new QuestionSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
/* @var $this yii\web\View */
/* @var $model app\models\Form */
/* @var $form yii\widgets\ActiveForm */
$banks = ['' => 'Bitte wählen Sie'] + ArrayHelper::map(app\models\Bank::find()->orderBy('klasse')->all(), 'klasse', 'bezeichnung');
$groups = ['' => 'Bitte wählen Sie'] + ArrayHelper::map(app\models\Group::find()->orderBy('bezeichnung')->all(), 'p_id', 'bezeichnung');
?>

<div class="form-form">

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

    <?php 
echo $form->field($model, 'f_klasse')->dropDownList($banks);
?>

    <?php 
echo $form->field($model, 'f_p_id')->dropDownList($groups);
?>