1 |
dpavlin |
1 |
<?php |
2 |
|
|
// Load globals |
3 |
|
|
require_once ("global_vars.php"); |
4 |
|
|
|
5 |
|
|
// Includes |
6 |
|
|
require_once ($GLOBAL_ADMIN_INC."sessionClass.php"); |
7 |
|
|
require_once ($GLOBAL_ADMIN_INC."accessClass.php"); |
8 |
|
|
require_once ($GLOBAL_ADMIN_INC."db_connect.php"); |
9 |
|
|
require_once ($GLOBAL_ADMIN_INC."app_controls.php"); |
10 |
|
|
|
11 |
|
|
|
12 |
|
|
// HTML header |
13 |
|
|
printf("<HTML>\n"); |
14 |
|
|
printf("<HEAD>\n"); |
15 |
|
|
printf("<title>%s System Activity</title>\n", $GLOBAL_SYS_NAME); |
16 |
|
|
printf("<link rel=\"stylesheet\" href=\"%s\" type=\"text/css\">\n", $GLOBAL_ADMIN_CSS); |
17 |
|
|
printf("</HEAD>\n"); |
18 |
|
|
|
19 |
|
|
|
20 |
|
|
// Page header |
21 |
|
|
require_once ($GLOBAL_ADMIN_HEADER); |
22 |
|
|
|
23 |
|
|
|
24 |
|
|
// Collect access information |
25 |
|
|
if(isset($libsession)) { |
26 |
|
|
|
27 |
|
|
// Fetch session information |
28 |
|
|
$sessionClass = new sessionClass("", $libsession, "", ""); |
29 |
|
|
$accessClass = new accessClass($sessionClass); |
30 |
|
|
|
31 |
|
|
// Load user session variables |
32 |
|
|
$sess_time_human = $sessionClass->time_human; |
33 |
|
|
$sess_staff_account = $sessionClass->staff_account; |
34 |
|
|
$sess_access_level = $accessClass->access_level; |
35 |
|
|
$sess_access = $accessClass->access; |
36 |
|
|
$sess_last_name = $accessClass->last_name; |
37 |
|
|
$sess_first_name = $accessClass->first_name; |
38 |
|
|
|
39 |
|
|
} |
40 |
|
|
|
41 |
|
|
|
42 |
|
|
// If the cookie is set and access level is appropriate |
43 |
|
|
if(isset($libsession) && $sess_access_level == 1000) { |
44 |
|
|
|
45 |
|
|
$summary_date = substr($sess_time_human, 0, 10); |
46 |
|
|
|
47 |
|
|
|
48 |
|
|
//Draw table and header |
49 |
|
|
printf("<h3>%s System Status %s</h3>", $GLOBAL_SYS_NAME, $summary_date); |
50 |
|
|
|
51 |
|
|
printf("<center>\n"); |
52 |
|
|
printf("<table border = \"1\" width=\"75%%\"><tr>\n"); |
53 |
|
|
printf("<td class=\"cellPlain\">System Metric</td>\n"); |
54 |
|
|
printf("<td class=\"cellPlain\">Totals</td>\n"); |
55 |
|
|
printf("</tr>\n"); |
56 |
|
|
|
57 |
|
|
// Logged in users |
58 |
|
|
$todays_date = substr($sess_time_human, 0, 10); |
59 |
|
|
$sql = "SELECT COUNT(*) FROM staff WHERE last_login LIKE '" . $summary_date . "%'"; |
60 |
|
|
$result = statQuery($con, $sql); |
61 |
|
|
printf("<tr><td>Staff logging in today (%s)</td>\n", $summary_date); |
62 |
|
|
printf("<td>%s</td></tr>\n", $result); |
63 |
|
|
|
64 |
|
|
// Total number of resources |
65 |
|
|
$sql = "SELECT COUNT(*) FROM resource"; |
66 |
|
|
$result = statQuery($con, $sql); |
67 |
|
|
printf("<tr><td>Resources</td>\n"); |
68 |
|
|
printf("<td>%s</td></tr>\n", $result); |
69 |
|
|
|
70 |
|
|
// Total number of subjects |
71 |
|
|
$sql = "SELECT COUNT(*) FROM subject"; |
72 |
|
|
$result = statQuery($con, $sql); |
73 |
|
|
printf("<tr><td>Subjects</td>\n"); |
74 |
|
|
printf("<td>%s</td></tr>\n", $result); |
75 |
|
|
|
76 |
|
|
// Total number of CourseLib pages |
77 |
|
|
$sql = "SELECT COUNT(*) FROM page WHERE pagetype_id = 3"; |
78 |
|
|
$result = statQuery($con, $sql); |
79 |
|
|
printf("<tr><td>CourseLib pages</td>\n"); |
80 |
|
|
printf("<td>%s</td></tr>\n", $result); |
81 |
|
|
|
82 |
|
|
// Total number of PageScribe Pages |
83 |
|
|
$sql = "SELECT COUNT(*) FROM page WHERE pagetype_id = 2"; |
84 |
|
|
$result = statQuery($con, $sql); |
85 |
|
|
printf("<tr><td>PageScribe pages</td>\n"); |
86 |
|
|
printf("<td>%s</td></tr>\n", $result); |
87 |
|
|
|
88 |
|
|
// Total number of elements |
89 |
|
|
$sql = "SELECT COUNT(*) FROM element"; |
90 |
|
|
$result = statQuery($con, $sql); |
91 |
|
|
printf("<tr><td>CourseLib and PageScribe elements</td>\n"); |
92 |
|
|
printf("<td>%s</td></tr>\n", $result); |
93 |
|
|
|
94 |
|
|
// Total number of resource elements |
95 |
|
|
$sql = "SELECT COUNT(*) FROM element WHERE resource_id > 0"; |
96 |
|
|
$result = statQuery($con, $sql); |
97 |
|
|
$num_resources = $result; |
98 |
|
|
printf("<tr><td>CourseLib and PageScribe resource-type elements</td>\n"); |
99 |
|
|
printf("<td>%s</td></tr>\n", $result); |
100 |
|
|
|
101 |
|
|
// Total number of "unique resource" elements |
102 |
|
|
$sql = "SELECT COUNT(*) FROM element WHERE LENGTH(label) > 0"; |
103 |
|
|
$result = statQuery($con, $sql); |
104 |
|
|
$num_text_elements = $result; |
105 |
|
|
if ($num_resources > 0 && $num_text_elements > 0) { |
106 |
|
|
$text_percent = 100 * ($num_text_elements / ($num_resources + $num_text_elements)); |
107 |
|
|
$text_percent = "(" . round($text_percent, 2) . "% of resource+text elements)"; |
108 |
|
|
} |
109 |
|
|
printf("<tr><td>CourseLib and PageScribe page 'text' type elements</td>\n"); |
110 |
|
|
printf("<td>%s %s</td></tr>\n", $result, $text_percent); |
111 |
|
|
|
112 |
|
|
// Total number of users |
113 |
|
|
$sql = "SELECT COUNT(*) FROM staff WHERE staff_id > 1"; |
114 |
|
|
$result = statQuery($con, $sql); |
115 |
|
|
printf("<tr><td>Staff</td>\n"); |
116 |
|
|
printf("<td>%s</td></tr>\n", $result); |
117 |
|
|
|
118 |
|
|
printf("</table>\n"); |
119 |
|
|
printf("</center>\n"); |
120 |
|
|
|
121 |
|
|
// Link to return to admin console |
122 |
|
|
adminReturn($sess_access_level); |
123 |
|
|
|
124 |
|
|
} // logged in |
125 |
|
|
|
126 |
|
|
// No access page |
127 |
|
|
else require_once ($GLOBAL_NO_ACCESS); |
128 |
|
|
|
129 |
|
|
|
130 |
|
|
|
131 |
|
|
// Page footer |
132 |
|
|
require_once ($GLOBAL_ADMIN_FOOTER); |
133 |
|
|
?> |
134 |
|
|
|
135 |
|
|
</body> |
136 |
|
|
</html> |