<?php
/**
*
* Parameters documentation
*
* $aCalendarParams=array(
* "iAction" => int : 0=>reloadCurrentPage with get param sDate,
* 1=>fill field sFieldName
* "sFieldName" => string : Id of field to fill (needed if iAction=1)
* "iStyle" => int : 0=>display calendar,
* 1=>display div on icon click
* "sIconPath" => strin : Path Of Icon If Needed (needed if iStyle=1)
* "aMonthNames" => array : array of localized monthes name
* "aDaysNames" => array : array of localized days name
* "sDateFormat" => string : outpu format in php date() function like syntax (needed if iAction=1)
* );
*
*
* Instanciation Documentation
*
* new oCalendarPicker($sNameInstance,$sDate, $aParams,$iUpdate=0,$sPath);
*
* $sNameInstance => string : Name for container div for calendar. Need to be unique in final document.
* $sDate => string : Current date of instance
* $aParams => array : Option for generation (see parameters documentation)
* $iUpdate => int : Display for first time or Update exsiting 0=>display, 1=update (used by ajax request)
* $sPath => string : path of current page (used by ajax request)
*
*
*/
require_once("./class/class.oCalendarPicker.php");
$aMonthNames=array(
"FR"=>array("Janvier","Février","Mars","Avril","Mai","Juin","Juillet","Août","Septembre","Octobre","Novembre","Décembre"),
"EN"=>array("January","February","March","April","May","June","July","August","September","October","November","December")
);
$aDaysNames=array(
"FR"=>array("Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi", "Dimanche"),
"EN"=>array("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday")
);
$sDateFormat=array(
"FR"=>"d/m/Y",
"EN"=>"Y-m-d"
);
$sDate=(!empty($_GET['sDate']))?$_GET['sDate']:date("Ymd");
?>
<html>
<head>
<script src="js/calendar.js" type="text/javascript"></script>
<link href="css/calendar.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<table cellspacing="0" cellpadding="30" border="1">
<tr>
<td> </td>
<td>Reload Current Page</td>
<td>Fill a text Field</td>
</tr>
<tr>
<td>Calendar Display</td>
<td><?php
/**
*
* Display Calendar and reload page
*
*
*/
$aCalendarParams=array(
"sIconPath" => "./img/calendar.png",
"iAction" => 0, //0=>reloadCurrentPage with get param sDate, 1=>fill field sFieldName
"sFieldName" => "",
"iStyle" => 0, //0=>display calendar, 1=>display div on icon click
"aMonthNames" => $aMonthNames["FR"],
"aDaysNames" => $aDaysNames["FR"],
"sDateFormat" => $sDateFormat["FR"]
);
new oCalendarPicker("calFixe1",$sDate,$aCalendarParams);
?>
</td>
<td>
<?php
/**
*
* Display Calendar and fill field
*
*
*/
$aCalendarParams=array(
"sIconPath" => "./img/calendar.png",
"iAction" => 1, //0=>reloadCurrentPage with get param sDate, 1=>fill field sFieldName
"sFieldName" => "Date1",
"iStyle" => 0, //0=>display calendar, 1=>display div on icon click
"aMonthNames" => $aMonthNames["FR"],
"aDaysNames" => $aDaysNames["FR"],
"sDateFormat" => $sDateFormat["FR"]
);
new oCalendarPicker("calFixe2",$sDate,$aCalendarParams);
?><input type="text" name="Date1" id="Date1"/><br/>French Format
</td>
</tr>
<tr>
<td>Image and div</td>
<td>
<?php
/**
*
* Display Icon and reload page
*
*
*/
$aCalendarParams=array(
"sIconPath" => "./img/calendar.png",
"iAction" => 0, //0=>reloadCurrentPage with get param sDate, 1=>fill field sFieldName
"sFieldName" => "",
"iStyle" => 1, //0=>display calendar, 1=>display div on icon click
"aMonthNames" => $aMonthNames["FR"],
"aDaysNames" => $aDaysNames["FR"],
"sDateFormat" => $sDateFormat["FR"]
);
new oCalendarPicker("calFixe3",$sDate,$aCalendarParams);
?>
</td>
<td
<?php
/**
*
* Display Icon and Fill Field
*
*
*/
$aCalendarParams=array(
"sIconPath" => "./img/calendar.png",
"iAction" => 1, //0=>reloadCurrentPage with get param sDate, 1=>fill field sFieldName
"sFieldName" => "Date2",
"iStyle" => 1, //0=>display calendar, 1=>display div on icon click
"aMonthNames" => $aMonthNames["EN"],
"aDaysNames" => $aDaysNames["EN"],
"sDateFormat" => $sDateFormat["EN"]
);
new oCalendarPicker("calFixe4",$sDate,$aCalendarParams);
?><input type="text" name="Date2" id="Date2"/><br/>English Format</td>
</tr>
</table>
</body>
</html>
|