36require
'../../main.inc.php';
44require_once DOL_DOCUMENT_ROOT.
'/comm/action/class/actioncomm.class.php';
45require_once DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php';
46require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
47require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
48require_once DOL_DOCUMENT_ROOT.
'/core/lib/agenda.lib.php';
49require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
50require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
55$action =
GETPOST(
'action',
'aZ09');
56$optioncss =
GETPOST(
'optioncss',
'aZ');
58if (empty($mode) && preg_match(
'/show_/', $action)) {
62$disabledefaultvalues =
GETPOSTINT(
'disabledefaultvalues');
65$check_birthday = !empty($conf->use_javascript_ajax) ?
GETPOSTINT(
"check_birthday") : 1;
66$filter =
GETPOST(
"search_filter",
'alpha', 3) ?
GETPOST(
"search_filter",
'alpha', 3) :
GETPOST(
"filter",
'alpha', 3);
67$filtert =
GETPOST(
"search_filtert",
"intcomma", 3) ?
GETPOST(
"search_filtert",
"intcomma", 3) :
GETPOST(
"filtert",
"intcomma", 3);
68$usergroup =
GETPOST(
"search_usergroup",
"intcomma", 3) ?
GETPOST(
"search_usergroup",
"intcomma", 3) :
GETPOST(
"usergroup",
"intcomma", 3);
69$search_categ_cus =
GETPOST(
"search_categ_cus",
'intcomma', 3) ?
GETPOST(
"search_categ_cus",
'intcomma', 3) : 0;
73 $filtert = (string) $user->id;
83$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
84$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
86if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
90$offset = $limit * $page;
95 $sortfield =
"a.datec";
101 $socid = $user->socid;
108if (!$user->hasRight(
'agenda',
'myactions',
'read')) {
111if (!$user->hasRight(
'agenda',
'allactions',
'read')) {
114if (!$user->hasRight(
'agenda',
'allactions',
'read') || $filter ==
'mine') {
115 $filtert = (string) $user->id;
123$pid = GETPOSTISSET(
"search_projectid") ?
GETPOSTINT(
"search_projectid", 3) :
GETPOSTINT(
"projectid", 3);
124$status = GETPOSTISSET(
"search_status") ?
GETPOST(
"search_status",
'aZ09') :
GETPOST(
"status",
'aZ09');
125$type = GETPOSTISSET(
"search_type") ?
GETPOST(
"search_type",
'aZ09') :
GETPOST(
"type",
'aZ09');
129if ($dateselect > 0) {
136if (
GETPOST(
'search_actioncode',
'array:aZ09')) {
137 $actioncode =
GETPOST(
'search_actioncode',
'array:aZ09', 3);
138 if (!count($actioncode)) {
142 $actioncode =
GETPOST(
"search_actioncode",
"alpha", 3) ?
GETPOST(
"search_actioncode",
"alpha", 3) : (
GETPOST(
"search_actioncode") ==
'0' ?
'0' : ((!
getDolGlobalString(
'AGENDA_DEFAULT_FILTER_TYPE') || $disabledefaultvalues) ?
'' :
getDolGlobalString(
'AGENDA_DEFAULT_FILTER_TYPE')));
144if (is_scalar($actioncode) && $actioncode ==
'-1') {
148if ($status ==
'' && !GETPOSTISSET(
'search_status')) {
154if (empty($mode) && !GETPOSTISSET(
'mode')) {
155 $mode = $defaultview;
157if ($mode ==
'default') {
158 $mode = (($defaultview !=
'show_list') ? $defaultview :
'show_month');
161 $mode =
'show_month';
166 $week = ($week ? $week :
date(
"W"));
167 $day = ($day ? $day :
date(
"d"));
171 $day = ($day ? $day :
date(
"d"));
177$langs->loadLangs(array(
'agenda',
'other',
'commercial'));
180$hookmanager->initHooks(array(
'agenda'));
182$result =
restrictedArea($user,
'agenda', 0,
'actioncomm&societe',
'myactions|allactions',
'fk_soc',
'id');
183if ($user->socid && $socid) {
187require_once DOL_DOCUMENT_ROOT.
'/core/redirect_if_setup_not_complete.inc.php';
194if (
GETPOST(
"viewlist",
'alpha') || $mode ==
'show_list') {
196 if (is_array($_POST)) {
197 foreach ($_POST as $key => $val) {
198 if ($key ==
'token') {
201 $param .=
'&'.urlencode($key).
'='.urlencode($val);
204 if (!preg_match(
'/action=/', $param)) {
205 $param .= ($param ?
'&' :
'').
'mode=show_list';
208 header(
"Location: ".DOL_URL_ROOT.
'/comm/action/list.php?'.$param);
212if (
GETPOST(
"viewperuser",
'alpha') || $mode ==
'show_peruser') {
214 if (is_array($_POST)) {
215 foreach ($_POST as $key => $val) {
216 if ($key ==
'token') {
219 $param .=
'&'.urlencode($key).
'='.urlencode($val);
223 header(
"Location: ".DOL_URL_ROOT.
'/comm/action/peruser.php?'.$param);
239 'maxprint' => $maxprint,
241 'filtert' => $filtert,
242 'showbirthday' => $check_birthday,
243 'canedit' => $canedit,
244 'optioncss' => $optioncss,
245 'actioncode' => $actioncode,
247 'resourceid' => $resourceid,
248 'usergroup' => $usergroup,
250$reshook = $hookmanager->executeHooks(
'beforeAgenda', $parameters, $object, $action);
255$form =
new Form($db);
256$companystatic =
new Societe($db);
257$contactstatic =
new Contact($db);
258$userstatic =
new User($db);
260$help_url =
'EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda|DE:Modul_Terminplanung';
261llxHeader(
'', $langs->trans(
"Agenda"), $help_url);
265$nowyear = $nowarray[
'year'];
266$nowmonth = $nowarray[
'mon'];
267$nowday = $nowarray[
'mday'];
269$listofextcals = array();
274 while ($i < $MAXAGENDA) {
276 $source =
'AGENDA_EXT_SRC'.$i;
277 $name =
'AGENDA_EXT_NAME'.$i;
278 $offsettz =
'AGENDA_EXT_OFFSETTZ'.$i;
279 $color =
'AGENDA_EXT_COLOR'.$i;
280 $default =
'AGENDA_EXT_ACTIVEBYDEFAULT'.$i;
281 $buggedfile =
'AGENDA_EXT_BUGGEDFILE'.$i;
284 $listofextcals[] = array(
285 'type' =>
'globalsetup',
301 while ($i < $MAXAGENDA) {
303 $source =
'AGENDA_EXT_SRC_'.$user->id.
'_'.$i;
304 $name =
'AGENDA_EXT_NAME_'.$user->id.
'_'.$i;
305 $offsettz =
'AGENDA_EXT_OFFSETTZ_'.$user->id.
'_'.$i;
306 $color =
'AGENDA_EXT_COLOR_'.$user->id.
'_'.$i;
307 $enabled =
'AGENDA_EXT_ENABLED_'.$user->id.
'_'.$i;
308 $default =
'AGENDA_EXT_ACTIVEBYDEFAULT_'.$user->id.
'_'.$i;
309 $buggedfile =
'AGENDA_EXT_BUGGEDFILE_'.$user->id.
'_'.$i;
313 $listofextcals[] = array(
314 'type' =>
'usersetup',
317 'offsettz' => (
int) (empty($user->conf->$offsettz) ? 0 : $user->
conf->$offsettz),
327$max_day_in_month = 0;
338$max_day_in_prev_month = 0;
342if (empty($mode) || $mode ==
'show_month') {
344 $prev_year = $prev[
'year'];
345 $prev_month = $prev[
'month'];
347 $next_year = $next[
'year'];
348 $next_month = $next[
'month'];
350 $max_day_in_prev_month = (int)
date(
"t",
dol_mktime(12, 0, 0, $prev_month, 1, $prev_year,
'gmt'));
351 $max_day_in_month = (int)
date(
"t",
dol_mktime(12, 0, 0, $month, 1, $year,
'gmt'));
353 $tmpday = - (int)
date(
"w",
dol_mktime(12, 0, 0, $month, 1, $year,
'gmt')) + 2;
359 $firstdaytoshow =
dol_mktime(0, 0, 0, $prev_month, $max_day_in_prev_month + $tmpday, $prev_year,
'tzuserrel');
360 $next_day = 7 - ($max_day_in_month + 1 - $tmpday) % 7;
364 $lastdaytoshow =
dol_mktime(0, 0, 0, $next_month, $next_day, $next_year,
'tzuserrel');
366if ($mode ==
'show_week') {
368 $prev_year = $prev[
'prev_year'];
369 $prev_month = $prev[
'prev_month'];
370 $prev_day = $prev[
'prev_day'];
371 $first_day = $prev[
'first_day'];
372 $first_month = $prev[
'first_month'];
373 $first_year = $prev[
'first_year'];
375 $week = $prev[
'week'];
379 $next_year = $next[
'year'];
380 $next_month = $next[
'month'];
381 $next_day = $next[
'day'];
384 $firstdaytoshow =
dol_mktime(0, 0, 0, $first_month, $first_day, $first_year,
'tzuserrel');
387 $max_day_in_month =
date(
"t",
dol_mktime(0, 0, 0, $month, 1, $year,
'gmt'));
389 $tmpday = $first_day;
391if ($mode ==
'show_day') {
393 $prev_year = $prev[
'year'];
394 $prev_month = $prev[
'month'];
395 $prev_day = $prev[
'day'];
397 $next_year = $next[
'year'];
398 $next_month = $next[
'month'];
399 $next_day = $next[
'day'];
401 $firstdaytoshow =
dol_mktime(0, 0, 0, $prev_month, $prev_day, $prev_year,
'tzuserrel');
402 $lastdaytoshow =
dol_mktime(0, 0, 0, $next_month, $next_day, $next_year,
'tzuserrel');
418if ($actioncode || GETPOSTISSET(
'search_actioncode')) {
419 if (is_array($actioncode)) {
420 foreach ($actioncode as $str_action) {
421 $param .=
"&search_actioncode[]=".urlencode($str_action);
424 $param .=
"&search_actioncode=".urlencode($actioncode);
427if ($resourceid > 0) {
428 $param .=
"&search_resourceid=".urlencode((
string) ($resourceid));
430if ($status || GETPOSTISSET(
'status') || GETPOSTISSET(
'search_status')) {
431 $param .=
"&search_status=".urlencode($status);
434 $param .=
"&search_filter=".urlencode((
string) $filter);
437 $param .=
"&search_filtert=".urlencode((
string) $filtert);
440 $param .=
"&search_usergroup=".urlencode((
string) ($usergroup));
443 $param .=
"&search_socid=".urlencode((
string) ($socid));
445if ($check_birthday) {
446 $param .=
"&check_birthday=1";
449 $param .=
"&check_holiday=1";
452 $param .=
"&search_projectid=".urlencode((
string) ($pid));
455 $param .=
"&search_type=".urlencode($type);
457$param .=
"&maxprint=".urlencode((
string) ($maxprint));
458if ($mode ==
'show_day' || $mode ==
'show_week' || $mode ==
'show_month') {
459 $param .=
'&mode='.urlencode($mode);
461if ($search_categ_cus != 0) {
462 $param .=
'&search_categ_cus='.urlencode((
string) ($search_categ_cus));
465 $param .=
'&check_holiday=1';
470$nav .=
'<div class="navselectiondate inline-block nowraponall">';
471if (empty($mode) || $mode ==
'show_month') {
472 $nav .=
"<a href=\"?year=".$prev_year.
"&month=".$prev_month.$param.
"\"><i class=\"fa fa-chevron-left\"></i></a> \n";
473 $nav .=
" <span id=\"month_name\">".dol_print_date(
dol_mktime(0, 0, 0, $month, 1, $year),
"%b %Y");
474 $nav .=
" </span>\n";
475 $nav .=
" <a href=\"?year=".$next_year.
"&month=".$next_month.$param.
"\"><i class=\"fa fa-chevron-right\"></i></a>\n";
478if ($mode ==
'show_week') {
479 $nav .=
"<a href=\"?year=".$prev_year.
"&month=".$prev_month.
"&day=".$prev_day.$param.
"\"><i class=\"fa fa-chevron-left\" title=\"".
dol_escape_htmltag($langs->trans(
"Previous")).
"\"></i></a> \n";
480 $nav .=
" <span id=\"month_name\">".dol_print_date(
dol_mktime(0, 0, 0, $first_month, $first_day, $first_year),
"%Y").
", ".$langs->trans(
"WeekShort").
" ".$week;
481 $nav .=
" </span>\n";
482 $nav .=
" <a href=\"?year=".$next_year.
"&month=".$next_month.
"&day=".$next_day.$param.
"\"><i class=\"fa fa-chevron-right\" title=\"".
dol_escape_htmltag($langs->trans(
"Next")).
"\"></i></a>\n";
483 $picto =
'calendarweek';
485if ($mode ==
'show_day') {
486 $nav .=
"<a href=\"?year=".$prev_year.
"&month=".$prev_month.
"&day=".$prev_day.$param.
"\"><i class=\"fa fa-chevron-left\"></i></a> \n";
487 $nav .=
" <span id=\"month_name\">".dol_print_date(
dol_mktime(0, 0, 0, $month, $day, $year),
"daytextshort");
488 $nav .=
" </span>\n";
489 $nav .=
" <a href=\"?year=".$next_year.
"&month=".$next_month.
"&day=".$next_day.$param.
"\"><i class=\"fa fa-chevron-right\"></i></a>\n";
490 $picto =
'calendarday';
492if (empty($conf->dol_optimize_smallscreen)) {
493 $nav .=
' <a href="?year='.$nowyear.
'&month='.$nowmonth.
'&day='.$nowday.$param.
'" class="datenowlink marginleftonly marginrightonly">'.$langs->trans(
"Today").
'</a> ';
497$nav .= $form->selectDate($dateselect,
'dateselect', 0, 0, 1,
'', 1, 0);
499$nav .=
'<button type="submit" class="liste_titre button_search valignmiddle" name="button_search_x" value="x"><span class="fa fa-search"></span></button>';
502$paramnodate = $param;
503$param .=
'&year='.$year.
'&month='.$month.($day ?
'&day='.$day :
'');
518$paramnoaction = preg_replace(
'/mode=[a-z_]+/',
'', preg_replace(
'/action=[a-z_]+/',
'', $param));
519$paramnoactionodate = preg_replace(
'/mode=[a-z_]+/',
'', preg_replace(
'/action=[a-z_]+/',
'', $paramnodate));
523print
'<form method="POST" id="searchFormList" class="listactionsfilter" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
524if ($optioncss !=
'') {
525 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
527print
'<input type="hidden" name="token" value="'.newToken().
'">';
528print
'<input type="hidden" name="mode" value="'.$mode.
'">';
531$viewmode =
'<div class="navmode inline-block">';
533$viewmode .=
'<a class="btnTitle'.($mode ==
'list' ?
' btnTitleSelected' :
'').
' reposition" href="'.DOL_URL_ROOT.
'/comm/action/list.php?mode=show_list&restore_lastsearch_values=1'.$paramnoactionodate.
'">';
535$viewmode .=
img_picto($langs->trans(
"List"),
'object_calendarlist',
'class="imgforviewmode pictoactionview block"');
537$viewmode .=
'<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone inline-block width75 divoverflow">'.$langs->trans(
"ViewList").
'</span></a>';
539$viewmode .=
'<a class="btnTitle'.($mode ==
'show_month' ?
' btnTitleSelected' :
'').
' reposition" href="'.DOL_URL_ROOT.
'/comm/action/index.php?mode=show_month&year='.(isset(
$object->datep) ?
dol_print_date(
$object->datep,
'%Y') : $year).
'&month='.(isset(
$object->datep) ?
dol_print_date(
$object->datep,
'%m') : $month).
'&day='.(isset(
$object->datep) ?
dol_print_date(
$object->datep,
'%d') : $day).$paramnoactionodate.
'">';
541$viewmode .=
img_picto($langs->trans(
"ViewCal"),
'object_calendarmonth',
'class="pictoactionview block"');
543$viewmode .=
'<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone inline-block width75 divoverflow">'.$langs->trans(
"ViewCal").
'</span></a>';
545$viewmode .=
'<a class="btnTitle'.($mode ==
'show_week' ?
' btnTitleSelected' :
'').
' reposition" href="'.DOL_URL_ROOT.
'/comm/action/index.php?mode=show_week&year='.(isset(
$object->datep) ?
dol_print_date(
$object->datep,
'%Y') : $year).
'&month='.(isset(
$object->datep) ?
dol_print_date(
$object->datep,
'%m') : $month).
'&day='.(isset(
$object->datep) ?
dol_print_date(
$object->datep,
'%d') : $day).$paramnoactionodate.
'">';
547$viewmode .=
img_picto($langs->trans(
"ViewWeek"),
'object_calendarweek',
'class="pictoactionview block"');
549$viewmode .=
'<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone inline-block width75 divoverflow">'.$langs->trans(
"ViewWeek").
'</span></a>';
551$viewmode .=
'<a class="btnTitle'.($mode ==
'show_day' ?
' btnTitleSelected' :
'').
' reposition" href="'.DOL_URL_ROOT.
'/comm/action/index.php?mode=show_day&year='.(isset(
$object->datep) ?
dol_print_date(
$object->datep,
'%Y') : $year).
'&month='.(isset(
$object->datep) ?
dol_print_date(
$object->datep,
'%m') : $month).
'&day='.(isset(
$object->datep) ?
dol_print_date(
$object->datep,
'%d') : $day).$paramnoactionodate.
'">';
553$viewmode .=
img_picto($langs->trans(
"ViewDay"),
'object_calendarday',
'class="pictoactionview block"');
555$viewmode .=
'<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone inline-block width75 divoverflow">'.$langs->trans(
"ViewDay").
'</span></a>';
557$viewmode .=
'<a class="btnTitle'.($mode ==
'show_peruser' ?
' btnTitleSelected' :
'').
' reposition" href="'.DOL_URL_ROOT.
'/comm/action/peruser.php?mode=show_peruser&year='.(isset(
$object->datep) ?
dol_print_date(
$object->datep,
'%Y') : $year).
'&month='.(isset(
$object->datep) ?
dol_print_date(
$object->datep,
'%m') : $month).
'&day='.(isset(
$object->datep) ?
dol_print_date(
$object->datep,
'%d') : $day).$paramnoactionodate.
'">';
559$viewmode .=
img_picto($langs->trans(
"ViewPerUser"),
'object_calendarperuser',
'class="pictoactionview block"');
561$viewmode .=
'<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone inline-block width75 divoverflow" title="'.dolPrintHTML($langs->trans(
"ViewPerUser")).
'">'.$langs->trans(
"ViewPerUser").
'</span></a>';
564$parameters = array();
566$reshook = $hookmanager->executeHooks(
'addCalendarView', $parameters, $object, $action);
567if (empty($reshook)) {
568 $viewmode .= $hookmanager->resPrint;
569} elseif ($reshook > 1) {
570 $viewmode = $hookmanager->resPrint;
573$viewmode .=
'</div>';
575$viewmode .=
'<span class="marginrightonly"></span>';
580if ($user->hasRight(
'agenda',
'myactions',
'create') || $user->hasRight(
'agenda',
'allactions',
'create')) {
583 $newparam .=
'&month='.((int) $month).
'&year='.((int) $tmpforcreatebutton[
'year']).
'&mode='.urlencode($mode);
588 $urltocreateaction = DOL_URL_ROOT.
'/comm/action/card.php?action=create';
589 $urltocreateaction .=
'&apyear='.$tmpforcreatebutton[
'year'].
'&apmonth='.$tmpforcreatebutton[
'mon'].
'&apday='.$tmpforcreatebutton[
'mday'].
'&aphour='.$tmpforcreatebutton[
'hours'].
'&apmin='.$tmpforcreatebutton[
'minutes'];
590 $urltocreateaction .=
'&backtopage='.urlencode($_SERVER[
"PHP_SELF"].($newparam ?
'?'.$newparam :
''));
592 $newcardbutton .=
dolGetButtonTitle($langs->trans(
"AddAction"),
'',
'fa fa-plus-circle', $urltocreateaction);
599$showextcals = $listofextcals;
600$bookcalcalendars = array();
604 $sql =
"SELECT ba.rowid, bc.label, bc.ref, bc.rowid as id_cal";
605 $sql .=
" FROM ".MAIN_DB_PREFIX.
"bookcal_availabilities as ba";
606 $sql .=
" JOIN ".MAIN_DB_PREFIX.
"bookcal_calendar as bc";
607 $sql .=
" ON bc.rowid = ba.fk_bookcal_calendar";
608 $sql .=
" WHERE bc.status = 1";
609 $sql .=
" AND ba.status = 1";
610 $sql .=
" AND bc.entity IN (".getEntity(
'agenda').
")";
611 if (!empty($filtert) && $filtert !=
'-1') {
612 $sql .=
" AND bc.visibility IN (".$db->sanitize($filtert, 0, 0, 0, 0).
")";
614 $resql = $db->query($sql);
616 $num = $db->num_rows($resql);
619 $objp = $db->fetch_object($resql);
620 $label = !empty($objp->label) ? $objp->label : $objp->ref;
621 $bookcalcalendars[
"calendars"][$objp->id_cal] = array(
"id" => $objp->id_cal,
"label" => $label);
622 $bookcalcalendars[
"availabilitieslink"][$objp->rowid] = $objp->id_cal;
630if (!empty($conf->use_javascript_ajax)) {
631 $s .=
"\n".
'<!-- Div to calendars selectors -->'.
"\n";
633 $s .=
'<script type="text/javascript">'.
"\n";
634 $s .=
'jQuery(document).ready(function () {'.
"\n";
635 $s .=
'jQuery(".check_birthday").click(function() { console.log("Toggle class .family_birthday"); jQuery(".family_birthday").toggle(); });'.
"\n";
636 $s .=
'jQuery(".check_holiday").click(function() { console.log("Toggle class .family_holiday"); jQuery(".family_holiday").toggle(); jQuery(this).closest("form").submit(); });'.
"\n";
637 if (
isModEnabled(
"bookcal") && !empty($bookcalcalendars[
"calendars"])) {
638 foreach ($bookcalcalendars[
"calendars"] as $key => $value) {
639 $s .=
'jQuery(".check_bookcal_calendar_'.$value[
'id'].
'").click(function() { console.log("Toggle Bookcal Calendar '.$value[
'id'].
'"); jQuery(".family_bookcal_calendar_'.$value[
'id'].
'").toggle(); });'.
"\n";
642 if ($mode ==
"show_week" || $mode ==
"show_month" || empty($mode)) {
644 $s .=
'jQuery( "div.sortable" ).sortable({connectWith: ".sortable", placeholder: "ui-state-highlight", items: "div.movable", receive: function( event, ui ) {'.
"\n";
646 $s .=
'console.log("submit form to record new event");'.
"\n";
648 $s .=
'var newval = jQuery(event.target).closest("div.dayevent").attr("id");'.
"\n";
649 $s .=
'console.log("found parent div.dayevent with id = "+newval);'.
"\n";
650 $s .=
'var frm=jQuery("#searchFormList");'.
"\n";
651 $s .=
'var newurl = ui.item.find("a.cal_event").attr("href");'.
"\n";
652 $s .=
'console.log("Found url on href of a.cal_event"+newurl+", we submit form with actionmove=mupdate");'.
"\n";
653 $s .=
'frm.attr("action", newurl).children("#newdate").val(newval);frm.submit();}'.
"\n";
657 $s .=
'</script>'.
"\n";
660 $s .=
'<div class="nowrap inline-block minheight30"><input type="checkbox" id="check_mytasks" name="check_mytasks" value="1" checked disabled><label class="labelcalendar"><span class="check_holiday_text"> '.$langs->trans(
"LocalAgenda").
' </span></label></div>';
663 if ($user->hasRight(
"holiday",
"read")) {
665 <div class="nowrap inline-block minheight30"><input type="checkbox" id="check_holiday" name="check_holiday" value="1" class="marginleftonly check_holiday"' . ($check_holiday
666 ?
' checked' :
'') .
'>
667 <label for="check_holiday" class="labelcalendar">
668 <span class="check_holiday_text">' . $langs->trans(
"Holidays") .
'</span>
674 if (is_array($showextcals) && count($showextcals) > 0) {
675 $s .=
'<script type="text/javascript">'.
"\n";
676 $s .=
'jQuery(document).ready(function () {
677 jQuery("div input[name^=\"check_ext\"]").each(function(index, elem) {
678 var name = jQuery(elem).attr("name");
679 if (jQuery(elem).is(":checked")) {
680 jQuery(".family_ext" + name.replace("check_ext", "")).show();
682 jQuery(".family_ext" + name.replace("check_ext", "")).hide();
686 jQuery("div input[name^=\"check_ext\"]").click(function() {
687 var name = $(this).attr("name");
688 jQuery(".family_ext" + name.replace("check_ext", "")).toggle();
691 $s .=
'</script>'.
"\n";
693 foreach ($showextcals as $val) {
694 $htmlname = md5($val[
'name']);
696 if (!empty($val[
'default']) ||
GETPOSTINT(
'check_ext'.$htmlname)) {
697 $default =
"checked";
702 $tooltip = $langs->trans(
"Cache").
' '.round($DELAYFORCACHE / 60).
'mn';
704 $s .=
'<div class="nowrap inline-block minheight30"><input type="checkbox" id="check_ext'.$htmlname.
'" class="marginleftonly check_ext_'.$htmlname.
'" name="check_ext'.$htmlname.
'" value="1" '.$default.
'><label for="check_ext'.$htmlname.
'" title="'.
dol_escape_htmltag($tooltip).
'" class="labelcalendar">'.
dol_escape_htmltag($val[
'name']).
'</label> </div>';
709 $s .=
'<div class="nowrap inline-block minheight30"><input type="checkbox" id="check_birthday" name="check_birthday" class="marginleftonly check_birthday" value="1" '. (
GETPOSTINT(
'check_birthday') ?
' checked' :
'') .
'><label for="check_birthday" class="labelcalendar"> <span class="check_birthday_text">'.$langs->trans(
"AgendaShowBirthdayEvents").
'</span></label> </div>';
713 if (!empty($bookcalcalendars[
"calendars"])) {
714 foreach ($bookcalcalendars[
"calendars"] as $key => $value) {
715 $label = $value[
'label'];
716 $s .=
'<div class="nowrap inline-block minheight30">';
717 $s .=
'<input '.(GETPOST(
'check_bookcal_calendar_'.$value[
'id']) ?
"checked" :
"").
' type="checkbox" id="check_bookcal_calendar_'.$value[
'id'].
'" name="check_bookcal_calendar_'.$value[
'id'].
'" class="marginleftonly check_bookcal_calendar_'.$value[
'id'].
'">';
718 $s .=
'<label for="check_bookcal_calendar_'.$value[
'id'].
'" class="labelcalendar">';
719 $s .=
'<span class="check_bookcal_calendar_'.$value[
'id'].
'_text">'.$langs->trans(
"AgendaShowBookcalCalendar", $label).
'</span>';
720 $s .=
'</label> </div>';
726 $parameters = array();
727 $reshook = $hookmanager->executeHooks(
'addCalendarChoice', $parameters, $object, $action);
728 if (empty($reshook)) {
729 $s .= $hookmanager->resPrint;
730 } elseif ($reshook > 1) {
731 $s = $hookmanager->resPrint;
734 $s .=
"\n".
'<!-- End div to calendars selectors -->'.
"\n";
737 $newparam = preg_replace(
'/check_birthday=[0-1]/i',
'check_birthday='.(empty($check_birthday) ? 1 : 0), $newparam);
738 if (!preg_match(
'/check_birthday=/i', $newparam)) {
739 $newparam .=
'&check_birthday=1';
743 if (empty($check_birthday)) {
744 $s .= $langs->trans(
"AgendaShowBirthdayEvents");
746 $s .= $langs->trans(
"AgendaHideBirthdayEvents");
753$eventarray = array();
761$sql .=
' a.id, a.label,';
764$sql .=
' a.percent,';
765$sql .=
' a.fk_user_author,a.fk_user_action,';
766$sql .=
' a.transparency, a.priority, a.fulldayevent, a.location,';
767$sql .=
' a.fk_soc, a.fk_contact, a.fk_project, a.fk_bookcal_calendar,';
768$sql .=
' a.fk_element, a.elementtype,';
769$sql .=
' ca.code as type_code, ca.libelle as type_label, ca.color as type_color, ca.type as type_type, ca.picto as type_picto';
772$parameters = array();
773$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
774$sql .= $hookmanager->resPrint;
778$sql .=
" FROM ".MAIN_DB_PREFIX.
"c_actioncomm as ca, ".MAIN_DB_PREFIX.
"actioncomm as a";
781if (($filtert !=
'-1' && $filtert !=
'-2') || $usergroup > 0) {
783 $sql .=
" INNER JOIN ".MAIN_DB_PREFIX.
"actioncomm_resources as ar ON ar.fk_actioncomm = a.id AND ar.element_type = 'user'";
784 if ($filtert !=
'-1' && $filtert !=
'-2' && $filtert !=
'-3') {
785 $sql .=
" AND (ar.fk_element IN (".$db->sanitize($filtert).
") OR (ar.fk_element IS NULL AND a.fk_user_action = ".((int) $filtert).
"))";
786 } elseif ($filtert ==
'-3') {
787 $sql .=
" AND ar.fk_element IN (".$db->sanitize(implode(
',', $user->getAllChildIds(1))).
")";
789 if ($usergroup > 0) {
790 $sql .=
" INNER JOIN ".MAIN_DB_PREFIX.
"usergroup_user as ugu ON ugu.fk_user = ar.fk_element AND ugu.fk_usergroup = ".((int) $usergroup);
795if ($resourceid > 0) {
796 $sql .=
", ".MAIN_DB_PREFIX.
"element_resources as r";
800$parameters = array();
801$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
802$sql .= $hookmanager->resPrint;
804$sql .=
" WHERE a.fk_action = ca.id";
805$sql .=
" AND a.entity IN (".getEntity(
'agenda').
")";
807if (!empty($actioncode)) {
809 if ((is_array($actioncode) && in_array(
'AC_NON_AUTO', $actioncode)) || $actioncode ==
'AC_NON_AUTO') {
810 $sql .=
" AND ca.type != 'systemauto'";
811 } elseif ((is_array($actioncode) && in_array(
'AC_ALL_AUTO', $actioncode)) || $actioncode ==
'AC_ALL_AUTO') {
812 $sql .=
" AND ca.type = 'systemauto'";
814 if ((is_array($actioncode) && in_array(
'AC_OTH', $actioncode)) || $actioncode ==
'AC_OTH') {
815 $sql .=
" AND ca.type != 'systemauto'";
817 if ((is_array($actioncode) && in_array(
'AC_OTH_AUTO', $actioncode)) || $actioncode ==
'AC_OTH_AUTO') {
818 $sql .=
" AND ca.type = 'systemauto'";
822 if ((is_array($actioncode) && in_array(
'AC_NON_AUTO', $actioncode)) || $actioncode ===
'AC_NON_AUTO') {
823 $sql .=
" AND ca.type != 'systemauto'";
824 } elseif ((is_array($actioncode) && in_array(
'AC_ALL_AUTO', $actioncode)) || $actioncode ===
'AC_ALL_AUTO') {
825 $sql .=
" AND ca.type = 'systemauto'";
827 if (is_array($actioncode)) {
829 $actioncode = array_filter(
836 return ((
string) $value !==
'-1');
839 if (count($actioncode)) {
840 $sql .=
" AND ca.code IN (".$db->sanitize(
"'".implode(
"','", $actioncode).
"'", 1).
")";
842 } elseif ($actioncode !==
'-1') {
843 $sql .=
" AND ca.code IN (".$db->sanitize(
"'".implode(
"','", explode(
',', $actioncode)).
"'", 1).
")";
848if ($resourceid > 0) {
849 $sql .=
" AND r.element_type = 'action' AND r.element_id = a.id AND r.resource_id = ".((int) $resourceid);
852 $sql .=
" AND a.fk_project=".((int) $pid);
856if (
isModEnabled(
"societe") && !$user->hasRight(
'societe',
'client',
'voir')) {
857 $search_sale = $user->id;
860if ($search_sale && $search_sale !=
'-1') {
861 if ($search_sale == -2) {
862 $sql .=
" AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = a.fk_soc)";
863 } elseif ($search_sale > 0) {
864 $sql .=
" AND (a.fk_soc IS NULL OR EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = a.fk_soc AND sc.fk_user = ".((int) $search_sale).
"))";
869 $sql .=
" AND a.fk_soc = ".((int) $socid);
872if ($mode ==
'show_day') {
874 $sql .=
" (a.datep BETWEEN '".$db->idate(
dol_mktime(0, 0, 0, $month, $day, $year,
'tzuserrel')).
"'";
875 $sql .=
" AND '".$db->idate(
dol_mktime(23, 59, 59, $month, $day, $year,
'tzuserrel')).
"')";
877 $sql .=
" (a.datep2 BETWEEN '".$db->idate(
dol_mktime(0, 0, 0, $month, $day, $year,
'tzuserrel')).
"'";
878 $sql .=
" AND '".$db->idate(
dol_mktime(23, 59, 59, $month, $day, $year,
'tzuserrel')).
"')";
880 $sql .=
" (a.datep < '".$db->idate(
dol_mktime(0, 0, 0, $month, $day, $year,
'tzuserrel')).
"'";
881 $sql .=
" AND a.datep2 > '".$db->idate(
dol_mktime(23, 59, 59, $month, $day, $year,
'tzuserrel')).
"')";
886 $sql .=
" (a.datep BETWEEN '".$db->idate(
dol_mktime(0, 0, 0, $month, 1, $year) - (60 * 60 * 24 * 7)).
"'";
887 $sql .=
" AND '".$db->idate(
dol_mktime(23, 59, 59, $month, 28, $year) + (60 * 60 * 24 * 10)).
"')";
889 $sql .=
" (a.datep2 BETWEEN '".$db->idate(
dol_mktime(0, 0, 0, $month, 1, $year) - (60 * 60 * 24 * 7)).
"'";
890 $sql .=
" AND '".$db->idate(
dol_mktime(23, 59, 59, $month, 28, $year) + (60 * 60 * 24 * 10)).
"')";
892 $sql .=
" (a.datep < '".$db->idate(
dol_mktime(0, 0, 0, $month, 1, $year) - (60 * 60 * 24 * 7)).
"'";
893 $sql .=
" AND a.datep2 > '".$db->idate(
dol_mktime(23, 59, 59, $month, 28, $year) + (60 * 60 * 24 * 10)).
"')";
897 $sql .=
" AND ca.id = ".((int) $type);
901 $sql .=
" AND a.percent = 0";
903if ($status ===
'na') {
905 $sql .=
" AND a.percent = -1";
907if ($status ==
'50') {
909 $sql .=
" AND (a.percent > 0 AND a.percent < 100)";
911if ($status ==
'done' || $status ==
'100') {
912 $sql .=
" AND (a.percent = 100)";
914if ($status ==
'todo') {
915 $sql .=
" AND (a.percent >= 0 AND a.percent < 100)";
919if ($search_categ_cus != -1) {
920 if ($search_categ_cus == -2) {
921 $sql .=
" AND NOT EXISTS (SELECT ca.fk_actioncomm FROM ".MAIN_DB_PREFIX.
"categorie_actioncomm as ca WHERE ca.fk_actioncomm = a.id)";
922 } elseif ($search_categ_cus > 0) {
923 $sql .=
" AND EXISTS (SELECT ca.fk_actioncomm FROM ".MAIN_DB_PREFIX.
"categorie_actioncomm as ca WHERE ca.fk_actioncomm = a.id AND ca.fk_categorie IN (".$db->sanitize($search_categ_cus).
"))";
928$sql .= $db->order(
"datep");
930$MAXONSAMEPAGE = 5000;
932$sql .= $db->plimit($MAXONSAMEPAGE + 1);
934dol_syslog(
"comm/action/index.php", LOG_DEBUG);
936$resql = $db->query($sql);
938 $num = $db->num_rows($resql);
942 while ($i < $num && $i < $MAXONSAMEPAGE) {
943 $obj = $db->fetch_object($resql);
946 if (
getDolGlobalString(
'AGENDA_ALWAYS_HIDE_AUTO') && $obj->type_code ==
'AC_OTH_AUTO') {
954 $event->id = $obj->id;
955 $event->ref = (string) $event->id;
957 $event->fulldayevent = $obj->fulldayevent;
960 if ($event->fulldayevent) {
962 $event->datep = $db->jdate($obj->datep, $tzforfullday ?
'tzuser' :
'tzserver');
963 $event->datef = $db->jdate($obj->datep2, $tzforfullday ?
'tzuser' :
'tzserver');
966 $event->datep = $db->jdate($obj->datep,
'tzserver');
967 $event->datef = $db->jdate($obj->datep2,
'tzserver');
973 $event->type_code = $obj->type_code;
974 $event->type_label = $obj->type_label;
975 $event->type_color = $obj->type_color;
976 $event->type = $obj->type_type;
977 $event->type_picto = $obj->type_picto;
979 $event->label = $obj->label;
980 $event->percentage = $obj->percent;
982 $event->authorid = $obj->fk_user_author;
983 $event->userownerid = $obj->fk_user_action;
984 $event->fetch_userassigned();
986 $event->priority = $obj->priority;
987 $event->location = $obj->location;
988 $event->transparency = $obj->transparency;
989 $event->fk_element = $obj->fk_element;
990 $event->elementid = $obj->fk_element;
991 $event->elementtype = $obj->elementtype;
993 $event->fk_project = $obj->fk_project;
995 $event->socid = $obj->fk_soc;
996 $event->contact_id = $obj->fk_contact;
997 $event->fk_bookcal_calendar = $obj->fk_bookcal_calendar;
998 if (!empty($event->fk_bookcal_calendar)) {
999 $event->type =
"bookcal_calendar";
1004 $event->date_start_in_calendar = $event->datep;
1005 if ($event->datef !=
'' && $event->datef >= $event->datep) {
1006 $event->date_end_in_calendar = $event->datef;
1008 $event->date_end_in_calendar = $event->datep;
1012 if ($event->date_end_in_calendar < $firstdaytoshow || $event->date_start_in_calendar >= $lastdaytoshow) {
1015 if ($event->date_start_in_calendar < $firstdaytoshow) {
1016 $event->date_start_in_calendar = $firstdaytoshow;
1018 if ($event->date_end_in_calendar >= $lastdaytoshow) {
1019 $event->date_end_in_calendar = ($lastdaytoshow - 1);
1023 $daycursor = $event->date_start_in_calendar;
1028 $daycursorend = $event->date_end_in_calendar;
1029 $anneeend = (int)
dol_print_date($daycursorend,
'%Y',
'tzuserrel');
1030 $moisend = (int)
dol_print_date($daycursorend,
'%m',
'tzuserrel');
1031 $jourend = (int)
dol_print_date($daycursorend,
'%d',
'tzuserrel');
1040 $daykey =
dol_mktime(0, 0, 0, $mois, $jour, $annee,
'gmt');
1041 $daykeyend =
dol_mktime(0, 0, 0, $moisend, $jourend, $anneeend,
'gmt');
1055 $eventarray[$daykey][] = $event;
1058 $daykey += 60 * 60 * 24;
1060 if ($daykey > $daykeyend) {
1069 $parameters[
'obj'] = $obj;
1070 $reshook = $hookmanager->executeHooks(
'hookEventElements', $parameters, $event, $action);
1071 $event = $hookmanager->resPrint;
1086if ($check_birthday) {
1088 $sql =
'SELECT sp.rowid, sp.lastname, sp.firstname, sp.birthday';
1089 $sql .=
' FROM '.MAIN_DB_PREFIX.
'socpeople as sp';
1090 $sql .=
' WHERE (priv=0 OR (priv=1 AND fk_user_creat='.((int) $user->id).
'))';
1091 $sql .=
" AND sp.entity IN (".getEntity(
'contact').
")";
1092 if ($mode ==
'show_day') {
1093 $sql .=
' AND MONTH(birthday) = '.((int) $month);
1094 $sql .=
' AND DAY(birthday) = '.((int) $day);
1096 $sql .=
' AND MONTH(birthday) = '.((int) $month);
1098 $sql .=
' ORDER BY birthday';
1100 dol_syslog(
"comm/action/index.php", LOG_DEBUG);
1101 $resql = $db->query($sql);
1103 $num = $db->num_rows($resql);
1108 $obj = $db->fetch_object($resql);
1112 $event->id = $obj->rowid;
1113 $event->ref = (string) $event->id;
1118 $event->datep =
dol_mktime(0, 0, 0, $datearray[
'mon'], $datearray[
'mday'], $year,
true);
1119 $event->datef = $event->datep;
1121 $event->type_code =
'BIRTHDAY';
1122 $event->type_label =
'';
1123 $event->type_color =
'';
1124 $event->type =
'birthdate';
1125 $event->type_picto =
'birthdate';
1127 $event->label = $langs->trans(
"Birthday").
' '.
dolGetFirstLastname($obj->firstname, $obj->lastname);
1128 $event->percentage = 100;
1129 $event->fulldayevent = 1;
1131 $event->contact_id = $obj->rowid;
1133 $event->date_start_in_calendar = $db->jdate($event->datep);
1134 $event->date_end_in_calendar = $db->jdate($event->datef);
1137 $daycursor = $event->datep;
1142 $daykey =
dol_mktime(0, 0, 0, $mois, $jour, $annee,
'gmt');
1144 $eventarray[$daykey][] = $event;
1162if ($user->hasRight(
"holiday",
"read")) {
1163 $sql =
"SELECT u.rowid as uid, u.lastname, u.firstname, u.statut, x.rowid, x.date_debut as date_start, x.date_fin as date_end, x.halfday, x.statut as status";
1164 $sql .=
" FROM ".MAIN_DB_PREFIX.
"holiday as x, ".MAIN_DB_PREFIX.
"user as u";
1165 $sql .=
" WHERE u.rowid = x.fk_user";
1166 $sql .=
" AND u.statut = '1'";
1167 $sql .=
" AND (x.statut = '2' OR x.statut = '3')";
1168 if ($mode ==
'show_day') {
1170 $sql .=
" AND '".$db->escape($year).
"-".$db->escape($month).
"-".$db->escape($day).
"' BETWEEN x.date_debut AND x.date_fin";
1171 } elseif ($mode ==
'show_week') {
1173 $sql .=
" AND x.date_debut < '".$db->idate(
dol_get_last_day($year, $month)).
"'";
1174 $sql .=
" AND x.date_fin >= '".$db->idate(
dol_get_first_day($year, $month)).
"'";
1175 } elseif ($mode ==
'show_month') {
1177 $sql .=
" AND x.date_debut <= '".$db->idate(
dol_get_last_day($year, $month)).
"'";
1178 $sql .=
" AND x.date_fin >= '".$db->idate(
dol_get_first_day($year, $month)).
"'";
1180 if (!$user->hasRight(
'holiday',
'readall') || $filtert ==
'-3') {
1182 $sql .=
" AND x.fk_user IN(".$db->sanitize(implode(
", ", $user->getAllChildIds(1))).
") ";
1186 $sql .=
" AND x.fk_user = ".((int) $filtert);
1189 $resql = $db->query($sql);
1191 $num = $db->num_rows($resql);
1196 $obj = $db->fetch_object($resql);
1201 $event->id = $obj->rowid;
1202 $event->ref = (string) $event->id;
1204 $event->type_code =
'HOLIDAY';
1205 $event->type_label =
'';
1206 $event->type_color =
'';
1207 $event->type =
'holiday';
1208 $event->type_picto =
'holiday';
1210 $event->datep = $db->jdate($obj->date_start) + (empty($obj->halfday) || $obj->halfday == 1 ? 0 : 12) * 60 * 60;
1211 $event->datef = $db->jdate($obj->date_end) + (empty($obj->halfday) || $obj->halfday == -1 ? 24 : 12) * 60 * 60 - 1;
1212 $event->date_start_in_calendar = $event->datep;
1213 $event->date_end_in_calendar = $event->datef;
1215 if ($obj->status == 3) {
1217 $event->percentage = -1;
1218 } elseif ($obj->status == 2) {
1220 $event->percentage = 0;
1223 $event->label = $langs->trans(
"Holiday");
1225 $daycursor = $event->date_start_in_calendar;
1230 $daycursorend = $event->date_end_in_calendar;
1231 $anneeend = (int)
dol_print_date($daycursorend,
'%Y',
'tzuserrel');
1232 $moisend = (int)
dol_print_date($daycursorend,
'%m',
'tzuserrel');
1233 $jourend = (int)
dol_print_date($daycursorend,
'%d',
'tzuserrel');
1236 $daykey =
dol_mktime(0, 0, 0, $mois, $jour, $annee,
'gmt');
1237 $daykeygmt =
dol_mktime(0, 0, 0, $mois, $jour, $annee,
'gmt');
1242 $firstdayofholiday = ($ifornbofdays == 1);
1243 $lastdayofholiday = ($daykeygmt ==
dol_get_first_hour($event->date_end_in_calendar,
'gmt'));
1252 if ((in_array($obj->halfday, array(1, 2)) == 1 && $lastdayofholiday) || (in_array($obj->halfday, array(-1, 2)) && $firstdayofholiday)) {
1255 if (in_array($obj->halfday, array(1, 2)) && $lastdayofholiday) {
1256 $newevent->label .=
' ('.$langs->trans(
"Morning").
')';
1257 } elseif (in_array($obj->halfday, array(-1, 2)) && $firstdayofholiday) {
1258 $newevent->label .=
' ('.$langs->trans(
"Afternoon").
')';
1260 $eventarray[$daykey][] = $newevent;
1262 $eventarray[$daykey][] = $event;
1265 $daykey += 60 * 60 * 24;
1266 $daykeygmt += 60 * 60 * 24;
1267 }
while ($daykey <= $event->date_end_in_calendar);
1276if (count($listofextcals)) {
1277 require_once DOL_DOCUMENT_ROOT.
'/comm/action/class/ical.class.php';
1279 foreach ($listofextcals as $key => $extcal) {
1280 $url = $extcal[
'src'];
1281 $namecal = $extcal[
'name'];
1282 $offsettz = $extcal[
'offsettz'];
1283 $colorcal = $extcal[
'color'];
1284 $buggedfile = $extcal[
'buggedfile'];
1290 $ical->parse($url, $pathforcachefile, $DELAYFORCACHE);
1293 $listofextcals[$key][
'error'] = $ical->error;
1294 $s .=
'<br><div class="warning">'.dol_escape_htmltag($listofextcals[$key][
'name']).
': '.$url.
'<br>Error message: '.
dol_escape_htmltag($ical->error).
'</div>';
1299 $icalevents = array();
1300 $tmparray = $ical->get_event_list();
1301 if (is_array($tmparray)) {
1302 $icalevents = array_merge($icalevents, $tmparray);
1304 $tmparray = $ical->get_freebusy_list();
1305 if (is_array($tmparray)) {
1306 $icalevents = array_merge($icalevents, $tmparray);
1309 $nbevents += count($icalevents);
1311 if (count($icalevents) > 0) {
1313 $moreicalevents = array();
1314 foreach ($icalevents as $icalevent) {
1315 if (isset($icalevent[
'RRULE']) && is_array($icalevent[
'RRULE'])) {
1318 if ($icalevent[
'DTSTART;VALUE=DATE']) {
1321 } elseif (is_array($icalevent[
'DTSTART']) && !empty($icalevent[
'DTSTART'][
'unixtime'])) {
1322 $datecurstart = $icalevent[
'DTSTART'][
'unixtime'];
1323 $datecurend = $icalevent[
'DTEND'][
'unixtime'];
1324 if (!empty($ical->cal[
'DAYLIGHT'][
'DTSTART']) && $datecurstart) {
1326 $tmpcurstart = $datecurstart;
1327 $tmpcurend = $datecurend;
1328 $tmpdaylightstart =
dol_mktime(0, 0, 0, 1, 1, 1970, 1) + (int) $ical->cal[
'DAYLIGHT'][
'DTSTART'];
1329 $tmpdaylightend =
dol_mktime(0, 0, 0, 1, 1, 1970, 1) + (int) $ical->cal[
'STANDARD'][
'DTSTART'];
1332 if ($tmpcurstart >= $tmpdaylightstart && $tmpcurstart < $tmpdaylightend) {
1333 $datecurstart -= ((int) $ical->cal[
'DAYLIGHT'][
'TZOFFSETTO']) * 36;
1335 $datecurstart -= ((int) $ical->cal[
'STANDARD'][
'TZOFFSETTO']) * 36;
1337 if ($tmpcurend >= $tmpdaylightstart && $tmpcurstart < $tmpdaylightend) {
1338 $datecurend -= ((int) $ical->cal[
'DAYLIGHT'][
'TZOFFSETTO']) * 36;
1340 $datecurend -= ((int) $ical->cal[
'STANDARD'][
'TZOFFSETTO']) * 36;
1347 dol_syslog(
"Found a not recognized repeatable record with unknown date start", LOG_ERR);
1352 $interval = (empty($icalevent[
'RRULE'][
'INTERVAL']) ? 1 : $icalevent[
'RRULE'][
'INTERVAL']);
1353 $until = empty($icalevent[
'RRULE'][
'UNTIL']) ? 0 :
dol_stringtotime($icalevent[
'RRULE'][
'UNTIL'], 1);
1354 $maxrepeat = empty($icalevent[
'RRULE'][
'COUNT']) ? 0 : $icalevent[
'RRULE'][
'COUNT'];
1355 if ($until && ($until + ($datecurend - $datecurstart)) < $firstdaytoshow) {
1358 if ($datecurstart >= $lastdaytoshow) {
1363 while (($datecurstart < $lastdaytoshow) && (empty($maxrepeat) || ($numofevent < $maxrepeat))) {
1364 if ($datecurend >= $firstdaytoshow) {
1365 $newevent = $icalevent;
1366 unset($newevent[
'RRULE']);
1367 if ($icalevent[
'DTSTART;VALUE=DATE']) {
1368 $newevent[
'DTSTART;VALUE=DATE'] =
dol_print_date($datecurstart,
'%Y%m%d');
1369 $newevent[
'DTEND;VALUE=DATE'] =
dol_print_date($datecurend + 1,
'%Y%m%d');
1371 $newevent[
'DTSTART'] = $datecurstart;
1372 $newevent[
'DTEND'] = $datecurend;
1374 $moreicalevents[] = $newevent;
1378 $savdatecurstart = $datecurstart;
1379 if ($icalevent[
'RRULE'][
'FREQ'] ==
'DAILY') {
1383 if ($icalevent[
'RRULE'][
'FREQ'] ==
'WEEKLY') {
1386 } elseif ($icalevent[
'RRULE'][
'FREQ'] ==
'MONTHLY') {
1389 } elseif ($icalevent[
'RRULE'][
'FREQ'] ==
'YEARLY') {
1394 if ($savdatecurstart >= $datecurstart) {
1395 dol_syslog(
"Found a rule freq ".$icalevent[
'RRULE'][
'FREQ'].
" not managed by dolibarr code. Assume 1 week frequency.", LOG_ERR);
1396 $datecurstart += 3600 * 24 * 7;
1397 $datecurend += 3600 * 24 * 7;
1402 $icalevents = array_merge($icalevents, $moreicalevents);
1405 foreach ($icalevents as $icalevent) {
1410 if (!empty($icalevent[
'RRULE'])) {
1417 if (isset($icalevent[
'DTSTART;VALUE=DATE'])) {
1420 if (empty($icalevent[
'DTEND;VALUE=DATE'])) {
1421 $dateend = $datestart + 86400 - 1;
1427 $event->fulldayevent = 1;
1429 } elseif (!is_array($icalevent[
'DTSTART'])) {
1430 $datestart = $icalevent[
'DTSTART'];
1431 $dateend = empty($icalevent[
'DTEND']) ? $datestart : $icalevent[
'DTEND'];
1433 $datestart += +($offsettz * 3600);
1434 $dateend += +($offsettz * 3600);
1439 } elseif (isset($icalevent[
'DTSTART'][
'unixtime'])) {
1440 $datestart = $icalevent[
'DTSTART'][
'unixtime'];
1441 $dateend = $icalevent[
'DTEND'][
'unixtime'];
1443 $datestart += +($offsettz * 3600);
1444 $dateend += +($offsettz * 3600);
1447 if ($buggedfile ===
'uselocalandtznodaylight') {
1451 if ($buggedfile ===
'uselocalandtzdaylight') {
1452 $localtzs =
new DateTimeZone(preg_replace(
'/"/',
'', $icalevent[
'DTSTART'][
'TZID']));
1453 $localtze =
new DateTimeZone(preg_replace(
'/"/',
'', $icalevent[
'DTEND'][
'TZID']));
1454 $localdts =
new DateTime(
dol_print_date($datestart,
'dayrfc',
'gmt'), $localtzs);
1455 $localdte =
new DateTime(
dol_print_date($dateend,
'dayrfc',
'gmt'), $localtze);
1456 $tmps = -1 * $localtzs->getOffset($localdts);
1457 $tmpe = -1 * $localtze->getOffset($localdte);
1458 $datestart += $tmps;
1466 $event->id = $icalevent[
'UID'];
1467 $event->ref = (string) $event->id;
1468 $userId = $userstatic->findUserIdByEmail($namecal);
1469 if (!empty($userId) && $userId > 0) {
1470 $event->userassigned[$userId] = $userId;
1471 $event->percentage = -1;
1474 $event->type_code =
"ICALEVENT";
1475 $event->type_label = $namecal;
1476 $event->type_color = $colorcal;
1477 $event->type =
'icalevent';
1478 $event->type_picto =
'rss';
1480 $event->icalname = $namecal;
1481 $event->icalcolor = $colorcal;
1483 $event->datep = $datestart + $usertime;
1484 $event->datef = $dateend + $usertime;
1486 if (isset($icalevent[
'SUMMARY']) && $icalevent[
'SUMMARY']) {
1488 } elseif (isset($icalevent[
'DESCRIPTION']) && $icalevent[
'DESCRIPTION']) {
1491 $event->label = $langs->trans(
"ExtSiteNoLabel");
1498 if (!empty($icalevent[
'PRIORITY'])) {
1499 $event->priority = $icalevent[
'PRIORITY'];
1503 if (!empty($icalevent[
'TRANSP'])) {
1504 if ($icalevent[
'TRANSP'] ==
"TRANSPARENT") {
1505 $event->transparency = 0;
1507 if ($icalevent[
'TRANSP'] ==
"OPAQUE") {
1508 $event->transparency = 1;
1519 if (!empty($icalevent[
'LOCATION'])) {
1520 $event->location = $icalevent[
'LOCATION'];
1523 $event->date_start_in_calendar = $event->datep;
1525 if ($event->datef !=
'' && $event->datef >= $event->datep) {
1526 $event->date_end_in_calendar = $event->datef;
1528 $event->date_end_in_calendar = $event->datep;
1532 if ($event->date_end_in_calendar < $firstdaytoshow || $event->date_start_in_calendar >= $lastdaytoshow) {
1538 if ($event->date_start_in_calendar < $firstdaytoshow) {
1539 $event->date_start_in_calendar = $firstdaytoshow;
1541 if ($event->date_end_in_calendar >= $lastdaytoshow) {
1542 $event->date_end_in_calendar = ($lastdaytoshow - 1);
1546 $daycursor = $event->date_start_in_calendar;
1555 $daykey =
dol_mktime(0, 0, 0, $mois, $jour, $annee,
'gmt');
1556 $daykeygmt =
dol_mktime(0, 0, 0, $mois, $jour, $annee,
'gmt');
1559 $eventarray[$daykey][] = $event;
1560 $daykey += 60 * 60 * 24;
1561 $daykeygmt += 60 * 60 * 24;
1562 if (($event->fulldayevent ? $daykeygmt : $daykey) > $event->date_end_in_calendar) {
1574$parameters = array();
1576$reshook = $hookmanager->executeHooks(
'getCalendarEvents', $parameters, $object, $action);
1577if (!empty($hookmanager->resArray[
'eventarray'])) {
1578 foreach ($hookmanager->resArray[
'eventarray'] as $keyDate => $events) {
1579 if (!isset($eventarray[$keyDate])) {
1580 $eventarray[$keyDate] = array();
1582 $eventarray[$keyDate] = array_merge($eventarray[$keyDate], $events);
1587foreach ($eventarray as $keyDate => &$dateeventarray) {
1588 usort($dateeventarray,
'sort_events_by_date');
1593$cachethirdparties = array();
1594$cachecontacts = array();
1598 array(137, 86, 161),
1599 array(60, 147, 183),
1600 array(250, 190, 80),
1602 array(190, 190, 100),
1603 array(91, 115, 247),
1604 array(140, 140, 220),
1605 array(190, 120, 120),
1606 array(115, 125, 150),
1607 array(100, 170, 20),
1608 array(150, 135, 125),
1609 array(85, 135, 150),
1610 array(150, 135, 80),
1615$color_file = DOL_DOCUMENT_ROOT.
"/theme/".$conf->theme.
"/theme_vars.inc.php";
1616if (is_readable($color_file)) {
1618 include $color_file;
1622$massactionbutton =
'';
1624print_barre_liste($langs->trans(
"Agenda"), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, -1,
'object_action', 0, $nav.
'<span class="marginleftonly"></span>'.$newcardbutton,
'', $limit, 1, 0, 1, $viewmode);
1626if ($nbevents > $MAXONSAMEPAGE) {
1627 print
info_admin(
'Number of results has been truncated to '.$MAXONSAMEPAGE, 0, 0,
'warning').
'<br>';
1634if (empty($mode) || $mode ==
'show_month') {
1636 $newparam = preg_replace(
'/check_birthday=/i',
'check_birthday_=', $newparam);
1637 $newparam = preg_replace(
'/mode=show_month&?/i',
'', $newparam);
1638 $newparam = preg_replace(
'/mode=show_week&?/i',
'', $newparam);
1639 $newparam = preg_replace(
'/day=[0-9]+&?/i',
'', $newparam);
1640 $newparam = preg_replace(
'/month=[0-9]+&?/i',
'', $newparam);
1641 $newparam = preg_replace(
'/year=[0-9]+&?/i',
'', $newparam);
1642 $newparam = preg_replace(
'/viewcal=[0-9]+&?/i',
'', $newparam);
1643 $newparam = preg_replace(
'/check_birthday_=/i',
'check_birthday=', $newparam);
1644 $newparam .=
'&viewcal=1';
1646 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1647 print_actions_filter($form, $canedit, $status, $year, $month, $day, $check_birthday,
'', $filtert,
'', $pid, $socid, $action, -1, $actioncode, $usergroup,
'', $resourceid, $search_categ_cus);
1650 print
'<div class="div-table-responsive-no-min sectioncalendarbymonth maxscreenheightless300">';
1651 print
'<table class="centpercent noborder nocellnopadd cal_pannel cal_month listwithfilterbefore">';
1652 print
' <tr class="liste_titre sticky">';
1654 echo
' <td class="center">#</td>';
1657 print
' <td class="center bold uppercase tdfordaytitle'.($i == 0 ?
' borderleft' :
'').
'">';
1659 if (!empty($conf->dol_optimize_smallscreen)) {
1660 $labelshort = array(0 =>
'SundayMin', 1 =>
'MondayMin', 2 =>
'TuesdayMin', 3 =>
'WednesdayMin', 4 =>
'ThursdayMin', 5 =>
'FridayMin', 6 =>
'SaturdayMin');
1661 print $langs->trans($labelshort[$numdayinweek]);
1663 print $langs->trans(
"Day".$numdayinweek);
1665 print
' </td>'.
"\n";
1671 $todaytms =
dol_mktime(0, 0, 0, $todayarray[
'mon'], $todayarray[
'mday'], $todayarray[
'year']);
1675 for ($iter_week = 0; $iter_week < 6; $iter_week++) {
1679 $currdate0 = sprintf(
"%04d", $prev_year).sprintf(
"%02d", $prev_month).sprintf(
"%02d", $max_day_in_prev_month + $tmpday);
1680 } elseif ($tmpday <= $max_day_in_month) {
1681 $currdate0 = sprintf(
"%04d", $year).sprintf(
"%02d", $month).sprintf(
"%02d", $tmpday);
1683 $currdate0 = sprintf(
"%04d", $next_year).sprintf(
"%02d", $next_month).sprintf(
"%02d", $tmpday - $max_day_in_month);
1686 $numweek0 =
date(
"W", strtotime(
date($currdate0)));
1688 echo
' <td class="center weeknumber opacitymedium" width="2%">'.$numweek0.
'</td>';
1690 for ($iter_day = 0; $iter_day < 7; $iter_day++) {
1693 $style =
'cal_other_month cal_past';
1694 if ($iter_day == 6) {
1695 $style .=
' cal_other_month_right';
1697 echo
' <td class="'.$style.
' nowrap tdtop" width="14%">';
1699 show_day_events($db, $max_day_in_prev_month + $tmpday, $prev_month, $prev_year, $month, $style, $eventarray, $maxprint, $maxnbofchar, $newparam);
1701 } elseif ($tmpday <= $max_day_in_month) {
1703 $curtime =
dol_mktime(0, 0, 0, $month, $tmpday, $year);
1704 $style =
'cal_current_month';
1705 if ($iter_day == 6) {
1706 $style .=
' cal_current_month_right';
1709 if ($todayarray[
'mday'] == $tmpday && $todayarray[
'mon'] == $month && $todayarray[
'year'] == $year) {
1713 $style =
'cal_today';
1715 if ($curtime < $todaytms) {
1716 $style .=
' cal_past';
1719 echo
' <td class="'.$style.
' nowrap tdtop" width="14%">';
1721 show_day_events($db, $tmpday, $month, $year, $month, $style, $eventarray, $maxprint, $maxnbofchar, $newparam, 0, 60, 0, $bookcalcalendars);
1725 $style =
'cal_other_month';
1726 if ($iter_day == 6) {
1727 $style .=
' cal_other_month_right';
1729 echo
' <td class="'.$style.
' nowrap tdtop" width="14%">';
1731 show_day_events($db, $tmpday - $max_day_in_month, $next_month, $next_year, $month, $style, $eventarray, $maxprint, $maxnbofchar, $newparam);
1741 print
'<input type="hidden" name="actionmove" value="mupdate">';
1742 print
'<input type="hidden" name="backtopage" value="'.dol_escape_htmltag($_SERVER[
'PHP_SELF']).
'?mode=show_month&'.
dol_escape_htmltag($_SERVER[
'QUERY_STRING']).
'">';
1743 print
'<input type="hidden" name="newdate" id="newdate">';
1744} elseif ($mode ==
'show_week') {
1747 $newparam = preg_replace(
'/check_birthday=/i',
'check_birthday_=', $newparam);
1748 $newparam = preg_replace(
'/mode=show_month&?/i',
'', $newparam);
1749 $newparam = preg_replace(
'/mode=show_week&?/i',
'', $newparam);
1750 $newparam = preg_replace(
'/day=[0-9]+&?/i',
'', $newparam);
1751 $newparam = preg_replace(
'/month=[0-9]+&?/i',
'', $newparam);
1752 $newparam = preg_replace(
'/year=[0-9]+&?/i',
'', $newparam);
1753 $newparam = preg_replace(
'/viewweek=[0-9]+&?/i',
'', $newparam);
1754 $newparam = preg_replace(
'/check_birthday_=/i',
'check_birthday=', $newparam);
1755 $newparam .=
'&viewweek=1';
1757 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1758 print_actions_filter($form, $canedit, $status, $year, $month, $day, $check_birthday,
'', $filtert,
'', $pid, $socid, $action, -1, $actioncode, $usergroup,
'', $resourceid);
1761 print
'<div class="div-table-responsive-no-min sectioncalendarbyweek maxscreenheightless300">';
1762 print
'<table class="centpercent noborder nocellnopadd cal_pannel cal_month listwithfilterbefore">';
1763 print
' <tr class="liste_titre">';
1766 echo
' <td class="center bold uppercase tdfordaytitle">'.$langs->trans(
"Day".(($i + (
getDolGlobalInt(
'MAIN_START_WEEK', 1))) % 7)).
"</td>\n";
1773 for ($iter_day = 0; $iter_day < 7; $iter_day++) {
1780 $style =
'cal_current_month';
1781 if ($iter_day == 6) {
1782 $style .=
' cal_other_month_right';
1787 if ($todayarray[
'mday'] == $tmpday && $todayarray[
'mon'] == $tmpmonth && $todayarray[
'year'] == $tmpyear) {
1791 $style =
'cal_today';
1794 echo
' <td class="'.$style.
'" width="14%" valign="top">';
1796 show_day_events($db, $tmpday, $tmpmonth, $tmpyear, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300, 0, $bookcalcalendars);
1804 echo
'<input type="hidden" name="actionmove" value="mupdate">';
1805 echo
'<input type="hidden" name="backtopage" value="'.dol_escape_htmltag($_SERVER[
'PHP_SELF']).
'?mode=show_week&'.
dol_escape_htmltag($_SERVER[
'QUERY_STRING']).
'">';
1806 echo
'<input type="hidden" name="newdate" id="newdate">';
1809 $newparam = preg_replace(
'/mode=show_month&?/i',
'', $newparam);
1810 $newparam = preg_replace(
'/mode=show_week&?/i',
'', $newparam);
1811 $newparam = preg_replace(
'/viewday=[0-9]+&?/i',
'', $newparam);
1812 $newparam .=
'&viewday=1';
1814 $style =
'cal_current_month cal_current_month_oneday';
1817 if ($todayarray[
'mday'] == $day && $todayarray[
'mon'] == $month && $todayarray[
'year'] == $year) {
1822 $timestamp =
dol_mktime(12, 0, 0, $month, $day, $year);
1825 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1826 print_actions_filter($form, $canedit, $status, $year, $month, $day, $check_birthday,
'', $filtert,
'', $pid, $socid, $action, -1, $actioncode, $usergroup,
'', $resourceid);
1829 print
'<div class="div-table-responsive-no-min sectioncalendarbyday maxscreenheightless300">';
1830 echo
'<table class="tagtable centpercent noborder nocellnopadd cal_pannel cal_month listwithfilterbefore" style="margin-bottom: 10px !important;">';
1832 echo
' <tr class="tagtr liste_titre">';
1833 echo
' <td class="tagtd center bold uppercase">'.$langs->trans(
"Day".$arraytimestamp[
'wday']).
"</td>\n";
1850 print
'<div class="div-table-responsive-no-min">';
1852 $maxheightwin = (isset($_SESSION[
"dol_screenheight"]) && $_SESSION[
"dol_screenheight"] > 500) ? ($_SESSION[
"dol_screenheight"] - 200) : 660;
1854 echo
'<div style="max-height: '.$maxheightwin.
'px;">';
1855 echo
'<div class="tagtable centpercent calendarviewcontainer">';
1860 $minhour = round((
float) $tmp[0], 0);
1861 $maxhour = round((
float) $tmp[1], 0);
1862 if ($minhour > 23) {
1868 if ($maxhour <= $minhour) {
1869 $maxhour = $minhour + 1;
1875 echo
' <div class="tagtr calendarviewcontainertr">'.
"\n";
1876 echo
' <div class="tagtd width100 tdtop">'.dol_print_date($i * 3600,
'hour',
'gmt').
'</div>';
1877 echo
' <div class="tagtd '.$style.
' tdtop"></div>'.
"\n";
1878 echo
' </div>'.
"\n";
1883 echo
'</div></div>';
1886 show_day_events($db, $day, $month, $year, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300, 1, $bookcalcalendars);
1890 print
'<div class="div-table-responsive-no-min">';
1893 show_day_events($db, $day, $month, $year, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300, 0, $bookcalcalendars);
1905print
"\n".
'</form>';
1931function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventarray, $maxprint = 0, $maxnbofchar = 16, $newparam =
'', $showinfo = 0, $minheight = 60, $nonew = 0, $bookcalcalendarsarray = array())
1933 global $user, $conf, $langs;
1934 global $action, $mode, $filter, $filtert, $status, $actioncode, $usergroup;
1936 global $cachethirdparties, $cachecontacts,
$cacheusers, $colorindexused;
1937 global $hookmanager;
1939 '@phan-var-force array{0:array{0:int,1:int,2:int},1:array{0:int,1:int,2:int},2:array{0:int,1:int,2:int},3:array{0:int,1:int,2:int}} $theme_datacolor
1940 @phan-var-force User[] $cacheusers
1941 @phan-var-force array<int<0,3>> $colorindexused';
1948 if ($conf->use_javascript_ajax) {
1949 $conf->global->MAIN_JS_SWITCH_AGENDA = 1;
1952 $dateint = sprintf(
"%04d", $year).sprintf(
"%02d", $month).sprintf(
"%02d", $day);
1958 $curtime =
dol_mktime(0, 0, 0, $month, $day, $year);
1959 $urltoshow = DOL_URL_ROOT.
'/comm/action/index.php?mode=show_day&day='.str_pad((
string) $day, 2,
"0", STR_PAD_LEFT).
'&month='.str_pad((
string) $month, 2,
"0", STR_PAD_LEFT).
'&year='.$year.$newparam;
1961 if ($user->hasRight(
'agenda',
'myactions',
'create') || $user->hasRight(
'agenda',
'allactions',
'create')) {
1962 $newparam .=
'&month='.str_pad((
string) $month, 2,
"0", STR_PAD_LEFT).
'&year='.$year;
1963 $hourminsec =
'100000';
1964 $urltocreate = DOL_URL_ROOT.
'/comm/action/card.php?action=create&datep='.sprintf(
"%04d%02d%02d", $year, $month, $day).$hourminsec.
'&backtopage='.urlencode($_SERVER[
"PHP_SELF"].($newparam ?
'?'.$newparam :
''));
1968 print
'<div id="dayevent_'.$dateint.
'" class="dayevent tagtable centpercent nobordernopadding">'.
"\n";
1971 print
'<div class="tagtr cursorpointer" onclick="window.location=\''.$urltocreate.
'\';
"><div class="nowrap tagtd
"><div class="left
inline-block
">';
1972 print '<a class="dayevent-aday
" style="color: #666
" href="'.$urltoshow.'">';
1973 print ($datenowint == $dateint ? '<span class="badgeneutral
">' : '');
1975 print dol_print_date($curtime, 'daytextshort');
1977 print dol_print_date($curtime, '%d');
1979 print ($datenowint == $dateint ? '</span>' : '');
1981 print '</div><div class="nowrap floatright
inline-block marginrightonly
">';
1982 if ($user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda', 'allactions', 'create')) {
1983 print '<a class="cursoradd
" href="'.$urltocreate.'">'; // Explicit link, useful for nojs interfaces
1984 print img_picto($langs->trans("NewAction
"), 'edit_add.png');
1987 print '</div></div></div>'."\n
";
1995 // Line with td contains all div of each events
1996 print '<div class="tagtr
">';
1997 print '<div class="tagtd centpercent agendacell sortable
">';
1999 //$curtime = dol_mktime (0, 0, 0, $month, $day, $year);
2006 $numicals = array();
2007 $ymd = sprintf("%04d
", $year).sprintf("%02d
", $month).sprintf("%02d
", $day);
2009 $colorindexused[$user->id] = 0; // Color index for current user (user->id) is always 0
2010 $nextindextouse = is_array($colorindexused) ? count($colorindexused) : 0; // At first run this is 0, so fist user has 0, next 1, ...
2011 //var_dump($colorindexused);
2013 include_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php';
2014 $tmpholiday = new Holiday($db);
2016 foreach ($eventarray as $daykey => $notused) { // daykey is the 'YYYYMMDD' to show according to user
2017 $annee = (int) dol_print_date($daykey, '%Y', 'gmt'); // We use gmt because we want the value represented by string 'YYYYMMDD'
2018 $mois = (int) dol_print_date($daykey, '%m', 'gmt'); // We use gmt because we want the value represented by string 'YYYYMMDD'
2019 $jour = (int) dol_print_date($daykey, '%d', 'gmt'); // We use gmt because we want the value represented by string 'YYYYMMDD'
2021 //print 'event daykey='.$daykey.' dol_print_date(daykey)='.dol_print_date($daykey, 'dayhour', 'gmt').' jour='.$jour.' mois='.$mois.' annee='.$annee."<br>\n
";
2022 //print 'event daykey='.$daykey.' dol_print_date(daykey)='.dol_print_date($daykey, 'dayhour', 'gmt').' day='.$day.' month='.$month.' year='.$year."<br>\n
";
2024 if ($day == $jour && $month == $mois && $year == $annee) {
2025 foreach ($eventarray[$daykey] as $index => $event) {
2026 if ($i < $maxprint || $maxprint == 0 || getDolGlobalString('MAIN_JS_SWITCH_AGENDA')) {
2027 $keysofuserassigned = array_keys($event->userassigned);
2029 // Define $color (Hex string like '0088FF') and $cssclass of event
2033 if (in_array($user->id, $keysofuserassigned)) {
2034 $cssclass = 'family_mytasks';
2036 if (empty($cacheusers[$event->userownerid])) {
2037 $newuser = new User($db);
2038 $newuser->fetch($event->userownerid);
2039 $cacheusers[$event->userownerid] = $newuser;
2041 //var_dump($cacheusers[$event->userownerid]->color);
2043 // We decide to choose color of owner of event (event->userownerid is user id of owner, event->userassigned contains all users assigned to event)
2044 if (!empty($cacheusers[$event->userownerid]->color)) {
2045 $color = $cacheusers[$event->userownerid]->color;
2048 /* May be we need this: if (getDolGlobalString('AGENDA_USE_COLOR_PER_EVENT_TYPE')) {
2049 $color = $event->type_color;
2051 } elseif ($event->type_code == 'ICALEVENT') { // Event come from external ical file
2053 if (!empty($event->icalname)) {
2054 if (!isset($numicals[dol_string_nospecial($event->icalname)])) {
2055 $numicals[dol_string_nospecial($event->icalname)] = 0;
2057 $numicals[dol_string_nospecial($event->icalname)]++;
2060 $color = ($event->icalcolor ? $event->icalcolor : -1);
2061 $cssclass = (!empty($event->icalname) ? 'family_ext'.md5($event->icalname) : 'family_other');
2062 } elseif ($event->type_code == 'BIRTHDAY') {
2065 $cssclass = 'family_birthday ';
2066 $color = sprintf("%02x%02x%02x
", $theme_datacolor[$colorindex][0], $theme_datacolor[$colorindex][1], $theme_datacolor[$colorindex][2]);
2067 } elseif ($event->type == 'bookcal_calendar') {
2070 $cssclass = 'family_bookcal_calendar_'.(!empty($bookcalcalendarsarray["availabilitieslink
"]) ? $bookcalcalendarsarray["availabilitieslink
"][$event->fk_bookcal_calendar] : "");
2071 $color = sprintf("%02x%02x%02x
", $theme_datacolor[$colorindex][0], $theme_datacolor[$colorindex][1], $theme_datacolor[$colorindex][2]);
2074 $color = ($event->icalcolor ? $event->icalcolor : -1);
2075 $cssclass = (!empty($event->icalname) ? 'family_ext'.md5($event->icalname) : 'family_other');
2077 if (empty($cacheusers[$event->userownerid])) {
2078 $newuser = new User($db);
2079 $newuser->fetch($event->userownerid);
2080 $cacheusers[$event->userownerid] = $newuser;
2082 //var_dump($cacheusers[$event->userownerid]->color);
2084 // We decide to choose color of owner of event (event->userownerid is user id of owner, event->userassigned contains all users assigned to event)
2085 if (!empty($cacheusers[$event->userownerid]->color)) {
2086 $color = $cacheusers[$event->userownerid]->color;
2090 if ($color < 0) { // Color was not set on user card. Set color according to color index.
2091 // Define color index if not yet defined
2092 $idusertouse = ($event->userownerid ? $event->userownerid : 0);
2093 if (isset($colorindexused[$idusertouse])) {
2094 $colorindex = $colorindexused[$idusertouse]; // Color already assigned to this user
2096 $colorindex = $nextindextouse;
2097 $colorindexused[$idusertouse] = $colorindex;
2098 if (!empty($theme_datacolor[$nextindextouse + 1])) {
2099 $nextindextouse++; // Prepare to use next color
2102 if (isset($theme_datacolor[$colorindex])) {
2103 $color = sprintf("%02x%02x%02x
", $theme_datacolor[$colorindex][0], $theme_datacolor[$colorindex][1], $theme_datacolor[$colorindex][2]);
2104 } elseif (getDolGlobalString('THEME_ELDY_BACKBODY')) {
2105 require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
2106 $color = colorArrayToHex(colorStringToArray(getDolGlobalString('THEME_ELDY_BACKBODY'), array()), '');
2111 $cssclass = $cssclass.' eventday_'.$ymd;
2113 // Defined style to disable drag and drop feature
2114 if ($event->type_code == 'AC_OTH_AUTO') {
2115 $cssclass .= " unmovable
";
2116 } elseif ($event->type_code == 'HOLIDAY') {
2117 $cssclass .= " unmovable
";
2118 } elseif ($event->type_code == 'BIRTHDAY') {
2119 $cssclass .= " unmovable
";
2120 } elseif ($event->type_code == 'ICALEVENT') {
2121 $cssclass .= " unmovable
";
2122 } elseif ($event->date_start_in_calendar && $event->date_end_in_calendar && date('Ymd', $event->date_start_in_calendar) != date('Ymd', $event->date_end_in_calendar)) {
2123 // If the event is on several days
2124 $tmpyearend = dol_print_date($event->date_start_in_calendar, '%Y', 'tzuserrel');
2125 $tmpmonthend = dol_print_date($event->date_start_in_calendar, '%m', 'tzuserrel');
2126 $tmpdayend = dol_print_date($event->date_start_in_calendar, '%d', 'tzuserrel');
2127 //var_dump($tmpyearend.' '.$tmpmonthend.' '.$tmpdayend);
2128 if ($tmpyearend != $annee || $tmpmonthend != $mois || $tmpdayend != $jour) {
2129 $cssclass .= " unmovable unmovable-mustusefirstdaytodrag
";
2131 $cssclass .= ' movable cursormove';
2134 if ($user->hasRight('agenda', 'allactions', 'create') ||
2135 (($event->authorid == $user->id || $event->userownerid == $user->id) && $user->hasRight('agenda', 'myactions', 'create'))) {
2136 $cssclass .= " movable cursormove
";
2138 $cssclass .= " unmovable
";
2144 if ($mode == 'show_day') {
2145 $h = 'height: 100%; ';
2148 if ($mode == 'show_week') {
2149 $h = 'height: 100%; ';
2155 print '<!-- start event '.$i.' -->'."\n
";
2158 if ($maxprint && $ireallyshown >= $maxprint) {
2159 $morecss = 'showifmore';
2161 if ($event->type == 'birthdate' && !GETPOST('check_birthday')) {
2162 $morecss = 'hidden';
2164 if ($event->type == 'holiday' && !GETPOST('check_holiday')) {
2165 $morecss = 'hidden';
2167 /* I comment this because it hides event recorded from bookcal online page
2168 if ($event->type == 'bookcal_calendar' && !GETPOST('check_bookcal_calendar_'.$bookcalcalendarsarray["availabilitieslink
"][$event->fk_bookcal_calendar])) {
2169 $morecss = 'hidden';
2171 if ($morecss != 'hidden') {
2174 if ($morecss != 'showifmore' && $morecss != 'hidden') {
2178 //var_dump($event->type.' - '.$morecss.' - '.$cssclass.' - '.$i.' - '.$ireallyshown.' - '.$itoshow);
2179 if (isModEnabled("bookcal
") && $event->type == 'bookcal_calendar') {
2180 print '<div id="event_
'.$ymd.'_
'.$i.'" class="event family_
'.$event->type.'_
'.$bookcalcalendarsarray["availabilitieslink"][$event->fk_bookcal_calendar].' '.$cssclass.($morecss ? ' '.$morecss : '').'"';
2182 print '<div id="event_
'.$ymd.'_
'.$i.'" class="event family_
'.$event->type.' '.$cssclass.($morecss ? ' '.$morecss : '').'"';
2184 //print ' style="height: 100px;
';
2185 //print ' position: absolute; top: 40px; width: 50%;
';
2189 //var_dump($event->userassigned);
2190 //var_dump($event->transparency);
2191 print '<table class="centpercent cal_event
';
2192 print(empty($event->transparency) ? ' cal_event_notbusy
' : ' cal_event_busy
');
2193 //if (empty($event->transparency) && empty($conf->global->AGENDA_NO_TRANSPARENT_ON_NOT_BUSY)) print ' opacitymedium
'; // Not busy
2194 print '" style="'.$h;
2195 $colortouse = $color;
2196 // If colortouse is similar than background, we force to change it.
2197 if (empty($event->transparency) && !getDolGlobalString('AGENDA_NO_TRANSPARENT_ON_NOT_BUSY
')) {
2198 print 'background: #f0f0f0;
';
2199 print 'border-left: 5px solid #
'.$colortouse.';
';
2201 print 'background: #f0f0f0;
';
2202 print 'border-left: 5px solid #
'.dol_color_minus($colortouse, -3).';
';
2203 //print 'background: -webkit-gradient(linear, left top, left bottom, from(#
'.dol_color_minus($colortouse, -3).'), to(#
'.dol_color_minus($colortouse, -1).'));
';
2205 //print 'background: #
'.$colortouse.';
';
2206 //print 'background: -webkit-gradient(linear, left top, left bottom, from(#
'.dol_color_minus($color, -3).'), to(#
'.dol_color_minus($color, -1).'));
';
2207 //if (!empty($event->transparency)) print 'background: #
'.$color.'; background: -webkit-gradient(linear, left top, left bottom, from(#
'.$color.'), to(#
'.dol_color_minus($color,1).'));
';
2208 //else print 'background-color: transparent !important; background: none; border: 1px solid #bbb;
';
2209 //print ' -moz-border-radius:4px;
"';
2210 //print 'border: 1px solid #ccc" width=
"100%"';
2213 // First the tr of the event (only one tr for event is used, but several td)
2215 print '<td class="tdoverflow nobottom small centpercent
'.($nowrapontd ? 'nowrap
' : '').'cal_event
'.($event->type_code == 'BIRTHDAY
' ? ' cal_event_birthday
' : '').'">';
2216 print '<!-- left section of event -->';
2220 $parameters = array();
2221 $reshook = $hookmanager->executeHooks('eventOptions', $parameters, $event, $action); // Note that $action and $object may have been modified by some hooks
2223 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
2225 '@phan-var-force ActionComm $event';
2226 if (empty($reshook)) {
2229 if (empty($event->fulldayevent)) {
2230 //print $event->getNomUrl(2).' ';
2234 if ($event->type_code == 'BIRTHDAY') {
2235 // It's birthday calendar
2236 $picb = img_picto('', 'birthday-cake', 'class="pictofixedwidth
"');
2237 print $picb.$langs->trans("Birthday
").'<br>';
2241 if ($event->type_code != 'HOLIDAY' && $event->type_code != 'BIRTHDAY') {
2242 if (empty($event->fulldayevent)) {
2243 // Show hours (start ... end)
2244 $tmpyearstart = dol_print_date($event->date_start_in_calendar, '%Y', 'tzuserrel');
2245 $tmpmonthstart = dol_print_date($event->date_start_in_calendar, '%m', 'tzuserrel');
2246 $tmpdaystart = dol_print_date($event->date_start_in_calendar, '%d', 'tzuserrel');
2247 $tmpyearend = dol_print_date($event->date_end_in_calendar, '%Y', 'tzuserrel');
2248 $tmpmonthend = dol_print_date($event->date_end_in_calendar, '%m', 'tzuserrel');
2249 $tmpdayend = dol_print_date($event->date_end_in_calendar, '%d', 'tzuserrel');
2252 if ($tmpyearstart == $annee && $tmpmonthstart == $mois && $tmpdaystart == $jour) {
2253 $daterange .= dol_print_date($event->date_start_in_calendar, 'hour', 'tzuserrel');
2254 if ($event->date_end_in_calendar && $event->date_start_in_calendar != $event->date_end_in_calendar) {
2255 if ($tmpyearstart == $tmpyearend && $tmpmonthstart == $tmpmonthend && $tmpdaystart == $tmpdayend) {
2262 if ($event->date_end_in_calendar && $event->date_start_in_calendar != $event->date_end_in_calendar) {
2263 if ($tmpyearstart != $tmpyearend || $tmpmonthstart != $tmpmonthend || $tmpdaystart != $tmpdayend) {
2264 $daterange .= '...';
2268 if ($event->date_end_in_calendar && $event->date_start_in_calendar != $event->date_end_in_calendar) {
2269 if ($tmpyearend == $annee && $tmpmonthend == $mois && $tmpdayend == $jour) {
2270 $daterange .= dol_print_date($event->date_end_in_calendar, 'hour', 'tzuserrel');
2275 print $langs->trans("EventOnFullDay
")."<br>\n
";
2281 $titletoshow = $daterange;
2282 $titletoshow .= ($titletoshow ? ' ' : '').dol_escape_htmltag($event->label);
2284 if ($event->type_code != 'ICALEVENT' && $event->type_code != 'BIRTHDAY') {
2285 $savlabel = $event->label;
2286 $event->label = $titletoshow;
2287 // Note: List of users are inside $event->userassigned. Link may be clickable depending on permissions of user.
2288 $titletoshow = (($event->type_picto || $event->type_code) ? $event->getTypePicto() : '');
2289 $titletoshow .= $event->getNomUrl(0, $maxnbofchar, 'cal_event cal_event_title valignmiddle', '', 0, 0); // do not add 'inline-block' in css here: it makes the title transformed completely into '...'
2290 $event->label = $savlabel;
2293 // Loop on each assigned user
2294 $listofusertoshow = '';
2295 $posuserassigned = 0;
2296 foreach ($event->userassigned as $tmpid => $tmpdata) {
2297 if (!$posuserassigned && $titletoshow) {
2298 $listofusertoshow .= '<br>';
2301 if (empty($cacheusers[$tmpid])) {
2302 $newuser = new User($db);
2303 $newuser->fetch($tmpid);
2304 $cacheusers[$tmpid] = $newuser;
2307 $listofusertoshow .= $cacheusers[$tmpid]->getNomUrl(-3, '', 0, 0, 0, 0, '', 'valignmiddle inline-block');
2310 if ($event->type_code != 'BIRTHDAY' && $event->type_code != 'HOLIDAY') {
2312 print $listofusertoshow.' ';
2315 if ($event->type_code == 'ICALEVENT') {
2316 print '<br>('.dol_trunc($event->icalname, $maxnbofchar).')';
2319 $thirdparty_id = ($event->socid > 0 ? $event->socid : ((is_object($event->societe) && $event->societe->id > 0) ? $event->societe->id : 0));
2320 $contact_id = ($event->contact_id > 0 ? $event->contact_id : ((is_object($event->contact) && $event->contact->id > 0) ? $event->contact->id : 0));
2322 // If action related to company / contact
2323 $linerelatedto = '';
2324 if ($thirdparty_id > 0) {
2325 if (!isset($cachethirdparties[$thirdparty_id]) || !is_object($cachethirdparties[$thirdparty_id])) {
2326 $thirdparty = new Societe($db);
2327 $thirdparty->fetch($thirdparty_id);
2328 $cachethirdparties[$thirdparty_id] = $thirdparty;
2330 $thirdparty = $cachethirdparties[$thirdparty_id];
2332 if (!empty($thirdparty->id)) {
2333 $linerelatedto .= $thirdparty->getNomUrl(1, '', 0, 0, -1, 0, '', 'valignmiddle inline'); // using inline-block make the content completely replace with ... when too large
2336 if (!empty($contact_id) && $contact_id > 0) {
2337 if (empty($cachecontacts[$contact_id]) || !is_object($cachecontacts[$contact_id])) {
2338 $contact = new Contact($db);
2339 $contact->fetch($contact_id);
2340 $cachecontacts[$contact_id] = $contact;
2342 $contact = $cachecontacts[$contact_id];
2344 if ($linerelatedto) {
2345 $linerelatedto .= ' ';
2347 if (!empty($contact->id)) {
2348 $linerelatedto .= $contact->getNomUrl(1, '', 0, '', -1, 0, 'valignmiddle inline'); // using inline-block make the content completely replace with ... when too large
2351 if (!empty($event->fk_element) && $event->fk_element > 0 && !empty($event->elementtype) && getDolGlobalString('AGENDA_SHOW_LINKED_OBJECT')) {
2352 include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
2353 if ($linerelatedto) {
2354 $linerelatedto .= '<br>';
2356 $linerelatedto .= dolGetElementUrl($event->fk_element, $event->elementtype, 1);
2358 if ($linerelatedto) {
2359 print ' '.$linerelatedto;
2361 } elseif (!empty($reshook)) {
2362 print $hookmanager->resPrint;
2366 if ($event->type_code == 'HOLIDAY') {
2367 // It's holiday calendar
2368 $tmpholiday->fetch($event->id);
2370 print $tmpholiday->getNomUrl(1, -1, 0, 'valignmiddle inline-block');
2372 $tmpid = $tmpholiday->fk_user;
2373 if (empty($cacheusers[$tmpid])) {
2374 $newuser = new User($db);
2375 $newuser->fetch($tmpid);
2376 $cacheusers[$tmpid] = $newuser;
2379 $listofusertoshow = '';
2380 $listofusertoshow .= "\n
".'<br>'.$cacheusers[$tmpid]->getNomUrl(-1, '', 0, 0, 0, 0, '', 'paddingright valignmiddle inline-block')."\n
";
2381 print $listofusertoshow;
2386 if ($event->location) {
2388 print $langs->trans("Location
").': '.$event->location;
2396 if ($event->type_code != 'HOLIDAY' && $event->type_code != 'BIRTHDAY' && $event->type_code != 'ICALEVENT') {
2398 if ($event->percentage >= 0) {
2402 print '<td class="nobottom right nowrap cal_event_right
'.($withstatus >= 2 ? ' cal_event_right_status
' : '').'">';
2404 print $event->getLibStatut(3, 1);
2408 print '</td></tr></table>';
2409 print '</div><!-- end event '.$i.' -->'."\n
";
2413 print '<a href="'.DOL_URL_ROOT.'/comm/action/index.php?mode=
'.$mode.'&maxprint=0&month=
'.((int) $monthshown).'&year=
'.((int) $year);
2414 print($status ? '&
status=
'.$status : '').($filter ? '&filter=
'.urlencode($filter) : '');
2415 print($filtert ? '&search_filtert=
'.urlencode((string) $filtert) : '');
2416 print($usergroup ? '&search_usergroup=
'.urlencode((string) $usergroup) : '');
2417 print($actioncode != '' ? '&search_actioncode=
'.urlencode($actioncode) : '');
2418 print '">'.img_picto("all
", "1downarrow_selected.png
").' ...';
2419 print ' +'.(count($eventarray[$daykey]) - $maxprint);
2422 //$ok=false; // To avoid to show twice the link
2429 if (!$i) { // No events
2433 if (getDolGlobalString('MAIN_JS_SWITCH_AGENDA') && $itoshow > $ireallyshown && $maxprint) {
2434 print '<div class="center cursorpointer
" id="more_
'.$ymd.'">'.img_picto("All
", "angle-
double-down
", 'class="warning
"').' +'.($itoshow - $ireallyshown).'</div>';
2435 //print ' +'.(count($eventarray[$daykey])-$maxprint);
2437 print '<script type="text/javascript
">'."\n
";
2438 print 'jQuery(document).ready(function () {'."\n
";
2439 print ' var open=0;'."\n
";
2440 print ' jQuery("#more_
'.$ymd.'").click(function() { console.log("Click on showmore
for '.$ymd.'"); reinit_day_'.$ymd.'(); event.stopImmediatePropagation(); });'."\n
";
2441 print ' function reinit_day_'.$ymd.'() {'."\n
";
2442 print ' jQuery(".eventday_
'.$ymd.'.showifmore
").toggle();'."\n
";
2443 print ' open = open + 1; if (open > 1) { open = 0; }'."\n
";
2444 print ' if (open) { ';
2445 print ' jQuery("#more_
'.$ymd.'").html(\''.img_picto("All
", "angle-
double-up
", 'class="warning
"').'\');'."\n
";
2447 print ' jQuery("#more_
'.$ymd.'").html(\''.img_picto("All
", "angle-
double-down
", 'class="warning
"').' +'.($itoshow - $ireallyshown).'\');'."\n
";
2451 print '</script>'."\n
";
2454 print '</div></div>'; // td tr
2456 print '</div>'; // table
2469function dol_color_minus($color, $minus, $minusunit = 16)
2472 if ($minusunit == 16 && is_array($newcolor)) {
2473 $newcolor[0] = dechex(max(min(hexdec($newcolor[0]) - $minus, 15), 0));
2474 $newcolor[2] = dechex(max(min(hexdec($newcolor[2]) - $minus, 15), 0));
2475 $newcolor[4] = dechex(max(min(hexdec($newcolor[4]) - $minus, 15), 0));
2477 // Not yet implemented
2489function sort_events_by_date($a, $b)
2491 // Sort holidays at first
2492 if ($a->type_code === 'HOLIDAY') {
2495 if ($b->type_code === 'HOLIDAY') {
2499 // datep => Event start time
2500 // datef => Event end time
2502 // Events have different start time
2503 if ($a->datep !== $b->datep) {
2504 return $a->datep - $b->datep;
2507 // Events have same start time and no end time
2508 if ((!is_numeric($b->datef)) || (!is_numeric($a->datef))) {
2509 return sort_events_by_percentage($a, $b);
2512 // Events have the same start time and same end time
2513 if ($b->datef === $a->datef) {
2514 return sort_events_by_percentage($a, $b);
2517 // Events have the same start time, but have different end time -> longest event first
2518 return $b->datef - $a->datef;
2528function sort_events_by_percentage($a, $b)
2530 // Sort events with no percentage before each other
2531 // (useful to sort holidays, sick days or similar on the top)
2533 if ($a->percentage < 0) {
2537 if ($b->percentage < 0) {
2541 return $b->percentage - $a->percentage;
if(! $sortfield) if(! $sortorder) $object
print_actions_filter( $form, $canedit, $status, $year, $month, $day, $showbirthday, $filtera, $filtert, $filtered, $pid, $socid, $action, $showextcals=array(), $actioncode='', $usergroupid=0, $excludetype='', $resourceid=0, $search_categ_cus=0, $search_import_key='')
Show filter form in agenda view.
calendars_prepare_head($param)
Define head array for tabs of agenda setup pages.
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage agenda events (actions)
Class to read/parse ICal calendars.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage Dolibarr users.
print $langs trans("Ref").' m titre as m m statut as status
Or an array listing all the potential status of the object: array: int of the status => translated la...
dol_get_prev_month($month, $year)
Return previous month.
dol_get_first_hour($date, $gm='tzserver')
Return GMT time for first hour of a given GMT date (it removes hours, min and second part)
dol_get_next_day($day, $month, $year)
Return next day.
dol_get_next_week($day, $week, $month, $year)
Return next week.
dol_get_first_day_week($day, $month, $year, $gm=false)
Return first day of week for a date.
dol_get_prev_day($day, $month, $year)
Return previous day.
dol_get_first_day($year, $month=1, $gm=false)
Return GMT time for first day of a month or year.
dol_get_next_month($month, $year)
Return next month.
dol_time_plus_duree($time, $duration_value, $duration_unit, $ruleforendofmonth=0)
Add a delay to a date.
dol_stringtotime($string, $gm=1)
Convert a string date into a GM Timestamps date Warning: YYYY-MM-DDTHH:MM:SS+02:00 (RFC3339) is not s...
dol_get_last_day($year, $month=12, $gm=false)
Return GMT time for last day of a month or year.
dol_now($mode='gmt')
Return date for now.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_string_nohtmltag($stringtoclean, $removelinefeed=1, $pagecodeto='UTF-8', $strip_tags=0, $removedoublespaces=1)
Clean a string from all HTML tags and entities.
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
dol_nl2br($stringtoencode, $nl2brmode=0, $forxml=false)
Replace CRLF in string with a HTML BR tag.
dol_sanitizePathName($str, $newstr='_', $unaccent=0, $allowdash=0)
Clean a string to use it as a path name.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0, $allowdash=0)
Clean a string to use it as a file name.
getDolUserString($key, $default='', $tmpuser=null)
Return Dolibarr user constant string value.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dolGetFirstLastname($firstname, $lastname, $nameorder=-1)
Return firstname and lastname in correct order.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_clone($srcobject, $native=2)
Create a clone of instance of object (new instance with same value for each properties) With native =...
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='')
Show information in HTML for admin users or standard users.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_getdate($timestamp, $fast=false, $forcetimezone='')
Return an array with locale date info.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
conf($dolibarr_main_document_root)
Load conf file (file must exists)
if(getDolGlobalString( 'TAKEPOS_SHOW_CUSTOMER')) print $langs trans('Date')." left Label right Qty right Price right TotalHT right TotalTTC right right right right right right right right right centpercent right TotalHT right n right VAT right n right TotalVAT right n No sujeto a RE IRPF right TotalLT1 right n right TotalLT2 right n right TotalTTC right n takeposcustomercurrency takeposcustomercurrency takeposcustomercurrency takeposcustomercurrency right TotalTTC takeposcustomercurrency right takeposcustomercurrency n right PaymentTypeShortLIQ right SELECT p pos_change as p datep as date
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.