Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
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_carousel
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_carousel_upgrade($oldversion) {
34
    global $CFG, $DB;
35
 
36
    $dbman = $DB->get_manager();
37
 
38
    if ($oldversion < 2023121501) {
39
 
40
        // Define field sortorder to be added to unilabeltype_carousel_tile.
41
        $table = new xmldb_table('unilabeltype_carousel_slide');
42
        $field = new xmldb_field('sortorder', XMLDB_TYPE_INTEGER, '10', null, null, null, null, 'carouselid');
43
 
44
        // Conditionally launch add field sortorder.
45
        if (!$dbman->field_exists($table, $field)) {
46
            $dbman->add_field($table, $field);
47
        }
48
 
49
        // Carousel savepoint reached.
50
        upgrade_plugin_savepoint(true, 2023121501, 'unilabeltype', 'carousel');
51
    }
52
 
53
    if ($oldversion < 2024012400) {
54
 
55
        // Define field sortorder to be added to unilabeltype_carousel_slide.
56
        $table = new xmldb_table('unilabeltype_carousel_slide');
57
        $field = new xmldb_field('newwindow', XMLDB_TYPE_INTEGER, '1', null, null, null, null, 'url');
58
 
59
        // Conditionally launch add field newwindow.
60
        if (!$dbman->field_exists($table, $field)) {
61
            $dbman->add_field($table, $field);
62
        }
63
 
64
        // Carousel savepoint reached.
65
        upgrade_plugin_savepoint(true, 2024012400, 'unilabeltype', 'carousel');
66
    }
67
 
68
    if ($oldversion < 2024050700) {
69
 
70
        // Define field captionstyle to be added to unilabeltype_carousel.
71
        $table = new xmldb_table('unilabeltype_carousel');
72
        $field = new xmldb_field('captionstyle', XMLDB_TYPE_CHAR, '255', null, null, null, null, 'background');
73
 
74
        // Conditionally launch add field captionstyle.
75
        if (!$dbman->field_exists($table, $field)) {
76
            $dbman->add_field($table, $field);
77
        }
78
 
79
        // Define field captionwidth to be added to unilabeltype_carousel.
80
        $table = new xmldb_table('unilabeltype_carousel');
81
        $field = new xmldb_field('captionwidth', XMLDB_TYPE_INTEGER, '10', null, null, null, null, 'captionstyle');
82
 
83
        // Conditionally launch add field captionwidth.
84
        if (!$dbman->field_exists($table, $field)) {
85
            $dbman->add_field($table, $field);
86
        }
87
        // Carousel savepoint reached.
88
        upgrade_plugin_savepoint(true, 2024050700, 'unilabeltype', 'carousel');
89
    }
90
 
91
    return true;
92
}