/** * View the grading table of all submissions for this assignment * * @return string */ private function view_grading_table() { global $USER, $CFG; // Include grading options form require_once($CFG->dirroot . '/mod/assign/gradingoptionsform.php'); require_once($CFG->dirroot . '/mod/assign/quickgradingform.php'); require_once($CFG->dirroot . '/mod/assign/gradingbatchoperationsform.php'); $o = ''; $links = array(); if (has_capability('gradereport/grader:view', $this->get_course_context()) && has_capability('moodle/grade:viewall', $this->get_course_context())) { $gradebookurl = '/grade/report/grader/index.php?id=' . $this->get_course()->id; $links[$gradebookurl] = get_string('viewgradebook', 'assign'); } if ($this->is_any_submission_plugin_enabled()) { $downloadurl = '/mod/assign/view.php?id=' . $this->get_course_module()->id . '&action=downloadall'; $links[$downloadurl] = get_string('downloadall', 'assign'); } if ($this->is_blind_marking() && has_capability('mod/assign:revealidentities', $this->get_context())) { $revealidentitiesurl = '/mod/assign/view.php?id=' . $this->get_course_module()->id . '&action=revealidentities'; $links[$revealidentitiesurl] = get_string('revealidentities', 'assign'); } foreach ($this->get_feedback_plugins() as $plugin) { if ($plugin->is_enabled() && $plugin->is_visible()) { foreach ($plugin->get_grading_actions() as $action => $description) { $url = '/mod/assign/view.php' . '?id=' . $this->get_course_module()->id . '&plugin=' . $plugin->get_type() . '&pluginsubtype=assignfeedback' . '&action=viewpluginpage&pluginaction=' . $action; $links[$url] = $description; } } } $gradingactions = new url_select($links); $gradingmanager = get_grading_manager($this->get_context(), 'mod_assign', 'submissions'); $perpage = get_user_preferences('assign_perpage', 10); $filter = get_user_preferences('assign_filter', ''); $controller = $gradingmanager->get_active_controller(); $showquickgrading = empty($controller); if (optional_param('action', '', PARAM_ALPHA) == 'saveoptions') { $quickgrading = optional_param('quickgrading', false, PARAM_BOOL); set_user_preference('assign_quickgrading', $quickgrading); } $quickgrading = get_user_preferences('assign_quickgrading', false); // print options for changing the filter and changing the number of results per page $gradingoptionsform = new mod_assign_grading_options_form(null, array('cm'=>$this->get_course_module()->id, 'contextid'=>$this->context->id, 'userid'=>$USER->id, 'submissionsenabled'=>$this->is_any_submission_plugin_enabled(), 'showquickgrading'=>$showquickgrading, 'quickgrading'=>$quickgrading), 'post', '', array('class'=>'gradingoptionsform')); $gradingbatchoperationsform = new mod_assign_grading_batch_operations_form(null, array('cm'=>$this->get_course_module()->id, 'submissiondrafts'=>$this->get_instance()->submissiondrafts, 'duedate'=>$this->get_instance()->duedate, 'feedbackplugins'=>$this->get_feedback_plugins()), 'post', '', array('class'=>'gradingbatchoperationsform')); $gradingoptionsdata = new stdClass(); $gradingoptionsdata->perpage = $perpage; $gradingoptionsdata->filter = $filter; $gradingoptionsform->set_data($gradingoptionsdata); $actionformtext = $this->output->render($gradingactions); $o .= $this->output->render(new assign_header($this->get_instance(), $this->get_context(), false, $this->get_course_module()->id, get_string('grading', 'assign'), $actionformtext)); $o .= groups_print_activity_menu($this->get_course_module(), $CFG->wwwroot . '/mod/assign/view.php?id=' . $this->get_course_module()->id.'&action=grading', true); // plagiarism update status apearring in the grading book if (!empty($CFG->enableplagiarism)) { /** Include plagiarismlib.php */ require_once($CFG->libdir . '/plagiarismlib.php'); $o .= plagiarism_update_status($this->get_course(), $this->get_course_module()); } // load and print the table of submissions if ($showquickgrading && $quickgrading) { $table = $this->output->render(new assign_grading_table($this, $perpage, $filter, 0, true)); $quickgradingform = new mod_assign_quick_grading_form(null, array('cm'=>$this->get_course_module()->id, 'gradingtable'=>$table)); $o .= $this->output->render(new assign_form('quickgradingform', $quickgradingform)); } else { $o .= $this->output->render(new assign_grading_table($this, $perpage, $filter, 0, false)); } $currentgroup = groups_get_activity_group($this->get_course_module(), true); $users = array_keys($this->list_participants($currentgroup, true)); if (count($users) != 0) { // if no enrolled user in a course then don't display the batch operations feature $o .= $this->output->render(new assign_form('gradingbatchoperationsform', $gradingbatchoperationsform)); } $o .= $this->output->render(new assign_form('gradingoptionsform', $gradingoptionsform, 'M.mod_assign.init_grading_options')); return $o; }
/** * View the grading table of all submissions for this assignment. * * @return string */ protected function view_grading_table() { global $USER, $CFG; // Include grading options form. require_once $CFG->dirroot . '/mod/assign/gradingoptionsform.php'; require_once $CFG->dirroot . '/mod/assign/quickgradingform.php'; require_once $CFG->dirroot . '/mod/assign/gradingbatchoperationsform.php'; $o = ''; $cmid = $this->get_course_module()->id; $links = array(); if (has_capability('gradereport/grader:view', $this->get_course_context()) && has_capability('moodle/grade:viewall', $this->get_course_context())) { $gradebookurl = '/grade/report/grader/index.php?id=' . $this->get_course()->id; $links[$gradebookurl] = get_string('viewgradebook', 'assign'); } if ($this->is_any_submission_plugin_enabled() && $this->count_submissions()) { $downloadurl = '/mod/assign/view.php?id=' . $cmid . '&action=downloadall'; $links[$downloadurl] = get_string('downloadall', 'assign'); } if ($this->is_blind_marking() && has_capability('mod/assign:revealidentities', $this->get_context())) { $revealidentitiesurl = '/mod/assign/view.php?id=' . $cmid . '&action=revealidentities'; $links[$revealidentitiesurl] = get_string('revealidentities', 'assign'); } foreach ($this->get_feedback_plugins() as $plugin) { if ($plugin->is_enabled() && $plugin->is_visible()) { foreach ($plugin->get_grading_actions() as $action => $description) { $url = '/mod/assign/view.php' . '?id=' . $cmid . '&plugin=' . $plugin->get_type() . '&pluginsubtype=assignfeedback' . '&action=viewpluginpage&pluginaction=' . $action; $links[$url] = $description; } } } // Sort links alphabetically based on the link description. core_collator::asort($links); $gradingactions = new url_select($links); $gradingactions->set_label(get_string('choosegradingaction', 'assign')); $gradingmanager = get_grading_manager($this->get_context(), 'mod_assign', 'submissions'); $perpage = get_user_preferences('assign_perpage', 10); $filter = get_user_preferences('assign_filter', ''); $markerfilter = get_user_preferences('assign_markerfilter', ''); $workflowfilter = get_user_preferences('assign_workflowfilter', ''); $controller = $gradingmanager->get_active_controller(); $showquickgrading = empty($controller); $quickgrading = get_user_preferences('assign_quickgrading', false); $showonlyactiveenrolopt = has_capability('moodle/course:viewsuspendedusers', $this->context); $markingallocation = $this->get_instance()->markingallocation && has_capability('mod/assign:manageallocations', $this->context); // Get markers to use in drop lists. $markingallocationoptions = array(); if ($markingallocation) { $markers = get_users_by_capability($this->context, 'mod/assign:grade'); $markingallocationoptions[''] = get_string('filternone', 'assign'); foreach ($markers as $marker) { $markingallocationoptions[$marker->id] = fullname($marker); } } $markingworkflow = $this->get_instance()->markingworkflow; // Get marking states to show in form. $markingworkflowoptions = array(); if ($markingworkflow) { $notmarked = get_string('markingworkflowstatenotmarked', 'assign'); $markingworkflowoptions[''] = get_string('filternone', 'assign'); $markingworkflowoptions[ASSIGN_MARKING_WORKFLOW_STATE_NOTMARKED] = $notmarked; $markingworkflowoptions = array_merge($markingworkflowoptions, $this->get_marking_workflow_states_for_current_user()); } // Print options for changing the filter and changing the number of results per page. $gradingoptionsformparams = array('cm' => $cmid, 'contextid' => $this->context->id, 'userid' => $USER->id, 'submissionsenabled' => $this->is_any_submission_plugin_enabled(), 'showquickgrading' => $showquickgrading, 'quickgrading' => $quickgrading, 'markingworkflowopt' => $markingworkflowoptions, 'markingallocationopt' => $markingallocationoptions, 'showonlyactiveenrolopt' => $showonlyactiveenrolopt, 'showonlyactiveenrol' => $this->show_only_active_users()); $classoptions = array('class' => 'gradingoptionsform'); $gradingoptionsform = new mod_assign_grading_options_form(null, $gradingoptionsformparams, 'post', '', $classoptions); $batchformparams = array('cm' => $cmid, 'submissiondrafts' => $this->get_instance()->submissiondrafts, 'duedate' => $this->get_instance()->duedate, 'attemptreopenmethod' => $this->get_instance()->attemptreopenmethod, 'feedbackplugins' => $this->get_feedback_plugins(), 'context' => $this->get_context(), 'markingworkflow' => $markingworkflow, 'markingallocation' => $markingallocation); $classoptions = array('class' => 'gradingbatchoperationsform'); $gradingbatchoperationsform = new mod_assign_grading_batch_operations_form(null, $batchformparams, 'post', '', $classoptions); $gradingoptionsdata = new stdClass(); $gradingoptionsdata->perpage = $perpage; $gradingoptionsdata->filter = $filter; $gradingoptionsdata->markerfilter = $markerfilter; $gradingoptionsdata->workflowfilter = $workflowfilter; $gradingoptionsform->set_data($gradingoptionsdata); $actionformtext = $this->get_renderer()->render($gradingactions); $header = new assign_header($this->get_instance(), $this->get_context(), false, $this->get_course_module()->id, get_string('grading', 'assign'), $actionformtext); $o .= $this->get_renderer()->render($header); $currenturl = $CFG->wwwroot . '/mod/assign/view.php?id=' . $this->get_course_module()->id . '&action=grading'; $o .= groups_print_activity_menu($this->get_course_module(), $currenturl, true); // Plagiarism update status apearring in the grading book. if (!empty($CFG->enableplagiarism)) { require_once $CFG->libdir . '/plagiarismlib.php'; $o .= plagiarism_update_status($this->get_course(), $this->get_course_module()); } // Load and print the table of submissions. if ($showquickgrading && $quickgrading) { $gradingtable = new assign_grading_table($this, $perpage, $filter, 0, true); $table = $this->get_renderer()->render($gradingtable); $quickformparams = array('cm' => $this->get_course_module()->id, 'gradingtable' => $table); $quickgradingform = new mod_assign_quick_grading_form(null, $quickformparams); $o .= $this->get_renderer()->render(new assign_form('quickgradingform', $quickgradingform)); } else { $gradingtable = new assign_grading_table($this, $perpage, $filter, 0, false); $o .= $this->get_renderer()->render($gradingtable); } $currentgroup = groups_get_activity_group($this->get_course_module(), true); $users = array_keys($this->list_participants($currentgroup, true)); if (count($users) != 0) { // If no enrolled user in a course then don't display the batch operations feature. $assignform = new assign_form('gradingbatchoperationsform', $gradingbatchoperationsform); $o .= $this->get_renderer()->render($assignform); } $assignform = new assign_form('gradingoptionsform', $gradingoptionsform, 'M.mod_assign.init_grading_options'); $o .= $this->get_renderer()->render($assignform); return $o; }
/** * View the grading table of all submissions for this assignment * * @return string */ private function view_grading_table() { global $USER, $CFG; // Include grading options form require_once $CFG->dirroot . '/mod/assign/gradingoptionsform.php'; require_once $CFG->dirroot . '/mod/assign/gradingactionsform.php'; require_once $CFG->dirroot . '/mod/assign/quickgradingform.php'; require_once $CFG->dirroot . '/mod/assign/gradingbatchoperationsform.php'; $o = ''; $links = array(); $selecturl = (string) new moodle_url('/mod/assign/view.php', array('action' => 'grading', 'id' => $this->get_course_module()->id)); $links[$selecturl] = get_string('selectlink', 'assign'); if (has_capability('gradereport/grader:view', $this->get_course_context()) && has_capability('moodle/grade:viewall', $this->get_course_context())) { $gradebookurl = (string) new moodle_url('/grade/report/grader/index.php', array('id' => $this->get_course()->id)); $links[$gradebookurl] = get_string('viewgradebook', 'assign'); } if ($this->is_any_submission_plugin_enabled()) { $downloadurl = (string) new moodle_url('/mod/assign/view.php', array('id' => $this->get_course_module()->id, 'action' => 'downloadall')); $links[$downloadurl] = get_string('downloadall', 'assign'); } $gradingactionsform = new mod_assign_grading_actions_form(null, array('links' => $links, 'cm' => $this->get_course_module()->id), 'post', '', array('class' => 'gradingactionsform')); $gradingmanager = get_grading_manager($this->get_context(), 'mod_assign', 'submissions'); $perpage = get_user_preferences('assign_perpage', 10); $filter = get_user_preferences('assign_filter', ''); $controller = $gradingmanager->get_active_controller(); $showquickgrading = empty($controller); if (optional_param('action', '', PARAM_ALPHA) == 'saveoptions') { $quickgrading = optional_param('quickgrading', false, PARAM_BOOL); set_user_preference('assign_quickgrading', $quickgrading); } $quickgrading = get_user_preferences('assign_quickgrading', false); // print options for changing the filter and changing the number of results per page $gradingoptionsform = new mod_assign_grading_options_form(null, array('cm' => $this->get_course_module()->id, 'contextid' => $this->context->id, 'userid' => $USER->id, 'showquickgrading' => $showquickgrading, 'quickgrading' => $quickgrading), 'post', '', array('class' => 'gradingoptionsform')); $gradingbatchoperationsform = new mod_assign_grading_batch_operations_form(null, array('cm' => $this->get_course_module()->id, 'submissiondrafts' => $this->get_instance()->submissiondrafts), 'post', '', array('class' => 'gradingbatchoperationsform')); $gradingoptionsdata = new stdClass(); $gradingoptionsdata->perpage = $perpage; $gradingoptionsdata->filter = $filter; $gradingoptionsform->set_data($gradingoptionsdata); // plagiarism update status apearring in the grading book if (!empty($CFG->enableplagiarism)) { /** Include plagiarismlib.php */ require_once $CFG->libdir . '/plagiarismlib.php'; plagiarism_update_status($this->get_course(), $this->get_course_module()); } $o .= $this->output->render(new assign_form('gradingactionsform', $gradingactionsform)); $o .= $this->output->render(new assign_form('gradingoptionsform', $gradingoptionsform, 'M.mod_assign.init_grading_options')); // load and print the table of submissions if ($showquickgrading && $quickgrading) { $table = $this->output->render(new assign_grading_table($this, $perpage, $filter, 0, true)); $quickgradingform = new mod_assign_quick_grading_form(null, array('cm' => $this->get_course_module()->id, 'gradingtable' => $table)); $o .= $this->output->render(new assign_form('quickgradingform', $quickgradingform)); } else { $o .= $this->output->render(new assign_grading_table($this, $perpage, $filter, 0, false)); } $currentgroup = groups_get_activity_group($this->get_course_module(), true); $users = array_keys($this->list_participants($currentgroup, true)); if (count($users) != 0) { // if no enrolled user in a course then don't display the batch operations feature $o .= $this->output->render(new assign_form('gradingbatchoperationsform', $gradingbatchoperationsform)); } return $o; }