-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathpoodlllogiclib.php
56 lines (46 loc) · 1.83 KB
/
poodlllogiclib.php
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
<?php
/**
* internal library of functions and constants for Poodll modules
* accessed directly by poodll flash widgets on web pages.
*
* @package mod-poodllpairwork
* @category mod
* @author Justin Hunt
*
*/
/**
* Includes and requires
*/
//relative path is dangerous, so only use it if we have no $CFG already Justin 20120424
if (!isset($CFG)) {
require_once("../../config.php");
}
require_login();
//added for moodle 2
require_once($CFG->libdir . '/filelib.php');
$datatype = optional_param('datatype', "", PARAM_TEXT); // Type of action/data we are requesting
$courseid = optional_param('courseid', 0, PARAM_INT); // the id of the course
$moduleid = optional_param('moduleid', 0, PARAM_INT); // the id of the module
$hash = optional_param('hash', "", PARAM_TEXT); // file or dir hash
$requestid = optional_param('requestid', "", PARAM_TEXT); // file or dir hash
$paramone = optional_param('paramone', "", PARAM_TEXT); // nature of value depends on datatype, maybe path
$paramtwo = optional_param('paramtwo', "", PARAM_TEXT); // nature of value depends on datatype, maybe protocol
$paramthree = optional_param('paramthree', "", PARAM_TEXT); // nature of value depends on datatype, maybe filearea
$paramfour = optional_param('paramfour', "", PARAM_TEXT); // nature of value depends on datatype, maybe filearea
$dm = new \filter_poodll\dataset_manager();
switch ($datatype) {
case "poodllflashcards":
header("Content-type: text/xml");
echo "<?xml version=\"1.0\"?>\n";
//courseid, cardset id,cardset name, fgcolor, bgcolor
$returnxml = $dm->fetch_poodllflashcards($courseid, $paramone, $paramtwo, $paramthree, $paramfour);
break;
default:
header("Content-type: text/xml");
echo "<?xml version=\"1.0\"?>\n";
$returnxml = "";
break;
}
echo $returnxml;
return;
?>