1 |
efrain |
1 |
<?php
|
|
|
2 |
// This file is part of Moodle - http://moodle.org/
|
|
|
3 |
//
|
|
|
4 |
// Moodle is free software: you can redistribute it and/or modify
|
|
|
5 |
// it under the terms of the GNU General Public License as published by
|
|
|
6 |
// the Free Software Foundation, either version 3 of the License, or
|
|
|
7 |
// (at your option) any later version.
|
|
|
8 |
//
|
|
|
9 |
// Moodle is distributed in the hope that it will be useful,
|
|
|
10 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
11 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
12 |
// GNU General Public License for more details.
|
|
|
13 |
//
|
|
|
14 |
// You should have received a copy of the GNU General Public License
|
|
|
15 |
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
|
|
16 |
|
|
|
17 |
/**
|
|
|
18 |
* unilabel module.
|
|
|
19 |
*
|
|
|
20 |
* @package unilabeltype_grid
|
|
|
21 |
* @author Andreas Grabs <info@grabs-edv.de>
|
|
|
22 |
* @copyright 2018 onwards Grabs EDV {@link https://www.grabs-edv.de}
|
|
|
23 |
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
|
|
24 |
* @param mixed $oldversion
|
|
|
25 |
*/
|
|
|
26 |
|
|
|
27 |
/**
|
|
|
28 |
* Upgrade hook for this plugin.
|
|
|
29 |
*
|
|
|
30 |
* @param int $oldversion
|
|
|
31 |
* @return bool
|
|
|
32 |
*/
|
|
|
33 |
function xmldb_unilabeltype_grid_upgrade($oldversion) {
|
|
|
34 |
global $CFG, $DB;
|
|
|
35 |
|
|
|
36 |
$dbman = $DB->get_manager();
|
|
|
37 |
|
|
|
38 |
if ($oldversion < 2020022900) {
|
|
|
39 |
// Define field columnsmiddle to be added to unilabeltype_grid.
|
|
|
40 |
$table = new xmldb_table('unilabeltype_grid');
|
|
|
41 |
$field = new xmldb_field('columnsmiddle', XMLDB_TYPE_INTEGER, '10', null, null, null, null, 'columns');
|
|
|
42 |
|
|
|
43 |
// Conditionally launch add field columnsmiddle.
|
|
|
44 |
if (!$dbman->field_exists($table, $field)) {
|
|
|
45 |
$dbman->add_field($table, $field);
|
|
|
46 |
}
|
|
|
47 |
|
|
|
48 |
// Define field columnssmall to be added to unilabeltype_grid.
|
|
|
49 |
$table = new xmldb_table('unilabeltype_grid');
|
|
|
50 |
$field = new xmldb_field('columnssmall', XMLDB_TYPE_INTEGER, '10', null, null, null, null, 'columnsmiddle');
|
|
|
51 |
|
|
|
52 |
// Conditionally launch add field columnssmall.
|
|
|
53 |
if (!$dbman->field_exists($table, $field)) {
|
|
|
54 |
$dbman->add_field($table, $field);
|
|
|
55 |
}
|
|
|
56 |
|
|
|
57 |
// Grid savepoint reached.
|
|
|
58 |
upgrade_plugin_savepoint(true, 2020022900, 'unilabeltype', 'grid');
|
|
|
59 |
}
|
|
|
60 |
|
|
|
61 |
if ($oldversion < 2023121501) {
|
|
|
62 |
|
|
|
63 |
// Define field sortorder to be added to unilabeltype_grid_tile.
|
|
|
64 |
$table = new xmldb_table('unilabeltype_grid_tile');
|
|
|
65 |
$field = new xmldb_field('sortorder', XMLDB_TYPE_INTEGER, '10', null, null, null, null, 'gridid');
|
|
|
66 |
|
|
|
67 |
// Conditionally launch add field sortorder.
|
|
|
68 |
if (!$dbman->field_exists($table, $field)) {
|
|
|
69 |
$dbman->add_field($table, $field);
|
|
|
70 |
}
|
|
|
71 |
|
|
|
72 |
// Grid savepoint reached.
|
|
|
73 |
upgrade_plugin_savepoint(true, 2023121501, 'unilabeltype', 'grid');
|
|
|
74 |
}
|
|
|
75 |
|
|
|
76 |
if ($oldversion < 2024012400) {
|
|
|
77 |
|
|
|
78 |
// Define field sortorder to be added to unilabeltype_grid_tile.
|
|
|
79 |
$table = new xmldb_table('unilabeltype_grid_tile');
|
|
|
80 |
$field = new xmldb_field('newwindow', XMLDB_TYPE_INTEGER, '1', null, null, null, null, 'url');
|
|
|
81 |
|
|
|
82 |
// Conditionally launch add field newwindow.
|
|
|
83 |
if (!$dbman->field_exists($table, $field)) {
|
|
|
84 |
$dbman->add_field($table, $field);
|
|
|
85 |
}
|
|
|
86 |
|
|
|
87 |
// Grid savepoint reached.
|
|
|
88 |
upgrade_plugin_savepoint(true, 2024012400, 'unilabeltype', 'grid');
|
|
|
89 |
}
|
|
|
90 |
|
|
|
91 |
return true;
|
|
|
92 |
}
|