/[dtapublic]/to_be_filed/webprojs/fboprime/sw/phplib/schedview.inc
ViewVC logotype

Contents of /to_be_filed/webprojs/fboprime/sw/phplib/schedview.inc

Parent Directory Parent Directory | Revision Log Revision Log


Revision 31 - (show annotations) (download)
Sat Oct 8 18:44:20 2016 UTC (8 years ago) by dashley
File size: 151809 byte(s)
Initial commit.
1 <?php
2 //$Header: /home/dashley/cvsrep/e3ft_gpl01/e3ft_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 //Copyright 2006 David T. Ashley
22 //-------------------------------------------------------------------------------------------------
23 //This source code and any program in which it is compiled/used is provided under the GNU GENERAL
24 //PUBLIC LICENSE, Version 3, full license text below.
25 //-------------------------------------------------------------------------------------------------
26 // GNU GENERAL PUBLIC LICENSE
27 // Version 3, 29 June 2007
28 //
29 // Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
30 // Everyone is permitted to copy and distribute verbatim copies
31 // of this license document, but changing it is not allowed.
32 //
33 // Preamble
34 //
35 // The GNU General Public License is a free, copyleft license for
36 //software and other kinds of works.
37 //
38 // The licenses for most software and other practical works are designed
39 //to take away your freedom to share and change the works. By contrast,
40 //the GNU General Public License is intended to guarantee your freedom to
41 //share and change all versions of a program--to make sure it remains free
42 //software for all its users. We, the Free Software Foundation, use the
43 //GNU General Public License for most of our software; it applies also to
44 //any other work released this way by its authors. You can apply it to
45 //your programs, too.
46 //
47 // When we speak of free software, we are referring to freedom, not
48 //price. Our General Public Licenses are designed to make sure that you
49 //have the freedom to distribute copies of free software (and charge for
50 //them if you wish), that you receive source code or can get it if you
51 //want it, that you can change the software or use pieces of it in new
52 //free programs, and that you know you can do these things.
53 //
54 // To protect your rights, we need to prevent others from denying you
55 //these rights or asking you to surrender the rights. Therefore, you have
56 //certain responsibilities if you distribute copies of the software, or if
57 //you modify it: responsibilities to respect the freedom of others.
58 //
59 // For example, if you distribute copies of such a program, whether
60 //gratis or for a fee, you must pass on to the recipients the same
61 //freedoms that you received. You must make sure that they, too, receive
62 //or can get the source code. And you must show them these terms so they
63 //know their rights.
64 //
65 // Developers that use the GNU GPL protect your rights with two steps:
66 //(1) assert copyright on the software, and (2) offer you this License
67 //giving you legal permission to copy, distribute and/or modify it.
68 //
69 // For the developers' and authors' protection, the GPL clearly explains
70 //that there is no warranty for this free software. For both users' and
71 //authors' sake, the GPL requires that modified versions be marked as
72 //changed, so that their problems will not be attributed erroneously to
73 //authors of previous versions.
74 //
75 // Some devices are designed to deny users access to install or run
76 //modified versions of the software inside them, although the manufacturer
77 //can do so. This is fundamentally incompatible with the aim of
78 //protecting users' freedom to change the software. The systematic
79 //pattern of such abuse occurs in the area of products for individuals to
80 //use, which is precisely where it is most unacceptable. Therefore, we
81 //have designed this version of the GPL to prohibit the practice for those
82 //products. If such problems arise substantially in other domains, we
83 //stand ready to extend this provision to those domains in future versions
84 //of the GPL, as needed to protect the freedom of users.
85 //
86 // Finally, every program is threatened constantly by software patents.
87 //States should not allow patents to restrict development and use of
88 //software on general-purpose computers, but in those that do, we wish to
89 //avoid the special danger that patents applied to a free program could
90 //make it effectively proprietary. To prevent this, the GPL assures that
91 //patents cannot be used to render the program non-free.
92 //
93 // The precise terms and conditions for copying, distribution and
94 //modification follow.
95 //
96 // TERMS AND CONDITIONS
97 //
98 // 0. Definitions.
99 //
100 // "This License" refers to version 3 of the GNU General Public License.
101 //
102 // "Copyright" also means copyright-like laws that apply to other kinds of
103 //works, such as semiconductor masks.
104 //
105 // "The Program" refers to any copyrightable work licensed under this
106 //License. Each licensee is addressed as "you". "Licensees" and
107 //"recipients" may be individuals or organizations.
108 //
109 // To "modify" a work means to copy from or adapt all or part of the work
110 //in a fashion requiring copyright permission, other than the making of an
111 //exact copy. The resulting work is called a "modified version" of the
112 //earlier work or a work "based on" the earlier work.
113 //
114 // A "covered work" means either the unmodified Program or a work based
115 //on the Program.
116 //
117 // To "propagate" a work means to do anything with it that, without
118 //permission, would make you directly or secondarily liable for
119 //infringement under applicable copyright law, except executing it on a
120 //computer or modifying a private copy. Propagation includes copying,
121 //distribution (with or without modification), making available to the
122 //public, and in some countries other activities as well.
123 //
124 // To "convey" a work means any kind of propagation that enables other
125 //parties to make or receive copies. Mere interaction with a user through
126 //a computer network, with no transfer of a copy, is not conveying.
127 //
128 // An interactive user interface displays "Appropriate Legal Notices"
129 //to the extent that it includes a convenient and prominently visible
130 //feature that (1) displays an appropriate copyright notice, and (2)
131 //tells the user that there is no warranty for the work (except to the
132 //extent that warranties are provided), that licensees may convey the
133 //work under this License, and how to view a copy of this License. If
134 //the interface presents a list of user commands or options, such as a
135 //menu, a prominent item in the list meets this criterion.
136 //
137 // 1. Source Code.
138 //
139 // The "source code" for a work means the preferred form of the work
140 //for making modifications to it. "Object code" means any non-source
141 //form of a work.
142 //
143 // A "Standard Interface" means an interface that either is an official
144 //standard defined by a recognized standards body, or, in the case of
145 //interfaces specified for a particular programming language, one that
146 //is widely used among developers working in that language.
147 //
148 // The "System Libraries" of an executable work include anything, other
149 //than the work as a whole, that (a) is included in the normal form of
150 //packaging a Major Component, but which is not part of that Major
151 //Component, and (b) serves only to enable use of the work with that
152 //Major Component, or to implement a Standard Interface for which an
153 //implementation is available to the public in source code form. A
154 //"Major Component", in this context, means a major essential component
155 //(kernel, window system, and so on) of the specific operating system
156 //(if any) on which the executable work runs, or a compiler used to
157 //produce the work, or an object code interpreter used to run it.
158 //
159 // The "Corresponding Source" for a work in object code form means all
160 //the source code needed to generate, install, and (for an executable
161 //work) run the object code and to modify the work, including scripts to
162 //control those activities. However, it does not include the work's
163 //System Libraries, or general-purpose tools or generally available free
164 //programs which are used unmodified in performing those activities but
165 //which are not part of the work. For example, Corresponding Source
166 //includes interface definition files associated with source files for
167 //the work, and the source code for shared libraries and dynamically
168 //linked subprograms that the work is specifically designed to require,
169 //such as by intimate data communication or control flow between those
170 //subprograms and other parts of the work.
171 //
172 // The Corresponding Source need not include anything that users
173 //can regenerate automatically from other parts of the Corresponding
174 //Source.
175 //
176 // The Corresponding Source for a work in source code form is that
177 //same work.
178 //
179 // 2. Basic Permissions.
180 //
181 // All rights granted under this License are granted for the term of
182 //copyright on the Program, and are irrevocable provided the stated
183 //conditions are met. This License explicitly affirms your unlimited
184 //permission to run the unmodified Program. The output from running a
185 //covered work is covered by this License only if the output, given its
186 //content, constitutes a covered work. This License acknowledges your
187 //rights of fair use or other equivalent, as provided by copyright law.
188 //
189 // You may make, run and propagate covered works that you do not
190 //convey, without conditions so long as your license otherwise remains
191 //in force. You may convey covered works to others for the sole purpose
192 //of having them make modifications exclusively for you, or provide you
193 //with facilities for running those works, provided that you comply with
194 //the terms of this License in conveying all material for which you do
195 //not control copyright. Those thus making or running the covered works
196 //for you must do so exclusively on your behalf, under your direction
197 //and control, on terms that prohibit them from making any copies of
198 //your copyrighted material outside their relationship with you.
199 //
200 // Conveying under any other circumstances is permitted solely under
201 //the conditions stated below. Sublicensing is not allowed; section 10
202 //makes it unnecessary.
203 //
204 // 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
205 //
206 // No covered work shall be deemed part of an effective technological
207 //measure under any applicable law fulfilling obligations under article
208 //11 of the WIPO copyright treaty adopted on 20 December 1996, or
209 //similar laws prohibiting or restricting circumvention of such
210 //measures.
211 //
212 // When you convey a covered work, you waive any legal power to forbid
213 //circumvention of technological measures to the extent such circumvention
214 //is effected by exercising rights under this License with respect to
215 //the covered work, and you disclaim any intention to limit operation or
216 //modification of the work as a means of enforcing, against the work's
217 //users, your or third parties' legal rights to forbid circumvention of
218 //technological measures.
219 //
220 // 4. Conveying Verbatim Copies.
221 //
222 // You may convey verbatim copies of the Program's source code as you
223 //receive it, in any medium, provided that you conspicuously and
224 //appropriately publish on each copy an appropriate copyright notice;
225 //keep intact all notices stating that this License and any
226 //non-permissive terms added in accord with section 7 apply to the code;
227 //keep intact all notices of the absence of any warranty; and give all
228 //recipients a copy of this License along with the Program.
229 //
230 // You may charge any price or no price for each copy that you convey,
231 //and you may offer support or warranty protection for a fee.
232 //
233 // 5. Conveying Modified Source Versions.
234 //
235 // You may convey a work based on the Program, or the modifications to
236 //produce it from the Program, in the form of source code under the
237 //terms of section 4, provided that you also meet all of these conditions:
238 //
239 // a) The work must carry prominent notices stating that you modified
240 // it, and giving a relevant date.
241 //
242 // b) The work must carry prominent notices stating that it is
243 // released under this License and any conditions added under section
244 // 7. This requirement modifies the requirement in section 4 to
245 // "keep intact all notices".
246 //
247 // c) You must license the entire work, as a whole, under this
248 // License to anyone who comes into possession of a copy. This
249 // License will therefore apply, along with any applicable section 7
250 // additional terms, to the whole of the work, and all its parts,
251 // regardless of how they are packaged. This License gives no
252 // permission to license the work in any other way, but it does not
253 // invalidate such permission if you have separately received it.
254 //
255 // d) If the work has interactive user interfaces, each must display
256 // Appropriate Legal Notices; however, if the Program has interactive
257 // interfaces that do not display Appropriate Legal Notices, your
258 // work need not make them do so.
259 //
260 // A compilation of a covered work with other separate and independent
261 //works, which are not by their nature extensions of the covered work,
262 //and which are not combined with it such as to form a larger program,
263 //in or on a volume of a storage or distribution medium, is called an
264 //"aggregate" if the compilation and its resulting copyright are not
265 //used to limit the access or legal rights of the compilation's users
266 //beyond what the individual works permit. Inclusion of a covered work
267 //in an aggregate does not cause this License to apply to the other
268 //parts of the aggregate.
269 //
270 // 6. Conveying Non-Source Forms.
271 //
272 // You may convey a covered work in object code form under the terms
273 //of sections 4 and 5, provided that you also convey the
274 //machine-readable Corresponding Source under the terms of this License,
275 //in one of these ways:
276 //
277 // a) Convey the object code in, or embodied in, a physical product
278 // (including a physical distribution medium), accompanied by the
279 // Corresponding Source fixed on a durable physical medium
280 // customarily used for software interchange.
281 //
282 // b) Convey the object code in, or embodied in, a physical product
283 // (including a physical distribution medium), accompanied by a
284 // written offer, valid for at least three years and valid for as
285 // long as you offer spare parts or customer support for that product
286 // model, to give anyone who possesses the object code either (1) a
287 // copy of the Corresponding Source for all the software in the
288 // product that is covered by this License, on a durable physical
289 // medium customarily used for software interchange, for a price no
290 // more than your reasonable cost of physically performing this
291 // conveying of source, or (2) access to copy the
292 // Corresponding Source from a network server at no charge.
293 //
294 // c) Convey individual copies of the object code with a copy of the
295 // written offer to provide the Corresponding Source. This
296 // alternative is allowed only occasionally and noncommercially, and
297 // only if you received the object code with such an offer, in accord
298 // with subsection 6b.
299 //
300 // d) Convey the object code by offering access from a designated
301 // place (gratis or for a charge), and offer equivalent access to the
302 // Corresponding Source in the same way through the same place at no
303 // further charge. You need not require recipients to copy the
304 // Corresponding Source along with the object code. If the place to
305 // copy the object code is a network server, the Corresponding Source
306 // may be on a different server (operated by you or a third party)
307 // that supports equivalent copying facilities, provided you maintain
308 // clear directions next to the object code saying where to find the
309 // Corresponding Source. Regardless of what server hosts the
310 // Corresponding Source, you remain obligated to ensure that it is
311 // available for as long as needed to satisfy these requirements.
312 //
313 // e) Convey the object code using peer-to-peer transmission, provided
314 // you inform other peers where the object code and Corresponding
315 // Source of the work are being offered to the general public at no
316 // charge under subsection 6d.
317 //
318 // A separable portion of the object code, whose source code is excluded
319 //from the Corresponding Source as a System Library, need not be
320 //included in conveying the object code work.
321 //
322 // A "User Product" is either (1) a "consumer product", which means any
323 //tangible personal property which is normally used for personal, family,
324 //or household purposes, or (2) anything designed or sold for incorporation
325 //into a dwelling. In determining whether a product is a consumer product,
326 //doubtful cases shall be resolved in favor of coverage. For a particular
327 //product received by a particular user, "normally used" refers to a
328 //typical or common use of that class of product, regardless of the status
329 //of the particular user or of the way in which the particular user
330 //actually uses, or expects or is expected to use, the product. A product
331 //is a consumer product regardless of whether the product has substantial
332 //commercial, industrial or non-consumer uses, unless such uses represent
333 //the only significant mode of use of the product.
334 //
335 // "Installation Information" for a User Product means any methods,
336 //procedures, authorization keys, or other information required to install
337 //and execute modified versions of a covered work in that User Product from
338 //a modified version of its Corresponding Source. The information must
339 //suffice to ensure that the continued functioning of the modified object
340 //code is in no case prevented or interfered with solely because
341 //modification has been made.
342 //
343 // If you convey an object code work under this section in, or with, or
344 //specifically for use in, a User Product, and the conveying occurs as
345 //part of a transaction in which the right of possession and use of the
346 //User Product is transferred to the recipient in perpetuity or for a
347 //fixed term (regardless of how the transaction is characterized), the
348 //Corresponding Source conveyed under this section must be accompanied
349 //by the Installation Information. But this requirement does not apply
350 //if neither you nor any third party retains the ability to install
351 //modified object code on the User Product (for example, the work has
352 //been installed in ROM).
353 //
354 // The requirement to provide Installation Information does not include a
355 //requirement to continue to provide support service, warranty, or updates
356 //for a work that has been modified or installed by the recipient, or for
357 //the User Product in which it has been modified or installed. Access to a
358 //network may be denied when the modification itself materially and
359 //adversely affects the operation of the network or violates the rules and
360 //protocols for communication across the network.
361 //
362 // Corresponding Source conveyed, and Installation Information provided,
363 //in accord with this section must be in a format that is publicly
364 //documented (and with an implementation available to the public in
365 //source code form), and must require no special password or key for
366 //unpacking, reading or copying.
367 //
368 // 7. Additional Terms.
369 //
370 // "Additional permissions" are terms that supplement the terms of this
371 //License by making exceptions from one or more of its conditions.
372 //Additional permissions that are applicable to the entire Program shall
373 //be treated as though they were included in this License, to the extent
374 //that they are valid under applicable law. If additional permissions
375 //apply only to part of the Program, that part may be used separately
376 //under those permissions, but the entire Program remains governed by
377 //this License without regard to the additional permissions.
378 //
379 // When you convey a copy of a covered work, you may at your option
380 //remove any additional permissions from that copy, or from any part of
381 //it. (Additional permissions may be written to require their own
382 //removal in certain cases when you modify the work.) You may place
383 //additional permissions on material, added by you to a covered work,
384 //for which you have or can give appropriate copyright permission.
385 //
386 // Notwithstanding any other provision of this License, for material you
387 //add to a covered work, you may (if authorized by the copyright holders of
388 //that material) supplement the terms of this License with terms:
389 //
390 // a) Disclaiming warranty or limiting liability differently from the
391 // terms of sections 15 and 16 of this License; or
392 //
393 // b) Requiring preservation of specified reasonable legal notices or
394 // author attributions in that material or in the Appropriate Legal
395 // Notices displayed by works containing it; or
396 //
397 // c) Prohibiting misrepresentation of the origin of that material, or
398 // requiring that modified versions of such material be marked in
399 // reasonable ways as different from the original version; or
400 //
401 // d) Limiting the use for publicity purposes of names of licensors or
402 // authors of the material; or
403 //
404 // e) Declining to grant rights under trademark law for use of some
405 // trade names, trademarks, or service marks; or
406 //
407 // f) Requiring indemnification of licensors and authors of that
408 // material by anyone who conveys the material (or modified versions of
409 // it) with contractual assumptions of liability to the recipient, for
410 // any liability that these contractual assumptions directly impose on
411 // those licensors and authors.
412 //
413 // All other non-permissive additional terms are considered "further
414 //restrictions" within the meaning of section 10. If the Program as you
415 //received it, or any part of it, contains a notice stating that it is
416 //governed by this License along with a term that is a further
417 //restriction, you may remove that term. If a license document contains
418 //a further restriction but permits relicensing or conveying under this
419 //License, you may add to a covered work material governed by the terms
420 //of that license document, provided that the further restriction does
421 //not survive such relicensing or conveying.
422 //
423 // If you add terms to a covered work in accord with this section, you
424 //must place, in the relevant source files, a statement of the
425 //additional terms that apply to those files, or a notice indicating
426 //where to find the applicable terms.
427 //
428 // Additional terms, permissive or non-permissive, may be stated in the
429 //form of a separately written license, or stated as exceptions;
430 //the above requirements apply either way.
431 //
432 // 8. Termination.
433 //
434 // You may not propagate or modify a covered work except as expressly
435 //provided under this License. Any attempt otherwise to propagate or
436 //modify it is void, and will automatically terminate your rights under
437 //this License (including any patent licenses granted under the third
438 //paragraph of section 11).
439 //
440 // However, if you cease all violation of this License, then your
441 //license from a particular copyright holder is reinstated (a)
442 //provisionally, unless and until the copyright holder explicitly and
443 //finally terminates your license, and (b) permanently, if the copyright
444 //holder fails to notify you of the violation by some reasonable means
445 //prior to 60 days after the cessation.
446 //
447 // Moreover, your license from a particular copyright holder is
448 //reinstated permanently if the copyright holder notifies you of the
449 //violation by some reasonable means, this is the first time you have
450 //received notice of violation of this License (for any work) from that
451 //copyright holder, and you cure the violation prior to 30 days after
452 //your receipt of the notice.
453 //
454 // Termination of your rights under this section does not terminate the
455 //licenses of parties who have received copies or rights from you under
456 //this License. If your rights have been terminated and not permanently
457 //reinstated, you do not qualify to receive new licenses for the same
458 //material under section 10.
459 //
460 // 9. Acceptance Not Required for Having Copies.
461 //
462 // You are not required to accept this License in order to receive or
463 //run a copy of the Program. Ancillary propagation of a covered work
464 //occurring solely as a consequence of using peer-to-peer transmission
465 //to receive a copy likewise does not require acceptance. However,
466 //nothing other than this License grants you permission to propagate or
467 //modify any covered work. These actions infringe copyright if you do
468 //not accept this License. Therefore, by modifying or propagating a
469 //covered work, you indicate your acceptance of this License to do so.
470 //
471 // 10. Automatic Licensing of Downstream Recipients.
472 //
473 // Each time you convey a covered work, the recipient automatically
474 //receives a license from the original licensors, to run, modify and
475 //propagate that work, subject to this License. You are not responsible
476 //for enforcing compliance by third parties with this License.
477 //
478 // An "entity transaction" is a transaction transferring control of an
479 //organization, or substantially all assets of one, or subdividing an
480 //organization, or merging organizations. If propagation of a covered
481 //work results from an entity transaction, each party to that
482 //transaction who receives a copy of the work also receives whatever
483 //licenses to the work the party's predecessor in interest had or could
484 //give under the previous paragraph, plus a right to possession of the
485 //Corresponding Source of the work from the predecessor in interest, if
486 //the predecessor has it or can get it with reasonable efforts.
487 //
488 // You may not impose any further restrictions on the exercise of the
489 //rights granted or affirmed under this License. For example, you may
490 //not impose a license fee, royalty, or other charge for exercise of
491 //rights granted under this License, and you may not initiate litigation
492 //(including a cross-claim or counterclaim in a lawsuit) alleging that
493 //any patent claim is infringed by making, using, selling, offering for
494 //sale, or importing the Program or any portion of it.
495 //
496 // 11. Patents.
497 //
498 // A "contributor" is a copyright holder who authorizes use under this
499 //License of the Program or a work on which the Program is based. The
500 //work thus licensed is called the contributor's "contributor version".
501 //
502 // A contributor's "essential patent claims" are all patent claims
503 //owned or controlled by the contributor, whether already acquired or
504 //hereafter acquired, that would be infringed by some manner, permitted
505 //by this License, of making, using, or selling its contributor version,
506 //but do not include claims that would be infringed only as a
507 //consequence of further modification of the contributor version. For
508 //purposes of this definition, "control" includes the right to grant
509 //patent sublicenses in a manner consistent with the requirements of
510 //this License.
511 //
512 // Each contributor grants you a non-exclusive, worldwide, royalty-free
513 //patent license under the contributor's essential patent claims, to
514 //make, use, sell, offer for sale, import and otherwise run, modify and
515 //propagate the contents of its contributor version.
516 //
517 // In the following three paragraphs, a "patent license" is any express
518 //agreement or commitment, however denominated, not to enforce a patent
519 //(such as an express permission to practice a patent or covenant not to
520 //sue for patent infringement). To "grant" such a patent license to a
521 //party means to make such an agreement or commitment not to enforce a
522 //patent against the party.
523 //
524 // If you convey a covered work, knowingly relying on a patent license,
525 //and the Corresponding Source of the work is not available for anyone
526 //to copy, free of charge and under the terms of this License, through a
527 //publicly available network server or other readily accessible means,
528 //then you must either (1) cause the Corresponding Source to be so
529 //available, or (2) arrange to deprive yourself of the benefit of the
530 //patent license for this particular work, or (3) arrange, in a manner
531 //consistent with the requirements of this License, to extend the patent
532 //license to downstream recipients. "Knowingly relying" means you have
533 //actual knowledge that, but for the patent license, your conveying the
534 //covered work in a country, or your recipient's use of the covered work
535 //in a country, would infringe one or more identifiable patents in that
536 //country that you have reason to believe are valid.
537 //
538 // If, pursuant to or in connection with a single transaction or
539 //arrangement, you convey, or propagate by procuring conveyance of, a
540 //covered work, and grant a patent license to some of the parties
541 //receiving the covered work authorizing them to use, propagate, modify
542 //or convey a specific copy of the covered work, then the patent license
543 //you grant is automatically extended to all recipients of the covered
544 //work and works based on it.
545 //
546 // A patent license is "discriminatory" if it does not include within
547 //the scope of its coverage, prohibits the exercise of, or is
548 //conditioned on the non-exercise of one or more of the rights that are
549 //specifically granted under this License. You may not convey a covered
550 //work if you are a party to an arrangement with a third party that is
551 //in the business of distributing software, under which you make payment
552 //to the third party based on the extent of your activity of conveying
553 //the work, and under which the third party grants, to any of the
554 //parties who would receive the covered work from you, a discriminatory
555 //patent license (a) in connection with copies of the covered work
556 //conveyed by you (or copies made from those copies), or (b) primarily
557 //for and in connection with specific products or compilations that
558 //contain the covered work, unless you entered into that arrangement,
559 //or that patent license was granted, prior to 28 March 2007.
560 //
561 // Nothing in this License shall be construed as excluding or limiting
562 //any implied license or other defenses to infringement that may
563 //otherwise be available to you under applicable patent law.
564 //
565 // 12. No Surrender of Others' Freedom.
566 //
567 // If conditions are imposed on you (whether by court order, agreement or
568 //otherwise) that contradict the conditions of this License, they do not
569 //excuse you from the conditions of this License. If you cannot convey a
570 //covered work so as to satisfy simultaneously your obligations under this
571 //License and any other pertinent obligations, then as a consequence you may
572 //not convey it at all. For example, if you agree to terms that obligate you
573 //to collect a royalty for further conveying from those to whom you convey
574 //the Program, the only way you could satisfy both those terms and this
575 //License would be to refrain entirely from conveying the Program.
576 //
577 // 13. Use with the GNU Affero General Public License.
578 //
579 // Notwithstanding any other provision of this License, you have
580 //permission to link or combine any covered work with a work licensed
581 //under version 3 of the GNU Affero General Public License into a single
582 //combined work, and to convey the resulting work. The terms of this
583 //License will continue to apply to the part which is the covered work,
584 //but the special requirements of the GNU Affero General Public License,
585 //section 13, concerning interaction through a network will apply to the
586 //combination as such.
587 //
588 // 14. Revised Versions of this License.
589 //
590 // The Free Software Foundation may publish revised and/or new versions of
591 //the GNU General Public License from time to time. Such new versions will
592 //be similar in spirit to the present version, but may differ in detail to
593 //address new problems or concerns.
594 //
595 // Each version is given a distinguishing version number. If the
596 //Program specifies that a certain numbered version of the GNU General
597 //Public License "or any later version" applies to it, you have the
598 //option of following the terms and conditions either of that numbered
599 //version or of any later version published by the Free Software
600 //Foundation. If the Program does not specify a version number of the
601 //GNU General Public License, you may choose any version ever published
602 //by the Free Software Foundation.
603 //
604 // If the Program specifies that a proxy can decide which future
605 //versions of the GNU General Public License can be used, that proxy's
606 //public statement of acceptance of a version permanently authorizes you
607 //to choose that version for the Program.
608 //
609 // Later license versions may give you additional or different
610 //permissions. However, no additional obligations are imposed on any
611 //author or copyright holder as a result of your choosing to follow a
612 //later version.
613 //
614 // 15. Disclaimer of Warranty.
615 //
616 // THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
617 //APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
618 //HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
619 //OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
620 //THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
621 //PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
622 //IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
623 //ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
624 //
625 // 16. Limitation of Liability.
626 //
627 // IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
628 //WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
629 //THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
630 //GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
631 //USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
632 //DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
633 //PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
634 //EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
635 //SUCH DAMAGES.
636 //
637 // 17. Interpretation of Sections 15 and 16.
638 //
639 // If the disclaimer of warranty and limitation of liability provided
640 //above cannot be given local legal effect according to their terms,
641 //reviewing courts shall apply local law that most closely approximates
642 //an absolute waiver of all civil liability in connection with the
643 //Program, unless a warranty or assumption of liability accompanies a
644 //copy of the Program in return for a fee.
645 //
646 // END OF TERMS AND CONDITIONS
647 //
648 // How to Apply These Terms to Your New Programs
649 //
650 // If you develop a new program, and you want it to be of the greatest
651 //possible use to the public, the best way to achieve this is to make it
652 //free software which everyone can redistribute and change under these terms.
653 //
654 // To do so, attach the following notices to the program. It is safest
655 //to attach them to the start of each source file to most effectively
656 //state the exclusion of warranty; and each file should have at least
657 //the "copyright" line and a pointer to where the full notice is found.
658 //
659 // <one line to give the program's name and a brief idea of what it does.>
660 // Copyright (C) <year> <name of author>
661 //
662 // This program is free software: you can redistribute it and/or modify
663 // it under the terms of the GNU General Public License as published by
664 // the Free Software Foundation, either version 3 of the License, or
665 // (at your option) any later version.
666 //
667 // This program is distributed in the hope that it will be useful,
668 // but WITHOUT ANY WARRANTY; without even the implied warranty of
669 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
670 // GNU General Public License for more details.
671 //
672 // You should have received a copy of the GNU General Public License
673 // along with this program. If not, see <http://www.gnu.org/licenses/>.
674 //
675 //Also add information on how to contact you by electronic and paper mail.
676 //
677 // If the program does terminal interaction, make it output a short
678 //notice like this when it starts in an interactive mode:
679 //
680 // <program> Copyright (C) <year> <name of author>
681 // This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
682 // This is free software, and you are welcome to redistribute it
683 // under certain conditions; type `show c' for details.
684 //
685 //The hypothetical commands `show w' and `show c' should show the appropriate
686 //parts of the General Public License. Of course, your program's commands
687 //might be different; for a GUI interface, you would use an "about box".
688 //
689 // You should also get your employer (if you work as a programmer) or school,
690 //if any, to sign a "copyright disclaimer" for the program, if necessary.
691 //For more information on this, and how to apply and follow the GNU GPL, see
692 //<http://www.gnu.org/licenses/>.
693 //
694 // The GNU General Public License does not permit incorporating your program
695 //into proprietary programs. If your program is a subroutine library, you
696 //may consider it more useful to permit linking proprietary applications with
697 //the library. If this is what you want to do, use the GNU Lesser General
698 //Public License instead of this License. But first, please read
699 //<http://www.gnu.org/philosophy/why-not-lgpl.html>.
700 //-------------------------------------------------------------------------------------------------
701 //********************************************************************************
702 //This file contains functions that assist in the scheduling views (daily,
703 //weekly, monthly) and may be common between them.
704 //--------------------------------------------------------------------------------
705 require_once("menu.inc");
706 require_once("rscs.inc");
707 require_once("stime.inc");
708 require_once("t4.inc");
709 //
710 //--------------------------------------------------------------------------------
711 //Emits the standard login form, or else a welcome/login message if a user is
712 //logged in. This may appear on more than one scheduling view.
713 //
714 //Parameters:
715 // userinfo : FALSE if no user is logged in, otherwise an associative
716 // array with the user's information from the MySQL database.
717 // dt8 : Date, if specified to page.
718 // t4in : Time is specified to page.
719 // prevloginfail : TRUE if login has failed so that
720 //
721 function SCHEDVIEW_login_form_echo($userinfo, $dt8in, $t4in, $prevloginfail)
722 {
723 if ($userinfo === FALSE)
724 {
725 HTMLFORMAT_echo_push_nl("<form name=\"loginform\" method=\"post\" action=\"index.php\">");
726 HTMLFORMAT_echo_push_nl("<table border=\"0\" cellspacing=\"0\" cellpadding=\"4\" bgcolor=\"#"
727 . CONFIG_SCHED_COLOR_BACKGROUND . "\">");
728 HTMLFORMAT_echo_push_nl("<tr>");
729 HTMLFORMAT_echo_noop_nl("<td align=\"center\">Username</td>");
730 HTMLFORMAT_echo_pull_nl("</tr>");
731 HTMLFORMAT_echo_push_nl("<tr>");
732 HTMLFORMAT_echo_noop_nl("<td align=\"center\"><input type=\"text\" name=\"authuserid\" size=\"15\" maxlength=\"20\"></td>");
733 HTMLFORMAT_echo_pull_nl("</tr>");
734 HTMLFORMAT_echo_push_nl("<tr>");
735 HTMLFORMAT_echo_noop_nl("<td align=\"center\">Password</td>");
736 HTMLFORMAT_echo_pull_nl("</tr>");
737 HTMLFORMAT_echo_push_nl("<tr>");
738 HTMLFORMAT_echo_noop_nl("<td align=\"center\"><input type=\"password\" name=\"authuserpasswd\" size=\"16\" maxlength=\"20\"></td>");
739 HTMLFORMAT_echo_pull_nl("</tr>");
740 HTMLFORMAT_echo_push_nl("<tr valign=\"bottom\">");
741 HTMLFORMAT_echo_noop_nl("<td height=\"80%\" align=\"center\"><input align=\"BOTTOM\" type=\"submit\" name=\"submit\" value=\"Login\"></td>");
742 HTMLFORMAT_echo_pull_nl("</tr>");
743 HTMLFORMAT_echo_pull_nl("</table>");
744 if ($dt8in !== FALSE)
745 {
746 HTMLFORMAT_echo_noop_nl("<input type=\"hidden\" name=\"sddt\" value=\"" . $dt8in . "\">");
747 }
748 if ($t4in !== FALSE)
749 {
750 HTMLFORMAT_echo_noop_nl("<input type=\"hidden\" name=\"sdtim\" value=\"" . $t4in . "\">");
751 }
752 HTMLFORMAT_echo_pull_nl("</form>");
753 if ($prevloginfail)
754 {
755 HTMLFORMAT_echo_push_nl("<p>");
756 if (($dt8in === FALSE) && ($t4in === FALSE))
757 {
758 $baseurl = "userloginrecovery.php";
759 }
760 else if (($dt8in === FALSE) && ($t4in !== FALSE))
761 {
762 $baseurl = "userloginrecovery.php?sdtim=" . $t4in;
763 }
764 else if (($dt8in !== FALSE) && ($t4in === FALSE))
765 {
766 $baseurl = "userloginrecovery.php?sddt=" . $dt8in;
767 }
768 else
769 {
770 $baseurl = "userloginrecovery.php?sddt=" . $dt8in . "&sdtim=" . $t4in;
771 }
772
773 HTMLFORMAT_echo_noop_nl("&nbsp;<a href=\"" . $baseurl . "\">Trouble logging in?</a>&nbsp;<br><br>");
774 HTMLFORMAT_echo_pull_nl("</p>");
775 }
776 }
777 }
778 //
779 //--------------------------------------------------------------------------------
780 //Displays a mini-calendar at the top of the dayview screen.
781 //
782 //Parameters:
783 // $disp_year : The calendar to create year.
784 // $disp_month : The calendar to create month.
785 // $schedviewyear : The year of the date currently being displayed on the
786 // scheduler.
787 // $schedviewmonth : The month of the date currently being displayed on the
788 // scheduler.
789 // $schedviewday : The day of the date currently being displayed on the
790 // scheduler.
791 //
792 function SCHEDVIEW_dayview_calendar($disp_year, $disp_month, $schedviewyear, $schedviewmonth, $schedviewday)
793 {
794 global $GLOBAL_stime_year;
795 global $GLOBAL_stime_month;
796 global $GLOBAL_stime_day;
797
798 //echo " Display year is : " . $disp_year . " ";
799
800 //Figure out the name of the month (as opposed to number).
801 $month_string = DATEFUNC_string_month_long($disp_month);
802
803 //Figure out what day of the week the first day of this month occurs on.
804 $dow_first = DATEFUNC_intdayofweek_intdate($disp_year, $disp_month, 1);
805
806 //Figure out how many days are in this month.
807 $ndays = DATEFUNC_year_month_days($disp_year, $disp_month);
808
809 HTMLFORMAT_echo_push_nl("<table border=\"0\" frame=\"void\" cellspacing=\"2\">");
810 HTMLFORMAT_echo_push_nl("<tr>");
811
812 //Display the banner containing the month name and the year.
813 //
814 HTMLFORMAT_echo_noop_nl("<td colspan=\"7\" align=\"center\" bgcolor=\"#"
815 . CONFIG_GLOBAL_BANNERBAR_MINI_A . "\"><b>"
816 . $month_string . " " . $disp_year . "</b></td>");
817
818 HTMLFORMAT_echo_pull_nl("</tr>");
819
820 //Display the table containing the days of the week, Sun - Sat.
821 HTMLFORMAT_echo_push_nl("<tr>");
822 HTMLFORMAT_echo_noop_nl("<td align=\"center\" bgcolor=\"#" . CONFIG_GLOBAL_BANNERBAR_MINI_B . "\">S</td>");
823 HTMLFORMAT_echo_noop_nl("<td align=\"center\" bgcolor=\"#" . CONFIG_GLOBAL_BANNERBAR_MINI_B . "\">M</td>");
824 HTMLFORMAT_echo_noop_nl("<td align=\"center\" bgcolor=\"#" . CONFIG_GLOBAL_BANNERBAR_MINI_B . "\">T</td>");
825 HTMLFORMAT_echo_noop_nl("<td align=\"center\" bgcolor=\"#" . CONFIG_GLOBAL_BANNERBAR_MINI_B . "\">W</td>");
826 HTMLFORMAT_echo_noop_nl("<td align=\"center\" bgcolor=\"#" . CONFIG_GLOBAL_BANNERBAR_MINI_B . "\">T</td>");
827 HTMLFORMAT_echo_noop_nl("<td align=\"center\" bgcolor=\"#" . CONFIG_GLOBAL_BANNERBAR_MINI_B . "\">F</td>");
828 HTMLFORMAT_echo_noop_nl("<td align=\"center\" bgcolor=\"#" . CONFIG_GLOBAL_BANNERBAR_MINI_B . "\">S</td>");
829 HTMLFORMAT_echo_pull_nl("</tr>");
830
831 //Start up a table row.
832 HTMLFORMAT_echo_push_nl("<tr>");
833
834 //Put in the spacers that occur before the first day of the month.
835 for ($i=0; $i<$dow_first; $i++)
836 {
837 HTMLFORMAT_echo_noop_nl("<td align=\"right\">&nbsp;</td>");
838 }
839
840 //Write the days of the month.
841 for ($i=1; $i<=$ndays; $i++)
842 {
843 //Calculate Boolean variables to record if the day whose day number is being written is
844 //the current calendar day and/or the day currently being viewed in the scheduler.
845 //
846 if (($disp_year == $schedviewyear) && ($disp_month == $schedviewmonth) && ($i == $schedviewday))
847 $is_sched_view_day = TRUE;
848 else
849 $is_sched_view_day = FALSE;
850 //
851 if (($disp_year == $GLOBAL_stime_year) && ($disp_month == $GLOBAL_stime_month) && ($i == $GLOBAL_stime_day))
852 $is_cal_day = TRUE;
853 else
854 $is_cal_day = FALSE;
855
856
857 if ($is_sched_view_day && $is_cal_day)
858 {
859 //The day whose calendar number is being written is the same as the day being
860 //displayed in the scheduler, and the same as today's date.
861 //
862 HTMLFORMAT_echo_noop_nl("<td bgcolor=\"#" . CONFIG_SCHED_COLOR_MINICAL_CURVIEW . "\" align=\"right\"><a href=\"index.php?sddt="
863 .
864 sprintf("%04d", $disp_year)
865 .
866 sprintf("%02d", $disp_month)
867 .
868 sprintf("%02d", $i)
869 .
870 "\">"
871 .
872 "<font color=\"#000000\">" . sprintf("%d", $i) . "</font>" . "</a></td>");
873 }
874 else if ($is_sched_view_day)
875 {
876 //The day whose calendar number is being written is the same as the day being
877 //displayed in the scheduler.
878 //
879 HTMLFORMAT_echo_noop_nl("<td bgcolor=\"#" . CONFIG_SCHED_COLOR_MINICAL_VIEWONLY . "\" align=\"right\"><a href=\"index.php?sddt="
880 .
881 sprintf("%04d", $disp_year)
882 .
883 sprintf("%02d", $disp_month)
884 .
885 sprintf("%02d", $i)
886 .
887 "\">"
888 .
889 "<font color=\"#000000\">" . sprintf("%d", $i) . "</font>" . "</a></td>");
890 }
891 else if ($is_cal_day)
892 {
893 //The day being displayed is today.
894 //
895 HTMLFORMAT_echo_noop_nl("<td bgcolor=\"#" . CONFIG_SCHED_COLOR_MINICAL_CURONLY . "\" align=\"right\"><a href=\"index.php?sddt="
896 .
897 sprintf("%04d", $disp_year)
898 .
899 sprintf("%02d", $disp_month)
900 .
901 sprintf("%02d", $i)
902 .
903 "\">"
904 .
905 "<font color=\"#000000\">" . sprintf("%d", $i) . "</font>" . "</a></td>");
906 }
907 else
908 {
909 HTMLFORMAT_echo_noop_nl("<td align=\"right\"><a href=\"index.php?sddt="
910 .
911 sprintf("%04d", $disp_year)
912 .
913 sprintf("%02d", $disp_month)
914 .
915 sprintf("%02d", $i)
916 .
917 "\">"
918 .
919 sprintf("%d", $i) . "</a></td>");
920 }
921
922 //We end a row and start a new one under this set of circumstances.
923 // a)It is not the last day of the month we just printed.
924 // b)The day of the week on which the month starts plus the day we
925 // just printed mod 7 is zero.
926 if ($i != $ndays)
927 {
928 if ((($i + $dow_first) % 7) == 0)
929 {
930 HTMLFORMAT_echo_pull_nl("</tr>");
931 HTMLFORMAT_echo_push_nl("<tr>");
932 }
933 }
934 }
935
936 //Round out the final row that contains calendar days.
937 $i = $ndays + $dow_first;
938 while (($i % 7) != 0)
939 {
940 HTMLFORMAT_echo_noop_nl("<td align=\"right\">&nbsp;</td>");
941 $i++;
942 }
943
944 //Terminate the final row of calendar days.
945 HTMLFORMAT_echo_pull_nl("</tr>");
946
947 //Output bottom spacer rows so that every month created has six
948 //rows of days. In general, the number of rows created by days
949 //alone is:
950 //
951 // ( month_start_dayofweek + days_in_month + 6 ) div 7
952 //
953 //The shortest case is a February with 28 days where Feb 1 falls
954 //on a Sunday, i.e.
955 //
956 // (0 + 28 + 6) / 7 = 4
957 //
958 //Many months require six rows to display. This is the worst case.
959 //So, round it out to six rows.
960 $rows_due_to_cal_days = (int)(( $dow_first + $ndays + 6 ) / 7);
961
962 for ($i = $rows_due_to_cal_days + 1; $i <= 6; $i++)
963 {
964 HTMLFORMAT_echo_push_nl("<tr>");
965 HTMLFORMAT_echo_noop_nl("<td align=\"right\">&nbsp;</td>");
966 HTMLFORMAT_echo_noop_nl("<td align=\"right\">&nbsp;</td>");
967 HTMLFORMAT_echo_noop_nl("<td align=\"right\">&nbsp;</td>");
968 HTMLFORMAT_echo_noop_nl("<td align=\"right\">&nbsp;</td>");
969 HTMLFORMAT_echo_noop_nl("<td align=\"right\">&nbsp;</td>");
970 HTMLFORMAT_echo_noop_nl("<td align=\"right\">&nbsp;</td>");
971 HTMLFORMAT_echo_noop_nl("<td align=\"right\">&nbsp;</td>");
972 HTMLFORMAT_echo_pull_nl("</tr>");
973 }
974
975 //HTMLFORMAT_echo_pull_nl("</tr>");
976 HTMLFORMAT_echo_pull_nl("</table>");
977 }
978 //
979 //--------------------------------------------------------------------------------
980 //Emits a temporal navigation bar.
981 //
982 function SCHEDVIEW_temporal_navigation_bar(
983 $userinfo,
984 $dateyear, $datemonth, $dateday,
985 $timehour, $timemin,
986 $diff_time_perm_array,
987 $panel
988 )
989 {
990 global $GLOBAL_stime_year;
991 global $GLOBAL_stime_month;
992 global $GLOBAL_stime_day;
993 global $GLOBAL_stime_hour;
994 global $GLOBAL_stime_minute;
995
996 global $CONFIG_SCHED_DAY_PANELS;
997
998 //Table header emitted unconditionally.
999 HTMLFORMAT_echo_push_nl("<table width=\"100%\" border=\"1\" cellspacing=\"0\" cellpadding=\"4\" rules=\"rows\">");
1000
1001 //Table row emitted unconditionally.
1002 HTMLFORMAT_echo_push_nl("<tr>");
1003
1004 //"Go To" text emitted unconditionally.
1005 HTMLFORMAT_echo_push_nl("<td align=\"center\">");
1006 HTMLFORMAT_echo_noop_nl("<b>Go To:</b>");
1007 HTMLFORMAT_echo_pull_nl("</td>");
1008
1009 //-1 month text.
1010 //--------------
1011 //The previous month should be displayed unless we are already at the lower limit
1012 //of navigation.
1013 //
1014 DATEFUNC_offset_month($dateyear, $datemonth, -1, $prev_month_year, $prev_month_month, $prev_month_result_code);
1015
1016 if ($diff_time_perm_array[0])
1017 {
1018 //We should display the previous month's link.
1019 //
1020 HTMLFORMAT_echo_push_nl("<td align=\"center\">");
1021 //
1022 //We need to figure out what day of the month to use. There is the possibility
1023 //that we are going back to a month with fewer days.
1024 //
1025 $prev_month_days_in_month = DATEFUNC_year_month_days($prev_month_year, $prev_month_month);
1026
1027 if ($dateday > $prev_month_days_in_month)
1028 {
1029 $prev_month_day = $prev_month_days_in_month;
1030 }
1031 else
1032 {
1033 $prev_month_day = $dateday;
1034 }
1035
1036 HTMLFORMAT_echo_noop_nl("<a href=\"index.php?sddt="
1037 .
1038 sprintf("%04d", $prev_month_year)
1039 .
1040 sprintf("%02d", $prev_month_month)
1041 .
1042 sprintf("%02d", $prev_month_day)
1043 .
1044 "\">-1 month</a>");
1045 HTMLFORMAT_echo_pull_nl("</td>");
1046 }
1047 else
1048 {
1049 HTMLFORMAT_echo_push_nl("<td align=\"center\">");
1050 HTMLFORMAT_echo_noop_nl(STRFUNC_nbsp_padding("-1 month"));
1051 HTMLFORMAT_echo_pull_nl("</td>");
1052 }
1053
1054 //-1 week text.
1055 //-------------
1056 //The previous week should be displayed unless we are already at the lower
1057 //limit of navigation or viewability.
1058 //
1059 if ($diff_time_perm_array[1])
1060 {
1061 HTMLFORMAT_echo_push_nl("<td align=\"center\">");
1062
1063 DATEFUNC_one_week_ago($dateyear,
1064 $datemonth,
1065 $dateday,
1066 $year_oneweekago,
1067 $month_oneweekago,
1068 $day_oneweekago);
1069 HTMLFORMAT_echo_noop_nl("<a href=\"index.php?sddt="
1070 .
1071 sprintf("%04d", $year_oneweekago)
1072 .
1073 sprintf("%02d", $month_oneweekago)
1074 .
1075 sprintf("%02d", $day_oneweekago)
1076 .
1077 "\">-1 week</a>");
1078 HTMLFORMAT_echo_pull_nl("</td>");
1079 }
1080 else
1081 {
1082 HTMLFORMAT_echo_push_nl("<td align=\"center\">");
1083 HTMLFORMAT_echo_noop_nl(STRFUNC_nbsp_padding("-1 week"));
1084 HTMLFORMAT_echo_pull_nl("</td>");
1085 }
1086
1087 //-1 day text.
1088 //------------
1089 //The previous day should be displayed unless we are already at the lower
1090 //limit or navigation or viewability.
1091 //
1092 if ($diff_time_perm_array[2])
1093 {
1094 HTMLFORMAT_echo_push_nl("<td align=\"center\">");
1095
1096 DATEFUNC_one_day_ago($dateyear,
1097 $datemonth,
1098 $dateday,
1099 $year_onedayago,
1100 $month_onedayago,
1101 $day_onedayago);
1102 HTMLFORMAT_echo_noop_nl("<a href=\"index.php?sddt="
1103 .
1104 sprintf("%04d", $year_onedayago)
1105 .
1106 sprintf("%02d", $month_onedayago)
1107 .
1108 sprintf("%02d", $day_onedayago)
1109 .
1110 "\">-1 day</a>");
1111 HTMLFORMAT_echo_pull_nl("</td>");
1112 }
1113 else
1114 {
1115 HTMLFORMAT_echo_push_nl("<td align=\"center\">");
1116 HTMLFORMAT_echo_noop_nl(STRFUNC_nbsp_padding("-1 day"));
1117 HTMLFORMAT_echo_pull_nl("</td>");
1118 }
1119
1120 //Previous Panel
1121 //--------------
1122 //Previous panel that can be displayed. A "panel" is a view of a certain
1123 //set of hours.
1124 //
1125 if ($diff_time_perm_array[3])
1126 {
1127 //We can display the link. Calculate the previous panel.
1128 if ($panel > 0)
1129 {
1130 //Simplest case: just back off the panel.
1131 $prevpanel = $panel - 1;
1132 $prevpanel_year = $dateyear;
1133 $prevpanel_month = $datemonth;
1134 $prevpanel_day = $dateday;
1135 }
1136 else
1137 {
1138 //The panel is the first one. To back off, we need to change
1139 //the date backwards.
1140 $prevpanel = ((int)(count($CONFIG_SCHED_DAY_PANELS) / 2)) - 1;
1141 DATEFUNC_one_day_ago($dateyear,
1142 $datemonth,
1143 $dateday,
1144 $prevpanel_year,
1145 $prevpanel_month,
1146 $prevpanel_day);
1147 }
1148
1149 //We need to figure out for the panel what a good time to choose is
1150 //that will guarantee that this panel is the right one to display.
1151 $sdtim_string_prev_panel = TOD_panel_center_t4($prevpanel);
1152
1153 //Form the URL reference.
1154 HTMLFORMAT_echo_push_nl("<td align=\"center\">");
1155 HTMLFORMAT_echo_noop_nl("<a href=\"index.php?sddt="
1156 .
1157 sprintf("%04d", $prevpanel_year)
1158 .
1159 sprintf("%02d", $prevpanel_month)
1160 .
1161 sprintf("%02d", $prevpanel_day)
1162 .
1163 "&amp;sdtim="
1164 .
1165 $sdtim_string_prev_panel
1166 .
1167 "\">-hours</a>");
1168 HTMLFORMAT_echo_pull_nl("</td>");
1169 }
1170 else
1171 {
1172 //We cannot display a link to the previous because it would violate
1173 //calendaring or viewability rules. Just use a placeholder.
1174 //
1175 HTMLFORMAT_echo_push_nl("<td align=\"center\">");
1176 HTMLFORMAT_echo_noop_nl(STRFUNC_nbsp_padding("-hours"));
1177 HTMLFORMAT_echo_pull_nl("</td>");
1178 }
1179
1180
1181 //Today, now text.
1182 HTMLFORMAT_echo_push_nl("<td align=\"center\">");
1183 HTMLFORMAT_echo_noop_nl("<a href=\"index.php?todaynow=1\">Today, Now</a>");
1184 HTMLFORMAT_echo_pull_nl("</td>");
1185
1186
1187 //Next Panel
1188 //----------
1189 //Next panel that can be displayed. A "panel" is a view of a certain
1190 //set of hours.
1191 //
1192 if ($diff_time_perm_array[4])
1193 {
1194 $npanels = ((int)(count($CONFIG_SCHED_DAY_PANELS) / 2));
1195
1196 //We can display the link. Calculate the next panel.
1197 if ($panel < ($npanels - 1))
1198 {
1199 //Simplest case: just add to the panel.
1200 $nextpanel = $panel + 1;
1201 $nextpanel_year = $dateyear;
1202 $nextpanel_month = $datemonth;
1203 $nextpanel_day = $dateday;
1204 }
1205 else
1206 {
1207 //The panel is the last one. To add, we need to change
1208 //the date forwards.
1209 $nextpanel = 0;
1210 DATEFUNC_one_day_future($dateyear,
1211 $datemonth,
1212 $dateday,
1213 $nextpanel_year,
1214 $nextpanel_month,
1215 $nextpanel_day);
1216 }
1217
1218 //We need to figure out for the panel what a good time to choose is
1219 //that will guarantee that this panel is the right one to display.
1220 $sdtim_string_next_panel = TOD_panel_center_t4($nextpanel);
1221
1222 //Form the URL reference.
1223 HTMLFORMAT_echo_push_nl("<td align=\"center\">");
1224 HTMLFORMAT_echo_noop_nl("<a href=\"index.php?sddt="
1225 .
1226 sprintf("%04d", $nextpanel_year)
1227 .
1228 sprintf("%02d", $nextpanel_month)
1229 .
1230 sprintf("%02d", $nextpanel_day)
1231 .
1232 "&amp;sdtim="
1233 .
1234 $sdtim_string_next_panel
1235 .
1236 "\">+hours</a>");
1237 HTMLFORMAT_echo_pull_nl("</td>");
1238 }
1239 else
1240 {
1241 //We cannot display a link to the previous because it would violate
1242 //calendaring or viewability rules. Just use a placeholder.
1243 //
1244 HTMLFORMAT_echo_push_nl("<td align=\"center\">");
1245 HTMLFORMAT_echo_noop_nl(STRFUNC_nbsp_padding("+hours"));
1246 HTMLFORMAT_echo_pull_nl("</td>");
1247 }
1248
1249
1250 //+1 day text.
1251 //------------
1252 //The next day should be displayed unless we are already at the upper
1253 //limit of navigation or viewability.
1254 //
1255 if ($diff_time_perm_array[5])
1256 {
1257 HTMLFORMAT_echo_push_nl("<td align=\"center\">");
1258
1259 DATEFUNC_one_day_future($dateyear,
1260 $datemonth,
1261 $dateday,
1262 $year_onedayfuture,
1263 $month_onedayfuture,
1264 $day_onedayfuture);
1265 HTMLFORMAT_echo_noop_nl("<a href=\"index.php?sddt="
1266 .
1267 sprintf("%04d", $year_onedayfuture)
1268 .
1269 sprintf("%02d", $month_onedayfuture)
1270 .
1271 sprintf("%02d", $day_onedayfuture)
1272 .
1273 "\">+1 day</a>");
1274 HTMLFORMAT_echo_pull_nl("</td>");
1275 }
1276 else
1277 {
1278 HTMLFORMAT_echo_push_nl("<td align=\"center\">");
1279 HTMLFORMAT_echo_noop_nl(STRFUNC_nbsp_padding("+1 day"));
1280 HTMLFORMAT_echo_pull_nl("</td>");
1281 }
1282
1283 //+1 week text.
1284 //-------------
1285 //The next week should be displayed unless we are already at the upper
1286 //limit of navigation or viewability.
1287 //
1288 if ($diff_time_perm_array[6])
1289 {
1290 HTMLFORMAT_echo_push_nl("<td align=\"center\">");
1291
1292 DATEFUNC_one_week_future($dateyear,
1293 $datemonth,
1294 $dateday,
1295 $year_oneweekfuture,
1296 $month_oneweekfuture,
1297 $day_oneweekfuture);
1298 HTMLFORMAT_echo_noop_nl("<a href=\"index.php?sddt="
1299 .
1300 sprintf("%04d", $year_oneweekfuture)
1301 .
1302 sprintf("%02d", $month_oneweekfuture)
1303 .
1304 sprintf("%02d", $day_oneweekfuture)
1305 .
1306 "\">+1 week</a>");
1307 HTMLFORMAT_echo_pull_nl("</td>");
1308 }
1309 else
1310 {
1311 HTMLFORMAT_echo_push_nl("<td align=\"center\">");
1312 HTMLFORMAT_echo_noop_nl(STRFUNC_nbsp_padding("+1 week"));
1313 HTMLFORMAT_echo_pull_nl("</td>");
1314 }
1315
1316
1317 //+1 month text.
1318 //--------------
1319 //The next month should be displayed unless we are already at the upper limit
1320 //of navigation.
1321 //
1322 DATEFUNC_offset_month($dateyear, $datemonth, 1, $next_month_year, $next_month_month, $next_month_result_code);
1323
1324 if ($diff_time_perm_array[7])
1325 {
1326 //We should display the next month's link.
1327 //
1328 HTMLFORMAT_echo_push_nl("<td align=\"center\">");
1329 //
1330 //We need to figure out what day of the month to use. There is the possibility
1331 //that we are going forward to a month with fewer days.
1332 //
1333 $next_month_days_in_month = DATEFUNC_year_month_days($next_month_year, $next_month_month);
1334
1335 if ($dateday > $next_month_days_in_month)
1336 {
1337 $next_month_day = $next_month_days_in_month;
1338 }
1339 else
1340 {
1341 $next_month_day = $dateday;
1342 }
1343
1344 HTMLFORMAT_echo_noop_nl("<a href=\"index.php?sddt="
1345 .
1346 sprintf("%04d", $next_month_year)
1347 .
1348 sprintf("%02d", $next_month_month)
1349 .
1350 sprintf("%02d", $next_month_day)
1351 .
1352 "\">+1 month</a>");
1353 HTMLFORMAT_echo_pull_nl("</td>");
1354 }
1355 else
1356 {
1357 HTMLFORMAT_echo_push_nl("<td align=\"center\">");
1358 HTMLFORMAT_echo_noop_nl(STRFUNC_nbsp_padding("+1 month"));
1359 HTMLFORMAT_echo_pull_nl("</td>");
1360 }
1361
1362
1363 //Padding to balance the Go To text.
1364 HTMLFORMAT_echo_push_nl("<td align=\"center\">");
1365 HTMLFORMAT_echo_noop_nl("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
1366 HTMLFORMAT_echo_pull_nl("</td>");
1367
1368 HTMLFORMAT_echo_pull_nl("</tr>");
1369 HTMLFORMAT_echo_push_nl("<tr>");
1370
1371 //Date Displayed information.
1372 HTMLFORMAT_echo_noop_nl("<td colspan=\"11\" align=\"center\"><b>Flight Schedule for "
1373 .
1374 DATEFUNC_stdlongdate_w_dow( $dateyear, $datemonth, $dateday)
1375 . "</b></td>");
1376
1377 HTMLFORMAT_echo_pull_nl("</tr>");
1378
1379 //Table footer emitted unconditionally.
1380 HTMLFORMAT_echo_pull_nl("</table>");
1381 }
1382 //--------------------------------------------------------------------------------
1383 //Emits the default view page navigation bar.
1384 //
1385 function SCHEDVIEW_dayview_page_navigation_bar($userinfo, $sessioninfo, $dt8in, $t4in)
1386 {
1387 //Grab the menu entries.
1388 if ($sessioninfo === FALSE)
1389 $menu_choices = MENU_menu_gen($userinfo, 0, $dt8in, $t4in, "index.php");
1390 else
1391 $menu_choices = MENU_menu_gen($userinfo, $sessioninfo["menulvl"], $dt8in, $t4in, "index.php");
1392
1393 $n = count($menu_choices);
1394
1395 for ($i=0; $i<$n; $i+=3)
1396 {
1397 if ($menu_choices[$i] == "H")
1398 {
1399 HTMLFORMAT_echo_noop_nl("&nbsp;&nbsp;<b>" . $menu_choices[$i+1] . "</b>&nbsp;&nbsp;<br>");
1400 }
1401 else
1402 {
1403 HTMLFORMAT_echo_noop_nl("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href=\""
1404 . $menu_choices[$i+2] . "\">" . $menu_choices[$i+1] . "</a>&nbsp;&nbsp;<br>");
1405 }
1406 }
1407 }
1408 //
1409 //
1410 //----------------------------------------------------------------------------------------------------
1411 //Given the start hour and end-hour for a panel, calculates the number of time columns involved.
1412 //For example, if the start hour is 8 and the end hour is 10, the columns are:
1413 // a) 8:00 - 8:30
1414 // b) 8:30 - 9:00
1415 // c) 9:00 - 9:30
1416 // d) 9:30 - 10:00
1417 // e)10:00 - 10:30
1418 // f)10:30 - 11:00
1419 //
1420 function SCHEDVIEW_panel_n_time_columns($start_hour_in, $end_hour_in)
1421 {
1422 $rv = ($end_hour_in - $start_hour_in + 1) * 2;
1423
1424 return($rv);
1425 }
1426 //
1427 //----------------------------------------------------------------------------------------------------
1428 //Decorates a list of reservation information with additional fields that help with
1429 //quickness. The fields are:
1430 //
1431 // emitted
1432 // Set to 0. Will be used later as the reservation is displayed.
1433 //
1434 // finsttimefloor
1435 // The reservation stime start (for a flight instructor), or the left panel time if
1436 // the time is clipped.
1437 //
1438 // finsttimefloorint
1439 // An integer corresponding to the first half-hour time slot of the appointment (clipped).
1440 // Zero if not applicable.
1441 //
1442 // finsttimeceiling
1443 // The reservation stime end (for a flight instructor), or the right panel time if
1444 // the time is clipped.
1445 //
1446 // finsttimeceilingint
1447 // An integer corresponding to one past the last half-hour time slot of the appointment (clipped).
1448 // Zero if not applicable. This may be 48.
1449 //
1450 // finsttimeleftclip
1451 // 1 if the displayed flight instructor appt left time was clipped on the left, or 0
1452 // if not.
1453 //
1454 // finsttimerightclip
1455 // 1 if the displayed flight instructor appt right time was clipped on the right, or 0
1456 // if not.
1457 //
1458 // acftsimtimefloor
1459 // The reservation stime start (for an aircraft or simulator), or the left panel time if
1460 // the time is clipped.
1461 //
1462 // acftsimtimefloorint
1463 // An integer corresponding to the first half-hour time slot of the appointment (clipped).
1464 // Zero if not applicable.
1465 //
1466 // acftsimtimeceiling
1467 // The reservation stime end (for an aircraft or simulator), or the right panel time if
1468 // the time is clipped.
1469 //
1470 // acftsimtimeceilingint
1471 // An integer corresponding to one past the last half-hour time slot of the appointment (clipped).
1472 // Zero if not applicable.
1473 //
1474 // acftsimtimeleftclip
1475 // 1 if the displayed aircraft or simulator appt left time was clipped on the left, or 0
1476 // if not.
1477 //
1478 // acftsimttimerightclip
1479 // 1 if the displayed aircraft or simulator right time was clipped on the right, or 0
1480 // if not.
1481 //
1482 function SCHEDVIEW_resv_list_decorate(&$flight_inst_data_array, $panel_left_stime, $panel_right_stime)
1483 {
1484 //Return if there is an empty array.
1485 //
1486 if ($flight_inst_data_array === FALSE)
1487 return;
1488
1489 $n = count($flight_inst_data_array);
1490 for ($i=0; $i<$n; $i++)
1491 {
1492 //---------------------------------------------------------------------------------
1493 //Emitted -- whether the reservation has been output yet.
1494 //---------------------------------------------------------------------------------
1495 $flight_inst_data_array[$i]["emitted"] = 0;
1496 //
1497 //---------------------------------------------------------------------------------
1498 //Flight instructor left.
1499 //---------------------------------------------------------------------------------
1500 if (strlen($flight_inst_data_array[$i]["finsttimestart"]))
1501 {
1502 //Do the clipping, if applicable.
1503 if (strcmp($flight_inst_data_array[$i]["finsttimestart"], $panel_left_stime) < 0)
1504 {
1505 //Clipping is appropriate.
1506 $flight_inst_data_array[$i]["finsttimefloor"] = $panel_left_stime;
1507 $flight_inst_data_array[$i]["finsttimefloorint"] = STIME_T4_lb_int($panel_left_stime);
1508 $flight_inst_data_array[$i]["finsttimeleftclip"] = 1;
1509 }
1510 else
1511 {
1512 //Clipping is not appropriate.
1513 $flight_inst_data_array[$i]["finsttimefloor"] = $flight_inst_data_array[$i]["finsttimestart"];
1514 $flight_inst_data_array[$i]["finsttimefloorint"] = STIME_T4_lb_int($flight_inst_data_array[$i]["finsttimestart"]);
1515 $flight_inst_data_array[$i]["finsttimeleftclip"] = 0;
1516 }
1517 }
1518 else
1519 {
1520 //Floor and floor int are meaningless.
1521 $flight_inst_data_array[$i]["finsttimefloor"] = "";
1522 $flight_inst_data_array[$i]["finsttimefloorint"] = 0;
1523 $flight_inst_data_array[$i]["finsttimeleftclip"] = 0;
1524 }
1525
1526 //---------------------------------------------------------------------------------
1527 //Flight instructor right.
1528 //---------------------------------------------------------------------------------
1529 if (strlen($flight_inst_data_array[$i]["finsttimeend"]))
1530 {
1531 //Do the clipping, if applicable.
1532 if (strcmp($flight_inst_data_array[$i]["finsttimeend"], $panel_right_stime) > 0)
1533 {
1534 //Clipping is appropriate.
1535 $flight_inst_data_array[$i]["finsttimeceiling"] = $panel_right_stime;
1536 $flight_inst_data_array[$i]["finsttimeceilingint"] = STIME_T4_lb_int($panel_right_stime);
1537
1538 //Adjust for a clip to midnight.
1539 if ($flight_inst_data_array[$i]["finsttimeceilingint"] == 0)
1540 $flight_inst_data_array[$i]["finsttimeceilingint"] = 48;
1541
1542 $flight_inst_data_array[$i]["finsttimerightclip"] = 1;
1543 }
1544 else
1545 {
1546 //Clipping is not appropriate.
1547 $flight_inst_data_array[$i]["finsttimeceiling"] = $flight_inst_data_array[$i]["finsttimeend"];
1548 $flight_inst_data_array[$i]["finsttimeceilingint"] = STIME_T4_lb_int($flight_inst_data_array[$i]["finsttimeend"]);
1549
1550 //Adjust for a reservation that ends at midnight.
1551 if ($flight_inst_data_array[$i]["finsttimeceilingint"] == 0)
1552 $flight_inst_data_array[$i]["finsttimeceilingint"] = 48;
1553
1554 $flight_inst_data_array[$i]["finsttimerightclip"] = 0;
1555 }
1556 }
1557 else
1558 {
1559 //Floor and floor int are meaningless.
1560 $flight_inst_data_array[$i]["finsttimeceiling"] = "";
1561 $flight_inst_data_array[$i]["finsttimeceilingint"] = 0;
1562 $flight_inst_data_array[$i]["finsttimerightclip"] = 0;
1563 }
1564
1565 //---------------------------------------------------------------------------------
1566 //Aircraft/simulator left.
1567 //---------------------------------------------------------------------------------
1568 if (strlen($flight_inst_data_array[$i]["acftsimtimestart"]))
1569 {
1570 //Do the clipping, if applicable.
1571 if (strcmp($flight_inst_data_array[$i]["acftsimtimestart"], $panel_left_stime) < 0)
1572 {
1573 //Clipping is appropriate.
1574 $flight_inst_data_array[$i]["acftsimtimefloor"] = $panel_left_stime;
1575 $flight_inst_data_array[$i]["acftsimtimefloorint"] = STIME_T4_lb_int($panel_left_stime);
1576 $flight_inst_data_array[$i]["acftsimtimeleftclip"] = 1;
1577 }
1578 else
1579 {
1580 //Clipping is not appropriate.
1581 $flight_inst_data_array[$i]["acftsimtimefloor"] = $flight_inst_data_array[$i]["acftsimtimestart"];
1582 $flight_inst_data_array[$i]["acftsimtimefloorint"] = STIME_T4_lb_int($flight_inst_data_array[$i]["acftsimtimestart"]);
1583 $flight_inst_data_array[$i]["acftsimtimeleftclip"] = 0;
1584 }
1585 }
1586 else
1587 {
1588 //Floor and floor int are meaningless.
1589 $flight_inst_data_array[$i]["acftsimtimefloor"] = "";
1590 $flight_inst_data_array[$i]["acftsimtimefloorint"] = 0;
1591 $flight_inst_data_array[$i]["acftsimtimeleftclip"] = 0;
1592 }
1593
1594 //---------------------------------------------------------------------------------
1595 //Aircraft/simulator right.
1596 //---------------------------------------------------------------------------------
1597 if (strlen($flight_inst_data_array[$i]["acftsimtimeend"]))
1598 {
1599 //Do the clipping, if applicable.
1600 if (strcmp($flight_inst_data_array[$i]["acftsimtimeend"], $panel_right_stime) > 0)
1601 {
1602 //Clipping is appropriate.
1603 $flight_inst_data_array[$i]["acftsimtimeceiling"] = $panel_right_stime;
1604 $flight_inst_data_array[$i]["acftsimtimeceilingint"] = STIME_T4_lb_int($panel_right_stime);
1605
1606 //Adjust for a clip to midnight.
1607 if ($flight_inst_data_array[$i]["acftsimtimeceilingint"] == 0)
1608 $flight_inst_data_array[$i]["acftsimtimeceilingint"] = 48;
1609
1610 $flight_inst_data_array[$i]["acftsimtimerightclip"] = 1;
1611 }
1612 else
1613 {
1614 //Clipping is not appropriate.
1615 $flight_inst_data_array[$i]["acftsimtimeceiling"] = $flight_inst_data_array[$i]["acftsimtimeend"];
1616 $flight_inst_data_array[$i]["acftsimtimeceilingint"] = STIME_T4_lb_int($flight_inst_data_array[$i]["acftsimtimeend"]);
1617
1618 //Adjust for a reservation that ends at midnight.
1619 if ($flight_inst_data_array[$i]["acftsimtimeceilingint"] == 0)
1620 $flight_inst_data_array[$i]["acftsimtimeceilingint"] = 48;
1621
1622 $flight_inst_data_array[$i]["acftsimtimerightclip"] = 0;
1623 }
1624 }
1625 else
1626 {
1627 //Floor and floor int are meaningless.
1628 $flight_inst_data_array[$i]["acftsimtimeceiling"] = "";
1629 $flight_inst_data_array[$i]["acftsimtimeceilingint"] = 0;
1630 $flight_inst_data_array[$i]["acftsimtimerightclip"] = 0;
1631 }
1632 }
1633 }
1634 //
1635 //----------------------------------------------------------------------------------------------------
1636 //Returns TRUE if the reservation passed has time intersection with at least one element of the
1637 //array for the aircraft or simulator time, or FALSE if not.
1638 //
1639 function SCHEDVIEW_resv_finst_array_intersection($array_in, $element_in)
1640 {
1641 //echo "<pre>\n----------\nIn Intersection Func\n---------\n";
1642 //echo "Array in:\n---------";
1643 //print_r($array_in);
1644 //echo "\nElement in:\n---------";
1645 //print_r($element_in);
1646 //echo "\n----------\n";
1647
1648 if (($array_in === FALSE) || ($element_in === FALSE))
1649 {
1650 //echo "\nReturning FALSE\n---------\n</pre>\n";
1651 return(FALSE);
1652 }
1653
1654 for ($i = 0; $i < count($array_in); $i++)
1655 {
1656 if (
1657 (strcmp($array_in[$i]["finsttimestart"], $element_in["finsttimeend"]) < 0)
1658 &&
1659 (strcmp($array_in[$i]["finsttimeend"], $element_in["finsttimestart"]) > 0)
1660 )
1661 //echo "\nReturning TRUE\n---------\n</pre>\n";
1662 return(TRUE);
1663 }
1664
1665 //No collision found, return FALSE.
1666 //echo "\nReturning FALSE\n---------\n</pre>\n";
1667 return(FALSE);
1668 }
1669 //----------------------------------------------------------------------------------------------------
1670 //Returns TRUE if the reservation passed has time intersection with at least one element of the
1671 //array for the aircraft or simulator time, or FALSE if not.
1672 //
1673 function SCHEDVIEW_resv_actfsim_array_intersection($array_in, $element_in)
1674 {
1675 //echo "<pre>\n----------\nIn Intersection Func\n---------\n";
1676 //echo "Array in:\n---------";
1677 //print_r($array_in);
1678 //echo "\nElement in:\n---------";
1679 //print_r($element_in);
1680 //echo "\n----------\n";
1681
1682 if (($array_in === FALSE) || ($element_in === FALSE))
1683 {
1684 //echo "\nReturning FALSE\n---------\n</pre>\n";
1685 return(FALSE);
1686 }
1687
1688 for ($i = 0; $i < count($array_in); $i++)
1689 {
1690 if (
1691 (strcmp($array_in[$i]["acftsimtimestart"], $element_in["acftsimtimeend"]) < 0)
1692 &&
1693 (strcmp($array_in[$i]["acftsimtimeend"], $element_in["acftsimtimestart"]) > 0)
1694 )
1695 //echo "\nReturning TRUE\n---------\n</pre>\n";
1696 return(TRUE);
1697 }
1698
1699 //No collision found, return FALSE.
1700 //echo "\nReturning FALSE\n---------\n</pre>\n";
1701 return(FALSE);
1702 }
1703 //----------------------------------------------------------------------------------------------------
1704 //Generates HTML lines corresponding to the left resource area description area. This will generally
1705 //be a single <td> cell with a rowspan potentially > 1.
1706 //
1707 //The returned value is an array of lines.
1708 //
1709 function SCHEDVIEW_do_left_resource_title_area( $userinfo_in,
1710 $rscs_rec_in,
1711 $resv_recs_in,
1712 $panel_low_hour_in,
1713 $panel_high_hour_in,
1714 $resourcecolumnwidth_in,
1715 $schedcolumnwidth_in,
1716 $rowspan_in,
1717 &$queued_html_lines)
1718 {
1719 $queued_html_lines[] = "<td colspan=\"1\" rowspan=\""
1720 . $rowspan_in
1721 . "\" width=\"" . $resourcecolumnwidth_in . "%\" nowrap bgcolor=\"#"
1722 . CONFIG_SCHED_COLOR_DSMAT_THEAD
1723 . "\" onClick=\"javascript:window.location='http://www.pageresource.com/jscript/newpage.htm';\" "
1724 . "onmouseover=\"javascript:window.status='Comment: "
1725 . STRFUNC_js_escape_sglquote_notrunc($rscs_rec_in["longdesc"])
1726 . "';\" onmouseout=\"javascript:window.status='';\" "
1727 . "title=\""
1728 . STRFUNC_html_title_escape_dblquote_notrunc($rscs_rec_in["longdesc"])
1729 . "\""
1730 . ">";
1731 $queued_html_lines[] = "&nbsp;"
1732 . $rscs_rec_in["shortdesc"]
1733 . "&nbsp;";
1734 $queued_html_lines[] = "</td>";
1735
1736 //echo "<pre>\n";
1737 //echo "In SCHEDVIEW_do_left_resource_title_area() ...\n";
1738 //print_r($queued_html_lines2);
1739 //echo "----------------------------\n</pre>\n";
1740 }
1741 //
1742 //----------------------------------------------------------------------------------------------------
1743 //Does the terminator (white area) bar beneath the last row of banner, active, and/or standby
1744 //reservations. The item returned is an array of HTML lines. This function will always produce
1745 //an array of lines, as it is always possible to produce the terminator area.
1746 //
1747 function SCHEDVIEW_form_resource_scheduling_area_terminator_bar( $userinfo_in,
1748 $rscs_rec_in,
1749 $resv_recs_in,
1750 $panel_low_hour_in,
1751 $panel_high_hour_in,
1752 $resourcecolumnwidth_in,
1753 $schedcolumnwidth_in,
1754 &$sched_right_table_rows,
1755 &$queued_html_lines)
1756 {
1757 for ($i=$panel_low_hour_in * 2; $i<=(($panel_high_hour_in * 2) + 1); $i++)
1758 {
1759 $queued_html_lines[] = "<td align=\"center\" width=\""
1760 . $schedcolumnwidth_in . "%\" bgcolor=\"#"
1761 . CONFIG_SCHED_COLOR_DSMAT_RIDLE
1762 . "\" onClick=\"window.location='http://www.google.com?testpar=30'\">";
1763 $queued_html_lines[] = "&nbsp;";
1764 $queued_html_lines[] = "</td>";
1765 }
1766
1767 //We've added a full row.
1768 $sched_right_table_rows++;
1769 }
1770 //
1771 //----------------------------------------------------------------------------------------------------
1772 //Does the rows corresponding to the banner reservations for a flight instructor.
1773 //
1774 function SCHEDVIEW_form_resource_scheduling_area_finst_banner( $userinfo_in,
1775 $rscs_rec_in,
1776 $banner_reservations_in,
1777 $panel_low_hour_in,
1778 $panel_high_hour_in,
1779 $resourcecolumnwidth_in,
1780 $schedcolumnwidth_in,
1781 $can_view_banner_reservations_in,
1782 &$sched_right_table_rows,
1783 &$queued_html_rows)
1784 {
1785 $done = FALSE;
1786 $grabpoint = 0;
1787 $panel_low_hour_in_int = $panel_low_hour_in * 2;
1788 $panel_high_hour_in_int_limit = ($panel_high_hour_in + 1) * 2;
1789
1790 while (!$done)
1791 {
1792 //Due to the loop, need to unset the display set to keep it from accumulating too many
1793 //elements.
1794 if (isset($display_set))
1795 unset($display_set);
1796
1797 //Grab one element. This is our trial set to start with.
1798 $display_set[] = $banner_reservations_in[$grabpoint];
1799
1800 //Next grabpoint.
1801 $grabpoint++;
1802
1803 //Keep on grabbing until there is a set intersection or we're out of things to grab.
1804 while (
1805 ($grabpoint < count($banner_reservations_in))
1806 &&
1807 (! SCHEDVIEW_resv_finst_array_intersection($display_set, $banner_reservations_in[$grabpoint]))
1808 )
1809 {
1810 $display_set[] = $banner_reservations_in[$grabpoint];
1811 $grabpoint ++;
1812 }
1813
1814 //If we can't go further grabbing, we're done.
1815 if ($grabpoint >= count($banner_reservations_in))
1816 $done = TRUE;
1817
1818 //Display the set that was collected for debugging, if necessary.
1819 //echo "<pre>\n----------\nDisplay Set\n----------\n";
1820 //print_r($display_set);
1821 //echo "\n--------\n";
1822
1823 //Our display set now contains a set of records to display. We know there is at least one,
1824 //we know the times don't overlap, and we know that these are in ascending order of start time
1825 //(due to the SQL query). Therefore, we can proceed in order.
1826 $cur_output_time_int = $panel_low_hour_in_int;
1827 $cur_display_record = 0;
1828 //$panel_high_hour_in_int_limit = ($panel_high_hour_in + 1) * 2;
1829
1830 while ($cur_display_record < count($display_set))
1831 {
1832 //Space out the blank cells until the first reservation or next reservation.
1833 while($cur_output_time_int < $display_set[$cur_display_record]["finsttimefloorint"])
1834 {
1835 $html_lines[] = "<td>&nbsp;</td>";
1836 $cur_output_time_int ++;
1837 }
1838
1839 //Get the text that should be displayed for the reservation.
1840 if ($userinfo_in === FALSE)
1841 {
1842 //echo " Clause 1 ";
1843 $box_string = "&nbsp;";
1844 }
1845 else
1846 {
1847 //Try to get the user name.
1848 //
1849 //echo "\n<pre>\n";
1850 //print_r($display_set[$cur_display_record]);
1851 //print_r($display_set[$cur_display_record]["useridx"]);
1852 //echo "\n</pre>\n";
1853
1854 if ($display_set[$cur_display_record]["useridx"] > 0)
1855 {
1856 $temp_user_info = USRS_retrieve_by_idx($display_set[$cur_display_record]["useridx"]);
1857 if ($temp_user_info === FALSE)
1858 {
1859 //echo " Clause 2 ";
1860 $box_string = "&nbsp;";
1861 }
1862 else
1863 {
1864 //echo " Clause 3 ";
1865 $box_string = $temp_user_info["lname"]
1866 .
1867 " ("
1868 .
1869 (string)($display_set[$cur_display_record]["idx"])
1870 .
1871 ")";
1872 }
1873 }
1874 else
1875 {
1876 //echo " Clause 4 ";
1877 $box_string = "&nbsp;";
1878 }
1879 }
1880
1881 //Spit the reservation.
1882 $html_lines[] = "<td colspan=\""
1883 . ($display_set[$cur_display_record]["finsttimeceilingint"] - $display_set[$cur_display_record]["finsttimefloorint"])
1884 . "\" bgcolor=\""
1885 . CONFIG_SCHED_COLOR_DSMAT_RBANN
1886 . "\" align=\"center\">"
1887 . $box_string
1888 . "</td>";
1889
1890 //This takes the time forward.
1891 $cur_output_time_int = $display_set[$cur_display_record]["finsttimeceilingint"];
1892
1893 $cur_display_record ++;
1894 }
1895
1896 //Do any remaining cells at the end.
1897 while($cur_output_time_int < $panel_high_hour_in_int_limit)
1898 {
1899 $html_lines[] = "<td>&nbsp;</td>";
1900 $cur_output_time_int ++;
1901 }
1902
1903
1904 //The lines are formed. Add the row.
1905 $queued_html_rows[] = $html_lines;
1906 unset($html_lines);
1907 $sched_right_table_rows++;
1908 }
1909 }
1910 //
1911 //----------------------------------------------------------------------------------------------------
1912 //Does the rows corresponding to the active reservations for a flight instructor.
1913 //
1914 function SCHEDVIEW_form_resource_scheduling_area_finst_active( $userinfo_in,
1915 $rscs_rec_in,
1916 $active_reservations_in,
1917 $panel_low_hour_in,
1918 $panel_high_hour_in,
1919 $resourcecolumnwidth_in,
1920 $schedcolumnwidth_in,
1921 $can_view_banner_reservations_in,
1922 &$sched_right_table_rows,
1923 &$queued_html_rows)
1924 {
1925 $done = FALSE;
1926 $grabpoint = 0;
1927 $panel_low_hour_in_int = $panel_low_hour_in * 2;
1928 $panel_high_hour_in_int_limit = ($panel_high_hour_in + 1) * 2;
1929
1930 while (!$done)
1931 {
1932 //Due to the loop, need to unset the display set to keep it from accumulating too many
1933 //elements.
1934 if (isset($display_set))
1935 unset($display_set);
1936
1937 //Grab one element. This is our trial set to start with.
1938 $display_set[] = $active_reservations_in[$grabpoint];
1939
1940 //Next grabpoint.
1941 $grabpoint++;
1942
1943 //Keep on grabbing until there is a set intersection or we're out of things to grab.
1944 while (
1945 ($grabpoint < count($active_reservations_in))
1946 &&
1947 (! SCHEDVIEW_resv_finst_array_intersection($display_set, $active_reservations_in[$grabpoint]))
1948 )
1949 {
1950 $display_set[] = $active_reservations_in[$grabpoint];
1951 $grabpoint ++;
1952 }
1953
1954 //If we can't go further grabbing, we're done.
1955 if ($grabpoint >= count($active_reservations_in))
1956 $done = TRUE;
1957
1958 //Display the set that was collected for debugging, if necessary.
1959 //echo "<pre>\n----------\nDisplay Set\n----------\n";
1960 //print_r($display_set);
1961 //echo "\n--------\n";
1962
1963 //Our display set now contains a set of records to display. We know there is at least one,
1964 //we know the times don't overlap, and we know that these are in ascending order of start time
1965 //(due to the SQL query). Therefore, we can proceed in order.
1966 $cur_output_time_int = $panel_low_hour_in_int;
1967 $cur_display_record = 0;
1968 //$panel_high_hour_in_int_limit = ($panel_high_hour_in + 1) * 2;
1969
1970 while ($cur_display_record < count($display_set))
1971 {
1972 //Space out the blank cells until the first reservation or next reservation.
1973 while($cur_output_time_int < $display_set[$cur_display_record]["finsttimefloorint"])
1974 {
1975 $html_lines[] = "<td>&nbsp;</td>";
1976 $cur_output_time_int ++;
1977 }
1978
1979 //Get the text that should be displayed for the reservation.
1980 if ($userinfo_in === FALSE)
1981 {
1982 //echo " Clause 1 ";
1983 $box_string = "&nbsp;";
1984 }
1985 else
1986 {
1987 //Try to get the user name.
1988 //
1989 //echo "\n<pre>\n";
1990 //print_r($display_set[$cur_display_record]);
1991 //print_r($display_set[$cur_display_record]["useridx"]);
1992 //echo "\n</pre>\n";
1993
1994 if ($display_set[$cur_display_record]["useridx"] > 0)
1995 {
1996 $temp_user_info = USRS_retrieve_by_idx($display_set[$cur_display_record]["useridx"]);
1997 if ($temp_user_info === FALSE)
1998 {
1999 //echo " Clause 2 ";
2000 $box_string = "&nbsp;";
2001 }
2002 else
2003 {
2004 //echo " Clause 3 ";
2005 $box_string = $temp_user_info["lname"]
2006 .
2007 " ("
2008 .
2009 (string)($display_set[$cur_display_record]["idx"])
2010 .
2011 ")";
2012 }
2013 }
2014 else
2015 {
2016 //echo " Clause 4 ";
2017 $box_string = "&nbsp;";
2018 }
2019 }
2020
2021 //Spit the reservation.
2022 $html_lines[] = "<td colspan=\""
2023 . ($display_set[$cur_display_record]["finsttimeceilingint"] - $display_set[$cur_display_record]["finsttimefloorint"])
2024 . "\" bgcolor=\""
2025 . CONFIG_SCHED_COLOR_DSMAT_RACTV
2026 . "\" align=\"center\">"
2027 . $box_string
2028 . "</td>";
2029
2030 //This takes the time forward.
2031 $cur_output_time_int = $display_set[$cur_display_record]["finsttimeceilingint"];
2032
2033 $cur_display_record ++;
2034 }
2035
2036 //Do any remaining cells at the end.
2037 while($cur_output_time_int < $panel_high_hour_in_int_limit)
2038 {
2039 $html_lines[] = "<td>&nbsp;</td>";
2040 $cur_output_time_int ++;
2041 }
2042
2043
2044 //The lines are formed. Add the row.
2045 $queued_html_rows[] = $html_lines;
2046 unset($html_lines);
2047 $sched_right_table_rows++;
2048 }
2049 }
2050 //
2051 //----------------------------------------------------------------------------------------------------
2052 //Does the rows corresponding to the standby reservations for a flight instructor.
2053 //
2054 function SCHEDVIEW_form_resource_scheduling_area_finst_standby( $userinfo_in,
2055 $rscs_rec_in,
2056 $standby_reservations_in,
2057 $panel_low_hour_in,
2058 $panel_high_hour_in,
2059 $resourcecolumnwidth_in,
2060 $schedcolumnwidth_in,
2061 $can_view_banner_reservations_in,
2062 &$sched_right_table_rows,
2063 &$queued_html_rows)
2064 {
2065 $done = FALSE;
2066 $grabpoint = 0;
2067 $panel_low_hour_in_int = $panel_low_hour_in * 2;
2068 $panel_high_hour_in_int_limit = ($panel_high_hour_in + 1) * 2;
2069
2070 while (!$done)
2071 {
2072 //Due to the loop, need to unset the display set to keep it from accumulating too many
2073 //elements.
2074 if (isset($display_set))
2075 unset($display_set);
2076
2077 //Grab one element. This is our trial set to start with.
2078 $display_set[] = $standby_reservations_in[$grabpoint];
2079
2080 //Next grabpoint.
2081 $grabpoint++;
2082
2083 //Keep on grabbing until there is a set intersection or we're out of things to grab.
2084 while (
2085 ($grabpoint < count($standby_reservations_in))
2086 &&
2087 (! SCHEDVIEW_resv_finst_array_intersection($display_set, $standby_reservations_in[$grabpoint]))
2088 )
2089 {
2090 $display_set[] = $standby_reservations_in[$grabpoint];
2091 $grabpoint ++;
2092 }
2093
2094 //If we can't go further grabbing, we're done.
2095 if ($grabpoint >= count($standby_reservations_in))
2096 $done = TRUE;
2097
2098 //Display the set that was collected for debugging, if necessary.
2099 //echo "<pre>\n----------\nDisplay Set\n----------\n";
2100 //print_r($display_set);
2101 //echo "\n--------\n";
2102
2103 //Our display set now contains a set of records to display. We know there is at least one,
2104 //we know the times don't overlap, and we know that these are in ascending order of start time
2105 //(due to the SQL query). Therefore, we can proceed in order.
2106 $cur_output_time_int = $panel_low_hour_in_int;
2107 $cur_display_record = 0;
2108 //$panel_high_hour_in_int_limit = ($panel_high_hour_in + 1) * 2;
2109
2110 while ($cur_display_record < count($display_set))
2111 {
2112 //Space out the blank cells until the first reservation or next reservation.
2113 while($cur_output_time_int < $display_set[$cur_display_record]["finsttimefloorint"])
2114 {
2115 $html_lines[] = "<td>&nbsp;</td>";
2116 $cur_output_time_int ++;
2117 }
2118
2119 //Get the text that should be displayed for the reservation.
2120 if ($userinfo_in === FALSE)
2121 {
2122 //echo " Clause 1 ";
2123 $box_string = "&nbsp;";
2124 }
2125 else
2126 {
2127 //Try to get the user name.
2128 //
2129 //echo "\n<pre>\n";
2130 //print_r($display_set[$cur_display_record]);
2131 //print_r($display_set[$cur_display_record]["useridx"]);
2132 //echo "\n</pre>\n";
2133
2134 if ($display_set[$cur_display_record]["useridx"] > 0)
2135 {
2136 $temp_user_info = USRS_retrieve_by_idx($display_set[$cur_display_record]["useridx"]);
2137 if ($temp_user_info === FALSE)
2138 {
2139 //echo " Clause 2 ";
2140 $box_string = "&nbsp;";
2141 }
2142 else
2143 {
2144 //echo " Clause 3 ";
2145 $box_string = $temp_user_info["lname"]
2146 .
2147 " ("
2148 .
2149 (string)($display_set[$cur_display_record]["idx"])
2150 .
2151 ")";
2152 }
2153 }
2154 else
2155 {
2156 //echo " Clause 4 ";
2157 $box_string = "&nbsp;";
2158 }
2159 }
2160
2161 //Spit the reservation.
2162 $html_lines[] = "<td colspan=\""
2163 . ($display_set[$cur_display_record]["finsttimeceilingint"] - $display_set[$cur_display_record]["finsttimefloorint"])
2164 . "\" bgcolor=\""
2165 . CONFIG_SCHED_COLOR_DSMAT_RSTBY
2166 . "\" align=\"center\">"
2167 . $box_string
2168 . "</td>";
2169
2170 //This takes the time forward.
2171 $cur_output_time_int = $display_set[$cur_display_record]["finsttimeceilingint"];
2172
2173 $cur_display_record ++;
2174 }
2175
2176 //Do any remaining cells at the end.
2177 while($cur_output_time_int < $panel_high_hour_in_int_limit)
2178 {
2179 $html_lines[] = "<td>&nbsp;</td>";
2180 $cur_output_time_int ++;
2181 }
2182
2183
2184 //The lines are formed. Add the row.
2185 $queued_html_rows[] = $html_lines;
2186 unset($html_lines);
2187 $sched_right_table_rows++;
2188 }
2189 }
2190 //
2191 //----------------------------------------------------------------------------------------------------
2192 //Does the resource scheduling area for an individual flight instructor.
2193 //
2194 function SCHEDVIEW_form_resource_scheduling_area_finst( $userinfo_in,
2195 $rscs_rec_in,
2196 $resv_recs_in,
2197 $panel_low_hour_in,
2198 $panel_high_hour_in,
2199 $resourcecolumnwidth_in,
2200 $schedcolumnwidth_in,
2201 $can_view_banner_reservations_in,
2202 &$sched_right_table_rows,
2203 &$queued_html_rows)
2204 {
2205 if ($resv_recs_in !== FALSE) //Can't parse reservations if none there.
2206 {
2207 //Identify the banner reservations, active reservations, and standby reservations.
2208 //
2209 $banner_first = -1;
2210 $banner_last = -1;
2211 $active_first = -1;
2212 $active_last = -1;
2213 $standby_first = -1;
2214 $standby_last = -1;
2215
2216 $n = count($resv_recs_in);
2217 for ($i=0; $i<$n; $i++)
2218 {
2219 if ($resv_recs_in[$i]["type"] == RESV_TYPE_BANNER)
2220 {
2221 if ($banner_first == -1)
2222 $banner_first = $i;
2223 $banner_last = $i;
2224 }
2225
2226 if ($resv_recs_in[$i]["type"] == RESV_TYPE_ACTIVE)
2227 {
2228 if ($active_first == -1)
2229 $active_first = $i;
2230 $active_last = $i;
2231 }
2232
2233 if ($resv_recs_in[$i]["type"] == RESV_TYPE_STANDBY)
2234 {
2235 if ($standby_first == -1)
2236 $standby_first = $i;
2237 $standby_last = $i;
2238 }
2239 }
2240 //
2241 //-----------------------------------------------------------------------------
2242 //Do the banner reservations, if there are any, and if it is appropriate.
2243 //
2244 if (($banner_first != -1) && ($can_view_banner_reservations_in))
2245 {
2246 //Extract the records.
2247 $banner_reservations = array_slice ($resv_recs_in,
2248 $banner_first,
2249 $banner_last - $banner_first + 1);
2250
2251 //echo "<pre>\n----------\nBanner Reservations\n----------\n";
2252 //print_r($banner_reservations);
2253 //echo "\n---------\n</pre>\n";
2254
2255 SCHEDVIEW_form_resource_scheduling_area_finst_banner( $userinfo_in,
2256 $rscs_rec_in,
2257 $banner_reservations,
2258 $panel_low_hour_in,
2259 $panel_high_hour_in,
2260 $resourcecolumnwidth_in,
2261 $schedcolumnwidth_in,
2262 $can_view_banner_reservations_in,
2263 $sched_right_table_rows,
2264 $queued_html_rows);
2265 }
2266 //
2267 //-----------------------------------------------------------------------------
2268 //Do the active reservations, if there are any.
2269 //
2270 if ($active_first != -1)
2271 {
2272 //Extract the records.
2273 $active_reservations = array_slice ($resv_recs_in,
2274 $active_first,
2275 $active_last - $active_first + 1);
2276
2277 //echo "<pre>\n----------\nActive Reservations\n----------\n";
2278 //print_r($active_reservations);
2279 //echo "\n---------\n</pre>\n";
2280
2281 SCHEDVIEW_form_resource_scheduling_area_finst_active( $userinfo_in,
2282 $rscs_rec_in,
2283 $active_reservations,
2284 $panel_low_hour_in,
2285 $panel_high_hour_in,
2286 $resourcecolumnwidth_in,
2287 $schedcolumnwidth_in,
2288 $can_view_banner_reservations_in,
2289 $sched_right_table_rows,
2290 $queued_html_rows);
2291 }
2292 //
2293 //-----------------------------------------------------------------------------
2294 //Do the standby reservations, if there are any.
2295 //
2296 if ($standby_first != -1)
2297 {
2298 //Extract the records.
2299 $standby_reservations = array_slice ($resv_recs_in,
2300 $standby_first,
2301 $standby_last - $standby_first + 1);
2302
2303 //echo "<pre>\n----------\nStandby Reservations\n----------\n";
2304 //print_r($standby_reservations);
2305 //echo "\n---------\n</pre>\n";
2306
2307 SCHEDVIEW_form_resource_scheduling_area_finst_standby( $userinfo_in,
2308 $rscs_rec_in,
2309 $standby_reservations,
2310 $panel_low_hour_in,
2311 $panel_high_hour_in,
2312 $resourcecolumnwidth_in,
2313 $schedcolumnwidth_in,
2314 $can_view_banner_reservations_in,
2315 $sched_right_table_rows,
2316 $queued_html_rows);
2317 }
2318 //
2319 }
2320
2321 SCHEDVIEW_form_resource_scheduling_area_terminator_bar($userinfo_in,
2322 $rscs_rec_in,
2323 $resv_recs_in,
2324 $panel_low_hour_in,
2325 $panel_high_hour_in,
2326 $resourcecolumnwidth_in,
2327 $schedcolumnwidth_in,
2328 $sched_right_table_rows,
2329 $queued_html_lines);
2330 $queued_html_rows[] = $queued_html_lines;
2331 unset($queued_html_lines);
2332 }
2333 //
2334 //----------------------------------------------------------------------------------------------------
2335 //Does the rows corresponding to the banner reservations for an aircraft or simulator.
2336 //
2337 function SCHEDVIEW_form_resource_scheduling_area_acftsim_banner( $userinfo_in,
2338 $rscs_rec_in,
2339 $banner_reservations_in,
2340 $panel_low_hour_in,
2341 $panel_high_hour_in,
2342 $resourcecolumnwidth_in,
2343 $schedcolumnwidth_in,
2344 $can_view_banner_reservations_in,
2345 &$sched_right_table_rows,
2346 &$queued_html_rows)
2347 {
2348 $done = FALSE;
2349 $grabpoint = 0;
2350 $panel_low_hour_in_int = $panel_low_hour_in * 2;
2351 $panel_high_hour_in_int_limit = ($panel_high_hour_in + 1) * 2;
2352
2353 while (!$done)
2354 {
2355 //Due to the loop, need to unset the display set to keep it from accumulating too many
2356 //elements.
2357 if (isset($display_set))
2358 unset($display_set);
2359
2360 //Grab one element. This is our trial set to start with.
2361 $display_set[] = $banner_reservations_in[$grabpoint];
2362
2363 //Next grabpoint.
2364 $grabpoint++;
2365
2366 //Keep on grabbing until there is a set intersection or we're out of things to grab.
2367 while (
2368 ($grabpoint < count($banner_reservations_in))
2369 &&
2370 (! SCHEDVIEW_resv_actfsim_array_intersection($display_set, $banner_reservations_in[$grabpoint]))
2371 )
2372 {
2373 $display_set[] = $banner_reservations_in[$grabpoint];
2374 $grabpoint ++;
2375 }
2376
2377 //If we can't go further grabbing, we're done.
2378 if ($grabpoint >= count($banner_reservations_in))
2379 $done = TRUE;
2380
2381 //Display the set that was collected for debugging, if necessary.
2382 //echo "<pre>\n----------\nDisplay Set\n----------\n";
2383 //print_r($display_set);
2384 //echo "\n--------\n";
2385
2386 //Our display set now contains a set of records to display. We know there is at least one,
2387 //we know the times don't overlap, and we know that these are in ascending order of start time
2388 //(due to the SQL query). Therefore, we can proceed in order.
2389 $cur_output_time_int = $panel_low_hour_in_int;
2390 $cur_display_record = 0;
2391 //$panel_high_hour_in_int_limit = ($panel_high_hour_in + 1) * 2;
2392
2393 while ($cur_display_record < count($display_set))
2394 {
2395 //Space out the blank cells until the first reservation or next reservation.
2396 while($cur_output_time_int < $display_set[$cur_display_record]["acftsimtimefloorint"])
2397 {
2398 $html_lines[] = "<td>&nbsp;</td>";
2399 $cur_output_time_int ++;
2400 }
2401
2402 //Get the text that should be displayed for the reservation.
2403 if ($userinfo_in === FALSE)
2404 {
2405 //echo " Clause 1 ";
2406 $box_string = "&nbsp;";
2407 }
2408 else
2409 {
2410 //Try to get the user name.
2411 //
2412 //echo "\n<pre>\n";
2413 //print_r($display_set[$cur_display_record]);
2414 //print_r($display_set[$cur_display_record]["useridx"]);
2415 //echo "\n</pre>\n";
2416
2417 if ($display_set[$cur_display_record]["useridx"] > 0)
2418 {
2419 $temp_user_info = USRS_retrieve_by_idx($display_set[$cur_display_record]["useridx"]);
2420 if ($temp_user_info === FALSE)
2421 {
2422 //echo " Clause 2 ";
2423 $box_string = "&nbsp;";
2424 }
2425 else
2426 {
2427 //echo " Clause 3 ";
2428 $box_string = $temp_user_info["lname"]
2429 .
2430 " ("
2431 .
2432 (string)($display_set[$cur_display_record]["idx"])
2433 .
2434 ")";
2435 }
2436 }
2437 else
2438 {
2439 //echo " Clause 4 ";
2440 $box_string = "&nbsp;";
2441 }
2442 }
2443
2444 //Spit the reservation.
2445 $html_lines[] = "<td colspan=\""
2446 . ($display_set[$cur_display_record]["acftsimtimeceilingint"] - $display_set[$cur_display_record]["acftsimtimefloorint"])
2447 . "\" bgcolor=\""
2448 . CONFIG_SCHED_COLOR_DSMAT_RBANN
2449 . "\" align=\"center\">"
2450 . $box_string
2451 . "</td>";
2452
2453 //This takes the time forward.
2454 $cur_output_time_int = $display_set[$cur_display_record]["acftsimtimeceilingint"];
2455
2456 $cur_display_record ++;
2457 }
2458
2459 //Do any remaining cells at the end.
2460 while($cur_output_time_int < $panel_high_hour_in_int_limit)
2461 {
2462 $html_lines[] = "<td>&nbsp;</td>";
2463 $cur_output_time_int ++;
2464 }
2465
2466
2467 //The lines are formed. Add the row.
2468 $queued_html_rows[] = $html_lines;
2469 unset($html_lines);
2470 $sched_right_table_rows++;
2471 }
2472 }
2473 //
2474 //----------------------------------------------------------------------------------------------------
2475 //Does the rows corresponding to the active reservations for an aircraft or simulator.
2476 //
2477 function SCHEDVIEW_form_resource_scheduling_area_acftsim_active( $userinfo_in,
2478 $rscs_rec_in,
2479 $active_reservations_in,
2480 $panel_low_hour_in,
2481 $panel_high_hour_in,
2482 $resourcecolumnwidth_in,
2483 $schedcolumnwidth_in,
2484 $can_view_banner_reservations_in,
2485 &$sched_right_table_rows,
2486 &$queued_html_rows)
2487 {
2488 $done = FALSE;
2489 $grabpoint = 0;
2490 $panel_low_hour_in_int = $panel_low_hour_in * 2;
2491 $panel_high_hour_in_int_limit = ($panel_high_hour_in + 1) * 2;
2492
2493 while (!$done)
2494 {
2495 //Due to the loop, need to unset the display set to keep it from accumulating too many
2496 //elements.
2497 if (isset($display_set))
2498 unset($display_set);
2499
2500 //Grab one element. This is our trial set to start with.
2501 $display_set[] = $active_reservations_in[$grabpoint];
2502
2503 //Next grabpoint.
2504 $grabpoint++;
2505
2506 //Keep on grabbing until there is a set intersection or we're out of things to grab.
2507 while (
2508 ($grabpoint < count($active_reservations_in))
2509 &&
2510 (! SCHEDVIEW_resv_actfsim_array_intersection($display_set, $active_reservations_in[$grabpoint]))
2511 )
2512 {
2513 $display_set[] = $active_reservations_in[$grabpoint];
2514 $grabpoint ++;
2515 }
2516
2517 //If we can't go further grabbing, we're done.
2518 if ($grabpoint >= count($active_reservations_in))
2519 $done = TRUE;
2520
2521 //Display the set that was collected for debugging, if necessary.
2522 //echo "<pre>\n----------\nDisplay Set\n----------\n";
2523 //print_r($display_set);
2524 //echo "\n--------\n";
2525
2526 //Our display set now contains a set of records to display. We know there is at least one,
2527 //we know the times don't overlap, and we know that these are in ascending order of start time
2528 //(due to the SQL query). Therefore, we can proceed in order.
2529 $cur_output_time_int = $panel_low_hour_in_int;
2530 $cur_display_record = 0;
2531 //$panel_high_hour_in_int_limit = ($panel_high_hour_in + 1) * 2;
2532
2533 while ($cur_display_record < count($display_set))
2534 {
2535 //Space out the blank cells until the first reservation or next reservation.
2536 while($cur_output_time_int < $display_set[$cur_display_record]["acftsimtimefloorint"])
2537 {
2538 $html_lines[] = "<td>&nbsp;</td>";
2539 $cur_output_time_int ++;
2540 }
2541
2542 //Get the text that should be displayed for the reservation.
2543 if ($userinfo_in === FALSE)
2544 {
2545 //echo " Clause 1 ";
2546 $box_string = "&nbsp;";
2547 }
2548 else
2549 {
2550 //Try to get the user name.
2551 //
2552 //echo "\n<pre>\n";
2553 //print_r($display_set[$cur_display_record]);
2554 //print_r($display_set[$cur_display_record]["useridx"]);
2555 //echo "\n</pre>\n";
2556
2557 if ($display_set[$cur_display_record]["useridx"] > 0)
2558 {
2559 $temp_user_info = USRS_retrieve_by_idx($display_set[$cur_display_record]["useridx"]);
2560 if ($temp_user_info === FALSE)
2561 {
2562 //echo " Clause 2 ";
2563 $box_string = "&nbsp;";
2564 }
2565 else
2566 {
2567 //echo " Clause 3 ";
2568 $box_string = $temp_user_info["lname"]
2569 .
2570 " ("
2571 .
2572 (string)($display_set[$cur_display_record]["idx"])
2573 .
2574 ")";
2575 }
2576 }
2577 else
2578 {
2579 //echo " Clause 4 ";
2580 $box_string = "&nbsp;";
2581 }
2582 }
2583
2584
2585 //Spit the reservation.
2586 $html_lines[] = "<td colspan=\""
2587 . ($display_set[$cur_display_record]["acftsimtimeceilingint"] - $display_set[$cur_display_record]["acftsimtimefloorint"])
2588 . "\" bgcolor=\""
2589 . CONFIG_SCHED_COLOR_DSMAT_RACTV
2590 . "\" align=\"center\">"
2591 . $box_string
2592 . "</td>";
2593
2594 //This takes the time forward.
2595 $cur_output_time_int = $display_set[$cur_display_record]["acftsimtimeceilingint"];
2596
2597 $cur_display_record ++;
2598 }
2599
2600 //Do any remaining cells at the end.
2601 while($cur_output_time_int < $panel_high_hour_in_int_limit)
2602 {
2603 $html_lines[] = "<td>&nbsp;</td>";
2604 $cur_output_time_int ++;
2605 }
2606
2607
2608 //The lines are formed. Add the row.
2609 $queued_html_rows[] = $html_lines;
2610 unset($html_lines);
2611 $sched_right_table_rows++;
2612 }
2613 }
2614 //
2615 //----------------------------------------------------------------------------------------------------
2616 //Does the rows corresponding to the standby reservations for an aircraft or simulator.
2617 //
2618 function SCHEDVIEW_form_resource_scheduling_area_acftsim_standby( $userinfo_in,
2619 $rscs_rec_in,
2620 $standby_reservations_in,
2621 $panel_low_hour_in,
2622 $panel_high_hour_in,
2623 $resourcecolumnwidth_in,
2624 $schedcolumnwidth_in,
2625 $can_view_banner_reservations_in,
2626 &$sched_right_table_rows,
2627 &$queued_html_rows)
2628 {
2629 $done = FALSE;
2630 $grabpoint = 0;
2631 $panel_low_hour_in_int = $panel_low_hour_in * 2;
2632 $panel_high_hour_in_int_limit = ($panel_high_hour_in + 1) * 2;
2633
2634 while (!$done)
2635 {
2636 //Due to the loop, need to unset the display set to keep it from accumulating too many
2637 //elements.
2638 if (isset($display_set))
2639 unset($display_set);
2640
2641 //Grab one element. This is our trial set to start with.
2642 $display_set[] = $standby_reservations_in[$grabpoint];
2643
2644 //Next grabpoint.
2645 $grabpoint++;
2646
2647 //Keep on grabbing until there is a set intersection or we're out of things to grab.
2648 while (
2649 ($grabpoint < count($standby_reservations_in))
2650 &&
2651 (! SCHEDVIEW_resv_actfsim_array_intersection($display_set, $standby_reservations_in[$grabpoint]))
2652 )
2653 {
2654 $display_set[] = $standby_reservations_in[$grabpoint];
2655 $grabpoint ++;
2656 }
2657
2658 //If we can't go further grabbing, we're done.
2659 if ($grabpoint >= count($standby_reservations_in))
2660 $done = TRUE;
2661
2662 //Display the set that was collected for debugging, if necessary.
2663 //echo "<pre>\n----------\nDisplay Set\n----------\n";
2664 //print_r($display_set);
2665 //echo "\n--------\n";
2666
2667 //Our display set now contains a set of records to display. We know there is at least one,
2668 //we know the times don't overlap, and we know that these are in ascending order of start time
2669 //(due to the SQL query). Therefore, we can proceed in order.
2670 $cur_output_time_int = $panel_low_hour_in_int;
2671 $cur_display_record = 0;
2672 //$panel_high_hour_in_int_limit = ($panel_high_hour_in + 1) * 2;
2673
2674 while ($cur_display_record < count($display_set))
2675 {
2676 //Space out the blank cells until the first reservation or next reservation.
2677 while($cur_output_time_int < $display_set[$cur_display_record]["acftsimtimefloorint"])
2678 {
2679 $html_lines[] = "<td>&nbsp;</td>";
2680 $cur_output_time_int ++;
2681 }
2682
2683 //Get the text that should be displayed for the reservation.
2684 if ($userinfo_in === FALSE)
2685 {
2686 //echo " Clause 1 ";
2687 $box_string = "&nbsp;";
2688 }
2689 else
2690 {
2691 //Try to get the user name.
2692 //
2693 //echo "\n<pre>\n";
2694 //print_r($display_set[$cur_display_record]);
2695 //print_r($display_set[$cur_display_record]["useridx"]);
2696 //echo "\n</pre>\n";
2697
2698 if ($display_set[$cur_display_record]["useridx"] > 0)
2699 {
2700 $temp_user_info = USRS_retrieve_by_idx($display_set[$cur_display_record]["useridx"]);
2701 if ($temp_user_info === FALSE)
2702 {
2703 //echo " Clause 2 ";
2704 $box_string = "&nbsp;";
2705 }
2706 else
2707 {
2708 //echo " Clause 3 ";
2709 $box_string = $temp_user_info["lname"]
2710 .
2711 " ("
2712 .
2713 (string)($display_set[$cur_display_record]["idx"])
2714 .
2715 ")";
2716 }
2717 }
2718 else
2719 {
2720 //echo " Clause 4 ";
2721 $box_string = "&nbsp;";
2722 }
2723 }
2724
2725
2726 //Spit the reservation.
2727 $html_lines[] = "<td colspan=\""
2728 . ($display_set[$cur_display_record]["acftsimtimeceilingint"] - $display_set[$cur_display_record]["acftsimtimefloorint"])
2729 . "\" bgcolor=\""
2730 . CONFIG_SCHED_COLOR_DSMAT_RSTBY
2731 . "\" align=\"center\">"
2732 . $box_string
2733 . "</td>";
2734
2735 //This takes the time forward.
2736 $cur_output_time_int = $display_set[$cur_display_record]["acftsimtimeceilingint"];
2737
2738 $cur_display_record ++;
2739 }
2740
2741 //Do any remaining cells at the end.
2742 while($cur_output_time_int < $panel_high_hour_in_int_limit)
2743 {
2744 $html_lines[] = "<td>&nbsp;</td>";
2745 $cur_output_time_int ++;
2746 }
2747
2748
2749 //The lines are formed. Add the row.
2750 $queued_html_rows[] = $html_lines;
2751 unset($html_lines);
2752 $sched_right_table_rows++;
2753 }
2754 }
2755 //
2756 //----------------------------------------------------------------------------------------------------
2757 function SCHEDVIEW_form_resource_scheduling_area_acftsim( $userinfo_in,
2758 $rscs_rec_in,
2759 $resv_recs_in,
2760 $panel_low_hour_in,
2761 $panel_high_hour_in,
2762 $resourcecolumnwidth_in,
2763 $schedcolumnwidth_in,
2764 $can_view_banner_reservations_in,
2765 &$sched_right_table_rows,
2766 &$queued_html_rows)
2767 {
2768 if ($resv_recs_in !== FALSE) //Can't parse reservations if none there.
2769 {
2770 //echo "<pre>\n----------\nReservations Passed In\n----------\n";
2771 //print_r($resv_recs_in);
2772 //echo "\n---------\n</pre>\n";
2773 //
2774 //Identify the banner reservations, active reservations, and standby reservations.
2775 //
2776 $banner_first = -1;
2777 $banner_last = -1;
2778 $active_first = -1;
2779 $active_last = -1;
2780 $standby_first = -1;
2781 $standby_last = -1;
2782
2783 $n = count($resv_recs_in);
2784 for ($i=0; $i<$n; $i++)
2785 {
2786 if ($resv_recs_in[$i]["type"] == RESV_TYPE_BANNER)
2787 {
2788 if ($banner_first == -1)
2789 $banner_first = $i;
2790 $banner_last = $i;
2791 }
2792
2793 if ($resv_recs_in[$i]["type"] == RESV_TYPE_ACTIVE)
2794 {
2795 if ($active_first == -1)
2796 $active_first = $i;
2797 $active_last = $i;
2798 }
2799
2800 if ($resv_recs_in[$i]["type"] == RESV_TYPE_STANDBY)
2801 {
2802 if ($standby_first == -1)
2803 $standby_first = $i;
2804 $standby_last = $i;
2805 }
2806 }
2807 //
2808 //-----------------------------------------------------------------------------
2809 //Do the banner reservations, if there are any, and if it is appropriate.
2810 //
2811 if (($banner_first != -1) && ($can_view_banner_reservations_in))
2812 {
2813 //Extract the records.
2814 $banner_reservations = array_slice ($resv_recs_in,
2815 $banner_first,
2816 $banner_last - $banner_first + 1);
2817
2818 //echo "<pre>\n----------\nBanner Reservations\n----------\n";
2819 //print_r($banner_reservations);
2820 //echo "\n---------\n</pre>\n";
2821
2822 SCHEDVIEW_form_resource_scheduling_area_acftsim_banner( $userinfo_in,
2823 $rscs_rec_in,
2824 $banner_reservations,
2825 $panel_low_hour_in,
2826 $panel_high_hour_in,
2827 $resourcecolumnwidth_in,
2828 $schedcolumnwidth_in,
2829 $can_view_banner_reservations_in,
2830 $sched_right_table_rows,
2831 $queued_html_rows);
2832 }
2833 //
2834 //-----------------------------------------------------------------------------
2835 //Do the active reservations, if there are any.
2836 //
2837 if ($active_first != -1)
2838 {
2839 //Extract the records.
2840 $active_reservations = array_slice ($resv_recs_in,
2841 $active_first,
2842 $active_last - $active_first + 1);
2843
2844 //echo "<pre>\n----------\nActive Reservations\n----------\n";
2845 //print_r($active_reservations);
2846 //echo "\n---------\n</pre>\n";
2847
2848 SCHEDVIEW_form_resource_scheduling_area_acftsim_active( $userinfo_in,
2849 $rscs_rec_in,
2850 $active_reservations,
2851 $panel_low_hour_in,
2852 $panel_high_hour_in,
2853 $resourcecolumnwidth_in,
2854 $schedcolumnwidth_in,
2855 $can_view_banner_reservations_in,
2856 $sched_right_table_rows,
2857 $queued_html_rows);
2858 }
2859 //
2860 //-----------------------------------------------------------------------------
2861 //Do the standby reservations, if there are any.
2862 //
2863 if ($standby_first != -1)
2864 {
2865 //Extract the records.
2866 $standby_reservations = array_slice ($resv_recs_in,
2867 $standby_first,
2868 $standby_last - $standby_first + 1);
2869
2870 //echo "<pre>\n----------\nStandby Reservations\n----------\n";
2871 //print_r($standby_reservations);
2872 //echo "\n---------\n</pre>\n";
2873
2874 SCHEDVIEW_form_resource_scheduling_area_acftsim_standby( $userinfo_in,
2875 $rscs_rec_in,
2876 $standby_reservations,
2877 $panel_low_hour_in,
2878 $panel_high_hour_in,
2879 $resourcecolumnwidth_in,
2880 $schedcolumnwidth_in,
2881 $can_view_banner_reservations_in,
2882 $sched_right_table_rows,
2883 $queued_html_rows);
2884 }
2885 //
2886 }
2887
2888 SCHEDVIEW_form_resource_scheduling_area_terminator_bar($userinfo_in,
2889 $rscs_rec_in,
2890 $resv_recs_in,
2891 $panel_low_hour_in,
2892 $panel_high_hour_in,
2893 $resourcecolumnwidth_in,
2894 $schedcolumnwidth_in,
2895 $sched_right_table_rows,
2896 $queued_html_lines);
2897 $queued_html_rows[] = $queued_html_lines;
2898 unset($queued_html_lines);
2899 }
2900 //
2901 //----------------------------------------------------------------------------------------------------
2902 //Does a dayview table row.
2903 //
2904 function SCHEDVIEW_do_dayview_table_row(
2905 $userinfo_in, //User record, or FALSE if none.
2906 $rscs_rec_in, //Resource record.
2907 $resv_recs_in, //Applicable reservations, or FALSE if none.
2908 $panel_low_hour_in, //Low panel hour.
2909 $panel_high_hour_in, //High panel hour (inclusive)
2910 $resourcecolumnwidth_in, //Column width, in percent, for left resource header.
2911 $schedcolumnwidth_in, //Column width for each scheduling cell.
2912 $can_view_banner_reservations_in //TRUE if this user is allowed to see banners.
2913 )
2914 {
2915 //Start a table row. This encompasses the left area that identifies the resource (with potentially a
2916 //rowspan > 1) and the scheduling area at the right.
2917
2918 //Start off believing no table rows dedicated to the right scheduling area for a resource.
2919 $sched_right_table_rows = 0;
2920
2921 //Form the scheduling area of the resource row as an array of HTML rows. Each HTML row is an array of
2922 //one or more HTML lines. We have to do this first, because otherwise won't know how large the rowspan
2923 //for the resource name at the left should be.
2924 //
2925 //We have to differentiate between forming the scheduling area for a flight instructor versus an
2926 //aircraft/simulator, as different fields are checked.
2927 //
2928 if ($rscs_rec_in["type"] == RSCS_TYPE_FLIGHTINSTRUCTOR)
2929 {
2930 SCHEDVIEW_form_resource_scheduling_area_finst($userinfo_in,
2931 $rscs_rec_in,
2932 $resv_recs_in,
2933 $panel_low_hour_in,
2934 $panel_high_hour_in,
2935 $resourcecolumnwidth_in,
2936 $schedcolumnwidth_in,
2937 $can_view_banner_reservations_in,
2938 $sched_right_table_rows,
2939 $queued_html_sched_rows);
2940 }
2941 else
2942 {
2943 SCHEDVIEW_form_resource_scheduling_area_acftsim($userinfo_in,
2944 $rscs_rec_in,
2945 $resv_recs_in,
2946 $panel_low_hour_in,
2947 $panel_high_hour_in,
2948 $resourcecolumnwidth_in,
2949 $schedcolumnwidth_in,
2950 $can_view_banner_reservations_in,
2951 $sched_right_table_rows,
2952 $queued_html_sched_rows);
2953 }
2954
2955 //Form the HTML for the left area with the resource short name. We can do this now because the number of
2956 //rows is no known. This will consist of exactly one <TD> cell.
2957 SCHEDVIEW_do_left_resource_title_area($userinfo_in,
2958 $rscs_rec_in,
2959 $resv_recs_in,
2960 $panel_low_hour_in,
2961 $panel_high_hour_in,
2962 $resourcecolumnwidth_in,
2963 $schedcolumnwidth_in,
2964 $sched_right_table_rows,
2965 $queued_html_head_lines);
2966
2967 //echo "<pre>\n";
2968 //print_r($queued_html_head_rows);
2969 //echo "</pre>\n";
2970
2971 //Output the HTML that was generated.
2972 $n = count($queued_html_sched_rows);
2973 for ($i=0; $i<$n; $i++)
2974 {
2975 //Row starts.
2976 HTMLFORMAT_echo_push_nl("<tr>");
2977
2978 //If this is the first row, output the left heading. This will have a rowspan potentially
2979 //>1.
2980 if ($i == 0)
2981 {
2982 for ($j=0; $j<count($queued_html_head_lines); $j++)
2983 {
2984 HTMLFORMAT_echo_noop_nl($queued_html_head_lines[$j]);
2985 }
2986 }
2987
2988 //Output the scheduling row(s).
2989 $cur_lines = $queued_html_sched_rows[$i];
2990
2991 for ($j=0; $j<count($cur_lines); $j++)
2992 {
2993 HTMLFORMAT_echo_noop_nl($cur_lines[$j]);
2994 }
2995
2996 //Row ends.
2997 HTMLFORMAT_echo_pull_nl("</tr>");
2998 }
2999 }
3000 //
3001 //----------------------------------------------------------------------------------------------------
3002 //Display the scheduling area for a given date and time.
3003 //
3004 //Parameters:
3005 // userinfo : The array of user information for the logged in user (pulled from the MySQL
3006 // database), or FALSE if no user is logged in.
3007 //
3008 // sessioninfo_in : The array of information about the current login session, or FALSE if
3009 // no session is active.
3010 //
3011 // dateyear : The year of the date to display (an integer).
3012 //
3013 // datemonth : The month of the date to display (an integer).
3014 //
3015 // dateday : The day of the date to display (an integer).
3016 //
3017 // timehour : The hour of the time to display (an integer).
3018 //
3019 // timemin : The minute of the time to display (an integer).
3020 //
3021 // diff_time_perm_array : An array of permissions about previous and future times
3022 // specifying which should be displayed.
3023 //
3024 function SCHEDVIEW_scheduling_area($userinfo, $sessioninfo_in,
3025 $dateyear, $datemonth, $dateday,
3026 $timehour, $timemin,
3027 $diff_time_perm_array,
3028 $panel
3029 )
3030 {
3031 global $CONFIG_SCHED_DAY_PANELS;
3032
3033 SCHEDVIEW_temporal_navigation_bar(
3034 $userinfo,
3035 $dateyear, $datemonth, $dateday,
3036 $timehour, $timemin,
3037 $diff_time_perm_array,
3038 $panel
3039 );
3040
3041 $panel_low_hour = $CONFIG_SCHED_DAY_PANELS[$panel * 2];
3042 $panel_high_hour = $CONFIG_SCHED_DAY_PANELS[$panel * 2 + 1];
3043
3044 $nwholehours = $panel_high_hour - $panel_low_hour + 1;
3045 $nschedcols = $nwholehours * 2;
3046
3047 //Calculate whether the logged in user, if any, can view banner reservations. Banner reservations
3048 //are non-restrictive, so this comes down to any logged in user.
3049 if ($userinfo === FALSE)
3050 {
3051 $user_can_view_banner_reservations = FALSE;
3052 }
3053 else
3054 {
3055 $user_can_view_banner_reservations = TRUE;
3056 }
3057
3058 //Calculate how wide to make columns. The goal is to give a hint to the browser that we want
3059 //everthing except the first column to be the same width. Output is an integer percentage.
3060 //
3061 $schedcolumnwidth = (int)(100/($nschedcols+1) + 0.5);
3062 $resourcecolumnwidth = 100 - ($nschedcols * $schedcolumnwidth);
3063
3064 //Obtain the list of resources to display. This function will return FALSE if there are no
3065 //resources that meet eligibility requirements, and this case needs to be handled
3066 //carefully.
3067 //
3068 $rscs_to_display = RSCS_rscs_list_dayview_online();
3069 //
3070 //echo "<tt>\n";
3071 //print_r($rscs_to_display);
3072 //echo "</tt>\n";
3073
3074 //Determine the count of resources to be displayed. If the database retrieval function
3075 //returned FALSE, this value should be set to 0. 0 will ensure that the array is not
3076 //dereferenced at all.
3077 //
3078 if ($rscs_to_display === FALSE)
3079 {
3080 $resource_display_count = 0;
3081 }
3082 else
3083 {
3084 $resource_display_count = count($rscs_to_display);
3085 }
3086
3087 //echo " Value of resource_display_count : " . $resource_display_count . " ";
3088
3089 //Calculate the number of time columns involved in this panel. This is constant across all
3090 //the resources because of the rectangular layout.
3091 $n_time_columns = SCHEDVIEW_panel_n_time_columns($panel_low_hour, $panel_high_hour);
3092 //echo "<tt>\n";
3093 //print_r($n_time_columns);
3094 //echo "</tt>\n";
3095
3096 //Calculate an stime corresponding to the left edge of the panel. This is used for the SQL query.
3097 //
3098 $panel_left_stime = STIME_stime_make_medres($dateyear, $datemonth, $dateday, $panel_low_hour, 0);
3099
3100 //Calculate an stime corresponding to the right edge of the panel. This is used for the SQL query.
3101 //We need to be careful at the right edge because of the midnight boundary.
3102 //
3103 if ($panel_high_hour < 23)
3104 {
3105 $panel_right_stime = STIME_stime_make_medres($dateyear, $datemonth, $dateday, $panel_high_hour + 1, 0);
3106 }
3107 else
3108 {
3109 //Figure out what one day in the future is.
3110 DATEFUNC_one_day_future($dateyear,
3111 $datemonth,
3112 $dateday,
3113 $localtemp_year_onedayfuture,
3114 $localtemp_month_onedayfuture,
3115 $localtemp_day_onedayfuture);
3116 //And calculate the STIME.
3117 //
3118 $panel_right_stime = STIME_stime_make_medres($localtemp_year_onedayfuture,
3119 $localtemp_month_onedayfuture,
3120 $localtemp_day_onedayfuture,
3121 0,
3122 0);
3123 }
3124
3125 //echo "<br><br>\n";
3126 //print_r($panel_left_stime);
3127 //echo "<br><br>\n";
3128 //print_r($panel_right_stime);
3129 //echo "<br><br>\n";
3130
3131 //Run the SQL query to identify the reservation records that match the time limit parameters.
3132 //These will be sorted according to the index, not the resource sort order, and then the reservation
3133 //type, so a little rearrangement will be necessary posthumously.
3134 //
3135 RESV_resvns_in_time_window( $panel_left_stime,
3136 $panel_right_stime,
3137 $flight_inst_data_array,
3138 $flight_inst_search_array,
3139 $resource_data_array,
3140 $resource_search_array );
3141 //
3142 //echo "<br><pre>\n";
3143 //print_r($flight_inst_data_array);
3144 //echo "</pre><br>\n";
3145 //echo "<br><pre>\n";
3146 //print_r($flight_inst_search_array);
3147 //echo "</pre><br>\n";
3148 //echo "<br><pre>\n";
3149 //print_r($resource_data_array);
3150 //echo "</pre><br>\n";
3151 //echo "<br><pre>\n";
3152 //print_r($resource_search_array);
3153 //echo "</pre><br>\n";
3154 //
3155 //Decorate the lists of reservations with additional information that will allow quicker display
3156 //of reservations.
3157 SCHEDVIEW_resv_list_decorate($flight_inst_data_array, $panel_left_stime, $panel_right_stime);
3158 SCHEDVIEW_resv_list_decorate($resource_data_array, $panel_left_stime, $panel_right_stime);
3159 //
3160 //echo "<pre>\n";
3161 //echo "Flight Instructor Data\n---------------------\n";
3162 //print_r($flight_inst_data_array);
3163 //echo "\nResource Data Array\n";
3164 //echo "-------------------\n";
3165 //print_r($resource_data_array);
3166 //echo "</pre>\n";
3167
3168
3169 HTMLFORMAT_echo_push_nl("<table border=\"1\" cellspacing=\"0\" cellpadding=\"1\" width=\"100%\">");
3170
3171 for ($row=-1; $row <= $resource_display_count; $row++)
3172 {
3173 if (($row == -1) || ($row == $resource_display_count))
3174 {
3175 //Top or bottom row, containing time headings.
3176 //
3177 HTMLFORMAT_echo_push_nl("<tr>");
3178 HTMLFORMAT_echo_push_nl("<td colspan=\"1\" width=\"" . $resourcecolumnwidth . "%\" bgcolor=\"#" . CONFIG_SCHED_COLOR_DSMAT_THEAD . "\">");
3179 HTMLFORMAT_echo_noop_nl("&nbsp;");
3180 HTMLFORMAT_echo_pull_nl("</td>");
3181
3182 for ($i=$panel_low_hour; $i<=$panel_high_hour; $i++)
3183 {
3184 HTMLFORMAT_echo_push_nl("<td align=\"center\" colspan=\"2\" width=\"" . $schedcolumnwidth * 2
3185 . "%\" bgcolor=\"#" . CONFIG_SCHED_COLOR_DSMAT_THEAD . "\">");
3186 HTMLFORMAT_echo_noop_nl("<font size=\"3\">" . DATEFUNC_stdtimenosec($i, 0) . "</font>");
3187 HTMLFORMAT_echo_pull_nl("</td>");
3188 }
3189
3190 HTMLFORMAT_echo_pull_nl("</tr>");
3191
3192 //If we have just done the top header and if there are no resources, output a table row indicating that
3193 //there are no resources that met search criteria.
3194 //
3195 if (($row == -1) && ($resource_display_count == 0))
3196 {
3197 HTMLFORMAT_echo_noop_nl("<tr align=\"center\"><td colspan=\""
3198 .
3199 sprintf("%d", $nschedcols+1)
3200 .
3201 "\"><br><b>No Resources Online</b><br><br></td></tr>");
3202 }
3203 }
3204 else
3205 {
3206 //Pull the current resource from the array. I haven't figured out the PHP syntax enough to
3207 //access an element of a 2-D array directly.
3208 //
3209 $current_resource = $rscs_to_display[$row];
3210
3211 //Extract the records from the SQL resv queries that correspond to the flight instructor or resource.
3212 //
3213 if ($current_resource["type"] == RSCS_TYPE_FLIGHTINSTRUCTOR)
3214 {
3215 //Flight instructor.
3216 $target_resvs = RESV_extract_finst_records($flight_inst_data_array, $flight_inst_search_array, $current_resource["idx"]);
3217 //
3218 //echo "<br><pre>\n";
3219 //print_r($target_resvs);
3220 //echo "</pre><br>\n";
3221 }
3222 else
3223 {
3224 //Aircraft or simulator.
3225 $target_resvs = RESV_extract_resource_records($resource_data_array, $resource_search_array, $current_resource["idx"]);
3226 //
3227 //echo "<br><pre>\n";
3228 //print_r($target_resvs);
3229 //echo "</pre><br>\n";
3230 }
3231
3232 SCHEDVIEW_do_dayview_table_row(
3233 $userinfo,
3234 $current_resource,
3235 $target_resvs,
3236 $panel_low_hour,
3237 $panel_high_hour,
3238 $resourcecolumnwidth,
3239 $schedcolumnwidth,
3240 $user_can_view_banner_reservations
3241 );
3242 }
3243 }
3244
3245 HTMLFORMAT_echo_pull_nl("</table>");
3246 }
3247 //
3248 //--------------------------------------------------------------------------------
3249 //End of $RCSfile: schedview.inc,v $.
3250 //--------------------------------------------------------------------------------
3251 ?>

dashley@gmail.com
ViewVC Help
Powered by ViewVC 1.1.25