MDL-52081 forms: Use __construct() for constructors

This commit is contained in:
Marina Glancy
2015-12-10 13:38:01 +08:00
parent 0dfcc2541a
commit 1a0df5535e
83 changed files with 1014 additions and 208 deletions
+1 -1
View File
@@ -54,7 +54,7 @@ class block_edit_form extends moodleform {
global $CFG;
$this->block = $block;
$this->page = $page;
parent::moodleform($actionurl);
parent::__construct($actionurl);
}
function definition() {
+1 -1
View File
@@ -36,7 +36,7 @@ class feed_edit_form extends moodleform {
function __construct($actionurl, $isadding, $caneditshared) {
$this->isadding = $isadding;
$this->caneditshared = $caneditshared;
parent::moodleform($actionurl);
parent::__construct($actionurl);
}
function definition() {
+12 -2
View File
@@ -58,7 +58,7 @@ abstract class moodleform_mod extends moodleform {
/** @var object The course format of the current course. */
protected $courseformat;
function moodleform_mod($current, $section, $cm, $course) {
public function __construct($current, $section, $cm, $course) {
global $CFG;
$this->current = $current;
@@ -83,7 +83,17 @@ abstract class moodleform_mod extends moodleform {
}
$this->_modname = $matches[1];
$this->init_features();
parent::moodleform('modedit.php');
parent::__construct('modedit.php');
}
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function moodleform_mod($current, $section, $cm, $course) {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct($current, $section, $cm, $course);
}
protected function init_features() {
+1 -1
View File
@@ -33,7 +33,7 @@ abstract class filter_local_settings_form extends moodleform {
public function __construct($submiturl, $filter, $context) {
$this->filter = $filter;
$this->context = $context;
parent::moodleform($submiturl);
parent::__construct($submiturl);
}
/**
+11 -1
View File
@@ -53,8 +53,18 @@ class moodlequickform_guideeditor extends HTML_QuickForm_input {
* @param string $elementlabel
* @param array $attributes
*/
public function __construct($elementname=null, $elementlabel=null, $attributes=null) {
parent::__construct($elementname, $elementlabel, $attributes);
}
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function moodlequickform_guideeditor($elementname=null, $elementlabel=null, $attributes=null) {
parent::HTML_QuickForm_input($elementname, $elementlabel, $attributes);
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct($elementname, $elementlabel, $attributes);
}
/**
+12 -2
View File
@@ -60,8 +60,18 @@ class MoodleQuickForm_rubriceditor extends HTML_QuickForm_input {
* @param string $elementLabel
* @param array $attributes
*/
function MoodleQuickForm_rubriceditor($elementName=null, $elementLabel=null, $attributes=null) {
parent::HTML_QuickForm_input($elementName, $elementLabel, $attributes);
public function __construct($elementName=null, $elementLabel=null, $attributes=null) {
parent::__construct($elementName, $elementLabel, $attributes);
}
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function MoodleQuickForm_rubriceditor($elementName=null, $elementLabel=null, $attributes=null) {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct($elementName, $elementLabel, $attributes);
}
/**
+12 -2
View File
@@ -55,7 +55,7 @@ class MoodleQuickForm_advcheckbox extends HTML_QuickForm_advcheckbox{
* or an associative array
* @param mixed $values (optional) Values to pass if checked or not checked
*/
function MoodleQuickForm_advcheckbox($elementName=null, $elementLabel=null, $text=null, $attributes=null, $values=null)
public function __construct($elementName=null, $elementLabel=null, $text=null, $attributes=null, $values=null)
{
if ($values === null){
$values = array(0, 1);
@@ -81,7 +81,17 @@ class MoodleQuickForm_advcheckbox extends HTML_QuickForm_advcheckbox{
}
}
parent::HTML_QuickForm_advcheckbox($elementName, $elementLabel, $text, $attributes, $values);
parent::__construct($elementName, $elementLabel, $text, $attributes, $values);
}
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function MoodleQuickForm_advcheckbox($elementName=null, $elementLabel=null, $text=null, $attributes=null, $values=null) {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct($elementName, $elementLabel, $text, $attributes, $values);
}
/**
+12 -2
View File
@@ -60,7 +60,7 @@ class MoodleQuickForm_autocomplete extends MoodleQuickForm_select {
* @param mixed $attributes Either a typical HTML attribute string or an associative array. Special options
* "tags", "placeholder", "ajax", "multiple", "casesensitive" are supported.
*/
function MoodleQuickForm_autocomplete($elementName=null, $elementLabel=null, $options=null, $attributes=null) {
public function __construct($elementName=null, $elementLabel=null, $options=null, $attributes=null) {
// Even if the constructor gets called twice we do not really want 2x options (crazy forms!).
$this->_options = array();
if ($attributes === null) {
@@ -87,11 +87,21 @@ class MoodleQuickForm_autocomplete extends MoodleQuickForm_select {
$this->casesensitive = $attributes['casesensitive'] ? true : false;
unset($attributes['casesensitive']);
}
parent::HTML_QuickForm_select($elementName, $elementLabel, $options, $attributes);
parent::__construct($elementName, $elementLabel, $options, $attributes);
$this->_type = 'autocomplete';
}
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function MoodleQuickForm_autocomplete($elementName=null, $elementLabel=null, $options=null, $attributes=null) {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct($elementName, $elementLabel, $options, $attributes);
}
/**
* Returns HTML for select form element.
*
+12 -2
View File
@@ -50,8 +50,18 @@ class MoodleQuickForm_button extends HTML_QuickForm_button
* @param mixed $attributes (optional) Either a typical HTML attribute string
* or an associative array
*/
function MoodleQuickForm_button($elementName=null, $value=null, $attributes=null) {
parent::HTML_QuickForm_button($elementName, $value, $attributes);
public function __construct($elementName=null, $value=null, $attributes=null) {
parent::__construct($elementName, $value, $attributes);
}
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function MoodleQuickForm_button($elementName=null, $value=null, $attributes=null) {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct($elementName, $value, $attributes);
}
/**
+13 -4
View File
@@ -52,7 +52,7 @@ class MoodleQuickForm_cancel extends MoodleQuickForm_submit
* @param mixed $attributes (optional) Either a typical HTML attribute string
* or an associative array
*/
function MoodleQuickForm_cancel($elementName=null, $value=null, $attributes=null)
public function __construct($elementName=null, $value=null, $attributes=null)
{
if ($elementName==null){
$elementName='cancel';
@@ -60,7 +60,7 @@ class MoodleQuickForm_cancel extends MoodleQuickForm_submit
if ($value==null){
$value=get_string('cancel');
}
MoodleQuickForm_submit::MoodleQuickForm_submit($elementName, $value, $attributes);
parent::__construct($elementName, $value, $attributes);
$this->updateAttributes(array('onclick'=>'skipClientValidation = true; return true;'));
// Add the class btn-cancel.
@@ -71,6 +71,16 @@ class MoodleQuickForm_cancel extends MoodleQuickForm_submit
$this->updateAttributes(array('class' => $class . ' btn-cancel'));
}
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function MoodleQuickForm_cancel($elementName=null, $value=null, $attributes=null) {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct($elementName, $value, $attributes);
}
/**
* Called by HTML_QuickForm whenever form event is made on this element
*
@@ -83,8 +93,7 @@ class MoodleQuickForm_cancel extends MoodleQuickForm_submit
{
switch ($event) {
case 'createElement':
$className = get_class($this);
$this->$className($arg[0], $arg[1], $arg[2]);
static::__construct($arg[0], $arg[1], $arg[2]);
$caller->_registerCancelButton($this->getName());
return true;
break;
+12 -2
View File
@@ -52,8 +52,18 @@ class MoodleQuickForm_checkbox extends HTML_QuickForm_checkbox{
* @param mixed $attributes (optional) Either a typical HTML attribute string
* or an associative array
*/
function MoodleQuickForm_checkbox($elementName=null, $elementLabel=null, $text='', $attributes=null) {
parent::HTML_QuickForm_checkbox($elementName, $elementLabel, $text, $attributes);
public function __construct($elementName=null, $elementLabel=null, $text='', $attributes=null) {
parent::__construct($elementName, $elementLabel, $text, $attributes);
}
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function MoodleQuickForm_checkbox($elementName=null, $elementLabel=null, $text='', $attributes=null) {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct($elementName, $elementLabel, $text, $attributes);
}
/**
+12 -2
View File
@@ -75,12 +75,12 @@ class MoodleQuickForm_date_selector extends MoodleQuickForm_group {
* @param array $options Options to control the element's display
* @param mixed $attributes Either a typical HTML attribute string or an associative array
*/
function MoodleQuickForm_date_selector($elementName = null, $elementLabel = null, $options = array(), $attributes = null) {
public function __construct($elementName = null, $elementLabel = null, $options = array(), $attributes = null) {
// Get the calendar type used - see MDL-18375.
$calendartype = \core_calendar\type_factory::get_calendar_instance();
$this->_options = array('startyear' => $calendartype->get_min_year(), 'stopyear' => $calendartype->get_max_year(),
'defaulttime' => 0, 'timezone' => 99, 'step' => 5, 'optional' => false);
$this->HTML_QuickForm_element($elementName, $elementLabel, $attributes);
HTML_QuickForm_element::__construct($elementName, $elementLabel, $attributes);
$this->_persistantFreeze = true;
$this->_appendName = true;
$this->_type = 'date_selector';
@@ -103,6 +103,16 @@ class MoodleQuickForm_date_selector extends MoodleQuickForm_group {
}
}
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function MoodleQuickForm_date_selector($elementName = null, $elementLabel = null, $options = array(), $attributes = null) {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct($elementName, $elementLabel, $options, $attributes);
}
/**
* This will create date group element constisting of day, month and year.
*
+12 -2
View File
@@ -77,13 +77,13 @@ class MoodleQuickForm_date_time_selector extends MoodleQuickForm_group {
* @param array $options Options to control the element's display
* @param mixed $attributes Either a typical HTML attribute string or an associative array
*/
function MoodleQuickForm_date_time_selector($elementName = null, $elementLabel = null, $options = array(), $attributes = null) {
public function __construct($elementName = null, $elementLabel = null, $options = array(), $attributes = null) {
// Get the calendar type used - see MDL-18375.
$calendartype = \core_calendar\type_factory::get_calendar_instance();
$this->_options = array('startyear' => $calendartype->get_min_year(), 'stopyear' => $calendartype->get_max_year(),
'defaulttime' => 0, 'timezone' => 99, 'step' => 5, 'optional' => false);
$this->HTML_QuickForm_element($elementName, $elementLabel, $attributes);
HTML_QuickForm_element::__construct($elementName, $elementLabel, $attributes);
$this->_persistantFreeze = true;
$this->_appendName = true;
$this->_type = 'date_time_selector';
@@ -106,6 +106,16 @@ class MoodleQuickForm_date_time_selector extends MoodleQuickForm_group {
}
}
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function MoodleQuickForm_date_time_selector($elementName = null, $elementLabel = null, $options = array(), $attributes = null) {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct($elementName, $elementLabel, $options, $attributes);
}
/**
* This will create date group element constisting of day, month and year.
*
+12 -2
View File
@@ -63,8 +63,8 @@ class MoodleQuickForm_duration extends MoodleQuickForm_group {
* If not specified, minutes is used.
* @param mixed $attributes Either a typical HTML attribute string or an associative array
*/
function MoodleQuickForm_duration($elementName = null, $elementLabel = null, $options = array(), $attributes = null) {
$this->HTML_QuickForm_element($elementName, $elementLabel, $attributes);
public function __construct($elementName = null, $elementLabel = null, $options = array(), $attributes = null) {
HTML_QuickForm_element::__construct($elementName, $elementLabel, $attributes);
$this->_persistantFreeze = true;
$this->_appendName = true;
$this->_type = 'duration';
@@ -83,6 +83,16 @@ class MoodleQuickForm_duration extends MoodleQuickForm_group {
}
}
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function MoodleQuickForm_duration($elementName = null, $elementLabel = null, $options = array(), $attributes = null) {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct($elementName, $elementLabel, $options, $attributes);
}
/**
* Returns time associative array of unit length.
*
+12 -2
View File
@@ -68,7 +68,7 @@ class MoodleQuickForm_editor extends HTML_QuickForm_element {
* or an associative array
* @param array $options set of options to initalize filepicker
*/
function MoodleQuickForm_editor($elementName=null, $elementLabel=null, $attributes=null, $options=null) {
public function __construct($elementName=null, $elementLabel=null, $attributes=null, $options=null) {
global $CFG, $PAGE;
$options = (array)$options;
@@ -89,7 +89,7 @@ class MoodleQuickForm_editor extends HTML_QuickForm_element {
}
}
$this->_options['trusted'] = trusttext_trusted($this->_options['context']);
parent::HTML_QuickForm_element($elementName, $elementLabel, $attributes);
parent::__construct($elementName, $elementLabel, $attributes);
// Note: for some reason the code using this setting does not like bools.
$this->_options['subdirs'] = (int)($this->_options['subdirs'] == 1);
@@ -97,6 +97,16 @@ class MoodleQuickForm_editor extends HTML_QuickForm_element {
editors_head_setup();
}
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function MoodleQuickForm_editor($elementName=null, $elementLabel=null, $attributes=null, $options=null) {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct($elementName, $elementLabel, $attributes, $options);
}
/**
* Called by HTML_QuickForm whenever form event is made on this element
*
+12 -2
View File
@@ -60,7 +60,7 @@ class MoodleQuickForm_filemanager extends HTML_QuickForm_element {
* or an associative array
* @param array $options set of options to initalize filemanager
*/
function MoodleQuickForm_filemanager($elementName=null, $elementLabel=null, $attributes=null, $options=null) {
public function __construct($elementName=null, $elementLabel=null, $attributes=null, $options=null) {
global $CFG, $PAGE;
$options = (array)$options;
@@ -76,7 +76,17 @@ class MoodleQuickForm_filemanager extends HTML_QuickForm_element {
$this->_options['return_types'] = (FILE_INTERNAL | FILE_REFERENCE);
}
$this->_type = 'filemanager';
parent::HTML_QuickForm_element($elementName, $elementLabel, $attributes);
parent::__construct($elementName, $elementLabel, $attributes);
}
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function MoodleQuickForm_filemanager($elementName=null, $elementLabel=null, $attributes=null, $options=null) {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct($elementName, $elementLabel, $attributes, $options);
}
/**
+12 -2
View File
@@ -59,7 +59,7 @@ class MoodleQuickForm_filepicker extends HTML_QuickForm_input {
* or an associative array
* @param array $options set of options to initalize filepicker
*/
function MoodleQuickForm_filepicker($elementName=null, $elementLabel=null, $attributes=null, $options=null) {
public function __construct($elementName=null, $elementLabel=null, $attributes=null, $options=null) {
global $CFG, $PAGE;
$options = (array)$options;
@@ -81,7 +81,17 @@ class MoodleQuickForm_filepicker extends HTML_QuickForm_input {
}
$this->_options['maxbytes'] = get_user_max_upload_file_size($PAGE->context, $CFG->maxbytes, $coursemaxbytes, $fpmaxbytes);
$this->_type = 'filepicker';
parent::HTML_QuickForm_input($elementName, $elementLabel, $attributes);
parent::__construct($elementName, $elementLabel, $attributes);
}
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function MoodleQuickForm_filepicker($elementName=null, $elementLabel=null, $attributes=null, $options=null) {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct($elementName, $elementLabel, $attributes, $options);
}
/**
+12 -2
View File
@@ -61,11 +61,21 @@ class MoodleQuickForm_grading extends HTML_QuickForm_input{
* @param mixed $elementLabel Label(s) for the input field
* @param mixed $attributes Either a typical HTML attribute string or an associative array
*/
public function MoodleQuickForm_grading($elementName=null, $elementLabel=null, $attributes=null) {
parent::HTML_QuickForm_input($elementName, $elementLabel, $attributes);
public function __construct($elementName=null, $elementLabel=null, $attributes=null) {
parent::__construct($elementName, $elementLabel, $attributes);
$this->gradingattributes = $attributes;
}
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function MoodleQuickForm_grading($elementName=null, $elementLabel=null, $attributes=null) {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct($elementName, $elementLabel, $attributes);
}
/**
* Helper function to retrieve gradingform_instance passed in element attributes
*
+12 -2
View File
@@ -50,8 +50,18 @@ class MoodleQuickForm_group extends HTML_QuickForm_group{
* @param string $separator (optional) string to seperate elements.
* @param string $appendName (optional) string to appened to grouped elements.
*/
function MoodleQuickForm_group($elementName=null, $elementLabel=null, $elements=null, $separator=null, $appendName = true) {
parent::HTML_QuickForm_group($elementName, $elementLabel, $elements, $separator, $appendName);
public function __construct($elementName=null, $elementLabel=null, $elements=null, $separator=null, $appendName = true) {
parent::__construct($elementName, $elementLabel, $elements, $separator, $appendName);
}
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function MoodleQuickForm_group($elementName=null, $elementLabel=null, $elements=null, $separator=null, $appendName = true) {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct($elementName, $elementLabel, $elements, $separator, $appendName);
}
/** @var string template type, would cause problems with client side validation so will leave for now */
+12 -2
View File
@@ -48,8 +48,18 @@ class MoodleQuickForm_header extends HTML_QuickForm_header
* @param string $elementName name of the header element
* @param string $text text displayed in header element
*/
function MoodleQuickForm_header($elementName = null, $text = null) {
parent::HTML_QuickForm_header($elementName, $text);
public function __construct($elementName = null, $text = null) {
parent::__construct($elementName, $text);
}
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function MoodleQuickForm_header($elementName = null, $text = null) {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct($elementName, $text);
}
/**
+12 -2
View File
@@ -49,8 +49,18 @@ class MoodleQuickForm_hidden extends HTML_QuickForm_hidden{
* @param mixed $attributes (optional) Either a typical HTML attribute string
* or an associative array
*/
function MoodleQuickForm_hidden($elementName=null, $value='', $attributes=null) {
parent::HTML_QuickForm_hidden($elementName, $value, $attributes);
public function __construct($elementName=null, $value='', $attributes=null) {
parent::__construct($elementName, $value, $attributes);
}
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function MoodleQuickForm_hidden($elementName=null, $value='', $attributes=null) {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
return self::__construct($elementName, $value, $attributes);
}
/**
+12 -2
View File
@@ -54,8 +54,8 @@ class MoodleQuickForm_htmleditor extends MoodleQuickForm_textarea{
* @param array $attributes (optional) Either a typical HTML attribute string
* or an associative array
*/
function MoodleQuickForm_htmleditor($elementName=null, $elementLabel=null, $options=array(), $attributes=null){
parent::MoodleQuickForm_textarea($elementName, $elementLabel, $attributes);
public function __construct($elementName=null, $elementLabel=null, $options=array(), $attributes=null){
parent::__construct($elementName, $elementLabel, $attributes);
// set the options, do not bother setting bogus ones
if (is_array($options)) {
foreach ($options as $name => $value) {
@@ -73,6 +73,16 @@ class MoodleQuickForm_htmleditor extends MoodleQuickForm_textarea{
editors_head_setup();
}
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function MoodleQuickForm_htmleditor($elementName=null, $elementLabel=null, $options=array(), $attributes=null) {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct($elementName, $elementLabel, $options, $attributes);
}
/**
* Returns the input field in HTML
*
+12 -2
View File
@@ -73,7 +73,7 @@ class MoodleQuickForm_listing extends HTML_QuickForm_input {
* @param array $attributes (optional) Either a typical HTML attribute string or an associative array.
* @param array $options set of options to initalize listing.
*/
function MoodleQuickForm_listing($elementName=null, $elementLabel=null, $attributes=null, $options=array()) {
public function __construct($elementName=null, $elementLabel=null, $attributes=null, $options=array()) {
$this->_type = 'listing';
if (!empty($options['items'])) {
@@ -89,7 +89,17 @@ class MoodleQuickForm_listing extends HTML_QuickForm_input {
} else {
$this->hideall = get_string('hide');
}
parent::HTML_QuickForm_input($elementName, $elementLabel, $attributes);
parent::__construct($elementName, $elementLabel, $attributes);
}
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function MoodleQuickForm_listing($elementName=null, $elementLabel=null, $attributes=null, $options=array()) {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct($elementName, $elementLabel, $attributes, $options);
}
/**
+12 -2
View File
@@ -53,13 +53,23 @@ class MoodleQuickForm_modgrade extends MoodleQuickForm_group{
* @param array $options Options to control the element's display. Not used.
* @param mixed $attributes Either a typical HTML attribute string or an associative array
*/
public function MoodleQuickForm_modgrade($elementname = null, $elementlabel = null, $options = array(), $attributes = null) {
$this->HTML_QuickForm_element($elementname, $elementlabel, $attributes);
public function __construct($elementname = null, $elementlabel = null, $options = array(), $attributes = null) {
HTML_QuickForm_element::__construct($elementname, $elementlabel, $attributes);
$this->_persistantFreeze = true;
$this->_appendName = true;
$this->_type = 'modgrade';
}
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function MoodleQuickForm_modgrade($elementname = null, $elementlabel = null, $options = array(), $attributes = null) {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct($elementname, $elementlabel, $options, $attributes);
}
/**
* Create elements for this group.
*/
+11 -4
View File
@@ -48,12 +48,19 @@ class MoodleQuickForm_modvisible extends MoodleQuickForm_select{
* @param mixed $attributes Either a typical HTML attribute string or an associative array
* @param array $options ignored
*/
function MoodleQuickForm_modvisible($elementName=null, $elementLabel=null, $attributes=null, $options=null)
{
HTML_QuickForm_element::HTML_QuickForm_element($elementName, $elementLabel, $attributes, null);
public function __construct($elementName=null, $elementLabel=null, $attributes=null, $options=null) {
HTML_QuickForm_element::__construct($elementName, $elementLabel, $attributes, null);
$this->_type = 'modvisible';
}
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function MoodleQuickForm_modvisible($elementName=null, $elementLabel=null, $attributes=null, $options=null) {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct($elementName, $elementLabel, $attributes, $options);
}
/**
+12 -2
View File
@@ -49,7 +49,7 @@ class MoodleQuickForm_password extends HTML_QuickForm_password{
* @param mixed $attributes (optional) Either a typical HTML attribute string
* or an associative array
*/
function MoodleQuickForm_password($elementName=null, $elementLabel=null, $attributes=null) {
public function __construct($elementName=null, $elementLabel=null, $attributes=null) {
global $CFG;
// no standard mform in moodle should allow autocomplete of passwords
if (empty($attributes)) {
@@ -62,7 +62,17 @@ class MoodleQuickForm_password extends HTML_QuickForm_password{
}
}
parent::HTML_QuickForm_password($elementName, $elementLabel, $attributes);
parent::__construct($elementName, $elementLabel, $attributes);
}
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function MoodleQuickForm_password($elementName=null, $elementLabel=null, $attributes=null) {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct($elementName, $elementLabel, $attributes);
}
/**
+12 -2
View File
@@ -51,7 +51,7 @@ class MoodleQuickForm_passwordunmask extends MoodleQuickForm_password {
* @param mixed $attributes (optional) Either a typical HTML attribute string
* or an associative array
*/
function MoodleQuickForm_passwordunmask($elementName=null, $elementLabel=null, $attributes=null) {
public function __construct($elementName=null, $elementLabel=null, $attributes=null) {
global $CFG;
// no standard mform in moodle should allow autocomplete of passwords
if (empty($attributes)) {
@@ -64,7 +64,17 @@ class MoodleQuickForm_passwordunmask extends MoodleQuickForm_password {
}
}
parent::MoodleQuickForm_password($elementName, $elementLabel, $attributes);
parent::__construct($elementName, $elementLabel, $attributes);
}
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function MoodleQuickForm_passwordunmask($elementName=null, $elementLabel=null, $attributes=null) {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct($elementName, $elementLabel, $attributes);
}
/**
+11 -2
View File
@@ -53,8 +53,8 @@ class MoodleQuickForm_questioncategory extends MoodleQuickForm_selectgroups {
* from moodlelib.php.
* @param mixed $attributes Either a typical HTML attribute string or an associative array
*/
function MoodleQuickForm_questioncategory($elementName = null, $elementLabel = null, $options = null, $attributes = null) {
MoodleQuickForm_selectgroups::MoodleQuickForm_selectgroups($elementName, $elementLabel, array(), $attributes);
public function __construct($elementName = null, $elementLabel = null, $options = null, $attributes = null) {
parent::__construct($elementName, $elementLabel, array(), $attributes);
$this->_type = 'questioncategory';
if (is_array($options)) {
$this->_options = $options + $this->_options;
@@ -64,4 +64,13 @@ class MoodleQuickForm_questioncategory extends MoodleQuickForm_selectgroups {
}
}
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function MoodleQuickForm_questioncategory($elementName = null, $elementLabel = null, $options = null, $attributes = null) {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct($elementName, $elementLabel, $options, $attributes);
}
}
+12 -2
View File
@@ -51,8 +51,18 @@ class MoodleQuickForm_radio extends HTML_QuickForm_radio{
* @param mixed $attributes (optional) Either a typical HTML attribute string
* or an associative array
*/
function MoodleQuickForm_radio($elementName=null, $elementLabel=null, $text=null, $value=null, $attributes=null) {
parent::HTML_QuickForm_radio($elementName, $elementLabel, $text, $value, $attributes);
public function __construct($elementName=null, $elementLabel=null, $text=null, $value=null, $attributes=null) {
parent::__construct($elementName, $elementLabel, $text, $value, $attributes);
}
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function MoodleQuickForm_radio($elementName=null, $elementLabel=null, $text=null, $value=null, $attributes=null) {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct($elementName, $elementLabel, $text, $value, $attributes);
}
/**
+12 -2
View File
@@ -53,9 +53,9 @@ class MoodleQuickForm_recaptcha extends HTML_QuickForm_input {
* @param mixed $attributes (optional) Either a typical HTML attribute string
* or an associative array
*/
function MoodleQuickForm_recaptcha($elementName = null, $elementLabel = null, $attributes = null) {
public function __construct($elementName = null, $elementLabel = null, $attributes = null) {
global $CFG;
parent::HTML_QuickForm_input($elementName, $elementLabel, $attributes);
parent::__construct($elementName, $elementLabel, $attributes);
$this->_type = 'recaptcha';
if (is_https()) {
$this->_https = true;
@@ -64,6 +64,16 @@ class MoodleQuickForm_recaptcha extends HTML_QuickForm_input {
}
}
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function MoodleQuickForm_recaptcha($elementName = null, $elementLabel = null, $attributes = null) {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct($elementName, $elementLabel, $attributes);
}
/**
* Returns the recaptcha element in HTML
*
+12 -2
View File
@@ -49,12 +49,22 @@ class MoodleQuickForm_searchableselector extends MoodleQuickForm_select{
* @param array $options additional options.
* @param mixed $attributes Either a typical HTML attribute string or an associative array
*/
function MoodleQuickForm_searchableselector($elementName=null, $elementLabel=null, $options=null, $attributes=null) {
public function __construct($elementName=null, $elementLabel=null, $options=null, $attributes=null) {
//set size default to 12
if (empty($attributes) || empty($attributes['size'])) {
$attributes['size'] = 12;
}
parent::MoodleQuickForm_select($elementName, $elementLabel, $options, $attributes);
parent::__construct($elementName, $elementLabel, $options, $attributes);
}
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function MoodleQuickForm_searchableselector($elementName=null, $elementLabel=null, $options=null, $attributes=null) {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct($elementName, $elementLabel, $options, $attributes);
}
/**
+12 -2
View File
@@ -52,8 +52,18 @@ class MoodleQuickForm_select extends HTML_QuickForm_select{
* @param mixed $options Data to be used to populate options
* @param mixed $attributes Either a typical HTML attribute string or an associative array
*/
function MoodleQuickForm_select($elementName=null, $elementLabel=null, $options=null, $attributes=null) {
parent::HTML_QuickForm_select($elementName, $elementLabel, $options, $attributes);
public function __construct($elementName=null, $elementLabel=null, $options=null, $attributes=null) {
parent::__construct($elementName, $elementLabel, $options, $attributes);
}
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function MoodleQuickForm_select($elementName=null, $elementLabel=null, $options=null, $attributes=null) {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct($elementName, $elementLabel, $options, $attributes);
}
/**
+12 -2
View File
@@ -63,10 +63,10 @@ class MoodleQuickForm_selectgroups extends HTML_QuickForm_element {
* @param mixed $attributes Either a typical HTML attribute string or an associative array
* @param bool $showchoose add standard moodle "Choose..." option as first item
*/
function MoodleQuickForm_selectgroups($elementName=null, $elementLabel=null, $optgrps=null, $attributes=null, $showchoose=false)
public function __construct($elementName=null, $elementLabel=null, $optgrps=null, $attributes=null, $showchoose=false)
{
$this->showchoose = $showchoose;
HTML_QuickForm_element::HTML_QuickForm_element($elementName, $elementLabel, $attributes);
parent::__construct($elementName, $elementLabel, $attributes);
$this->_persistantFreeze = true;
$this->_type = 'selectgroups';
if (isset($optgrps)) {
@@ -74,6 +74,16 @@ class MoodleQuickForm_selectgroups extends HTML_QuickForm_element {
}
}
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function MoodleQuickForm_selectgroups($elementName=null, $elementLabel=null, $optgrps=null, $attributes=null, $showchoose=false) {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct($elementName, $elementLabel, $optgrps, $attributes, $showchoose);
}
/**
* Sets the default values of the select box
*
+12 -3
View File
@@ -62,8 +62,7 @@ class MoodleQuickForm_selectwithlink extends HTML_QuickForm_select{
* @param mixed $attributes Either a typical HTML attribute string or an associative array
* @param bool $linkdata data to be posted
*/
function MoodleQuickForm_selectwithlink($elementName=null, $elementLabel=null, $options=null, $attributes=null, $linkdata=null)
{
public function __construct($elementName=null, $elementLabel=null, $options=null, $attributes=null, $linkdata=null) {
if (!empty($linkdata['link']) && !empty($linkdata['label'])) {
$this->_link = $linkdata['link'];
$this->_linklabel = $linkdata['label'];
@@ -73,7 +72,17 @@ class MoodleQuickForm_selectwithlink extends HTML_QuickForm_select{
$this->_linkreturn = $linkdata['return'];
}
parent::HTML_QuickForm_select($elementName, $elementLabel, $options, $attributes);
parent::__construct($elementName, $elementLabel, $options, $attributes);
}
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function MoodleQuickForm_selectwithlink($elementName=null, $elementLabel=null, $options=null, $attributes=null, $linkdata=null) {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct($elementName, $elementLabel, $options, $attributes, $linkdata);
}
/**
+12 -3
View File
@@ -47,13 +47,22 @@ class MoodleQuickForm_selectyesno extends MoodleQuickForm_select{
* @param mixed $attributes Either a typical HTML attribute string or an associative array
* @param mixed $options ignored, not used.
*/
function MoodleQuickForm_selectyesno($elementName=null, $elementLabel=null, $attributes=null, $options=null)
{
HTML_QuickForm_element::HTML_QuickForm_element($elementName, $elementLabel, $attributes, null);
public function __construct($elementName=null, $elementLabel=null, $attributes=null, $options=null) {
HTML_QuickForm_element::__construct($elementName, $elementLabel, $attributes, null);
$this->_type = 'selectyesno';
$this->_persistantFreeze = true;
}
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function MoodleQuickForm_selectyesno($elementName=null, $elementLabel=null, $attributes=null, $options=null) {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct($elementName, $elementLabel, $attributes, $options);
}
/**
* Called by HTML_QuickForm whenever form event is made on this element
*
+12 -2
View File
@@ -51,8 +51,18 @@ class MoodleQuickForm_static extends HTML_QuickForm_static{
* @param string $elementLabel (optional) text field label
* @param string $text (optional) Text to put in text field
*/
function MoodleQuickForm_static($elementName=null, $elementLabel=null, $text=null) {
parent::HTML_QuickForm_static($elementName, $elementLabel, $text);
public function __construct($elementName=null, $elementLabel=null, $text=null) {
parent::__construct($elementName, $elementLabel, $text);
}
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function MoodleQuickForm_static($elementName=null, $elementLabel=null, $text=null) {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct($elementName, $elementLabel, $text);
}
/**
+12 -2
View File
@@ -45,8 +45,18 @@ class MoodleQuickForm_submit extends HTML_QuickForm_submit {
* @param string $value (optional) field label
* @param string $attributes (optional) Either a typical HTML attribute string or an associative array
*/
function MoodleQuickForm_submit($elementName=null, $value=null, $attributes=null) {
parent::HTML_QuickForm_submit($elementName, $value, $attributes);
public function __construct($elementName=null, $value=null, $attributes=null) {
parent::__construct($elementName, $value, $attributes);
}
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function MoodleQuickForm_submit($elementName=null, $value=null, $attributes=null) {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct($elementName, $value, $attributes);
}
/**
+12 -2
View File
@@ -51,8 +51,18 @@ class MoodleQuickForm_submitlink extends MoodleQuickForm_submit {
* @param string $value (optional) field label
* @param string $attributes (optional) Either a typical HTML attribute string or an associative array
*/
function MoodleQuickForm_submitlink($elementName=null, $value=null, $attributes=null) {
parent::MoodleQuickForm_submit($elementName, $value, $attributes);
public function __construct($elementName=null, $value=null, $attributes=null) {
parent::__construct($elementName, $value, $attributes);
}
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function MoodleQuickForm_submitlink($elementName=null, $value=null, $attributes=null) {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct($elementName, $value, $attributes);
}
/**
+12 -2
View File
@@ -71,7 +71,7 @@ class MoodleQuickForm_tags extends MoodleQuickForm_autocomplete {
* @param array $options Options to control the element's display
* @param mixed $attributes Either a typical HTML attribute string or an associative array.
*/
function MoodleQuickForm_tags($elementName = null, $elementLabel = null, $options = array(), $attributes = null) {
public function __construct($elementName = null, $elementLabel = null, $options = array(), $attributes = null) {
if (!isset($options['display'])) {
$options['display'] = self::DEFAULTUI;
}
@@ -92,7 +92,17 @@ class MoodleQuickForm_tags extends MoodleQuickForm_autocomplete {
$attributes['placeholder'] = get_string('entertags', 'tag');
$attributes['showsuggestions'] = $this->showingofficial;
parent::MoodleQuickForm_autocomplete($elementName, $elementLabel, $validoptions, $attributes);
parent::__construct($elementName, $elementLabel, $validoptions, $attributes);
}
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function MoodleQuickForm_tags($elementName = null, $elementLabel = null, $options = array(), $attributes = null) {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct($elementName, $elementLabel, $options, $attributes);
}
/**
+12 -2
View File
@@ -51,8 +51,18 @@ class MoodleQuickForm_text extends HTML_QuickForm_text{
* @param string $elementLabel (optional) text field label
* @param string $attributes (optional) Either a typical HTML attribute string or an associative array
*/
function MoodleQuickForm_text($elementName=null, $elementLabel=null, $attributes=null) {
parent::HTML_QuickForm_text($elementName, $elementLabel, $attributes);
public function __construct($elementName=null, $elementLabel=null, $attributes=null) {
parent::__construct($elementName, $elementLabel, $attributes);
}
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function MoodleQuickForm_text($elementName=null, $elementLabel=null, $attributes=null) {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct($elementName, $elementLabel, $attributes);
}
/**
+12 -2
View File
@@ -54,8 +54,18 @@ class MoodleQuickForm_textarea extends HTML_QuickForm_textarea{
* @param string $elementLabel (optional) text field label
* @param string $attributes (optional) Either a typical HTML attribute string or an associative array
*/
function MoodleQuickForm_textarea($elementName=null, $elementLabel=null, $attributes=null) {
parent::HTML_QuickForm_textarea($elementName, $elementLabel, $attributes);
public function __construct($elementName=null, $elementLabel=null, $attributes=null) {
parent::__construct($elementName, $elementLabel, $attributes);
}
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function MoodleQuickForm_textarea($elementName=null, $elementLabel=null, $attributes=null) {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct($elementName, $elementLabel, $attributes);
}
/**
+12 -2
View File
@@ -51,7 +51,7 @@ class MoodleQuickForm_url extends HTML_QuickForm_text{
* @param mixed $attributes Either a typical HTML attribute string or an associative array.
* @param array $options data which need to be posted.
*/
function MoodleQuickForm_url($elementName=null, $elementLabel=null, $attributes=null, $options=null) {
public function __construct($elementName=null, $elementLabel=null, $attributes=null, $options=null) {
global $CFG;
require_once("$CFG->dirroot/repository/lib.php");
$options = (array)$options;
@@ -61,7 +61,17 @@ class MoodleQuickForm_url extends HTML_QuickForm_text{
if (!isset($this->_options['usefilepicker'])) {
$this->_options['usefilepicker'] = true;
}
parent::HTML_QuickForm_text($elementName, $elementLabel, $attributes);
parent::__construct($elementName, $elementLabel, $attributes);
}
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function MoodleQuickForm_url($elementName=null, $elementLabel=null, $attributes=null, $options=null) {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct($elementName, $elementLabel, $attributes, $options);
}
/**
+12 -2
View File
@@ -53,8 +53,8 @@ class MoodleQuickForm_warning extends HTML_QuickForm_static{
* @param string $elementClass (optional) show as warning or notification => 'notifyproblem'
* @param string $text (optional) Text to put in warning field
*/
function MoodleQuickForm_warning($elementName=null, $elementClass='notifyproblem', $text=null) {
parent::HTML_QuickForm_static($elementName, null, $text);
public function __construct($elementName=null, $elementClass='notifyproblem', $text=null) {
parent::__construct($elementName, null, $text);
$this->_type = 'warning';
if (is_null($elementClass)) {
$elementClass = 'notifyproblem';
@@ -62,6 +62,16 @@ class MoodleQuickForm_warning extends HTML_QuickForm_static{
$this->_class = $elementClass;
}
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function MoodleQuickForm_warning($elementName=null, $elementClass='notifyproblem', $text=null) {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct($elementName, $elementClass, $text);
}
/**
* Returns HTML for this form element.
*
+35 -5
View File
@@ -157,7 +157,7 @@ abstract class moodleform {
* @param mixed $attributes you can pass a string of html attributes here or an array.
* @param bool $editable
*/
function moodleform($action=null, $customdata=null, $method='post', $target='', $attributes=null, $editable=true) {
public function __construct($action=null, $customdata=null, $method='post', $target='', $attributes=null, $editable=true) {
global $CFG, $FULLME;
// no standard mform in moodle should allow autocomplete with the exception of user signup
if (empty($attributes)) {
@@ -207,6 +207,16 @@ abstract class moodleform {
$this->_process_submission($method);
}
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function moodleform($action=null, $customdata=null, $method='post', $target='', $attributes=null, $editable=true) {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct($action, $customdata, $method, $target, $attributes, $editable);
}
/**
* It should returns unique identifier for the form.
* Currently it will return class name, but in case two same forms have to be
@@ -1426,12 +1436,12 @@ class MoodleQuickForm extends HTML_QuickForm_DHTMLRulesTableless {
* @param string $target (optional)Form's target defaults to none
* @param mixed $attributes (optional)Extra attributes for <form> tag
*/
function MoodleQuickForm($formName, $method, $action, $target='', $attributes=null){
public function __construct($formName, $method, $action, $target='', $attributes=null) {
global $CFG, $OUTPUT;
static $formcounter = 1;
HTML_Common::HTML_Common($attributes);
HTML_Common::__construct($attributes);
$target = empty($target) ? array() : array('target' => $target);
$this->_formName = $formName;
if (is_a($action, 'moodle_url')){
@@ -1460,6 +1470,16 @@ class MoodleQuickForm extends HTML_QuickForm_DHTMLRulesTableless {
$this->setRequiredNote(get_string('somefieldsrequired', 'form', '<img alt="'.get_string('requiredelement', 'form').'" src="'.$OUTPUT->pix_url('req') .'" />'));
}
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function MoodleQuickForm($formName, $method, $action, $target='', $attributes=null) {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct($formName, $method, $action, $target, $attributes);
}
/**
* Use this method to indicate an element in a form is an advanced field. If items in a form
* are marked as advanced then 'Hide/Show Advanced' buttons will automatically be displayed in the
@@ -2594,7 +2614,7 @@ class MoodleQuickForm_Renderer extends HTML_QuickForm_Renderer_Tableless{
/**
* Constructor
*/
function MoodleQuickForm_Renderer(){
public function __construct() {
// switch next two lines for ol li containers for form items.
// $this->_elementTemplates=array('default'=>"\n\t\t".'<li class="fitem"><label>{label}{help}<!-- BEGIN required -->{req}<!-- END required --></label><div class="qfelement<!-- BEGIN error --> error<!-- END error --> {type}"><!-- BEGIN error --><span class="error">{error}</span><br /><!-- END error -->{element}</div></li>');
$this->_elementTemplates = array(
@@ -2610,7 +2630,17 @@ class MoodleQuickForm_Renderer extends HTML_QuickForm_Renderer_Tableless{
'nodisplay'=>'');
parent::HTML_QuickForm_Renderer_Tableless();
parent::__construct();
}
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function MoodleQuickForm_Renderer() {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct();
}
/**
+11 -1
View File
@@ -83,12 +83,22 @@ class HTML_Common {
* @param int $tabOffset Indent offset in tabs
* @access public
*/
function HTML_Common($attributes = null, $tabOffset = 0)
public function __construct($attributes = null, $tabOffset = 0)
{
$this->setAttributes($attributes);
$this->setTabOffset($tabOffset);
} // end constructor
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function HTML_Common($attributes = null, $tabOffset = 0) {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct($attributes, $tabOffset);
}
public static function raiseError($message = null,
$code = null,
$mode = null,
+26 -5
View File
@@ -253,9 +253,9 @@ class HTML_QuickForm extends HTML_Common {
* @param bool $trackSubmit (optional)Whether to track if the form was submitted by adding a special hidden field
* @access public
*/
function HTML_QuickForm($formName='', $method='post', $action='', $target='', $attributes=null, $trackSubmit = false)
public function __construct($formName='', $method='post', $action='', $target='', $attributes=null, $trackSubmit = false)
{
HTML_Common::HTML_Common($attributes);
parent::__construct($attributes);
$method = (strtoupper($method) == 'GET') ? 'get' : 'post';
$action = ($action == '') ? $_SERVER['PHP_SELF'] : $action;
$target = empty($target) ? array() : array('target' => $target);
@@ -301,6 +301,16 @@ class HTML_QuickForm extends HTML_Common {
}
} // end constructor
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function HTML_QuickForm($formName='', $method='post', $action='', $target='', $attributes=null, $trackSubmit = false) {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct($formName, $method, $action, $target, $attributes, $trackSubmit);
}
// }}}
// {{{ apiVersion()
@@ -1983,16 +1993,27 @@ class HTML_QuickForm_Error extends PEAR_Error {
* @param int $level intensity of the error (PHP error code)
* @param mixed $debuginfo any information that can inform user as to nature of the error
*/
function HTML_QuickForm_Error($code = QUICKFORM_ERROR, $mode = PEAR_ERROR_RETURN,
public function __construct($code = QUICKFORM_ERROR, $mode = PEAR_ERROR_RETURN,
$level = E_USER_NOTICE, $debuginfo = null)
{
if (is_int($code)) {
$this->PEAR_Error(HTML_QuickForm::errorMessage($code), $code, $mode, $level, $debuginfo);
parent::__construct(HTML_QuickForm::errorMessage($code), $code, $mode, $level, $debuginfo);
} else {
$this->PEAR_Error("Invalid error code: $code", QUICKFORM_ERROR, $mode, $level, $debuginfo);
parent::__construct("Invalid error code: $code", QUICKFORM_ERROR, $mode, $level, $debuginfo);
}
}
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function HTML_QuickForm_Error($code = QUICKFORM_ERROR, $mode = PEAR_ERROR_RETURN,
$level = E_USER_NOTICE, $debuginfo = null) {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct($code, $mode, $level, $debuginfo);
}
// }}}
} // end class HTML_QuickForm_Error
?>
+11 -2
View File
@@ -33,10 +33,19 @@ class HTML_QuickForm_Renderer
*
* @access public
*/
function HTML_QuickForm_Renderer()
{
public function __construct() {
} // end constructor
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function HTML_QuickForm_Renderer() {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct();
}
/**
* Called when visiting a form, before processing any form elements
*
+11 -3
View File
@@ -147,13 +147,21 @@ class HTML_QuickForm_Renderer_Array extends HTML_QuickForm_Renderer
* @param bool true: render an array of labels to many labels, $key 0 to 'label' and the oterh to "label_$key"
* @access public
*/
function HTML_QuickForm_Renderer_Array($collectHidden = false, $staticLabels = false)
{
$this->HTML_QuickForm_Renderer();
public function __construct($collectHidden = false, $staticLabels = false) {
parent::__construct();
$this->_collectHidden = $collectHidden;
$this->_staticLabels = $staticLabels;
} // end constructor
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function HTML_QuickForm_Renderer_Array($collectHidden = false, $staticLabels = false) {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct($collectHidden, $staticLabels);
}
/**
* Returns the resultant array
+12 -3
View File
@@ -141,9 +141,18 @@ class HTML_QuickForm_Renderer_Default extends HTML_QuickForm_Renderer
*
* @access public
*/
function HTML_QuickForm_Renderer_Default()
{
$this->HTML_QuickForm_Renderer();
public function __construct() {
parent::__construct();
} // end constructor
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function HTML_QuickForm_Renderer_Default() {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct();
} // end constructor
/**
+12 -3
View File
@@ -78,13 +78,22 @@ class HTML_QuickForm_Renderer_Object extends HTML_QuickForm_Renderer
* @param collecthidden bool true: collect all hidden elements
* @access public
*/
function HTML_QuickForm_Renderer_Object($collecthidden = false)
{
$this->HTML_QuickForm_Renderer();
public function __construct($collecthidden = false) {
parent::__construct();
$this->_collectHidden = $collecthidden;
$this->_obj = new QuickformForm;
}
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function HTML_QuickForm_Renderer_Object($collecthidden = false) {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct($collecthidden);
}
/**
* Return the rendered Object
* @access public
+12 -3
View File
@@ -118,11 +118,20 @@ class HTML_QuickForm_Renderer_Tableless extends HTML_QuickForm_Renderer_Default
*
* @access public
*/
function HTML_QuickForm_Renderer_Tableless()
{
$this->HTML_QuickForm_Renderer_Default();
public function __construct() {
parent::__construct();
} // end constructor
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function HTML_QuickForm_Renderer_Tableless() {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct();
}
/**
* Called when visiting a header element
*
+12 -3
View File
@@ -77,12 +77,21 @@ class HTML_QuickForm_advcheckbox extends HTML_QuickForm_checkbox
* @access public
* @return void
*/
function HTML_QuickForm_advcheckbox($elementName=null, $elementLabel=null, $text=null, $attributes=null, $values=null)
{
$this->HTML_QuickForm_checkbox($elementName, $elementLabel, $text, $attributes);
public function __construct($elementName=null, $elementLabel=null, $text=null, $attributes=null, $values=null) {
parent::__construct($elementName, $elementLabel, $text, $attributes);
$this->setValues($values);
} //end constructor
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function HTML_QuickForm_advcheckbox($elementName=null, $elementLabel=null, $text=null, $attributes=null, $values=null) {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct($elementName, $elementLabel, $text, $attributes, $values);
}
// }}}
// {{{ getPrivateName()
+12 -3
View File
@@ -75,9 +75,8 @@ class HTML_QuickForm_autocomplete extends HTML_QuickForm_text
* @access public
* @return void
*/
function HTML_QuickForm_autocomplete($elementName = null, $elementLabel = null, $options = null, $attributes = null)
{
$this->HTML_QuickForm_text($elementName, $elementLabel, $attributes);
public function __construct($elementName = null, $elementLabel = null, $options = null, $attributes = null) {
parent::__construct($elementName, $elementLabel, $attributes);
$this->_persistantFreeze = true;
$this->_type = 'autocomplete';
if (isset($options)) {
@@ -85,6 +84,16 @@ class HTML_QuickForm_autocomplete extends HTML_QuickForm_text
}
} //end constructor
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function HTML_QuickForm_autocomplete($elementName = null, $elementLabel = null, $options = null, $attributes = null) {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct($elementName, $elementLabel, $options, $attributes);
}
// }}}
// {{{ setOptions()
+12 -3
View File
@@ -45,13 +45,22 @@ class HTML_QuickForm_button extends HTML_QuickForm_input
* @access public
* @return void
*/
function HTML_QuickForm_button($elementName=null, $value=null, $attributes=null)
{
HTML_QuickForm_input::HTML_QuickForm_input($elementName, null, $attributes);
public function __construct($elementName=null, $value=null, $attributes=null) {
parent::__construct($elementName, null, $attributes);
$this->_persistantFreeze = false;
$this->setValue($value);
$this->setType('button');
} //end constructor
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function HTML_QuickForm_button($elementName=null, $value=null, $attributes=null) {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct($elementName, $value, $attributes);
}
// }}}
// {{{ freeze()
+13 -4
View File
@@ -57,15 +57,24 @@ class HTML_QuickForm_checkbox extends HTML_QuickForm_input
* @access public
* @return void
*/
function HTML_QuickForm_checkbox($elementName=null, $elementLabel=null, $text='', $attributes=null)
{
HTML_QuickForm_input::HTML_QuickForm_input($elementName, $elementLabel, $attributes);
public function __construct($elementName=null, $elementLabel=null, $text='', $attributes=null) {
parent::__construct($elementName, $elementLabel, $attributes);
$this->_persistantFreeze = true;
$this->_text = $text;
$this->setType('checkbox');
$this->updateAttributes(array('value'=>1));
} //end constructor
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function HTML_QuickForm_checkbox($elementName=null, $elementLabel=null, $text='', $attributes=null) {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct($elementName, $elementLabel, $text, $attributes);
}
// }}}
// {{{ setChecked()
+12 -3
View File
@@ -266,9 +266,8 @@ class HTML_QuickForm_date extends HTML_QuickForm_group
* @param array Options to control the element's display
* @param mixed Either a typical HTML attribute string or an associative array
*/
function HTML_QuickForm_date($elementName = null, $elementLabel = null, $options = array(), $attributes = null)
{
$this->HTML_QuickForm_element($elementName, $elementLabel, $attributes);
public function __construct($elementName = null, $elementLabel = null, $options = array(), $attributes = null) {
HTML_QuickForm_element::__construct($elementName, $elementLabel, $attributes);
$this->_persistantFreeze = true;
$this->_appendName = true;
$this->_type = 'date';
@@ -288,6 +287,16 @@ class HTML_QuickForm_date extends HTML_QuickForm_group
}
}
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function HTML_QuickForm_date($elementName = null, $elementLabel = null, $options = array(), $attributes = null) {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct($elementName, $elementLabel, $options, $attributes);
}
// }}}
// {{{ _createElements()
+13 -5
View File
@@ -80,9 +80,8 @@ class HTML_QuickForm_element extends HTML_Common
* @access public
* @return void
*/
function HTML_QuickForm_element($elementName=null, $elementLabel=null, $attributes=null)
{
HTML_Common::HTML_Common($attributes);
public function __construct($elementName=null, $elementLabel=null, $attributes=null) {
parent::__construct($attributes);
if (isset($elementName)) {
$this->setName($elementName);
}
@@ -90,6 +89,16 @@ class HTML_QuickForm_element extends HTML_Common
$this->setLabel($elementLabel);
}
} //end constructor
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function HTML_QuickForm_element($elementName=null, $elementLabel=null, $attributes=null) {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct($elementName, $elementLabel, $attributes);
}
// }}}
// {{{ apiVersion()
@@ -359,8 +368,7 @@ class HTML_QuickForm_element extends HTML_Common
{
switch ($event) {
case 'createElement':
$className = get_class($this);
$this->$className($arg[0], $arg[1], $arg[2], $arg[3], $arg[4]);
static::__construct($arg[0], $arg[1], $arg[2], $arg[3], $arg[4]);
break;
case 'addElement':
$this->onQuickFormEvent('createElement', $arg, $caller);
+14 -6
View File
@@ -61,12 +61,21 @@ class HTML_QuickForm_file extends HTML_QuickForm_input
* @since 1.0
* @access public
*/
function HTML_QuickForm_file($elementName=null, $elementLabel=null, $attributes=null)
{
HTML_QuickForm_input::HTML_QuickForm_input($elementName, $elementLabel, $attributes);
public function __construct($elementName=null, $elementLabel=null, $attributes=null) {
parent::__construct($elementName, $elementLabel, $attributes);
$this->setType('file');
} //end constructor
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function HTML_QuickForm_file($elementName=null, $elementLabel=null, $attributes=null) {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct($elementName, $elementLabel, $attributes);
}
// }}}
// {{{ setSize()
@@ -176,8 +185,7 @@ class HTML_QuickForm_file extends HTML_QuickForm_input
return $this->onQuickFormEvent('updateValue', null, $caller);
break;
case 'createElement':
$className = get_class($this);
$this->$className($arg[0], $arg[1], $arg[2]);
static::__construct($arg[0], $arg[1], $arg[2], $arg[3], $arg[4]);
break;
}
return true;
+12 -3
View File
@@ -92,9 +92,8 @@ class HTML_QuickForm_group extends HTML_QuickForm_element
* @access public
* @return void
*/
function HTML_QuickForm_group($elementName=null, $elementLabel=null, $elements=null, $separator=null, $appendName = true)
{
$this->HTML_QuickForm_element($elementName, $elementLabel);
public function __construct($elementName=null, $elementLabel=null, $elements=null, $separator=null, $appendName = true) {
parent::__construct($elementName, $elementLabel);
$this->_type = 'group';
if (isset($elements) && is_array($elements)) {
$this->setElements($elements);
@@ -107,6 +106,16 @@ class HTML_QuickForm_group extends HTML_QuickForm_element
}
} //end constructor
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function HTML_QuickForm_group($elementName=null, $elementLabel=null, $elements=null, $separator=null, $appendName = true) {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct($elementName, $elementLabel, $elements, $separator, $appendName);
}
// }}}
// {{{ setName()
+12 -3
View File
@@ -38,12 +38,21 @@ class HTML_QuickForm_header extends HTML_QuickForm_static
* @access public
* @return void
*/
function HTML_QuickForm_header($elementName = null, $text = null)
{
$this->HTML_QuickForm_static($elementName, null, $text);
public function __construct($elementName = null, $text = null) {
parent::__construct($elementName, null, $text);
$this->_type = 'header';
}
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function HTML_QuickForm_header($elementName = null, $text = null) {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct($elementName, $text);
}
// }}}
// {{{ accept()
+12 -3
View File
@@ -45,13 +45,22 @@ class HTML_QuickForm_hidden extends HTML_QuickForm_input
* @access public
* @return void
*/
function HTML_QuickForm_hidden($elementName=null, $value='', $attributes=null)
{
HTML_QuickForm_input::HTML_QuickForm_input($elementName, null, $attributes);
public function __construct($elementName=null, $value='', $attributes=null) {
parent::__construct($elementName, null, $attributes);
$this->setType('hidden');
$this->setValue($value);
} //end constructor
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function HTML_QuickForm_hidden($elementName=null, $value='', $attributes=null) {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
return self::__construct($elementName, $value, $attributes);
}
// }}}
// {{{ freeze()
+12 -3
View File
@@ -49,9 +49,8 @@ class HTML_QuickForm_hiddenselect extends HTML_QuickForm_select
* @access public
* @return void
*/
function HTML_QuickForm_hiddenselect($elementName=null, $elementLabel=null, $options=null, $attributes=null)
{
HTML_QuickForm_element::HTML_QuickForm_element($elementName, $elementLabel, $attributes);
public function __construct($elementName=null, $elementLabel=null, $options=null, $attributes=null) {
HTML_QuickForm_element::__construct($elementName, $elementLabel, $attributes);
$this->_persistantFreeze = true;
$this->_type = 'hiddenselect';
if (isset($options)) {
@@ -59,6 +58,16 @@ class HTML_QuickForm_hiddenselect extends HTML_QuickForm_select
}
} //end constructor
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function HTML_QuickForm_hiddenselect($elementName=null, $elementLabel=null, $options=null, $attributes=null) {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct($elementName, $elementLabel, $options, $attributes);
}
// }}}
// {{{ toHtml()
+12 -3
View File
@@ -114,9 +114,8 @@ class HTML_QuickForm_hierselect extends HTML_QuickForm_group
* @access public
* @return void
*/
function HTML_QuickForm_hierselect($elementName=null, $elementLabel=null, $attributes=null, $separator=null)
{
$this->HTML_QuickForm_element($elementName, $elementLabel, $attributes);
public function __construct($elementName=null, $elementLabel=null, $attributes=null, $separator=null) {
HTML_QuickForm_element::__construct($elementName, $elementLabel, $attributes);
$this->_persistantFreeze = true;
if (isset($separator)) {
$this->_separator = $separator;
@@ -125,6 +124,16 @@ class HTML_QuickForm_hierselect extends HTML_QuickForm_group
$this->_appendName = true;
} //end constructor
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function HTML_QuickForm_hierselect($elementName=null, $elementLabel=null, $attributes=null, $separator=null) {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct($elementName, $elementLabel, $attributes, $separator);
}
// }}}
// {{{ setOptions()
+12 -3
View File
@@ -40,12 +40,21 @@ class HTML_QuickForm_html extends HTML_QuickForm_static
* @access public
* @return void
*/
function HTML_QuickForm_html($text = null)
{
$this->HTML_QuickForm_static(null, null, $text);
public function __construct($text = null) {
parent::__construct(null, null, $text);
$this->_type = 'html';
}
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function HTML_QuickForm_html($text = null) {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct($text);
}
// }}}
// {{{ accept()
+12 -3
View File
@@ -44,13 +44,22 @@ class HTML_QuickForm_image extends HTML_QuickForm_input
* @access public
* @return void
*/
function HTML_QuickForm_image($elementName=null, $src='', $attributes=null)
{
HTML_QuickForm_input::HTML_QuickForm_input($elementName, null, $attributes);
public function __construct($elementName=null, $src='', $attributes=null) {
parent::__construct($elementName, null, $attributes);
$this->setType('image');
$this->setSource($src);
} // end class constructor
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function HTML_QuickForm_image($elementName=null, $src='', $attributes=null) {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct($elementName, $src, $attributes);
}
// }}}
// {{{ setSource()
+12 -3
View File
@@ -45,11 +45,20 @@ class HTML_QuickForm_input extends HTML_QuickForm_element
* @access public
* @return void
*/
function HTML_QuickForm_input($elementName=null, $elementLabel=null, $attributes=null)
{
$this->HTML_QuickForm_element($elementName, $elementLabel, $attributes);
public function __construct($elementName=null, $elementLabel=null, $attributes=null) {
parent::__construct($elementName, $elementLabel, $attributes);
} //end constructor
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function HTML_QuickForm_input($elementName=null, $elementLabel=null, $attributes=null) {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct($elementName, $elementLabel, $attributes);
}
// }}}
// {{{ setType()
+13 -4
View File
@@ -57,15 +57,24 @@ class HTML_QuickForm_link extends HTML_QuickForm_static
* @return void
* @throws
*/
function HTML_QuickForm_link($elementName=null, $elementLabel=null, $href=null, $text=null, $attributes=null)
{
HTML_QuickForm_element::HTML_QuickForm_element($elementName, $elementLabel, $attributes);
public function __construct($elementName=null, $elementLabel=null, $href=null, $text=null, $attributes=null) {
HTML_QuickForm_element::__construct($elementName, $elementLabel, $attributes);
$this->_persistantFreeze = false;
$this->_type = 'link';
$this->setHref($href);
$this->_text = $text;
} //end constructor
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function HTML_QuickForm_link($elementName=null, $elementLabel=null, $href=null, $text=null, $attributes=null) {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct($elementName, $elementLabel, $href, $text, $attributes);
}
// }}}
// {{{ setName()
+12 -3
View File
@@ -46,11 +46,20 @@ class HTML_QuickForm_password extends HTML_QuickForm_input
* @return void
* @throws
*/
function HTML_QuickForm_password($elementName=null, $elementLabel=null, $attributes=null)
{
HTML_QuickForm_input::HTML_QuickForm_input($elementName, $elementLabel, $attributes);
public function __construct($elementName=null, $elementLabel=null, $attributes=null) {
parent::__construct($elementName, $elementLabel, $attributes);
$this->setType('password');
} //end constructor
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function HTML_QuickForm_password($elementName=null, $elementLabel=null, $attributes=null) {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct($elementName, $elementLabel, $attributes);
}
// }}}
// {{{ setSize()
+12 -3
View File
@@ -57,9 +57,8 @@ class HTML_QuickForm_radio extends HTML_QuickForm_input
* @access public
* @return void
*/
function HTML_QuickForm_radio($elementName=null, $elementLabel=null, $text=null, $value=null, $attributes=null)
{
$this->HTML_QuickForm_element($elementName, $elementLabel, $attributes);
public function __construct($elementName=null, $elementLabel=null, $text=null, $value=null, $attributes=null) {
HTML_QuickForm_element::__construct($elementName, $elementLabel, $attributes);
if (isset($value)) {
$this->setValue($value);
}
@@ -68,6 +67,16 @@ class HTML_QuickForm_radio extends HTML_QuickForm_input
$this->_text = $text;
} //end constructor
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function HTML_QuickForm_radio($elementName=null, $elementLabel=null, $text=null, $value=null, $attributes=null) {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct($elementName, $elementLabel, $text, $value, $attributes);
}
// }}}
function _generateId() {
+12 -3
View File
@@ -45,13 +45,22 @@ class HTML_QuickForm_reset extends HTML_QuickForm_input
* @access public
* @return void
*/
function HTML_QuickForm_reset($elementName=null, $value=null, $attributes=null)
{
HTML_QuickForm_input::HTML_QuickForm_input($elementName, null, $attributes);
public function __construct($elementName=null, $value=null, $attributes=null) {
parent::__construct($elementName, null, $attributes);
$this->setValue($value);
$this->setType('reset');
} //end constructor
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function HTML_QuickForm_reset($elementName=null, $value=null, $attributes=null) {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct($elementName, $value, $attributes);
}
// }}}
// {{{ freeze()
+12 -3
View File
@@ -66,15 +66,24 @@ class HTML_QuickForm_select extends HTML_QuickForm_element {
* @access public
* @return void
*/
function HTML_QuickForm_select($elementName=null, $elementLabel=null, $options=null, $attributes=null)
{
HTML_QuickForm_element::HTML_QuickForm_element($elementName, $elementLabel, $attributes);
public function __construct($elementName=null, $elementLabel=null, $options=null, $attributes=null) {
parent::__construct($elementName, $elementLabel, $attributes);
$this->_persistantFreeze = true;
$this->_type = 'select';
if (isset($options)) {
$this->load($options);
}
} //end constructor
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function HTML_QuickForm_select($elementName=null, $elementLabel=null, $options=null, $attributes=null) {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct($elementName, $elementLabel, $attributes);
}
// }}}
// {{{ apiVersion()
+13 -4
View File
@@ -49,14 +49,23 @@ class HTML_QuickForm_static extends HTML_QuickForm_element {
* @access public
* @return void
*/
function HTML_QuickForm_static($elementName=null, $elementLabel=null, $text=null)
{
HTML_QuickForm_element::HTML_QuickForm_element($elementName, $elementLabel);
public function __construct($elementName=null, $elementLabel=null, $text=null) {
parent::__construct($elementName, $elementLabel);
$this->_persistantFreeze = false;
$this->_type = 'static';
$this->_text = $text;
} //end constructor
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function HTML_QuickForm_static($elementName=null, $elementLabel=null, $text=null) {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct($elementName, $elementLabel, $text);
}
// }}}
// {{{ setName()
+13 -4
View File
@@ -44,13 +44,22 @@ class HTML_QuickForm_submit extends HTML_QuickForm_input
* @access public
* @return void
*/
function HTML_QuickForm_submit($elementName=null, $value=null, $attributes=null)
{
HTML_QuickForm_input::HTML_QuickForm_input($elementName, null, $attributes);
public function __construct($elementName=null, $value=null, $attributes=null) {
parent::__construct($elementName, null, $attributes);
$this->setValue($value);
$this->setType('submit');
} //end constructor
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function HTML_QuickForm_submit($elementName=null, $value=null, $attributes=null) {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct($elementName, $value, $attributes);
}
// }}}
// {{{ freeze()
+12 -3
View File
@@ -46,12 +46,21 @@ class HTML_QuickForm_text extends HTML_QuickForm_input
* @access public
* @return void
*/
function HTML_QuickForm_text($elementName=null, $elementLabel=null, $attributes=null)
{
HTML_QuickForm_input::HTML_QuickForm_input($elementName, $elementLabel, $attributes);
public function __construct($elementName=null, $elementLabel=null, $attributes=null) {
parent::__construct($elementName, $elementLabel, $attributes);
$this->_persistantFreeze = true;
$this->setType('text');
} //end constructor
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function HTML_QuickForm_text($elementName=null, $elementLabel=null, $attributes=null) {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct($elementName, $elementLabel, $attributes);
}
// }}}
// {{{ setSize()
+13 -4
View File
@@ -55,13 +55,22 @@ class HTML_QuickForm_textarea extends HTML_QuickForm_element
* @access public
* @return void
*/
function HTML_QuickForm_textarea($elementName=null, $elementLabel=null, $attributes=null)
{
HTML_QuickForm_element::HTML_QuickForm_element($elementName, $elementLabel, $attributes);
public function __construct($elementName=null, $elementLabel=null, $attributes=null) {
parent::__construct($elementName, $elementLabel, $attributes);
$this->_persistantFreeze = true;
$this->_type = 'textarea';
} //end constructor
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function HTML_QuickForm_textarea($elementName=null, $elementLabel=null, $attributes=null) {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct($elementName, $elementLabel, $attributes);
}
// }}}
// {{{ setName()
+11 -3
View File
@@ -44,14 +44,22 @@ class HTML_QuickForm_xbutton extends HTML_QuickForm_element
* @param mixed Either a typical HTML attribute string or an associative array
* @access public
*/
function HTML_QuickForm_xbutton($elementName = null, $elementContent = null, $attributes = null)
{
$this->HTML_QuickForm_element($elementName, null, $attributes);
public function __construct($elementName = null, $elementContent = null, $attributes = null) {
parent::__construct($elementName, null, $attributes);
$this->setContent($elementContent);
$this->setPersistantFreeze(false);
$this->_type = 'xbutton';
}
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function HTML_QuickForm_xbutton($elementName = null, $elementContent = null, $attributes = null) {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct($elementName, $elementContent, $attributes);
}
function toHtml()
{
+22 -2
View File
@@ -146,7 +146,7 @@ class PEAR
* @access public
* @return void
*/
function PEAR($error_class = null)
function __construct($error_class = null)
{
$classname = strtolower(get_class($this));
if ($this->_debug) {
@@ -173,6 +173,18 @@ class PEAR
}
}
/**
* Only here for backwards compatibility.
* E.g. Archive_Tar calls $this->PEAR() in its constructor.
*
* @param string $error_class Which class to use for error objects,
* defaults to PEAR_Error.
*/
public function PEAR($error_class = null)
{
$this->__construct($error_class);
}
/**
* Destructor (the emulated type of...). Does nothing right now,
* but is included for forward compatibility, so subclass
@@ -823,7 +835,7 @@ class PEAR_Error
* @access public
*
*/
function PEAR_Error($message = 'unknown error', $code = null,
function __construct($message = 'unknown error', $code = null,
$mode = null, $options = null, $userinfo = null)
{
if ($mode === null) {
@@ -896,6 +908,14 @@ class PEAR_Error
}
}
/**
* Old syntax of class constructor for backward compatibility.
*/
public function PEAR_Error($message = 'unknown error', $code = null,
$mode = null, $options = null, $userinfo = null) {
self::__construct($message, $code, $mode, $options, $userinfo);
}
/**
* Get the error mode from an error object.
*
+7
View File
@@ -27,3 +27,10 @@ Most probably we will stop using this library in the future.
MDL-20876 - replaced split() with explode() or preg_split() where appropriate
MDL-40267 - Moodle core_text strlen functions used for range rule rule to be utf8 safe.
MDL-46467 - $mform->hardfreeze causes labels to loose their for HTML attribute
MDL-52081 - made all constructors PHP7 compatible
Pear
====
Changed constructors in classes PEAR and PEAR_ERROR to be __construct(). This has
been already changed upstream in 1.10.0, remove this line after upgrade.
+12
View File
@@ -11,6 +11,18 @@ information provided here is intended especially for developers.
* Ajax calls going through lib/ajax/* now validate the return values before sending
the response. If the validation does not pass an exception is raised. This behaviour
is consistent with web services.
* Several changes in Moodle core, standard plugins and third party libraries to
ensure compatibility with PHP7. All plugins are recommended to perform testing
against PHP7 as well. The following changes may affect you:
* Class moodleform, moodleform_mod and some module classes have been changed to use
__construct() for the constructor. Calling parent constructors by the class
name will display debugging message. Incorrect: parent::moodleform(),
correct: parent::__construct()
* All form elements have also changed the constructor syntax. No changes are
needed for using form elements, however if plugin defines new form element it
needs to use correct syntax. For example, incorrect: parent::HTML_QuickForm_input(),
HTML_QuickForm_input::HTML_QuickForm_input(), $this->HTML_QuickForm_input().
Correct: HTML_QuickForm_input::__construct() or parent::__construct().
=== 3.0 ===
+12 -2
View File
@@ -13,11 +13,21 @@ class mod_data_export_form extends moodleform {
// @param string $url: the url to post to
// @param array $datafields: objects in this database
function mod_data_export_form($url, $datafields, $cm, $data) {
public function __construct($url, $datafields, $cm, $data) {
$this->_datafields = $datafields;
$this->_cm = $cm;
$this->_data = $data;
parent::moodleform($url);
parent::__construct($url);
}
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function mod_data_export_form($url, $datafields, $cm, $data) {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct($url, $datafields, $cm, $data);
}
function definition() {
+12 -2
View File
@@ -33,9 +33,19 @@ class mod_lesson_mod_form extends moodleform_mod {
protected $course = null;
public function mod_lesson_mod_form($current, $section, $cm, $course) {
public function __construct($current, $section, $cm, $course) {
$this->course = $course;
parent::moodleform_mod($current, $section, $cm, $course);
parent::__construct($current, $section, $cm, $course);
}
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function mod_lesson_mod_form($current, $section, $cm, $course) {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct($current, $section, $cm, $course);
}
function definition() {
+19 -2
View File
@@ -33,7 +33,14 @@ class MoodleQuickForm_wikieditor extends MoodleQuickForm_textarea {
private $files;
function MoodleQuickForm_wikieditor($elementName = null, $elementLabel = null, $attributes = null) {
/**
* Constructor
*
* @param string $elementName (optional) name of the text field
* @param string $elementLabel (optional) text field label
* @param string $attributes (optional) Either a typical HTML attribute string or an associative array
*/
function __construct($elementName = null, $elementLabel = null, $attributes = null) {
if (isset($attributes['wiki_format'])) {
$this->wikiformat = $attributes['wiki_format'];
unset($attributes['wiki_format']);
@@ -43,7 +50,17 @@ class MoodleQuickForm_wikieditor extends MoodleQuickForm_textarea {
unset($attributes['files']);
}
parent::MoodleQuickForm_textarea($elementName, $elementLabel, $attributes);
parent::__construct($elementName, $elementLabel, $attributes);
}
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function MoodleQuickForm_wikieditor($elementName = null, $elementLabel = null, $attributes = null) {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct($elementName, $elementLabel, $attributes);
}
function setWikiFormat($wikiformat) {
+12 -2
View File
@@ -37,13 +37,23 @@ class MoodleQuickForm_wikifiletable extends HTML_QuickForm_element {
private $_fileinfo;
private $_value = array();
function MoodleQuickForm_wikifiletable($elementName = null, $elementLabel = null, $attributes = null, $fileinfo = null, $format = null) {
public function __construct($elementName = null, $elementLabel = null, $attributes = null, $fileinfo = null, $format = null) {
parent::HTML_QuickForm_element($elementName, $elementLabel, $attributes);
parent::__construct($elementName, $elementLabel, $attributes);
$this->_fileinfo = $fileinfo;
$this->_format = $format;
}
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function MoodleQuickForm_wikifiletable($elementName = null, $elementLabel = null, $attributes = null, $fileinfo = null, $format = null) {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct($elementName, $elementLabel, $attributes, $fileinfo, $format);
}
function onQuickFormEvent($event, $arg, &$caller) {
global $OUTPUT;