/**
  * Toggles a binary field from the summary grid
  * @param type $id
  * @param type $attribute
  * @return mixed ajax response
  * @throws ForbiddenHttpException
  */
 public function actionToggle($id, $attribute)
 {
     $accessParams = ['student' => Student::findOne($id)];
     if (Yii::$app->user->can('updateStudent', $accessParams)) {
         $action = new ToggleAction('toggle', $this, ['modelClass' => Student::className()]);
         return $action->run($id, $attribute);
     } else {
         throw new ForbiddenHttpException(Yii::t('app', 'You are not authorized to perform this action.'));
     }
 }
Beispiel #2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getStudents()
 {
     return $this->hasMany(Student::className(), ['school_id' => 'id']);
 }
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getStudent()
 {
     return $this->hasOne(Student::className(), ['id' => 'student_id']);
 }
Beispiel #4
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getStudent()
 {
     return $this->hasOne(Student::className(), ['idUser' => 'idStudent']);
 }
Beispiel #5
0
 public function getStudents()
 {
     return $this->hasMany(Student::className(), ['id' => 'student_id'])->viaTable('teacher_student', ['teacher_id' => 'id']);
 }
Beispiel #6
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getStudents()
 {
     return $this->hasMany(Student::className(), ['id' => 'student_id'])->via('assignedRanks');
 }
Beispiel #7
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getStudents()
 {
     return $this->hasMany(Student::className(), ['weapon_anchor_id' => 'id']);
 }
Beispiel #8
0
 public function getUserStudent()
 {
     return $this->hasOne(Student::className(), ['st_id' => 'usr_type_id']);
 }
 /**
  * @inheritdoc
  */
 public function rules()
 {
     return [[['student_id', 'teacher_id'], 'required'], [['student_id', 'teacher_id'], 'integer'], ['student_id', 'exist', 'targetClass' => Student::className(), 'targetAttribute' => 'id', 'message' => 'Ученик с таким id не найден'], ['teacher_id', 'exist', 'targetClass' => Teacher::className(), 'targetAttribute' => 'id', 'message' => 'Учитель с таким id не найден']];
 }