blob: 0f16cd09acfd2310508075a47331ae71801f2324 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
<?php
/**
*
* This class contains methods to handle LonCapa learning modules
*
* @modulegroup elearning_interface_modules
* @module LonCapaContentModule
* @package ELearning-Interface
*/
class LonCapaContentModule extends ContentModule
{
/**
* @var LonCapaRequest
*/
public $lcRequest;
/**
* @var string
*/
public $cmsUrl;
/**
* LonCapaContentModule constructor.
* @param string $module_id
* @param string $module_type
* @param string $cms_type
*/
public function __construct($module_id, $module_type, $cms_type)
{
$this->lcRequest = new LonCapaRequest();
$this->cmsUrl = $GLOBALS['ELEARNING_INTERFACE_MODULES'][$cms_type]['ABSOLUTE_PATH_ELEARNINGMODULES'];
parent::__construct($module_id, $module_type, $cms_type);
}
/**
*fetch data from LonCapa
*
*/
public function readData()
{
$url = $this->cmsUrl . '/course/' . urlencode($this->id);
$response = $this->lcRequest->request($url);
if ($response) {
$courses = new SimpleXMLElement($response);
$course = $courses->course[0];
list($author, $dummy) = explode(':', (string)$course->owner);
$this->id = (string)$course->id;
$this->title = (string)$course->description;
$this->authors = $author;
}
}
/**
* get permission-status
*
*
* @param string $operation operation
* @return boolean allowed
*/
public function isAllowed($operation)
{
return true;
}
/**
* store connection between Stud.IP course and LonCapa course
*
* @param string $seminar_id
* @return bool
*/
public function setConnection($seminar_id)
{
$this->is_connected = true;
return ObjectConnections::setConnection(
$seminar_id,
$this->id,
$this->module_type,
$this->cms_type
);
}
}
|