Skip to content
Browse files

Merge branch 'MDL-35388' of git://github.com/Lightwork-Marking/moodle…

… into integration

Conflicts:
	mod/assign/locallib.php
  • Loading branch information...
2 parents 36b76c1 + 2cffef9 commit fd637d38ac8195feb22f0f4a3022f3d99dbd918f Damyon Wiese committed Sep 13, 2012
Showing with 50 additions and 38 deletions.
  1. +1 −1 mod/assign/lib.php
  2. +49 −37 mod/assign/locallib.php
View
2 mod/assign/lib.php
@@ -31,7 +31,7 @@
* @param mod_assign_mod_form $form
* @return int The instance id of the new assignment
*/
-function assign_add_instance(stdClass $data, mod_assign_mod_form $form) {
+function assign_add_instance(stdClass $data, mod_assign_mod_form $form = null) {
global $CFG;
require_once($CFG->dirroot . '/mod/assign/locallib.php');
View
86 mod/assign/locallib.php
@@ -132,7 +132,6 @@ public function __construct($coursemodulecontext, $coursemodule, $course) {
$this->submissionplugins = $this->load_plugins('assignsubmission');
$this->feedbackplugins = $this->load_plugins('assignfeedback');
- $this->output = $PAGE->get_renderer('mod_assign');
}
/**
@@ -1500,7 +1499,7 @@ private function view_grant_extension($mform) {
} else {
$data->batchusers = $batchusers;
}
- $o .= $this->output->render(new assign_header($this->get_instance(),
+ $o .= $this->get_output()->render(new assign_header($this->get_instance(),
$this->get_context(),
$this->show_intro(),
$this->get_course_module()->id,
@@ -1513,7 +1512,7 @@ private function view_grant_extension($mform) {
$this->get_instance(),
$data));
}
- $o .= $this->output->render(new assign_form('extensionform', $mform));
+ $o .= $this->get_output()->render(new assign_form('extensionform', $mform));
$o .= $this->view_footer();
return $o;
}
@@ -1713,12 +1712,12 @@ private function view_plugin_content($pluginsubtype) {
if ($item->userid != $USER->id) {
require_capability('mod/assign:grade', $this->context);
}
- $o .= $this->output->render(new assign_header($this->get_instance(),
+ $o .= $this->get_output()->render(new assign_header($this->get_instance(),
$this->get_context(),
$this->show_intro(),
$this->get_course_module()->id,
$plugin->get_name()));
- $o .= $this->output->render(new assign_submission_plugin_submission($plugin,
+ $o .= $this->get_output()->render(new assign_submission_plugin_submission($plugin,
$item,
assign_submission_plugin_submission::FULL,
$this->get_course_module()->id,
@@ -1736,12 +1735,12 @@ private function view_plugin_content($pluginsubtype) {
if ($item->userid != $USER->id) {
require_capability('mod/assign:grade', $this->context);
}
- $o .= $this->output->render(new assign_header($this->get_instance(),
+ $o .= $this->get_output()->render(new assign_header($this->get_instance(),
$this->get_context(),
$this->show_intro(),
$this->get_course_module()->id,
$plugin->get_name()));
- $o .= $this->output->render(new assign_feedback_plugin_feedback($plugin,
+ $o .= $this->get_output()->render(new assign_feedback_plugin_feedback($plugin,
$item,
assign_feedback_plugin_feedback::FULL,
$this->get_course_module()->id,
@@ -1807,12 +1806,12 @@ public function render_editor_content($filearea, $submissionid, $plugintype, $ed
*/
private function view_quickgrading_result($message) {
$o = '';
- $o .= $this->output->render(new assign_header($this->get_instance(),
+ $o .= $this->get_output()->render(new assign_header($this->get_instance(),
$this->get_context(),
$this->show_intro(),
$this->get_course_module()->id,
get_string('quickgradingresult', 'assign')));
- $o .= $this->output->render(new assign_quickgrading_result($message, $this->get_course_module()->id));
+ $o .= $this->get_output()->render(new assign_quickgrading_result($message, $this->get_course_module()->id));
$o .= $this->view_footer();
return $o;
}
@@ -1823,7 +1822,7 @@ private function view_quickgrading_result($message) {
* @return string
*/
private function view_footer() {
- return $this->output->render_footer();
+ return $this->get_output()->render_footer();
}
/**
@@ -1937,6 +1936,19 @@ public function add_to_log($action = '', $info = '', $url='') {
add_to_log($this->get_course()->id, 'assign', $action, $fullurl, $info, $this->get_course_module()->id, $USER->id);
}
+
+ /**
+ * Load the page renderer
+ * @return assign_renderer
+ */
+ private function get_output() {
+ global $PAGE;
+ if ($this->output) {
+ return $this->output;
+ }
+ $this->output = $PAGE->get_renderer('mod_assign');
+ return $this->output;
+ }
/**
* Load the submission object for a particular user, optionally creating it if required
@@ -2059,7 +2071,7 @@ private function view_single_grade_page($mform, $offset=0) {
// Need submit permission to submit an assignment
require_capability('mod/assign:grade', $this->context);
- $o .= $this->output->render(new assign_header($this->get_instance(),
+ $o .= $this->get_output()->render(new assign_header($this->get_instance(),
$this->get_context(), false, $this->get_course_module()->id,get_string('grading', 'assign')));
$rownum = required_param('rownum', PARAM_INT) + $offset;
@@ -2083,7 +2095,7 @@ private function view_single_grade_page($mform, $offset=0) {
}
$user = $DB->get_record('user', array('id' => $userid));
if ($user) {
- $o .= $this->output->render(new assign_user_summary($user,
+ $o .= $this->get_output()->render(new assign_user_summary($user,
$this->get_course()->id,
has_capability('moodle/site:viewfullnames',
$this->get_course_context()),
@@ -2123,7 +2135,7 @@ private function view_single_grade_page($mform, $offset=0) {
}
$viewfullnames = has_capability('moodle/site:viewfullnames', $this->get_course_context());
- $o .= $this->output->render(new assign_submission_status($this->get_instance()->allowsubmissionsfromdate,
+ $o .= $this->get_output()->render(new assign_submission_status($this->get_instance()->allowsubmissionsfromdate,
$this->get_instance()->alwaysshowdescription,
$submission,
$this->get_instance()->teamsubmission,
@@ -2169,7 +2181,7 @@ private function view_single_grade_page($mform, $offset=0) {
'',
array('class'=>'gradeform'));
}
- $o .= $this->output->render(new assign_form('gradingform',$mform));
+ $o .= $this->get_output()->render(new assign_form('gradingform',$mform));
$msg = get_string('viewgradingformforstudent', 'assign', array('id'=>$user->id, 'fullname'=>fullname($user)));
$this->add_to_log('view grading form', $msg);
@@ -2189,7 +2201,7 @@ private function view_reveal_identities_confirm() {
require_capability('mod/assign:revealidentities', $this->get_context());
$o = '';
- $o .= $this->output->render(new assign_header($this->get_instance(),
+ $o .= $this->get_output()->render(new assign_header($this->get_instance(),
$this->get_context(), false, $this->get_course_module()->id));
$confirmurl = new moodle_url('/mod/assign/view.php', array('id'=>$this->get_course_module()->id,
@@ -2199,7 +2211,7 @@ private function view_reveal_identities_confirm() {
$cancelurl = new moodle_url('/mod/assign/view.php', array('id'=>$this->get_course_module()->id,
'action'=>'grading'));
- $o .= $this->output->confirm(get_string('revealidentitiesconfirm', 'assign'), $confirmurl, $cancelurl);
+ $o .= $this->get_output()->confirm(get_string('revealidentitiesconfirm', 'assign'), $confirmurl, $cancelurl);
$o .= $this->view_footer();
$this->add_to_log('view', get_string('viewrevealidentitiesconfirm', 'assign'));
return $o;
@@ -2222,7 +2234,7 @@ private function view_return_links() {
parse_str($returnparams, $params);
$params = array_merge( array('id' => $this->get_course_module()->id, 'action' => $returnaction), $params);
- return $this->output->single_button(new moodle_url('/mod/assign/view.php', $params), get_string('back'), 'get');
+ return $this->get_output()->single_button(new moodle_url('/mod/assign/view.php', $params), get_string('back'), 'get');
}
@@ -2304,8 +2316,8 @@ private function view_grading_table() {
$gradingoptionsdata->filter = $filter;
$gradingoptionsform->set_data($gradingoptionsdata);
- $actionformtext = $this->output->render($gradingactions);
- $o .= $this->output->render(new assign_header($this->get_instance(),
+ $actionformtext = $this->get_output()->render($gradingactions);
+ $o .= $this->get_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);
@@ -2318,22 +2330,22 @@ private function view_grading_table() {
// load and print the table of submissions
if ($showquickgrading && $quickgrading) {
- $table = $this->output->render(new assign_grading_table($this, $perpage, $filter, 0, true));
+ $table = $this->get_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));
+ $o .= $this->get_output()->render(new assign_form('quickgradingform', $quickgradingform));
} else {
- $o .= $this->output->render(new assign_grading_table($this, $perpage, $filter, 0, false));
+ $o .= $this->get_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->get_output()->render(new assign_form('gradingbatchoperationsform', $gradingbatchoperationsform));
}
- $o .= $this->output->render(new assign_form('gradingoptionsform', $gradingoptionsform, 'M.mod_assign.init_grading_options'));
+ $o .= $this->get_output()->render(new assign_form('gradingoptionsform', $gradingoptionsform, 'M.mod_assign.init_grading_options'));
return $o;
}
@@ -2390,13 +2402,13 @@ private function view_student_error_message() {
// Need submit permission to submit an assignment
require_capability('mod/assign:submit', $this->context);
- $o .= $this->output->render(new assign_header($this->get_instance(),
+ $o .= $this->get_output()->render(new assign_header($this->get_instance(),
$this->get_context(),
$this->show_intro(),
$this->get_course_module()->id,
get_string('editsubmission', 'assign')));
- $o .= $this->output->notification(get_string('submissionsclosed', 'assign'));
+ $o .= $this->get_output()->notification(get_string('submissionsclosed', 'assign'));
$o .= $this->view_footer();
@@ -2422,7 +2434,7 @@ private function view_edit_submission_page($mform) {
if (!$this->submissions_open()) {
return $this->view_student_error_message();
}
- $o .= $this->output->render(new assign_header($this->get_instance(),
+ $o .= $this->get_output()->render(new assign_header($this->get_instance(),
$this->get_context(),
$this->show_intro(),
$this->get_course_module()->id,
@@ -2434,7 +2446,7 @@ private function view_edit_submission_page($mform) {
$mform = new mod_assign_submission_form(null, array($this, $data));
}
- $o .= $this->output->render(new assign_form('editsubmissionform',$mform));
+ $o .= $this->get_output()->render(new assign_form('editsubmissionform',$mform));
$o .= $this->view_footer();
$this->add_to_log('view submit assignment form', get_string('viewownsubmissionform', 'assign'));
@@ -2595,8 +2607,8 @@ private function check_submit_for_grading($mform) {
$data));
}
$o = '';
- $o .= $this->output->header();
- $o .= $this->output->render(new assign_submit_for_grading_page($notifications, $this->get_course_module()->id, $mform));
+ $o .= $this->get_output()->header();
+ $o .= $this->get_output()->render(new assign_submit_for_grading_page($notifications, $this->get_course_module()->id, $mform));
$o .= $this->view_footer();
$this->add_to_log('view confirm submit assignment form', get_string('viewownsubmissionform', 'assign'));
@@ -2658,7 +2670,7 @@ public function view_student_summary($user, $showlinks) {
$extensionduedate = $grade->extensionduedate;
}
$viewfullnames = has_capability('moodle/site:viewfullnames', $this->get_course_context());
- $o .= $this->output->render(new assign_submission_status($this->get_instance()->allowsubmissionsfromdate,
+ $o .= $this->get_output()->render(new assign_submission_status($this->get_instance()->allowsubmissionsfromdate,
$this->get_instance()->alwaysshowdescription,
$submission,
$this->get_instance()->teamsubmission,
@@ -2737,7 +2749,7 @@ public function view_student_summary($user, $showlinks) {
$this->get_return_action(),
$this->get_return_params());
- $o .= $this->output->render($feedbackstatus);
+ $o .= $this->get_output()->render($feedbackstatus);
}
}
@@ -2753,7 +2765,7 @@ private function view_submission_page() {
global $CFG, $DB, $USER, $PAGE;
$o = '';
- $o .= $this->output->render(new assign_header($this->get_instance(),
+ $o .= $this->get_output()->render(new assign_header($this->get_instance(),
$this->get_context(),
$this->show_intro(),
$this->get_course_module()->id));
@@ -2770,7 +2782,7 @@ private function view_submission_page() {
$this->get_course_module()->id,
$this->count_submissions_need_grading(),
$this->get_instance()->teamsubmission);
- $o .= $this->output->render($summary);
+ $o .= $this->get_output()->render($summary);
} else {
$summary = new assign_grading_summary($this->count_participants(0),
$this->get_instance()->submissiondrafts,
@@ -2782,7 +2794,7 @@ private function view_submission_page() {
$this->get_course_module()->id,
$this->count_submissions_need_grading(),
$this->get_instance()->teamsubmission);
- $o .= $this->output->render($summary);
+ $o .= $this->get_output()->render($summary);
}
}
$grade = $this->get_user_grade($USER->id, false);
@@ -3057,7 +3069,7 @@ public function render_area_files($component, $area, $submissionid) {
$fs = get_file_storage();
$browser = get_file_browser();
$files = $fs->get_area_files($this->get_context()->id, $component, $area , $submissionid , "timemodified", false);
- return $this->output->assign_files($this->context, $submissionid, $area, $component);
+ return $this->get_output()->assign_files($this->context, $submissionid, $area, $component);
}
@@ -3898,7 +3910,7 @@ public function add_grade_form_elements(MoodleQuickForm $mform, stdClass $data,
}
if (has_all_capabilities(array('gradereport/grader:view', 'moodle/grade:viewall'), $this->get_course_context())) {
- $gradestring = $this->output->action_link(new moodle_url('/grade/report/grader/index.php',
+ $gradestring = $this->get_output()->action_link(new moodle_url('/grade/report/grader/index.php',
array('id'=>$this->get_course()->id)),
$gradinginfo->items[0]->grades[$userid]->str_grade);
} else {

0 comments on commit fd637d3

Please sign in to comment.
Something went wrong with that request. Please try again.