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