Skip to content

Commit

Permalink
Refactor for MOODLE41 & PHP 7.4
Browse files Browse the repository at this point in the history
  • Loading branch information
luukverhoeven committed Dec 18, 2023
1 parent 64257c7 commit 9eb3230
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 118 deletions.
5 changes: 3 additions & 2 deletions components/columns/coursestats/plugin.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,17 +92,18 @@ public function execute($data, $row, $user, $courseid, $starttime = 0, $endtime
$endtime = ($filterendtime) ? $filterendtime : $endtime;

$limit = 0;
$numericroles = array_filter($data->roles, 'is_numeric');

switch ($data->stat) {
case 'activityview':
$total = 'SUM(stat1)';
$stattype = 'activity';
$extrasql = " AND roleid IN (" . implode(',', $data->roles) . ")";
$extrasql = " AND roleid IN (" . implode(',', $numericroles ). ")";
break;
case 'activitypost':
$total = 'SUM(stat2)';
$stattype = 'activity';
$extrasql = " AND roleid IN (" . implode(',', $data->roles) . ")";
$extrasql = " AND roleid IN (" . implode(',', $numericroles) . ")";
break;
case 'activeenrolments':
$total = 'stat2';
Expand Down
6 changes: 6 additions & 0 deletions components/filters/fsearchuserfield/plugin.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,12 @@ public function print_filter(MoodleQuickForm $mform, $formdata = false): void {
$selectname = get_string($formdata->field);

[$usql, $params] = $remotedb->get_in_or_equal($userlist);
$columns = $remotedb->get_columns('user');

if (!array_key_exists($formdata->field, $columns)) {
throw new moodle_exception('nosuchcolumn', 'error', '', null, "The column '{$formdata->field}' does not exist in the user table.");
}

$sql = "SELECT DISTINCT(" . $formdata->field . ") as ufield FROM {user} WHERE id $usql ORDER BY ufield ASC";
if ($rs = $remotedb->get_recordset_sql($sql, $params)) {
foreach ($rs as $u) {
Expand Down
115 changes: 0 additions & 115 deletions lib/pChart/pCache.class.php

This file was deleted.

1 change: 0 additions & 1 deletion locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,6 @@ function cr_import_xml(string $xml, object $course) {
* @return array
*/
function cr_logging_info(): array {
global $CFG;

static $uselegacyreader;
static $useinternalreader;
Expand Down

0 comments on commit 9eb3230

Please sign in to comment.