mirror of
https://github.com/moodle/moodle.git
synced 2025-04-13 12:32:08 +02:00
MDL-32094 fix various E_STRICT compatibility problems
This commit is contained in:
parent
0ed6f71232
commit
f20edd5208
@ -307,7 +307,8 @@ if (during_initial_install()) {
|
||||
}
|
||||
|
||||
// at this stage there can be only one admin unless more were added by install - users may change username, so do not rely on that
|
||||
$adminuser = get_complete_user_data('id', reset(explode(',', $CFG->siteadmins)));
|
||||
$adminids = explode(',', $CFG->siteadmins);
|
||||
$adminuser = get_complete_user_data('id', reset($adminids));
|
||||
|
||||
if ($adminuser->password === 'adminsetuppending') {
|
||||
// prevent installation hijacking
|
||||
|
@ -141,10 +141,10 @@ class mnet_review_host_form extends moodleform {
|
||||
|
||||
if ($mnet_peer && !empty($mnet_peer->deleted)) {
|
||||
$radioarray = array();
|
||||
$radioarray[] = MoodleQuickForm::createElement('static', 'deletedinfo', '',
|
||||
$radioarray[] = $mform->createElement('static', 'deletedinfo', '',
|
||||
$OUTPUT->container(get_string('deletedhostinfo', 'mnet'), 'deletedhostinfo'));
|
||||
$radioarray[] = MoodleQuickForm::createElement('radio', 'deleted', '', get_string('yes'), 1);
|
||||
$radioarray[] = MoodleQuickForm::createElement('radio', 'deleted', '', get_string('no'), 0);
|
||||
$radioarray[] = $mform->createElement('radio', 'deleted', '', get_string('yes'), 1);
|
||||
$radioarray[] = $mform->createElement('radio', 'deleted', '', get_string('no'), 0);
|
||||
$mform->addGroup($radioarray, 'radioar', get_string('deleted'), array(' ', ' '), false);
|
||||
} else {
|
||||
$mform->addElement('hidden', 'deleted');
|
||||
|
@ -76,7 +76,7 @@ class block_quiz_results extends block_base {
|
||||
return $cm->instance;
|
||||
}
|
||||
|
||||
function instance_config_save($data) {
|
||||
function instance_config_save($data, $nolongerused = false) {
|
||||
if (empty($data->quizid)) {
|
||||
$data->quizid = $this->get_owning_quiz();
|
||||
}
|
||||
|
@ -497,7 +497,7 @@ function calendar_get_upcoming($courses, $groups, $users, $daysinfuture, $maxeve
|
||||
|
||||
if ($events !== false) {
|
||||
|
||||
$modinfo =& get_fast_modinfo($COURSE);
|
||||
$modinfo = get_fast_modinfo($COURSE);
|
||||
|
||||
foreach($events as $event) {
|
||||
|
||||
|
@ -932,7 +932,7 @@ function print_recent_activity($course) {
|
||||
|
||||
/// Next, have there been any modifications to the course structure?
|
||||
|
||||
$modinfo =& get_fast_modinfo($course);
|
||||
$modinfo = get_fast_modinfo($course);
|
||||
|
||||
$changelist = array();
|
||||
|
||||
|
@ -82,7 +82,7 @@ echo $OUTPUT->heading(format_string($course->fullname) . ": $userinfo", 2);
|
||||
|
||||
$mform->display();
|
||||
|
||||
$modinfo =& get_fast_modinfo($course);
|
||||
$modinfo = get_fast_modinfo($course);
|
||||
get_all_mods($course->id, $mods, $modnames, $modnamesplural, $modnamesused);
|
||||
|
||||
if (has_capability('moodle/course:viewhiddensections', $context)) {
|
||||
|
@ -226,12 +226,12 @@
|
||||
// Course wrapper start.
|
||||
echo html_writer::start_tag('div', array('class'=>'course-content'));
|
||||
|
||||
$modinfo =& get_fast_modinfo($COURSE);
|
||||
$modinfo = get_fast_modinfo($COURSE);
|
||||
get_all_mods($course->id, $mods, $modnames, $modnamesplural, $modnamesused);
|
||||
foreach($mods as $modid=>$unused) {
|
||||
if (!isset($modinfo->cms[$modid])) {
|
||||
rebuild_course_cache($course->id);
|
||||
$modinfo =& get_fast_modinfo($COURSE);
|
||||
$modinfo = get_fast_modinfo($COURSE);
|
||||
debugging('Rebuilding course cache', DEBUG_DEVELOPER);
|
||||
break;
|
||||
}
|
||||
|
@ -73,8 +73,8 @@ class grade_export_form extends moodleform {
|
||||
|
||||
if (!empty($features['includeseparator'])) {
|
||||
$radio = array();
|
||||
$radio[] = &MoodleQuickForm::createElement('radio', 'separator', null, get_string('septab', 'grades'), 'tab');
|
||||
$radio[] = &MoodleQuickForm::createElement('radio', 'separator', null, get_string('sepcomma', 'grades'), 'comma');
|
||||
$radio[] = $mform->createElement('radio', 'separator', null, get_string('septab', 'grades'), 'tab');
|
||||
$radio[] = $mform->createElement('radio', 'separator', null, get_string('sepcomma', 'grades'), 'comma');
|
||||
$mform->addGroup($radio, 'separator', get_string('separator', 'grades'), ' ', false);
|
||||
$mform->setDefault('separator', 'comma');
|
||||
}
|
||||
|
@ -46,8 +46,8 @@ class grade_import_form extends moodleform {
|
||||
|
||||
if (!empty($features['includeseparator'])) {
|
||||
$radio = array();
|
||||
$radio[] = &MoodleQuickForm::createElement('radio', 'separator', null, get_string('septab', 'grades'), 'tab');
|
||||
$radio[] = &MoodleQuickForm::createElement('radio', 'separator', null, get_string('sepcomma', 'grades'), 'comma');
|
||||
$radio[] = $mform->createElement('radio', 'separator', null, get_string('septab', 'grades'), 'tab');
|
||||
$radio[] = $mform->createElement('radio', 'separator', null, get_string('sepcomma', 'grades'), 'comma');
|
||||
$mform->addGroup($radio, 'separator', get_string('separator', 'grades'), ' ', false);
|
||||
$mform->setDefault('separator', 'comma');
|
||||
}
|
||||
|
@ -226,10 +226,13 @@ class block_manager {
|
||||
|
||||
$pageformat = $this->page->pagetype;
|
||||
foreach($allblocks as $block) {
|
||||
if (!$bi = block_instance($block->name)) {
|
||||
continue;
|
||||
}
|
||||
if ($block->visible &&
|
||||
(block_method_result($block->name, 'instance_allow_multiple') || !$this->is_block_present($block->name)) &&
|
||||
($bi->instance_allow_multiple() || !$this->is_block_present($block->name)) &&
|
||||
blocks_name_allowed_in_format($block->name, $pageformat) &&
|
||||
block_method_result($block->name, 'user_can_addto', $this->page)) {
|
||||
$bi->user_can_addto($this->page)) {
|
||||
$this->addableblocks[$block->name] = $block;
|
||||
}
|
||||
}
|
||||
@ -1850,7 +1853,11 @@ function blocks_remove_inappropriate($course) {
|
||||
function blocks_name_allowed_in_format($name, $pageformat) {
|
||||
$accept = NULL;
|
||||
$maxdepth = -1;
|
||||
$formats = block_method_result($name, 'applicable_formats');
|
||||
if (!$bi = block_instance($name)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$formats = $bi->applicable_formats();
|
||||
if (!$formats) {
|
||||
$formats = array();
|
||||
}
|
||||
|
@ -289,7 +289,7 @@ class csv_import_reader {
|
||||
* @param string separator name
|
||||
* @return string encoded delimiter char
|
||||
*/
|
||||
function get_encoded_delimiter($delimiter_name) {
|
||||
static function get_encoded_delimiter($delimiter_name) {
|
||||
global $CFG;
|
||||
if ($delimiter_name == 'cfg' and isset($CFG->CSV_ENCODE)) {
|
||||
return $CFG->CSV_ENCODE;
|
||||
@ -305,7 +305,7 @@ class csv_import_reader {
|
||||
* @param string who imports?
|
||||
* @return int iid
|
||||
*/
|
||||
function get_new_iid($type) {
|
||||
static function get_new_iid($type) {
|
||||
global $USER;
|
||||
|
||||
$filename = make_temp_directory('csvimport/'.$type.'/'.$USER->id);
|
||||
|
@ -1733,9 +1733,10 @@ abstract class enrol_plugin {
|
||||
* Returns true if the plugin has one or more bulk operations that can be performed on
|
||||
* user enrolments.
|
||||
*
|
||||
* @param course_enrolment_manager $manager
|
||||
* @return bool
|
||||
*/
|
||||
public function has_bulk_operations() {
|
||||
public function has_bulk_operations(course_enrolment_manager $manager) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1743,9 +1744,10 @@ abstract class enrol_plugin {
|
||||
* Return an array of enrol_bulk_enrolment_operation objects that define
|
||||
* the bulk actions that can be performed on user enrolments by the plugin.
|
||||
*
|
||||
* @param course_enrolment_manager $manager
|
||||
* @return array
|
||||
*/
|
||||
public function get_bulk_operations() {
|
||||
public function get_bulk_operations(course_enrolment_manager $manager) {
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
@ -400,7 +400,7 @@ class grade_grade extends grade_object {
|
||||
* @param array $items array of all grade item ids
|
||||
* @return void
|
||||
*/
|
||||
public function check_locktime_all($items) {
|
||||
public static function check_locktime_all($items) {
|
||||
global $CFG, $DB;
|
||||
|
||||
$now = time(); // no rounding needed, this is not supposed to be called every 10 seconds
|
||||
|
@ -244,7 +244,7 @@ class grade_scale extends grade_object {
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
public function fetch_all_global() {
|
||||
public static function fetch_all_global() {
|
||||
return grade_scale::fetch_all(array('courseid'=>0));
|
||||
}
|
||||
|
||||
|
@ -77,8 +77,8 @@ final class portfolio_export_form extends moodleform {
|
||||
&& $this->_customdata['expectedtime'] != PORTFOLIO_TIME_LOW
|
||||
&& $this->_customdata['expectedtime'] != PORTFOLIO_TIME_FORCEQUEUE) {
|
||||
$radioarray = array();
|
||||
$radioarray[] = &MoodleQuickForm::createElement('radio', 'wait', '', get_string('wait', 'portfolio'), 1);
|
||||
$radioarray[] = &MoodleQuickForm::createElement('radio', 'wait', '', get_string('dontwait', 'portfolio'), 0);
|
||||
$radioarray[] = $mform->createElement('radio', 'wait', '', get_string('wait', 'portfolio'), 1);
|
||||
$radioarray[] = $mform->createElement('radio', 'wait', '', get_string('dontwait', 'portfolio'), 0);
|
||||
$mform->addGroup($radioarray, 'radioar', get_string('wanttowait_' . $this->_customdata['expectedtime'], 'portfolio') , array(' '), false);
|
||||
$mform->setDefault('wait', 0);
|
||||
} else {
|
||||
|
@ -1705,7 +1705,8 @@ function upgrade_plugin_mnet_functions($component) {
|
||||
* @return array
|
||||
*/
|
||||
function admin_mnet_method_profile(Zend_Server_Reflection_Function_Abstract $function) {
|
||||
$proto = array_pop($function->getPrototypes());
|
||||
$protos = $function->getPrototypes();
|
||||
$proto = array_pop($protos);
|
||||
$ret = $proto->getReturnValue();
|
||||
$profile = array(
|
||||
'parameters' => array(),
|
||||
|
@ -267,7 +267,7 @@ function chat_print_recent_activity($course, $viewfullnames, $timestart) {
|
||||
|
||||
$past = array();
|
||||
$current = array();
|
||||
$modinfo =& get_fast_modinfo($course); // reference needed because we might load the groups
|
||||
$modinfo = get_fast_modinfo($course); // reference needed because we might load the groups
|
||||
|
||||
foreach ($mcms as $cmid=>$mcm) {
|
||||
if (!array_key_exists($cmid, $modinfo->cms)) {
|
||||
|
@ -344,7 +344,7 @@ function feedback_get_recent_mod_activity(&$activities, &$index,
|
||||
$course = $DB->get_record('course', array('id'=>$courseid));
|
||||
}
|
||||
|
||||
$modinfo =& get_fast_modinfo($course);
|
||||
$modinfo = get_fast_modinfo($course);
|
||||
|
||||
$cm = $modinfo->cms[$cmid];
|
||||
|
||||
|
@ -116,7 +116,7 @@ $forums = $DB->get_records('forum', array('course' => $course->id));
|
||||
|
||||
$generalforums = array();
|
||||
$learningforums = array();
|
||||
$modinfo =& get_fast_modinfo($course);
|
||||
$modinfo = get_fast_modinfo($course);
|
||||
|
||||
if (!isset($modinfo->instances['forum'])) {
|
||||
$modinfo->instances['forum'] = array();
|
||||
|
@ -1373,7 +1373,7 @@ function forum_print_recent_activity($course, $viewfullnames, $timestart) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$modinfo =& get_fast_modinfo($course);
|
||||
$modinfo = get_fast_modinfo($course);
|
||||
|
||||
$groupmodes = array();
|
||||
$cms = array();
|
||||
@ -1858,7 +1858,7 @@ function forum_get_readable_forums($userid, $courseid=0) {
|
||||
|
||||
foreach ($courses as $course) {
|
||||
|
||||
$modinfo =& get_fast_modinfo($course);
|
||||
$modinfo = get_fast_modinfo($course);
|
||||
if (is_null($modinfo->groups)) {
|
||||
$modinfo->groups = groups_get_user_groups($course->id, $userid);
|
||||
}
|
||||
@ -2442,7 +2442,7 @@ function forum_count_discussions($forum, $cm, $course) {
|
||||
|
||||
require_once($CFG->dirroot.'/course/lib.php');
|
||||
|
||||
$modinfo =& get_fast_modinfo($course);
|
||||
$modinfo = get_fast_modinfo($course);
|
||||
if (is_null($modinfo->groups)) {
|
||||
$modinfo->groups = groups_get_user_groups($course->id, $USER->id);
|
||||
}
|
||||
@ -5750,7 +5750,7 @@ function forum_get_recent_mod_activity(&$activities, &$index, $timestart, $cours
|
||||
$course = $DB->get_record('course', array('id' => $courseid));
|
||||
}
|
||||
|
||||
$modinfo =& get_fast_modinfo($course);
|
||||
$modinfo = get_fast_modinfo($course);
|
||||
|
||||
$cm = $modinfo->cms[$cmid];
|
||||
$params = array($timestart, $cm->instance);
|
||||
@ -6451,7 +6451,7 @@ function forum_tp_count_forum_unread_posts($cm, $course) {
|
||||
|
||||
require_once($CFG->dirroot.'/course/lib.php');
|
||||
|
||||
$modinfo =& get_fast_modinfo($course);
|
||||
$modinfo = get_fast_modinfo($course);
|
||||
if (is_null($modinfo->groups)) {
|
||||
$modinfo->groups = groups_get_user_groups($course->id, $USER->id);
|
||||
}
|
||||
|
@ -756,7 +756,7 @@ function quiz_get_recent_mod_activity(&$activities, &$index, $timestart,
|
||||
$course = $DB->get_record('course', array('id' => $courseid));
|
||||
}
|
||||
|
||||
$modinfo =& get_fast_modinfo($course);
|
||||
$modinfo = get_fast_modinfo($course);
|
||||
|
||||
$cm = $modinfo->cms[$cmid];
|
||||
$quiz = $DB->get_record('quiz', array('id' => $cm->instance));
|
||||
|
@ -288,7 +288,7 @@ function wiki_print_recent_activity($course, $viewfullnames, $timestart) {
|
||||
if (!$pages = $DB->get_records_sql($sql, array($timestart, $course->id))) {
|
||||
return false;
|
||||
}
|
||||
$modinfo =& get_fast_modinfo($course);
|
||||
$modinfo = get_fast_modinfo($course);
|
||||
|
||||
$wikis = array();
|
||||
|
||||
|
@ -343,7 +343,7 @@ function workshop_print_recent_activity($course, $viewfullnames, $timestart) {
|
||||
|
||||
$rs = $DB->get_recordset_sql($sql, array($course->id, $timestart, $timestart));
|
||||
|
||||
$modinfo =& get_fast_modinfo($course); // reference needed because we might load the groups
|
||||
$modinfo = get_fast_modinfo($course); // reference needed because we might load the groups
|
||||
|
||||
$submissions = array(); // recent submissions indexed by submission id
|
||||
$assessments = array(); // recent assessments indexed by assessment id
|
||||
@ -552,7 +552,7 @@ function workshop_get_recent_mod_activity(&$activities, &$index, $timestart, $co
|
||||
$course = $DB->get_record('course', array('id'=>$courseid));
|
||||
}
|
||||
|
||||
$modinfo =& get_fast_modinfo($course);
|
||||
$modinfo = get_fast_modinfo($course);
|
||||
|
||||
$cm = $modinfo->cms[$cmid];
|
||||
|
||||
|
@ -41,7 +41,7 @@ class repository_coursefiles extends repository {
|
||||
* @param string $encodedpath
|
||||
* @return mixed
|
||||
*/
|
||||
public function get_listing($encodedpath = '') {
|
||||
public function get_listing($encodedpath = '', $page = '') {
|
||||
global $CFG, $USER, $OUTPUT;
|
||||
$ret = array();
|
||||
$ret['dynload'] = true;
|
||||
|
@ -77,7 +77,7 @@ if ($token==="$inttoken") {
|
||||
|
||||
//find the context id
|
||||
if ($course = $DB->get_record('course', array('id' => $courseid))) {
|
||||
$modinfo =& get_fast_modinfo($course);
|
||||
$modinfo = get_fast_modinfo($course);
|
||||
|
||||
if (!isset($modinfo->instances[$componentname])) {
|
||||
$modinfo->instances[$componentname] = array();
|
||||
|
@ -72,7 +72,7 @@ class user_filter_checkbox extends user_filter_type {
|
||||
*
|
||||
* @param moodleform $mform a MoodleQuickForm object in which element will be added
|
||||
*/
|
||||
public function setupForm(MoodleQuickForm &$mform) {
|
||||
public function setupForm(&$mform) {
|
||||
$objs = array();
|
||||
|
||||
$objs[] = $mform->createElement('checkbox', $this->_name, null, '');
|
||||
|
@ -67,7 +67,7 @@ class webservice_xmlrpc_client extends Zend_XmlRpc_Client {
|
||||
* @param array $params the parameters of the function
|
||||
* @return mixed
|
||||
*/
|
||||
public function call($functionname, $params) {
|
||||
public function call($functionname, $params=array()) {
|
||||
global $DB, $CFG;
|
||||
|
||||
//zend expects 0 based array with numeric indexes
|
||||
|
Loading…
x
Reference in New Issue
Block a user