868319c6963832109603e3cc74bf15622f2ee1a6
[atutor.git] / mods / certify / certify_student_status.php
1 <?php
2 define('AT_INCLUDE_PATH', '../../include/');
3 require (AT_INCLUDE_PATH.'vitals.inc.php');
4 authenticate(AT_PRIV_CERTIFY);
5
6 require 'certify_functions.php';
7
8
9 $_custom_css = $_base_path . 'mods/certify/certify.css'; // use a custom stylesheet
10
11 $GLOBALS['dout'] = '';
12
13 function dbug($out) {
14         $GLOBALS['dout'] .= $out . "\n";
15 }
16
17 $certify_id = '';
18 if (isset($_POST['certify_id'])) {
19     $certify_id = $addslashes($_POST['certify_id']);
20 } else if (isset($_GET['certify_id'])) {
21     $certify_id = $addslashes($_GET['certify_id']);
22 }
23
24
25
26
27 $sql =  '
28         SELECT '.TABLE_PREFIX.'members.*
29         FROM '.TABLE_PREFIX.'course_enrollment
30         INNER JOIN '.TABLE_PREFIX.'members ON '.TABLE_PREFIX.'members.member_id = '.TABLE_PREFIX.'course_enrollment.member_id
31         WHERE '.TABLE_PREFIX.'course_enrollment.course_id = '.$_SESSION['course_id'].'
32 ';
33
34
35 $result = mysql_query($sql, $db) or die(mysql_error());
36
37 dbug($sql);
38
39 $members = array();
40 while( $member = mysql_fetch_assoc($result) ) {
41         $member['certificate'] = array();
42         $member['certificate']['progress'] = getCertificateProgress($member['member_id'],$certify_id);
43         $members[$member['member_id']] = $member;
44 }
45
46
47 function membercmp($a,$b) {
48
49         if ($a['certificate']['progress'] == $b['certificate']['progress'])
50                 return 0;
51
52         return ($a['certificate']['progress'] > $b['certificate']['progress']) ? -1 : 1;
53
54 }
55
56 usort($members, "membercmp");
57
58 // -- Certificate update code end --
59
60 dbug(var_export($members,true));
61
62
63 require (AT_INCLUDE_PATH.'header.inc.php');
64
65
66 ?>
67
68
69
70 <code><pre>
71 <?php //echo $GLOBALS['dout']; ?>
72 </pre></code>
73
74
75
76
77
78
79
80
81 <table class="data" summary="" rules="cols">
82 <thead>
83 <tr>
84         <!--th align="left">&nbsp;</th-->
85         <th scope="col"><?php echo _AT('login_name'); ?></th>
86         <th scope="col"><?php echo _AT('full_name'); ?></th>
87         <th scope="col"><?php echo _AT('mark'); ?></th>
88 </tr>
89 </thead>
90 <!--tfoot>
91 <tr>
92         <td colspan="4"><input type="submit" name="edit" value="Should there be a button here for viewing individual tests?" /></td>
93 </tr>
94 </tfoot-->
95 <tbody>
96 <?php if ($members): ?>
97         <?php foreach ($members as &$member): ?>
98                 <tr>
99                         <!--td>&nbsp;</td-->
100                         <td><?php echo $member['login']; ?></td>
101                         <td><?php 
102                                 if ($anonymous == 0 && $member['member_id']){
103                                         echo AT_print(get_display_name($member['member_id']), 'members.full_name'); /*$member['full_name'] */ 
104                                 } else {
105                                         echo $guest_text; // no need in AT_print(): $guest_text is a trusted _AT() output
106                                 }
107                                 ?></td>
108
109
110                         <td>                            
111                                 <div class="certify_bar-border">
112                                         <div class="certify_bar-fill">
113                                                 <div class="certify_bar-bar" style="width: <?php echo floor($member['certificate']['progress']); ?>%;">
114                                                 <span class="test_<?php echo $member['certificate']['progress'] == 100 ? 'passed' : 'failed' ?>" >
115                                                 <?php echo floor($member['certificate']['progress']); ?>%
116                                                 </span>
117                                                 </div>
118                                         </div>
119                                 </div>
120                                 
121                         </td>
122
123
124                 </tr>
125         <?php endforeach; ?>
126 <?php else: ?>
127         <tr>
128                 <td colspan="3"><?php echo _AT('none_found'); ?></td>
129         </tr>
130 <?php endif; ?>
131 </tbody>
132 </table>
133
134
135
136
137
138
139
140 <?php require (AT_INCLUDE_PATH.'footer.inc.php'); ?>