1. Summary
  2. Files
  3. Support
  4. Report Spam
  5. Create account
  6. Log in

LTI4Wordpress Spanish

From learningapps

Jump to: navigation, search

Main Page

English Version

Contents

Wordpress

WordPress is a free and open source blogging tool and a dynamic content management system (CMS) based on PHP and MySQL. The Integration is based on Multisite Wordpress.

LTI

You can find more information about LTI on http://www.imsglobal.org/lti/

LTI for Wordpress

You can find the last version of the plugin in subversion https://svn.code.sf.net/p/learningapps/code/LTI4Wordpress/trunk This is a fork a LTI plugin developed by Chuck Severance http://code.google.com/p/basiclti4wordpress/.

If the email of the user who is logging in has the same email that the email of an existing user in wordpress but a different username, you will have this error: This email address is already registered.

This plugin is tested with Moodle 1.9.x, 2.0, 2.1 and 2.2 * as a Consumer and Wordpress 2.9.x, 3.0.x, 3.1.x, 3.2.x and 3.2.x

* Moodle 2.2 doesn't validate if you enable Accept grades from the too because there is a bug encoding {


This plugin is developed to allow anybody to add new blogTypes. BlogType allows to customize different plugins, names, roles, themes for each type of blogs; thus, you can define your own types to customize each blog. As a default, the plugin has two blogTypes defined: defaultType and exampleType. To execute exampleType you have to indicate a custom parameter named: blogType=exampleType; if you don't indicate it, it launches the defaultType.

The aim of this document is to show how to develop and customize new blogTypes for LTI for wordpress. The plugin get the basic data and is based on an interface named “blogType”. Each blogType has the implementation and allows to customize each blog. For example, if you want to have two sites under your main blog with differents themes, you can create your own blogTypes.

Test Wordpress

LTI Certification

2012/08/27 was certificated. Registration Number IMSB2Oa2012W1.

Certification Details

http://www.imscert.org

Subversion

URL
https://svn.code.sf.net/p/learningapps/code/LTI4Wordpress/trunk

Installation

  1. Download Moodle http://wordpress.org/download/
  2. Add a Multisite http://codex.wordpress.org/Create_A_Network
  3. Download plugin http://sourceforge.net/projects/learningapps/files/Files/Basic%20LTI%20Integrations/Wordpress/wordpressLTIPlugin.zip/download
  4. Uncompress to wp-content/mu-plugins
  5. Log as superAdmin and go to Network Dashboard -> Settings -> LTI Consumers Keys. Here you can manage the authorized consumers keys
Manage LTI

Wordpress Plugin

This sections explains how the plugin is structured

Parameter blogType

This parameter indicates which wordpress type has to create, having to implement blogType/types/blogType.php. We suggest to create each plugin extending from defaultType.php

interface blogType
{
   public function getCourseName($blti);
   public function getCoursePath($blti, $siteUrlArray, $domain);
   public function setLanguage($blti);
   public function changeTheme();
   public function loadPlugins();
   public function roleMapping($role, $blti);
   public function postActions($obj);
}
Methods Description
getCourseName Get the name of course, if you want you can overwrite this method in your new plugin to customize the course name.
getCoursePath Gets the path of blog (URL to site)
setLanguage Set the Language to the blog, as default is using the launch_presentation_locale
changeTheme Change the theme to the blog
loadPlugins Indicate the list of plugins to load
roleMapping Returns the role from LTI to Wordpress
postActions If the plugin has to execute any extra action you can add some code in this function, has a $obj, it is a stdClass:
  • $obj->blog_id identifier of corrent blog
  • $obj->userkey username
  • $obj->path_base corrent path (myblog/courseName)
  • $obj->domain corrent domain (cv.uoc.edu)
  • $obj->uinfoID Wordpress user id
  • $obj->role corrent role of Wordpress
  • $obj->context has all paràmetres of LTI
  • $obj->blog_is_new indicates if blog has been created or not

Folders

Folders Description
blogType Constants and typesAula loaders
blogType/types The plugins (and interface to implement)
blogType/configuration If your plugin needs some configuration, here you can put here (the format is key=value)
blogType/utils Utilities to load and manage the configurations
IMSBasicLTI/configuration Configuration of authorized consumers keys
IMSBasicLTI/ims-blti LTI library
IMSBasicLTI/uoc-blti This is a wrapper of UOC to get password from configuration and add some utils functions to get data from LTI context
IMSBasicLTI/utils Set of Utilities to manage properties files

Files

File Description
IMSLBasicTI.php This is a main file and calls to blogType and validate LTI request. SuperAdmin can manage configurations of Providers

IMSBasicLTI Folder

File Description
IMSBasicLTI/configuration/authorizedConsumersKey.cfg Only you you don't want to configure via superAdmin This is a configuration to be readed by providers to authorize the consumer key and gets the secret. You have to add
consumer_key."name_consumer".enabled=1
consumer_key."name_consumer".secret=secret
for example to add new with resource key “test” and password “testpasswd”
consumer_key.test.enabled=1
consumer_key.test.secret=testpasswd
IMSBasicLTI/ims-blti/blti_util.php Utilities of BasicLTI, signing
IMSBasicLTI/ims-blti/blti.php Core validation and main functions to get data of LTI context
IMSBasicLTI/ims-blti/OAuth.php PHP Oauth Implementation
IMSBasicLTI/uoc-blti/bltiUocWrapper.php It is a wrapper of blti.php that enables to load a password from file, add some useful functions
IMSBasicLTI/utils/UtilsPropertiesBLTI.php Allow to read configuration file (as a properties, key=value)

