From 1afc701bff567edbea1873f31e9f45022a303714 Mon Sep 17 00:00:00 2001 From: Brian King Date: Mon, 29 Oct 2012 17:27:57 +0100 Subject: [PATCH] fixed some php strict-mode warnings --- db/install.php | 2 +- export.php | 1 + locallib.php | 6 ++++-- preferences.php | 6 +++--- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/db/install.php b/db/install.php index 0433ec9..5cc1af6 100644 --- a/db/install.php +++ b/db/install.php @@ -34,7 +34,7 @@ function xmldb_attforblock_install() { $result = true; $arr = array('P' => 2, 'A' => 0, 'L' => 1, 'E' => 1); foreach ($arr as $k => $v) { - unset($rec); + $rec = new stdClass; $rec->attendanceid = 0; $rec->acronym = get_string($k.'acronym', 'attforblock'); $rec->description = get_string($k.'full', 'attforblock'); diff --git a/export.php b/export.php index c5916e0..0d47952 100644 --- a/export.php +++ b/export.php @@ -77,6 +77,7 @@ if ($mform->is_submitted()) { $filename = clean_filename($course->shortname.'_Attendances_'.userdate(time(), '%Y%m%d-%H%M')); $group = $formdata->group ? $reportdata->groups[$formdata->group] : 0; + $data = new stdClass; $data->tabhead = array(); $data->course = $att->course->fullname; $data->group = $group ? $group->name : get_string('allparticipants'); diff --git a/locallib.php b/locallib.php index 346e569..68633de 100644 --- a/locallib.php +++ b/locallib.php @@ -1292,12 +1292,14 @@ function att_update_all_users_grades($attid, $course, $context) { $statuses = att_get_statuses($attid); $gradebook_maxgrade = att_get_gradebook_maxgrade($attid); foreach ($userids as $userid) { - $grades[$userid]->userid = $userid; + $grade = new stdClass; + $grade->userid = $userid; $userstatusesstat = att_get_user_statuses_stat($attid, $course->startdate, $userid); $usertakensesscount = att_get_user_taken_sessions_count($attid, $course->startdate, $userid); $usergrade = att_get_user_grade($userstatusesstat, $statuses); $usermaxgrade = att_get_user_max_grade($usertakensesscount, $statuses); - $grades[$userid]->rawgrade = att_calc_user_grade_fraction($usergrade, $usermaxgrade) * $gradebook_maxgrade; + $grade->rawgrade = att_calc_user_grade_fraction($usergrade, $usermaxgrade) * $gradebook_maxgrade; + $grades[$userid] = $grade; } return grade_update('mod/attforblock', $course->id, 'mod', 'attforblock', diff --git a/preferences.php b/preferences.php index c09ed2e..24ef61d 100644 --- a/preferences.php +++ b/preferences.php @@ -85,9 +85,9 @@ switch ($att->pageparams->action) { $att->update_status($att->pageparams->statusid, null, null, null, 1); break; case att_preferences_page_params::ACTION_SAVE: - $acronym = required_param('acronym', PARAM_MULTILANG); - $description = required_param('description', PARAM_MULTILANG); - $grade = required_param('grade', PARAM_INT); + $acronym = required_param_array('acronym', PARAM_MULTILANG); + $description = required_param_array('description', PARAM_MULTILANG); + $grade = required_param_array('grade', PARAM_INT); foreach ($acronym as $id => $v) { $att->update_status($id, $acronym[$id], $description[$id], $grade[$id], null);