private function processSingleSubmission($row, $includeTags = false)
 {
     $submission = new Submission();
     $submission->submission_id = $row->id;
     $submission->assignment_id = $row->assignment_id;
     if (isset($row->course)) {
         $submission->course = $row->course;
     }
     if (isset($row->attempt)) {
         $submission->attempt = $row->attempt;
     }
     if (isset($row->body)) {
         $submission->body = $row->body;
     }
     if (isset($row->grade)) {
         $submission->grade = $row->grade;
     }
     if (isset($row->grade_matches_current_submission)) {
         $submission->grade_matches_current_submission = $row->grade_matches_current_submission;
     }
     if (isset($row->html_url)) {
         $submission->html_url = $row->html_url;
     }
     if (isset($row->preview_url)) {
         $submission->preview_url = $row->preview_url;
     }
     if (isset($row->score)) {
         $submission->score = $row->score;
     }
     if (isset($row->submission_comments)) {
         $submission->submission_comments = $row->submission_comments;
     }
     if (isset($row->submission_type)) {
         $submission->submission_type = $row->submission_type;
     }
     if (isset($row->submitted_at)) {
         $submission->submitted_at = $row->submitted_at;
     }
     if (isset($row->url)) {
         $submission->url = $row->url;
     }
     if (isset($row->user_id)) {
         $submission->user_id = $row->user_id;
     }
     if (isset($row->grader_id)) {
         $submission->grader_id = $row->grader_id;
     }
     if (isset($row->late)) {
         $submission->late = $row->late;
     }
     if (isset($row->assignment_visible)) {
         $submission->assignment_visible = $row->assignment_visible;
     }
     if ($includeTags) {
         //returns tags
         $tags = $this->matchAssignmentIdWithTags($submission->assignment_id);
         $arr = $submission->toArray();
         $arr['tags'] = $tags;
         return $arr;
     } else {
         return $submission->toArray();
     }
 }
Beispiel #2
0
 public function matchSubmissionWithTags(Submission $submission)
 {
     $assignment = Assignment::where(array('assignment_id' => $submission->assignment_id));
     if (is_null($assignment)) {
         return null;
     } else {
         $assignment->assignment_id = $submission->assignment_id;
         $assignmentWithTags = $this->matchAssignmentWithTags($assignment);
         $arr = $submission->toArray();
         if (strlen($assignmentWithTags['tags']) > 0) {
             $arr['tags'] = $assignmentWithTags['tags'];
         } else {
             $arr['tags'] = "";
         }
         return $arr;
     }
 }