Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

ecommerce/jscalendar/test.php
Go to the documentation of this file.
1 <?php
4 $lang = $_GET['lang'];
5 if (!$lang) {
6 $lang = $_REQUEST['lang'];
7 }
8 if (!$lang) {
9 $lang = 'en';
10 }
11 setcookie('lang', $lang);
12
13 ?>
14 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
15 <html>
16 <head>
17 <title>
18 Test for calendar.php
19 </title>
20
21 <?php
22
23 // put here the correct path to "calendar.php"; don't move the file
24 // "calendar.php" -- I think it's best if you leave it inside the
25 // "/jscalendar/" directory. Just put here the correct path to it, such as
26 // "../jscalendar/calendar.php" or something.
27 require_once ('calendar.php');
28
29 // parameters to constructor:
30 // 1. the absolute URL path to the calendar files
31 // 2. the languate used for the calendar (see the lang/ dir)
32 // 3. the theme file used for the clanedar, without the ".css" extension
33 // 4. boolean that specifies if the "_stripped" files are to be loaded
34 // The stripped files are smaller as they have no whitespace and comments
35 $calendar = new DHTML_Calendar('/jscalendar/', $lang, 'calendar-win2k-2', false);
36
37 // call this in the <head> section; it will "echo" code that loads the calendar
38 // scripts and theme file.
39 $calendar->load_files();
40
41 ?>
42
43 </head>
44
45 <body>
46
47 <?php if ($_REQUEST['submitted']) { ?>
48
49 <h1>Form submitted</h1>
50
51 <?php foreach ($_REQUEST as $key => $val) {
52 echo htmlspecialchars($key) . ' = ' . htmlspecialchars($val) . '<br />';
53 } ?>
54
55 <?php } else { ?>
56
57 <h1>Calendar.php test</h1>
58
59 <form action="test.php" method="get">
60 Select language: <select name="lang" onchange="this.form.submit()">
61 <?php
62 $cwd = getcwd();
63 chdir('lang');
64 foreach (glob('*.js') as $filename) {
65 $l = preg_replace('/(^calendar-|.js$)/', '', $filename);
66 $selected = '';
67 if ($l == $lang)
68 $selected = 'selected="selected" ';
69 $display = $l;
70 if ($l == 'en')
71 $display = 'EN';
72 echo '<option ' . $selected . 'value="' . $l . '">' . $display . '</option>';
73 }
74 ?>
75 </select>
76 <blockquote style="font-size: 90%">
77 <b>NOTE</b>: as of this release, 0.9.6, only "EN" and "RO", which I
78 maintain, function correctly. Other language files do not work
79 because they need to be updated. If you update some language file,
80 please consider sending it back to me so that I can include it in the
81 calendar distribution.
82 </blockquote>
83 </form>
84
85 <form action="test.php" method="get">
86 <input type="hidden" name="submitted" value="1" />
87
88 <table>
89 <tr>
90 <td>
91 Date 1:
92 </td>
93 <td>
94 <?php $calendar->make_input_field(
95 // calendar options go here; see the documentation and/or calendar-setup.js
96 array('firstDay' => 1, // show Monday first
97 'showsTime' => true,
98 'showOthers' => true,
99 'ifFormat' => '%Y-%m-%d %I:%M %P',
100 'timeFormat' => '12'),
101 // field attributes go here
102 array('style' => 'width: 15em; color: #840; background-color: #ff8; border: 1px solid #000; text-align: center',
103 'name' => 'date1',
104 'value' => strftime('%Y-%m-%d %I:%M %P', strtotime('now')))); ?>
105 </td>
106 </tr>
107 </table>
108
109 <hr />
110 <button>Submit</button>
111
112 </form>
113
114 <?php } ?>
115
116 </body>
117 </html>
DHTML_Calendar
Definition: ecommerce/jscalendar/calendar.php:16
$lang
$lang
Definition: ecommerce/jscalendar/test.php:4
$calendar
$calendar
Definition: ecommerce/jscalendar/test.php:35
$cwd
if($_REQUEST['submitted']) else $cwd
Definition: ecommerce/jscalendar/test.php:62
table
$def table
Definition: ezprestauthorizedclient.php:13
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.