MDL-51025 tool_lp: Dropping column sortorder for frameworks

This commit is contained in:
Frederic Massart
2016-04-18 10:58:33 +08:00
parent f610a95732
commit 761a493cda
5 changed files with 18 additions and 42 deletions
@@ -46,9 +46,6 @@ class competency_framework extends persistent {
/** @var int $descriptionformat Format for the description */
private $descriptionformat = 0;
/** @var int $sortorder A number used to influence sorting */
private $sortorder = 0;
/** @var bool $visible Used to show/hide this framework */
private $visible = true;
@@ -141,24 +138,6 @@ class competency_framework extends persistent {
$this->description = $description;
}
/**
* Get the sort order index.
*
* @return string The sort order index
*/
public function get_sortorder() {
return $this->sortorder;
}
/**
* Set the sort order index.
*
* @param string $sortorder The sort order index
*/
public function set_sortorder($sortorder) {
$this->sortorder = $sortorder;
}
/**
* Get the visible flag.
*
@@ -253,9 +232,6 @@ class competency_framework extends persistent {
if (isset($record->descriptionformat)) {
$this->set_descriptionformat($record->descriptionformat);
}
if (isset($record->sortorder)) {
$this->set_sortorder($record->sortorder);
}
if (isset($record->scaleid)) {
$this->set_scaleid($record->scaleid);
}
@@ -293,7 +269,6 @@ class competency_framework extends persistent {
$record->description = $this->get_description();
$record->descriptionformat = $this->get_descriptionformat();
$record->descriptionformatted = format_text($this->get_description(), $this->get_descriptionformat());
$record->sortorder = $this->get_sortorder();
$record->scaleid = $this->get_scaleid();
$record->scaleconfiguration = $this->get_scaleconfiguration();
$record->visible = $this->get_visible();
@@ -305,14 +280,4 @@ class competency_framework extends persistent {
return $record;
}
/**
* Add a default for the sortorder field to the default create logic.
*
* @return persistent
*/
public function create() {
$this->sortorder = $this->count_records();
return parent::create();
}
}
-5
View File
@@ -173,10 +173,6 @@ class external extends external_api {
PARAM_BOOL,
'Is this framework visible?'
);
$sortorder = new external_value(
PARAM_INT,
'Relative sort order of this framework'
);
$timecreated = new external_value(
PARAM_INT,
'Timestamp this record was created'
@@ -198,7 +194,6 @@ class external extends external_api {
'descriptionformat' => $descriptionformat,
'descriptionformatted' => $descriptionformatted,
'visible' => $visible,
'sortorder' => $sortorder,
'timecreated' => $timecreated,
'timemodified' => $timemodified,
'usermodified' => $usermodified,
+16
View File
@@ -81,5 +81,21 @@ function xmldb_tool_lp_upgrade($oldversion) {
upgrade_plugin_savepoint(true, 2015052405, 'tool', 'lp');
}
if ($oldversion < 2015052406) {
// Define field sortorder to be dropped from tool_lp_competency_framework.
$table = new xmldb_table('tool_lp_competency_framework');
$field = new xmldb_field('sortorder');
// Conditionally launch drop field sortorder.
if ($dbman->field_exists($table, $field)) {
$dbman->drop_field($table, $field);
}
// Lp savepoint reached.
upgrade_plugin_savepoint(true, 2015052406, 'tool', 'lp');
}
return true;
}
@@ -29,7 +29,7 @@
* data-action = deletecompetencyframework
Context variables required for this template:
* competencyframeworks - array of objects containing id, shortname, idnumber, sortorder, visible
* competencyframeworks - array of objects containing id, shortname, idnumber, visible
* canmanage - true if this user has permission to manage the frameworks
* navigation - array of strings containing buttons for navigation
}}
+1 -1
View File
@@ -24,7 +24,7 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2015052405; // The current plugin version (Date: YYYYMMDDXX).
$plugin->version = 2015052406; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2014110400; // Requires this Moodle version.
$plugin->component = 'tool_lp'; // Full name of the plugin (used for diagnostics).