-
Notifications
You must be signed in to change notification settings - Fork 4
/
side_menu.inc.php
49 lines (44 loc) · 1.63 KB
/
side_menu.inc.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
<?php
namespace gameme;
use gameme\PHPGamification\DAO;
/* start output buffering: */
global $savant;
ob_start();
global $_base_path;
$sql = "SELECT * FROM %sgm_options WHERE course_id=%d";
$gm_options = queryDB($sql, array(TABLE_PREFIX, $_SESSION['course_id']));
$count = 0;
foreach($gm_options as $option => $value){
$enabled_options[$count] = $value['gm_option'];
$count++;
}
require_once(AT_INCLUDE_PATH.'../mods/gameme/gamify.lib.php');
require_once(AT_INCLUDE_PATH.'../mods/gameme/PHPGamification/PHPGamification.class.php');
$gamification = new PHPGamification();
$gamification->setDAO(new DAO(DB_HOST, DB_NAME, DB_USER, DB_PASSWORD));
$gamification->setUserId($_SESSION['member_id']);
if(is_array($enabled_options)){
if(in_array('showpoints',$enabled_options)){
showUserScore($gamification, $_SESSION['course_id']);
}
if(in_array('showlevels',$enabled_options)){
showUserLevel($gamification, $_SESSION['course_id']);
}
if(in_array('showprogress',$enabled_options)){
echo showUserProgress($gamification, $_SESSION['course_id']);
}
if(in_array('showbadges',$enabled_options)){
echo showUserBadge($gamification, $_SESSION['course_id']);
}
if(in_array('showleaders',$enabled_options)){
echo getLeaders($gamification, get_leader_count());
}
if(in_array('showposition',$enabled_options)){
echo yourPosition($_SESSION['member_id']);
}
}
$savant->assign('dropdown_contents', ob_get_contents());
ob_end_clean();
$savant->assign('title', _AT('gameme')); // the box title
$savant->display('include/box.tmpl.php');
?>