\unikent\ReadingListsAPI

Reading Lists API.

Examples

How to grab a module's reading lists.

<?php
/**
 * Reading Lists API for is-dev applications.
 *
 * @package    ReadingLists
 * @copyright  2014 Skylar Kelty <S.Kelty@kent.ac.uk>
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */

require_once("vendor/autoload.php");

$api = new \unikent\ReadingLists\API();

$lists = $api->get_lists("EN902");

foreach ($lists as $list) {
    echo "---------------------------------\n";
    echo $list;
}

How to grab a module's reading lists for a campus in a given year.

<?php
/**
 * Reading Lists API for is-dev applications.
 *
 * @package    ReadingLists
 * @copyright  2014 Skylar Kelty <S.Kelty@kent.ac.uk>
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */

require_once("vendor/autoload.php");

$api = new \unikent\ReadingLists\API();
$api->set_timeout(4000);
$api->set_timeperiod("2013");
$api->set_campus("canterbury");

$lists = $api->get_lists("EN902");

foreach ($lists as $list) {
    echo "---------------------------------\n";
    echo $list;
}

Summary

Methods
Properties
Constants
__construct()
set_timeout()
set_campus()
set_timeperiod()
set_cache_layer()
get_lists()
No public properties found
CANTERBURY_URL
MEDWAY_URL
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Constants

CANTERBURY_URL

CANTERBURY_URL

URL of the Canterbury Reading Lists system.

MEDWAY_URL

MEDWAY_URL

URL of the Medway Reading Lists system.

Methods

__construct()

__construct() 

Constructor.

set_timeout()

set_timeout(integer  $timeout) 

Set a custom CURL timeout

Parameters

integer $timeout

CURL Timeout in ms

set_campus()

set_campus(string  $campus) 

Set the campus we want lists from.

Defaults to all lists.

Parameters

string $campus

Canterbury or Medway, or an array of both.

set_timeperiod()

set_timeperiod(string  $timeperiod = null) 

Set a time period (year).

Parameters

string $timeperiod

Time period to CURL. Defaults to latest.

set_cache_layer()

set_cache_layer(object  $cache) 

Set a cache object.

This API expects it can call "set($key, $value)" and "get($key)" and wont try to do anything else.

Parameters

object $cache

An object with get and set methods.

get_lists()

get_lists(string  $modulecode) : array

Returns a list of reading lists for a given module code.

Parameters

string $modulecode

Module Code

Returns

array —

An array of URLs to reading lists