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