/[libdata]/trunk/admin/element_results_brief.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/admin/element_results_brief.phtml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (hide annotations)
Fri Dec 5 18:34:18 2003 UTC (20 years, 4 months ago) by dpavlin
File size: 7359 byte(s)
Initial revision

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>PageScribe-CourseLib Element Search Results</title>\n");
16     printf("<link rel=\"stylesheet\" href=\"%s\" type=\"text/css\">\n", $GLOBAL_ADMIN_CSS);
17     printf("</HEAD>\n");
18    
19    
20     // Page header
21     require_once ($GLOBAL_ADMIN_HEADER);
22    
23    
24     // Collect access information
25     if(isset($libsession)) {
26    
27     // Fetch session information
28     $sessionClass = new sessionClass("", $libsession, "", "");
29     $accessClass = new accessClass($sessionClass);
30    
31     // Load user session variables
32     $sess_time_human = $sessionClass->time_human;
33     $sess_staff_account = $sessionClass->staff_account;
34     $sess_access_level = $accessClass->access_level;
35     $sess_access = $accessClass->access;
36     $sess_last_name = $accessClass->last_name;
37     $sess_first_name = $accessClass->first_name;
38    
39     }
40    
41     // If the cookie is set and access level is appropriate
42     if(isset($libsession) && $sess_access_level >= 20) {
43    
44     // Orderby field function
45     function orderByField($noOrderSQL, $field_name, $validated){
46     $finalSQL = $noOrderSQL . " ORDER BY " . $field_name;
47     printf("<form method = \"POST\" action = \"element_results_brief.phtml\" >\n");
48     printf("<input type = \"Submit\" value = \"Sort\" >", $field_name);
49     printf("</form><br>\n");
50     }
51    
52     // Display page heading
53     printf("<center><h3>Element Search Results</h3>\n");
54    
55     // Set up a flagging variable to track possible problems with the search parameters
56     $problem = 0;
57    
58     // Algorithm is cleared to search
59     if ($problem < 1) {
60    
61     /* Select a distinct row of reference information, but build the extra
62     joins in case the user wants to limit by additional criteria. */
63    
64     $sql = "SELECT DISTINCT
65     e.page_id,
66     r.title,
67     p.page_title,
68     p.date_created,
69     p.date_modified,
70     c.course_concat,
71     s.first_name,
72     s.last_name,
73     t.staff_account
74     FROM
75     element e
76     LEFT JOIN resource r using (resource_id)
77     LEFT JOIN staff s on e.staff_id = s.staff_id
78     LEFT JOIN location l on e.location_id = l.location_id
79     LEFT JOIN service v on e.service_id = v.service_id
80     LEFT JOIN page p on e.page_id = p.page_id
81     LEFT JOIN staff t on p.staff_coordinator = t.staff_id
82     LEFT JOIN course c on e.page_id = c.page_id
83     WHERE (e.element_id > 0";
84    
85     // If user limited by page title
86     if ($page_title != ""){
87    
88     $page_title = textSearchmySQL($page_title);
89     $sql .= " AND (p.page_title LIKE '%"
90     . $page_title
91     . "%')";
92    
93     }
94    
95     // If user limited by element label
96     if ($label != ""){
97    
98     $label = textSearchmySQL($label);
99     $sql .= " AND (e.label LIKE '%"
100     . $label
101     . "%')";
102    
103     }
104    
105     // If user limited by element url
106     if ($label_url != ""){
107    
108     $label_url = textSearchmySQL($label_url);
109     $sql .= " AND (e.label_url LIKE '%"
110     . $label_url
111     . "%')";
112    
113     }
114    
115     // If user limited by element descr
116     if ($element_descr != ""){
117    
118     $element_descr = textSearchmySQL($element_descr);
119     $sql .= " AND (e.element_descr LIKE '%"
120     . $element_descr
121     . "%')";
122    
123     }
124    
125     // If user limited by resource
126     if ($resource_id > 1){
127     $sql .= " AND (e.resource_id ="
128     . $resource_id
129     . ")";
130     }
131    
132     // If user limited by service
133     if ($service_id > 1){
134     $sql .= " AND (e.service_id ="
135     . $service_id
136     . ")";
137     }
138    
139     // If user limited by location
140     if ($location_id > 1){
141     $sql .= " AND (e.location_id ="
142     . $location_id
143     . ")";
144     }
145    
146    
147     // If user limited by staff-as-element
148     if ($staff_id > 1){
149     $sql .= " AND (e.staff_id ="
150     . $staff_id
151     . ")";
152     }
153    
154     // cap it off
155     $sql .= ")";
156    
157    
158     // Order by
159     if ($orderby !="" && $orderdir != ""){
160     $sql .= " ORDER BY " . $orderby . " " . $orderdir;
161     }
162    
163     // Debugging
164     // printf("sql was: %s<BR>", $sql);
165    
166     if ( !$rs = mysql_query ( $sql, $con ) ) {
167     sql_err ( $sql ) And bailout();
168     }
169    
170     // Table
171     printf("<center><table width=\"90%%\" border =\"1\" bgcolor =\"#ffffff\" cellpadding=\"4\">");
172    
173     // Page ID
174     printf("<tr><td width = \"5%%\" class=\"cellPlain\">\n");
175     printf("Page ID#");
176     printf("</td>\n");
177    
178     // Edit
179     printf("<td width=\"10%%\" align=\"center\" class=\"cellPlain\">Command</td>\n");
180    
181     // Page coordinator
182     printf("<td width=\"20%%\" class=\"cellPlain\">Coordinator ID</td>\n");
183    
184     // Page/Course Title
185     printf("<td width = \"45%%\" class=\"cellPlain\">\n");
186     printf("Page/Course Title");
187     printf("</td>\n");
188    
189     // Date created
190     printf("<td width = \"10%%\" class=\"cellPlain\">\n");
191     printf("Created");
192     printf("</td>\n");
193    
194     // Date created
195     printf("<td width = \"10%%\" class=\"cellPlain\">\n");
196     printf("Modified");
197     printf("</td>\n");
198    
199     // Close row
200     printf("</tr>\n");
201    
202     // Initialize counter
203     $rowcount = 0;
204    
205     // Cycle through the result set
206     while ( $row = mysql_fetch_array ( $rs ) ) {
207     $page_id = $row["page_id"];
208     $page_title = Trim($row["page_title"]);
209     $date_created = substr($row["date_created"], 0, 10);
210     $date_modified = substr($row["date_modified"], 0, 10);
211     $course_concat = Trim($row["course_concat"]);
212    
213     $first_name = Trim($row["first_name"]);
214     $last_name = Trim($row["last_name"]);
215     $staff_account = Trim($row["staff_account"]);
216    
217     // New row
218     if ($rowcount % 2 == 0) $color = " class=\"backLight\" ";
219     else $color ="";
220    
221     // Use full course name if this is a coursescribe page
222     if (strlen($course_concat) > 0) $page_title = $course_concat;
223    
224     // Pull out any HTML
225     $page_title = strip_tags($page_title);
226    
227     // Page id
228     printf("<tr>");
229     printf("<td width=\"5%%\" %s>\n", $color);
230     printf("<a href=\"%spage.phtml?page_id=%d\">%d</a>\n",$GLOBAL_SCRIBE_URL, $page_id, $page_id);
231     printf("</td>\n");
232    
233     // Edit/View command
234     printf("<td width=\"10%%\"align=\"center\" %s>\n", $color);
235     printf("<a href=\"%spage.phtml?page_id=%d\">View</a> | ",$GLOBAL_SCRIBE_URL, $page_id);
236     printf("<a href=\"scribe.phtml?page_id="
237     . $page_id
238     . "\">Edit</a>\n");
239     printf("</td>\n");
240    
241     // Staff Coordinator
242     printf("<td width=\"20%%\" %s>%s</td>\n", $color, $staff_account);
243    
244     // Title
245     printf("<td width=\"45%%\" %s>%s</td>\n", $color, $page_title);
246    
247     // Date created
248     printf("<td width=\"10%%\" %s>%s</td>\n", $color, $date_created);
249    
250     // Date last modified
251     printf("<td width=\"10%%\" %s>%s</td>\n", $color, $date_modified);
252    
253     // Close row
254     printf("</tr>\n");
255    
256     // Increment counter
257     $rowcount++;
258    
259     }
260    
261     // Search statistics
262     printf("<tr><td align = \"right\" colspan =\"6\" class=\"backLight\">");
263     $records = "record";
264     printf("<BR>Returned %d ", mysql_num_rows($rs));
265     if (mysql_num_rows($rs) != 1) $records .= "s";
266     printf($records);
267     printf(".");
268    
269     // Close off the table
270     printf ("</td></tr></table></center><BR>");
271    
272     }
273    
274     printf("<center>");
275    
276     // Error trapping
277     // No search criteria supplied
278     if ($problem == 2) printf ("No search criteria supplied. Please go back and select some criteria.<br><br");
279    
280     printf("</center>");
281    
282     // Link to return to admin console
283     adminReturn($sess_access_level);
284    
285     } // logged in
286    
287     // No access page
288     else require_once ($GLOBAL_NO_ACCESS);
289    
290    
291     // Page footer
292     require_once ($GLOBAL_ADMIN_FOOTER);
293     ?>
294    
295     </body>
296     </html>

  ViewVC Help
Powered by ViewVC 1.1.26