-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathviewer_result.php
More file actions
executable file
·92 lines (80 loc) · 3.58 KB
/
viewer_result.php
File metadata and controls
executable file
·92 lines (80 loc) · 3.58 KB
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<?php
/**
**************************************************************************
** Chairman **
**************************************************************************
* @package mod **
* @subpackage chairman **
* @name Chairman **
* @copyright oohoo.biz **
* @link http://oohoo.biz **
* @author Raymond Wainman **
* @author Patrick Thibaudeau **
* @author Dustin Durand **
* @license **
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later **
**************************************************************************
**************************************************************************/
require_once('../../config.php');
require_once('lib.php');
require_once('lib_chairman.php');
$id = optional_param('id',0,PARAM_INT); // Planner ID
$planner = $DB->get_record('chairman_planner', array('id'=>$id));
//content
echo '<table class="generaltable" style="margin-left:0;">';
echo '<tr>';
echo '<th class="header"></th>';
$dates = $DB->get_records('chairman_planner_dates', array('planner_id'=>$planner->id), 'to_time ASC');
$count = 0;
$date_col = array(); //Keep track of what id is which column
$date_col_count = array(); //Keep track of how many people can make this date
$date_flag = array(); //If a required person cannot make it, flag it here
foreach($dates as $date) {
echo '<th class="header">'.strftime('%a %d %B, %Y', $date->from_time).'<br/>';
echo '<span style="font-size:10px;font-weight:normal;">'.date('H:i', $date->from_time).' - '.date('H:i', $date->to_time).'</span>';
echo '</th>';
$date_col[$count] = $date->id;
$date_flag[$count] = false; //Initialise
$date_col_count[$count] = 0; //Initialise
$count++;
}
echo '</tr>';
$members = $DB->get_records('chairman_planner_users', array('planner_id'=>$planner->id));
$numberofmembers = $DB->count_records('chairman_planner_users', array('planner_id'=>$planner->id));
foreach($members as $member) {
echo '<tr>';
$memberobj = $DB->get_record('chairman_members', array('id'=>$member->chairman_member_id));
$userobj = $DB->get_record('user', array('id'=>$memberobj->user_id));
if($member->rule==1) {
$style = 'font-weight:bold;';
}
else {
$style = '';
}
for($i=0;$i<$count;$i++) {
if($DB->get_record('chairman_planner_response', array('planner_user_id'=>$member->id, 'planner_date_id'=>$date_col[$i]))){
$date_col_count[$i]++;
}
else if($member->rule==1){
$date_flag[$i] = true;
}
}
echo '</tr>';
}
echo '<tr>';
echo '<td></td>';
for($i=0;$i<$count;$i++) {
if($date_flag[$i]){
$background = 'red';
$percentage = '0';
}
else{
$brilliance = ($date_col_count[$i])/($numberofmembers);
$background = 'rgba(33,204,33,'.$brilliance.')';
$percentage = number_format($brilliance*100,0);
}
echo '<td class="cell" style="font-size:10px;height:20px;background-color:'.$background.';">'.$percentage.'%</td>';
}
echo '</tr>';
echo '</table>';
?>