Merge branch 'w12_MDL-32094_m23_phpstrict' of git://github.com/skodak/moodle

This commit is contained in:
Sam Hemelryk
2012-03-20 16:47:17 +13:00
91 changed files with 236 additions and 200 deletions
+3
View File
@@ -81,6 +81,9 @@ if (check_browser_version('MSIE')) {
@header('Content-Type: text/plain; charset=utf-8');
}
// we do not want html markup in emulated CLI
@ini_set('html_errors', 'off');
// execute the cron
cron_run();
+2 -1
View File
@@ -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
+3 -3
View File
@@ -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');
+5
View File
@@ -27,6 +27,11 @@ define('NO_OUTPUT_BUFFERING', true);
require(dirname(__FILE__) . '/../../../config.php');
require_once($CFG->libdir.'/adminlib.php');
// unfortunately outdated SimpleTest is not E_STRICT compatible
$CFG->debug = ($CFG->debug & ~E_STRICT);
error_reporting($CFG->debug);
require_once('simpletestlib.php');
require_once('simpletestcoveragelib.php');
require_once('ex_simple_test.php');
+7 -5
View File
@@ -28,16 +28,18 @@ define('NO_OUTPUT_BUFFERING', true);
require(dirname(__FILE__) . '/../../../config.php');
require_once($CFG->libdir.'/adminlib.php');
// Always run the unit tests in developer debug mode.
// unfortunately outdated SimpleTest is not E_STRICT compatible
$CFG->debug = (DEBUG_DEVELOPER & ~E_STRICT);
error_reporting($CFG->debug);
raise_memory_limit(MEMORY_EXTRA);
require_once('simpletestlib.php');
require_once('simpletestcoveragelib.php');
require_once('ex_simple_test.php');
require_once('ex_reporter.php');
// Always run the unit tests in developer debug mode.
$CFG->debug = DEBUG_DEVELOPER;
error_reporting($CFG->debug);
raise_memory_limit(MEMORY_EXTRA);
// page parameters
$path = optional_param('path', null, PARAM_PATH);
$showpasses = optional_param('showpasses', false, PARAM_BOOL);
@@ -54,18 +54,11 @@ class XMLDBAction {
var $sesskey_protected; // Actions must be protected by sesskey mechanism
/**
* Constructor
*/
function XMLDBAction() {
$this->init();
}
/**
* Constructor to keep PHP5 happy
*/
function __construct() {
$this->XMLDBAction();
$this->init();
}
/**
+1 -1
View File
@@ -215,7 +215,7 @@ class auth_plugin_cas extends auth_plugin_ldap {
* @param object object with submitted configuration settings (without system magic quotes)
* @param array $err array of error messages
*/
function validate_form(&$form, &$err) {
function validate_form($form, &$err) {
$certificate_path = trim($form->certificate_path);
if ($form->certificate_check && empty($certificate_path)) {
$err['certificate_path'] = get_string('auth_cas_certificate_path_empty', 'auth_cas');
+1 -1
View File
@@ -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();
}
+1 -1
View File
@@ -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) {
+1 -1
View File
@@ -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();
+1 -1
View File
@@ -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)) {
+2 -2
View File
@@ -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;
}
+2 -2
View File
@@ -355,7 +355,7 @@ class grade_edit_tree {
* @param string type "extra" or "weight": the type of the column hosting the weight input
* @return string HTML
*/
function get_weight_input($item, $type) {
static function get_weight_input($item, $type) {
global $OUTPUT;
if (!is_object($item) || get_class($item) !== 'grade_item') {
@@ -387,7 +387,7 @@ class grade_edit_tree {
//Trims trailing zeros
//Used on the 'categories and items' page for grade items settings like aggregation co-efficient
//Grader report has its own decimal place settings so they are handled elsewhere
function format_number($number) {
static function format_number($number) {
$formatted = rtrim(format_float($number, 4),'0');
if (substr($formatted, -1)=='.') { //if last char is the decimal point
$formatted .= '0';
+2 -2
View File
@@ -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');
}
+2 -2
View File
@@ -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');
}
+1 -1
View File
@@ -1207,7 +1207,7 @@ class grade_report_grader extends grade_report {
foreach ($this->gtree->items as $itemid=>$unused) {
// emulate grade element
$item =& $this->gtree->get_item($itemid);
$item = $this->gtree->get_item($itemid);
$eid = $this->gtree->get_item_eid($item);
$element = $this->gtree->locate_element($eid);
+1 -1
View File
@@ -366,7 +366,7 @@ class auth_plugin_base {
* @param object object with submitted configuration settings (without system magic quotes)
* @param array $err array of error messages
*/
function validate_form(&$form, &$err) {
function validate_form($form, &$err) {
//override if needed
}
+10 -3
View File
@@ -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();
}
+1 -1
View File
@@ -356,7 +356,7 @@ function cron_run() {
require_once($CFG->dirroot . '/blog/lib.php');
mtrace("Fetching external blog entries...", '');
$sql = "timefetched < ? OR timefetched = 0";
$externalblogs = $DB->get_records_select('blog_external', $sql, array(mktime() - $CFG->externalblogcrontime));
$externalblogs = $DB->get_records_select('blog_external', $sql, array(time() - $CFG->externalblogcrontime));
foreach ($externalblogs as $eb) {
blog_sync_external_entries($eb);
+2 -2
View File
@@ -1249,7 +1249,7 @@ class css_rule {
list($name, $value) = array_map('trim', $bits);
}
if (isset($name) && isset($value) && $name !== '' && $value !== '') {
$style = css_style::init($name, $value);
$style = css_style::init_automatic($name, $value);
}
} else if ($style instanceof css_style) {
// Clone the style as it may be coming from another rule and we don't
@@ -1646,7 +1646,7 @@ abstract class css_style {
* @param string $value The value of the style.
* @return css_style_generic
*/
public static function init($name, $value) {
public static function init_automatic($name, $value) {
$specificclass = 'css_style_'.preg_replace('#[^a-zA-Z0-9]+#', '', $name);
if (class_exists($specificclass)) {
return $specificclass::init($value);
+2 -2
View File
@@ -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);
+4 -2
View File
@@ -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();
}
}
+5 -4
View File
@@ -102,12 +102,13 @@ class MoodleQuickForm_date_selector extends MoodleQuickForm_group
for ($i=$this->_options['startyear']; $i<=$this->_options['stopyear']; $i++) {
$years[$i] = $i;
}
$this->_elements[] =& MoodleQuickForm::createElement('select', 'day', get_string('day', 'form'), $days, $this->getAttributes(), true);
$this->_elements[] =& MoodleQuickForm::createElement('select', 'month', get_string('month', 'form'), $months, $this->getAttributes(), true);
$this->_elements[] =& MoodleQuickForm::createElement('select', 'year', get_string('year', 'form'), $years, $this->getAttributes(), true);
// E_STRICT creating elements without forms is nasty because it internally uses $this
$this->_elements[] = @MoodleQuickForm::createElement('select', 'day', get_string('day', 'form'), $days, $this->getAttributes(), true);
$this->_elements[] = @MoodleQuickForm::createElement('select', 'month', get_string('month', 'form'), $months, $this->getAttributes(), true);
$this->_elements[] = @MoodleQuickForm::createElement('select', 'year', get_string('year', 'form'), $years, $this->getAttributes(), true);
// If optional we add a checkbox which the user can use to turn if on
if($this->_options['optional']) {
$this->_elements[] =& MoodleQuickForm::createElement('checkbox', 'enabled', null, get_string('enable'), $this->getAttributes(), true);
$this->_elements[] =@MoodleQuickForm::createElement('checkbox', 'enabled', null, get_string('enable'), $this->getAttributes(), true);
}
foreach ($this->_elements as $element){
if (method_exists($element, 'setHiddenLabel')){
+9 -8
View File
@@ -109,19 +109,20 @@ class MoodleQuickForm_date_time_selector extends MoodleQuickForm_group{
for ($i=0; $i<60; $i+=$this->_options['step']) {
$minutes[$i] = sprintf("%02d",$i);
}
$this->_elements[] =& MoodleQuickForm::createElement('select', 'day', get_string('day', 'form'), $days, $this->getAttributes(), true);
$this->_elements[] =& MoodleQuickForm::createElement('select', 'month', get_string('month', 'form'), $months, $this->getAttributes(), true);
$this->_elements[] =& MoodleQuickForm::createElement('select', 'year', get_string('year', 'form'), $years, $this->getAttributes(), true);
// E_STRICT creating elements without forms is nasty because it internally uses $this
$this->_elements[] = @MoodleQuickForm::createElement('select', 'day', get_string('day', 'form'), $days, $this->getAttributes(), true);
$this->_elements[] = @MoodleQuickForm::createElement('select', 'month', get_string('month', 'form'), $months, $this->getAttributes(), true);
$this->_elements[] = @MoodleQuickForm::createElement('select', 'year', get_string('year', 'form'), $years, $this->getAttributes(), true);
if (right_to_left()) { // Switch order of elements for Right-to-Left
$this->_elements[] =& MoodleQuickForm::createElement('select', 'minute', get_string('minute', 'form'), $minutes, $this->getAttributes(), true);
$this->_elements[] =& MoodleQuickForm::createElement('select', 'hour', get_string('hour', 'form'), $hours, $this->getAttributes(), true);
$this->_elements[] = @MoodleQuickForm::createElement('select', 'minute', get_string('minute', 'form'), $minutes, $this->getAttributes(), true);
$this->_elements[] = @MoodleQuickForm::createElement('select', 'hour', get_string('hour', 'form'), $hours, $this->getAttributes(), true);
} else {
$this->_elements[] =& MoodleQuickForm::createElement('select', 'hour', get_string('hour', 'form'), $hours, $this->getAttributes(), true);
$this->_elements[] =& MoodleQuickForm::createElement('select', 'minute', get_string('minute', 'form'), $minutes, $this->getAttributes(), true);
$this->_elements[] = @MoodleQuickForm::createElement('select', 'hour', get_string('hour', 'form'), $hours, $this->getAttributes(), true);
$this->_elements[] = @MoodleQuickForm::createElement('select', 'minute', get_string('minute', 'form'), $minutes, $this->getAttributes(), true);
}
// If optional we add a checkbox which the user can use to turn if on
if($this->_options['optional']) {
$this->_elements[] =& MoodleQuickForm::createElement('checkbox', 'enabled', null, get_string('enable'), $this->getAttributes(), true);
$this->_elements[] = @MoodleQuickForm::createElement('checkbox', 'enabled', null, get_string('enable'), $this->getAttributes(), true);
}
foreach ($this->_elements as $element){
if (method_exists($element, 'setHiddenLabel')){
+7 -6
View File
@@ -131,12 +131,13 @@ class MoodleQuickForm_duration extends MoodleQuickForm_group {
$attributes['size'] = 3;
}
$this->_elements = array();
$this->_elements[] = MoodleQuickForm::createElement('text', 'number', get_string('time', 'form'), $attributes, true);
// E_STRICT creating elements without forms is nasty because it internally uses $this
$this->_elements[] = @MoodleQuickForm::createElement('text', 'number', get_string('time', 'form'), $attributes, true);
unset($attributes['size']);
$this->_elements[] = MoodleQuickForm::createElement('select', 'timeunit', get_string('timeunit', 'form'), $this->get_units(), $attributes, true);
$this->_elements[] = @MoodleQuickForm::createElement('select', 'timeunit', get_string('timeunit', 'form'), $this->get_units(), $attributes, true);
// If optional we add a checkbox which the user can use to turn if on
if($this->_options['optional']) {
$this->_elements[] = MoodleQuickForm::createElement('checkbox', 'enabled', null, get_string('enable'), $this->getAttributes(), true);
$this->_elements[] = @MoodleQuickForm::createElement('checkbox', 'enabled', null, get_string('enable'), $this->getAttributes(), true);
}
foreach ($this->_elements as $element){
if (method_exists($element, 'setHiddenLabel')){
@@ -153,7 +154,7 @@ class MoodleQuickForm_duration extends MoodleQuickForm_group {
* @param object $caller calling object
* @return bool
*/
function onQuickFormEvent($event, $arg, $caller) {
function onQuickFormEvent($event, $arg, &$caller) {
switch ($event) {
case 'updateValue':
// constant values override both default and submitted ones
@@ -216,7 +217,7 @@ class MoodleQuickForm_duration extends MoodleQuickForm_group {
* @param bool $required Whether a group is required
* @param string $error An error message associated with a group
*/
function accept($renderer, $required = false, $error = null) {
function accept(&$renderer, $required = false, $error = null) {
$renderer->renderElement($this, $required, $error);
}
@@ -228,7 +229,7 @@ class MoodleQuickForm_duration extends MoodleQuickForm_group {
* @param bool $notused Not used.
* @return array field name => value. The value is the time interval in seconds.
*/
function exportValue($submitValues, $notused = false) {
function exportValue(&$submitValues, $notused = false) {
// Get the values from all the child elements.
$valuearray = array();
foreach ($this->_elements as $element) {
+2 -1
View File
@@ -361,8 +361,9 @@ class MoodleQuickForm_editor extends HTML_QuickForm_element {
if (count($formats)>1) {
$str.= html_writer::select($formats, $elname.'[format]', $format, false);
} else {
$keys = array_keys($formats);
$str.= html_writer::empty_tag('input',
array('name'=>$elname.'[format]', 'type'=> 'hidden', 'value' => array_pop(array_keys($formats))));
array('name'=>$elname.'[format]', 'type'=> 'hidden', 'value' => array_pop($keys)));
}
$str .= '</div>';
+1 -1
View File
@@ -57,7 +57,7 @@ class MoodleQuickForm_header extends HTML_QuickForm_header
*
* @param HTML_QuickForm_Renderer $renderer a HTML_QuickForm_Renderer object
*/
function accept(&$renderer)
function accept(&$renderer, $required=false, $error=null)
{
$this->_text .= $this->getHelpButton();
$renderer->renderHeader($this);
+4 -2
View File
@@ -150,7 +150,8 @@ class MoodleQuickForm_tags extends MoodleQuickForm_group {
// Create the element.
$size = min(5, count($officialtags));
$officialtagsselect = MoodleQuickForm::createElement('select', 'officialtags', $label, $officialtags, array('size' => $size));
// E_STRICT creating elements without forms is nasty because it internally uses $this
$officialtagsselect = @MoodleQuickForm::createElement('select', 'officialtags', $label, $officialtags, array('size' => $size));
$officialtagsselect->setMultiple(true);
if ($noofficial) {
$officialtagsselect->updateAttributes(array('disabled' => 'disabled'));
@@ -165,7 +166,8 @@ class MoodleQuickForm_tags extends MoodleQuickForm_group {
} else {
$label = get_string('entertags', 'tag');
}
$othertags = MoodleQuickForm::createElement('textarea', 'othertags', $label, array('cols'=>'40', 'rows'=>'5'));
// E_STRICT creating elements without forms is nasty because it internally uses $this
$othertags = @MoodleQuickForm::createElement('textarea', 'othertags', $label, array('cols'=>'40', 'rows'=>'5'));
$this->_elements[] = $othertags;
}
+4 -2
View File
@@ -62,7 +62,9 @@ function pear_handle_error($error){
}
if (!empty($CFG->debug) and $CFG->debug >= DEBUG_ALL){
PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'pear_handle_error');
//TODO: this is a wrong place to init PEAR!
$GLOBALS['_PEAR_default_error_mode'] = PEAR_ERROR_CALLBACK;
$GLOBALS['_PEAR_default_error_options'] = 'pear_handle_error';
}
/**
@@ -1638,7 +1640,7 @@ class MoodleQuickForm extends HTML_QuickForm_DHTMLRulesTableless {
}
foreach ($elementList as $elementName) {
$value = $this->exportValue($elementName);
if (PEAR::isError($value)) {
if (@PEAR::isError($value)) {
return $value;
}
//oh, stock QuickFOrm was returning array of arrays!
+2 -1
View File
@@ -1011,7 +1011,8 @@ class grade_category extends grade_object {
'children'=>$course_category->get_children($include_category_items));
$course_category->sortorder = $course_category->get_sortorder();
return grade_category::_fetch_course_tree_recursion($category_array, $course_category->get_sortorder());
$sortorder = $course_category->get_sortorder();
return grade_category::_fetch_course_tree_recursion($category_array, $sortorder);
}
/**
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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));
}
+6 -4
View File
@@ -329,7 +329,7 @@ class HTML_QuickForm extends HTML_Common {
* @access public
* @return void
*/
function registerElementType($typeName, $include, $className)
static function registerElementType($typeName, $include, $className)
{
$GLOBALS['HTML_QUICKFORM_ELEMENT_TYPES'][strtolower($typeName)] = array($include, $className);
} // end func registerElementType
@@ -348,7 +348,7 @@ class HTML_QuickForm extends HTML_Common {
* @access public
* @return void
*/
function registerRule($ruleName, $type, $data1, $data2 = null)
static function registerRule($ruleName, $type, $data1, $data2 = null)
{
include_once('HTML/QuickForm/RuleRegistry.php');
$registry =& HTML_QuickForm_RuleRegistry::singleton();
@@ -600,7 +600,7 @@ class HTML_QuickForm extends HTML_Common {
} else {
$args = func_get_args();
$elementObject =& $this->_loadElement('addElement', $element, array_slice($args, 1));
if (PEAR::isError($elementObject)) {
if (@PEAR::isError($elementObject)) {
return $elementObject;
}
}
@@ -1260,8 +1260,10 @@ class HTML_QuickForm extends HTML_Common {
* @param array $b array which will be merged into first one
* @return array merged array
*/
function arrayMerge($a, $b)
static function arrayMerge($a, $b)
{
if (is_null($a)) {$a = array();}
if (is_null($b)) {$b = array();}
foreach ($b as $k => $v) {
if (is_array($v)) {
if (isset($a[$k]) && !is_array($a[$k])) {
+1 -1
View File
@@ -44,7 +44,7 @@ class HTML_QuickForm_RuleRegistry
* @static
* @return object Reference to the HTML_QuickForm_RuleRegistry singleton
*/
function &singleton()
static function &singleton()
{
static $obj;
if (!isset($obj)) {
+16 -16
View File
@@ -27,15 +27,15 @@ require_once('HTML/QuickForm/checkbox.php');
* Basically this fixes a problem that HTML has had
* where checkboxes can only pass a single value (the
* value of the checkbox when checked). A value for when
* the checkbox is not checked cannot be passed, and
* the checkbox is not checked cannot be passed, and
* furthermore the checkbox variable doesn't even exist if
* the checkbox was submitted unchecked.
*
* It works by prepending a hidden field with the same name and
* another "unchecked" value to the checbox. If the checkbox is
* checked, PHP overwrites the value of the hidden field with
* its value.
*
* its value.
*
* @author Jason Rust <[email protected]>
* @since 2.0
* @access public
@@ -65,13 +65,13 @@ class HTML_QuickForm_advcheckbox extends HTML_QuickForm_checkbox
/**
* Class constructor
*
*
* @param string $elementName (optional)Input field name attribute
* @param string $elementLabel (optional)Input field label
* @param string $elementLabel (optional)Input field label
* @param string $text (optional)Text to put after the checkbox
* @param mixed $attributes (optional)Either a typical HTML attribute string
* @param mixed $attributes (optional)Either a typical HTML attribute string
* or an associative array
* @param mixed $values (optional)Values to pass if checked or not checked
* @param mixed $values (optional)Values to pass if checked or not checked
*
* @since 1.0
* @access public
@@ -82,7 +82,7 @@ class HTML_QuickForm_advcheckbox extends HTML_QuickForm_checkbox
$this->HTML_QuickForm_checkbox($elementName, $elementLabel, $text, $attributes);
$this->setValues($values);
} //end constructor
// }}}
// {{{ getPrivateName()
@@ -139,7 +139,7 @@ class HTML_QuickForm_advcheckbox extends HTML_QuickForm_checkbox
// give it default checkbox behavior
$this->_values = array('', 1);
} elseif (is_scalar($values)) {
// if it's string, then assume the value to
// if it's string, then assume the value to
// be passed is for when the element is checked
$this->_values = array('', $values);
} else {
@@ -154,7 +154,7 @@ class HTML_QuickForm_advcheckbox extends HTML_QuickForm_checkbox
/**
* Sets the element's value
*
*
* @param mixed Element's value
* @access public
*/
@@ -188,7 +188,7 @@ class HTML_QuickForm_advcheckbox extends HTML_QuickForm_checkbox
/**
* Returns the checkbox element in HTML
* and the additional hidden element in HTML
*
*
* @access public
* @return string
*/
@@ -198,14 +198,14 @@ class HTML_QuickForm_advcheckbox extends HTML_QuickForm_checkbox
return parent::toHtml();
} else {
return '<input' . $this->_getAttrString(array(
'type' => 'hidden',
'name' => $this->getName(),
'type' => 'hidden',
'name' => $this->getName(),
'value' => $this->_values[0]
)) . ' />' . parent::toHtml();
}
} //end func toHtml
// }}}
// {{{ getFrozenHtml()
@@ -262,7 +262,7 @@ class HTML_QuickForm_advcheckbox extends HTML_QuickForm_checkbox
* This element has a value even if it is not checked, thus we override
* checkbox's behaviour here
*/
function exportValue(&$submitValues, $assoc)
function exportValue(&$submitValues, $assoc = false)
{
$value = $this->_findValue($submitValues);
if (null === $value) {
+4 -4
View File
@@ -21,7 +21,7 @@
require_once 'HTML/QuickForm/static.php';
/**
* A pseudo-element used for adding headers to form
* A pseudo-element used for adding headers to form
*
* @author Alexey Borzov <[email protected]>
* @access public
@@ -32,7 +32,7 @@ class HTML_QuickForm_header extends HTML_QuickForm_static
/**
* Class constructor
*
*
* @param string $elementName Header name
* @param string $text Header text
* @access public
@@ -52,9 +52,9 @@ class HTML_QuickForm_header extends HTML_QuickForm_static
*
* @param object An HTML_QuickForm_Renderer object
* @access public
* @return void
* @return void
*/
function accept(&$renderer)
function accept(&$renderer, $required=false, $error=null)
{
$renderer->renderHeader($this);
} // end func accept
+7 -7
View File
@@ -23,7 +23,7 @@ require_once("HTML/QuickForm/input.php");
/**
* HTML class for a hidden type element
*
*
* @author Adam Daniel <[email protected]>
* @author Bertrand Mansion <[email protected]>
* @version 1.0
@@ -36,10 +36,10 @@ class HTML_QuickForm_hidden extends HTML_QuickForm_input
/**
* Class constructor
*
*
* @param string $elementName (optional)Input field name attribute
* @param string $value (optional)Input field value
* @param mixed $attributes (optional)Either a typical HTML attribute string
* @param mixed $attributes (optional)Either a typical HTML attribute string
* or an associative array
* @since 1.0
* @access public
@@ -51,13 +51,13 @@ class HTML_QuickForm_hidden extends HTML_QuickForm_input
$this->setType('hidden');
$this->setValue($value);
} //end constructor
// }}}
// {{{ freeze()
/**
* Freeze the element so that only its value is returned
*
*
* @access public
* @return void
*/
@@ -74,9 +74,9 @@ class HTML_QuickForm_hidden extends HTML_QuickForm_input
*
* @param object An HTML_QuickForm_Renderer object
* @access public
* @return void
* @return void
*/
function accept(&$renderer)
function accept(&$renderer, $required=false, $error=null)
{
$renderer->renderHidden($this);
} // end func accept
+8 -8
View File
@@ -29,7 +29,7 @@ require_once('HTML/QuickForm/select.php');
* selected values to be passed.
*
* @author Isaac Shepard <[email protected]>
*
*
* @version 1.0
* @since 2.1
* @access public
@@ -37,10 +37,10 @@ require_once('HTML/QuickForm/select.php');
class HTML_QuickForm_hiddenselect extends HTML_QuickForm_select
{
// {{{ constructor
/**
* Class constructor
*
*
* @param string Select name attribute
* @param mixed Label(s) for the select (not used)
* @param mixed Data to be used to populate options
@@ -58,7 +58,7 @@ class HTML_QuickForm_hiddenselect extends HTML_QuickForm_select
$this->load($options);
}
} //end constructor
// }}}
// {{{ toHtml()
@@ -68,7 +68,7 @@ class HTML_QuickForm_hiddenselect extends HTML_QuickForm_select
* @since 1.0
* @access public
* @return string
* @throws
* @throws
*/
function toHtml()
{
@@ -90,14 +90,14 @@ class HTML_QuickForm_hiddenselect extends HTML_QuickForm_select
return $strHtml;
} //end func toHtml
// }}}
// {{{ accept()
/**
* This is essentially a hidden element and should be rendered as one
* This is essentially a hidden element and should be rendered as one
*/
function accept(&$renderer)
function accept(&$renderer, $required=false, $error=null)
{
$renderer->renderHidden($this);
}
+4 -4
View File
@@ -22,7 +22,7 @@ require_once 'HTML/QuickForm/static.php';
/**
* A pseudo-element used for adding raw HTML to form
*
*
* Intended for use with the default renderer only, template-based
* ones may (and probably will) completely ignore this
*
@@ -35,7 +35,7 @@ class HTML_QuickForm_html extends HTML_QuickForm_static
/**
* Class constructor
*
*
* @param string $text raw HTML to add
* @access public
* @return void
@@ -54,9 +54,9 @@ class HTML_QuickForm_html extends HTML_QuickForm_static
*
* @param object An HTML_QuickForm_Renderer object
* @access public
* @return void
* @return void
*/
function accept(&$renderer)
function accept(&$renderer, $required=false, $error=null)
{
$renderer->renderHtml($this);
} // end func accept
+2 -2
View File
@@ -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 {
+2 -1
View File
@@ -1707,7 +1707,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(),
+3 -3
View File
@@ -2560,7 +2560,7 @@ class mod_assignment_grading_form extends moodleform {
}
}
function add_action_buttons() {
function add_action_buttons($cancel = true, $submitlabel = NULL) {
$mform =& $this->_form;
//if there are more to be graded.
if ($this->_customdata->nextid>0) {
@@ -3211,7 +3211,7 @@ function assignment_print_recent_activity($course, $viewfullnames, $timestart) {
return false;
}
$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
$show = array();
$grader = array();
@@ -3294,7 +3294,7 @@ function assignment_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];
@@ -18,7 +18,7 @@ class assignment_offline extends assignment_base {
return '';//does nothing!
}
function prepare_new_submission($userid) {
function prepare_new_submission($userid, $teachermodified=false) {
$submission = new stdClass();
$submission->assignment = $this->assignment->id;
$submission->userid = $userid;
@@ -37,7 +37,7 @@ class assignment_offline extends assignment_base {
}
// needed for the timemodified override
function process_feedback() {
function process_feedback($formdata=null) {
global $CFG, $USER, $DB;
require_once($CFG->libdir.'/gradelib.php');
@@ -214,8 +214,15 @@ class assignment_online extends assignment_base {
return $output;
}
function print_user_files($userid, $return=false) {
global $OUTPUT, $CFG;
function print_user_files($userid=0, $return=false) {
global $OUTPUT, $CFG, $USER;
if (!$userid) {
if (!isloggedin()) {
return '';
}
$userid = $USER->id;
}
if (!$submission = $this->get_submission($userid)) {
return '';
@@ -383,7 +383,7 @@ class assignment_upload extends assignment_base {
parent::submissions($mode);
}
function process_feedback() {
function process_feedback($formdata=null) {
if (!$feedback = data_submitted() or !confirm_sesskey()) { // No incoming data?
return false;
}
@@ -92,7 +92,7 @@ class assignment_uploadsingle extends assignment_base {
$this->view_footer();
}
function process_feedback() {
function process_feedback($formdata=null) {
if (!$feedback = data_submitted() or !confirm_sesskey()) { // No incoming data?
return false;
}
+1 -1
View File
@@ -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)) {
+4 -4
View File
@@ -27,10 +27,10 @@ class mod_choice_mod_form extends moodleform_mod {
//-------------------------------------------------------------------------------
$repeatarray = array();
$repeatarray[] = &MoodleQuickForm::createElement('header', '', get_string('option','choice').' {no}');
$repeatarray[] = &MoodleQuickForm::createElement('text', 'option', get_string('option','choice'));
$repeatarray[] = &MoodleQuickForm::createElement('text', 'limit', get_string('limit','choice'));
$repeatarray[] = &MoodleQuickForm::createElement('hidden', 'optionid', 0);
$repeatarray[] = $mform->createElement('header', '', get_string('option','choice').' {no}');
$repeatarray[] = $mform->createElement('text', 'option', get_string('option','choice'));
$repeatarray[] = $mform->createElement('text', 'limit', get_string('limit','choice'));
$repeatarray[] = $mform->createElement('hidden', 'optionid', 0);
$menuoptions = array();
$menuoptions[0] = get_string('disable');
+4 -4
View File
@@ -29,11 +29,11 @@ class mod_data_export_form extends moodleform {
unset($choices[$key]);
}
$typesarray = array();
$typesarray[] = &MoodleQuickForm::createElement('radio', 'exporttype', null, get_string('csvwithselecteddelimiter', 'data') . '&nbsp;', 'csv');
$typesarray[] = &MoodleQuickForm::createElement('select', 'delimiter_name', null, $choices);
$typesarray[] = $mform->createElement('radio', 'exporttype', null, get_string('csvwithselecteddelimiter', 'data') . '&nbsp;', 'csv');
$typesarray[] = $mform->createElement('select', 'delimiter_name', null, $choices);
//temporarily commenting out Excel export option. See MDL-19864
//$typesarray[] = &MoodleQuickForm::createElement('radio', 'exporttype', null, get_string('excel', 'data'), 'xls');
$typesarray[] = &MoodleQuickForm::createElement('radio', 'exporttype', null, get_string('ods', 'data'), 'ods');
//$typesarray[] = $mform->createElement('radio', 'exporttype', null, get_string('excel', 'data'), 'xls');
$typesarray[] = $mform->createElement('radio', 'exporttype', null, get_string('ods', 'data'), 'ods');
$mform->addGroup($typesarray, 'exportar', '', array(''), false);
$mform->addRule('exportar', null, 'required');
$mform->setDefault('exporttype', 'csv');
+1 -1
View File
@@ -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];
+1 -1
View File
@@ -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();
+5 -5
View File
@@ -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);
}
+7 -5
View File
@@ -830,7 +830,7 @@ abstract class lesson_add_page_form_base extends moodleform {
*
* @return bool
*/
public function construction_override() {
public function construction_override($pageid, lesson $lesson) {
return true;
}
}
@@ -1620,14 +1620,16 @@ abstract class lesson_base {
return !empty($this->properties->{$key});
}
//NOTE: E_STRICT does not allow to change function signature!
/**
* If overridden should create a new instance, save it in the DB and return it
* If implemented should create a new instance, save it in the DB and return it
*/
public static function create() {}
//public static function create() {}
/**
* If overridden should load an instance from the DB and return it
* If implemented should load an instance from the DB and return it
*/
public static function load() {}
//public static function load() {}
/**
* Fetches all of the properties of the object
* @return stdClass
+3 -3
View File
@@ -72,7 +72,7 @@ class lesson_page_type_branchtable extends lesson_page {
return $jumps;
}
public static function get_jumptooptions($firstpage, $lesson) {
public static function get_jumptooptions($firstpage, lesson $lesson) {
global $DB, $PAGE;
$jump = array();
$jump[0] = get_string("thispage", "lesson");
@@ -199,7 +199,7 @@ class lesson_page_type_branchtable extends lesson_page {
redirect(new moodle_url('/mod/lesson/view.php', array('id'=>$PAGE->cm->id,'pageid'=>$newpageid)));
}
public function display_answers($table) {
public function display_answers(html_table $table) {
$answers = $this->get_answers();
$options = new stdClass;
$options->noclean = true;
@@ -243,7 +243,7 @@ class lesson_page_type_branchtable extends lesson_page {
return $answerpage;
}
public function update($properties) {
public function update($properties, $context = null, $maxbytes = null) {
if (empty($properties->display)) {
$properties->display = '0';
}
+2 -2
View File
@@ -99,7 +99,7 @@ class lesson_page_type_endofbranch extends lesson_page {
public function get_grayout() {
return 1;
}
public function update($properties) {
public function update($properties, $context = null, $maxbytes = null) {
global $DB, $PAGE;
$properties->id = $this->properties->id;
@@ -178,7 +178,7 @@ class lesson_add_page_form_endofbranch extends lesson_add_page_form_base {
$this->add_jumpto(0);
}
public function construction_override($pageid, $lesson) {
public function construction_override($pageid, lesson $lesson) {
global $DB, $CFG, $PAGE;
require_sesskey();
+2 -2
View File
@@ -68,7 +68,7 @@ class lesson_page_type_endofcluster extends lesson_page {
public function get_grayout() {
return 1;
}
public function update($properties) {
public function update($properties, $context = null, $maxbytes = null) {
global $DB, $PAGE;
$properties->id = $this->properties->id;
@@ -160,7 +160,7 @@ class lesson_add_page_form_endofcluster extends lesson_add_page_form_base {
$this->add_jumpto(0);
}
public function construction_override($pageid, $lesson) {
public function construction_override($pageid, lesson $lesson) {
global $CFG, $PAGE, $DB;
require_sesskey();
+1 -1
View File
@@ -126,7 +126,7 @@ class lesson_page_type_essay extends lesson_page {
$result->studentanswer = s($studentanswer);
return $result;
}
public function update($properties) {
public function update($properties, $context = null, $maxbytes = null) {
global $DB, $PAGE;
$answers = $this->get_answers();
$properties->id = $this->properties->id;
+1 -1
View File
@@ -293,7 +293,7 @@ class lesson_page_type_matching extends lesson_page {
* @param stdClass $properties
* @return bool
*/
public function update($properties) {
public function update($properties, $context = null, $maxbytes = null) {
global $DB, $PAGE;
$answers = $this->get_answers();
$properties->id = $this->properties->id;
+1 -1
View File
@@ -153,7 +153,7 @@ class lesson_page_type_truefalse extends lesson_page {
* @param stdClass $properties
* @return bool
*/
public function update($properties) {
public function update($properties, $context = null, $maxbytes = null) {
global $DB, $PAGE;
$answers = $this->get_answers();
$properties->id = $this->properties->id;
+1 -1
View File
@@ -763,7 +763,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));
+4 -4
View File
@@ -317,10 +317,10 @@ class mod_quiz_mod_form extends moodleform_mod {
$repeatarray = array();
$repeatedoptions = array();
$repeatarray[] = MoodleQuickForm::createElement('editor', 'feedbacktext',
$repeatarray[] = $mform->createElement('editor', 'feedbacktext',
get_string('feedback', 'quiz'), null, array('maxfiles' => EDITOR_UNLIMITED_FILES,
'noclean' => true, 'context' => $this->context));
$repeatarray[] = MoodleQuickForm::createElement('text', 'feedbackboundaries',
$repeatarray[] = $mform->createElement('text', 'feedbackboundaries',
get_string('gradeboundary', 'quiz'), array('size' => 10));
$repeatedoptions['feedbacktext']['type'] = PARAM_RAW;
$repeatedoptions['feedbackboundaries']['type'] = PARAM_RAW;
@@ -338,12 +338,12 @@ class mod_quiz_mod_form extends moodleform_mod {
get_string('addmoreoverallfeedbacks', 'quiz'), true);
// Put some extra elements in before the button
$mform->insertElementBefore(MoodleQuickForm::createElement('editor',
$mform->insertElementBefore($mform->createElement('editor',
"feedbacktext[$nextel]", get_string('feedback', 'quiz'), null,
array('maxfiles' => EDITOR_UNLIMITED_FILES, 'noclean' => true,
'context' => $this->context)),
'boundary_add_fields');
$mform->insertElementBefore(MoodleQuickForm::createElement('static',
$mform->insertElementBefore($mform->createElement('static',
'gradeboundarystatic2', get_string('gradeboundary', 'quiz'), '0%'),
'boundary_add_fields');
+1 -1
View File
@@ -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();
+2 -2
View File
@@ -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];
+2 -2
View File
@@ -82,13 +82,13 @@ class qbehaviour_deferredcbm extends qbehaviour_deferredfeedback {
}
}
protected function is_same_response($pendingstep) {
protected function is_same_response(question_attempt_step $pendingstep) {
return parent::is_same_response($pendingstep) &&
$this->qa->get_last_behaviour_var('certainty') ==
$pendingstep->get_behaviour_var('certainty');
}
protected function is_complete_response($pendingstep) {
protected function is_complete_response(question_attempt_step $pendingstep) {
return parent::is_complete_response($pendingstep) &&
$pendingstep->has_behaviour_var('certainty');
}
@@ -80,13 +80,13 @@ class qbehaviour_immediatecbm extends qbehaviour_immediatefeedback {
}
}
protected function is_same_response($pendingstep) {
protected function is_same_response(question_attempt_step $pendingstep) {
return parent::is_same_response($pendingstep) &&
$this->qa->get_last_behaviour_var('certainty') ==
$pendingstep->get_behaviour_var('certainty');
}
protected function is_complete_response($pendingstep) {
protected function is_complete_response(question_attempt_step $pendingstep) {
return parent::is_complete_response($pendingstep) &&
$pendingstep->has_behaviour_var('certainty');
}
+2 -1
View File
@@ -73,7 +73,7 @@ class question_category_list extends moodle_list {
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class question_category_list_item extends list_item {
public function set_icon_html($first, $last, &$lastitem){
public function set_icon_html($first, $last, $lastitem){
global $CFG;
$category = $this->item;
$url = new moodle_url('/question/category.php', ($this->parentlist->pageurl->params() + array('edit'=>$category->id)));
@@ -155,6 +155,7 @@ class question_category_object {
$this->tab = str_repeat('&nbsp;', $this->tabsize);
$this->str = new stdClass();
$this->str->course = get_string('course');
$this->str->category = get_string('category', 'question');
$this->str->categoryinfo = get_string('categoryinfo', 'question');
+1 -1
View File
@@ -324,7 +324,7 @@ abstract class question_bank {
self::$testdata[$question->id] = $question;
}
protected function ensure_fraction_options_initialised() {
protected static function ensure_fraction_options_initialised() {
if (!is_null(self::$fractionoptions)) {
return;
}
+2 -2
View File
@@ -1277,10 +1277,10 @@ class question_attempt_with_restricted_history extends question_attempt {
protected function add_step(question_attempt_step $step) {
coding_exception('Cannot modify a question_attempt_with_restricted_history.');
}
public function process_action($submitteddata, $timestamp = null, $userid = null) {
public function process_action($submitteddata, $timestamp = null, $userid = null, $existingstepid = null) {
coding_exception('Cannot modify a question_attempt_with_restricted_history.');
}
public function start($preferredbehaviour, $variant, $submitteddata = array(), $timestamp = null, $userid = null) {
public function start($preferredbehaviour, $variant, $submitteddata = array(), $timestamp = null, $userid = null, $existingstepid = null) {
coding_exception('Cannot modify a question_attempt_with_restricted_history.');
}
+1 -1
View File
@@ -58,7 +58,7 @@ class qformat_aiken extends qformat_default {
return true;
}
public function readquestions($lines) {
public function readquestions($lines, $context) {
$questions = array();
$question = $this->defaultquestion();
$endchar = chr(13);
+1 -1
View File
@@ -41,7 +41,7 @@ class qformat_blackboard extends qformat_default {
return true;
}
function readquestions ($lines) {
function readquestions ($lines, $context) {
/// Parses an array of lines into an array of questions,
/// where each item is a question object as defined by
/// readquestion().
+1 -1
View File
@@ -243,7 +243,7 @@ class qformat_blackboard_six extends qformat_default {
function readquestions ($lines) {
protected function readquestions ($lines, $context) {
/// Parses an array of lines into an array of questions,
/// where each item is a question object as defined by
/// readquestion().
+1 -1
View File
@@ -149,7 +149,7 @@ class qformat_examview extends qformat_default {
return str_replace('&#x2019;', "'", $text);
}
function readquestions($lines) {
protected function readquestions($lines, $context) {
/// Parses an array of lines into an array of questions,
/// where each item is a question object as defined by
/// readquestion().
+1 -1
View File
@@ -46,7 +46,7 @@ class qformat_learnwise extends qformat_default {
return true;
}
function readquestions($lines) {
protected function readquestions($lines, $context) {
$questions = array();
$currentquestion = array();
+1 -1
View File
@@ -40,7 +40,7 @@ class qformat_multianswer extends qformat_default {
return true;
}
protected function readquestions($lines) {
protected function readquestions($lines, $context) {
// For this class the method has been simplified as
// there can never be more than one question for a
// multianswer import
+1 -1
View File
@@ -172,7 +172,7 @@ class qformat_webct extends qformat_default {
return true;
}
function readquestions ($lines) {
protected function readquestions($lines, $context) {
$webctnumberregex =
'[+-]?([0-9]+(\\.[0-9]*)?|\\.[0-9]+)((e|E|\\*10\\*\\*)([+-]?[0-9]+|\\([+-]?[0-9]+\\)))?';
+2 -1
View File
@@ -886,9 +886,10 @@ class qformat_xml extends qformat_default {
* this *could* burn memory - but it won't happen that much
* so fingers crossed!
* @param array of lines from the input file.
* @param stdClass $context
* @return array (of objects) question objects.
*/
protected function readquestions($lines) {
protected function readquestions($lines, $context) {
// We just need it as one big string
$text = implode($lines, ' ');
unset($lines);
@@ -162,8 +162,8 @@ class qtype_calculated_edit_form extends qtype_numerical_edit_form {
return $question;
}
protected function data_preprocessing_answers($question) {
$question = parent::data_preprocessing_answers($question);
protected function data_preprocessing_answers($question, $withanswerfiles = false) {
$question = parent::data_preprocessing_answers($question, $withanswerfiles);
if (empty($question->options->answers)) {
return $question;
}
@@ -194,8 +194,8 @@ class qtype_calculatedmulti_edit_form extends question_edit_form {
return $question;
}
protected function data_preprocessing_answers($question) {
$question = parent::data_preprocessing_answers($question);
protected function data_preprocessing_answers($question, $withanswerfiles = false) {
$question = parent::data_preprocessing_answers($question, $withanswerfiles);
if (empty($question->options->answers)) {
return $question;
}
+1 -1
View File
@@ -190,7 +190,7 @@ class qtype_multianswer extends question_type {
parent::delete_question($questionid, $contextid);
}
protected function initialise_question_instance($question, $questiondata) {
protected function initialise_question_instance(question_definition $question, $questiondata) {
parent::initialise_question_instance($question, $questiondata);
$bits = preg_split('/\{#(\d+)\}/', $question->questiontext,
@@ -174,8 +174,8 @@ class qtype_numerical_edit_form extends question_edit_form {
return $question;
}
protected function data_preprocessing_answers($question) {
$question = parent::data_preprocessing_answers($question);
protected function data_preprocessing_answers($question, $withanswerfiles = false) {
$question = parent::data_preprocessing_answers($question, $withanswerfiles);
if (empty($question->options->answers)) {
return $question;
}
+1 -1
View File
@@ -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;
+2 -2
View File
@@ -1952,7 +1952,7 @@ final class repository_instance_form extends moodleform {
}
}
public function validation($data) {
public function validation($data, $files) {
global $DB;
$errors = array();
$plugin = $this->_customdata['plugin'];
@@ -2062,7 +2062,7 @@ final class repository_type_form extends moodleform {
$this->add_action_buttons(true, get_string('save','repository'));
}
public function validation($data) {
public function validation($data, $files) {
$errors = array();
$plugin = $this->_customdata['plugin'];
$instance = (isset($this->_customdata['instance'])
+1 -1
View File
@@ -41,7 +41,7 @@ class repository_local 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;
+1 -1
View File
@@ -68,7 +68,7 @@ class repository_merlot extends repository {
* Get a list of links
* @return array
*/
public function get_listing() {
public function get_listing($path = '', $page = '') {
$ret = array();
$ret['nologin'] = true;
$ret['list'] = $this->_get_collection($this->keyword);
+2 -2
View File
@@ -132,8 +132,8 @@ class repository_recent extends repository {
return array('recentfilesnumber', 'pluginname');
}
public function type_config_form($mform) {
parent::type_config_form($mform);
public function type_config_form($mform, $classname = 'repository') {
parent::type_config_form($mform, $classname);
$number = get_config('repository_recent', 'recentfilesnumber');
if (empty($number)) {
$number = DEFAULT_RECENT_FILES_NUM;
+1 -1
View File
@@ -50,7 +50,7 @@ class repository_s3 extends repository {
* @param string $path
* @return array The file list and options
*/
public function get_listing($path = '') {
public function get_listing($path = '', $page = '') {
global $CFG, $OUTPUT;
if (empty($this->access_key)) {
die(json_encode(array('e'=>get_string('needaccesskey', 'repository_s3'))));
+1 -1
View File
@@ -214,7 +214,7 @@ class repository_upload extends repository {
* Return a upload form
* @return array
*/
public function get_listing() {
public function get_listing($path = '', $page = '') {
global $CFG;
$ret = array();
$ret['nologin'] = true;
+1 -1
View File
@@ -41,7 +41,7 @@ class repository_user 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;
+1 -1
View File
@@ -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();
+1 -1
View File
@@ -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, '');
+1 -1
View File
@@ -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