Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/mod/lti/settings.php
Go to the documentation of this file.
00001 <?php
00002 // This file is part of Moodle - http://moodle.org/
00003 //
00004 // Moodle is free software: you can redistribute it and/or modify
00005 // it under the terms of the GNU General Public License as published by
00006 // the Free Software Foundation, either version 3 of the License, or
00007 // (at your option) any later version.
00008 //
00009 // Moodle is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 // GNU General Public License for more details.
00013 //
00014 // You should have received a copy of the GNU General Public License
00015 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
00016 //
00017 // This file is part of BasicLTI4Moodle
00018 //
00019 // BasicLTI4Moodle is an IMS BasicLTI (Basic Learning Tools for Interoperability)
00020 // consumer for Moodle 1.9 and Moodle 2.0. BasicLTI is a IMS Standard that allows web
00021 // based learning tools to be easily integrated in LMS as native ones. The IMS BasicLTI
00022 // specification is part of the IMS standard Common Cartridge 1.1 Sakai and other main LMS
00023 // are already supporting or going to support BasicLTI. This project Implements the consumer
00024 // for Moodle. Moodle is a Free Open source Learning Management System by Martin Dougiamas.
00025 // BasicLTI4Moodle is a project iniciated and leaded by Ludo(Marc Alier) and Jordi Piguillem
00026 // at the GESSI research group at UPC.
00027 // SimpleLTI consumer for Moodle is an implementation of the early specification of LTI
00028 // by Charles Severance (Dr Chuck) htp://dr-chuck.com , developed by Jordi Piguillem in a
00029 // Google Summer of Code 2008 project co-mentored by Charles Severance and Marc Alier.
00030 //
00031 // BasicLTI4Moodle is copyright 2009 by Marc Alier Forment, Jordi Piguillem and Nikolas Galanis
00032 // of the Universitat Politecnica de Catalunya http://www.upc.edu
00033 // Contact info: Marc Alier Forment granludo @ gmail.com or marc.alier @ upc.edu
00034 
00050 defined('MOODLE_INTERNAL') || die;
00051 
00052 if ($ADMIN->fulltree) {
00053     require_once($CFG->dirroot.'/mod/lti/locallib.php');
00054 
00055     $configuredtoolshtml = '';
00056     $pendingtoolshtml = '';
00057     $rejectedtoolshtml = '';
00058 
00059     $active = get_string('active', 'lti');
00060     $pending = get_string('pending', 'lti');
00061     $rejected = get_string('rejected', 'lti');
00062     $typename = get_string('typename', 'lti');
00063     $baseurl = get_string('baseurl', 'lti');
00064     $action = get_string('action', 'lti');
00065     $createdon = get_string('createdon', 'lti');
00066 
00067     $types = lti_filter_get_types(get_site()->id);
00068 
00069     $configuredtools = array_filter($types, function($value) {
00070         return $value->state == LTI_TOOL_STATE_CONFIGURED;
00071     });
00072 
00073     $configuredtoolshtml = lti_get_tool_table($configuredtools, 'lti_configured');
00074 
00075     $pendingtools = array_filter($types, function($value) {
00076         return $value->state == LTI_TOOL_STATE_PENDING;
00077     });
00078 
00079     $pendingtoolshtml = lti_get_tool_table($pendingtools, 'lti_pending');
00080 
00081     $rejectedtools = array_filter($types, function($value) {
00082         return $value->state == LTI_TOOL_STATE_REJECTED;
00083     });
00084 
00085     $rejectedtoolshtml = lti_get_tool_table($rejectedtools, 'lti_rejected');
00086 
00087     $tab = optional_param('tab', '', PARAM_ALPHAEXT);
00088     $activeselected = '';
00089     $pendingselected = '';
00090     $rejectedselected = '';
00091     switch ($tab) {
00092         case 'lti_pending':
00093             $pendingselected = 'class="selected"';
00094             break;
00095         case 'lti_rejected':
00096             $rejectedselected = 'class="selected"';
00097             break;
00098         default:
00099             $activeselected = 'class="selected"';
00100             break;
00101     }
00102 
00103     $template = "
00104 <div id=\"lti_tabs\" class=\"yui-navset\">
00105     <ul id=\"lti_tab_heading\" class=\"yui-nav\" style=\"display:none\">
00106         <li {$activeselected}>
00107             <a href=\"#tab1\">
00108                 <em>$active</em>
00109             </a>
00110         </li>
00111         <li {$pendingselected}>
00112             <a href=\"#tab2\">
00113                 <em>$pending</em>
00114             </a>
00115         </li>
00116         <li {$rejectedselected}>
00117             <a href=\"#tab3\">
00118                 <em>$rejected</em>
00119             </a>
00120         </li>
00121     </ul>
00122     <div class=\"yui-content\">
00123         <div>
00124             $configuredtoolshtml
00125         </div>
00126         <div>
00127             $pendingtoolshtml
00128         </div>
00129         <div>
00130             $rejectedtoolshtml
00131         </div>
00132     </div>
00133 </div>
00134 
00135 <script type=\"text/javascript\">
00136 //<![CDATA[
00137     (function(){
00138         //If javascript is disabled, they will just see the three tabs one after another
00139         var lti_tab_heading = document.getElementById('lti_tab_heading');
00140         lti_tab_heading.style.display = '';
00141 
00142         new YAHOO.widget.TabView('lti_tabs');
00143 
00144         var setupTools = function(id, sort){
00145             var lti_tools = YAHOO.util.Dom.get(id + '_tools');
00146 
00147             if(lti_tools){
00148                 var dataSource = new YAHOO.util.DataSource(lti_tools);
00149 
00150                 var configuredColumns = [
00151                     {key:'name', label:'$typename', sortable:true},
00152                     {key:'baseURL', label:'$baseurl', sortable:true},
00153                     {key:'timecreated', label:'$createdon', sortable:true, formatter:YAHOO.widget.DataTable.formatDate},
00154                     {key:'action', label:'$action'}
00155                 ];
00156 
00157                 dataSource.responseType = YAHOO.util.DataSource.TYPE_HTMLTABLE;
00158                 dataSource.responseSchema = {
00159                     fields: [
00160                         {key:'name'},
00161                         {key:'baseURL'},
00162                         {key:'timecreated', parser:'date'},
00163                         {key:'action'}
00164                     ]
00165                 };
00166 
00167                 new YAHOO.widget.DataTable(id + '_container', configuredColumns, dataSource,
00168                     {
00169                         sortedBy: sort
00170                     }
00171                 );
00172             }
00173         };
00174 
00175         setupTools('lti_configured', {key:'name', dir:'asc'});
00176         setupTools('lti_pending', {key:'timecreated', dir:'desc'});
00177         setupTools('lti_rejected', {key:'timecreated', dir:'desc'});
00178     })();
00179 //]]
00180 </script>
00181 ";
00182     global $PAGE; // TODO: Move to YUI3 ASAP
00183     $PAGE->requires->yui2_lib('tabview');
00184     $PAGE->requires->yui2_lib('datatable');
00185 
00186     $settings->add(new admin_setting_heading('lti_types', get_string('external_tool_types', 'lti') . $OUTPUT->help_icon('main_admin', 'lti'), $template));
00187 }
 All Data Structures Namespaces Files Functions Variables Enumerations