Permalink
Browse files

MDL-32888 Grader report: use SESSION object and DB functions

  • Loading branch information...
Melissa Aitkin
Melissa Aitkin committed Aug 20, 2013
1 parent d5f6d9e commit d1a4346f86c784c819e120fa57b2c3d39db945c5
Showing with 13 additions and 13 deletions.
  1. +5 −5 grade/report/grader/index.php
  2. +1 −1 grade/report/grader/lib.php
  3. +7 −7 grade/report/lib.php
@@ -43,12 +43,12 @@
$graderreportsifirst = optional_param('sifirst', NULL, PARAM_ALPHA);
$graderreportsilast = optional_param('silast', NULL, PARAM_ALPHA);
-// The report object is recreated each time, save search information to USER object for future use.
+// The report object is recreated each time, save search information to SESSION object for future use.
if (isset($graderreportsifirst)) {
- $USER->filterfirstname = $graderreportsifirst;
+ $SESSION->filterfirstname = $graderreportsifirst;
}
if (isset($graderreportsilast)) {
- $USER->filtersurname = $graderreportsilast;
+ $SESSION->filtersurname = $graderreportsilast;
}
$PAGE->set_url(new moodle_url('/grade/report/grader/index.php', array('id'=>$courseid)));
@@ -153,8 +153,8 @@
// User search
$url = new moodle_url('/grade/report/grader/index.php', array('id' => $course->id));
-$firstinitial = isset($USER->filterfirstname) ? $USER->filterfirstname : '';
-$lastinitial = isset($USER->filtersurname) ? $USER->filtersurname : '';
+$firstinitial = isset($SESSION->filterfirstname) ? $SESSION->filterfirstname : '';
+$lastinitial = isset($SESSION->filtersurname) ? $SESSION->filtersurname : '';
$totalusers = $report->get_numusers(true, false);
$renderer = $PAGE->get_renderer('core_user');
echo $renderer->user_search($url, $firstinitial, $lastinitial, $numusers, $totalusers, $report->currentgroupname);
@@ -158,7 +158,7 @@ public function __construct($courseid, $gpr, $context, $page=null, $sortitemid=n
public function process_data($data) {
global $DB;
$warnings = array();
-
+
$separategroups = false;
$mygroups = array();
if ($this->groupmode == SEPARATEGROUPS and !has_capability('moodle/site:accessallgroups', $this->context)) {
View
@@ -388,17 +388,17 @@ protected function setup_groups() {
}
public function setup_users() {
- global $USER;
+ global $SESSION, $DB;
$this->userwheresql = "";
$this->userwheresql_params = array();
- if (isset($USER->filterfirstname) && !empty($USER->filterfirstname)) {
- $this->userwheresql .= ' AND u.firstname ILIKE :firstname ';
- $this->userwheresql_params['firstname'] = $USER->filterfirstname.'%';
+ if (isset($SESSION->filterfirstname) && !empty($SESSION->filterfirstname)) {
+ $this->userwheresql .= ' AND '.$DB->sql_like('u.firstname', ':firstname', false, false);
+ $this->userwheresql_params['firstname'] = $SESSION->filterfirstname.'%';
}
- if (isset($USER->filtersurname) && !empty($USER->filtersurname)) {
- $this->userwheresql .= ' AND u.lastname ILIKE :lastname ';
- $this->userwheresql_params['lastname'] = $USER->filtersurname.'%';
+ if (isset($SESSION->filtersurname) && !empty($SESSION->filtersurname)) {
+ $this->userwheresql .= ' AND '.$DB->sql_like('u.lastname', ':lastname', false, false);
+ $this->userwheresql_params['lastname'] = $SESSION->filtersurname.'%';
}
}

0 comments on commit d1a4346

Please sign in to comment.