From: skodak Date: Tue, 17 Jul 2007 06:09:03 +0000 (+0000) Subject: MDL-10438 inline docs added, moved $gpr into grade class X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=d30c44814b796eb286f042aa69fdada03de456e0;p=moodle.git MDL-10438 inline docs added, moved $gpr into grade class --- diff --git a/grade/report/grader/index.php b/grade/report/grader/index.php index 3de8b30dae..65c2f3d33a 100644 --- a/grade/report/grader/index.php +++ b/grade/report/grader/index.php @@ -21,7 +21,7 @@ if (!is_null($toggle) && !empty($toggle_type)) { } // Initialise the grader report object -$report = new grade_report_grader($courseid, $context, $page, $sortitemid); +$report = new grade_report_grader($courseid, $gpr, $context, $page, $sortitemid); /// processing posted grades & feedback here if ($data = data_submitted() and confirm_sesskey()) { @@ -64,11 +64,11 @@ echo $report->get_toggles_html(); print_paging_bar($numusers, $report->page, $report->get_pref('studentsperpage'), $report->pbarurl); $reporthtml = ''; -$reporthtml .= $report->get_headerhtml($gpr); -$reporthtml .= $report->get_scalehtml($gpr); -$reporthtml .= $report->get_studentshtml($gpr); -$reporthtml .= $report->get_groupavghtml($gpr); -$reporthtml .= $report->get_gradeavghtml($gpr, $numusers); //TODO: numusers not in function definition?? +$reporthtml .= $report->get_headerhtml(); +$reporthtml .= $report->get_scalehtml(); +$reporthtml .= $report->get_studentshtml(); +$reporthtml .= $report->get_groupavghtml(); +$reporthtml .= $report->get_gradeavghtml($numusers); //TODO: numusers not in function definition?? $reporthtml .= "
"; // print submit button if ($USER->gradeediting) { diff --git a/grade/report/grader/lib.php b/grade/report/grader/lib.php index 532bee9992..9477315848 100644 --- a/grade/report/grader/lib.php +++ b/grade/report/grader/lib.php @@ -81,13 +81,14 @@ class grade_report_grader extends grade_report { /** * Constructor. Sets local copies of user preferences and initialises grade_tree. * @param int $courseid + * @param object $gpr grade plugin return tracking object * @param string $context * @param int $page The current page being viewed (when report is paged) * @param int $sortitemid The id of the grade_item by which to sort the table */ - function grade_report_grader($courseid, $context, $page=null, $sortitemid=null) { + function grade_report_grader($courseid, $gpr, $context, $page=null, $sortitemid=null) { global $CFG; - parent::grade_report($courseid, $context, $page); + parent::grade_report($courseid, $gpr, $context, $page); $this->sortitemid = $sortitemid; @@ -443,7 +444,7 @@ class grade_report_grader extends grade_report { * Builds and returns the HTML code for the headers. * @return string $headerhtml */ - function get_headerhtml($gpr) { + function get_headerhtml() { global $CFG, $USER; $strsortasc = $this->get_lang_string('sortasc', 'grades'); @@ -512,7 +513,7 @@ class grade_report_grader extends grade_report { // Print icons if ($USER->gradeediting) { - $headerhtml .= $this->get_icons($element, $gpr); + $headerhtml .= $this->get_icons($element); } $headerhtml .= ''; @@ -546,7 +547,7 @@ class grade_report_grader extends grade_report { . $element['object']->id .'">'. $element['object']->get_name() . '' . $arrow; - $headerhtml .= $this->get_icons($element, $gpr) . ''; + $headerhtml .= $this->get_icons($element) . ''; $this->items[$element['object']->sortorder] =& $element['object']; } @@ -562,7 +563,7 @@ class grade_report_grader extends grade_report { * Builds and return the HTML rows of the table (grades headed by student). * @return string HTML */ - function get_studentshtml($gpr) { + function get_studentshtml() { global $CFG, $USER; $studentshtml = ''; $strfeedback = $this->get_lang_string("feedback"); @@ -634,7 +635,7 @@ class grade_report_grader extends grade_report { $states = array('is_hidden' => $item->hidden, 'is_locked' => $item->locked, 'is_editable' => $item->gradetype != GRADE_TYPE_NONE && !$grade->locked && !$item->locked); - $studentshtml .= $this->get_icons($element, $gpr, null, true, $states); + $studentshtml .= $this->get_icons($element, null, true, $states); } // if in editting mode, we need to print either a text box @@ -742,7 +743,7 @@ class grade_report_grader extends grade_report { * Builds and return the HTML rows of the table (grades headed by student). * @return string HTML */ - function get_groupavghtml($gpr) { + function get_groupavghtml() { global $CFG; $averagesdisplaytype = $this->get_pref('averagesdisplaytype'); @@ -828,7 +829,7 @@ class grade_report_grader extends grade_report { * Builds and return the HTML row of column totals. * @return string HTML */ - function get_gradeavghtml($gpr) { + function get_gradeavghtml() { global $CFG; $averagesdisplaytype = $this->get_pref('averagesdisplaytype'); @@ -907,7 +908,7 @@ class grade_report_grader extends grade_report { * Builds and return the HTML row of scales for each column (i.e. range). * @return string HTML */ - function get_scalehtml($gpr) { + function get_scalehtml() { $scalehtml = ''; if ($this->get_pref('showranges')) { $scalehtml = ''.$this->get_lang_string('range','grades').''; @@ -930,7 +931,7 @@ class grade_report_grader extends grade_report { * @param object $states An optional array of states (hidden, locked, editable), shortcuts to increase performance. * @return string HTML */ - function get_icons($element, $gpr, $icons=null, $limit=true, $states=array()) { + function get_icons($element, $icons=null, $limit=true, $states=array()) { global $CFG; global $USER; @@ -986,18 +987,18 @@ class grade_report_grader extends grade_report { if ($states['is_editable']) { if ($type == 'category') { $url = GRADE_EDIT_URL . '/category.php?courseid='.$object->courseid.'&id='.$object->id; - $url = $gpr->add_url_params($url); + $url = $this->gpr->add_url_params($url); $edit_icon = ''
                            . $stredit.''. "\n"; } else if ($type == 'item' or $type == 'categoryitem' or $type == 'courseitem'){ $url = GRADE_EDIT_URL . '/item.php?courseid='.$object->courseid.'&id='.$object->id; - $url = $gpr->add_url_params($url); + $url = $this->gpr->add_url_params($url); $edit_icon = ''
                            . $stredit.''. "\n"; } else if ($type == 'grade' and ($states['is_editable'] or empty($object->id))) { // TODO: change link to use itemid and userid to allow creating of new grade objects $url = GRADE_EDIT_URL . '/grade.php?courseid='.$object->courseid.'&id='.$object->id; - $url = $gpr->add_url_params($url); + $url = $this->gpr->add_url_params($url); $edit_icon = '' . $stredit.''. "\n"; } @@ -1008,7 +1009,7 @@ class grade_report_grader extends grade_report { // show calculation icon only when calculation possible if (!$object->is_normal_item() and ($object->gradetype == GRADE_TYPE_SCALE or $object->gradetype == GRADE_TYPE_VALUE)) { $url = GRADE_EDIT_URL . '/calculation.php?courseid='.$object->courseid.'&id='.$object->id; - $url = $gpr->add_url_params($url); + $url = $this->gpr->add_url_params($url); $edit_calculation_icon = ''
                                        . $streditcalculation.''. "\n"; } diff --git a/grade/report/lib.php b/grade/report/lib.php index 31cc011022..6084efc5d2 100755 --- a/grade/report/lib.php +++ b/grade/report/lib.php @@ -18,6 +18,9 @@ class grade_report { */ var $courseid; + /** Grade plugin return tracking object. + var $gpr; + /** * The context. * @var int $context @@ -69,15 +72,17 @@ class grade_report { /** * Constructor. Sets local copies of user preferences and initialises grade_tree. * @param int $courseid + * @param object $gpr grade plugin return tracking object * @param string $context * @param int $page The current page being viewed (when report is paged) */ - function grade_report($courseid, $context, $page=null) { + function grade_report($courseid, $gpr, $context, $page=null) { global $CFG; $this->courseid = $courseid; - $this->context = $context; - $this->page = $page; + $this->gpr = $gpr; + $this->context = $context; + $this->page = $page; // roles to be displayed in the gradebook $this->gradebookroles = $CFG->gradebookroles; diff --git a/grade/report/user/index.php b/grade/report/user/index.php index 3d102c323c..4e1e893663 100644 --- a/grade/report/user/index.php +++ b/grade/report/user/index.php @@ -11,7 +11,7 @@ if (!$userid = optional_param('user', 0, PARAM_INT)) { } // Create a report instance -$report = new grade_report_user($courseid, $context, $userid); +$report = new grade_report_user($courseid, $gpr, $context, $userid); // find total number of participants $numusers = $report->get_numusers(); diff --git a/grade/report/user/lib.php b/grade/report/user/lib.php index dfeeccb66f..3b8e21c26c 100644 --- a/grade/report/user/lib.php +++ b/grade/report/user/lib.php @@ -29,12 +29,13 @@ class grade_report_user extends grade_report { /** * Constructor. Sets local copies of user preferences and initialises grade_tree. * @param int $courseid + * @param object $gpr grade plugin return tracking object * @param string $context * @param int $userid The id of the user */ - function grade_report_user($courseid, $context, $userid) { + function grade_report_user($courseid, $gpr, $context, $userid) { global $CFG; - parent::grade_report($courseid, $context); + parent::grade_report($courseid, $gpr, $context); // get the user (for full name) $this->user = get_record('user', 'id', $userid);