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
// This file is part of BasicLTI4Moodle
18
//
19
// BasicLTI4Moodle is an IMS BasicLTI (Basic Learning Tools for Interoperability)
20
// consumer for Moodle 1.9 and Moodle 2.0. BasicLTI is a IMS Standard that allows web
21
// based learning tools to be easily integrated in LMS as native ones. The IMS BasicLTI
22
// specification is part of the IMS standard Common Cartridge 1.1 Sakai and other main LMS
23
// are already supporting or going to support BasicLTI. This project Implements the consumer
24
// for Moodle. Moodle is a Free Open source Learning Management System by Martin Dougiamas.
25
// BasicLTI4Moodle is a project iniciated and leaded by Ludo(Marc Alier) and Jordi Piguillem
26
// at the GESSI research group at UPC.
27
// SimpleLTI consumer for Moodle is an implementation of the early specification of LTI
28
// by Charles Severance (Dr Chuck) htp://dr-chuck.com , developed by Jordi Piguillem in a
29
// Google Summer of Code 2008 project co-mentored by Charles Severance and Marc Alier.
30
//
31
// BasicLTI4Moodle is copyright 2009 by Marc Alier Forment, Jordi Piguillem and Nikolas Galanis
32
// of the Universitat Politecnica de Catalunya http://www.upc.edu
33
// Contact info: Marc Alier Forment granludo @ gmail.com or marc.alier @ upc.edu.
34
 
35
/**
36
 * This file keeps track of upgrades to the lti module
37
 *
38
 * @package mod_lti
39
 * @copyright  2009 Marc Alier, Jordi Piguillem, Nikolas Galanis
40
 *  marc.alier@upc.edu
41
 * @copyright  2009 Universitat Politecnica de Catalunya http://www.upc.edu
42
 * @author     Marc Alier
43
 * @author     Jordi Piguillem
44
 * @author     Nikolas Galanis
45
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
46
 */
47
 
48
/**
49
 * xmldb_lti_upgrade is the function that upgrades
50
 * the lti module database when is needed
51
 *
52
 * This function is automaticly called when version number in
53
 * version.php changes.
54
 *
55
 * @param int $oldversion New old version number.
56
 *
57
 * @return boolean
58
 */
59
function xmldb_lti_upgrade($oldversion) {
60
    global $CFG, $DB, $OUTPUT;
61
 
62
    $dbman = $DB->get_manager();
63
 
64
    // Automatically generated Moodle v4.1.0 release upgrade line.
65
    // Put any upgrade step following this.
66
 
67
    // Automatically generated Moodle v4.2.0 release upgrade line.
68
    // Put any upgrade step following this.
69
 
70
    if ($oldversion < 2023070501) {
71
        // Define table lti_types_categories to be created.
72
        $table = new xmldb_table('lti_types_categories');
73
 
74
        // Adding fields to table lti_types_categories.
75
        $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
76
        $table->add_field('typeid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
77
        $table->add_field('categoryid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
78
 
79
        // Adding keys to table lti_types_categories.
80
        $table->add_key('primary', XMLDB_KEY_PRIMARY, ['id']);
81
        $table->add_key('typeid', XMLDB_KEY_FOREIGN, ['typeid'], 'lti_types', ['id']);
82
        $table->add_key('categoryid', XMLDB_KEY_FOREIGN, ['categoryid'], 'course_categories', ['id']);
83
 
84
        // Conditionally launch create table for lti_types_categories.
85
        if (!$dbman->table_exists($table)) {
86
            $dbman->create_table($table);
87
        }
88
        // Lti savepoint reached.
89
        upgrade_mod_savepoint(true, 2023070501, 'lti');
90
    }
91
 
92
    if ($oldversion < 2023081101) {
93
        // Define table to override coursevisible for a tool on course level.
94
        $table = new xmldb_table('lti_coursevisible');
95
 
96
        // Adding fields to table lti_coursevisible.
97
        $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE);
98
        $table->add_field('typeid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null, 'id');
99
        $table->add_field('courseid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null, 'typeid');
100
        $table->add_field('coursevisible', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, null, 'courseid');
101
 
102
        // Add key.
103
        $table->add_key('primary', XMLDB_KEY_PRIMARY, ['id']);
104
 
105
        // Define index courseid (not unique) to be added to lti_coursevisible.
106
        $table->add_index('courseid', XMLDB_INDEX_NOTUNIQUE, ['courseid']);
107
        // Define index typeid (not unique) to be added to lti_coursevisible.
108
        $table->add_index('typeid', XMLDB_INDEX_NOTUNIQUE, ['typeid']);
109
 
110
        // Conditionally launch create table for overriding coursevisible.
111
        if (!$dbman->table_exists($table)) {
112
            $dbman->create_table($table);
113
        }
114
 
115
        // Lti savepoint reached.
116
        upgrade_mod_savepoint(true, 2023081101, 'lti');
117
    }
118
 
119
    // Automatically generated Moodle v4.3.0 release upgrade line.
120
    // Put any upgrade step following this.
121
 
122
    // Automatically generated Moodle v4.4.0 release upgrade line.
123
    // Put any upgrade step following this.
124
 
125
    return true;
126
}