Permalink
Browse files

Adding basiclti plugin

  • Loading branch information...
1 parent 735de1c commit b7e436b0373ea6fb377c4d4b7003d38586fb1847 @scriby scriby committed Aug 25, 2011
View
No changes.
@@ -0,0 +1,105 @@
+<?php
+// This file is part of BasicLTI4Moodle
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+// BasicLTI4Moodle is an IMS BasicLTI (Basic Learning Tools for Interoperability)
+// consumer for Moodle 1.9 and Moodle 2.0. BasicLTI is a IMS Standard that allows web
+// based learning tools to be easily integrated in LMS as native ones. The IMS BasicLTI
+// specification is part of the IMS standard Common Cartridge 1.1 Sakai and other main LMS
+// are already supporting or going to support BasicLTI. This project Implements the consumer
+// for Moodle. Moodle is a Free Open source Learning Management System by Martin Dougiamas.
+// BasicLTI4Moodle is a project iniciated and leaded by Ludo(Marc Alier) and Jordi Piguillem
+// at the GESSI research group at UPC.
+// SimpleLTI consumer for Moodle is an implementation of the early specification of LTI
+// by Charles Severance (Dr Chuck) htp://dr-chuck.com , developed by Jordi Piguillem in a
+// Google Summer of Code 2008 project co-mentored by Charles Severance and Marc Alier.
+//
+// BasicLTI4Moodle is copyright 2009 by Marc Alier Forment, Jordi Piguillem and Nikolas Galanis
+// of the Universitat Politecnica de Catalunya http://www.upc.edu
+// Contact info: Marc Alier Forment granludo @ gmail.com or marc.alier @ upc.edu
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * This file contains a Trivial memory-based store - no support for tokens
+ *
+ * @package basiclti
+ * @copyright IMS Global Learning Consortium
+ *
+ * @author Charles Severance csev@umich.edu
+ *
+ * @license http://www.apache.org/licenses/LICENSE-2.0
+ */
+
+defined('MOODLE_INTERNAL') || die;
+
+/**
+ * A Trivial memory-based store - no support for tokens
+ */
+class TrivialOAuthDataStore extends OAuthDataStore {
+ private $consumers = array();
+
+ function add_consumer($consumer_key, $consumer_secret) {
+ $this->consumers[$consumer_key] = $consumer_secret;
+ }
+
+ function lookup_consumer($consumer_key) {
+ if ( strpos($consumer_key, "http://" ) === 0 ) {
+ $consumer = new OAuthConsumer($consumer_key, "secret", null);
+ return $consumer;
+ }
+ if ( $this->consumers[$consumer_key] ) {
+ $consumer = new OAuthConsumer($consumer_key, $this->consumers[$consumer_key], null);
+ return $consumer;
+ }
+ return null;
+ }
+
+ function lookup_token($consumer, $token_type, $token) {
+ return new OAuthToken($consumer, "");
+ }
+
+ // Return NULL if the nonce has not been used
+ // Return $nonce if the nonce was previously used
+ function lookup_nonce($consumer, $token, $nonce, $timestamp) {
+ // Should add some clever logic to keep nonces from
+ // being reused - for no we are really trusting
+ // that the timestamp will save us
+ return null;
+ }
+
+ function new_request_token($consumer) {
+ return null;
+ }
+
+ function new_access_token($token, $consumer) {
+ return null;
+ }
+}
@@ -0,0 +1,91 @@
+<?php
+// This file is part of BasicLTI4Moodle
+//
+// BasicLTI4Moodle is an IMS BasicLTI (Basic Learning Tools for Interoperability)
+// consumer for Moodle 1.9 and Moodle 2.0. BasicLTI is a IMS Standard that allows web
+// based learning tools to be easily integrated in LMS as native ones. The IMS BasicLTI
+// specification is part of the IMS standard Common Cartridge 1.1 Sakai and other main LMS
+// are already supporting or going to support BasicLTI. This project Implements the consumer
+// for Moodle. Moodle is a Free Open source Learning Management System by Martin Dougiamas.
+// BasicLTI4Moodle is a project iniciated and leaded by Ludo(Marc Alier) and Jordi Piguillem
+// at the GESSI research group at UPC.
+// SimpleLTI consumer for Moodle is an implementation of the early specification of LTI
+// by Charles Severance (Dr Chuck) htp://dr-chuck.com , developed by Jordi Piguillem in a
+// Google Summer of Code 2008 project co-mentored by Charles Severance and Marc Alier.
+//
+// BasicLTI4Moodle is copyright 2009 by Marc Alier Forment, Jordi Piguillem and Nikolas Galanis
+// of the Universitat Politecnica de Catalunya http://www.upc.edu
+// Contact info: Marc Alier Forment granludo @ gmail.com or marc.alier @ upc.edu
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+
+
+/**
+ * This file contains the basiclti module backup class
+ *
+ * @package basiclti
+ * @copyright 2009 Marc Alier, Jordi Piguillem, Nikolas Galanis
+ * marc.alier@upc.edu
+ * @copyright 2009 Universitat Politecnica de Catalunya http://www.upc.edu
+ *
+ * @author Marc Alier
+ * @author Jordi Piguillem
+ * @author Nikolas Galanis
+ *
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+require_once($CFG->dirroot . '/mod/basiclti/backup/moodle2/backup_basiclti_stepslib.php');
+
+/**
+ * basiclti backup task that provides all the settings and steps to perform one
+ * complete backup of the module
+ */
+class backup_basiclti_activity_task extends backup_activity_task {
+
+ /**
+ * Define (add) particular settings this activity can have
+ */
+ protected function define_my_settings() {
+ // No particular settings for this activity
+ }
+
+ /**
+ * Define (add) particular steps this activity can have
+ */
+ protected function define_my_steps() {
+ // Choice only has one structure step
+ $this->add_step(new backup_basiclti_activity_structure_step('basiclti_structure', 'basiclti.xml'));
+ }
+
+ /**
+ * Code the transformations to perform in the activity in
+ * order to get transportable (encoded) links
+ */
+ static public function encode_content_links($content) {
+ global $CFG;
+
+ $base = preg_quote($CFG->wwwroot, "/");
+
+ // Link to the list of basiclti tools
+ $search="/(".$base."\/mod\/basiclti\/index.php\?id\=)([0-9]+)/";
+ $content= preg_replace($search, '$@BASICLTIINDEX*$2@$', $content);
+
+ // Link to basiclti view by moduleid
+ $search="/(".$base."\/mod\/basiclti\/view.php\?id\=)([0-9]+)/";
+ $content= preg_replace($search, '$@BASICLTIVIEWBYID*$2@$', $content);
+
+ return $content;
+ }
+}
@@ -0,0 +1,87 @@
+<?php
+// This file is part of BasicLTI4Moodle
+//
+// BasicLTI4Moodle is an IMS BasicLTI (Basic Learning Tools for Interoperability)
+// consumer for Moodle 1.9 and Moodle 2.0. BasicLTI is a IMS Standard that allows web
+// based learning tools to be easily integrated in LMS as native ones. The IMS BasicLTI
+// specification is part of the IMS standard Common Cartridge 1.1 Sakai and other main LMS
+// are already supporting or going to support BasicLTI. This project Implements the consumer
+// for Moodle. Moodle is a Free Open source Learning Management System by Martin Dougiamas.
+// BasicLTI4Moodle is a project iniciated and leaded by Ludo(Marc Alier) and Jordi Piguillem
+// at the GESSI research group at UPC.
+// SimpleLTI consumer for Moodle is an implementation of the early specification of LTI
+// by Charles Severance (Dr Chuck) htp://dr-chuck.com , developed by Jordi Piguillem in a
+// Google Summer of Code 2008 project co-mentored by Charles Severance and Marc Alier.
+//
+// BasicLTI4Moodle is copyright 2009 by Marc Alier Forment, Jordi Piguillem and Nikolas Galanis
+// of the Universitat Politecnica de Catalunya http://www.upc.edu
+// Contact info: Marc Alier Forment granludo @ gmail.com or marc.alier @ upc.edu
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * This file contains all the backup steps that will be used
+ * by the backup_basiclti_activity_task
+ *
+ * @package basiclti
+ * @copyright 2009 Marc Alier, Jordi Piguillem, Nikolas Galanis
+ * marc.alier@upc.edu
+ * @copyright 2009 Universitat Politecnica de Catalunya http://www.upc.edu
+ *
+ * @author Marc Alier
+ * @author Jordi Piguillem
+ * @author Nikolas Galanis
+ *
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+/**
+ * Define all the backup steps that will be used by the backup_basiclti_activity_task
+ */
+
+/**
+ * Define the complete assignment structure for backup, with file and id annotations
+ */
+class backup_basiclti_activity_structure_step extends backup_activity_structure_step {
+
+ protected function define_structure() {
+
+ // To know if we are including userinfo
+ $userinfo = $this->get_setting_value('userinfo');
+
+ // Define each element separated
+ $basiclti = new backup_nested_element('basiclti', array('id'), array(
+ 'name', 'intro', 'introformat', 'timecreated', 'timemodified',
+ 'typeid', 'toolurl', 'preferheight', 'instructorchoiccesendname',
+ 'instructorchoicesendemailaddr', 'organizationid',
+ 'organizationurl', 'organizationdescr', 'launchinpopup',
+ 'debuglaunch', 'instructorchoiceacceptgrades', 'instructorchoiceallowroster',
+ 'instructorchoiceallowsetting', 'grade', 'instructorcustomparameters'));
+
+ // Build the tree
+ // (none)
+
+ // Define sources
+ $basiclti->set_source_table('basiclti', array('id' => backup::VAR_ACTIVITYID));
+
+ // Define id annotations
+ // (none)
+
+ // Define file annotations
+ $basiclti->annotate_files('mod_basiclti', 'intro', null); // This file areas haven't itemid
+
+ // Return the root element (basiclti), wrapped into standard activity structure
+ return $this->prepare_activity_structure($basiclti);
+ }
+}
Oops, something went wrong. Retry.

0 comments on commit b7e436b

Please sign in to comment.