/[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

Annotation of /trunk/rqs.phtml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 72 - (hide annotations)
Thu Mar 18 20:33:37 2004 UTC (20 years, 1 month ago) by dpavlin
File size: 14291 byte(s)
changes made in version 2.00

1 dpavlin 21 <?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 dpavlin 72 $exists = existsRow("subject", "subject_id", $subject_id);
41 dpavlin 21
42     // If this subject is valid, increment stats
43 dpavlin 72 if ($subject_id > 1 && $exists == 1) subLoadStats($subject_id);
44 dpavlin 21
45    
46     /***********************************
47     ** Generate the table of contents **
48     ***********************************/
49    
50     // Determine if there are related PageScribe or RQS pages
51 dpavlin 72 $other_ps = existsRow("sub_page", "subject_id", $subject_id);
52     $other_rqs = existsRow("sub_othersub", "subject_id", $subject_id);
53 dpavlin 21
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 dpavlin 72 $rs = xx_tryquery($sql);
81 dpavlin 42 $rows = xx_num_rows($rs);
82 dpavlin 21
83     // initialize
84     $last_masterinfotype_id = 0;
85     $rowcount = 0;
86    
87 dpavlin 72 while ($row = xx_fetch_array ($rs, xx_ASSOC)) {
88 dpavlin 21
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 dpavlin 72 printf("</ul><b><span class=\"small\"><a href=\"rqs.phtml?subject_id=%d#m%d\">%s</a></b></span><br>\n", $subject_id, $masterinfotype_id, $masterinfotype);
97 dpavlin 21 printf("<ul>\n");
98     }
99    
100 dpavlin 72 printf("<li><span class=\"small\"><b><a href=\"#i%d\">%s</a></b></span></li>\n", $infotype_id, $infotype);
101 dpavlin 21
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 dpavlin 72 $rs = xx_tryquery($sql);
127     $row = xx_fetch_array ($rs, xx_ASSOC);
128 dpavlin 21 $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 dpavlin 72 r.cat_num,
182     r.guide_url,
183     r.resource_status,
184     r.resource_message,
185     v.vendor_status,
186     v.vendor_message
187 dpavlin 21 FROM res_sub_infotype rsi,
188     infotype i, masterinfotype m, resource r
189 dpavlin 72 LEFT JOIN vendor v on r.vendor_id = v.vendor_id
190 dpavlin 21 WHERE
191     rsi.subject_id = "
192     . $subject_id
193     . " AND rsi.masterinfotype_id = m.masterinfotype_id AND";
194     // if core selected, only print out the core resources selected for this subject
195     if ($core == "1") {
196     $sql .= " rsi.highlighted = 1 AND";
197     }
198     $sql .= " rsi.infotype_id = i.infotype_id AND
199     rsi.masterinfotype_id = m.masterinfotype_id AND
200     rsi.resource_id = r.resource_id
201     ORDER BY m.masterinfotype, i.infotype, r.title";
202    
203 dpavlin 72 $rs = xx_tryquery($sql);
204 dpavlin 21
205 dpavlin 72 while ($row = xx_fetch_array ($rs, xx_ASSOC)) {
206 dpavlin 21
207     // Fetch information types for this subject
208     $masterinfotype = $row["masterinfotype"];
209     $masterinfotype_id = $row["masterinfotype_id"];
210     $infotype = $row["infotype"];
211     $infotype_id = $row["infotype_id"];
212     $title = $row["title"];
213     $author = $row["author"];
214     $annotation = $row["annotation"];
215     $resource_id = $row["resource_id"];
216     $url = $row["url"];
217     $cat_num = $row["cat_num"];
218     $call_no = $row["call_no"];
219     $coverage = $row["coverage_detail"];
220     $description = $row["description"];
221 dpavlin 72
222     $guide_url = $row["guide_url"];
223     $resource_message = $row["resource_message"];
224     $resource_status = $row["resource_status"];
225     $vendor_message = $row["vendor_message"];
226     $vendor_status = $row["vendor_status"];
227 dpavlin 21
228     if (strlen($description) > 0) $annotation = $description;
229    
230     // Header info
231     if ($last_m != $masterinfotype) printf("<a name=\"m%d\"><h3>%s</h3></a>", $masterinfotype_id, $masterinfotype);
232     if ($last_i != $infotype) printf("<p>&nbsp;&nbsp;&nbsp;&nbsp;<a name=\"i%d\"><b><i>%s</i></b></a></p>", $infotype_id, $infotype);
233    
234     printf("<table><tr><td width=\"20\">&nbsp;</td>\n");
235     printf("<td valign=\"top\"><img src=\"images/bullet.gif\" alt=\"\"></td>\n");
236 dpavlin 72 printf("<td>\n");
237 dpavlin 21
238     // Display the resource
239     if (strlen($url) > 0 ) {
240     printf("<b><a href=\"%s\">%s</a></b>\n", $url, $title);
241    
242     }
243     else {
244     printf("<b>%s</b>", $title);
245     }
246    
247     // Lookup features
248     $f_sql = "SELECT * FROM res_feature rf, feature f
249     WHERE rf.resource_id = "
250     . $resource_id
251     . " AND rf.feature_id = f.feature_id";
252    
253 dpavlin 72 $f_rs = xx_tryquery($f_sql);
254 dpavlin 21
255    
256 dpavlin 72 while ($f_row = xx_fetch_array ($f_rs, xx_ASSOC)) {
257 dpavlin 21 $image_path = $f_row["image_path"];
258     $image_alt = $f_row["image_alt"];
259     printf("<img src=\"%s\" alt=\"%s\">&nbsp;", $image_path, $image_alt);
260     }
261    
262     // If print-friendly display the URL
263     if (($url) && ($pf == 1)) {
264     printf("<br>%s\n", $url);
265     }
266    
267 dpavlin 72 // Handle down/alert messages
268     if ($vendor_status > 0 || $resource_status > 0) {
269    
270     printf("<br><img src =\"images/chain.jpg\" alt=\"Resource Temporarily Unavailable\">\n");
271     printf("<span class=\"error\">\n");
272     if (strlen($vendor_message) > 1) printf("%s<br>\n", $vendor_message);
273     else if (strlen($resource_message) > 1) printf("%s<br>\n", $resource_message);
274     printf("</span>\n");
275     }
276    
277 dpavlin 21 // Display other items
278     if (strlen($coverage) > 0) printf("<br>&nbsp;&nbsp;&nbsp;&nbsp;<i>%s</i>", $coverage);
279     if (strlen($annotation) > 0) printf("<br>%s", $annotation);
280     if (strlen($call_no) > 0) printf("<br><b>Location</b>: %s", $call_no);
281    
282     // Link to library holdings if something was supplied for catalog number
283     if (strlen($cat_num) > 0)
284 dpavlin 72 printf("<BR><a href=\"yourlibrarycatalog.here.edu\">Check Catalog</a>", $cat_num);
285 dpavlin 21
286     // Swap variables
287     $last_m = $masterinfotype;
288     $last_i = $infotype;
289     printf("</td></tr></table>\n");
290     }
291    
292     printf( "<p><hr noshade=\"noshade\" width=\"75%%\" align=\"left\"></p>\n");
293    
294     /*****************************
295     ** Primary subject location **
296     *****************************/
297    
298     printf("<p><span class=\"bigDark\"><a name=\"lib\">Library Information</a></span></p>\n");
299    
300     // Generate the sql
301     $sql = "SELECT *
302     FROM subject, location
303     WHERE subject.subject_id = " . $subject_id . " AND
304     subject.sublocation_id = location.location_id";
305    
306     // Fetch the values
307 dpavlin 72 $rs = xx_tryquery($sql);
308     $row = xx_fetch_array ($rs, xx_ASSOC);
309 dpavlin 21 $location_id = $row["location_id"];
310     $location = $row["location"];
311     $location_descr = $row["location_descr"];
312     $campus = $row["campus"];
313     $address1 = $row["address1"];
314     $address2 = $row["address2"];
315     $address3 = $row["address3"];
316     $address4 = $row["address4"];
317     $telephone = $row["telephone"];
318     $mainURL = $row["mainURL"];
319     $referenceURL = $row["referenceURL"];
320     $mapURL = $row["mapURL"];
321     $hoursURL = $row["hoursURL"];
322    
323     if ($location_id > 1) {
324    
325     printf("<p><span class=\"bigDark\">Primary Subject Location(s)</span></p>\n");
326    
327     if (strlen($mainURL) > 1) printf("<a href=\"%s\"><b>%s</b></a><br>\n", $mainURL, $location);
328     else printf("<b>%s</b><br>\n", $location);
329    
330     if (strlen($location_descr) > 1) printf("%s<br>\n", $location_descr);
331     if (strlen($campus) > 1) printf("<b>Campus:</b> %s<br>\n", $campus);
332     if (strlen($address1) > 1) printf("<b>Address Line 1:</b> %s<br>\n", $address1);
333     if (strlen($address2) > 1) printf("<b>Address Line 2:</b> %s<br>\n", $address2);
334     if (strlen($address3) > 1) printf("<b>Address Line 3:</b> %s<br>\n", $address3);
335     if (strlen($address4) > 1) printf("<b>Address Line 4:</b> %s<br>\n", $address4);
336     if (strlen($telephone) > 1) printf("<b>Telephone:</b> %s<br>\n", $telephone);
337     if (strlen($mainURL) > 1) printf("<b>Main URL:</b> <a href= \"%s\">%s</a><br>\n", $mainURL, $mainURL);
338     if (strlen($referenceURL) > 1) printf("<b>Reference URL:</b> <a href=\"%s\">%s</a><br>\n", $referenceURL, $referenceURL);
339     if (strlen($mapURL) > 1) printf("<b>Map URL:</b> <a href=\"%s\">%s</a><br>\n", $mapURL, $mapURL);
340     if (strlen($hoursURL) > 1) printf("<b>Hours URL:</b> <a href= \"%s\">%s</a><br>\n", $hoursURL, $hoursURL);
341     }
342    
343     printf("<br>\n");
344    
345     /**********************************
346     ** Secondary subject location(s) **
347     **********************************/
348    
349     // Generate the sql
350     $sql = "SELECT *
351     FROM sub_loc, location
352     WHERE sub_loc.subject_id = " . $subject_id . " AND
353     sub_loc.location_id = location.location_id";
354    
355     // Fetch the values
356 dpavlin 72 $rs = xx_tryquery($sql);
357 dpavlin 21
358     // Initialize
359     $rowcount = 0;
360    
361 dpavlin 72 while ($row = xx_fetch_array ($rs, xx_ASSOC)) {
362 dpavlin 21
363     $location_id = $row["location_id"];
364     $location = $row["location"];
365     $location_descr = $row["location_descr"];
366     $campus = $row["campus"];
367     $address1 = $row["address1"];
368     $address2 = $row["address2"];
369     $address3 = $row["address3"];
370     $address4 = $row["address4"];
371     $telephone = $row["telephone"];
372     $mainURL = $row["mainURL"];
373     $referenceURL = $row["referenceURL"];
374     $mapURL = $row["mapURL"];
375     $hoursURL = $row["hoursURL"];
376    
377     // Increment
378     $rowcount++;
379    
380     // Display the values if present
381     if ($rowcount == 1) printf("<p><span class=\"bigDark\">Secondary Subject Location(s)</span></p>\n");
382    
383     if (strlen($mainURL) > 1) printf("<a href=\"%s\"><b>%s</b></a><br>\n", $mainURL, $location);
384     else printf("<b>%s</b><br>\n", $location);
385    
386     if (strlen($location_descr) > 1) printf("%s<br>\n", $location_descr);
387     if (strlen($campus) > 1) printf("<b>Campus:</b> %s<br>\n", $campus);
388     if (strlen($address1) > 1) printf("<b>Address Line 1:</b> %s<br>\n", $address1);
389     if (strlen($address2) > 1) printf("<b>Address Line 2:</b> %s<br>\n", $address2);
390     if (strlen($address3) > 1) printf("<b>Address Line 3:</b> %s<br>\n", $address3);
391     if (strlen($address4) > 1) printf("<b>Address Line 4:</b> %s<br>\n", $address4);
392     if (strlen($telephone) > 1) printf("<b>Telephone:</b> %s<br>\n", $telephone);
393     if (strlen($mainURL) > 1) printf("<b>Main URL:</b> <a href= \"%s\">%s</a><br>\n", $mainURL, $mainURL);
394     if (strlen($referenceURL) > 1) printf("<b>Reference URL:</b> <a href=\"%s\">%s</a><br>\n", $referenceURL, $referenceURL);
395     if (strlen($mapURL) > 1) printf("<b>Map URL:</b> <a href=\"%s\">%s</a><br>\n", $mapURL, $mapURL);
396     if (strlen($hoursURL) > 1) printf("<b>Hours URL:</b> <a href= \"%s\">%s</a><br>\n", $hoursURL, $hoursURL);
397    
398     printf("<br>");
399    
400     }
401     printf("</td></tr>\n");
402    
403    
404     printf("<tr>\n");
405     printf("<td align=\"left\">\n");
406    
407     if ($other_ps || $other_rqs) printf("<a name=\"related\"></a>\n");
408    
409     /****************************************************************
410     ** Hunt for related subject pages & display them if they exist **
411     ****************************************************************/
412 dpavlin 72 $othersubs = existsRow("sub_othersub", "subject_id", $subject_id);
413 dpavlin 21
414     if ($othersubs > 0) {
415     printf("<table cellpadding=\"10\"><tr><td bgcolor=\"#dcdcdc\" class=\"small\"><h4>Related RQS Pages</h4>\n");
416 dpavlin 72 displayRelatedSubjects($subject_id);
417 dpavlin 21 print "</td></tr></table><br>\n";
418     }
419    
420    
421     /*******************************************************************
422     ** Hunt for related PageScribe pages & display them if they exist **
423     *******************************************************************/
424 dpavlin 72 $pages = existsRow("sub_page", "subject_id", $subject_id);
425 dpavlin 21
426     if ($pages > 0) {
427     printf("<table cellpadding=\"10\"><tr><td bgcolor=\"#dcdcdc\" class=\"small\"><h4>Related PageScribe Pages</h4>\n");
428 dpavlin 72 displayRelatedPages($subject_id);
429 dpavlin 21 print "</td></tr></table>\n";
430     }
431    
432     // main body table
433     printf("</td></tr></table>\n");
434    
435     // outer table
436     printf("</td></tr></table>\n");
437    
438     // Page footer
439     require_once ("footer.phtml");
440     ?>
441    
442     </body>
443     </html>

  ViewVC Help
Powered by ViewVC 1.1.26