datePicker
[ class tree: datePicker ] [ index: datePicker ] [ all elements ]

Class: datePicker

Source Location: /class.datepicker.php

Class Overview


A PHP class providing access to a date/time picker


Author(s):

Version:

  • 1.0.7 (last revision: November 15, 2007)

Copyright:

  • (c) 2006-2007 Stefan Gabos

Variables

Methods



Class Details

[line 38]
A PHP class providing access to a date/time picker

  • provides a nice and intuitive date picker and optionally, a time picker
  • complex formulas for selectable dates and times ranges can be set
  • dates can be preselected and the datepicker can be instructed to show specific month/year as default
  • the returned format of the date can be set to any formats supported by PHP's date() function
  • customizable starting day of the week
  • supports localisation (currently english, dutch, finnish, french, german, italian, romanian and slovenian translations are available)
  • template driven and highly customizable
  • the included template produces valid HTML 4.01 Transitional and XHTML 1.0
  • code is heavily documented so you can easily understand every aspect of it
See the documentation for more info.

Read the LICENSE file, provided with the package, to find out how you can use this PHP script.

If you don't find this file, please write an email to noname at nivelzero dot ro and you will be sent a copy of the license file

For more resources visit http://stefangabos.blogspot.com




Tags:

example:  example
example:  example
example:  example
example:  example
example:  example
version:  1.0.7 (last revision: November 15, 2007)
copyright:  (c) 2006-2007 Stefan Gabos
example:  example
author:  Stefan Gabos <ix@nivelzero.ro>


[ Top ]


Class Variables

$dateFormat =

[line 191]

Format of the returned day

Any combination allowed by PHP's date() function can be used

Note

You should never use hours, minutes and seconds in your format because you will always have "00:00" appended to your returned date. If enableTimePicker is set to TRUE, selected hour and minute will be automatically appended

default is "m d Y"



Type:   string


[ Top ]

$enableTimePicker =

[line 166]

If set to TRUE, a time picker will also be shown

Default is FALSE




Tags:

since:  1.0.4

Type:   boolean


[ Top ]

$firstDayOfWeek =

[line 202]

What day should be taken as the first day of week

Possible values range from 0 (Sunday) to 6 (Saturday)

default is 0 (Sunday)



Type:   integer


[ Top ]

$language =

[line 233]

Language file to use

The name of the php language file you wish to use from the /languages folder.

Without the extension! (i.e. "german" for the german language not "german.php")

default is "english"



Type:   string


[ Top ]

$preselectedDate =

[line 175]

Preselects a date in the calendar

The date must be specified as a UNIX timestamp!



Type:   timestamp


[ Top ]

$selectableDatesRange =

[line 72]

An array of an unlimited number of arrays with three elements.

In these arrays of three elements the first one is the date representing the start of the range (inclusive), the second one is the date representing the end of the range (inclusive) and the third one represents how days should be skipped (i.e. "1" means every day in the range should be available for selection, "2" means every second day should be available for selection and so on)

Note that dates must be represented as UNIX timestamps!

Also note that the range of dates can be anywhere in between 1/1/1970 and 31/12/2038

  1.       /**
  2.       *
  3.       *   Allow every second day starting from next Monday and up to next Friday
  4.       *
  5.       */
  6.  
  7.      $dp->selectableDatesRange array(
  8.  
  9.           array(strtotime("next Monday")strtotime("next Friday")1),
  10.  
  11.      )




Tags:

since:  1.0.4

Type:   array


[ Top ]

$selectableTimesRange =

[line 142]

An array of an unlimited number of arrays with six elements.

In these arrays of six elements the first one is the hour representing the start of the range (inclusive), the second one is the hour representing the end of the range (exclusive), the third one represents how hours should be skipped (i.e. "1" means every hour in the range should be available for selection, "2" means every second hour should be available for selection and so on), the fourth one is the minute representing the start of the range (inclusive), the fifth one is the minute representing the end of the range (exclusive) and the sixth one represents how minutes should be skipped (i.e. "15" means every 15th minute in the range should be available for selection, "30" means every 30th minute should be available for selection and so on),

An unlimited number of ranges can be specified.

Setting this property has sense only if enableTimePicker property is set to TRUE

  1.       $dp->selectableTimesRange array(
  2.           /**
  3.               from hours 10 to 12 and minute 0 to 60 allow every hour and minute
  4.           */
  5.           array(101210601),
  6.           /**
  7.               also, from hours 12 to 18 and minutes 0 to 60 allow only 12, 14 and
  8.               16 hours to be selected (through a stepping of 2) and 0, 15, 30, 45
  9.               minutes (through a stepping of 15)
  10.           */
  11.           array(1218206015),
  12.       )




Tags:

since:  1.0.4

Type:   array


[ Top ]

$selectableYearsRange =

[line 106]

An array of an unlimited number of arrays with three elements.

In these arrays of three elements the first one is the year representing the start of the range (inclusive), the second one is the year representing the end of the range (inclusive) and the third one represents how years should be skipped (i.e. "1" means every year in the range should be available for selection, "2" means every second year should be available for selection and so on)

  1.       /**
  2.       *
  3.       *   Allow every second year starting with 2000 and up to the current year
  4.       *   and also, every year from 1990 to 1996
  5.       *
  6.       */
  7.  
  8.      $dp->selectableYearsRange array(
  9.  
  10.           array(2000date("Y")2),
  11.           array(199019961)
  12.  
  13.      )

Setting values to this property will make the years show in a select box (rather than static text) enabling the user to quickly select a year from the given range




Tags:

since:  1.0.4

Type:   array


[ Top ]

$showGoToCurrentMonthYear =

[line 155]

If set to TRUE, a button for going to the current month/year will be shown.

Useful when the user can wonder through the years and months and might want to get back.

Default is FALSE




Tags:

since:  1.0.7

Type:   boolean


[ Top ]

$template =

[line 245]

Template folder to use

Note that only the folder of the template you wish to use needs to be specified. Inside the folder you must have the template.xtpl file which will be automatically loaded

default is "default"



Type:   string


[ Top ]

$windowHeight =

[line 211]

Height of the calendar window

default is 250



Type:   integer


[ Top ]

$windowWidth =

[line 220]

Width of the calendar window

default is 300



Type:   integer


[ Top ]



Class Methods


constructor datePicker [line 252]

void datePicker( )

Constructor of the class



[ Top ]

method show [line 311]

void show( string $controlID, [mixed $startMonth = ""], [mixed $startYear = ""], [mixed $startHour = ""], [mixed $startMinute = ""])

Returns the JavaScript code that will open the pop-up window containing the date picker



Parameters:

string   $controlID   the ID of the HTML element (textbox or textarea) where to return the selected value

mixed   $startMonth  

(optional) which month to start the calendar from

Note that you can also pass a javascript statement as argument!


mixed   $startYear  

(optional) which year to start the calendar from

Note that you can also pass a javascript statement as argument!


mixed   $startHour  

(optional) what hour to show by default

Default is "0"

This argument will be processed only if the enableTimePicker property is set to TRUE!

Note that you can also pass a javascript statement as argument!


mixed   $startMinute  

(optional) what minute to show by default

Default is "0"

This argument will be processed only if the enableTimePicker property is set to TRUE!

Note that you can also pass a javascript statement as argument!



[ Top ]


Documentation generated on Thu, 04 Sep 2008 10:13:49 +0300 by phpDocumentor 1.3.0RC6