[ Index ] |
PHP Cross Reference of moodle-2.8 |
[Summary view] [Print] [Text view]
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 * This file contains the script used to register a new external tool. 19 * 20 * It is used to create a new form used to configure the capabilities 21 * and services to be offered to the tool provider. 22 * 23 * @package mod_lti 24 * @copyright 2014 Vital Source Technologies http://vitalsource.com 25 * @author Stephen Vickers 26 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 27 */ 28 29 require_once('../../config.php'); 30 require_once($CFG->libdir.'/adminlib.php'); 31 require_once($CFG->dirroot.'/mod/lti/edit_form.php'); 32 require_once($CFG->dirroot.'/mod/lti/locallib.php'); 33 34 $action = optional_param('action', '', PARAM_ALPHANUMEXT); 35 $id = optional_param('id', '', PARAM_INT); 36 $tab = optional_param('tab', '', PARAM_ALPHAEXT); 37 38 // No guest autologin. 39 require_login(0, false); 40 41 require_sesskey(); 42 43 // Check this is for a tool created from a tool proxy. 44 $err = empty($id); 45 if (!$err) { 46 $type = lti_get_type_type_config($id); 47 $err = empty($type->toolproxyid); 48 } 49 if ($err) { 50 $redirect = new moodle_url('/mod/lti/typessettings.php', 51 array('action' => $action, 'id' => $id, 'sesskey' => sesskey(), 'tab' => $tab)); 52 redirect($redirect); 53 } 54 55 $pageurl = new moodle_url('/mod/lti/toolssettings.php'); 56 if (!empty($id)) { 57 $pageurl->param('id', $id); 58 } 59 $PAGE->set_url($pageurl); 60 61 admin_externalpage_setup('managemodules'); // Hacky solution for printing the admin page. 62 63 $redirect = "$CFG->wwwroot/$CFG->admin/settings.php?section=modsettinglti&tab={$tab}"; 64 65 if ($action == 'accept') { 66 lti_set_state_for_type($id, LTI_TOOL_STATE_CONFIGURED); 67 redirect($redirect); 68 } else if (($action == 'reject') || ($action == 'delete')) { 69 lti_set_state_for_type($id, LTI_TOOL_STATE_REJECTED); 70 redirect($redirect); 71 } 72 73 $form = new mod_lti_edit_types_form($pageurl, (object)array('isadmin' => true, 'istool' => true)); 74 75 if ($data = $form->get_data()) { 76 $type = new stdClass(); 77 if (!empty($id)) { 78 $type->id = $id; 79 lti_update_type($type, $data); 80 } else { 81 $type->state = LTI_TOOL_STATE_CONFIGURED; 82 lti_add_type($type, $data); 83 } 84 redirect($redirect); 85 } else if ($form->is_cancelled()) { 86 redirect($redirect); 87 } 88 89 $PAGE->set_title(format_string($SITE->shortname) . ': ' . get_string('toolsetup', 'lti')); 90 $PAGE->navbar->add(get_string('lti_administration', 'lti'), $CFG->wwwroot.'/'.$CFG->admin.'/settings.php?section=modsettinglti'); 91 92 echo $OUTPUT->header(); 93 echo $OUTPUT->heading(get_string('toolsetup', 'lti')); 94 echo $OUTPUT->box_start('generalbox'); 95 96 if ($action == 'update') { 97 $form->set_data($type); 98 } 99 100 $form->display(); 101 echo $OUTPUT->box_end(); 102 echo $OUTPUT->footer();
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 20:29:05 2014 | Cross-referenced by PHPXref 0.7.1 |