/[libdata]/trunk/rqs.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

Contents of /trunk/rqs.phtml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 21 - (show annotations)
Wed Jan 28 16:44:01 2004 UTC (17 years, 7 months ago) by dpavlin
File size: 13591 byte(s)
Initial revision

1 <?php
2 // Load globals
3 require_once ("global_vars.php");
4
5
6 // Includes
7 require_once ("db_connect.php");
8 require_once ("public_controls.php");
9
10
11 // HTML header
12 printf("<html>\n");
13 printf("<head>\n");
14 printf("<title>Research QuickStart: Subject Page</title>\n");
15 printf("<link rel=\"stylesheet\" href=\"libdata.css\" type=\"text/css\">\n");
16 printf("</head>\n");
17 printf("<body marginheight = \"0\" marginwidth = \"0\" leftmargin = \"0\" topmargin = \"0\">\n");
18
19 // if printer friendly version, omit the standard header
20 if ($pf == 1) {
21 printf("<h3>Research QuickStart</h3>\n");
22 }
23
24 else {
25 // Page header
26 require_once ("header.phtml");
27 }
28
29 // Initialize
30 if ($core < 1) $core = 0;
31
32
33 /****************************
34 ** Increment subject stats **
35 ****************************/
36
37 // Initialize
38 $subject_id = (int) $subject_id;
39 $exists = 0;
40 $exists = existsRow($con, "subject", "subject_id", $subject_id);
41
42 // If this subject is valid, increment stats
43 if ($subject_id > 1 && $exists == 1) subLoadStats($con, $subject_id);
44
45
46 /***********************************
47 ** Generate the table of contents **
48 ***********************************/
49
50 // Determine if there are related PageScribe or RQS pages
51 $other_ps = existsRow($con, "sub_page", "subject_id", $subject_id);
52 $other_rqs = existsRow($con, "sub_othersub", "subject_id", $subject_id);
53
54
55 // if printer friendly version don't print the TOC
56 if ($pf != 1) {
57 printf("<table border=\"0\" width=\"100%%\" cellspacing=\"0\" cellpadding=\"0\"><tr>\n");
58 printf("<td width=\"3\" bgcolor=\"#000000\"></td><td valign=\"top\" width=\"200\" class=\"backLight\">\n");
59 printf("<table cellpadding=\"5\" border=\"0\"><tr><td>\n");
60 printf("<p class=\"small\"><b>Contents of this page:</b></p>\n");
61
62 // Generate the list
63 $sql = "SELECT DISTINCT mi.masterinfotype_id, mi.masterinfotype, i.infotype_id, i.infotype FROM
64 res_sub_infotype rsi,
65 infotype i,
66 masterinfotype mi
67
68 WHERE
69 rsi.subject_id = "
70 . $subject_id
71 . " AND mi.masterinfotype_id = i.masterinfotype_id AND
72 rsi.infotype_id = i.infotype_id";
73
74 //if core selected, only print out the core TOC
75 if ($core == "1") {
76 $sql .= " AND rsi.highlighted = '1'";
77 }
78
79 $sql .= " ORDER BY mi.masterinfotype, i.infotype";
80 $rs = mysql_query($sql, $con);
81 $rows = mysql_num_rows($rs);
82
83 // initialize
84 $last_masterinfotype_id = 0;
85 $rowcount = 0;
86
87 while ($row = mysql_fetch_array ($rs)) {
88
89 // Fetch information types for this subject
90 $infotype_id = $row["infotype_id"];
91 $infotype = $row["infotype"];
92 $masterinfotype_id = $row["masterinfotype_id"];
93 $masterinfotype = $row["masterinfotype"];
94
95 if ($last_masterinfotype_id == 0 || ($last_masterinfotype_id != $masterinfotype_id)) {
96 printf("</ul><span class=\"small\"><b><a href=\"rqs.phtml?subject_id=%d#m%d\">%s</a></b></span><br>\n", $subject_id, $masterinfotype_id, $masterinfotype);
97 printf("<ul>\n");
98 }
99
100 printf("<li><b class=\"small\"><a href=\"#i%d\">%s</a></b></li>\n", $infotype_id, $infotype);
101
102 // Swap & increment
103 $last_masterinfotype_id = $masterinfotype_id;
104 $rowcount++;
105
106 };
107
108 printf("</ul><span class=\"small\"><b><a href=\"rqs.phtml?subject_id=%d#lib\">Library Information</a></b></span><br>\n", $subject_id);
109 printf("</ul>\n");
110
111 if ($other_ps || $other_rqs) printf("<p class=\"small\"><b><a href=\"rqs.phtml?subject_id=%d#related\">Related Pages</a></b></p>\n", $subject_id);
112
113 printf("<p class=\"small\"><b><a href=\"rqs.phtml?subject_id=$subject_id&pf=1&core=$core\">Printer-friendly version of this page</a></b></p>\n");
114 printf("</td></tr></table>\n");
115 printf("</td><td width=\"3\" class=\"backLight\">&nbsp;</td><td valign=\"top\">\n");
116
117 }
118
119 /**********************************
120 ** Display user's subject choice **
121 **********************************/
122
123 $sql = "SELECT subject, subject_descr FROM subject WHERE subject_id = "
124 . $subject_id;
125
126 $rs = mysql_query($sql, $con);
127 $row = mysql_fetch_array ($rs);
128 $subject = $row["subject"];
129 $subject_descr = $row["subject_descr"];
130
131 printf("<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"100%%\"><tr>\n");
132
133 // Remove the subject cell bgcolor if printer-friendly
134 if ($pf == 1) {
135 printf("<td>\n");
136 }
137
138 else {
139 printf("<td class=\"backLight\" valign=\"top\">\n");
140 }
141
142 printf("<table cellpadding=\"3\"><tr><td>\n");
143 printf("<p><span class=\"bigDark\">Selected Resources for: %s</span>", $subject);
144
145 if ($core == 1) {
146 printf("<span class=\"small\">Display all <a href=\"rqs.phtml?subject_id=$subject_id\">resources</a></span>).</p>\n");
147 }
148
149 else {
150 printf(" (<span class=\"small\">Display only the <a href=\"rqs.phtml?core=1&subject_id=%d\">highlighted/core resources</a></span>).</p>\n", $subject_id);
151 }
152 printf("</td></tr></table></td></tr></table>\n");
153
154 /************************
155 /* Table for main body **
156 ************************/
157
158 printf("<table cellpadding=\"10\" border=\"0\"><tr><td valign=\"top\">\n");
159 printf("<p class=\"small\"><b>Subject Description:</b> %s</p>", $subject_descr);
160 printf("</td></tr>");
161
162 /***************************
163 ** Generate the resources **
164 ***************************/
165
166 printf("<tr><td>\n");
167
168 $sql = "SELECT
169 rsi.description,
170 m.masterinfotype,
171 m.masterinfotype_id,
172 i.infotype,
173 i.infotype_id,
174 r.resource_id,
175 r.title,
176 r.author,
177 r.annotation,
178 r.url,
179 r.call_no,
180 r.coverage_detail,
181 r.cat_num
182 FROM res_sub_infotype rsi,
183 infotype i, masterinfotype m, resource r
184 WHERE
185 rsi.subject_id = "
186 . $subject_id
187 . " AND rsi.masterinfotype_id = m.masterinfotype_id AND";
188 // if core selected, only print out the core resources selected for this subject
189 if ($core == "1") {
190 $sql .= " rsi.highlighted = 1 AND";
191 }
192 $sql .= " rsi.infotype_id = i.infotype_id AND
193 rsi.masterinfotype_id = m.masterinfotype_id AND
194 rsi.resource_id = r.resource_id
195 ORDER BY m.masterinfotype, i.infotype, r.title";
196
197 $rs = mysql_query($sql, $con);
198
199 while ($row = mysql_fetch_array ($rs)) {
200
201 // Fetch information types for this subject
202 $masterinfotype = $row["masterinfotype"];
203 $masterinfotype_id = $row["masterinfotype_id"];
204 $infotype = $row["infotype"];
205 $infotype_id = $row["infotype_id"];
206 $title = $row["title"];
207 $author = $row["author"];
208 $annotation = $row["annotation"];
209 $resource_id = $row["resource_id"];
210 $url = $row["url"];
211 $cat_num = $row["cat_num"];
212 $call_no = $row["call_no"];
213 $coverage = $row["coverage_detail"];
214 $description = $row["description"];
215
216 if (strlen($description) > 0) $annotation = $description;
217
218 // Header info
219 if ($last_m != $masterinfotype) printf("<a name=\"m%d\"><h3>%s</h3></a>", $masterinfotype_id, $masterinfotype);
220 if ($last_i != $infotype) printf("<p>&nbsp;&nbsp;&nbsp;&nbsp;<a name=\"i%d\"><b><i>%s</i></b></a></p>", $infotype_id, $infotype);
221
222 printf("<table><tr><td width=\"20\">&nbsp;</td>\n");
223 printf("<td valign=\"top\"><img src=\"images/bullet.gif\" alt=\"\"></td>\n");
224 printf("<td class=\"small\">\n");
225
226 // Display the resource
227 if (strlen($url) > 0 ) {
228 printf("<b><a href=\"%s\">%s</a></b>\n", $url, $title);
229
230 }
231 else {
232 printf("<b>%s</b>", $title);
233 }
234
235 // Lookup features
236 $f_sql = "SELECT * FROM res_feature rf, feature f
237 WHERE rf.resource_id = "
238 . $resource_id
239 . " AND rf.feature_id = f.feature_id";
240
241 $f_rs = mysql_query($f_sql, $con);
242
243
244 while ($f_row = mysql_fetch_array ($f_rs)) {
245 $image_path = $f_row["image_path"];
246 $image_alt = $f_row["image_alt"];
247 printf("<img src=\"%s\" alt=\"%s\">&nbsp;", $image_path, $image_alt);
248 }
249
250 // If print-friendly display the URL
251 if (($url) && ($pf == 1)) {
252 printf("<br>%s\n", $url);
253 }
254
255 // Display other items
256 if (strlen($coverage) > 0) printf("<br>&nbsp;&nbsp;&nbsp;&nbsp;<i>%s</i>", $coverage);
257 if (strlen($annotation) > 0) printf("<br>%s", $annotation);
258 if (strlen($call_no) > 0) printf("<br><b>Location</b>: %s", $call_no);
259
260 // Link to library holdings if something was supplied for catalog number
261 if (strlen($cat_num) > 0)
262 printf("<BR><a href=\"yourlibrarycatalog.here.edu\">Check Catalog</a>", $cat_num);
263
264 // Swap variables
265 $last_m = $masterinfotype;
266 $last_i = $infotype;
267 printf("</td></tr></table>\n");
268 }
269
270 printf( "<p><hr noshade=\"noshade\" width=\"75%%\" align=\"left\"></p>\n");
271
272 /*****************************
273 ** Primary subject location **
274 *****************************/
275
276 printf("<p><span class=\"bigDark\"><a name=\"lib\">Library Information</a></span></p>\n");
277
278 // Generate the sql
279 $sql = "SELECT *
280 FROM subject, location
281 WHERE subject.subject_id = " . $subject_id . " AND
282 subject.sublocation_id = location.location_id";
283
284 // Fetch the values
285 $rs = mysql_query($sql, $con);
286 $row = mysql_fetch_array ($rs);
287 $location_id = $row["location_id"];
288 $location = $row["location"];
289 $location_descr = $row["location_descr"];
290 $campus = $row["campus"];
291 $address1 = $row["address1"];
292 $address2 = $row["address2"];
293 $address3 = $row["address3"];
294 $address4 = $row["address4"];
295 $telephone = $row["telephone"];
296 $mainURL = $row["mainURL"];
297 $referenceURL = $row["referenceURL"];
298 $mapURL = $row["mapURL"];
299 $hoursURL = $row["hoursURL"];
300
301 if ($location_id > 1) {
302
303 printf("<p><span class=\"bigDark\">Primary Subject Location(s)</span></p>\n");
304
305 if (strlen($mainURL) > 1) printf("<a href=\"%s\"><b>%s</b></a><br>\n", $mainURL, $location);
306 else printf("<b>%s</b><br>\n", $location);
307
308 if (strlen($location_descr) > 1) printf("%s<br>\n", $location_descr);
309 if (strlen($campus) > 1) printf("<b>Campus:</b> %s<br>\n", $campus);
310 if (strlen($address1) > 1) printf("<b>Address Line 1:</b> %s<br>\n", $address1);
311 if (strlen($address2) > 1) printf("<b>Address Line 2:</b> %s<br>\n", $address2);
312 if (strlen($address3) > 1) printf("<b>Address Line 3:</b> %s<br>\n", $address3);
313 if (strlen($address4) > 1) printf("<b>Address Line 4:</b> %s<br>\n", $address4);
314 if (strlen($telephone) > 1) printf("<b>Telephone:</b> %s<br>\n", $telephone);
315 if (strlen($mainURL) > 1) printf("<b>Main URL:</b> <a href= \"%s\">%s</a><br>\n", $mainURL, $mainURL);
316 if (strlen($referenceURL) > 1) printf("<b>Reference URL:</b> <a href=\"%s\">%s</a><br>\n", $referenceURL, $referenceURL);
317 if (strlen($mapURL) > 1) printf("<b>Map URL:</b> <a href=\"%s\">%s</a><br>\n", $mapURL, $mapURL);
318 if (strlen($hoursURL) > 1) printf("<b>Hours URL:</b> <a href= \"%s\">%s</a><br>\n", $hoursURL, $hoursURL);
319 }
320
321 printf("<br>\n");
322
323 /**********************************
324 ** Secondary subject location(s) **
325 **********************************/
326
327 // Generate the sql
328 $sql = "SELECT *
329 FROM sub_loc, location
330 WHERE sub_loc.subject_id = " . $subject_id . " AND
331 sub_loc.location_id = location.location_id";
332
333 // Fetch the values
334 $rs = mysql_query($sql, $con);
335
336 // Initialize
337 $rowcount = 0;
338
339 while ($row = mysql_fetch_array ($rs)) {
340
341 $location_id = $row["location_id"];
342 $location = $row["location"];
343 $location_descr = $row["location_descr"];
344 $campus = $row["campus"];
345 $address1 = $row["address1"];
346 $address2 = $row["address2"];
347 $address3 = $row["address3"];
348 $address4 = $row["address4"];
349 $telephone = $row["telephone"];
350 $mainURL = $row["mainURL"];
351 $referenceURL = $row["referenceURL"];
352 $mapURL = $row["mapURL"];
353 $hoursURL = $row["hoursURL"];
354
355 // Increment
356 $rowcount++;
357
358 // Display the values if present
359 if ($rowcount == 1) printf("<p><span class=\"bigDark\">Secondary Subject Location(s)</span></p>\n");
360
361 if (strlen($mainURL) > 1) printf("<a href=\"%s\"><b>%s</b></a><br>\n", $mainURL, $location);
362 else printf("<b>%s</b><br>\n", $location);
363
364 if (strlen($location_descr) > 1) printf("%s<br>\n", $location_descr);
365 if (strlen($campus) > 1) printf("<b>Campus:</b> %s<br>\n", $campus);
366 if (strlen($address1) > 1) printf("<b>Address Line 1:</b> %s<br>\n", $address1);
367 if (strlen($address2) > 1) printf("<b>Address Line 2:</b> %s<br>\n", $address2);
368 if (strlen($address3) > 1) printf("<b>Address Line 3:</b> %s<br>\n", $address3);
369 if (strlen($address4) > 1) printf("<b>Address Line 4:</b> %s<br>\n", $address4);
370 if (strlen($telephone) > 1) printf("<b>Telephone:</b> %s<br>\n", $telephone);
371 if (strlen($mainURL) > 1) printf("<b>Main URL:</b> <a href= \"%s\">%s</a><br>\n", $mainURL, $mainURL);
372 if (strlen($referenceURL) > 1) printf("<b>Reference URL:</b> <a href=\"%s\">%s</a><br>\n", $referenceURL, $referenceURL);
373 if (strlen($mapURL) > 1) printf("<b>Map URL:</b> <a href=\"%s\">%s</a><br>\n", $mapURL, $mapURL);
374 if (strlen($hoursURL) > 1) printf("<b>Hours URL:</b> <a href= \"%s\">%s</a><br>\n", $hoursURL, $hoursURL);
375
376 printf("<br>");
377
378 }
379 printf("</td></tr>\n");
380
381
382 printf("<tr>\n");
383 printf("<td align=\"left\">\n");
384
385 if ($other_ps || $other_rqs) printf("<a name=\"related\"></a>\n");
386
387 /****************************************************************
388 ** Hunt for related subject pages & display them if they exist **
389 ****************************************************************/
390 $othersubs = existsRow($con, "sub_othersub", "subject_id", $subject_id);
391
392 if ($othersubs > 0) {
393 printf("<table cellpadding=\"10\"><tr><td bgcolor=\"#dcdcdc\" class=\"small\"><h4>Related RQS Pages</h4>\n");
394 displayRelatedSubjects($con, $subject_id);
395 print "</td></tr></table><br>\n";
396 }
397
398
399 /*******************************************************************
400 ** Hunt for related PageScribe pages & display them if they exist **
401 *******************************************************************/
402 $pages = existsRow($con, "sub_page", "subject_id", $subject_id);
403
404 if ($pages > 0) {
405 printf("<table cellpadding=\"10\"><tr><td bgcolor=\"#dcdcdc\" class=\"small\"><h4>Related PageScribe Pages</h4>\n");
406 displayRelatedPages($con, $subject_id);
407 print "</td></tr></table>\n";
408 }
409
410 // main body table
411 printf("</td></tr></table>\n");
412
413 // outer table
414 printf("</td></tr></table>\n");
415
416 // Page footer
417 require_once ("footer.phtml");
418 ?>
419
420 </body>
421 </html>

  ViewVC Help
Powered by ViewVC 1.1.26