29if (!defined(
'NOREQUIREUSER')) {
30 define(
'NOREQUIREUSER',
'1');
33if (!defined(
'NOREQUIRESOC')) {
34 define(
'NOREQUIRESOC',
'1');
37if (!defined(
'NOCSRFCHECK')) {
38 define(
'NOCSRFCHECK', 1);
40if (!defined(
'NOTOKENRENEWAL')) {
41 define(
'NOTOKENRENEWAL', 1);
43if (!defined(
'NOLOGIN')) {
46if (!defined(
'NOREQUIREMENU')) {
47 define(
'NOREQUIREMENU', 1);
49if (!defined(
'NOREQUIREHTML')) {
50 define(
'NOREQUIREHTML', 1);
53require_once
'../main.inc.php';
54require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
57 $langs->setDefaultLang(
GETPOST(
'lang',
'aZ09'));
61$langs->loadLangs(array(
"main",
"agenda"));
63$right = ($langs->trans(
"DIRECTION") ==
'rtl' ?
'left' :
'right');
64$left = ($langs->trans(
"DIRECTION") ==
'rtl' ?
'right' :
'left');
72print
'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">'.
"\n";
76 print
'<script nonce="'.getNonce().
'" type="text/javascript" src="'.DOL_URL_ROOT.
'/core/js/lib_head.js.php"></script>'.
"\n";
78 print
'<title>'.$langs->trans(
"Calendar").
'</title>';
83 $langs->trans(
"January"),
84 $langs->trans(
"February"),
85 $langs->trans(
"March"),
86 $langs->trans(
"April"),
88 $langs->trans(
"June"),
89 $langs->trans(
"July"),
90 $langs->trans(
"August"),
91 $langs->trans(
"September"),
92 $langs->trans(
"October"),
93 $langs->trans(
"November"),
94 $langs->trans(
"December")
96print
'<script nonce="'.getNonce().
'" type="text/javascript">';
97print
'var tradMonths = [';
98foreach ($tradTemp as $val) {
99 print
'"'.addslashes($val).
'",';
102print
'</script>'.
"\n";
110if (!isset($_GET[
"sd"])) {
111 $_GET[
"sd"] =
"00000000";
114if (!isset($_GET[
"m"]) || !isset($_GET[
"y"])) {
117if (isset($_GET[
"m"]) && isset($_GET[
"y"])) {
118 if ($_GET[
"m"] < 1 || $_GET[
"m"] > 12) {
121 if ($_GET[
"y"] < 0 || $_GET[
"y"] > 9999) {
135print
'</body></html>'.
"\n";
143function xyzToUnixTimestamp($mysqldate)
145 $year = substr($mysqldate, 0, 4);
146 $month = substr($mysqldate, 4, 2);
147 $day = substr($mysqldate, 6, 2);
148 $unixtimestamp =
dol_mktime(12, 0, 0, $month, $day, $year);
149 return $unixtimestamp;
160function displayBox($selectedDate, $month, $year)
162 global $langs, $conf;
165 $thedate =
dol_mktime(12, 0, 0, $month, 1, $year);
169 if ($selectedDate !=
"00000000") {
170 $selDate = xyzToUnixTimestamp($selectedDate);
178 <td colspan=
"6" class=
"dpHead"><?php
181 echo $langs->trans(
"Month".$selectMonth).
", ".$selectYear; ?></td>
183 <
button type=
"button" class=
"dpInvisibleButtons" id=
"DPCancel"
184 onClick=
"closeDPBox();">X</
button>
188 <td
class=
"dpButtons"
189 onClick=
"loadMonth('<?php echo DOL_URL_ROOT.'/core/' ?>','<?php echo $month?>','<?php echo $year - 1?>','<?php echo $xyz ?>','<?php echo $langs->defaultlang ?>')"><<</td>
190 <td
class=
"dpButtons"
191 onClick=
"loadMonth('<?php echo DOL_URL_ROOT.'/core/' ?>','<?php if ($month == 1) {
195 } ?>','<?php if ($month == 1) {
199 } ?>','<?php echo $xyz ?>','<?php echo $langs->defaultlang ?>')"><</td>
200 <td colspan=
"3" class=
"dpButtons"
201 onClick=
"loadMonth('<?php echo DOL_URL_ROOT.'/core/' ?>','<?php echo (int) dol_print_date($today, '%m')?>','<?php echo $todayArray["year
"]?>','<?php echo $xyz ?>','<?php echo $langs->defaultlang ?>')"><?php echo
'-' ?></td>
202 <td
class=
"dpButtons"
203 onClick=
"loadMonth('<?php echo DOL_URL_ROOT.'/core/' ?>','<?php if ($month == 12) {
207 } ?>','<?php if ($month == 12) {
211 } ?>','<?php echo $xyz ?>','<?php echo $langs->defaultlang ?>')">></td>
212 <td
class=
"dpButtons"
213 onClick=
"loadMonth('<?php echo DOL_URL_ROOT.'/core/' ?>','<?php echo $month?>','<?php echo $year + 1?>','<?php echo $xyz ?>','<?php echo $langs->defaultlang ?>')">>></td>
215 <tr
class=
"dpDayNames">
217 $startday = isset($conf->global->MAIN_START_WEEK) ? $conf->global->MAIN_START_WEEK : 1;
218 $day_names = array(
'ShortSunday',
'ShortMonday',
'ShortTuesday',
'ShortWednesday',
'ShortThursday',
'ShortFriday',
'ShortSaturday');
219 for ($i = 0; $i < 7; $i++) {
220 echo
'<td width="', (int) (($i + 1) * 100 / 7) - (
int) ($i * 100 / 7),
'%">', $langs->trans($day_names[($i + $startday) % 7]),
'</td>',
"\n";
234 if ($mydate < $firstdate) {
235 echo
"<tr class=\"dpWeek\">";
238 for ($i = 0; $i < 7; $i++) {
239 $w = ($i + $startday) % 7;
240 if ($w == $firstdate[
"wday"]) {
241 $mydate = $firstdate;
244 echo
"<td> </td>";
248 if ($mydate[
"wday"] == $startday) {
249 echo
"<tr class=\"dpWeek\">";
255 if ($thedate == $selDate) {
256 $dayclass =
"dpSelected";
257 } elseif ($thedate == $today) {
258 $dayclass =
"dpToday";
261 if ($langs->trans(
"FormatDateShortJavaInput") ==
"FormatDateShortJavaInput") {
262 print
"ERROR FormatDateShortJavaInput not defined for language ".$langs->defaultlang;
267 echo
"<td class=\"".$dayclass.
"\"";
268 echo
" onMouseOver=\"dpHighlightDay(".$mydate[
"year"].
",parseInt('".
dol_print_date($thedate,
"%m").
"',10),".$mydate[
"mday"].
",tradMonths)\"";
269 echo
" onClick=\"dpClickDay(".$mydate[
"year"].
",parseInt('".
dol_print_date($thedate,
"%m").
"',10),".$mydate[
"mday"].
",'".$langs->trans(
"FormatDateShortJavaInput").
"')\"";
270 echo
">".sprintf(
"%02s", $mydate[
"mday"]).
"</td>";
273 if (($mydate[
"wday"] + 1) % 7 == $startday) {
279 $thedate =
dol_mktime(12, 0, 0, $month, $day, $year);
280 if ($thedate ==
'') {
284 if ($firstdate[
"month"] != $mydate[
"month"]) {
291 for ($i = 6; $i >= $cols; $i--) {
292 echo
"<td> </td>";
297 <td
id=
"dpExp" class=
"dpExplanation" colspan=
"7"><?php
300 print $langs->trans(
"Month".$selectMonth).
" ";
301 print sprintf(
"%02s", $tempDate[
"mday"]);
302 print
", ".$selectYear;
304 print
"Click a Date";
dol_get_first_day_week($day, $month, $year, $gm=false)
Return first day of week for a date.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_now($mode='auto')
Return date for now.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_getdate($timestamp, $fast=false, $forcetimezone='')
Return an array with locale date info.
ui dialog ui datepicker calendar ui widget content ui state ui datepicker calendar ui widget header ui state ui datepicker calendar ui button
0 = Do not include form tag and submit button -1 = Do not include form tag but include submit button
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type