[ Index ]

PHP Cross Reference of moodle-2.8

title

Body

[close]

/mod/lti/ -> settings.php (source)

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


Generated: Fri Nov 28 20:29:05 2014 Cross-referenced by PHPXref 0.7.1