/[dtapublic]/to_be_filed/webprojs/php_libraries/php_library/fboprime/schedview.inc
ViewVC logotype

Contents of /to_be_filed/webprojs/php_libraries/php_library/fboprime/schedview.inc

Parent Directory Parent Directory | Revision Log Revision Log


Revision 35 - (show annotations) (download)
Sat Oct 8 23:35:33 2016 UTC (7 years, 5 months ago) by dashley
File size: 114030 byte(s)
Initial commit.
1 <?php
2 //$Header: /hl/cvsroots/gpl01/gpl01/webprojs/fboprime/sw/phplib/schedview.inc,v 1.35 2006/08/01 21:51:46 dashley Exp $
3 //********************************************************************************
4 //schedview.inc--FboPrime Scheduling View Functions
5 //Copyright (C) 2006 David T. Ashley
6 //
7 //This program is free software; you can redistribute it and/or
8 //modify it under the terms of the GNU General Public License
9 //as published by the Free Software Foundation; either version 2
10 //of the License, or (at your option) any later version.
11 //
12 //This program is distributed in the hope that it will be useful,
13 //but WITHOUT ANY WARRANTY; without even the implied warranty of
14 //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 //GNU General Public License for more details.
16 //
17 //You should have received a copy of the GNU General Public License
18 //along with this program; if not, write to the Free Software
19 //Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 //********************************************************************************
21 //This file contains functions that assist in the scheduling views (daily,
22 //weekly, monthly) and may be common between them.
23 //--------------------------------------------------------------------------------
24 require_once("menu.inc");
25 require_once("rscs.inc");
26 require_once("stime.inc");
27 require_once("t4.inc");
28 //
29 //--------------------------------------------------------------------------------
30 //Emits the standard login form, or else a welcome/login message if a user is
31 //logged in. This may appear on more than one scheduling view.
32 //
33 //Parameters:
34 // userinfo : FALSE if no user is logged in, otherwise an associative
35 // array with the user's information from the MySQL database.
36 // dt8 : Date, if specified to page.
37 // t4in : Time is specified to page.
38 // prevloginfail : TRUE if login has failed so that
39 //
40 function SCHEDVIEW_login_form_echo($userinfo, $dt8in, $t4in, $prevloginfail)
41 {
42 if ($userinfo === FALSE)
43 {
44 HTMLFORMAT_echo_push_nl("<form name=\"loginform\" method=\"post\" action=\"index.php\">");
45 HTMLFORMAT_echo_push_nl("<table border=\"0\" cellspacing=\"0\" cellpadding=\"4\" bgcolor=\"#"
46 . CONFIG_SCHED_COLOR_BACKGROUND . "\">");
47 HTMLFORMAT_echo_push_nl("<tr>");
48 HTMLFORMAT_echo_noop_nl("<td align=\"center\">Username</td>");
49 HTMLFORMAT_echo_pull_nl("</tr>");
50 HTMLFORMAT_echo_push_nl("<tr>");
51 HTMLFORMAT_echo_noop_nl("<td align=\"center\"><input type=\"text\" name=\"authuserid\" size=\"15\" maxlength=\"20\"></td>");
52 HTMLFORMAT_echo_pull_nl("</tr>");
53 HTMLFORMAT_echo_push_nl("<tr>");
54 HTMLFORMAT_echo_noop_nl("<td align=\"center\">Password</td>");
55 HTMLFORMAT_echo_pull_nl("</tr>");
56 HTMLFORMAT_echo_push_nl("<tr>");
57 HTMLFORMAT_echo_noop_nl("<td align=\"center\"><input type=\"password\" name=\"authuserpasswd\" size=\"16\" maxlength=\"20\"></td>");
58 HTMLFORMAT_echo_pull_nl("</tr>");
59 HTMLFORMAT_echo_push_nl("<tr valign=\"bottom\">");
60 HTMLFORMAT_echo_noop_nl("<td height=\"80%\" align=\"center\"><input align=\"BOTTOM\" type=\"submit\" name=\"submit\" value=\"Login\"></td>");
61 HTMLFORMAT_echo_pull_nl("</tr>");
62 HTMLFORMAT_echo_pull_nl("</table>");
63 if ($dt8in !== FALSE)
64 {
65 HTMLFORMAT_echo_noop_nl("<input type=\"hidden\" name=\"sddt\" value=\"" . $dt8in . "\">");
66 }
67 if ($t4in !== FALSE)
68 {
69 HTMLFORMAT_echo_noop_nl("<input type=\"hidden\" name=\"sdtim\" value=\"" . $t4in . "\">");
70 }
71 HTMLFORMAT_echo_pull_nl("</form>");
72 if ($prevloginfail)
73 {
74 HTMLFORMAT_echo_push_nl("<p>");
75 if (($dt8in === FALSE) && ($t4in === FALSE))
76 {
77 $baseurl = "userloginrecovery.php";
78 }
79 else if (($dt8in === FALSE) && ($t4in !== FALSE))
80 {
81 $baseurl = "userloginrecovery.php?sdtim=" . $t4in;
82 }
83 else if (($dt8in !== FALSE) && ($t4in === FALSE))
84 {
85 $baseurl = "userloginrecovery.php?sddt=" . $dt8in;
86 }
87 else
88 {
89 $baseurl = "userloginrecovery.php?sddt=" . $dt8in . "&sdtim=" . $t4in;
90 }
91
92 HTMLFORMAT_echo_noop_nl("&nbsp;<a href=\"" . $baseurl . "\">Trouble logging in?</a>&nbsp;<br><br>");
93 HTMLFORMAT_echo_pull_nl("</p>");
94 }
95 }
96 }
97 //
98 //--------------------------------------------------------------------------------
99 //Displays a mini-calendar at the top of the dayview screen.
100 //
101 //Parameters:
102 // $disp_year : The calendar to create year.
103 // $disp_month : The calendar to create month.
104 // $schedviewyear : The year of the date currently being displayed on the
105 // scheduler.
106 // $schedviewmonth : The month of the date currently being displayed on the
107 // scheduler.
108 // $schedviewday : The day of the date currently being displayed on the
109 // scheduler.
110 //
111 function SCHEDVIEW_dayview_calendar($disp_year, $disp_month, $schedviewyear, $schedviewmonth, $schedviewday)
112 {
113 global $GLOBAL_stime_year;
114 global $GLOBAL_stime_month;
115 global $GLOBAL_stime_day;
116
117 //echo " Display year is : " . $disp_year . " ";
118
119 //Figure out the name of the month (as opposed to number).
120 $month_string = DATEFUNC_string_month_long($disp_month);
121
122 //Figure out what day of the week the first day of this month occurs on.
123 $dow_first = DATEFUNC_intdayofweek_intdate($disp_year, $disp_month, 1);
124
125 //Figure out how many days are in this month.
126 $ndays = DATEFUNC_year_month_days($disp_year, $disp_month);
127
128 HTMLFORMAT_echo_push_nl("<table border=\"0\" frame=\"void\" cellspacing=\"2\">");
129 HTMLFORMAT_echo_push_nl("<tr>");
130
131 //Display the banner containing the month name and the year.
132 //
133 HTMLFORMAT_echo_noop_nl("<td colspan=\"7\" align=\"center\" bgcolor=\"#"
134 . CONFIG_GLOBAL_BANNERBAR_MINI_A . "\"><b>"
135 . $month_string . " " . $disp_year . "</b></td>");
136
137 HTMLFORMAT_echo_pull_nl("</tr>");
138
139 //Display the table containing the days of the week, Sun - Sat.
140 HTMLFORMAT_echo_push_nl("<tr>");
141 HTMLFORMAT_echo_noop_nl("<td align=\"center\" bgcolor=\"#" . CONFIG_GLOBAL_BANNERBAR_MINI_B . "\">S</td>");
142 HTMLFORMAT_echo_noop_nl("<td align=\"center\" bgcolor=\"#" . CONFIG_GLOBAL_BANNERBAR_MINI_B . "\">M</td>");
143 HTMLFORMAT_echo_noop_nl("<td align=\"center\" bgcolor=\"#" . CONFIG_GLOBAL_BANNERBAR_MINI_B . "\">T</td>");
144 HTMLFORMAT_echo_noop_nl("<td align=\"center\" bgcolor=\"#" . CONFIG_GLOBAL_BANNERBAR_MINI_B . "\">W</td>");
145 HTMLFORMAT_echo_noop_nl("<td align=\"center\" bgcolor=\"#" . CONFIG_GLOBAL_BANNERBAR_MINI_B . "\">T</td>");
146 HTMLFORMAT_echo_noop_nl("<td align=\"center\" bgcolor=\"#" . CONFIG_GLOBAL_BANNERBAR_MINI_B . "\">F</td>");
147 HTMLFORMAT_echo_noop_nl("<td align=\"center\" bgcolor=\"#" . CONFIG_GLOBAL_BANNERBAR_MINI_B . "\">S</td>");
148 HTMLFORMAT_echo_pull_nl("</tr>");
149
150 //Start up a table row.
151 HTMLFORMAT_echo_push_nl("<tr>");
152
153 //Put in the spacers that occur before the first day of the month.
154 for ($i=0; $i<$dow_first; $i++)
155 {
156 HTMLFORMAT_echo_noop_nl("<td align=\"right\">&nbsp;</td>");
157 }
158
159 //Write the days of the month.
160 for ($i=1; $i<=$ndays; $i++)
161 {
162 //Calculate Boolean variables to record if the day whose day number is being written is
163 //the current calendar day and/or the day currently being viewed in the scheduler.
164 //
165 if (($disp_year == $schedviewyear) && ($disp_month == $schedviewmonth) && ($i == $schedviewday))
166 $is_sched_view_day = TRUE;
167 else
168 $is_sched_view_day = FALSE;
169 //
170 if (($disp_year == $GLOBAL_stime_year) && ($disp_month == $GLOBAL_stime_month) && ($i == $GLOBAL_stime_day))
171 $is_cal_day = TRUE;
172 else
173 $is_cal_day = FALSE;
174
175
176 if ($is_sched_view_day && $is_cal_day)
177 {
178 //The day whose calendar number is being written is the same as the day being
179 //displayed in the scheduler, and the same as today's date.
180 //
181 HTMLFORMAT_echo_noop_nl("<td bgcolor=\"#" . CONFIG_SCHED_COLOR_MINICAL_CURVIEW . "\" align=\"right\"><a href=\"index.php?sddt="
182 .
183 sprintf("%04d", $disp_year)
184 .
185 sprintf("%02d", $disp_month)
186 .
187 sprintf("%02d", $i)
188 .
189 "\">"
190 .
191 "<font color=\"#000000\">" . sprintf("%d", $i) . "</font>" . "</a></td>");
192 }
193 else if ($is_sched_view_day)
194 {
195 //The day whose calendar number is being written is the same as the day being
196 //displayed in the scheduler.
197 //
198 HTMLFORMAT_echo_noop_nl("<td bgcolor=\"#" . CONFIG_SCHED_COLOR_MINICAL_VIEWONLY . "\" align=\"right\"><a href=\"index.php?sddt="
199 .
200 sprintf("%04d", $disp_year)
201 .
202 sprintf("%02d", $disp_month)
203 .
204 sprintf("%02d", $i)
205 .
206 "\">"
207 .
208 "<font color=\"#000000\">" . sprintf("%d", $i) . "</font>" . "</a></td>");
209 }
210 else if ($is_cal_day)
211 {
212 //The day being displayed is today.
213 //
214 HTMLFORMAT_echo_noop_nl("<td bgcolor=\"#" . CONFIG_SCHED_COLOR_MINICAL_CURONLY . "\" align=\"right\"><a href=\"index.php?sddt="
215 .
216 sprintf("%04d", $disp_year)
217 .
218 sprintf("%02d", $disp_month)
219 .
220 sprintf("%02d", $i)
221 .
222 "\">"
223 .
224 "<font color=\"#000000\">" . sprintf("%d", $i) . "</font>" . "</a></td>");
225 }
226 else
227 {
228 HTMLFORMAT_echo_noop_nl("<td align=\"right\"><a href=\"index.php?sddt="
229 .
230 sprintf("%04d", $disp_year)
231 .
232 sprintf("%02d", $disp_month)
233 .
234 sprintf("%02d", $i)
235 .
236 "\">"
237 .
238 sprintf("%d", $i) . "</a></td>");
239 }
240
241 //We end a row and start a new one under this set of circumstances.
242 // a)It is not the last day of the month we just printed.
243 // b)The day of the week on which the month starts plus the day we
244 // just printed mod 7 is zero.
245 if ($i != $ndays)
246 {
247 if ((($i + $dow_first) % 7) == 0)
248 {
249 HTMLFORMAT_echo_pull_nl("</tr>");
250 HTMLFORMAT_echo_push_nl("<tr>");
251 }
252 }
253 }
254
255 //Round out the final row that contains calendar days.
256 $i = $ndays + $dow_first;
257 while (($i % 7) != 0)
258 {
259 HTMLFORMAT_echo_noop_nl("<td align=\"right\">&nbsp;</td>");
260 $i++;
261 }
262
263 //Terminate the final row of calendar days.
264 HTMLFORMAT_echo_pull_nl("</tr>");
265
266 //Output bottom spacer rows so that every month created has six
267 //rows of days. In general, the number of rows created by days
268 //alone is:
269 //
270 // ( month_start_dayofweek + days_in_month + 6 ) div 7
271 //
272 //The shortest case is a February with 28 days where Feb 1 falls
273 //on a Sunday, i.e.
274 //
275 // (0 + 28 + 6) / 7 = 4
276 //
277 //Many months require six rows to display. This is the worst case.
278 //So, round it out to six rows.
279 $rows_due_to_cal_days = (int)(( $dow_first + $ndays + 6 ) / 7);
280
281 for ($i = $rows_due_to_cal_days + 1; $i <= 6; $i++)
282 {
283 HTMLFORMAT_echo_push_nl("<tr>");
284 HTMLFORMAT_echo_noop_nl("<td align=\"right\">&nbsp;</td>");
285 HTMLFORMAT_echo_noop_nl("<td align=\"right\">&nbsp;</td>");
286 HTMLFORMAT_echo_noop_nl("<td align=\"right\">&nbsp;</td>");
287 HTMLFORMAT_echo_noop_nl("<td align=\"right\">&nbsp;</td>");
288 HTMLFORMAT_echo_noop_nl("<td align=\"right\">&nbsp;</td>");
289 HTMLFORMAT_echo_noop_nl("<td align=\"right\">&nbsp;</td>");
290 HTMLFORMAT_echo_noop_nl("<td align=\"right\">&nbsp;</td>");
291 HTMLFORMAT_echo_pull_nl("</tr>");
292 }
293
294 //HTMLFORMAT_echo_pull_nl("</tr>");
295 HTMLFORMAT_echo_pull_nl("</table>");
296 }
297 //
298 //--------------------------------------------------------------------------------
299 //Emits a temporal navigation bar.
300 //
301 function SCHEDVIEW_temporal_navigation_bar(
302 $userinfo,
303 $dateyear, $datemonth, $dateday,
304 $timehour, $timemin,
305 $diff_time_perm_array,
306 $panel
307 )
308 {
309 global $GLOBAL_stime_year;
310 global $GLOBAL_stime_month;
311 global $GLOBAL_stime_day;
312 global $GLOBAL_stime_hour;
313 global $GLOBAL_stime_minute;
314
315 global $CONFIG_SCHED_DAY_PANELS;
316
317 //Table header emitted unconditionally.
318 HTMLFORMAT_echo_push_nl("<table width=\"100%\" border=\"1\" cellspacing=\"0\" cellpadding=\"4\" rules=\"rows\">");
319
320 //Table row emitted unconditionally.
321 HTMLFORMAT_echo_push_nl("<tr>");
322
323 //"Go To" text emitted unconditionally.
324 HTMLFORMAT_echo_push_nl("<td align=\"center\">");
325 HTMLFORMAT_echo_noop_nl("<b>Go To:</b>");
326 HTMLFORMAT_echo_pull_nl("</td>");
327
328 //-1 month text.
329 //--------------
330 //The previous month should be displayed unless we are already at the lower limit
331 //of navigation.
332 //
333 DATEFUNC_offset_month($dateyear, $datemonth, -1, $prev_month_year, $prev_month_month, $prev_month_result_code);
334
335 if ($diff_time_perm_array[0])
336 {
337 //We should display the previous month's link.
338 //
339 HTMLFORMAT_echo_push_nl("<td align=\"center\">");
340 //
341 //We need to figure out what day of the month to use. There is the possibility
342 //that we are going back to a month with fewer days.
343 //
344 $prev_month_days_in_month = DATEFUNC_year_month_days($prev_month_year, $prev_month_month);
345
346 if ($dateday > $prev_month_days_in_month)
347 {
348 $prev_month_day = $prev_month_days_in_month;
349 }
350 else
351 {
352 $prev_month_day = $dateday;
353 }
354
355 HTMLFORMAT_echo_noop_nl("<a href=\"index.php?sddt="
356 .
357 sprintf("%04d", $prev_month_year)
358 .
359 sprintf("%02d", $prev_month_month)
360 .
361 sprintf("%02d", $prev_month_day)
362 .
363 "\">-1 month</a>");
364 HTMLFORMAT_echo_pull_nl("</td>");
365 }
366 else
367 {
368 HTMLFORMAT_echo_push_nl("<td align=\"center\">");
369 HTMLFORMAT_echo_noop_nl(STRFUNC_nbsp_padding("-1 month"));
370 HTMLFORMAT_echo_pull_nl("</td>");
371 }
372
373 //-1 week text.
374 //-------------
375 //The previous week should be displayed unless we are already at the lower
376 //limit of navigation or viewability.
377 //
378 if ($diff_time_perm_array[1])
379 {
380 HTMLFORMAT_echo_push_nl("<td align=\"center\">");
381
382 DATEFUNC_one_week_ago($dateyear,
383 $datemonth,
384 $dateday,
385 $year_oneweekago,
386 $month_oneweekago,
387 $day_oneweekago);
388 HTMLFORMAT_echo_noop_nl("<a href=\"index.php?sddt="
389 .
390 sprintf("%04d", $year_oneweekago)
391 .
392 sprintf("%02d", $month_oneweekago)
393 .
394 sprintf("%02d", $day_oneweekago)
395 .
396 "\">-1 week</a>");
397 HTMLFORMAT_echo_pull_nl("</td>");
398 }
399 else
400 {
401 HTMLFORMAT_echo_push_nl("<td align=\"center\">");
402 HTMLFORMAT_echo_noop_nl(STRFUNC_nbsp_padding("-1 week"));
403 HTMLFORMAT_echo_pull_nl("</td>");
404 }
405
406 //-1 day text.
407 //------------
408 //The previous day should be displayed unless we are already at the lower
409 //limit or navigation or viewability.
410 //
411 if ($diff_time_perm_array[2])
412 {
413 HTMLFORMAT_echo_push_nl("<td align=\"center\">");
414
415 DATEFUNC_one_day_ago($dateyear,
416 $datemonth,
417 $dateday,
418 $year_onedayago,
419 $month_onedayago,
420 $day_onedayago);
421 HTMLFORMAT_echo_noop_nl("<a href=\"index.php?sddt="
422 .
423 sprintf("%04d", $year_onedayago)
424 .
425 sprintf("%02d", $month_onedayago)
426 .
427 sprintf("%02d", $day_onedayago)
428 .
429 "\">-1 day</a>");
430 HTMLFORMAT_echo_pull_nl("</td>");
431 }
432 else
433 {
434 HTMLFORMAT_echo_push_nl("<td align=\"center\">");
435 HTMLFORMAT_echo_noop_nl(STRFUNC_nbsp_padding("-1 day"));
436 HTMLFORMAT_echo_pull_nl("</td>");
437 }
438
439 //Previous Panel
440 //--------------
441 //Previous panel that can be displayed. A "panel" is a view of a certain
442 //set of hours.
443 //
444 if ($diff_time_perm_array[3])
445 {
446 //We can display the link. Calculate the previous panel.
447 if ($panel > 0)
448 {
449 //Simplest case: just back off the panel.
450 $prevpanel = $panel - 1;
451 $prevpanel_year = $dateyear;
452 $prevpanel_month = $datemonth;
453 $prevpanel_day = $dateday;
454 }
455 else
456 {
457 //The panel is the first one. To back off, we need to change
458 //the date backwards.
459 $prevpanel = ((int)(count($CONFIG_SCHED_DAY_PANELS) / 2)) - 1;
460 DATEFUNC_one_day_ago($dateyear,
461 $datemonth,
462 $dateday,
463 $prevpanel_year,
464 $prevpanel_month,
465 $prevpanel_day);
466 }
467
468 //We need to figure out for the panel what a good time to choose is
469 //that will guarantee that this panel is the right one to display.
470 $sdtim_string_prev_panel = TOD_panel_center_t4($prevpanel);
471
472 //Form the URL reference.
473 HTMLFORMAT_echo_push_nl("<td align=\"center\">");
474 HTMLFORMAT_echo_noop_nl("<a href=\"index.php?sddt="
475 .
476 sprintf("%04d", $prevpanel_year)
477 .
478 sprintf("%02d", $prevpanel_month)
479 .
480 sprintf("%02d", $prevpanel_day)
481 .
482 "&amp;sdtim="
483 .
484 $sdtim_string_prev_panel
485 .
486 "\">-hours</a>");
487 HTMLFORMAT_echo_pull_nl("</td>");
488 }
489 else
490 {
491 //We cannot display a link to the previous because it would violate
492 //calendaring or viewability rules. Just use a placeholder.
493 //
494 HTMLFORMAT_echo_push_nl("<td align=\"center\">");
495 HTMLFORMAT_echo_noop_nl(STRFUNC_nbsp_padding("-hours"));
496 HTMLFORMAT_echo_pull_nl("</td>");
497 }
498
499
500 //Today, now text.
501 HTMLFORMAT_echo_push_nl("<td align=\"center\">");
502 HTMLFORMAT_echo_noop_nl("<a href=\"index.php?todaynow=1\">Today, Now</a>");
503 HTMLFORMAT_echo_pull_nl("</td>");
504
505
506 //Next Panel
507 //----------
508 //Next panel that can be displayed. A "panel" is a view of a certain
509 //set of hours.
510 //
511 if ($diff_time_perm_array[4])
512 {
513 $npanels = ((int)(count($CONFIG_SCHED_DAY_PANELS) / 2));
514
515 //We can display the link. Calculate the next panel.
516 if ($panel < ($npanels - 1))
517 {
518 //Simplest case: just add to the panel.
519 $nextpanel = $panel + 1;
520 $nextpanel_year = $dateyear;
521 $nextpanel_month = $datemonth;
522 $nextpanel_day = $dateday;
523 }
524 else
525 {
526 //The panel is the last one. To add, we need to change
527 //the date forwards.
528 $nextpanel = 0;
529 DATEFUNC_one_day_future($dateyear,
530 $datemonth,
531 $dateday,
532 $nextpanel_year,
533 $nextpanel_month,
534 $nextpanel_day);
535 }
536
537 //We need to figure out for the panel what a good time to choose is
538 //that will guarantee that this panel is the right one to display.
539 $sdtim_string_next_panel = TOD_panel_center_t4($nextpanel);
540
541 //Form the URL reference.
542 HTMLFORMAT_echo_push_nl("<td align=\"center\">");
543 HTMLFORMAT_echo_noop_nl("<a href=\"index.php?sddt="
544 .
545 sprintf("%04d", $nextpanel_year)
546 .
547 sprintf("%02d", $nextpanel_month)
548 .
549 sprintf("%02d", $nextpanel_day)
550 .
551 "&amp;sdtim="
552 .
553 $sdtim_string_next_panel
554 .
555 "\">+hours</a>");
556 HTMLFORMAT_echo_pull_nl("</td>");
557 }
558 else
559 {
560 //We cannot display a link to the previous because it would violate
561 //calendaring or viewability rules. Just use a placeholder.
562 //
563 HTMLFORMAT_echo_push_nl("<td align=\"center\">");
564 HTMLFORMAT_echo_noop_nl(STRFUNC_nbsp_padding("+hours"));
565 HTMLFORMAT_echo_pull_nl("</td>");
566 }
567
568
569 //+1 day text.
570 //------------
571 //The next day should be displayed unless we are already at the upper
572 //limit of navigation or viewability.
573 //
574 if ($diff_time_perm_array[5])
575 {
576 HTMLFORMAT_echo_push_nl("<td align=\"center\">");
577
578 DATEFUNC_one_day_future($dateyear,
579 $datemonth,
580 $dateday,
581 $year_onedayfuture,
582 $month_onedayfuture,
583 $day_onedayfuture);
584 HTMLFORMAT_echo_noop_nl("<a href=\"index.php?sddt="
585 .
586 sprintf("%04d", $year_onedayfuture)
587 .
588 sprintf("%02d", $month_onedayfuture)
589 .
590 sprintf("%02d", $day_onedayfuture)
591 .
592 "\">+1 day</a>");
593 HTMLFORMAT_echo_pull_nl("</td>");
594 }
595 else
596 {
597 HTMLFORMAT_echo_push_nl("<td align=\"center\">");
598 HTMLFORMAT_echo_noop_nl(STRFUNC_nbsp_padding("+1 day"));
599 HTMLFORMAT_echo_pull_nl("</td>");
600 }
601
602 //+1 week text.
603 //-------------
604 //The next week should be displayed unless we are already at the upper
605 //limit of navigation or viewability.
606 //
607 if ($diff_time_perm_array[6])
608 {
609 HTMLFORMAT_echo_push_nl("<td align=\"center\">");
610
611 DATEFUNC_one_week_future($dateyear,
612 $datemonth,
613 $dateday,
614 $year_oneweekfuture,
615 $month_oneweekfuture,
616 $day_oneweekfuture);
617 HTMLFORMAT_echo_noop_nl("<a href=\"index.php?sddt="
618 .
619 sprintf("%04d", $year_oneweekfuture)
620 .
621 sprintf("%02d", $month_oneweekfuture)
622 .
623 sprintf("%02d", $day_oneweekfuture)
624 .
625 "\">+1 week</a>");
626 HTMLFORMAT_echo_pull_nl("</td>");
627 }
628 else
629 {
630 HTMLFORMAT_echo_push_nl("<td align=\"center\">");
631 HTMLFORMAT_echo_noop_nl(STRFUNC_nbsp_padding("+1 week"));
632 HTMLFORMAT_echo_pull_nl("</td>");
633 }
634
635
636 //+1 month text.
637 //--------------
638 //The next month should be displayed unless we are already at the upper limit
639 //of navigation.
640 //
641 DATEFUNC_offset_month($dateyear, $datemonth, 1, $next_month_year, $next_month_month, $next_month_result_code);
642
643 if ($diff_time_perm_array[7])
644 {
645 //We should display the next month's link.
646 //
647 HTMLFORMAT_echo_push_nl("<td align=\"center\">");
648 //
649 //We need to figure out what day of the month to use. There is the possibility
650 //that we are going forward to a month with fewer days.
651 //
652 $next_month_days_in_month = DATEFUNC_year_month_days($next_month_year, $next_month_month);
653
654 if ($dateday > $next_month_days_in_month)
655 {
656 $next_month_day = $next_month_days_in_month;
657 }
658 else
659 {
660 $next_month_day = $dateday;
661 }
662
663 HTMLFORMAT_echo_noop_nl("<a href=\"index.php?sddt="
664 .
665 sprintf("%04d", $next_month_year)
666 .
667 sprintf("%02d", $next_month_month)
668 .
669 sprintf("%02d", $next_month_day)
670 .
671 "\">+1 month</a>");
672 HTMLFORMAT_echo_pull_nl("</td>");
673 }
674 else
675 {
676 HTMLFORMAT_echo_push_nl("<td align=\"center\">");
677 HTMLFORMAT_echo_noop_nl(STRFUNC_nbsp_padding("+1 month"));
678 HTMLFORMAT_echo_pull_nl("</td>");
679 }
680
681
682 //Padding to balance the Go To text.
683 HTMLFORMAT_echo_push_nl("<td align=\"center\">");
684 HTMLFORMAT_echo_noop_nl("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
685 HTMLFORMAT_echo_pull_nl("</td>");
686
687 HTMLFORMAT_echo_pull_nl("</tr>");
688 HTMLFORMAT_echo_push_nl("<tr>");
689
690 //Date Displayed information.
691 HTMLFORMAT_echo_noop_nl("<td colspan=\"11\" align=\"center\"><b>Flight Schedule for "
692 .
693 DATEFUNC_stdlongdate_w_dow( $dateyear, $datemonth, $dateday)
694 . "</b></td>");
695
696 HTMLFORMAT_echo_pull_nl("</tr>");
697
698 //Table footer emitted unconditionally.
699 HTMLFORMAT_echo_pull_nl("</table>");
700 }
701 //--------------------------------------------------------------------------------
702 //Emits the default view page navigation bar.
703 //
704 function SCHEDVIEW_dayview_page_navigation_bar($userinfo, $sessioninfo, $dt8in, $t4in)
705 {
706 //Grab the menu entries.
707 if ($sessioninfo === FALSE)
708 $menu_choices = MENU_menu_gen($userinfo, 0, $dt8in, $t4in, "index.php");
709 else
710 $menu_choices = MENU_menu_gen($userinfo, $sessioninfo["menulvl"], $dt8in, $t4in, "index.php");
711
712 $n = count($menu_choices);
713
714 for ($i=0; $i<$n; $i+=3)
715 {
716 if ($menu_choices[$i] == "H")
717 {
718 HTMLFORMAT_echo_noop_nl("&nbsp;&nbsp;<b>" . $menu_choices[$i+1] . "</b>&nbsp;&nbsp;<br>");
719 }
720 else
721 {
722 HTMLFORMAT_echo_noop_nl("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href=\""
723 . $menu_choices[$i+2] . "\">" . $menu_choices[$i+1] . "</a>&nbsp;&nbsp;<br>");
724 }
725 }
726 }
727 //
728 //
729 //----------------------------------------------------------------------------------------------------
730 //Given the start hour and end-hour for a panel, calculates the number of time columns involved.
731 //For example, if the start hour is 8 and the end hour is 10, the columns are:
732 // a) 8:00 - 8:30
733 // b) 8:30 - 9:00
734 // c) 9:00 - 9:30
735 // d) 9:30 - 10:00
736 // e)10:00 - 10:30
737 // f)10:30 - 11:00
738 //
739 function SCHEDVIEW_panel_n_time_columns($start_hour_in, $end_hour_in)
740 {
741 $rv = ($end_hour_in - $start_hour_in + 1) * 2;
742
743 return($rv);
744 }
745 //
746 //----------------------------------------------------------------------------------------------------
747 //Decorates a list of reservation information with additional fields that help with
748 //quickness. The fields are:
749 //
750 // emitted
751 // Set to 0. Will be used later as the reservation is displayed.
752 //
753 // finsttimefloor
754 // The reservation stime start (for a flight instructor), or the left panel time if
755 // the time is clipped.
756 //
757 // finsttimefloorint
758 // An integer corresponding to the first half-hour time slot of the appointment (clipped).
759 // Zero if not applicable.
760 //
761 // finsttimeceiling
762 // The reservation stime end (for a flight instructor), or the right panel time if
763 // the time is clipped.
764 //
765 // finsttimeceilingint
766 // An integer corresponding to one past the last half-hour time slot of the appointment (clipped).
767 // Zero if not applicable. This may be 48.
768 //
769 // finsttimeleftclip
770 // 1 if the displayed flight instructor appt left time was clipped on the left, or 0
771 // if not.
772 //
773 // finsttimerightclip
774 // 1 if the displayed flight instructor appt right time was clipped on the right, or 0
775 // if not.
776 //
777 // acftsimtimefloor
778 // The reservation stime start (for an aircraft or simulator), or the left panel time if
779 // the time is clipped.
780 //
781 // acftsimtimefloorint
782 // An integer corresponding to the first half-hour time slot of the appointment (clipped).
783 // Zero if not applicable.
784 //
785 // acftsimtimeceiling
786 // The reservation stime end (for an aircraft or simulator), or the right panel time if
787 // the time is clipped.
788 //
789 // acftsimtimeceilingint
790 // An integer corresponding to one past the last half-hour time slot of the appointment (clipped).
791 // Zero if not applicable.
792 //
793 // acftsimtimeleftclip
794 // 1 if the displayed aircraft or simulator appt left time was clipped on the left, or 0
795 // if not.
796 //
797 // acftsimttimerightclip
798 // 1 if the displayed aircraft or simulator right time was clipped on the right, or 0
799 // if not.
800 //
801 function SCHEDVIEW_resv_list_decorate(&$flight_inst_data_array, $panel_left_stime, $panel_right_stime)
802 {
803 //Return if there is an empty array.
804 //
805 if ($flight_inst_data_array === FALSE)
806 return;
807
808 $n = count($flight_inst_data_array);
809 for ($i=0; $i<$n; $i++)
810 {
811 //---------------------------------------------------------------------------------
812 //Emitted -- whether the reservation has been output yet.
813 //---------------------------------------------------------------------------------
814 $flight_inst_data_array[$i]["emitted"] = 0;
815 //
816 //---------------------------------------------------------------------------------
817 //Flight instructor left.
818 //---------------------------------------------------------------------------------
819 if (strlen($flight_inst_data_array[$i]["finsttimestart"]))
820 {
821 //Do the clipping, if applicable.
822 if (strcmp($flight_inst_data_array[$i]["finsttimestart"], $panel_left_stime) < 0)
823 {
824 //Clipping is appropriate.
825 $flight_inst_data_array[$i]["finsttimefloor"] = $panel_left_stime;
826 $flight_inst_data_array[$i]["finsttimefloorint"] = STIME_T4_lb_int($panel_left_stime);
827 $flight_inst_data_array[$i]["finsttimeleftclip"] = 1;
828 }
829 else
830 {
831 //Clipping is not appropriate.
832 $flight_inst_data_array[$i]["finsttimefloor"] = $flight_inst_data_array[$i]["finsttimestart"];
833 $flight_inst_data_array[$i]["finsttimefloorint"] = STIME_T4_lb_int($flight_inst_data_array[$i]["finsttimestart"]);
834 $flight_inst_data_array[$i]["finsttimeleftclip"] = 0;
835 }
836 }
837 else
838 {
839 //Floor and floor int are meaningless.
840 $flight_inst_data_array[$i]["finsttimefloor"] = "";
841 $flight_inst_data_array[$i]["finsttimefloorint"] = 0;
842 $flight_inst_data_array[$i]["finsttimeleftclip"] = 0;
843 }
844
845 //---------------------------------------------------------------------------------
846 //Flight instructor right.
847 //---------------------------------------------------------------------------------
848 if (strlen($flight_inst_data_array[$i]["finsttimeend"]))
849 {
850 //Do the clipping, if applicable.
851 if (strcmp($flight_inst_data_array[$i]["finsttimeend"], $panel_right_stime) > 0)
852 {
853 //Clipping is appropriate.
854 $flight_inst_data_array[$i]["finsttimeceiling"] = $panel_right_stime;
855 $flight_inst_data_array[$i]["finsttimeceilingint"] = STIME_T4_lb_int($panel_right_stime);
856
857 //Adjust for a clip to midnight.
858 if ($flight_inst_data_array[$i]["finsttimeceilingint"] == 0)
859 $flight_inst_data_array[$i]["finsttimeceilingint"] = 48;
860
861 $flight_inst_data_array[$i]["finsttimerightclip"] = 1;
862 }
863 else
864 {
865 //Clipping is not appropriate.
866 $flight_inst_data_array[$i]["finsttimeceiling"] = $flight_inst_data_array[$i]["finsttimeend"];
867 $flight_inst_data_array[$i]["finsttimeceilingint"] = STIME_T4_lb_int($flight_inst_data_array[$i]["finsttimeend"]);
868
869 //Adjust for a reservation that ends at midnight.
870 if ($flight_inst_data_array[$i]["finsttimeceilingint"] == 0)
871 $flight_inst_data_array[$i]["finsttimeceilingint"] = 48;
872
873 $flight_inst_data_array[$i]["finsttimerightclip"] = 0;
874 }
875 }
876 else
877 {
878 //Floor and floor int are meaningless.
879 $flight_inst_data_array[$i]["finsttimeceiling"] = "";
880 $flight_inst_data_array[$i]["finsttimeceilingint"] = 0;
881 $flight_inst_data_array[$i]["finsttimerightclip"] = 0;
882 }
883
884 //---------------------------------------------------------------------------------
885 //Aircraft/simulator left.
886 //---------------------------------------------------------------------------------
887 if (strlen($flight_inst_data_array[$i]["acftsimtimestart"]))
888 {
889 //Do the clipping, if applicable.
890 if (strcmp($flight_inst_data_array[$i]["acftsimtimestart"], $panel_left_stime) < 0)
891 {
892 //Clipping is appropriate.
893 $flight_inst_data_array[$i]["acftsimtimefloor"] = $panel_left_stime;
894 $flight_inst_data_array[$i]["acftsimtimefloorint"] = STIME_T4_lb_int($panel_left_stime);
895 $flight_inst_data_array[$i]["acftsimtimeleftclip"] = 1;
896 }
897 else
898 {
899 //Clipping is not appropriate.
900 $flight_inst_data_array[$i]["acftsimtimefloor"] = $flight_inst_data_array[$i]["acftsimtimestart"];
901 $flight_inst_data_array[$i]["acftsimtimefloorint"] = STIME_T4_lb_int($flight_inst_data_array[$i]["acftsimtimestart"]);
902 $flight_inst_data_array[$i]["acftsimtimeleftclip"] = 0;
903 }
904 }
905 else
906 {
907 //Floor and floor int are meaningless.
908 $flight_inst_data_array[$i]["acftsimtimefloor"] = "";
909 $flight_inst_data_array[$i]["acftsimtimefloorint"] = 0;
910 $flight_inst_data_array[$i]["acftsimtimeleftclip"] = 0;
911 }
912
913 //---------------------------------------------------------------------------------
914 //Aircraft/simulator right.
915 //---------------------------------------------------------------------------------
916 if (strlen($flight_inst_data_array[$i]["acftsimtimeend"]))
917 {
918 //Do the clipping, if applicable.
919 if (strcmp($flight_inst_data_array[$i]["acftsimtimeend"], $panel_right_stime) > 0)
920 {
921 //Clipping is appropriate.
922 $flight_inst_data_array[$i]["acftsimtimeceiling"] = $panel_right_stime;
923 $flight_inst_data_array[$i]["acftsimtimeceilingint"] = STIME_T4_lb_int($panel_right_stime);
924
925 //Adjust for a clip to midnight.
926 if ($flight_inst_data_array[$i]["acftsimtimeceilingint"] == 0)
927 $flight_inst_data_array[$i]["acftsimtimeceilingint"] = 48;
928
929 $flight_inst_data_array[$i]["acftsimtimerightclip"] = 1;
930 }
931 else
932 {
933 //Clipping is not appropriate.
934 $flight_inst_data_array[$i]["acftsimtimeceiling"] = $flight_inst_data_array[$i]["acftsimtimeend"];
935 $flight_inst_data_array[$i]["acftsimtimeceilingint"] = STIME_T4_lb_int($flight_inst_data_array[$i]["acftsimtimeend"]);
936
937 //Adjust for a reservation that ends at midnight.
938 if ($flight_inst_data_array[$i]["acftsimtimeceilingint"] == 0)
939 $flight_inst_data_array[$i]["acftsimtimeceilingint"] = 48;
940
941 $flight_inst_data_array[$i]["acftsimtimerightclip"] = 0;
942 }
943 }
944 else
945 {
946 //Floor and floor int are meaningless.
947 $flight_inst_data_array[$i]["acftsimtimeceiling"] = "";
948 $flight_inst_data_array[$i]["acftsimtimeceilingint"] = 0;
949 $flight_inst_data_array[$i]["acftsimtimerightclip"] = 0;
950 }
951 }
952 }
953 //
954 //----------------------------------------------------------------------------------------------------
955 //Returns TRUE if the reservation passed has time intersection with at least one element of the
956 //array for the aircraft or simulator time, or FALSE if not.
957 //
958 function SCHEDVIEW_resv_finst_array_intersection($array_in, $element_in)
959 {
960 //echo "<pre>\n----------\nIn Intersection Func\n---------\n";
961 //echo "Array in:\n---------";
962 //print_r($array_in);
963 //echo "\nElement in:\n---------";
964 //print_r($element_in);
965 //echo "\n----------\n";
966
967 if (($array_in === FALSE) || ($element_in === FALSE))
968 {
969 //echo "\nReturning FALSE\n---------\n</pre>\n";
970 return(FALSE);
971 }
972
973 for ($i = 0; $i < count($array_in); $i++)
974 {
975 if (
976 (strcmp($array_in[$i]["finsttimestart"], $element_in["finsttimeend"]) < 0)
977 &&
978 (strcmp($array_in[$i]["finsttimeend"], $element_in["finsttimestart"]) > 0)
979 )
980 //echo "\nReturning TRUE\n---------\n</pre>\n";
981 return(TRUE);
982 }
983
984 //No collision found, return FALSE.
985 //echo "\nReturning FALSE\n---------\n</pre>\n";
986 return(FALSE);
987 }
988 //----------------------------------------------------------------------------------------------------
989 //Returns TRUE if the reservation passed has time intersection with at least one element of the
990 //array for the aircraft or simulator time, or FALSE if not.
991 //
992 function SCHEDVIEW_resv_actfsim_array_intersection($array_in, $element_in)
993 {
994 //echo "<pre>\n----------\nIn Intersection Func\n---------\n";
995 //echo "Array in:\n---------";
996 //print_r($array_in);
997 //echo "\nElement in:\n---------";
998 //print_r($element_in);
999 //echo "\n----------\n";
1000
1001 if (($array_in === FALSE) || ($element_in === FALSE))
1002 {
1003 //echo "\nReturning FALSE\n---------\n</pre>\n";
1004 return(FALSE);
1005 }
1006
1007 for ($i = 0; $i < count($array_in); $i++)
1008 {
1009 if (
1010 (strcmp($array_in[$i]["acftsimtimestart"], $element_in["acftsimtimeend"]) < 0)
1011 &&
1012 (strcmp($array_in[$i]["acftsimtimeend"], $element_in["acftsimtimestart"]) > 0)
1013 )
1014 //echo "\nReturning TRUE\n---------\n</pre>\n";
1015 return(TRUE);
1016 }
1017
1018 //No collision found, return FALSE.
1019 //echo "\nReturning FALSE\n---------\n</pre>\n";
1020 return(FALSE);
1021 }
1022 //----------------------------------------------------------------------------------------------------
1023 //Generates HTML lines corresponding to the left resource area description area. This will generally
1024 //be a single <td> cell with a rowspan potentially > 1.
1025 //
1026 //The returned value is an array of lines.
1027 //
1028 function SCHEDVIEW_do_left_resource_title_area( $userinfo_in,
1029 $rscs_rec_in,
1030 $resv_recs_in,
1031 $panel_low_hour_in,
1032 $panel_high_hour_in,
1033 $resourcecolumnwidth_in,
1034 $schedcolumnwidth_in,
1035 $rowspan_in,
1036 &$queued_html_lines)
1037 {
1038 $queued_html_lines[] = "<td colspan=\"1\" rowspan=\""
1039 . $rowspan_in
1040 . "\" width=\"" . $resourcecolumnwidth_in . "%\" nowrap bgcolor=\"#"
1041 . CONFIG_SCHED_COLOR_DSMAT_THEAD
1042 . "\" onClick=\"javascript:window.location='http://www.pageresource.com/jscript/newpage.htm';\" "
1043 . "onmouseover=\"javascript:window.status='Comment: "
1044 . STRFUNC_js_escape_sglquote_notrunc($rscs_rec_in["longdesc"])
1045 . "';\" onmouseout=\"javascript:window.status='';\" "
1046 . "title=\""
1047 . STRFUNC_html_title_escape_dblquote_notrunc($rscs_rec_in["longdesc"])
1048 . "\""
1049 . ">";
1050 $queued_html_lines[] = "&nbsp;"
1051 . $rscs_rec_in["shortdesc"]
1052 . "&nbsp;";
1053 $queued_html_lines[] = "</td>";
1054
1055 //echo "<pre>\n";
1056 //echo "In SCHEDVIEW_do_left_resource_title_area() ...\n";
1057 //print_r($queued_html_lines2);
1058 //echo "----------------------------\n</pre>\n";
1059 }
1060 //
1061 //----------------------------------------------------------------------------------------------------
1062 //Does the terminator (white area) bar beneath the last row of banner, active, and/or standby
1063 //reservations. The item returned is an array of HTML lines. This function will always produce
1064 //an array of lines, as it is always possible to produce the terminator area.
1065 //
1066 function SCHEDVIEW_form_resource_scheduling_area_terminator_bar( $userinfo_in,
1067 $rscs_rec_in,
1068 $resv_recs_in,
1069 $panel_low_hour_in,
1070 $panel_high_hour_in,
1071 $resourcecolumnwidth_in,
1072 $schedcolumnwidth_in,
1073 &$sched_right_table_rows,
1074 &$queued_html_lines)
1075 {
1076 for ($i=$panel_low_hour_in * 2; $i<=(($panel_high_hour_in * 2) + 1); $i++)
1077 {
1078 $queued_html_lines[] = "<td align=\"center\" width=\""
1079 . $schedcolumnwidth_in . "%\" bgcolor=\"#"
1080 . CONFIG_SCHED_COLOR_DSMAT_RIDLE
1081 . "\" onClick=\"window.location='http://www.google.com?testpar=30'\">";
1082 $queued_html_lines[] = "&nbsp;";
1083 $queued_html_lines[] = "</td>";
1084 }
1085
1086 //We've added a full row.
1087 $sched_right_table_rows++;
1088 }
1089 //
1090 //----------------------------------------------------------------------------------------------------
1091 //Does the rows corresponding to the banner reservations for a flight instructor.
1092 //
1093 function SCHEDVIEW_form_resource_scheduling_area_finst_banner( $userinfo_in,
1094 $rscs_rec_in,
1095 $banner_reservations_in,
1096 $panel_low_hour_in,
1097 $panel_high_hour_in,
1098 $resourcecolumnwidth_in,
1099 $schedcolumnwidth_in,
1100 $can_view_banner_reservations_in,
1101 &$sched_right_table_rows,
1102 &$queued_html_rows)
1103 {
1104 $done = FALSE;
1105 $grabpoint = 0;
1106 $panel_low_hour_in_int = $panel_low_hour_in * 2;
1107 $panel_high_hour_in_int_limit = ($panel_high_hour_in + 1) * 2;
1108
1109 while (!$done)
1110 {
1111 //Due to the loop, need to unset the display set to keep it from accumulating too many
1112 //elements.
1113 if (isset($display_set))
1114 unset($display_set);
1115
1116 //Grab one element. This is our trial set to start with.
1117 $display_set[] = $banner_reservations_in[$grabpoint];
1118
1119 //Next grabpoint.
1120 $grabpoint++;
1121
1122 //Keep on grabbing until there is a set intersection or we're out of things to grab.
1123 while (
1124 ($grabpoint < count($banner_reservations_in))
1125 &&
1126 (! SCHEDVIEW_resv_finst_array_intersection($display_set, $banner_reservations_in[$grabpoint]))
1127 )
1128 {
1129 $display_set[] = $banner_reservations_in[$grabpoint];
1130 $grabpoint ++;
1131 }
1132
1133 //If we can't go further grabbing, we're done.
1134 if ($grabpoint >= count($banner_reservations_in))
1135 $done = TRUE;
1136
1137 //Display the set that was collected for debugging, if necessary.
1138 //echo "<pre>\n----------\nDisplay Set\n----------\n";
1139 //print_r($display_set);
1140 //echo "\n--------\n";
1141
1142 //Our display set now contains a set of records to display. We know there is at least one,
1143 //we know the times don't overlap, and we know that these are in ascending order of start time
1144 //(due to the SQL query). Therefore, we can proceed in order.
1145 $cur_output_time_int = $panel_low_hour_in_int;
1146 $cur_display_record = 0;
1147 //$panel_high_hour_in_int_limit = ($panel_high_hour_in + 1) * 2;
1148
1149 while ($cur_display_record < count($display_set))
1150 {
1151 //Space out the blank cells until the first reservation or next reservation.
1152 while($cur_output_time_int < $display_set[$cur_display_record]["finsttimefloorint"])
1153 {
1154 $html_lines[] = "<td>&nbsp;</td>";
1155 $cur_output_time_int ++;
1156 }
1157
1158 //Get the text that should be displayed for the reservation.
1159 if ($userinfo_in === FALSE)
1160 {
1161 //echo " Clause 1 ";
1162 $box_string = "&nbsp;";
1163 }
1164 else
1165 {
1166 //Try to get the user name.
1167 //
1168 //echo "\n<pre>\n";
1169 //print_r($display_set[$cur_display_record]);
1170 //print_r($display_set[$cur_display_record]["useridx"]);
1171 //echo "\n</pre>\n";
1172
1173 if ($display_set[$cur_display_record]["useridx"] > 0)
1174 {
1175 $temp_user_info = USRS_retrieve_by_idx($display_set[$cur_display_record]["useridx"]);
1176 if ($temp_user_info === FALSE)
1177 {
1178 //echo " Clause 2 ";
1179 $box_string = "&nbsp;";
1180 }
1181 else
1182 {
1183 //echo " Clause 3 ";
1184 $box_string = $temp_user_info["lname"]
1185 .
1186 " ("
1187 .
1188 (string)($display_set[$cur_display_record]["idx"])
1189 .
1190 ")";
1191 }
1192 }
1193 else
1194 {
1195 //echo " Clause 4 ";
1196 $box_string = "&nbsp;";
1197 }
1198 }
1199
1200 //Spit the reservation.
1201 $html_lines[] = "<td colspan=\""
1202 . ($display_set[$cur_display_record]["finsttimeceilingint"] - $display_set[$cur_display_record]["finsttimefloorint"])
1203 . "\" bgcolor=\""
1204 . CONFIG_SCHED_COLOR_DSMAT_RBANN
1205 . "\" align=\"center\">"
1206 . $box_string
1207 . "</td>";
1208
1209 //This takes the time forward.
1210 $cur_output_time_int = $display_set[$cur_display_record]["finsttimeceilingint"];
1211
1212 $cur_display_record ++;
1213 }
1214
1215 //Do any remaining cells at the end.
1216 while($cur_output_time_int < $panel_high_hour_in_int_limit)
1217 {
1218 $html_lines[] = "<td>&nbsp;</td>";
1219 $cur_output_time_int ++;
1220 }
1221
1222
1223 //The lines are formed. Add the row.
1224 $queued_html_rows[] = $html_lines;
1225 unset($html_lines);
1226 $sched_right_table_rows++;
1227 }
1228 }
1229 //
1230 //----------------------------------------------------------------------------------------------------
1231 //Does the rows corresponding to the active reservations for a flight instructor.
1232 //
1233 function SCHEDVIEW_form_resource_scheduling_area_finst_active( $userinfo_in,
1234 $rscs_rec_in,
1235 $active_reservations_in,
1236 $panel_low_hour_in,
1237 $panel_high_hour_in,
1238 $resourcecolumnwidth_in,
1239 $schedcolumnwidth_in,
1240 $can_view_banner_reservations_in,
1241 &$sched_right_table_rows,
1242 &$queued_html_rows)
1243 {
1244 $done = FALSE;
1245 $grabpoint = 0;
1246 $panel_low_hour_in_int = $panel_low_hour_in * 2;
1247 $panel_high_hour_in_int_limit = ($panel_high_hour_in + 1) * 2;
1248
1249 while (!$done)
1250 {
1251 //Due to the loop, need to unset the display set to keep it from accumulating too many
1252 //elements.
1253 if (isset($display_set))
1254 unset($display_set);
1255
1256 //Grab one element. This is our trial set to start with.
1257 $display_set[] = $active_reservations_in[$grabpoint];
1258
1259 //Next grabpoint.
1260 $grabpoint++;
1261
1262 //Keep on grabbing until there is a set intersection or we're out of things to grab.
1263 while (
1264 ($grabpoint < count($active_reservations_in))
1265 &&
1266 (! SCHEDVIEW_resv_finst_array_intersection($display_set, $active_reservations_in[$grabpoint]))
1267 )
1268 {
1269 $display_set[] = $active_reservations_in[$grabpoint];
1270 $grabpoint ++;
1271 }
1272
1273 //If we can't go further grabbing, we're done.
1274 if ($grabpoint >= count($active_reservations_in))
1275 $done = TRUE;
1276
1277 //Display the set that was collected for debugging, if necessary.
1278 //echo "<pre>\n----------\nDisplay Set\n----------\n";
1279 //print_r($display_set);
1280 //echo "\n--------\n";
1281
1282 //Our display set now contains a set of records to display. We know there is at least one,
1283 //we know the times don't overlap, and we know that these are in ascending order of start time
1284 //(due to the SQL query). Therefore, we can proceed in order.
1285 $cur_output_time_int = $panel_low_hour_in_int;
1286 $cur_display_record = 0;
1287 //$panel_high_hour_in_int_limit = ($panel_high_hour_in + 1) * 2;
1288
1289 while ($cur_display_record < count($display_set))
1290 {
1291 //Space out the blank cells until the first reservation or next reservation.
1292 while($cur_output_time_int < $display_set[$cur_display_record]["finsttimefloorint"])
1293 {
1294 $html_lines[] = "<td>&nbsp;</td>";
1295 $cur_output_time_int ++;
1296 }
1297
1298 //Get the text that should be displayed for the reservation.
1299 if ($userinfo_in === FALSE)
1300 {
1301 //echo " Clause 1 ";
1302 $box_string = "&nbsp;";
1303 }
1304 else
1305 {
1306 //Try to get the user name.
1307 //
1308 //echo "\n<pre>\n";
1309 //print_r($display_set[$cur_display_record]);
1310 //print_r($display_set[$cur_display_record]["useridx"]);
1311 //echo "\n</pre>\n";
1312
1313 if ($display_set[$cur_display_record]["useridx"] > 0)
1314 {
1315 $temp_user_info = USRS_retrieve_by_idx($display_set[$cur_display_record]["useridx"]);
1316 if ($temp_user_info === FALSE)
1317 {
1318 //echo " Clause 2 ";
1319 $box_string = "&nbsp;";
1320 }
1321 else
1322 {
1323 //echo " Clause 3 ";
1324 $box_string = $temp_user_info["lname"]
1325 .
1326 " ("
1327 .
1328 (string)($display_set[$cur_display_record]["idx"])
1329 .
1330 ")";
1331 }
1332 }
1333 else
1334 {
1335 //echo " Clause 4 ";
1336 $box_string = "&nbsp;";
1337 }
1338 }
1339
1340 //Spit the reservation.
1341 $html_lines[] = "<td colspan=\""
1342 . ($display_set[$cur_display_record]["finsttimeceilingint"] - $display_set[$cur_display_record]["finsttimefloorint"])
1343 . "\" bgcolor=\""
1344 . CONFIG_SCHED_COLOR_DSMAT_RACTV
1345 . "\" align=\"center\">"
1346 . $box_string
1347 . "</td>";
1348
1349 //This takes the time forward.
1350 $cur_output_time_int = $display_set[$cur_display_record]["finsttimeceilingint"];
1351
1352 $cur_display_record ++;
1353 }
1354
1355 //Do any remaining cells at the end.
1356 while($cur_output_time_int < $panel_high_hour_in_int_limit)
1357 {
1358 $html_lines[] = "<td>&nbsp;</td>";
1359 $cur_output_time_int ++;
1360 }
1361
1362
1363 //The lines are formed. Add the row.
1364 $queued_html_rows[] = $html_lines;
1365 unset($html_lines);
1366 $sched_right_table_rows++;
1367 }
1368 }
1369 //
1370 //----------------------------------------------------------------------------------------------------
1371 //Does the rows corresponding to the standby reservations for a flight instructor.
1372 //
1373 function SCHEDVIEW_form_resource_scheduling_area_finst_standby( $userinfo_in,
1374 $rscs_rec_in,
1375 $standby_reservations_in,
1376 $panel_low_hour_in,
1377 $panel_high_hour_in,
1378 $resourcecolumnwidth_in,
1379 $schedcolumnwidth_in,
1380 $can_view_banner_reservations_in,
1381 &$sched_right_table_rows,
1382 &$queued_html_rows)
1383 {
1384 $done = FALSE;
1385 $grabpoint = 0;
1386 $panel_low_hour_in_int = $panel_low_hour_in * 2;
1387 $panel_high_hour_in_int_limit = ($panel_high_hour_in + 1) * 2;
1388
1389 while (!$done)
1390 {
1391 //Due to the loop, need to unset the display set to keep it from accumulating too many
1392 //elements.
1393 if (isset($display_set))
1394 unset($display_set);
1395
1396 //Grab one element. This is our trial set to start with.
1397 $display_set[] = $standby_reservations_in[$grabpoint];
1398
1399 //Next grabpoint.
1400 $grabpoint++;
1401
1402 //Keep on grabbing until there is a set intersection or we're out of things to grab.
1403 while (
1404 ($grabpoint < count($standby_reservations_in))
1405 &&
1406 (! SCHEDVIEW_resv_finst_array_intersection($display_set, $standby_reservations_in[$grabpoint]))
1407 )
1408 {
1409 $display_set[] = $standby_reservations_in[$grabpoint];
1410 $grabpoint ++;
1411 }
1412
1413 //If we can't go further grabbing, we're done.
1414 if ($grabpoint >= count($standby_reservations_in))
1415 $done = TRUE;
1416
1417 //Display the set that was collected for debugging, if necessary.
1418 //echo "<pre>\n----------\nDisplay Set\n----------\n";
1419 //print_r($display_set);
1420 //echo "\n--------\n";
1421
1422 //Our display set now contains a set of records to display. We know there is at least one,
1423 //we know the times don't overlap, and we know that these are in ascending order of start time
1424 //(due to the SQL query). Therefore, we can proceed in order.
1425 $cur_output_time_int = $panel_low_hour_in_int;
1426 $cur_display_record = 0;
1427 //$panel_high_hour_in_int_limit = ($panel_high_hour_in + 1) * 2;
1428
1429 while ($cur_display_record < count($display_set))
1430 {
1431 //Space out the blank cells until the first reservation or next reservation.
1432 while($cur_output_time_int < $display_set[$cur_display_record]["finsttimefloorint"])
1433 {
1434 $html_lines[] = "<td>&nbsp;</td>";
1435 $cur_output_time_int ++;
1436 }
1437
1438 //Get the text that should be displayed for the reservation.
1439 if ($userinfo_in === FALSE)
1440 {
1441 //echo " Clause 1 ";
1442 $box_string = "&nbsp;";
1443 }
1444 else
1445 {
1446 //Try to get the user name.
1447 //
1448 //echo "\n<pre>\n";
1449 //print_r($display_set[$cur_display_record]);
1450 //print_r($display_set[$cur_display_record]["useridx"]);
1451 //echo "\n</pre>\n";
1452
1453 if ($display_set[$cur_display_record]["useridx"] > 0)
1454 {
1455 $temp_user_info = USRS_retrieve_by_idx($display_set[$cur_display_record]["useridx"]);
1456 if ($temp_user_info === FALSE)
1457 {
1458 //echo " Clause 2 ";
1459 $box_string = "&nbsp;";
1460 }
1461 else
1462 {
1463 //echo " Clause 3 ";
1464 $box_string = $temp_user_info["lname"]
1465 .
1466 " ("
1467 .
1468 (string)($display_set[$cur_display_record]["idx"])
1469 .
1470 ")";
1471 }
1472 }
1473 else
1474 {
1475 //echo " Clause 4 ";
1476 $box_string = "&nbsp;";
1477 }
1478 }
1479
1480 //Spit the reservation.
1481 $html_lines[] = "<td colspan=\""
1482 . ($display_set[$cur_display_record]["finsttimeceilingint"] - $display_set[$cur_display_record]["finsttimefloorint"])
1483 . "\" bgcolor=\""
1484 . CONFIG_SCHED_COLOR_DSMAT_RSTBY
1485 . "\" align=\"center\">"
1486 . $box_string
1487 . "</td>";
1488
1489 //This takes the time forward.
1490 $cur_output_time_int = $display_set[$cur_display_record]["finsttimeceilingint"];
1491
1492 $cur_display_record ++;
1493 }
1494
1495 //Do any remaining cells at the end.
1496 while($cur_output_time_int < $panel_high_hour_in_int_limit)
1497 {
1498 $html_lines[] = "<td>&nbsp;</td>";
1499 $cur_output_time_int ++;
1500 }
1501
1502
1503 //The lines are formed. Add the row.
1504 $queued_html_rows[] = $html_lines;
1505 unset($html_lines);
1506 $sched_right_table_rows++;
1507 }
1508 }
1509 //
1510 //----------------------------------------------------------------------------------------------------
1511 //Does the resource scheduling area for an individual flight instructor.
1512 //
1513 function SCHEDVIEW_form_resource_scheduling_area_finst( $userinfo_in,
1514 $rscs_rec_in,
1515 $resv_recs_in,
1516 $panel_low_hour_in,
1517 $panel_high_hour_in,
1518 $resourcecolumnwidth_in,
1519 $schedcolumnwidth_in,
1520 $can_view_banner_reservations_in,
1521 &$sched_right_table_rows,
1522 &$queued_html_rows)
1523 {
1524 if ($resv_recs_in !== FALSE) //Can't parse reservations if none there.
1525 {
1526 //Identify the banner reservations, active reservations, and standby reservations.
1527 //
1528 $banner_first = -1;
1529 $banner_last = -1;
1530 $active_first = -1;
1531 $active_last = -1;
1532 $standby_first = -1;
1533 $standby_last = -1;
1534
1535 $n = count($resv_recs_in);
1536 for ($i=0; $i<$n; $i++)
1537 {
1538 if ($resv_recs_in[$i]["type"] == RESV_TYPE_BANNER)
1539 {
1540 if ($banner_first == -1)
1541 $banner_first = $i;
1542 $banner_last = $i;
1543 }
1544
1545 if ($resv_recs_in[$i]["type"] == RESV_TYPE_ACTIVE)
1546 {
1547 if ($active_first == -1)
1548 $active_first = $i;
1549 $active_last = $i;
1550 }
1551
1552 if ($resv_recs_in[$i]["type"] == RESV_TYPE_STANDBY)
1553 {
1554 if ($standby_first == -1)
1555 $standby_first = $i;
1556 $standby_last = $i;
1557 }
1558 }
1559 //
1560 //-----------------------------------------------------------------------------
1561 //Do the banner reservations, if there are any, and if it is appropriate.
1562 //
1563 if (($banner_first != -1) && ($can_view_banner_reservations_in))
1564 {
1565 //Extract the records.
1566 $banner_reservations = array_slice ($resv_recs_in,
1567 $banner_first,
1568 $banner_last - $banner_first + 1);
1569
1570 //echo "<pre>\n----------\nBanner Reservations\n----------\n";
1571 //print_r($banner_reservations);
1572 //echo "\n---------\n</pre>\n";
1573
1574 SCHEDVIEW_form_resource_scheduling_area_finst_banner( $userinfo_in,
1575 $rscs_rec_in,
1576 $banner_reservations,
1577 $panel_low_hour_in,
1578 $panel_high_hour_in,
1579 $resourcecolumnwidth_in,
1580 $schedcolumnwidth_in,
1581 $can_view_banner_reservations_in,
1582 $sched_right_table_rows,
1583 $queued_html_rows);
1584 }
1585 //
1586 //-----------------------------------------------------------------------------
1587 //Do the active reservations, if there are any.
1588 //
1589 if ($active_first != -1)
1590 {
1591 //Extract the records.
1592 $active_reservations = array_slice ($resv_recs_in,
1593 $active_first,
1594 $active_last - $active_first + 1);
1595
1596 //echo "<pre>\n----------\nActive Reservations\n----------\n";
1597 //print_r($active_reservations);
1598 //echo "\n---------\n</pre>\n";
1599
1600 SCHEDVIEW_form_resource_scheduling_area_finst_active( $userinfo_in,
1601 $rscs_rec_in,
1602 $active_reservations,
1603 $panel_low_hour_in,
1604 $panel_high_hour_in,
1605 $resourcecolumnwidth_in,
1606 $schedcolumnwidth_in,
1607 $can_view_banner_reservations_in,
1608 $sched_right_table_rows,
1609 $queued_html_rows);
1610 }
1611 //
1612 //-----------------------------------------------------------------------------
1613 //Do the standby reservations, if there are any.
1614 //
1615 if ($standby_first != -1)
1616 {
1617 //Extract the records.
1618 $standby_reservations = array_slice ($resv_recs_in,
1619 $standby_first,
1620 $standby_last - $standby_first + 1);
1621
1622 //echo "<pre>\n----------\nStandby Reservations\n----------\n";
1623 //print_r($standby_reservations);
1624 //echo "\n---------\n</pre>\n";
1625
1626 SCHEDVIEW_form_resource_scheduling_area_finst_standby( $userinfo_in,
1627 $rscs_rec_in,
1628 $standby_reservations,
1629 $panel_low_hour_in,
1630 $panel_high_hour_in,
1631 $resourcecolumnwidth_in,
1632 $schedcolumnwidth_in,
1633 $can_view_banner_reservations_in,
1634 $sched_right_table_rows,
1635 $queued_html_rows);
1636 }
1637 //
1638 }
1639
1640 SCHEDVIEW_form_resource_scheduling_area_terminator_bar($userinfo_in,
1641 $rscs_rec_in,
1642 $resv_recs_in,
1643 $panel_low_hour_in,
1644 $panel_high_hour_in,
1645 $resourcecolumnwidth_in,
1646 $schedcolumnwidth_in,
1647 $sched_right_table_rows,
1648 $queued_html_lines);
1649 $queued_html_rows[] = $queued_html_lines;
1650 unset($queued_html_lines);
1651 }
1652 //
1653 //----------------------------------------------------------------------------------------------------
1654 //Does the rows corresponding to the banner reservations for an aircraft or simulator.
1655 //
1656 function SCHEDVIEW_form_resource_scheduling_area_acftsim_banner( $userinfo_in,
1657 $rscs_rec_in,
1658 $banner_reservations_in,
1659 $panel_low_hour_in,
1660 $panel_high_hour_in,
1661 $resourcecolumnwidth_in,
1662 $schedcolumnwidth_in,
1663 $can_view_banner_reservations_in,
1664 &$sched_right_table_rows,
1665 &$queued_html_rows)
1666 {
1667 $done = FALSE;
1668 $grabpoint = 0;
1669 $panel_low_hour_in_int = $panel_low_hour_in * 2;
1670 $panel_high_hour_in_int_limit = ($panel_high_hour_in + 1) * 2;
1671
1672 while (!$done)
1673 {
1674 //Due to the loop, need to unset the display set to keep it from accumulating too many
1675 //elements.
1676 if (isset($display_set))
1677 unset($display_set);
1678
1679 //Grab one element. This is our trial set to start with.
1680 $display_set[] = $banner_reservations_in[$grabpoint];
1681
1682 //Next grabpoint.
1683 $grabpoint++;
1684
1685 //Keep on grabbing until there is a set intersection or we're out of things to grab.
1686 while (
1687 ($grabpoint < count($banner_reservations_in))
1688 &&
1689 (! SCHEDVIEW_resv_actfsim_array_intersection($display_set, $banner_reservations_in[$grabpoint]))
1690 )
1691 {
1692 $display_set[] = $banner_reservations_in[$grabpoint];
1693 $grabpoint ++;
1694 }
1695
1696 //If we can't go further grabbing, we're done.
1697 if ($grabpoint >= count($banner_reservations_in))
1698 $done = TRUE;
1699
1700 //Display the set that was collected for debugging, if necessary.
1701 //echo "<pre>\n----------\nDisplay Set\n----------\n";
1702 //print_r($display_set);
1703 //echo "\n--------\n";
1704
1705 //Our display set now contains a set of records to display. We know there is at least one,
1706 //we know the times don't overlap, and we know that these are in ascending order of start time
1707 //(due to the SQL query). Therefore, we can proceed in order.
1708 $cur_output_time_int = $panel_low_hour_in_int;
1709 $cur_display_record = 0;
1710 //$panel_high_hour_in_int_limit = ($panel_high_hour_in + 1) * 2;
1711
1712 while ($cur_display_record < count($display_set))
1713 {
1714 //Space out the blank cells until the first reservation or next reservation.
1715 while($cur_output_time_int < $display_set[$cur_display_record]["acftsimtimefloorint"])
1716 {
1717 $html_lines[] = "<td>&nbsp;</td>";
1718 $cur_output_time_int ++;
1719 }
1720
1721 //Get the text that should be displayed for the reservation.
1722 if ($userinfo_in === FALSE)
1723 {
1724 //echo " Clause 1 ";
1725 $box_string = "&nbsp;";
1726 }
1727 else
1728 {
1729 //Try to get the user name.
1730 //
1731 //echo "\n<pre>\n";
1732 //print_r($display_set[$cur_display_record]);
1733 //print_r($display_set[$cur_display_record]["useridx"]);
1734 //echo "\n</pre>\n";
1735
1736 if ($display_set[$cur_display_record]["useridx"] > 0)
1737 {
1738 $temp_user_info = USRS_retrieve_by_idx($display_set[$cur_display_record]["useridx"]);
1739 if ($temp_user_info === FALSE)
1740 {
1741 //echo " Clause 2 ";
1742 $box_string = "&nbsp;";
1743 }
1744 else
1745 {
1746 //echo " Clause 3 ";
1747 $box_string = $temp_user_info["lname"]
1748 .
1749 " ("
1750 .
1751 (string)($display_set[$cur_display_record]["idx"])
1752 .
1753 ")";
1754 }
1755 }
1756 else
1757 {
1758 //echo " Clause 4 ";
1759 $box_string = "&nbsp;";
1760 }
1761 }
1762
1763 //Spit the reservation.
1764 $html_lines[] = "<td colspan=\""
1765 . ($display_set[$cur_display_record]["acftsimtimeceilingint"] - $display_set[$cur_display_record]["acftsimtimefloorint"])
1766 . "\" bgcolor=\""
1767 . CONFIG_SCHED_COLOR_DSMAT_RBANN
1768 . "\" align=\"center\">"
1769 . $box_string
1770 . "</td>";
1771
1772 //This takes the time forward.
1773 $cur_output_time_int = $display_set[$cur_display_record]["acftsimtimeceilingint"];
1774
1775 $cur_display_record ++;
1776 }
1777
1778 //Do any remaining cells at the end.
1779 while($cur_output_time_int < $panel_high_hour_in_int_limit)
1780 {
1781 $html_lines[] = "<td>&nbsp;</td>";
1782 $cur_output_time_int ++;
1783 }
1784
1785
1786 //The lines are formed. Add the row.
1787 $queued_html_rows[] = $html_lines;
1788 unset($html_lines);
1789 $sched_right_table_rows++;
1790 }
1791 }
1792 //
1793 //----------------------------------------------------------------------------------------------------
1794 //Does the rows corresponding to the active reservations for an aircraft or simulator.
1795 //
1796 function SCHEDVIEW_form_resource_scheduling_area_acftsim_active( $userinfo_in,
1797 $rscs_rec_in,
1798 $active_reservations_in,
1799 $panel_low_hour_in,
1800 $panel_high_hour_in,
1801 $resourcecolumnwidth_in,
1802 $schedcolumnwidth_in,
1803 $can_view_banner_reservations_in,
1804 &$sched_right_table_rows,
1805 &$queued_html_rows)
1806 {
1807 $done = FALSE;
1808 $grabpoint = 0;
1809 $panel_low_hour_in_int = $panel_low_hour_in * 2;
1810 $panel_high_hour_in_int_limit = ($panel_high_hour_in + 1) * 2;
1811
1812 while (!$done)
1813 {
1814 //Due to the loop, need to unset the display set to keep it from accumulating too many
1815 //elements.
1816 if (isset($display_set))
1817 unset($display_set);
1818
1819 //Grab one element. This is our trial set to start with.
1820 $display_set[] = $active_reservations_in[$grabpoint];
1821
1822 //Next grabpoint.
1823 $grabpoint++;
1824
1825 //Keep on grabbing until there is a set intersection or we're out of things to grab.
1826 while (
1827 ($grabpoint < count($active_reservations_in))
1828 &&
1829 (! SCHEDVIEW_resv_actfsim_array_intersection($display_set, $active_reservations_in[$grabpoint]))
1830 )
1831 {
1832 $display_set[] = $active_reservations_in[$grabpoint];
1833 $grabpoint ++;
1834 }
1835
1836 //If we can't go further grabbing, we're done.
1837 if ($grabpoint >= count($active_reservations_in))
1838 $done = TRUE;
1839
1840 //Display the set that was collected for debugging, if necessary.
1841 //echo "<pre>\n----------\nDisplay Set\n----------\n";
1842 //print_r($display_set);
1843 //echo "\n--------\n";
1844
1845 //Our display set now contains a set of records to display. We know there is at least one,
1846 //we know the times don't overlap, and we know that these are in ascending order of start time
1847 //(due to the SQL query). Therefore, we can proceed in order.
1848 $cur_output_time_int = $panel_low_hour_in_int;
1849 $cur_display_record = 0;
1850 //$panel_high_hour_in_int_limit = ($panel_high_hour_in + 1) * 2;
1851
1852 while ($cur_display_record < count($display_set))
1853 {
1854 //Space out the blank cells until the first reservation or next reservation.
1855 while($cur_output_time_int < $display_set[$cur_display_record]["acftsimtimefloorint"])
1856 {
1857 $html_lines[] = "<td>&nbsp;</td>";
1858 $cur_output_time_int ++;
1859 }
1860
1861 //Get the text that should be displayed for the reservation.
1862 if ($userinfo_in === FALSE)
1863 {
1864 //echo " Clause 1 ";
1865 $box_string = "&nbsp;";
1866 }
1867 else
1868 {
1869 //Try to get the user name.
1870 //
1871 //echo "\n<pre>\n";
1872 //print_r($display_set[$cur_display_record]);
1873 //print_r($display_set[$cur_display_record]["useridx"]);
1874 //echo "\n</pre>\n";
1875
1876 if ($display_set[$cur_display_record]["useridx"] > 0)
1877 {
1878 $temp_user_info = USRS_retrieve_by_idx($display_set[$cur_display_record]["useridx"]);
1879 if ($temp_user_info === FALSE)
1880 {
1881 //echo " Clause 2 ";
1882 $box_string = "&nbsp;";
1883 }
1884 else
1885 {
1886 //echo " Clause 3 ";
1887 $box_string = $temp_user_info["lname"]
1888 .
1889 " ("
1890 .
1891 (string)($display_set[$cur_display_record]["idx"])
1892 .
1893 ")";
1894 }
1895 }
1896 else
1897 {
1898 //echo " Clause 4 ";
1899 $box_string = "&nbsp;";
1900 }
1901 }
1902
1903
1904 //Spit the reservation.
1905 $html_lines[] = "<td colspan=\""
1906 . ($display_set[$cur_display_record]["acftsimtimeceilingint"] - $display_set[$cur_display_record]["acftsimtimefloorint"])
1907 . "\" bgcolor=\""
1908 . CONFIG_SCHED_COLOR_DSMAT_RACTV
1909 . "\" align=\"center\">"
1910 . $box_string
1911 . "</td>";
1912
1913 //This takes the time forward.
1914 $cur_output_time_int = $display_set[$cur_display_record]["acftsimtimeceilingint"];
1915
1916 $cur_display_record ++;
1917 }
1918
1919 //Do any remaining cells at the end.
1920 while($cur_output_time_int < $panel_high_hour_in_int_limit)
1921 {
1922 $html_lines[] = "<td>&nbsp;</td>";
1923 $cur_output_time_int ++;
1924 }
1925
1926
1927 //The lines are formed. Add the row.
1928 $queued_html_rows[] = $html_lines;
1929 unset($html_lines);
1930 $sched_right_table_rows++;
1931 }
1932 }
1933 //
1934 //----------------------------------------------------------------------------------------------------
1935 //Does the rows corresponding to the standby reservations for an aircraft or simulator.
1936 //
1937 function SCHEDVIEW_form_resource_scheduling_area_acftsim_standby( $userinfo_in,
1938 $rscs_rec_in,
1939 $standby_reservations_in,
1940 $panel_low_hour_in,
1941 $panel_high_hour_in,
1942 $resourcecolumnwidth_in,
1943 $schedcolumnwidth_in,
1944 $can_view_banner_reservations_in,
1945 &$sched_right_table_rows,
1946 &$queued_html_rows)
1947 {
1948 $done = FALSE;
1949 $grabpoint = 0;
1950 $panel_low_hour_in_int = $panel_low_hour_in * 2;
1951 $panel_high_hour_in_int_limit = ($panel_high_hour_in + 1) * 2;
1952
1953 while (!$done)
1954 {
1955 //Due to the loop, need to unset the display set to keep it from accumulating too many
1956 //elements.
1957 if (isset($display_set))
1958 unset($display_set);
1959
1960 //Grab one element. This is our trial set to start with.
1961 $display_set[] = $standby_reservations_in[$grabpoint];
1962
1963 //Next grabpoint.
1964 $grabpoint++;
1965
1966 //Keep on grabbing until there is a set intersection or we're out of things to grab.
1967 while (
1968 ($grabpoint < count($standby_reservations_in))
1969 &&
1970 (! SCHEDVIEW_resv_actfsim_array_intersection($display_set, $standby_reservations_in[$grabpoint]))
1971 )
1972 {
1973 $display_set[] = $standby_reservations_in[$grabpoint];
1974 $grabpoint ++;
1975 }
1976
1977 //If we can't go further grabbing, we're done.
1978 if ($grabpoint >= count($standby_reservations_in))
1979 $done = TRUE;
1980
1981 //Display the set that was collected for debugging, if necessary.
1982 //echo "<pre>\n----------\nDisplay Set\n----------\n";
1983 //print_r($display_set);
1984 //echo "\n--------\n";
1985
1986 //Our display set now contains a set of records to display. We know there is at least one,
1987 //we know the times don't overlap, and we know that these are in ascending order of start time
1988 //(due to the SQL query). Therefore, we can proceed in order.
1989 $cur_output_time_int = $panel_low_hour_in_int;
1990 $cur_display_record = 0;
1991 //$panel_high_hour_in_int_limit = ($panel_high_hour_in + 1) * 2;
1992
1993 while ($cur_display_record < count($display_set))
1994 {
1995 //Space out the blank cells until the first reservation or next reservation.
1996 while($cur_output_time_int < $display_set[$cur_display_record]["acftsimtimefloorint"])
1997 {
1998 $html_lines[] = "<td>&nbsp;</td>";
1999 $cur_output_time_int ++;
2000 }
2001
2002 //Get the text that should be displayed for the reservation.
2003 if ($userinfo_in === FALSE)
2004 {
2005 //echo " Clause 1 ";
2006 $box_string = "&nbsp;";
2007 }
2008 else
2009 {
2010 //Try to get the user name.
2011 //
2012 //echo "\n<pre>\n";
2013 //print_r($display_set[$cur_display_record]);
2014 //print_r($display_set[$cur_display_record]["useridx"]);
2015 //echo "\n</pre>\n";
2016
2017 if ($display_set[$cur_display_record]["useridx"] > 0)
2018 {
2019 $temp_user_info = USRS_retrieve_by_idx($display_set[$cur_display_record]["useridx"]);
2020 if ($temp_user_info === FALSE)
2021 {
2022 //echo " Clause 2 ";
2023 $box_string = "&nbsp;";
2024 }
2025 else
2026 {
2027 //echo " Clause 3 ";
2028 $box_string = $temp_user_info["lname"]
2029 .
2030 " ("
2031 .
2032 (string)($display_set[$cur_display_record]["idx"])
2033 .
2034 ")";
2035 }
2036 }
2037 else
2038 {
2039 //echo " Clause 4 ";
2040 $box_string = "&nbsp;";
2041 }
2042 }
2043
2044
2045 //Spit the reservation.
2046 $html_lines[] = "<td colspan=\""
2047 . ($display_set[$cur_display_record]["acftsimtimeceilingint"] - $display_set[$cur_display_record]["acftsimtimefloorint"])
2048 . "\" bgcolor=\""
2049 . CONFIG_SCHED_COLOR_DSMAT_RSTBY
2050 . "\" align=\"center\">"
2051 . $box_string
2052 . "</td>";
2053
2054 //This takes the time forward.
2055 $cur_output_time_int = $display_set[$cur_display_record]["acftsimtimeceilingint"];
2056
2057 $cur_display_record ++;
2058 }
2059
2060 //Do any remaining cells at the end.
2061 while($cur_output_time_int < $panel_high_hour_in_int_limit)
2062 {
2063 $html_lines[] = "<td>&nbsp;</td>";
2064 $cur_output_time_int ++;
2065 }
2066
2067
2068 //The lines are formed. Add the row.
2069 $queued_html_rows[] = $html_lines;
2070 unset($html_lines);
2071 $sched_right_table_rows++;
2072 }
2073 }
2074 //
2075 //----------------------------------------------------------------------------------------------------
2076 function SCHEDVIEW_form_resource_scheduling_area_acftsim( $userinfo_in,
2077 $rscs_rec_in,
2078 $resv_recs_in,
2079 $panel_low_hour_in,
2080 $panel_high_hour_in,
2081 $resourcecolumnwidth_in,
2082 $schedcolumnwidth_in,
2083 $can_view_banner_reservations_in,
2084 &$sched_right_table_rows,
2085 &$queued_html_rows)
2086 {
2087 if ($resv_recs_in !== FALSE) //Can't parse reservations if none there.
2088 {
2089 //echo "<pre>\n----------\nReservations Passed In\n----------\n";
2090 //print_r($resv_recs_in);
2091 //echo "\n---------\n</pre>\n";
2092 //
2093 //Identify the banner reservations, active reservations, and standby reservations.
2094 //
2095 $banner_first = -1;
2096 $banner_last = -1;
2097 $active_first = -1;
2098 $active_last = -1;
2099 $standby_first = -1;
2100 $standby_last = -1;
2101
2102 $n = count($resv_recs_in);
2103 for ($i=0; $i<$n; $i++)
2104 {
2105 if ($resv_recs_in[$i]["type"] == RESV_TYPE_BANNER)
2106 {
2107 if ($banner_first == -1)
2108 $banner_first = $i;
2109 $banner_last = $i;
2110 }
2111
2112 if ($resv_recs_in[$i]["type"] == RESV_TYPE_ACTIVE)
2113 {
2114 if ($active_first == -1)
2115 $active_first = $i;
2116 $active_last = $i;
2117 }
2118
2119 if ($resv_recs_in[$i]["type"] == RESV_TYPE_STANDBY)
2120 {
2121 if ($standby_first == -1)
2122 $standby_first = $i;
2123 $standby_last = $i;
2124 }
2125 }
2126 //
2127 //-----------------------------------------------------------------------------
2128 //Do the banner reservations, if there are any, and if it is appropriate.
2129 //
2130 if (($banner_first != -1) && ($can_view_banner_reservations_in))
2131 {
2132 //Extract the records.
2133 $banner_reservations = array_slice ($resv_recs_in,
2134 $banner_first,
2135 $banner_last - $banner_first + 1);
2136
2137 //echo "<pre>\n----------\nBanner Reservations\n----------\n";
2138 //print_r($banner_reservations);
2139 //echo "\n---------\n</pre>\n";
2140
2141 SCHEDVIEW_form_resource_scheduling_area_acftsim_banner( $userinfo_in,
2142 $rscs_rec_in,
2143 $banner_reservations,
2144 $panel_low_hour_in,
2145 $panel_high_hour_in,
2146 $resourcecolumnwidth_in,
2147 $schedcolumnwidth_in,
2148 $can_view_banner_reservations_in,
2149 $sched_right_table_rows,
2150 $queued_html_rows);
2151 }
2152 //
2153 //-----------------------------------------------------------------------------
2154 //Do the active reservations, if there are any.
2155 //
2156 if ($active_first != -1)
2157 {
2158 //Extract the records.
2159 $active_reservations = array_slice ($resv_recs_in,
2160 $active_first,
2161 $active_last - $active_first + 1);
2162
2163 //echo "<pre>\n----------\nActive Reservations\n----------\n";
2164 //print_r($active_reservations);
2165 //echo "\n---------\n</pre>\n";
2166
2167 SCHEDVIEW_form_resource_scheduling_area_acftsim_active( $userinfo_in,
2168 $rscs_rec_in,
2169 $active_reservations,
2170 $panel_low_hour_in,
2171 $panel_high_hour_in,
2172 $resourcecolumnwidth_in,
2173 $schedcolumnwidth_in,
2174 $can_view_banner_reservations_in,
2175 $sched_right_table_rows,
2176 $queued_html_rows);
2177 }
2178 //
2179 //-----------------------------------------------------------------------------
2180 //Do the standby reservations, if there are any.
2181 //
2182 if ($standby_first != -1)
2183 {
2184 //Extract the records.
2185 $standby_reservations = array_slice ($resv_recs_in,
2186 $standby_first,
2187 $standby_last - $standby_first + 1);
2188
2189 //echo "<pre>\n----------\nStandby Reservations\n----------\n";
2190 //print_r($standby_reservations);
2191 //echo "\n---------\n</pre>\n";
2192
2193 SCHEDVIEW_form_resource_scheduling_area_acftsim_standby( $userinfo_in,
2194 $rscs_rec_in,
2195 $standby_reservations,
2196 $panel_low_hour_in,
2197 $panel_high_hour_in,
2198 $resourcecolumnwidth_in,
2199 $schedcolumnwidth_in,
2200 $can_view_banner_reservations_in,
2201 $sched_right_table_rows,
2202 $queued_html_rows);
2203 }
2204 //
2205 }
2206
2207 SCHEDVIEW_form_resource_scheduling_area_terminator_bar($userinfo_in,
2208 $rscs_rec_in,
2209 $resv_recs_in,
2210 $panel_low_hour_in,
2211 $panel_high_hour_in,
2212 $resourcecolumnwidth_in,
2213 $schedcolumnwidth_in,
2214 $sched_right_table_rows,
2215 $queued_html_lines);
2216 $queued_html_rows[] = $queued_html_lines;
2217 unset($queued_html_lines);
2218 }
2219 //
2220 //----------------------------------------------------------------------------------------------------
2221 //Does a dayview table row.
2222 //
2223 function SCHEDVIEW_do_dayview_table_row(
2224 $userinfo_in, //User record, or FALSE if none.
2225 $rscs_rec_in, //Resource record.
2226 $resv_recs_in, //Applicable reservations, or FALSE if none.
2227 $panel_low_hour_in, //Low panel hour.
2228 $panel_high_hour_in, //High panel hour (inclusive)
2229 $resourcecolumnwidth_in, //Column width, in percent, for left resource header.
2230 $schedcolumnwidth_in, //Column width for each scheduling cell.
2231 $can_view_banner_reservations_in //TRUE if this user is allowed to see banners.
2232 )
2233 {
2234 //Start a table row. This encompasses the left area that identifies the resource (with potentially a
2235 //rowspan > 1) and the scheduling area at the right.
2236
2237 //Start off believing no table rows dedicated to the right scheduling area for a resource.
2238 $sched_right_table_rows = 0;
2239
2240 //Form the scheduling area of the resource row as an array of HTML rows. Each HTML row is an array of
2241 //one or more HTML lines. We have to do this first, because otherwise won't know how large the rowspan
2242 //for the resource name at the left should be.
2243 //
2244 //We have to differentiate between forming the scheduling area for a flight instructor versus an
2245 //aircraft/simulator, as different fields are checked.
2246 //
2247 if ($rscs_rec_in["type"] == RSCS_TYPE_FLIGHTINSTRUCTOR)
2248 {
2249 SCHEDVIEW_form_resource_scheduling_area_finst($userinfo_in,
2250 $rscs_rec_in,
2251 $resv_recs_in,
2252 $panel_low_hour_in,
2253 $panel_high_hour_in,
2254 $resourcecolumnwidth_in,
2255 $schedcolumnwidth_in,
2256 $can_view_banner_reservations_in,
2257 $sched_right_table_rows,
2258 $queued_html_sched_rows);
2259 }
2260 else
2261 {
2262 SCHEDVIEW_form_resource_scheduling_area_acftsim($userinfo_in,
2263 $rscs_rec_in,
2264 $resv_recs_in,
2265 $panel_low_hour_in,
2266 $panel_high_hour_in,
2267 $resourcecolumnwidth_in,
2268 $schedcolumnwidth_in,
2269 $can_view_banner_reservations_in,
2270 $sched_right_table_rows,
2271 $queued_html_sched_rows);
2272 }
2273
2274 //Form the HTML for the left area with the resource short name. We can do this now because the number of
2275 //rows is no known. This will consist of exactly one <TD> cell.
2276 SCHEDVIEW_do_left_resource_title_area($userinfo_in,
2277 $rscs_rec_in,
2278 $resv_recs_in,
2279 $panel_low_hour_in,
2280 $panel_high_hour_in,
2281 $resourcecolumnwidth_in,
2282 $schedcolumnwidth_in,
2283 $sched_right_table_rows,
2284 $queued_html_head_lines);
2285
2286 //echo "<pre>\n";
2287 //print_r($queued_html_head_rows);
2288 //echo "</pre>\n";
2289
2290 //Output the HTML that was generated.
2291 $n = count($queued_html_sched_rows);
2292 for ($i=0; $i<$n; $i++)
2293 {
2294 //Row starts.
2295 HTMLFORMAT_echo_push_nl("<tr>");
2296
2297 //If this is the first row, output the left heading. This will have a rowspan potentially
2298 //>1.
2299 if ($i == 0)
2300 {
2301 for ($j=0; $j<count($queued_html_head_lines); $j++)
2302 {
2303 HTMLFORMAT_echo_noop_nl($queued_html_head_lines[$j]);
2304 }
2305 }
2306
2307 //Output the scheduling row(s).
2308 $cur_lines = $queued_html_sched_rows[$i];
2309
2310 for ($j=0; $j<count($cur_lines); $j++)
2311 {
2312 HTMLFORMAT_echo_noop_nl($cur_lines[$j]);
2313 }
2314
2315 //Row ends.
2316 HTMLFORMAT_echo_pull_nl("</tr>");
2317 }
2318 }
2319 //
2320 //----------------------------------------------------------------------------------------------------
2321 //Display the scheduling area for a given date and time.
2322 //
2323 //Parameters:
2324 // userinfo : The array of user information for the logged in user (pulled from the MySQL
2325 // database), or FALSE if no user is logged in.
2326 //
2327 // sessioninfo_in : The array of information about the current login session, or FALSE if
2328 // no session is active.
2329 //
2330 // dateyear : The year of the date to display (an integer).
2331 //
2332 // datemonth : The month of the date to display (an integer).
2333 //
2334 // dateday : The day of the date to display (an integer).
2335 //
2336 // timehour : The hour of the time to display (an integer).
2337 //
2338 // timemin : The minute of the time to display (an integer).
2339 //
2340 // diff_time_perm_array : An array of permissions about previous and future times
2341 // specifying which should be displayed.
2342 //
2343 function SCHEDVIEW_scheduling_area($userinfo, $sessioninfo_in,
2344 $dateyear, $datemonth, $dateday,
2345 $timehour, $timemin,
2346 $diff_time_perm_array,
2347 $panel
2348 )
2349 {
2350 global $CONFIG_SCHED_DAY_PANELS;
2351
2352 SCHEDVIEW_temporal_navigation_bar(
2353 $userinfo,
2354 $dateyear, $datemonth, $dateday,
2355 $timehour, $timemin,
2356 $diff_time_perm_array,
2357 $panel
2358 );
2359
2360 $panel_low_hour = $CONFIG_SCHED_DAY_PANELS[$panel * 2];
2361 $panel_high_hour = $CONFIG_SCHED_DAY_PANELS[$panel * 2 + 1];
2362
2363 $nwholehours = $panel_high_hour - $panel_low_hour + 1;
2364 $nschedcols = $nwholehours * 2;
2365
2366 //Calculate whether the logged in user, if any, can view banner reservations. Banner reservations
2367 //are non-restrictive, so this comes down to any logged in user.
2368 if ($userinfo === FALSE)
2369 {
2370 $user_can_view_banner_reservations = FALSE;
2371 }
2372 else
2373 {
2374 $user_can_view_banner_reservations = TRUE;
2375 }
2376
2377 //Calculate how wide to make columns. The goal is to give a hint to the browser that we want
2378 //everthing except the first column to be the same width. Output is an integer percentage.
2379 //
2380 $schedcolumnwidth = (int)(100/($nschedcols+1) + 0.5);
2381 $resourcecolumnwidth = 100 - ($nschedcols * $schedcolumnwidth);
2382
2383 //Obtain the list of resources to display. This function will return FALSE if there are no
2384 //resources that meet eligibility requirements, and this case needs to be handled
2385 //carefully.
2386 //
2387 $rscs_to_display = RSCS_rscs_list_dayview_online();
2388 //
2389 //echo "<tt>\n";
2390 //print_r($rscs_to_display);
2391 //echo "</tt>\n";
2392
2393 //Determine the count of resources to be displayed. If the database retrieval function
2394 //returned FALSE, this value should be set to 0. 0 will ensure that the array is not
2395 //dereferenced at all.
2396 //
2397 if ($rscs_to_display === FALSE)
2398 {
2399 $resource_display_count = 0;
2400 }
2401 else
2402 {
2403 $resource_display_count = count($rscs_to_display);
2404 }
2405
2406 //echo " Value of resource_display_count : " . $resource_display_count . " ";
2407
2408 //Calculate the number of time columns involved in this panel. This is constant across all
2409 //the resources because of the rectangular layout.
2410 $n_time_columns = SCHEDVIEW_panel_n_time_columns($panel_low_hour, $panel_high_hour);
2411 //echo "<tt>\n";
2412 //print_r($n_time_columns);
2413 //echo "</tt>\n";
2414
2415 //Calculate an stime corresponding to the left edge of the panel. This is used for the SQL query.
2416 //
2417 $panel_left_stime = STIME_stime_make_medres($dateyear, $datemonth, $dateday, $panel_low_hour, 0);
2418
2419 //Calculate an stime corresponding to the right edge of the panel. This is used for the SQL query.
2420 //We need to be careful at the right edge because of the midnight boundary.
2421 //
2422 if ($panel_high_hour < 23)
2423 {
2424 $panel_right_stime = STIME_stime_make_medres($dateyear, $datemonth, $dateday, $panel_high_hour + 1, 0);
2425 }
2426 else
2427 {
2428 //Figure out what one day in the future is.
2429 DATEFUNC_one_day_future($dateyear,
2430 $datemonth,
2431 $dateday,
2432 $localtemp_year_onedayfuture,
2433 $localtemp_month_onedayfuture,
2434 $localtemp_day_onedayfuture);
2435 //And calculate the STIME.
2436 //
2437 $panel_right_stime = STIME_stime_make_medres($localtemp_year_onedayfuture,
2438 $localtemp_month_onedayfuture,
2439 $localtemp_day_onedayfuture,
2440 0,
2441 0);
2442 }
2443
2444 //echo "<br><br>\n";
2445 //print_r($panel_left_stime);
2446 //echo "<br><br>\n";
2447 //print_r($panel_right_stime);
2448 //echo "<br><br>\n";
2449
2450 //Run the SQL query to identify the reservation records that match the time limit parameters.
2451 //These will be sorted according to the index, not the resource sort order, and then the reservation
2452 //type, so a little rearrangement will be necessary posthumously.
2453 //
2454 RESV_resvns_in_time_window( $panel_left_stime,
2455 $panel_right_stime,
2456 $flight_inst_data_array,
2457 $flight_inst_search_array,
2458 $resource_data_array,
2459 $resource_search_array );
2460 //
2461 //echo "<br><pre>\n";
2462 //print_r($flight_inst_data_array);
2463 //echo "</pre><br>\n";
2464 //echo "<br><pre>\n";
2465 //print_r($flight_inst_search_array);
2466 //echo "</pre><br>\n";
2467 //echo "<br><pre>\n";
2468 //print_r($resource_data_array);
2469 //echo "</pre><br>\n";
2470 //echo "<br><pre>\n";
2471 //print_r($resource_search_array);
2472 //echo "</pre><br>\n";
2473 //
2474 //Decorate the lists of reservations with additional information that will allow quicker display
2475 //of reservations.
2476 SCHEDVIEW_resv_list_decorate($flight_inst_data_array, $panel_left_stime, $panel_right_stime);
2477 SCHEDVIEW_resv_list_decorate($resource_data_array, $panel_left_stime, $panel_right_stime);
2478 //
2479 //echo "<pre>\n";
2480 //echo "Flight Instructor Data\n---------------------\n";
2481 //print_r($flight_inst_data_array);
2482 //echo "\nResource Data Array\n";
2483 //echo "-------------------\n";
2484 //print_r($resource_data_array);
2485 //echo "</pre>\n";
2486
2487
2488 HTMLFORMAT_echo_push_nl("<table border=\"1\" cellspacing=\"0\" cellpadding=\"1\" width=\"100%\">");
2489
2490 for ($row=-1; $row <= $resource_display_count; $row++)
2491 {
2492 if (($row == -1) || ($row == $resource_display_count))
2493 {
2494 //Top or bottom row, containing time headings.
2495 //
2496 HTMLFORMAT_echo_push_nl("<tr>");
2497 HTMLFORMAT_echo_push_nl("<td colspan=\"1\" width=\"" . $resourcecolumnwidth . "%\" bgcolor=\"#" . CONFIG_SCHED_COLOR_DSMAT_THEAD . "\">");
2498 HTMLFORMAT_echo_noop_nl("&nbsp;");
2499 HTMLFORMAT_echo_pull_nl("</td>");
2500
2501 for ($i=$panel_low_hour; $i<=$panel_high_hour; $i++)
2502 {
2503 HTMLFORMAT_echo_push_nl("<td align=\"center\" colspan=\"2\" width=\"" . $schedcolumnwidth * 2
2504 . "%\" bgcolor=\"#" . CONFIG_SCHED_COLOR_DSMAT_THEAD . "\">");
2505 HTMLFORMAT_echo_noop_nl("<font size=\"3\">" . DATEFUNC_stdtimenosec($i, 0) . "</font>");
2506 HTMLFORMAT_echo_pull_nl("</td>");
2507 }
2508
2509 HTMLFORMAT_echo_pull_nl("</tr>");
2510
2511 //If we have just done the top header and if there are no resources, output a table row indicating that
2512 //there are no resources that met search criteria.
2513 //
2514 if (($row == -1) && ($resource_display_count == 0))
2515 {
2516 HTMLFORMAT_echo_noop_nl("<tr align=\"center\"><td colspan=\""
2517 .
2518 sprintf("%d", $nschedcols+1)
2519 .
2520 "\"><br><b>No Resources Online</b><br><br></td></tr>");
2521 }
2522 }
2523 else
2524 {
2525 //Pull the current resource from the array. I haven't figured out the PHP syntax enough to
2526 //access an element of a 2-D array directly.
2527 //
2528 $current_resource = $rscs_to_display[$row];
2529
2530 //Extract the records from the SQL resv queries that correspond to the flight instructor or resource.
2531 //
2532 if ($current_resource["type"] == RSCS_TYPE_FLIGHTINSTRUCTOR)
2533 {
2534 //Flight instructor.
2535 $target_resvs = RESV_extract_finst_records($flight_inst_data_array, $flight_inst_search_array, $current_resource["idx"]);
2536 //
2537 //echo "<br><pre>\n";
2538 //print_r($target_resvs);
2539 //echo "</pre><br>\n";
2540 }
2541 else
2542 {
2543 //Aircraft or simulator.
2544 $target_resvs = RESV_extract_resource_records($resource_data_array, $resource_search_array, $current_resource["idx"]);
2545 //
2546 //echo "<br><pre>\n";
2547 //print_r($target_resvs);
2548 //echo "</pre><br>\n";
2549 }
2550
2551 SCHEDVIEW_do_dayview_table_row(
2552 $userinfo,
2553 $current_resource,
2554 $target_resvs,
2555 $panel_low_hour,
2556 $panel_high_hour,
2557 $resourcecolumnwidth,
2558 $schedcolumnwidth,
2559 $user_can_view_banner_reservations
2560 );
2561 }
2562 }
2563
2564 HTMLFORMAT_echo_pull_nl("</table>");
2565 }
2566 //
2567 //--------------------------------------------------------------------------------
2568 //End of $RCSfile: schedview.inc,v $.
2569 //--------------------------------------------------------------------------------
2570 ?>

dashley@gmail.com
ViewVC Help
Powered by ViewVC 1.1.25