Example #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = UserScore::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, 'user_id' => $this->user_id, 'exam_id' => $this->exam_id, 'score' => $this->score, 'finished_time' => $this->finished_time]);
     return $dataProvider;
 }
Example #2
0
 /**
  * Lists all UserScore models.
  * @return mixed
  */
 public function actionIndex()
 {
     $dataProvider = new ActiveDataProvider(['query' => UserScore::find()->where(['user_id' => Yii::$app->user->identity->id])]);
     return $this->render('index', ['dataProvider' => $dataProvider]);
 }
Example #3
0
use yii\widgets\ActiveForm;
use yii\widgets\ListView;
use yii\data\ActiveDataProvider;
use app\models\Question;
use app\models\Subject;
use app\models\UserScore;
use app\models\HardQuestion;
/* @var $this yii\web\View */
/* @var $model app\models\SubjectTest */
$this->title = 'Тест № ' . $model->id;
$this->params['breadcrumbs'][] = ['label' => 'Тест по предметам', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
$count = 1;
$isFirst = true;
$subjects = Subject::find()->where(['type' => 1, 'section' => $model->section])->all();
$user_score = UserScore::find()->where(['user_id' => Yii::$app->user->identity->id, 'test_id' => $model->id, 'test_type' => 1])->one();
?>
<div class="subject-test-view">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>

    <?php 
if (Yii::$app->session->hasFlash('TestChecked')) {
    ?>

        <div class="alert alert-success">
            Ваш результат: <?php 
    if ($user_score->score) {