/[libdata]/branches/paul/admin/res_drill.phtml
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /branches/paul/admin/res_drill.phtml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 67 - (hide annotations)
Thu Mar 18 19:24:54 2004 UTC (20 years, 1 month ago) by dpavlin
File size: 7469 byte(s)
updated to libdata 2.00

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>Resource Drilldown</title>\n");
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     // If the cookie is set and access level is appropriate
52     if(isset($libsession) && $sess_access_level >= 20) {
53    
54     // Initialize
55     $exists = 0;
56    
57     // Cast as integer to be sure
58     $resource_id = (int) $resource_id;
59    
60     // Check to see if resource exists
61 dpavlin 67 $exists = existsRow("resource", "resource_id", $resource_id);
62 dpavlin 1
63     // If resource exists
64     if ($exists > 0) {
65    
66     // Fetch the resource title
67 dpavlin 67 $title = lookupField("resource", "resource_id", $resource_id, "title");
68 dpavlin 1
69     printf("<center>\n");
70     printf("<h3>Resource Title '%s' (#%d) used on the following:</h3>", $title, $resource_id);
71    
72    
73     // RQS Usage Drilldowns
74     printf("<table width = \"75%%\" border=\"1\"><tr>\n");
75     printf("<td width=\"40%%\" class=\"cellPlain\">RQS Subject Page(s)</td>\n");
76     printf("<td width=\"40%%\" class=\"cellPlain\">Information Type</td>\n");
77     printf("<td width=\"20%%\" class=\"cellPlain\">Edit RQS Page</td>\n");
78     printf("</tr>\n");
79    
80    
81    
82     // Build the query
83     $sql = "SELECT DISTINCT
84     s.subject,
85     s.subject_id,
86     i.infotype,
87     m.masterinfotype
88    
89     FROM
90     resource r
91     LEFT JOIN res_sub_infotype rsi using (resource_id)
92     LEFT JOIN subject s on rsi.subject_id = s.subject_id
93     LEFT JOIN infotype i on rsi.infotype_id = i.infotype_id
94     LEFT JOIN masterinfotype m on rsi.masterinfotype_id = m.masterinfotype_id
95    
96     WHERE s.subject_id > 0 AND r.resource_id = "
97     . $resource_id
98     . " ORDER BY s.subject";
99    
100     // Initialize counter
101     $rowcount = 0;
102    
103 dpavlin 67 $rs = mysql_tryquery($sql);
104 dpavlin 1
105     // Cycle through the result set
106 dpavlin 67 while ( $row = mysql_fetch_array ($rs, MYSQL_ASSOC)) {
107 dpavlin 1 $subject = Trim($row["subject"]);
108     $subject_id = Trim($row["subject_id"]);
109     $infotype = Trim($row["infotype"]);
110     $masterinfotype = Trim($row["masterinfotype"]);
111    
112     // Make every other row colored
113     if ($rowcount % 2 == 0) $color = " class=\"backLight\" ";
114     else $color = "";
115    
116     // New row
117     printf("<tr>\n");
118     printf("<td %s>%s</td>\n", $color, $subject);
119     printF("<td %s>%s -> %s</td>\n", $color, $masterinfotype, $infotype);
120     printf("<td %s><a href=\"subject_builder.phtml?subject_id=%d\">Edit</a></td>\n", $color, $subject_id);
121     printf("</tr>\n");
122    
123     // Increment counter
124     $rowcount++;
125     }
126    
127     // Summary of RQS page uses
128     printf("<tr><td colspan=\"2\" align=\"right\" class=\"backLight\">Total Research QuickStart Uses:</td>\n");
129     if (mysql_num_rows($rs) == 0) printf("<td class=\"backLight\">(None)</td>\n");
130     else printf("<td class=\"backLight\">%d</td>\n", mysql_num_rows($rs));
131     printf("</tr>\n");
132    
133     // Close table
134     printf("</table><br><br>\n");
135    
136    
137     // CourseLib Usage
138     printf("<table width = \"75%%\" border=\"1\"><tr>\n");
139     printf("<td width=\"80%%\" class=\"cellPlain\">CourseLib Page(s)</td>\n");
140     printf("<td width=\"20%%\" class=\"cellPlain\">Edit</td>\n");
141     printf("</tr>\n");
142    
143    
144     // CourseLib Usage
145     $sql = "SELECT DISTINCT p.page_id, c.course_concat
146     FROM resource r
147     LEFT JOIN element e using (resource_id)
148     LEFT JOIN page p on e.page_id = p.page_id
149     LEFT JOIN course c on p.page_id = c.page_id
150     WHERE p.pagetype_id = 3 AND r.resource_id = "
151     . $resource_id
152     . " ORDER BY c.course_concat";
153    
154     // Initialize counter
155     $rowcount = 0;
156    
157 dpavlin 67 $rs = mysql_tryquery($sql);
158 dpavlin 1
159     // Cycle through the result set
160 dpavlin 67 while ( $row = mysql_fetch_array ($rs, MYSQL_ASSOC)) {
161 dpavlin 1
162     $page_id = Trim($row["page_id"]);
163     $course_concat = Trim($row["course_concat"]);
164    
165     // Make every other row colored
166     if ($rowcount % 2 == 0) $color = " class=\"backLight\" ";
167     else $color = "";
168    
169     // New row
170     printf("<tr>\n");
171     printf("<td %s>%s</td>\n", $color, $course_concat);
172     printf("<td %s><a href=\"scribe.phtml?page_id=%d\">Edit</a></td>\n", $color, $page_id);
173     printf("</tr>\n");
174    
175     // Increment counter
176     $rowcount++;
177     }
178    
179     // Summary of CourseScribe page uses
180     printf("<tr><td align=\"right\" class=\"backLight\">Total CourseLib+ Uses:</td>\n");
181     if (mysql_num_rows($rs) == 0) printf("<td class=\"backLight\">(None)</td>\n");
182     else printf("<td class=\"backLight\">%d</td>\n", mysql_num_rows($rs));
183     printf("</tr>\n");
184    
185     // Close table
186     printf("</table><br><br>\n");
187    
188    
189     // FreeForm PageScribe Usage
190     printf("<table width = \"75%%\" border=\"1\"><tr>\n");
191     printf("<td width=\"80%%\" class=\"cellPlain\">PageScribe Page(s)</td>\n");
192     printf("<td width=\"20%%\" class=\"cellPlain\">Edit</td>\n");
193     printf("</tr>\n");
194    
195    
196     // Freeform PageScribe Usage
197     $sql = "SELECT DISTINCT p.page_id, p.page_title
198     FROM resource r
199     LEFT JOIN element e using (resource_id)
200     LEFT JOIN page p on e.page_id = p.page_id
201     WHERE pagetype_id = 2 AND r.resource_id = "
202     . $resource_id
203     . " ORDER BY p.page_title";
204    
205     // Initialize counter
206     $rowcount = 0;
207    
208 dpavlin 67 $rs = mysql_tryquery($sql);
209 dpavlin 1
210     // Cycle through the result set
211 dpavlin 67 while ( $row = mysql_fetch_array ($rs, MYSQL_ASSOC)) {
212 dpavlin 1
213     $page_id = Trim($row["page_id"]);
214     $page_title = Trim($row["page_title"]);
215    
216     // Make every other row colored
217     if ($rowcount % 2 == 0) $color = " class=\"backLight\" ";
218     else $color = "";
219    
220     // New row
221     printf("<tr>\n");
222     printf("<td %s>%s</td>\n", $color, $page_title);
223     printf("<td %s><a href=\"scribe.phtml?page_id=%d\">Edit</a></td>\n", $color, $page_id);
224     printf("</tr>\n");
225    
226     // Increment counter
227     $rowcount++;
228     }
229    
230     // Summary of FreeForm page uses
231     printf("<tr><td align=\"right\" class=\"backLight\">Total PageScribe Uses:</td>\n");
232     if (mysql_num_rows($rs) == 0) printf("<td class=\"backLight\">(None)</td>\n");
233     else printf("<td class=\"backLight\">%d</td>\n", mysql_num_rows($rs));
234     printf("</tr>\n");
235    
236     // Close table
237     printf("</table><br><br>\n");
238    
239     } // resource exists
240    
241     else {
242    
243     // Draw form heading
244     printf("<center><h3>Not Found...</h3>");
245    
246     // Table
247     printf("<table width = \"60%%\" border = \"1\" cellpadding =\"4\" class=\"backLight\">");
248     printf("<tr><td><br>");
249     printf("<strong>Messages:</strong><br>");
250     printf("Resource ID#%s not found.<br><br>", $resource_id);
251     printf("</td></tr>\n");
252     printf("</table></center>\n");
253     }
254    
255     // Link to return to admin console
256     adminReturn($sess_access_level);
257    
258     } // logged in
259    
260     // No access page
261     else require_once ($GLOBAL_NO_ACCESS);
262    
263    
264     // Page footer
265     require_once ($GLOBAL_ADMIN_FOOTER);
266     ?>
267    
268     </body>
269     </html>

  ViewVC Help
Powered by ViewVC 1.1.26