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 defines the global lti administration form
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
 * @author     Chris Scribner
46
 * @copyright  2015 Vital Source Technologies http://vitalsource.com
47
 * @author     Stephen Vickers
48
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
49
 */
50
 
51
defined('MOODLE_INTERNAL') || die;
52
 
53
/*
54
 * @var admin_settingpage $settings
55
 */
56
$modltifolder = new admin_category('modltifolder', new lang_string('pluginname', 'mod_lti'), $module->is_enabled() === false);
57
$ADMIN->add('modsettings', $modltifolder);
58
$settings->visiblename = new lang_string('manage_tools', 'mod_lti');
59
$settings->hidden = true;
60
$ADMIN->add('modltifolder', $settings);
61
$proxieslink = new admin_externalpage('ltitoolproxies',
62
        get_string('manage_tool_proxies', 'lti'),
63
        new moodle_url('/mod/lti/toolproxies.php'));
64
$proxieslink->hidden = true;
65
$ADMIN->add('modltifolder', $proxieslink);
66
$ADMIN->add('modltifolder', new admin_externalpage('ltitoolconfigure',
67
        get_string('manage_external_tools', 'lti'),
68
        new moodle_url('/mod/lti/toolconfigure.php')));
69
 
70
foreach (core_plugin_manager::instance()->get_plugins_of_type('ltisource') as $plugin) {
71
    /*
72
     * @var \mod_lti\plugininfo\ltisource $plugin
73
     */
74
    $plugin->load_settings($ADMIN, 'modltifolder', $hassiteconfig);
75
}
76
 
77
$toolproxiesurl = new moodle_url('/mod/lti/toolproxies.php');
78
$toolproxiesurl = $toolproxiesurl->out();
79
 
80
if ($ADMIN->fulltree) {
81
    require_once($CFG->dirroot.'/mod/lti/locallib.php');
82
 
83
    $configuredtoolshtml = '';
84
    $pendingtoolshtml = '';
85
    $rejectedtoolshtml = '';
86
 
87
    $active = get_string('active', 'lti');
88
    $pending = get_string('pending', 'lti');
89
    $rejected = get_string('rejected', 'lti');
90
 
91
    // Gather strings used for labels in the inline JS.
92
    $PAGE->requires->strings_for_js(
93
        array(
94
            'typename',
95
            'baseurl',
96
            'action',
97
            'createdon'
98
        ),
99
        'mod_lti'
100
    );
101
 
102
    $types = lti_filter_get_types(get_site()->id);
103
 
104
    $configuredtools = lti_filter_tool_types($types, LTI_TOOL_STATE_CONFIGURED);
105
 
106
    $configuredtoolshtml = lti_get_tool_table($configuredtools, 'lti_configured');
107
 
108
    $pendingtools = lti_filter_tool_types($types, LTI_TOOL_STATE_PENDING);
109
 
110
    $pendingtoolshtml = lti_get_tool_table($pendingtools, 'lti_pending');
111
 
112
    $rejectedtools = lti_filter_tool_types($types, LTI_TOOL_STATE_REJECTED);
113
 
114
    $rejectedtoolshtml = lti_get_tool_table($rejectedtools, 'lti_rejected');
115
 
116
    $tab = optional_param('tab', '', PARAM_ALPHAEXT);
117
    $activeselected = '';
118
    $pendingselected = '';
119
    $rejectedselected = '';
120
    switch ($tab) {
121
        case 'lti_pending':
122
            $pendingselected = 'class="selected"';
123
            break;
124
        case 'lti_rejected':
125
            $rejectedselected = 'class="selected"';
126
            break;
127
        default:
128
            $activeselected = 'class="selected"';
129
            break;
130
    }
131
    $addtype = get_string('addtype', 'lti');
132
    $config = get_string('manage_tool_proxies', 'lti');
133
 
134
    $addtypeurl = "{$CFG->wwwroot}/mod/lti/typessettings.php?action=add&amp;sesskey={$USER->sesskey}";
135
 
136
    $template = <<< EOD
137
<div id="lti_tabs" class="yui-navset">
138
    <ul id="lti_tab_heading" class="yui-nav" style="display:none">
139
        <li {$activeselected}>
140
            <a href="#tab1">
141
                <em>$active</em>
142
            </a>
143
        </li>
144
        <li {$pendingselected}>
145
            <a href="#tab2">
146
                <em>$pending</em>
147
            </a>
148
        </li>
149
        <li {$rejectedselected}>
150
            <a href="#tab3">
151
                <em>$rejected</em>
152
            </a>
153
        </li>
154
    </ul>
155
    <div class="yui-content">
156
        <div>
157
            <div><a style="margin-top:.25em" href="{$addtypeurl}">{$addtype}</a></div>
158
            $configuredtoolshtml
159
        </div>
160
        <div>
161
            $pendingtoolshtml
162
        </div>
163
        <div>
164
            $rejectedtoolshtml
165
        </div>
166
    </div>
167
</div>
168
 
169
<script type="text/javascript">
170
//<![CDATA[
171
    YUI().use('yui2-tabview', 'yui2-datatable', function(Y) {
172
        //If javascript is disabled, they will just see the three tabs one after another
173
        var lti_tab_heading = document.getElementById('lti_tab_heading');
174
        lti_tab_heading.style.display = '';
175
 
176
        new Y.YUI2.widget.TabView('lti_tabs');
177
 
178
        var setupTools = function(id, sort){
179
            var lti_tools = Y.YUI2.util.Dom.get(id);
180
 
181
            if(lti_tools){
182
                var dataSource = new Y.YUI2.util.DataSource(lti_tools);
183
 
184
                var configuredColumns = [
185
                    {key:'name', label: M.util.get_string('typename', 'mod_lti'), sortable: true},
186
                    {key:'baseURL', label: M.util.get_string('baseurl', 'mod_lti'), sortable: true},
187
                    {key:'timecreated', label: M.util.get_string('createdon', 'mod_lti'), sortable: true},
188
                    {key:'action', label: M.util.get_string('action', 'mod_lti')}
189
                ];
190
 
191
                dataSource.responseType = Y.YUI2.util.DataSource.TYPE_HTMLTABLE;
192
                dataSource.responseSchema = {
193
                    fields: [
194
                        {key:'name'},
195
                        {key:'baseURL'},
196
                        {key:'timecreated'},
197
                        {key:'action'}
198
                    ]
199
                };
200
 
201
                new Y.YUI2.widget.DataTable(id + '_container', configuredColumns, dataSource,
202
                    {
203
                        sortedBy: sort
204
                    }
205
                );
206
            }
207
        };
208
 
209
        setupTools('lti_configured_tools', {key:'name', dir:'asc'});
210
        setupTools('lti_pending_tools', {key:'timecreated', dir:'desc'});
211
        setupTools('lti_rejected_tools', {key:'timecreated', dir:'desc'});
212
    });
213
//]]
214
</script>
215
EOD;
216
    $settings->add(new admin_setting_heading('lti_types', new lang_string('external_tool_types', 'lti') .
217
        $OUTPUT->help_icon('main_admin', 'lti'), $template));
218
}
219
 
220
// Tell core we already added the settings structure.
221
$settings = null;
222