Project

General

Profile

1
The DHTML Calendar
2
-------------------
3

    
4
  Author: Mihai Bazon, <mihai_bazon@yahoo.com>
5
          http://dynarch.com/mishoo/
6

    
7
  This program is free software published under the
8
  terms of the GNU Lesser General Public License.
9

    
10
  For the entire license text please refer to
11
  http://www.gnu.org/licenses/lgpl.html
12

    
13
Contents
14
---------
15

    
16
  calendar.js     -- the main program file
17
  lang/*.js       -- internalization files
18
  *.css           -- color themes
19
  cal.html        -- example usage file
20
  doc/            -- documentation, in PDF and HTML
21
  simple-1.html   -- quick setup examples [popup calendars]
22
  simple-2.html   -- quick setup example for flat calendar
23
  calendar.php    -- PHP wrapper
24
  test.php        -- test file for the PHP wrapper
25

    
26
Homepage
27
---------
28

    
29
  For details and latest versions please refer to calendar
30
  homepage, located on my website:
31

    
32
    http://dynarch.com/mishoo/calendar.epl
33

    
34

    
35
How to use
36
-----------
37

    
38
1. enter this code somewhere _above_ the form
39
    you can overwrite some vars as descripted below
40
--cut-PHP----------------------------------------------------
41
    // include jscalendar-setup
42
    $jscal_use_time = false; // whether to use a clock, too
43
    require_once(WB_PATH."/include/jscalendar/wb-setup.php");
44
    // override some vars: (normally, there is no need to change this)
45
    //$jscal_lang = "en"; //- calendar-language (default: wb-backend-language)
46
    //$jscal_today = ""; // - date the calendar offers if the text-field is empty (default: today)
47
    //$jscal_firstday = "0"; // - first-day-of-week (0-sunday, 1-monday, ...) (default: 0(EN) or 1(everything else))
48
    //$jscal_format = "Y-m-d"; // - initial-format used for the text-field (default: from wb-backend-date-format)
49
    //$jscal_ifformat = "%Y-%m-%d"; // - format for jscalendar (default: from wb-backend-date-format)
50
----------------------------------------------------------
51

    
52

    
53
2. enter this code within your form
54
    $date holds the entered date as timestamp
55
    the field is called "my_date_field"
56
    the calender-trigger is called "my_date_trigger"
57
--cut-HTML---------------------------------------------------
58
    <input type="text" id="my_date_field" name="my_date_field" value="<?php if($date==0) print ""; else print date($jscal_format, $date)?>" style="width: 120px;" />
59
    <img src="<?php echo WB_URL ?>/include/jscalendar/img.gif" id="my_date_trigger" style="cursor: pointer; border: 1px solid red;" title="Calendar" onmouseover="this.style.background='red';" onmouseout="this.style.background=''" />
60
----------------------------------------------------------
61

    
62

    
63
3. enter this code _below_ the form
64
    to store the result as timestamp, you have to use  range : [1970, 2037],
65
--cut-HTML---------------------------------------------------
66
    <script type="text/javascript">
67
        Calendar.setup(
68
            {
69
                inputField  : "my_date_field",
70
                ifFormat    : "<?php echo $jscal_ifformat ?>",
71
                button      : "my_date_trigger",
72
                firstDay    : <?php echo $jscal_firstday ?>,
73
                <?php if(isset($jscal_use_time) && $jscal_use_time==TRUE) { ?>
74
                    showsTime   : "true",
75
                    timeFormat  : "24",
76
                <?php } ?>
77
                date        : "<?php echo $jscal_today ?>",
78
                range       : [1970, 2037],
79
                step        : 1
80
            }
81
        );
82
    </script>
83
----------------------------------------------------------
84

    
(1-1/10)