blogType Folder

File Description
blogType/Constants.php Set of constants
blogType/MessageBlogsType.php Constants to manage error and messages
blogType/configuration/exampleType.cfg This is a example configuration file for exampleType.php. Here you can define the default name of blog (blogname)
blogType/configuration/general.cfg This file contains a set of parameters used in IMSBasicLTI.php.

You can set if use prefixed username or as parameter

#1 indicates without prefix, if you don't indicate the value it assume 0
use_username=0
blogType/types/blogType.php The interface all types has to implements it
blogType/types/defaultType.php The defaultType, every new type has to extends it
blogType/types/exampleType.php In this example overwrite some methods like loadPlugins, roleMapping and postActions (rest of methods are inherited from defaultType.php
blogType/utils/UtilsPropertiesWP.php This utils allows to read the configuration types

Develop your own type

The interface blogType/types/blogType.php determines which methods are implemented in our type. However it is recommended that any development should extend the default type (defaultType.php) in order to cover the cases default or generic. This will simply implement the methods that are different from default. The name of the type has to be the name of the file and the class (in the example should be myType.php)

class myType extends defaultType implements typeAula {
.....
}

Please note the class name must match the file respecting upper/lower case. Suppose the 6 marks the interface methods that do not want to overwrite getCourseName setLanguage and therefore we must create a file with the following content without external configuration:

Type without configuration

<?php
/**
* @name Plugin  myType
* @abstract Plugin to implement typeAula and modify wordpress for blogType "myType"
* @author Antoni Bertran (abertranb@uoc.edu)
* @copyright 2011 Universitat Oberta de Catalunya
* @license GPL
* @version 1.0.0
* Date March 2011
*/
require_once(dirname(__FILE__).DIRECTORY_SEPARATOR.'typeAula.php');
require_once(dirname(__FILE__).DIRECTORY_SEPARATOR.'defaultType.php');

class myType extends defaultType implements typeAula {

	public function changeTheme() {
		
		switch_theme("theme_myType", "theme_myType"); 
                   
	}

	public function loadPlugins() {
	    $plugins = $this->removeActivedPlugins(array("akismet/akismet.php"));
	    activate_plugins($plugins,);
	}
 
	public function roleMapping($role, $blti) {
		
	    if ($role == 'Administrator' || $role == 'Instructor,Administrator') return 'administrator';
	    if ($role == 'Instructor') return 'editor';
		
	    return 'subscriber';
	}
 
     /**
      * This function contains the last actions before show blog
      */
     public function postActions($obj) {
   	 (...)
     }
}


Type with configuration

<?php
/**
* @name Plugin  myType
* @abstract Plugin to implement typeAula and modify wordpress for blogType "myType"
* @author Antoni Bertran (abertranb@uoc.edu)
* @copyright 2011 Universitat Oberta de Catalunya
* @license GPL
* @version 1.0.0
* Date March 2011
*/
require_once(dirname(__FILE__).DIRECTORY_SEPARATOR.'typeAula.php');
require_once(dirname(__FILE__).DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'utils'.DIRECTORY_SEPARATOR.'UtilsPropertiesWP.php');
require_once(dirname(__FILE__).DIRECTORY_SEPARATOR.'defaultType.php');

class myType extends defaultType implements typeAula {
 
       private $configuration = null;

       /**
       * Only if needs to load configuration file
       **/	
	public function __construct() {
          //Loads configuration
          $this->configuration = new UtilsPropertiesWP(dirname(__FILE__).'/../configuration/'.get_class($this).'.cfg');
	} 

	public function changeTheme() {
		
		switch_theme("theme_myType", "theme_myType"); 
                   
	}

	public function loadPlugins() {
	    $plugins = $this->removeActivedPlugins(array("akismet/akismet.php"));
	    activate_plugins($plugins,);
	}
 
	public function roleMapping($role, $blti) {
		
	    if ($role == 'Administrator' || $role == 'Instructor,Administrator') return 'administrator';
	    if ($role == 'Instructor') return 'editor';
		
	    return 'subscriber';
	}
 
     /**
      * This function contains the last actions before show blog
      */
     public function postActions($obj) {
   	 (...)
     }
}

Custom parameters to change behaviour

Overwrite Plugins and Themes

By default, once you have created a blog, it does not reload the plugins and themes by default so, if the consultant has changed something, it does not override. If we wished that every time it re-establish the original plugins, you should pass a new parameter overwrite_plugins_theme with value 1 (parameter should be added in custom parameters)

Overwrite Roles

By default, once you have created a blog and was assigned to user the role doesn't change. If you indicate overwrite_roles as 1 (parameter should be added in custom parameters) then overwrite role.

If you start as Student in Consumer then the role is mapped as contributor (for example) then If your role change in Consumer as Teacher the role is not modified in Wordpress, but if you indicate overwrite_roles as 1 then it will be changed

Use Username

The plugin allows to use the real username instead of the username provided by BLTI (uoc.edu_userid.25555). Therefore there is a configuration file that is wp-content/mu-plugins/blogType/configuration/general.cfg indicating:

use_username=1

If it is enabled, you can solve the problem of error This email address is already registered, because the user is not prefixed.

English Version

Main Page

Personal tools