예제 #1
0
 public function saveQuizSubmission($quizSubmission)
 {
     $dbQuizSubmission = QuizSubmission::firstOrNew(array('quiz_submission_id' => $quizSubmission->id, 'user_id' => $quizSubmission->user_id, 'quiz_id' => $quizSubmission->quiz_id));
     $dbQuizSubmission->quiz_submission_id = $quizSubmission->id;
     $dbQuizSubmission->user_id = $quizSubmission->user_id;
     $dbQuizSubmission->quiz_id = $quizSubmission->quiz_id;
     $dbQuizSubmission->submission_id = $quizSubmission->submission_id;
     $dbQuizSubmission->validation_token = $quizSubmission->validation_token;
     if (isset($quizSubmission->quiz_version)) {
         $dbQuizSubmission->quiz_version = $quizSubmission->quiz_version;
     }
     if (isset($quizSubmission->attempt)) {
         $dbQuizSubmission->attempt = $quizSubmission->attempt;
     }
     if (isset($quizSubmission)) {
         $dbQuizSubmission->extra_attempts = $quizSubmission->extra_attempts;
     }
     if (isset($quizSubmission->attempts_left)) {
         $dbQuizSubmission->attempts_left = $quizSubmission->attempts_left;
     }
     if (isset($quizSubmission->time_spent)) {
         $dbQuizSubmission->time_spent = $quizSubmission->time_spent;
     }
     if (isset($quizSubmission->extra_time)) {
         $dbQuizSubmission->extra_time = $quizSubmission->extra_time;
     }
     if (isset($quizSubmission->started_at)) {
         $dbQuizSubmission->started_at = $quizSubmission->started_at;
     }
     if (isset($quizSubmission->finished_at)) {
         $dbQuizSubmission->finished_at = $quizSubmission->finished_at;
     }
     if (isset($quizSubmission->end_at)) {
         $dbQuizSubmission->end_at = $quizSubmission->end_at;
     }
     if (isset($quizSubmission->workflow_state)) {
         $dbQuizSubmission->workflow_state = $quizSubmission->workflow_state;
     }
     if (isset($quizSubmission->has_seen_results)) {
         $dbQuizSubmission->has_seen_results = $quizSubmission->has_seen_results;
     }
     if (isset($quizSubmission->manually_unlocked)) {
         $dbQuizSubmission->manually_unlocked = $quizSubmission->manually_unlocked;
     }
     if (isset($quizSubmission->overdue_and_needs_submission)) {
         $dbQuizSubmission->overdue_and_needs_submission = $quizSubmission->overdue_and_needs_submission;
     }
     if (isset($quizSubmission->score)) {
         $dbQuizSubmission->score = $quizSubmission->score;
     }
     if (isset($quizSubmission->score_before_regrade)) {
         $dbQuizSubmission->score_before_regrade = $quizSubmission->score_before_regrade;
     }
     if (isset($quizSubmission->quiz_points_possible)) {
         $dbQuizSubmission->quiz_points_possible = $quizSubmission->quiz_points_possible;
     }
     if (isset($quizSubmission->kept_score)) {
         $dbQuizSubmission->kept_score = $quizSubmission->kept_score;
     }
     if (isset($quizSubmission->fudge_points)) {
         $dbQuizSubmission->fudge_points = $quizSubmission->fudge_points;
     }
     if (isset($quizSubmission->html_url)) {
         $dbQuizSubmission->html_url = $quizSubmission->html_url;
     }
     $dbQuizSubmission->save();
     return $dbQuizSubmission;
 }
예제 #2
0
 public function getQuizSubmission($quiz_id, $user_id)
 {
     $quizSubmission = QuizSubmission::where(array('user_id' => $user_id, 'quiz_id' => $quiz_id))->first();
     return $quizSubmission;
 }