MDL-26425 tablelib rename constructors to PHP5 __construct
and add depreacted functions with the old name so that legacy code does not break.
This commit is contained in:
+25
-3
@@ -119,7 +119,7 @@ class flexible_table {
|
||||
* @param int $uniqueid
|
||||
* @todo Document properly
|
||||
*/
|
||||
function flexible_table($uniqueid) {
|
||||
function __construct($uniqueid) {
|
||||
$this->uniqueid = $uniqueid;
|
||||
$this->request = array(
|
||||
TABLE_VAR_SORT => 'tsort',
|
||||
@@ -131,6 +131,17 @@ class flexible_table {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Backwards-compatible constructor, so that legacy code subclassing
|
||||
* flexible_table does not break.
|
||||
* @deprecated since Moodle 2.0. Will be removed in Moodle 2.1.
|
||||
*/
|
||||
function flexible_table($uniqueid) {
|
||||
debugging('Please update your code to user PHP5-style parent::__construct(...), ' .
|
||||
'not parent::flexible_table(...).');
|
||||
$this->__construct($uniqueid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Call this to pass the download type. Use :
|
||||
* $download = optional_param('download', '', PARAM_ALPHA);
|
||||
@@ -1244,13 +1255,24 @@ class table_sql extends flexible_table {
|
||||
* @param string $uniqueid a string identifying this table.Used as a key in
|
||||
* session vars.
|
||||
*/
|
||||
function table_sql($uniqueid) {
|
||||
parent::flexible_table($uniqueid);
|
||||
function __construct($uniqueid) {
|
||||
parent::__construct($uniqueid);
|
||||
// some sensible defaults
|
||||
$this->set_attribute('cellspacing', '0');
|
||||
$this->set_attribute('class', 'generaltable generalbox');
|
||||
}
|
||||
|
||||
/**
|
||||
* Backwards-compatible constructor, so that legacy code subclassing
|
||||
* table_sql does not break.
|
||||
* @deprecated since Moodle 2.0. Will be removed in Moodle 2.1.
|
||||
*/
|
||||
function table_sql($uniqueid) {
|
||||
debugging('Please update your code to user PHP5-style parent::__construct(...), ' .
|
||||
'not parent::table_sql(...).');
|
||||
$this->__construct($uniqueid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Take the data returned from the db_query and go through all the rows
|
||||
* processing each col using either col_{columnname} method or other_cols
|
||||
|
||||
Reference in New Issue
Block a user