Example #1
0
 public function getQuizQuestion($quizId, $quizQuestionId)
 {
     return Quizquestion::where(array('quiz_id' => $quizId, 'question_id' => $quizQuestionId))->first();
 }
 public function processSingleQuizQuestion($quizQuestion)
 {
     $question = Quizquestion::firstOrNew(array('question_id' => $quizQuestion->id));
     $question->question_id = $quizQuestion->id;
     $question->quiz_id = $quizQuestion->quiz_id;
     if (isset($quizQuestion->position)) {
         $question->position = $quizQuestion->position;
     }
     if (isset($quizQuestion->points_possible)) {
         $question->points_possible = $quizQuestion->points_possible;
     }
     if (isset($quizQuestion->question_name)) {
         $question->name = $quizQuestion->question_name;
     }
     if (isset($quizQuestion->question_type)) {
         $question->type = $quizQuestion->question_type;
     }
     if (isset($quizQuestion->question_text)) {
         $question->text = htmlspecialchars($quizQuestion->question_text);
     }
     if (isset($quizQuestion->correct_comments)) {
         $question->correct_comments = $quizQuestion->correct_comments;
     }
     if (isset($quizQuestion->incorrect_comments)) {
         $question->incorrect_comments = $quizQuestion->incorrect_comments;
     }
     if (isset($quizQuestion->neutral_comments)) {
         $question->neutral_comments = $quizQuestion->neutral_comments;
     }
     if (isset($quizQuestion->answers)) {
         $question->answers = json_encode($quizQuestion->answers);
     }
     $question->save();
     return $question;
 }
Example #3
0
 public function getQuizQuestion($quizId, $quizQuestionId = null)
 {
     if (is_null($quizQuestionId)) {
         return Quizquestion::where(array('quiz_id' => $quizId))->get();
     } else {
         return Quizquestion::where(array('quiz_id' => $quizId, 'question_id' => $quizQuestionId))->first();
     }
 }