]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-10438 inline docs added, moved $gpr into grade class
authorskodak <skodak>
Tue, 17 Jul 2007 06:09:03 +0000 (06:09 +0000)
committerskodak <skodak>
Tue, 17 Jul 2007 06:09:03 +0000 (06:09 +0000)
grade/report/grader/index.php
grade/report/grader/lib.php
grade/report/lib.php
grade/report/user/index.php
grade/report/user/lib.php

index 3de8b30daeb882e5e43c9136ec57d2af093335c9..65c2f3d33ab656c7a267670b723fd78968409490 100644 (file)
@@ -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 = '<table class="gradestable">';
-$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 .= "</table>";
 // print submit button
 if ($USER->gradeediting) {
index 532bee999210c987fa76299e94191a21ddb41375..94773158481325dd8531e94b8a55375f2f671221 100644 (file)
@@ -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 .= '</th>';
@@ -546,7 +547,7 @@ class grade_report_grader extends grade_report {
                               . $element['object']->id .'">'. $element['object']->get_name()
                               . '</a>' . $arrow;
 
-                    $headerhtml .= $this->get_icons($element, $gpr) . '</th>';
+                    $headerhtml .= $this->get_icons($element) . '</th>';
 
                     $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 = '<tr><th class="range">'.$this->get_lang_string('range','grades').'</th>';
@@ -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.'&amp;id='.$object->id;
-                $url = $gpr->add_url_params($url);
+                $url = $this->gpr->add_url_params($url);
                 $edit_icon = '<a href="'.$url.'"><img src="'.$CFG->pixpath.'/t/edit.gif" class="iconsmall" alt="'
                            . $stredit.'" title="'.$stredit.'" /></a>'. "\n";
             } else if ($type == 'item' or $type == 'categoryitem' or $type == 'courseitem'){
                 $url = GRADE_EDIT_URL . '/item.php?courseid='.$object->courseid.'&amp;id='.$object->id;
-                $url = $gpr->add_url_params($url);
+                $url = $this->gpr->add_url_params($url);
                 $edit_icon = '<a href="'.$url.'"><img src="'.$CFG->pixpath.'/t/edit.gif" class="iconsmall" alt="'
                            . $stredit.'" title="'.$stredit.'" /></a>'. "\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.'&amp;id='.$object->id;
-                $url = $gpr->add_url_params($url);
+                $url = $this->gpr->add_url_params($url);
                 $edit_icon = '<a href="'.$url.'"><img ' . $overlib . ' src="'.$CFG->pixpath.'/t/edit.gif"'
                            . 'class="iconsmall" alt="' . $stredit.'" title="'.$stredit.'" /></a>'. "\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.'&amp;id='.$object->id;
-                $url = $gpr->add_url_params($url);
+                $url = $this->gpr->add_url_params($url);
                 $edit_calculation_icon = '<a href="'. $url.'"><img src="'.$CFG->pixpath.'/t/calc.gif" class="iconsmall" alt="'
                                        . $streditcalculation.'" title="'.$streditcalculation.'" /></a>'. "\n";
             }
index 31cc011022b0dbf4994ce0ba16a40eb7a60da76a..6084efc5d21c1ce82d02330d3fd7713ef3e8f1ff 100755 (executable)
@@ -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;
index 3d102c323cf6e3eccd0e6fa5e147b7c40fc5e202..4e1e89366349620f441877be357cc26fd16e19c2 100644 (file)
@@ -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();
index dfeeccb66f6260249166c7c65b268662b989f717..3b8e21c26c5e2c69415bc98b5dfd38a060d0e5e8 100644 (file)
@@ -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);