Esempio n. 1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params, $way = null)
 {
     if ($way == null) {
         $query = Exercise::find();
     } else {
         $query = $way;
     }
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $query->joinWith('subject');
     $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, 'teacher_id' => $this->teacher_id]);
     $query->andFilterWhere(['like', 'exercise.text', $this->text])->andFilterWhere(['like', 'exercise.name', $this->name])->andFilterWhere(['like', 'exercise_subject.name', $this->subject_id]);
     return $dataProvider;
 }
Esempio n. 2
0
 /**
  * @get exercises
  */
 public function getExercises()
 {
     return $this->hasMany(Exercise::className(), ['teacher_id' => 'id']);
 }
Esempio n. 3
0
 public function getExercise()
 {
     return $this->hasOne(Exercise::className(), ['id' => 'exercise_id']);
 }
Esempio n. 4
0
 /** 
  * Finds the Exercise model based on its primary key value. 
  * If the model is not found, a 404 HTTP exception will be thrown. 
  * @param integer $id 
  * @return Exercise the loaded model 
  * @throws NotFoundHttpException if the model cannot be found 
  */
 protected function findModel($id)
 {
     if (($model = Exercise::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Esempio n. 5
0
                $.post( "' . Url::to(['//task/exersicespreview', 'list' => '']) . '"+arr, function( data ) {
                  $( "#exersicespreview" ).html( data );
                });
            '], 'pluginOptions' => ['tags' => true]]);
?>
    
    
    <?php 
echo Html::tag('br');
?>
    
    <div class="panel panel-default">
        <div class='panel-heading'>Список упражнений</div>
             <div class='panel-body'  id="exersicespreview" ><?php 
$list = ArrayHelper::getColumn($model->exercises, 'exercise.id');
$exersices = \common\models\Exercise::findAll($list);
echo $this->render('/task/_exersicespreview', ['exersices' => $exersices]);
?>
</div>
    </div>
    
    <?php 
//= $form->field($model, 'student_id')->listBox(TaskType::typeList(),['onchange' => '$.pjax.reload({container: "#form-give-task"});'])
?>
        
    <?php 
//= $form->field($model, 'text')->textarea(['rows' => 6])
?>
        

    <div class="form-group">
Esempio n. 6
0
 public function actionExersicespreview($list)
 {
     $list = GivenTask::listToArray($list);
     $exersices = \common\models\Exercise::findAll($list);
     return $this->renderAjax('_exersicespreview', ['exersices' => $exersices]);
 }