add_system_message(_("At least one of the parameters is empty."), 'error'); forward("course/assignments/{$course_id}/answer/{$answer_id}/view"); } else if (empty($answer_id)) { $Dippler->add_system_message(_("Answer not found."), 'error'); forward("course/assignments/{$course_id}"); } else if (empty($course_id)) { $Dippler->add_system_message(_("Course not found."), 'error'); forward('courses/my'); } else { $answer = new Answer($answer_id); $answer->load(); $course = new Course($course_id); $course->load(); if ($answer && $course) { if ($course->canEdit()) { $answer->feedback = $answer_feedback; $answer->grade = $answer_points; if (!$answer->save_grade()) { $Dippler->add_system_message(_("Answer could not be graded.."), 'error'); forward("course/assignments/{$course_id}/answer/{$answer_id}/view"); } } else { $Dippler->add_system_message(_("No rights to facilitate course."), 'error'); forward("course/assignments/{$course_id}/answer/{answer_id}/view"); } } else { $Dippler->add_system_message(_("Answer could not be graded."), 'error'); } $Dippler->add_system_message(_("Answer graded.")); // Clear cache $Dippler->clearSessionInputValues(); forward("course/assignments/{$course_id}/assignment/{$answer->assignment}/submissions"); } forward('courses/my'); ?>