-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathajax.php
51 lines (42 loc) · 1.19 KB
/
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
<?php
if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
if(isset($_REQUEST['action']) && !empty($_REQUEST['action'])) {
require_once('../../config.php');
include_once('lib.php');
$PAGE->set_context(context_system::instance());
$action = $_REQUEST['action'];
$count = !empty($_REQUEST['count']);
$max_records = 5;
switch($action) {
case 'institutions': echo cubic_get_user_institutions(); break;
case 'courses': echo cubic_get_user_courses(null); break;
case 'applications': echo cubic_get_user_applications(null); break;
case 'activities': echo cubic_get_user_activities(null); break;
case 'notifications':
if($count) {
echo cubic_get_notifications_count();
}
else {
echo cubic_get_user_notifications($max_records);
}
break;
case 'events':
if($count) {
echo cubic_get_events_count();
}
else {
echo cubic_get_user_events($max_records);
}
break;
case 'messages':
if($count) {
echo cubic_get_messages_count();
}
else {
echo cubic_get_user_messages($max_records);
}
break;
}
}
}
?>