-
Notifications
You must be signed in to change notification settings - Fork 2
/
fetch_past_signups_ajax.php
69 lines (51 loc) · 1.9 KB
/
fetch_past_signups_ajax.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
57
58
59
60
61
62
63
64
65
66
67
68
69
<?php
// this script gets the past sign-ups the current user has made and
// returns them as a formatted list (prefixed with SUCCESS). On a failure
// it returns FAILURE with a brief description appended.
require_once('../../config.php');
require_once($CFG->libdir.'/moodlelib.php');
/////////////////////////////////////////////////////////////////////////////////////////
// locally defined functions
// This function returns true. It is called by various included files
// to make sure they're actually in the signup sheet world - i.e. to
// prevent them from being (usefully) used directly from the web. E.g.
// if (! verify_in_signup_sheets()) { die("not in signup_sheets"); }
function verify_in_signup_sheets() {
return true;
}
require_login();
include_once 'sus_lib.php';
$DEBUG=0;
/////////////////////////////////////////////////////////////////////////////////////////
// input validation
log_debug_r(4,$_REQUEST);
$contextid = clean_param($_REQUEST['contextid'],PARAM_INT); // determines what course
$action = clean_param($_REQUEST['action'],PARAM_CLEAN);
$actionsource = clean_param($_REQUEST['actionsource'],PARAM_CLEAN);
log_debug(1,"
contextid is $contextid
action is $action
actionsource is $actionsource
");
/////////////////////////////////////////////////////////////////////////////////////////
// processing
$limit = ymd(dayBefore_timeAsDate(mktime()));
if ($action == 'fetchmypast')
{
$my_signups = getSignupsBySignee($USER->id,'',$limit);
echo 'SUCCESS';
generateMySignupsList($my_signups);
exit;
} else if ($action == 'fetchformepast')
{
$signups_for_me = getSignupsForSheetsOf($USER->id,$USER->username,'',$limit);
echo 'SUCCESS';
generateSignupsForMeList($signups_for_me);
exit;
} else
{
echo 'FAILURE: unknown action $action';
exit;
}
/////////////////////////////////////////////////////////////////////////////////////////
?>