1 |
dpavlin |
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>CourseLib: Select a Course</title>\n"); |
15 |
|
|
printf("<link rel=\"stylesheet\" href=\"libdata.css\" type=\"text/css\">\n"); |
16 |
|
|
printf("</head>\n"); |
17 |
|
|
|
18 |
|
|
printf("<body marginheight = \"0\" marginwidth = \"0\" leftmargin = \"0\" topmargin = \"0\">\n"); |
19 |
|
|
|
20 |
|
|
// Page header |
21 |
|
|
require_once ("header.phtml"); |
22 |
|
|
|
23 |
|
|
?> |
24 |
|
|
|
25 |
|
|
|
26 |
|
|
|
27 |
|
|
<center> |
28 |
|
|
|
29 |
|
|
<br><br> |
30 |
|
|
<table width="95%" bgcolor ="#ffffff" border="0"> |
31 |
|
|
|
32 |
|
|
<tr> |
33 |
|
|
<td colspan="2" align="left" class="bigDark"> |
34 |
|
|
Select a course<br><br> |
35 |
|
|
<hr noshade> |
36 |
|
|
</td> |
37 |
|
|
|
38 |
|
|
</tr> |
39 |
|
|
|
40 |
|
|
|
41 |
|
|
<tr> |
42 |
|
|
<td colspan="2" align="left"> |
43 |
|
|
<span class="bigDark"> |
44 |
|
|
Step #1: Limit Course Selection Box |
45 |
|
|
<br><br> |
46 |
|
|
|
47 |
|
|
Department letter begins with:</span><br> |
48 |
|
|
<?php |
49 |
|
|
// Allow A-Z |
50 |
|
|
if ($letter == "") printf("<b>\n"); |
51 |
|
|
printf("<a href=\"courses.phtml\">A-Z</a>"); |
52 |
|
|
if ($letter == "") printf("</b>\n"); |
53 |
|
|
|
54 |
|
|
// Draw the alphabet |
55 |
|
|
for ($ascii_char = 65; $ascii_char <= 90; $ascii_char++) { |
56 |
|
|
if ($letter == chr($ascii_char)) printf("<b>\n"); |
57 |
|
|
if ($asci_char != 90) printf(" | "); |
58 |
|
|
printf("<a href=\"courses.phtml?letter=" |
59 |
|
|
. chr($ascii_char) |
60 |
|
|
. "\">" |
61 |
|
|
. chr($ascii_char) |
62 |
|
|
. "</a>"); |
63 |
|
|
if ($letter == chr($ascii_char)) printf("</b>\n"); |
64 |
|
|
} |
65 |
|
|
|
66 |
|
|
|
67 |
|
|
?> |
68 |
|
|
</b></font> |
69 |
|
|
<br><br> |
70 |
|
|
</td> |
71 |
|
|
|
72 |
|
|
|
73 |
|
|
</tr> |
74 |
|
|
|
75 |
|
|
<tr> |
76 |
|
|
<td colspan="2" class="bigDark"> |
77 |
|
|
<form method="POST" action="courses.phtml"> |
78 |
|
|
and/or search course title or department:<br> |
79 |
|
|
|
80 |
|
|
<input type="text" NAME="course_descr" SIZE="25" border =" 1" maxlength =" 100" value="<?php printf($course_descr); ?>"> |
81 |
|
|
</td> |
82 |
|
|
</tr> |
83 |
|
|
|
84 |
|
|
|
85 |
|
|
<tr> |
86 |
|
|
<td colspan="2" class="bigDark"> |
87 |
|
|
<form method="POST" action="courses.phtml"> |
88 |
|
|
and/or select course department:<br> |
89 |
|
|
|
90 |
|
|
<select name = "coursesub"> |
91 |
|
|
<option value="">Unselected</option> |
92 |
dpavlin |
72 |
<?php dropDownCoursesubSelected(" WHERE s.coursesub_id > 1", $coursesub); ?> |
93 |
dpavlin |
1 |
</select> |
94 |
|
|
</td> |
95 |
|
|
|
96 |
|
|
</tr> |
97 |
|
|
|
98 |
|
|
<tr> |
99 |
|
|
<td width="60%" class="bigDark"> |
100 |
|
|
<form method="POST" action="courses.phtml"> |
101 |
|
|
and/or select by professor:<br> |
102 |
|
|
|
103 |
|
|
<select name = "faculty_id"> |
104 |
|
|
<option value="">Unselected</option> |
105 |
dpavlin |
72 |
<?php dropDownFacultySelected(" WHERE f.faculty_id > 1", $faculty_id); ?> |
106 |
dpavlin |
1 |
</select> |
107 |
|
|
</td> |
108 |
|
|
|
109 |
|
|
<td width="40%" align="left"> |
110 |
|
|
<input type="submit" value="Limit Selection Box"> |
111 |
|
|
</form> |
112 |
|
|
</td> |
113 |
|
|
</tr> |
114 |
|
|
|
115 |
|
|
<tr> |
116 |
|
|
<td colspan="2"> |
117 |
|
|
<hr noshade> |
118 |
|
|
</td> |
119 |
|
|
</tr> |
120 |
|
|
|
121 |
|
|
<tr> |
122 |
|
|
<td width="60%"> |
123 |
|
|
<span class="bigDark"> |
124 |
|
|
Step #2: Pick a Course</span><br><br> |
125 |
|
|
<form method="GET" action="page.phtml"> |
126 |
|
|
<select name="page_id" size = "5" > |
127 |
|
|
|
128 |
|
|
<?php |
129 |
|
|
|
130 |
|
|
|
131 |
|
|
// Display Courses |
132 |
|
|
$sql = "SELECT DISTINCT |
133 |
|
|
p.page_id, |
134 |
|
|
p.page_title, |
135 |
|
|
t.term, |
136 |
|
|
c.course_year, |
137 |
|
|
c.course_concat |
138 |
|
|
|
139 |
|
|
FROM |
140 |
|
|
course c |
141 |
|
|
LEFT JOIN page p using (page_id) |
142 |
|
|
LEFT JOIN coursesub s on c.coursesub_id = s.coursesub_id |
143 |
|
|
LEFT JOIN term t on c.term_id = t.term_id |
144 |
|
|
LEFT JOIN course_personnel cp on c.course_id = cp.course_id |
145 |
|
|
|
146 |
|
|
WHERE |
147 |
|
|
p.published = 1"; |
148 |
|
|
|
149 |
|
|
if (strlen($letter) > 0) { |
150 |
|
|
$sql .= " AND c.course_concat LIKE '" |
151 |
|
|
. $letter |
152 |
|
|
. "%'"; |
153 |
|
|
} |
154 |
|
|
|
155 |
|
|
if ($faculty_id > 0) { |
156 |
|
|
$sql .= " AND cp.faculty_id = " |
157 |
|
|
. $faculty_id; |
158 |
|
|
} |
159 |
|
|
|
160 |
|
|
|
161 |
|
|
if (strlen($coursesub) > 0) { |
162 |
|
|
$sql .= " AND s.coursesub ='" |
163 |
|
|
. $coursesub |
164 |
|
|
. "'"; |
165 |
|
|
} |
166 |
|
|
|
167 |
|
|
else if (strlen($course_descr) > 0) { |
168 |
|
|
|
169 |
|
|
$course_descr = textSearchmySQL($course_descr); |
170 |
|
|
$sql .=" AND c.course_concat LIKE '%" |
171 |
|
|
. $course_descr |
172 |
|
|
. "%' OR p.page_title LIKE '%" |
173 |
|
|
. $course_descr |
174 |
|
|
. "%'"; |
175 |
|
|
} |
176 |
|
|
|
177 |
|
|
// Order them by designator |
178 |
|
|
$sql .= " ORDER BY c.course_concat"; |
179 |
|
|
|
180 |
|
|
// Fetch a recordset |
181 |
dpavlin |
72 |
$rs = xx_tryquery($sql); |
182 |
dpavlin |
1 |
|
183 |
|
|
// Cycle through them |
184 |
dpavlin |
72 |
while ($row = xx_fetch_array ($rs, xx_ASSOC)) { |
185 |
dpavlin |
1 |
$course_num = $row["course_num"]; |
186 |
|
|
$page_title = $row["page_title"]; |
187 |
|
|
$page_id = $row["page_id"]; |
188 |
|
|
$term = $row["term"]; |
189 |
|
|
$course_year = $row["course_year"]; |
190 |
|
|
$course_concat = $row["course_concat"]; |
191 |
|
|
|
192 |
|
|
printf("<option value=\"%d\">%s</option>\n", $page_id, $course_concat); |
193 |
|
|
|
194 |
|
|
} |
195 |
|
|
?> |
196 |
|
|
</select> |
197 |
|
|
|
198 |
|
|
</td> |
199 |
|
|
|
200 |
|
|
<td width="40%" align="left" valign="bottom"> |
201 |
|
|
<input type="submit" value="Select a Course"> |
202 |
|
|
</form> |
203 |
|
|
</td> |
204 |
|
|
</tr> |
205 |
|
|
|
206 |
|
|
|
207 |
|
|
|
208 |
|
|
|
209 |
|
|
</table> |
210 |
|
|
</center> |
211 |
|
|
<br> |
212 |
|
|
|
213 |
|
|
<?php |
214 |
|
|
// Page footer |
215 |
|
|
require_once ("footer.phtml"); |
216 |
|
|
?> |
217 |
|
|
|
218 |
|
|
</body> |
219 |
dpavlin |
72 |
</html> |