示例#1
0
文件: Quiz.php 项目: Akelcehg/psycho
 public function getQuizResult($answersSum)
 {
     return QuizResults::find()->where("'" . $answersSum . "' BETWEEN value_from AND value_to AND quiz_id=" . $this->id)->one()['text'];
 }
示例#2
0
 /**
  * Deletes an existing Quiz model.
  * If deletion is successful, the browser will be redirected to the 'index' page.
  * @param integer $id
  * @return mixed
  */
 public function actionDelete($id)
 {
     $this->findModel($id)->delete();
     QuizResults::deleteAll(['quiz_id' => $id]);
     QuizQuestions::deleteAll(['quiz_id' => $id]);
     return $this->redirect(['index']);
 }