34require
'../../main.inc.php';
42require_once DOL_DOCUMENT_ROOT.
'/comm/action/class/actioncomm.class.php';
43require_once DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php';
44require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
45require_once DOL_DOCUMENT_ROOT.
'/user/class/usergroup.class.php';
46require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
47require_once DOL_DOCUMENT_ROOT.
'/core/lib/agenda.lib.php';
48require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
49require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
54$disabledefaultvalues =
GETPOSTINT(
'disabledefaultvalues');
56$action =
GETPOST(
'action',
'aZ09');
59$filter =
GETPOST(
"search_filter",
'alpha', 3) ?
GETPOST(
"search_filter",
'alpha', 3) :
GETPOST(
"filter",
'alpha', 3);
60$filtert =
GETPOST(
"search_filtert",
"intcomma", 3) ?
GETPOST(
"search_filtert",
"intcomma", 3) :
GETPOST(
"filtert",
"intcomma", 3);
66$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
67$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
69if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
73$offset = $limit * $page;
78 $sortfield =
"a.datec";
84 $socid = $user->socid;
91if (!$user->hasRight(
'agenda',
'myactions',
'read')) {
94if (!$user->hasRight(
'agenda',
'allactions',
'read')) {
97if (!$user->hasRight(
'agenda',
'allactions',
'read') || $filter ==
'mine') {
98 $filtert = (
string) $user->id;
101$mode =
'show_peruser';
111$optioncss =
GETPOST(
'optioncss',
'aZ');
114if (
GETPOST(
'search_actioncode',
'array:aZ09')) {
115 $actioncode =
GETPOST(
'search_actioncode',
'array:aZ09', 3);
116 if (!count($actioncode)) {
120 $actioncode =
GETPOST(
"search_actioncode",
"alpha", 3) ?
GETPOST(
"search_actioncode",
"alpha", 3) : (
GETPOST(
"search_actioncode",
"alpha") ==
'0' ?
'0' : ((!
getDolGlobalString(
'AGENDA_DEFAULT_FILTER_TYPE') || $disabledefaultvalues) ?
'' :
getDolGlobalString(
'AGENDA_DEFAULT_FILTER_TYPE')));
124if ($dateselect > 0) {
132$tmp = str_replace(
' ',
'', $tmp);
133$tmparray = explode(
'-', $tmp);
136if ($begin_h < 0 || $begin_h > 23) {
139if ($end_h < 1 || $end_h > 24) {
142if ($end_h <= $begin_h) {
143 $end_h = $begin_h + 1;
148$tmp = str_replace(
' ',
'', $tmp);
149$tmparray = explode(
'-', $tmp);
152if ($begin_d < 1 || $begin_d > 7) {
155if ($end_d < 1 || $end_d > 7) {
158if ($end_d < $begin_d) {
159 $end_d = $begin_d + 1;
171if (
GETPOST(
'viewcal',
'alpha') && $mode !=
'show_day' && $mode !=
'show_week' && $mode !=
'show_peruser') {
172 $mode =
'show_month';
176if (
GETPOST(
'viewweek',
'alpha') || $mode ==
'show_week') {
178 $week = ($week ? $week :
date(
"W"));
179 $day = ($day ? $day :
date(
"d"));
182if (
GETPOST(
'viewday',
'alpha') || $mode ==
'show_day') {
184 $day = ($day ? $day :
date(
"d"));
187$labelbytype = array();
192$langs->loadLangs(array(
'users',
'agenda',
'other',
'commercial'));
195$hookmanager->initHooks(array(
'agenda'));
197$result =
restrictedArea($user,
'agenda', 0,
'actioncomm&societe',
'myactions|allactions',
'fk_soc',
'id');
198if ($user->socid && $socid) {
202$search_status = $status;
223 'maxprint' => $maxprint,
225 'filtert' => $filtert,
226 'showbirthday' => $showbirthday,
227 'canedit' => $canedit,
228 'optioncss' => $optioncss,
229 'actioncode' => $actioncode,
231 'resourceid' => $resourceid,
232 'usergroup' => $usergroup,
234$reshook = $hookmanager->executeHooks(
'beforeAgendaPerUser', $parameters, $object, $action);
242$help_url =
'EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda|DE:Modul_Terminplanung';
243llxHeader(
'', $langs->trans(
"Agenda"), $help_url);
247$nowyear = $nowarray[
'year'];
248$nowmonth = $nowarray[
'mon'];
249$nowday = $nowarray[
'mday'];
252$listofextcals = array();
256while ($i < $MAXAGENDA) {
258 $source =
'AGENDA_EXT_SRC'.$i;
259 $name =
'AGENDA_EXT_NAME'.$i;
260 $offsettz =
'AGENDA_EXT_OFFSETTZ'.$i;
261 $color =
'AGENDA_EXT_COLOR'.$i;
262 $enabled =
'AGENDA_EXT_ENABLED'.$i;
263 $default =
'AGENDA_EXT_ACTIVEBYDEFAULT'.$i;
264 $buggedfile =
'AGENDA_EXT_BUGGEDFILE'.$i;
267 $listofextcals[] = array(
268 'type' =>
'globalsetup',
282while ($i < $MAXAGENDA) {
284 $source =
'AGENDA_EXT_SRC_'.$user->id.
'_'.$i;
285 $name =
'AGENDA_EXT_NAME_'.$user->id.
'_'.$i;
286 $offsettz =
'AGENDA_EXT_OFFSETTZ_'.$user->id.
'_'.$i;
287 $color =
'AGENDA_EXT_COLOR_'.$user->id.
'_'.$i;
288 $enabled =
'AGENDA_EXT_ENABLED_'.$user->id.
'_'.$i;
289 $default =
'AGENDA_EXT_ACTIVEBYDEFAULT_'.$user->id.
'_'.$i;
290 $buggedfile =
'AGENDA_EXT_BUGGEDFILE_'.$user->id.
'_'.$i;
294 $listofextcals[] = array(
295 'type' =>
'usersetup',
298 'offsettz' => (
int) (empty($user->conf->$offsettz) ? 0 : $user->
conf->$offsettz),
309$first_day = $prev[
'first_day'];
310$first_month = $prev[
'first_month'];
311$first_year = $prev[
'first_year'];
313$week = $prev[
'week'];
317$next_year = $next[
'year'];
318$next_month = $next[
'month'];
319$next_day = $next[
'day'];
321$max_day_in_month =
date(
"t",
dol_mktime(0, 0, 0, $month, 1, $year));
327$title = $langs->trans(
"DoneAndToDoActions");
328if ($status ==
'done') {
329 $title = $langs->trans(
"DoneActions");
331if ($status ==
'todo') {
332 $title = $langs->trans(
"ToDoActions");
336if (($actioncode && $actioncode !==
'-1') ||
GETPOSTISSET(
'search_actioncode')) {
337 if (is_array($actioncode)) {
338 foreach ($actioncode as $str_action) {
339 if ($str_action !=
'-1') {
340 $param .=
"&search_actioncode[]=".urlencode($str_action);
344 $param .=
"&search_actioncode=".urlencode($actioncode);
347if ($resourceid > 0) {
348 $param .=
"&search_resourceid=".urlencode((
string) ($resourceid));
352 $param .=
"&search_status=".urlencode($status);
355 $param .=
"&search_filter=".urlencode((
string) $filter);
358 $param .=
"&search_filtert=".urlencode((
string) $filtert);
361 $param .=
"&search_usergroup=".urlencode((
string) ($usergroup));
364 $param .=
"&search_socid=".urlencode((
string) ($socid));
367 $param .=
"&search_showbirthday=1";
370 $param .=
"&search_projectid=".urlencode((
string) ($pid));
373 $param .=
"&search_type=".urlencode($type);
375if ($mode !=
'show_peruser') {
376 $param .=
'&mode='.urlencode((
string) $mode);
379 $param .=
'&begin_h='.((int) $begin_h);
382 $param .=
'&end_h='.((int) $end_h);
385 $param .=
'&begin_d='.((int) $begin_d);
388 $param .=
'&end_d='.((int) $end_d);
390if ($search_categ_cus != 0) {
391 $param .=
'&search_categ_cus='.urlencode((
string) ($search_categ_cus));
394 $param .=
'&check_holiday=1';
396$param .=
"&maxprint=".urlencode((
string) ($maxprint));
398$paramnoactionodate = $param;
403$prev_year = $prev[
'prev_year'];
404$prev_month = $prev[
'prev_month'];
405$prev_day = $prev[
'prev_day'];
406$first_day = $prev[
'first_day'];
407$first_month = $prev[
'first_month'];
408$first_year = $prev[
'first_year'];
410$week = $prev[
'week'];
414$next_year = $next[
'year'];
415$next_month = $next[
'month'];
416$next_day = $next[
'day'];
420$firstdaytoshow =
dol_mktime(0, 0, 0, $first_month, $first_day, $first_year,
'tzuserrel');
421$nb_weeks_to_show = (
getDolGlobalString(
'AGENDA_NB_WEEKS_IN_VIEW_PER_USER')) ? ((
int)
$conf->global->AGENDA_NB_WEEKS_IN_VIEW_PER_USER * 7) : 7;
427$max_day_in_month = idate(
"t",
dol_mktime(0, 0, 0, $month, 1, $year,
'gmt'));
430$picto =
'calendarweek';
433$nav =
'<div class="navselectiondate inline-block nowraponall">';
434$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";
435$nav .=
" <span id=\"month_name\">".dol_print_date(
dol_mktime(0, 0, 0, $first_month, $first_day, $first_year),
"%Y").
", ".$langs->trans(
"WeekShort").
" ".$week;
437$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";
438if (empty(
$conf->dol_optimize_smallscreen)) {
439 $nav .=
' <a href="?year='.$nowyear.
'&month='.$nowmonth.
'&day='.$nowday.$param.
'" class="datenowlink marginleftonly marginrightonly">'.$langs->trans(
"Today").
'</a> ';
442$nav .= $form->selectDate($dateselect,
'dateselect', 0, 0, 1,
'', 1, 0);
444$nav .=
'<button type="submit" class="liste_titre button_search valignmiddle" name="button_search_x" value="x"><span class="fa fa-search"></span></button>';
447$paramnodate = $param;
448$param .=
'&year='.$year.
'&month='.$month.($day ?
'&day='.$day :
'');
452$paramnoaction = preg_replace(
'/mode=[a-z_]+/',
'', preg_replace(
'/action=[a-z_]+/',
'', $param));
453$paramnoactionodate = preg_replace(
'/mode=[a-z_]+/',
'', preg_replace(
'/action=[a-z_]+/',
'', $paramnodate));
457print
'<form method="POST" id="searchFormList" class="listactionsfilter" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
458if ($optioncss !=
'') {
459 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
461print
'<input type="hidden" name="token" value="'.newToken().
'">';
462print
'<input type="hidden" name="mode" value="'.$mode.
'">';
465$mode =
'show_peruser';
466$massactionbutton =
'';
469$viewmode =
'<div class="navmode inline-block">';
471$viewmode .=
'<a class="btnTitle reposition" href="'.DOL_URL_ROOT.
'/comm/action/list.php?mode=show_list&restore_lastsearch_values=1'.$paramnoactionodate.
'">';
473$viewmode .=
img_picto($langs->trans(
"List"),
'object_calendarlist',
'class="imgforviewmode pictoactionview block"');
475$viewmode .=
'<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone inline-block width75 divoverflow">'.$langs->trans(
"ViewList").
'</span></a>';
479$viewmode .=
img_picto($langs->trans(
"ViewCal"),
'object_calendarmonth',
'class="pictoactionview block"');
481$viewmode .=
'<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone inline-block width75 divoverflow">'.$langs->trans(
"ViewCal").
'</span></a>';
485$viewmode .=
img_picto($langs->trans(
"ViewWeek"),
'object_calendarweek',
'class="pictoactionview block"');
487$viewmode .=
'<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone inline-block width75 divoverflow">'.$langs->trans(
"ViewWeek").
'</span></a>';
491$viewmode .=
img_picto($langs->trans(
"ViewDay"),
'object_calendarday',
'class="pictoactionview block"');
493$viewmode .=
'<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone inline-block width75 divoverflow">'.$langs->trans(
"ViewDay").
'</span></a>';
497$viewmode .=
img_picto($langs->trans(
"ViewPerUser"),
'object_calendarperuser',
'class="pictoactionview block"');
499$viewmode .=
'<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone inline-block width75 divoverflow" title="'.dolPrintHTML($langs->trans(
"ViewPerUser")).
'">'.$langs->trans(
"ViewPerUser").
'</span></a>';
502$parameters = array();
504$reshook = $hookmanager->executeHooks(
'addCalendarView', $parameters, $object, $action);
505if (empty($reshook)) {
506 $viewmode .= $hookmanager->resPrint;
507} elseif ($reshook > 1) {
508 $viewmode = $hookmanager->resPrint;
511$viewmode .=
'</div>';
513$viewmode .=
'<span class="marginrightonly"></span>';
518if ($user->hasRight(
'agenda',
'myactions',
'create') || $user->hasRight(
'agenda',
'allactions',
'create')) {
521 $newparam .=
'&month='.urlencode(str_pad((
string) $month, 2,
"0", STR_PAD_LEFT)).
'&year='.((int) $tmpforcreatebutton[
'year']);
522 if ($begin_h !==
'') {
523 $newparam .=
'&begin_h='.((int) $begin_h);
526 $newparam .=
'&end_h='.((int) $end_h);
528 if ($begin_d !==
'') {
529 $newparam .=
'&begin_d='.((int) $begin_d);
532 $newparam .=
'&end_d='.((int) $end_d);
535 $urltocreateaction = DOL_URL_ROOT.
'/comm/action/card.php?action=create';
536 $urltocreateaction .=
'&apyear='.$tmpforcreatebutton[
'year'].
'&apmonth='.$tmpforcreatebutton[
'mon'].
'&apday='.$tmpforcreatebutton[
'mday'].
'&aphour='.$tmpforcreatebutton[
'hours'].
'&apmin='.$tmpforcreatebutton[
'minutes'];
537 $urltocreateaction .=
'&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?'.$newparam);
539 $newcardbutton .=
dolGetButtonTitle($langs->trans(
"AddAction"),
'',
'fa fa-plus-circle', $urltocreateaction);
548$showextcals = $listofextcals;
549$bookcalcalendars = array();
553 $sql =
"SELECT ba.rowid, bc.label, bc.ref, bc.rowid as id_cal";
554 $sql .=
" FROM ".MAIN_DB_PREFIX.
"bookcal_availabilities as ba";
555 $sql .=
" JOIN ".MAIN_DB_PREFIX.
"bookcal_calendar as bc";
556 $sql .=
" ON bc.rowid = ba.fk_bookcal_calendar";
557 $sql .=
" WHERE bc.status = 1";
558 $sql .=
" AND ba.status = 1";
559 $sql .=
" AND bc.entity IN (".getEntity(
'agenda').
")";
560 if (!empty($filtert) && $filtert !=
'-1' && $filtert !=
'-2') {
561 $sql .=
" AND bc.visibility IN (".$db->sanitize($filtert, 0, 0, 0, 0).
")";
563 $resql =
$db->query($sql);
565 $num =
$db->num_rows($resql);
568 $objp =
$db->fetch_object($resql);
569 $label = !empty($objp->label) ? $objp->label : $objp->ref;
570 $bookcalcalendars[
"calendars"][$objp->id_cal] = array(
"id" => $objp->id_cal,
"label" => $label);
571 $bookcalcalendars[
"availabilitieslink"][$objp->rowid] = $objp->id_cal;
579if (!empty(
$conf->use_javascript_ajax)) {
580 $s .=
"\n".
'<!-- Div to calendars selectors -->'.
"\n";
582 $s .=
'<script type="text/javascript">'.
"\n";
583 $s .=
'jQuery(document).ready(function () {'.
"\n";
584 $s .=
'jQuery(".check_birthday").click(function() { console.log("Click on .check_birthday so we toggle class .peruser_birthday"); jQuery(".peruser_birthday").addClass("peruser_birthday_imp"); });'.
"\n";
586 $s .=
'jQuery(".check_holiday").click(function() {';
587 $s .=
' console.log("Click on .check_holiday so we toggle class .peruser_holiday");';
588 $s .=
' if (jQuery(".peruser_holiday").hasClass("peruser_holiday_imp")) {';
589 $s .=
' jQuery(".peruser_holiday").removeClass("peruser_holiday_imp");';
591 $s .=
' jQuery(".peruser_holiday").addClass("peruser_holiday_imp");';
594 $s .=
' var checkHoliday = jQuery(this).is(":checked") ? 1 : 0;';
595 $s .=
' jQuery(".navselectiondate a, .navmode a").each(function(index, elem) { ';
596 $s .=
' var navLinkElem = jQuery(elem);';
597 $s .=
' var navLinkHref = navLinkElem.attr("href");';
598 $s .=
' var navLinkParts = navLinkHref.split("?");';
599 $s .=
' var navLinkPath = navLinkParts[0];';
600 $s .=
' var navLinkParams = new URLSearchParams(navLinkParts[1] || "");';
601 $s .=
' navLinkParams.set("check_holiday", checkHoliday);';
602 $s .=
' navLinkElem.attr("href", navLinkPath + "?" + navLinkParams.toString());';
606 if (
isModEnabled(
"bookcal") && !empty($bookcalcalendars[
"calendars"])) {
607 foreach ($bookcalcalendars[
"calendars"] as $key => $value) {
608 $s .=
'jQuery(".check_bookcal_calendar_'.$value[
'id'].
'").click(function() { console.log("Toggle Bookcal Calendar '.$value[
'id'].
'"); jQuery(".family_bookcal_calendar_'.$value[
'id'].
'").toggle(); });'.
"\n";
612 $s .=
'</script>'.
"\n";
615 $s .=
'<div class="nowrap inline-block minheight30 hideonsmartphone"><input type="checkbox" id="check_mytasks" name="check_mytasks" value="1" class="check_mytasks" checked disabled><label class="labelcalendar"><span class="check_local_text small"> '.$langs->trans(
"LocalAgenda").
' </span></label></div>';
618 if ($user->hasRight(
"holiday",
"read")) {
620 <div class="nowrap inline-block minheight30"><input type="checkbox" id="check_holiday" name="check_holiday small" value="1" class="marginleftonly check_holiday"' . ($check_holiday ?
' checked' :
'') .
'>
621 <label for="check_holiday" class="labelcalendar">
622 <span class="check_holiday_text small">' . $langs->trans(
"Holidays") .
'</span>
628 if (is_array($showextcals) && count($showextcals) > 0) {
629 $s .=
'<script type="text/javascript">'.
"\n";
630 $s .=
'jQuery(document).ready(function () {
631 jQuery("div input[name^=\"check_ext\"]").each(function(index, elem) {
632 var name = jQuery(elem).attr("name");
633 if (jQuery(elem).is(":checked")) {
634 jQuery(".family_ext" + name.replace("check_ext", "")).show();
636 jQuery(".family_ext" + name.replace("check_ext", "")).hide();
640 jQuery("div input[name^=\"check_ext\"]").click(function() {
641 var name = $(this).attr("name");
642 jQuery(".family_ext" + name.replace("check_ext", "")).toggle();
645 $s .=
'</script>'.
"\n";
647 foreach ($showextcals as $val) {
648 $htmlname = md5($val[
'name']);
650 if (!empty($val[
'default']) ||
GETPOSTINT(
'check_ext'.$htmlname)) {
651 $default =
"checked";
656 $tooltip = $langs->trans(
"Cache").
' '.round($DELAYFORCACHE / 60).
'mn';
658 $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"><span class="check_ext_text small">'.
dol_escape_htmltag($val[
'name']).
'</small></label> </div>';
682 $parameters = array();
683 $reshook = $hookmanager->executeHooks(
'addCalendarChoice', $parameters, $object, $action);
684 if (empty($reshook)) {
685 $s .= $hookmanager->resPrint;
686 } elseif ($reshook > 1) {
687 $s = $hookmanager->resPrint;
690 $s .=
"\n".
'<!-- End div to calendars selectors -->'.
"\n";
693 $newparam = preg_replace(
'/showbirthday=[0-1]/i',
'showbirthday='.($showbirthday ?
'1' :
'0'), $newparam);
694 if (!preg_match(
'/showbirthday=/i', $newparam)) {
695 $newparam .=
'&showbirthday=1';
700 $link .= $langs->trans(
"AgendaShowBirthdayEvents");
702 $link .= $langs->trans(
"AgendaHideBirthdayEvents");
709$eventarray = array();
717$sql .=
" a.id, a.label,";
720$sql .=
" a.percent,";
721$sql .=
" a.fk_user_author, a.fk_user_action,";
722$sql .=
" a.transparency, a.priority, a.fulldayevent, a.location,";
723$sql .=
" a.fk_soc, a.fk_contact, a.fk_project, a.fk_bookcal_calendar,";
724$sql .=
" a.fk_element, a.elementtype,";
725$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";
728$parameters = array();
729$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
730$sql .= $hookmanager->resPrint;
734$sql .=
" FROM ".MAIN_DB_PREFIX.
"c_actioncomm as ca, ".MAIN_DB_PREFIX.
"actioncomm as a";
736if ($resourceid > 0) {
737 $sql .=
", ".MAIN_DB_PREFIX.
"element_resources as r";
741if (($filtert !=
'-1' && $filtert !=
'-2') || $usergroup > 0) {
743 $sql .=
" INNER JOIN ".MAIN_DB_PREFIX.
"actioncomm_resources as ar";
744 $sql .=
" ON ar.fk_actioncomm = a.id AND ar.element_type = 'user'";
745 if ($filtert !=
'' && $filtert !=
'-1' && $filtert !=
'-2' && $filtert !=
'-3') {
746 $sql .=
" AND ar.fk_element IN (".$db->sanitize($filtert).
")";
747 } elseif ($filtert ==
'-3') {
748 $sql .=
" AND ar.fk_element IN (".$db->sanitize(implode(
',', $user->getAllChildIds(1))).
")";
750 if ($usergroup > 0) {
751 $sql .=
" INNER JOIN ".MAIN_DB_PREFIX.
"usergroup_user as ugu ON ugu.fk_user = ar.fk_element AND ugu.fk_usergroup = ".((int) $usergroup);
756$parameters = array();
757$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
758$sql .= $hookmanager->resPrint;
760$sql .=
" WHERE a.fk_action = ca.id";
761$sql .=
" AND a.entity IN (".getEntity(
'agenda').
")";
764if (!empty($actioncode)) {
766 if ((is_array($actioncode) && in_array(
'AC_NON_AUTO', $actioncode)) || $actioncode ==
'AC_NON_AUTO') {
767 $sql .=
" AND ca.type != 'systemauto'";
768 } elseif ((is_array($actioncode) && in_array(
'AC_ALL_AUTO', $actioncode)) || $actioncode ==
'AC_ALL_AUTO') {
769 $sql .=
" AND ca.type = 'systemauto'";
771 if ((is_array($actioncode) && in_array(
'AC_OTH', $actioncode)) || $actioncode ==
'AC_OTH') {
772 $sql .=
" AND ca.type != 'systemauto'";
774 if ((is_array($actioncode) && in_array(
'AC_OTH_AUTO', $actioncode)) || $actioncode ==
'AC_OTH_AUTO') {
775 $sql .=
" AND ca.type = 'systemauto'";
779 if ((is_array($actioncode) && in_array(
'AC_NON_AUTO', $actioncode)) || $actioncode ===
'AC_NON_AUTO') {
780 $sql .=
" AND ca.type != 'systemauto'";
781 } elseif ((is_array($actioncode) && in_array(
'AC_ALL_AUTO', $actioncode)) || $actioncode ===
'AC_ALL_AUTO') {
782 $sql .=
" AND ca.type = 'systemauto'";
783 } elseif ((is_array($actioncode) && !in_array(
'-1', $actioncode) && !in_array(
'-3', $actioncode)) || ($actioncode !==
'-1' && $actioncode !==
'-3')) {
784 if (is_array($actioncode)) {
785 foreach ($actioncode as $key => $val) {
786 if ($val ==
'-1' || $val ==
'-2') {
787 unset($actioncode[$key]);
790 if (!empty($actioncode)) {
791 $sql .=
" AND ca.code IN (".$db->sanitize(
"'".implode(
"','", $actioncode).
"'", 1).
")";
794 $sql .=
" AND ca.code IN (".$db->sanitize(
"'".implode(
"','", explode(
',', $actioncode)).
"'", 1).
")";
799if ($resourceid > 0) {
800 $sql .=
" AND r.element_type = 'action' AND r.element_id = a.id AND r.resource_id = ".((int) $resourceid);
803 $sql .=
" AND a.fk_project = ".((int) $pid);
807if (
isModEnabled(
"societe") && !$user->hasRight(
'societe',
'client',
'voir')) {
808 $search_sale = $user->id;
811if ($search_sale && $search_sale !=
'-1') {
812 if ($search_sale == -2) {
813 $sql .=
" AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = a.fk_soc)";
814 } elseif ($search_sale > 0) {
815 $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).
"))";
820 $sql .=
" AND a.fk_soc = ".((int) $socid);
823if ($mode ==
'show_day') {
825 $sql .=
" (a.datep BETWEEN '".$db->idate(
dol_mktime(0, 0, 0, $month, $day, $year,
'tzuserrel')).
"'";
826 $sql .=
" AND '".$db->idate(
dol_mktime(23, 59, 59, $month, $day, $year,
'tzuserrel')).
"')";
828 $sql .=
" (a.datep2 BETWEEN '".$db->idate(
dol_mktime(0, 0, 0, $month, $day, $year,
'tzuserrel')).
"'";
829 $sql .=
" AND '".$db->idate(
dol_mktime(23, 59, 59, $month, $day, $year,
'tzuserrel')).
"')";
831 $sql .=
" (a.datep < '".$db->idate(
dol_mktime(0, 0, 0, $month, $day, $year,
'tzuserrel')).
"'";
832 $sql .=
" AND a.datep2 > '".$db->idate(
dol_mktime(23, 59, 59, $month, $day, $year,
'tzuserrel')).
"')";
837 $sql .=
" (a.datep BETWEEN '".$db->idate($firstdaytoshow - (60 * 60 * 24 * 2)).
"'";
838 $sql .=
" AND '".$db->idate($lastdaytoshow + (60 * 60 * 24 * 2)).
"')";
840 $sql .=
" (a.datep2 BETWEEN '".$db->idate($firstdaytoshow - (60 * 60 * 24 * 2)).
"'";
841 $sql .=
" AND '".$db->idate($lastdaytoshow + (60 * 60 * 24 * 2)).
"')";
843 $sql .=
" (a.datep < '".$db->idate($firstdaytoshow - (60 * 60 * 24 * 2)).
"'";
844 $sql .=
" AND a.datep2 > '".$db->idate($lastdaytoshow + (60 * 60 * 24 * 2)).
"')";
848 $sql .=
" AND ca.id = ".((int) $type);
852 $sql .=
" AND a.percent = 0";
854if ($status ===
'na') {
856 $sql .=
" AND a.percent = -1";
858if ($status ==
'50') {
860 $sql .=
" AND (a.percent > 0 AND a.percent < 100)";
862if ($status ==
'done' || $status ==
'100') {
863 $sql .=
" AND (a.percent = 100)";
865if ($status ==
'todo') {
866 $sql .=
" AND (a.percent >= 0 AND a.percent < 100)";
869if (($filtert > 0 || $filtert == -3) || $usergroup > 0) {
873 $sql .=
"ar.fk_element = ".((int) $filtert);
874 } elseif ($filtert == -3) {
875 $sql .=
"ar.fk_element IN (".$db->sanitize(implode(
',', $user->getAllChildIds(1))).
")";
877 if ($usergroup > 0) {
878 $sql .= ($filtert > 0 ?
" OR " :
"").
" ugu.fk_usergroup = ".((
int) $usergroup);
884if ($search_categ_cus != -1) {
885 if ($search_categ_cus == -2) {
886 $sql .=
" AND NOT EXISTS (SELECT ca.fk_actioncomm FROM ".MAIN_DB_PREFIX.
"categorie_actioncomm as ca WHERE ca.fk_actioncomm = a.id)";
887 } elseif ($search_categ_cus > 0) {
888 $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((
string) $search_categ_cus).
"))";
892$sql .=
$db->order(
"fk_user_action, datep");
895dol_syslog(
"comm/action/peruser.php", LOG_DEBUG);
896$resql =
$db->query($sql);
898 $num =
$db->num_rows($resql);
900 $MAXONSAMEPAGE = 10000;
902 while ($i < $num && $i < $MAXONSAMEPAGE) {
903 $obj =
$db->fetch_object($resql);
907 if (
getDolGlobalString(
'AGENDA_ALWAYS_HIDE_AUTO') && $obj->type_code ==
'AC_OTH_AUTO') {
912 $datep =
$db->jdate($obj->datep);
913 $datep2 =
$db->jdate($obj->datep2);
919 $event->id = $obj->id;
920 $event->ref = (
string) $event->id;
922 $event->fulldayevent = $obj->fulldayevent;
925 if ($event->fulldayevent) {
927 $event->datep =
$db->jdate($obj->datep, $tzforfullday ?
'tzuser' :
'tzserver');
928 $event->datef =
$db->jdate($obj->datep2, $tzforfullday ?
'tzuser' :
'tzserver');
931 $event->datep =
$db->jdate($obj->datep,
'tzserver');
932 $event->datef =
$db->jdate($obj->datep2,
'tzserver');
938 $event->type_code = $obj->type_code;
939 $event->type_label = $obj->type_label;
940 $event->type_color = $obj->type_color;
941 $event->type = $obj->type_type;
942 $event->type_picto = $obj->type_picto;
944 $event->label = $obj->label;
945 $event->percentage = $obj->percent;
946 $event->authorid = $obj->fk_user_author;
947 $event->userownerid = $obj->fk_user_action;
948 $event->fetch_userassigned();
950 $event->priority = $obj->priority;
951 $event->location = $obj->location;
952 $event->transparency = $obj->transparency;
953 $event->fk_element = $obj->fk_element;
954 $event->elementid = $obj->fk_element;
955 $event->elementtype = $obj->elementtype;
957 $event->fk_project = $obj->fk_project;
959 $event->socid = $obj->fk_soc;
960 $event->contact_id = $obj->fk_contact;
961 $event->fk_bookcal_calendar = $obj->fk_bookcal_calendar;
962 if (!empty($event->fk_bookcal_calendar)) {
963 $event->type =
"bookcal_calendar";
968 $event->date_start_in_calendar = $event->datep;
969 if ($event->datef !=
'' && $event->datef >= $event->datep) {
970 $event->date_end_in_calendar = $event->datef;
972 $event->date_end_in_calendar = $event->datep;
978 if ($event->date_end_in_calendar < $firstdaytoshow || $event->date_start_in_calendar >= $lastdaytoshow) {
982 if ($event->date_start_in_calendar < $firstdaytoshow) {
983 $event->date_start_in_calendar = $firstdaytoshow;
985 if ($event->date_end_in_calendar >= $lastdaytoshow) {
986 $event->date_end_in_calendar = ($lastdaytoshow - 1);
990 $daycursor = $event->date_start_in_calendar;
995 $daycursorend = $event->date_end_in_calendar;
996 $anneeend = (int)
dol_print_date($daycursorend,
'%Y',
'tzuserrel');
997 $moisend = (int)
dol_print_date($daycursorend,
'%m',
'tzuserrel');
998 $jourend = (int)
dol_print_date($daycursorend,
'%d',
'tzuserrel');
1003 $daykey =
dol_mktime(0, 0, 0, $mois, $jour, $annee,
'gmt');
1004 $daykeyend =
dol_mktime(0, 0, 0, $moisend, $jourend, $anneeend,
'gmt');
1018 $eventarray[$daykey][] = $event;
1021 $daykey += 60 * 60 * 24;
1023 if ($daykey > $daykeyend) {
1032 $parameters[
'obj'] = $obj;
1033 $reshook = $hookmanager->executeHooks(
'hookEventElements', $parameters, $event, $action);
1034 $event = $hookmanager->resPrint;
1052 $sql =
'SELECT sp.rowid, sp.lastname, sp.firstname, sp.birthday';
1053 $sql .=
' FROM '.MAIN_DB_PREFIX.
'socpeople as sp';
1054 $sql .=
' WHERE (priv=0 OR (priv=1 AND fk_user_creat='.((int) $user->id).
'))';
1055 $sql .=
" AND sp.entity IN (".getEntity(
'contact').
")";
1056 if ($mode ==
'show_day') {
1057 $sql .=
' AND MONTH(birthday) = '.((int) $month);
1058 $sql .=
' AND DAY(birthday) = '.((int) $day);
1060 $sql .=
' AND MONTH(birthday) = '.((int) $month);
1062 $sql .=
' ORDER BY birthday';
1064 dol_syslog(
"comm/action/index.php", LOG_DEBUG);
1065 $resql =
$db->query($sql);
1067 $num =
$db->num_rows($resql);
1070 $obj =
$db->fetch_object($resql);
1074 $event->id = $obj->rowid;
1075 $event->ref = (
string) $event->id;
1080 $event->datep =
dol_mktime(0, 0, 0, $datearray[
'mon'], $datearray[
'mday'], $year,
true);
1081 $event->datef = $event->datep;
1083 $event->type_code =
'BIRTHDAY';
1084 $event->type_label =
'';
1085 $event->type_color =
'';
1086 $event->type =
'birthdate';
1087 $event->type_picto =
'birthdate';
1089 $event->label = $langs->trans(
"Birthday").
' '.
dolGetFirstLastname($obj->firstname, $obj->lastname);
1090 $event->percentage = 100;
1091 $event->fulldayevent = 1;
1093 $event->contact_id = $obj->rowid;
1095 $event->date_start_in_calendar =
$db->jdate($event->datep);
1096 $event->date_end_in_calendar =
$db->jdate($event->datef);
1099 $daycursor = $event->datep;
1104 $daykey =
dol_mktime(0, 0, 0, $mois, $jour, $annee,
'gmt');
1106 $eventarray[$daykey][] = $event;
1124if ($user->hasRight(
"holiday",
"read")) {
1125 $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";
1126 $sql .=
" FROM ".MAIN_DB_PREFIX.
"holiday as x, ".MAIN_DB_PREFIX.
"user as u";
1127 $sql .=
" WHERE u.rowid = x.fk_user";
1128 $sql .=
" AND u.statut = '1'";
1129 $sql .=
" AND (x.statut = '2' OR x.statut = '3')";
1131 $sql .=
" AND x.date_debut < '".$db->idate(
dol_get_last_day($year, $month)).
"'";
1132 $sql .=
" AND x.date_fin >= '".$db->idate(
dol_get_first_day($year, $month)).
"'";
1133 if (!$user->hasRight(
'holiday',
'readall')) {
1134 $sql .=
" AND x.fk_user IN(".$db->sanitize(implode(
", ", $user->getAllChildIds(1))).
") ";
1137 $resql =
$db->query($sql);
1139 $num =
$db->num_rows($resql);
1143 $obj =
$db->fetch_object($resql);
1148 $event->id = $obj->rowid;
1149 $event->ref = (
string) $event->id;
1151 $event->type_code =
'HOLIDAY';
1152 $event->type_label =
'';
1153 $event->type_color =
'';
1154 $event->type =
'holiday';
1155 $event->type_picto =
'holiday';
1159 $event->datep = (int)
$db->jdate($obj->date_start,
'gmt') + ((empty($obj->halfday) || $obj->halfday == 1) ? 0 : 12) * 60 * 60;
1160 $event->datef = (int)
$db->jdate($obj->date_end,
'gmt') + ((empty($obj->halfday) || $obj->halfday == -1) ? 24 : 12) * 60 * 60 - 1;
1161 $event->date_start_in_calendar = $event->datep;
1162 $event->date_end_in_calendar = $event->datef;
1164 $event->transparency = 1;
1166 $event->userownerid = $obj->uid;
1167 $event->userassigned = array($obj->uid => array(
'id' => $obj->uid,
'transparency' => 1));
1169 if ($obj->status == 3) {
1171 $event->percentage = -1;
1172 } elseif ($obj->status == 2) {
1174 $event->percentage = 0;
1178 $daycursor = $event->date_start_in_calendar;
1183 $daycursorend = $event->date_end_in_calendar;
1189 $daykey =
dol_mktime(0, 0, 0, $mois, $jour, $annee,
'gmt');
1190 $daykeygmt =
dol_mktime(0, 0, 0, $mois, $jour, $annee,
'gmt');
1195 $firstdayofholiday = ($ifornbofdays == 1);
1196 $lastdayofholiday = ($daykeygmt ==
dol_get_first_hour($event->date_end_in_calendar,
'gmt'));
1200 if ((in_array($obj->halfday, array(1, 2)) == 1 && $lastdayofholiday) || (in_array($obj->halfday, array(-1, 2)) && $firstdayofholiday)) {
1203 if (in_array($obj->halfday, array(1, 2)) && $lastdayofholiday) {
1204 $newevent->label .=
' ('.$langs->trans(
"Morning").
')';
1205 } elseif (in_array($obj->halfday, array(-1, 2)) && $firstdayofholiday) {
1206 $newevent->label .=
' ('.$langs->trans(
"Afternoon").
')';
1208 $eventarray[$daykey][] = $newevent;
1210 $eventarray[$daykey][] = $event;
1213 $daykey += 60 * 60 * 24;
1214 $daykeygmt += 60 * 60 * 24;
1215 }
while ($daykey <= $event->date_end_in_calendar);
1224if (count($listofextcals)) {
1225 require_once DOL_DOCUMENT_ROOT.
'/comm/action/class/ical.class.php';
1227 foreach ($listofextcals as $key => $extcal) {
1228 $url = $extcal[
'src'];
1229 $namecal = $extcal[
'name'];
1230 $offsettz = $extcal[
'offsettz'];
1231 $colorcal = $extcal[
'color'];
1232 $buggedfile = $extcal[
'buggedfile'];
1238 $ical->parse($url, $pathforcachefile, $DELAYFORCACHE);
1241 $listofextcals[$key][
'error'] = $ical->error;
1242 $s .=
'<br><div class="warning">'.dol_escape_htmltag($listofextcals[$key][
'name']).
': '.$url.
'<br>Error message: '.
dol_escape_htmltag($ical->error).
'</div>';
1247 $icalevents = array();
1248 if (is_array($ical->get_event_list())) {
1249 $icalevents = array_merge($icalevents, $ical->get_event_list());
1251 if (is_array($ical->get_freebusy_list())) {
1252 $icalevents = array_merge($icalevents, $ical->get_freebusy_list());
1255 if (count($icalevents) > 0) {
1257 $moreicalevents = array();
1258 foreach ($icalevents as $icalevent) {
1259 if (isset($icalevent[
'RRULE']) && is_array($icalevent[
'RRULE'])) {
1262 if ($icalevent[
'DTSTART;VALUE=DATE']) {
1265 } elseif (is_array($icalevent[
'DTSTART']) && !empty($icalevent[
'DTSTART'][
'unixtime'])) {
1266 $datecurstart = $icalevent[
'DTSTART'][
'unixtime'];
1267 $datecurend = $icalevent[
'DTEND'][
'unixtime'];
1268 if (!empty($ical->cal[
'DAYLIGHT'][
'DTSTART']) ) {
1270 $tmpcurstart = $datecurstart;
1271 $tmpcurend = $datecurend;
1272 $tmpdaylightstart =
dol_mktime(0, 0, 0, 1, 1, 1970, 1) + (int) $ical->cal[
'DAYLIGHT'][
'DTSTART'];
1273 $tmpdaylightend =
dol_mktime(0, 0, 0, 1, 1, 1970, 1) + (int) $ical->cal[
'STANDARD'][
'DTSTART'];
1276 if ($tmpcurstart >= $tmpdaylightstart && $tmpcurstart < $tmpdaylightend) {
1277 $datecurstart -= ((int) $ical->cal[
'DAYLIGHT'][
'TZOFFSETTO']) * 36;
1279 $datecurstart -= ((int) $ical->cal[
'STANDARD'][
'TZOFFSETTO']) * 36;
1281 if ($tmpcurend >= $tmpdaylightstart && $tmpcurstart < $tmpdaylightend) {
1282 $datecurend -= ((int) $ical->cal[
'DAYLIGHT'][
'TZOFFSETTO']) * 36;
1284 $datecurend -= ((int) $ical->cal[
'STANDARD'][
'TZOFFSETTO']) * 36;
1291 dol_syslog(
"Found a not recognized repeatable record with unknown date start", LOG_ERR);
1296 $interval = (empty($icalevent[
'RRULE'][
'INTERVAL']) ? 1 : $icalevent[
'RRULE'][
'INTERVAL']);
1297 $until = empty($icalevent[
'RRULE'][
'UNTIL']) ? 0 :
dol_stringtotime($icalevent[
'RRULE'][
'UNTIL'], 1);
1298 $maxrepeat = empty($icalevent[
'RRULE'][
'COUNT']) ? 0 : $icalevent[
'RRULE'][
'COUNT'];
1299 if ($until && ($until + ($datecurend - $datecurstart)) < $firstdaytoshow) {
1302 if ($datecurstart >= $lastdaytoshow) {
1307 while (($datecurstart < $lastdaytoshow) && (empty($maxrepeat) || ($numofevent < $maxrepeat))) {
1308 if ($datecurend >= $firstdaytoshow) {
1309 $newevent = $icalevent;
1310 unset($newevent[
'RRULE']);
1311 if ($icalevent[
'DTSTART;VALUE=DATE']) {
1312 $newevent[
'DTSTART;VALUE=DATE'] =
dol_print_date($datecurstart,
'%Y%m%d');
1313 $newevent[
'DTEND;VALUE=DATE'] =
dol_print_date($datecurend + 1,
'%Y%m%d');
1315 $newevent[
'DTSTART'] = $datecurstart;
1316 $newevent[
'DTEND'] = $datecurend;
1318 $moreicalevents[] = $newevent;
1322 $savdatecurstart = $datecurstart;
1323 if ($icalevent[
'RRULE'][
'FREQ'] ==
'DAILY') {
1327 if ($icalevent[
'RRULE'][
'FREQ'] ==
'WEEKLY') {
1330 } elseif ($icalevent[
'RRULE'][
'FREQ'] ==
'MONTHLY') {
1333 } elseif ($icalevent[
'RRULE'][
'FREQ'] ==
'YEARLY') {
1338 if ($savdatecurstart >= $datecurstart) {
1339 dol_syslog(
"Found a rule freq ".$icalevent[
'RRULE'][
'FREQ'].
" not managed by dolibarr code. Assume 1 week frequency.", LOG_ERR);
1340 $datecurstart += 3600 * 24 * 7;
1341 $datecurend += 3600 * 24 * 7;
1346 $icalevents = array_merge($icalevents, $moreicalevents);
1349 foreach ($icalevents as $icalevent) {
1354 if (!empty($icalevent[
'RRULE'])) {
1363 if (isset($icalevent[
'DTSTART;VALUE=DATE'])) {
1366 if (empty($icalevent[
'DTEND;VALUE=DATE'])) {
1367 $dateend = $datestart + 86400 - 1;
1373 $event->fulldayevent = 1;
1375 } elseif (!is_array($icalevent[
'DTSTART'])) {
1376 $datestart = $icalevent[
'DTSTART'];
1377 $dateend = empty($icalevent[
'DTEND']) ? $datestart : $icalevent[
'DTEND'];
1379 $datestart += +($offsettz * 3600);
1380 $dateend += +($offsettz * 3600);
1385 } elseif (isset($icalevent[
'DTSTART'][
'unixtime'])) {
1386 $datestart = $icalevent[
'DTSTART'][
'unixtime'];
1387 $dateend = $icalevent[
'DTEND'][
'unixtime'];
1389 $datestart += +($offsettz * 3600);
1390 $dateend += +($offsettz * 3600);
1393 if ($buggedfile ===
'uselocalandtznodaylight') {
1397 if ($buggedfile ===
'uselocalandtzdaylight') {
1398 $localtzs =
new DateTimeZone((
string) preg_replace(
'/"/',
'', $icalevent[
'DTSTART'][
'TZID']));
1399 $localtze =
new DateTimeZone((
string) preg_replace(
'/"/',
'', $icalevent[
'DTEND'][
'TZID']));
1400 $localdts =
new DateTime(
dol_print_date($datestart,
'dayrfc',
'gmt'), $localtzs);
1401 $localdte =
new DateTime(
dol_print_date($dateend,
'dayrfc',
'gmt'), $localtze);
1402 $tmps = -1 * $localtzs->getOffset($localdts);
1403 $tmpe = -1 * $localtze->getOffset($localdte);
1404 $datestart += $tmps;
1411 if ($addevent && $datestart !==
null && $dateend !==
null) {
1412 $event->id = $icalevent[
'UID'];
1413 $event->ref = (
string) $event->id;
1415 $userId = $userstatic->findUserIdByEmail($namecal);
1416 if (!empty($userId) && $userId > 0) {
1417 $event->userassigned[$userId] = [
1419 'transparency' => 1,
1421 $event->percentage = -1;
1424 $event->type_code =
"ICALEVENT";
1425 $event->type_label = $namecal;
1426 $event->type_color = $colorcal;
1427 $event->type =
'icalevent';
1428 $event->type_picto =
'rss';
1430 $event->icalname = $namecal;
1431 $event->icalcolor = $colorcal;
1433 $event->datep = (int) ($datestart + $usertime);
1434 $event->datef = (int) ($dateend + $usertime);
1436 if (isset($icalevent[
'SUMMARY']) && $icalevent[
'SUMMARY']) {
1438 } elseif (isset($icalevent[
'DESCRIPTION']) && $icalevent[
'DESCRIPTION']) {
1441 $event->label = $langs->trans(
"ExtSiteNoLabel");
1448 if (!empty($icalevent[
'PRIORITY'])) {
1449 $event->priority = $icalevent[
'PRIORITY'];
1453 if (!empty($icalevent[
'TRANSP'])) {
1454 if ($icalevent[
'TRANSP'] ==
"TRANSPARENT") {
1455 $event->transparency = 0;
1457 if ($icalevent[
'TRANSP'] ==
"OPAQUE") {
1458 $event->transparency = 1;
1469 if (!empty($icalevent[
'LOCATION'])) {
1470 $event->location = $icalevent[
'LOCATION'];
1473 $event->date_start_in_calendar = $event->datep;
1475 if ((
int) $event->datef != 0 && $event->datef >= $event->datep) {
1476 $event->date_end_in_calendar = $event->datef;
1478 $event->date_end_in_calendar = $event->datep;
1482 if ($event->date_end_in_calendar < $firstdaytoshow || $event->date_start_in_calendar >= $lastdaytoshow) {
1488 if ($event->date_start_in_calendar < $firstdaytoshow) {
1489 $event->date_start_in_calendar = $firstdaytoshow;
1491 if ($event->date_end_in_calendar >= $lastdaytoshow) {
1492 $event->date_end_in_calendar = ($lastdaytoshow - 1);
1496 $daycursor = $event->date_start_in_calendar;
1505 $daykey =
dol_mktime(0, 0, 0, $mois, $jour, $annee,
'gmt');
1506 $daykeygmt =
dol_mktime(0, 0, 0, $mois, $jour, $annee,
'gmt');
1509 $eventarray[$daykey][] = $event;
1510 $daykey += 60 * 60 * 24;
1511 $daykeygmt += 60 * 60 * 24;
1512 if (($event->fulldayevent ? $daykeygmt : $daykey) > $event->date_end_in_calendar) {
1524$parameters = array();
1526$reshook = $hookmanager->executeHooks(
'getCalendarEvents', $parameters, $object, $action);
1527if (!empty($hookmanager->resArray[
'eventarray'])) {
1528 foreach ($hookmanager->resArray[
'eventarray'] as $keyDate => $events) {
1529 if (!isset($eventarray[$keyDate])) {
1530 $eventarray[$keyDate] = array();
1532 $eventarray[$keyDate] = array_merge($eventarray[$keyDate], $events);
1544$cachethirdparties = array();
1545$cachecontacts = array();
1549 array(137, 86, 161),
1550 array(60, 147, 183),
1551 array(250, 190, 80),
1553 array(190, 190, 100),
1554 array(91, 115, 247),
1555 array(140, 140, 220),
1556 array(190, 120, 120),
1557 array(115, 125, 150),
1558 array(100, 170, 20),
1559 array(150, 135, 125),
1560 array(85, 135, 150),
1561 array(150, 135, 80),
1565$color_file = DOL_DOCUMENT_ROOT.
"/theme/".
$conf->theme.
"/theme_vars.inc.php";
1566if (is_readable($color_file)) {
1567 include $color_file;
1571$massactionbutton =
'';
1575print_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);
1583print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1584print_actions_filter($form, $canedit, $search_status, $year, $month, $day, $showbirthday,
'', (
string) $filtert,
'', $pid, $socid, $action, -1, $actioncode, $usergroup,
'', $resourceid, $search_categ_cus);
1589$newparam = preg_replace(
'/showbirthday=/i',
'showbirthday_=', $newparam);
1590$newparam = preg_replace(
'/mode=show_month&?/i',
'', $newparam);
1591$newparam = preg_replace(
'/mode=show_week&?/i',
'', $newparam);
1592$newparam = preg_replace(
'/day=[0-9]+&?/i',
'', $newparam);
1593$newparam = preg_replace(
'/month=[0-9]+&?/i',
'', $newparam);
1594$newparam = preg_replace(
'/year=[0-9]+&?/i',
'', $newparam);
1595$newparam = preg_replace(
'/viewweek=[0-9]+&?/i',
'', $newparam);
1596$newparam = preg_replace(
'/showbirthday_=/i',
'showbirthday=', $newparam);
1597$newparam .=
'&viewweek=1';
1599echo
'<input type="hidden" name="actionmove" value="mupdate">';
1600echo
'<input type="hidden" name="backtopage" value="'.dol_escape_htmltag($_SERVER[
'PHP_SELF']).
'?'.
dol_escape_htmltag($_SERVER[
'QUERY_STRING']).
'">';
1601echo
'<input type="hidden" name="newdate" id="newdate">';
1608$currentdaytoshow = $firstdaytoshow;
1609echo
'<div class="div-table-responsive">';
1612$colorsbytype = array();
1614while ($currentdaytoshow < $lastdaytoshow) {
1615 echo
'<table class="centpercent noborder nocellnopadd cal_month cal_peruser listwithfilterbefore">';
1617 echo
'<tr class="liste_titre">';
1618 echo
'<td class="nopaddingtopimp nopaddingbottomimp nowraponsmartphone">';
1622 print
'<span class="hideonsmartphone" title="'.$langs->trans(
"VisibleDaysRange").
'">';
1623 print
img_picto(
'',
'clock',
'class="fawidth30 inline-block marginleftonly"');
1624 print $langs->trans(
"DaysOfWeek").
'</span>';
1626 print
'<div class="ui-grid-a inline-block"><div class="ui-block-a nowraponall">';
1627 print
'<input type="number" class="shortbis" name="begin_d" value="'.$begin_d.
'" min="1" max="7">';
1628 if (empty(
$conf->dol_use_jmobile)) {
1631 print
'</div><div class="ui-block-b">';
1633 print
'<input type="number" class="shortbis" name="end_d" value="'.$end_d.
'" min="1" max="7">';
1634 print
'</div></div>';
1640 if (($i + 1) < $begin_d || ($i + 1) > $end_d) {
1644 echo
'<td align="center" colspan="'.($end_h - $begin_h).
'">';
1645 echo
'<span class="bold spandayofweek">'.$langs->trans(
"Day".(($i +
getDolGlobalInt(
'MAIN_START_WEEK', 1)) % 7)).
'</span>';
1650 $valtoshow = $currentdaytoshow;
1653 echo
'<span class="badgeliketopmenu">';
1655 print
dol_print_date($valtoshow,
'dayreduceformat',
'tzuserrel');
1664 echo
'<tr class="liste_titre">';
1668 print
'<span class="hideonsmartphone" title="'.$langs->trans(
"VisibleTimeRange").
'">';
1669 print
img_picto(
'',
'clock',
'class="fawidth30 inline-block marginleftonly"');
1670 print $langs->trans(
"Hours").
'</span>';
1672 print
'<div class="ui-grid-a inline-block"><div class="ui-block-a nowraponall">';
1673 print
'<input type="number" class="shortbis" name="begin_h" value="'.$begin_h.
'" min="0" max="23">';
1674 if (empty(
$conf->dol_use_jmobile)) {
1677 print
'</div><div class="ui-block-b">';
1679 print
'<input type="number" class="shortbis" name="end_h" value="'.$end_h.
'" min="1" max="24">';
1680 if (empty(
$conf->dol_use_jmobile)) {
1681 print
' '.$langs->trans(
"HourShort");
1683 print
'</div></div>';
1688 if (($i + 1) < $begin_d || ($i + 1) > $end_d) {
1692 for ($h = $begin_h; $h < $end_h; $h++) {
1693 echo
'<td class="center">';
1694 print
'<small style="font-family: courier">'.sprintf(
"%02d", $h).
'</small>';
1704 $usernames = array();
1705 $usernamesid = array();
1708 foreach ($eventarray as $daykey => $notused) {
1710 foreach ($eventarray[$daykey] as $index => $event) {
1711 $event->fetch_userassigned();
1712 $listofuserid = $event->userassigned;
1713 foreach ($listofuserid as $userid => $tmp) {
1714 if (!in_array($userid, $usernamesid)) {
1715 $usernamesid[$userid] = $userid;
1722 $sql =
"SELECT u.rowid, u.lastname as lastname, u.firstname, u.statut, u.login, u.admin, u.entity";
1723 $sql .=
" FROM ".$db->prefix().
"user as u";
1725 $sql .=
" WHERE u.rowid IN (";
1726 $sql .=
" SELECT ug.fk_user FROM ".$db->prefix().
"usergroup_user as ug";
1727 $sql .=
" WHERE ug.entity IN (".getEntity(
'usergroup').
")";
1728 if ($usergroup > 0) {
1729 $sql .=
" AND ug.fk_usergroup = ".((int) $usergroup);
1733 if ($usergroup > 0) {
1734 $sql .=
" LEFT JOIN ".$db->prefix().
"usergroup_user as ug ON u.rowid = ug.fk_user";
1736 $sql .=
" WHERE u.entity IN (".getEntity(
'user').
")";
1737 if ($usergroup > 0) {
1738 $sql .=
" AND ug.fk_usergroup = ".((int) $usergroup);
1741 $sql .=
" AND u.statut = 1";
1743 $sql .=
" AND u.rowid = ".((int) $filtert);
1745 if ($usergroup > 0) {
1746 $sql .=
" AND ug.fk_usergroup = ".((int) $usergroup);
1748 if ($user->socid > 0) {
1750 $sql .=
" AND u.fk_soc = ".((int) $user->socid);
1753 if (!$canedit || $filtert ==
'-3') {
1754 if (!$user->hasRight(
'user',
'user',
'lire') || $filtert ==
'-3') {
1755 $usersInHierarchy = $user->getAllChildIds(1);
1756 $sql .=
" AND u.rowid IN (".$db->sanitize(implode(
',', $usersInHierarchy)).
")";
1761 $resql =
$db->query($sql);
1763 $num =
$db->num_rows($resql);
1767 $obj =
$db->fetch_object($resql);
1768 $usernamesid[$obj->rowid] = $obj->rowid;
1777 foreach ($usernamesid as
$id) {
1779 $result = $tmpuser->fetch(
$id);
1780 $usernames[] = $tmpuser;
1784 $labelbytype = array();
1785 $sql =
"SELECT code, color, libelle as label FROM ".MAIN_DB_PREFIX.
"c_actioncomm ORDER BY position";
1786 $resql =
$db->query($sql);
1787 while ($obj =
$db->fetch_object($resql)) {
1788 $colorsbytype[$obj->code] = $obj->color;
1789 $labelbytype[$obj->code] = $obj->label;
1797 foreach ($usernames as $username) {
1803 echo
'<td class="tdoverflowmax100 cal_current_month cal_peruserviewname'.($var ?
' cal_impair' :
'').
' nopaddingtopimp nopaddingbottomimp noheightimp">';
1804 print
'<span class="paddingrightimp">';
1805 print $username->getNomUrl(-1,
'', 0, 0, 20, 1,
'',
'paddingleft');
1812 for ($iter_day = 0; $iter_day < 8; $iter_day++) {
1813 if (($i + 1) < $begin_d || ($i + 1) > $end_d) {
1826 $style =
'cal_current_month';
1827 if ($iter_day == 6) {
1828 $style .=
' cal_other_month';
1831 if ($todayarray[
'mday'] == $tmpday && $todayarray[
'mon'] == $tmpmonth && $todayarray[
'year'] == $tmpyear) {
1835 $style =
'cal_today_peruser';
1838 show_day_events2($username, $tmpday, $tmpmonth, $tmpyear, 0, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300, $showheader, $colorsbytype, $var);
1843 $showheader =
false;
1855 $langs->load(
"commercial");
1856 print
'<br>'.$langs->trans(
"Legend").
': <br>';
1857 foreach ($colorsbytype as $code => $color) {
1859 print
'<div style="float: left; padding: 2px; margin-right: 6px;"><div style="background: #'.$color.
'; width:16px; float: left; margin-right: 4px;"> </div>';
1860 print $langs->trans(
"Action".$code) !=
"Action".$code ? $langs->trans(
"Action".$code) : $labelbytype[$code];
1866 print
'<div style="float: left; padding: 2px; margin-right: 6px;"><div class="peruser_busy" style="width:16px; float: left; margin-right: 4px;"> </div>';
1867 print $langs->trans(
"Other");
1876print
"\n".
'</form>';
1881print
'<script type="text/javascript">
1882jQuery(document).ready(function() {
1883 jQuery(".onclickopenref").click(function() {
1884 var ref=$(this).attr(\'ref\');
1885 var res = ref.split("_");
1887 var userid = res[1];
1895 console.log("We click on a class onclickopenref in page peruser with ref="+ref+" type="+type);
1897 if (ids == \'none\') /* No event */
1899 /* alert(\'no event\'); */
1900 url = "'.DOL_URL_ROOT.
'/comm/action/card.php?action=create&assignedtouser="+userid+"&datep="+year+month+day+hour+min+"00&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?year='.$year.
'&month='.$month.
'&day='.$day.($begin_h !==
'' ?
'&begin_h='.$begin_h :
'').($end_h !==
'' ?
'&end_h='.$end_h :
'').($begin_d !==
'' ?
'&begin_d='.$begin_d :
'').($end_d !==
'' ?
'&end_d='.$end_d :
'')).
'"
1901 window.location.href = url;
1903 else if (ids.indexOf(",") > -1) /* There is several events */
1905 /* alert(\'several events\'); */
1906 url = "'.DOL_URL_ROOT.
'/comm/action/list.php?mode=show_list&search_actioncode="+jQuery("#search_actioncode").val()+"&search_status="+jQuery("#selectsearch_status").val()+"&filtert="+userid+"&dateselectyear="+year+"&dateselectmonth="+month+"&dateselectday="+day;
1907 window.location.href = url;
1908 } else { /* One event */
1909 /* alert(\'one event\'); */
1910 if (type == \'holiday\') {
1911 url = "'.DOL_URL_ROOT.
'/holiday/card.php?id="+ids
1913 url = "'.DOL_URL_ROOT.
'/comm/action/card.php?action=view&id="+ids
1915 window.location.href = url;
1948function show_day_events2($username, $day, $month, $year, $monthshown, $style, &$eventarray, $maxprint = 0, $maxnbofchar = 16, $newparam =
'', $showinfo = 0, $minheight = 60, $showheader =
false, $colorsbytype = array(), $var =
false)
1951 global $user,
$conf, $langs, $hookmanager, $action;
1952 global $filter, $filtert, $status, $actioncode;
1954 global $cachethirdparties, $cachecontacts,
$cacheusers, $cacheprojects, $colorindexused;
1955 global $begin_h, $end_h;
1969 @phan-var-force array<int,array<int,array<string,string|int|bool>>> $cases1
1970 @phan-var-force array<int,array<int,array<string,string|int|bool>>> $cases2
1971 @phan-var-force array<int,array<int,array<string,string|int|bool>>> $cases3
1972 @phan-var-force array<int,array<int,array<string,string|int|bool>>> $cases4
1979 $numicals = array();
1982 $colorindexused[$user->id] = 0;
1983 $nextindextouse = count($colorindexused);
1990 foreach ($eventarray as $daykey => $notused) {
1997 if ($day == $jour && (
int) $month == $mois && $year == $annee) {
2001 foreach ($eventarray[$daykey] as $index => $event) {
2005 $keysofuserassigned = array_keys($event->userassigned);
2007 if (!in_array($username->id, $keysofuserassigned)) {
2012 $parameters = array();
2013 $reshook = $hookmanager->executeHooks(
'formatEvent', $parameters, $event, $action);
2023 if ($event->type_code ==
'HOLIDAY') {
2024 $cssclass =
'family_holiday';
2027 if (in_array($user->id, $keysofuserassigned)) {
2028 $cssclass =
'family_mytasks';
2030 if (empty($cacheusers[$event->userownerid])) {
2032 $newuser->fetch($event->userownerid);
2038 if (!empty($cacheusers[$event->userownerid]->color)) {
2043 $color = $event->type_color;
2045 } elseif ($event->type_code ==
'ICALEVENT') {
2047 if (!empty($event->icalname)) {
2054 $color = $event->icalcolor;
2055 $cssclass = (!empty($event->icalname) ?
'family_ext'.md5($event->icalname) :
'family_other unsortable');
2056 } elseif ($event->type_code ==
'BIRTHDAY') {
2059 $cssclass =
'family_birthday unsortable';
2060 $color = sprintf(
"%02x%02x%02x", $theme_datacolor[$colorindex][0], $theme_datacolor[$colorindex][1], $theme_datacolor[$colorindex][2]);
2063 $color = ($event->icalcolor ? $event->icalcolor : -1);
2064 $cssclass = (!empty($event->icalname) ?
'family_ext'.md5($event->icalname) :
'family_other');
2066 if (empty($cacheusers[$event->userownerid])) {
2068 $newuser->fetch($event->userownerid);
2074 if (!empty($cacheusers[$event->userownerid]->color)) {
2079 $color = $event->type_color;
2085 $idusertouse = ($event->userownerid ? $event->userownerid : 0);
2086 if (isset($colorindexused[$idusertouse])) {
2087 $colorindex = $colorindexused[$idusertouse];
2089 $colorindex = $nextindextouse;
2090 $colorindexused[$idusertouse] = $colorindex;
2091 if (!empty($theme_datacolor[$nextindextouse + 1])) {
2096 $color = sprintf(
"%02x%02x%02x", $theme_datacolor[$colorindex][0], $theme_datacolor[$colorindex][1], $theme_datacolor[$colorindex][2]);
2100 for ($h = $begin_h; $h < $end_h; $h++) {
2103 if (empty($event->fulldayevent)) {
2104 $a =
dol_mktime((
int) $h, 0, 0, $month, $day, $year,
'tzuserrel', 0);
2105 $b =
dol_mktime((
int) $h, 15, 0, $month, $day, $year,
'tzuserrel', 0);
2106 $b1 =
dol_mktime((
int) $h, 30, 0, $month, $day, $year,
'tzuserrel', 0);
2107 $b2 =
dol_mktime((
int) $h, 45, 0, $month, $day, $year,
'tzuserrel', 0);
2108 $c =
dol_mktime((
int) $h + 1, 0, 0, $month, $day, $year,
'tzuserrel', 0);
2110 $dateendtouse = $event->date_end_in_calendar;
2111 if ($dateendtouse == $event->date_start_in_calendar) {
2116 if ($event->date_start_in_calendar < $b && $dateendtouse > $a) {
2117 $busy = $event->transparency;
2118 $cases1[$h][$event->id][
'busy'] = $busy;
2119 $cases1[$h][$event->id][
'string'] =
dol_print_date($event->date_start_in_calendar,
'dayhour',
'tzuserrel');
2120 if ($event->date_end_in_calendar && $event->date_end_in_calendar != $event->date_start_in_calendar) {
2121 $tmpa =
dol_getdate($event->date_start_in_calendar,
true);
2122 $tmpb =
dol_getdate($event->date_end_in_calendar,
true);
2123 if ($tmpa[
'mday'] == $tmpb[
'mday'] && $tmpa[
'mon'] == $tmpb[
'mon'] && $tmpa[
'year'] == $tmpb[
'year']) {
2124 $cases1[$h][$event->id][
'string'] .=
'-'.dol_print_date($event->date_end_in_calendar,
'hour',
'tzuserrel');
2126 $cases1[$h][$event->id][
'string'] .=
'-'.dol_print_date($event->date_end_in_calendar,
'dayhour',
'tzuserrel');
2129 if ($event->label) {
2130 $cases1[$h][$event->id][
'string'] .=
' - '.$event->label;
2132 $cases1[$h][$event->id][
'typecode'] = $event->type_code;
2133 if ($event->type_code ==
'HOLIDAY') {
2134 $cases1[$h][$event->id][
'css'] =
'peruser_holiday ';
2136 $cases1[$h][$event->id][
'css'] .=
'peruser_holiday_imp ';
2139 $cases1[$h][$event->id][
'color'] = $color;
2141 if ($event->fk_project > 0) {
2142 if (empty($cacheprojects[$event->fk_project])) {
2144 $tmpproj->fetch($event->fk_project);
2145 $cacheprojects[$event->fk_project] = $tmpproj;
2147 $cases1[$h][$event->id][
'string'] .=
', '.$langs->trans(
"Project").
': '.$cacheprojects[$event->fk_project]->ref.
' - '.$cacheprojects[$event->fk_project]->title;
2149 if ($event->socid > 0) {
2150 if (empty($cachethirdparties[$event->socid])) {
2152 $tmpthirdparty->fetch($event->socid);
2153 $cachethirdparties[$event->socid] = $tmpthirdparty;
2155 $cases1[$h][$event->id][
'string'] .=
', '.$cachethirdparties[$event->socid]->name;
2157 if ($event->contact_id > 0) {
2158 if (empty($cachecontacts[$event->contact_id])) {
2160 $tmpcontact->fetch($event->contact_id);
2161 $cachecontacts[$event->contact_id] = $tmpcontact;
2163 $cases1[$h][$event->id][
'string'] .=
', '.$cachecontacts[$event->contact_id]->getFullName($langs);
2167 if ($event->date_start_in_calendar < $b1 && $dateendtouse > $b) {
2168 $busy = $event->transparency;
2169 $cases2[$h][$event->id][
'busy'] = $busy;
2170 $cases2[$h][$event->id][
'string'] =
dol_print_date($event->date_start_in_calendar,
'dayhour',
'tzuserrel');
2171 if ($event->date_end_in_calendar && $event->date_end_in_calendar != $event->date_start_in_calendar) {
2172 $tmpa =
dol_getdate($event->date_start_in_calendar,
true);
2173 $tmpb =
dol_getdate($event->date_end_in_calendar,
true);
2174 if ($tmpa[
'mday'] == $tmpb[
'mday'] && $tmpa[
'mon'] == $tmpb[
'mon'] && $tmpa[
'year'] == $tmpb[
'year']) {
2175 $cases2[$h][$event->id][
'string'] .=
'-'.dol_print_date($event->date_end_in_calendar,
'hour',
'tzuserrel');
2177 $cases2[$h][$event->id][
'string'] .=
'-'.dol_print_date($event->date_end_in_calendar,
'dayhour',
'tzuserrel');
2180 if ($event->label) {
2181 $cases2[$h][$event->id][
'string'] .=
' - '.$event->label;
2183 $cases2[$h][$event->id][
'typecode'] = $event->type_code;
2184 if ($event->type_code ==
'HOLIDAY') {
2185 $cases2[$h][$event->id][
'css'] =
'peruser_holiday ';
2187 $cases2[$h][$event->id][
'css'] .=
'peruser_holiday_imp ';
2190 $cases2[$h][$event->id][
'color'] = $color;
2192 if ($event->fk_project > 0) {
2193 if (empty($cacheprojects[$event->fk_project])) {
2195 $tmpproj->fetch($event->fk_project);
2196 $cacheprojects[$event->fk_project] = $tmpproj;
2198 $cases2[$h][$event->id][
'string'] .=
', '.$langs->trans(
"Project").
': '.$cacheprojects[$event->fk_project]->ref.
' - '.$cacheprojects[$event->fk_project]->title;
2200 if ($event->socid > 0) {
2201 if (empty($cachethirdparties[$event->socid])) {
2203 $tmpthirdparty->fetch($event->socid);
2204 $cachethirdparties[$event->socid] = $tmpthirdparty;
2206 $cases2[$h][$event->id][
'string'] .=
', '.$cachethirdparties[$event->socid]->name;
2208 if ($event->contact_id > 0) {
2209 if (empty($cachecontacts[$event->contact_id])) {
2211 $tmpcontact->fetch($event->contact_id);
2212 $cachecontacts[$event->contact_id] = $tmpcontact;
2214 $cases2[$h][$event->id][
'string'] .=
', '.$cachecontacts[$event->contact_id]->getFullName($langs);
2218 if ($event->date_start_in_calendar < $b2 && $dateendtouse > $b1) {
2219 $busy = $event->transparency;
2220 $cases3[$h][$event->id][
'busy'] = $busy;
2221 $cases3[$h][$event->id][
'string'] =
dol_print_date($event->date_start_in_calendar,
'dayhour',
'tzuserrel');
2222 if ($event->date_end_in_calendar && $event->date_end_in_calendar != $event->date_start_in_calendar) {
2223 $tmpa =
dol_getdate($event->date_start_in_calendar,
true);
2224 $tmpb =
dol_getdate($event->date_end_in_calendar,
true);
2225 if ($tmpa[
'mday'] == $tmpb[
'mday'] && $tmpa[
'mon'] == $tmpb[
'mon'] && $tmpa[
'year'] == $tmpb[
'year']) {
2226 $cases3[$h][$event->id][
'string'] .=
'-'.dol_print_date($event->date_end_in_calendar,
'hour',
'tzuserrel');
2228 $cases3[$h][$event->id][
'string'] .=
'-'.dol_print_date($event->date_end_in_calendar,
'dayhour',
'tzuserrel');
2231 if ($event->label) {
2232 $cases3[$h][$event->id][
'string'] .=
' - '.$event->label;
2234 $cases3[$h][$event->id][
'typecode'] = $event->type_code;
2235 if ($event->type_code ==
'HOLIDAY') {
2236 $cases3[$h][$event->id][
'css'] .=
'peruser_holiday ';
2238 $cases3[$h][$event->id][
'css'] .=
'peruser_holiday_imp ';
2241 $cases3[$h][$event->id][
'color'] = $color;
2243 if ($event->fk_project > 0) {
2244 if (empty($cacheprojects[$event->fk_project])) {
2246 $tmpproj->fetch($event->fk_project);
2247 $cacheprojects[$event->fk_project] = $tmpproj;
2249 $cases3[$h][$event->id][
'string'] .=
', '.$langs->trans(
"Project").
': '.$cacheprojects[$event->fk_project]->ref.
' - '.$cacheprojects[$event->fk_project]->title;
2251 if ($event->socid > 0) {
2252 if (empty($cachethirdparties[$event->socid])) {
2254 $tmpthirdparty->fetch($event->socid);
2255 $cachethirdparties[$event->socid] = $tmpthirdparty;
2257 $cases3[$h][$event->id][
'string'] .=
', '.$cachethirdparties[$event->socid]->name;
2259 if ($event->contact_id > 0) {
2260 if (empty($cachecontacts[$event->contact_id])) {
2262 $tmpcontact->fetch($event->contact_id);
2263 $cachecontacts[$event->contact_id] = $tmpcontact;
2265 $cases3[$h][$event->id][
'string'] .=
', '.$cachecontacts[$event->contact_id]->getFullName($langs);
2269 if ($event->date_start_in_calendar <
$c && $dateendtouse > $b2) {
2270 $busy = $event->transparency;
2271 $cases4[$h][$event->id][
'busy'] = $busy;
2272 $cases4[$h][$event->id][
'string'] =
dol_print_date($event->date_start_in_calendar,
'dayhour',
'tzuserrel');
2273 if ($event->date_end_in_calendar && $event->date_end_in_calendar != $event->date_start_in_calendar) {
2274 $tmpa =
dol_getdate($event->date_start_in_calendar,
true);
2275 $tmpb =
dol_getdate($event->date_end_in_calendar,
true);
2276 if ($tmpa[
'mday'] == $tmpb[
'mday'] && $tmpa[
'mon'] == $tmpb[
'mon'] && $tmpa[
'year'] == $tmpb[
'year']) {
2277 $cases4[$h][$event->id][
'string'] .=
'-'.dol_print_date($event->date_end_in_calendar,
'hour',
'tzuserrel');
2279 $cases4[$h][$event->id][
'string'] .=
'-'.dol_print_date($event->date_end_in_calendar,
'dayhour',
'tzuserrel');
2282 if ($event->label) {
2283 $cases4[$h][$event->id][
'string'] .=
' - '.$event->label;
2285 $cases4[$h][$event->id][
'typecode'] = $event->type_code;
2286 if ($event->type_code ==
'HOLIDAY') {
2287 $cases4[$h][$event->id][
'css'] =
'peruser_holiday ';
2289 $cases4[$h][$event->id][
'css'] .=
'peruser_holiday_imp ';
2292 $cases4[$h][$event->id][
'color'] = $color;
2294 if ($event->fk_project > 0) {
2295 if (empty($cacheprojects[$event->fk_project])) {
2297 $tmpproj->fetch($event->fk_project);
2298 $cacheprojects[$event->fk_project] = $tmpproj;
2300 $cases4[$h][$event->id][
'string'] .=
', '.$langs->trans(
"Project").
': '.$cacheprojects[$event->fk_project]->ref.
' - '.$cacheprojects[$event->fk_project]->title;
2302 if ($event->socid > 0) {
2303 if (empty($cachethirdparties[$event->socid])) {
2305 $tmpthirdparty->fetch($event->socid);
2306 $cachethirdparties[$event->socid] = $tmpthirdparty;
2308 $cases4[$h][$event->id][
'string'] .=
', '.$cachethirdparties[$event->socid]->name;
2310 if ($event->contact_id > 0) {
2311 if (empty($cachecontacts[$event->contact_id])) {
2313 $tmpcontact->fetch($event->contact_id);
2314 $cachecontacts[$event->contact_id] = $tmpcontact;
2316 $cases4[$h][$event->id][
'string'] .=
', '.$cachecontacts[$event->contact_id]->getFullName($langs);
2321 $busy = $event->transparency;
2322 $cases1[$h][$event->id][
'busy'] = $busy;
2323 $cases2[$h][$event->id][
'busy'] = $busy;
2324 $cases3[$h][$event->id][
'busy'] = $busy;
2325 $cases4[$h][$event->id][
'busy'] = $busy;
2326 $cases1[$h][$event->id][
'string'] = $event->label;
2327 $cases2[$h][$event->id][
'string'] = $event->label;
2328 $cases3[$h][$event->id][
'string'] = $event->label;
2329 $cases4[$h][$event->id][
'string'] = $event->label;
2330 $cases1[$h][$event->id][
'typecode'] = $event->type_code;
2331 $cases2[$h][$event->id][
'typecode'] = $event->type_code;
2332 $cases3[$h][$event->id][
'typecode'] = $event->type_code;
2333 $cases4[$h][$event->id][
'typecode'] = $event->type_code;
2334 $cases1[$h][$event->id][
'color'] = $color;
2335 $cases2[$h][$event->id][
'color'] = $color;
2336 $cases3[$h][$event->id][
'color'] = $color;
2337 $cases4[$h][$event->id][
'color'] = $color;
2338 $cases1[$h][$event->id][
'css'] =
'';
2339 $cases2[$h][$event->id][
'css'] =
'';
2340 $cases3[$h][$event->id][
'css'] =
'';
2341 $cases4[$h][$event->id][
'css'] =
'';
2352 for ($h = $begin_h; $h < $end_h; $h++) {
2357 $style1 =
'onclickopenref ';
2358 $style2 =
'onclickopenref ';
2359 $style3 =
'onclickopenref ';
2360 $style4 =
'onclickopenref ';
2361 $string1 =
' ';
2362 $string2 =
' ';
2363 $string3 =
' ';
2364 $string4 =
' ';
2369 if (isset($cases1[$h])) {
2371 if (count($cases1[$h]) > 1) {
2372 $title1 .= count($cases1[$h]).
' '.(count($cases1[$h]) == 1 ? $langs->trans(
"Event") : $langs->trans(
"Events"));
2375 $peruserbusyadded = 0;
2376 $perusernotbusyadded = 0;
2377 foreach ($cases1[$h] as
$id => $ev) {
2378 if (!empty($ev[
'busy']) && !
getDolGlobalString(
'AGENDA_NO_TRANSPARENT_ON_NOT_BUSY')) {
2379 $style1 .= $peruserbusyadded ?
'' :
' peruser_busy';
2380 $peruserbusyadded++;
2382 $style1 .= $perusernotbusyadded ?
'' :
'peruser_notbusy ';
2383 $perusernotbusyadded++;
2385 if (!empty($ev[
'css'])) {
2386 $style1 .= $ev[
'css'].
' ';
2390 if (isset($cases2[$h])) {
2392 if (count($cases2[$h]) > 1) {
2393 $title2 .= count($cases2[$h]).
' '.(count($cases2[$h]) == 1 ? $langs->trans(
"Event") : $langs->trans(
"Events"));
2396 $peruserbusyadded = 0;
2397 $perusernotbusyadded = 0;
2398 foreach ($cases2[$h] as
$id => $ev) {
2399 if (!empty($ev[
'busy']) && !
getDolGlobalString(
'AGENDA_NO_TRANSPARENT_ON_NOT_BUSY')) {
2400 $style2 .= $peruserbusyadded ?
'' :
' peruser_busy';
2401 $peruserbusyadded++;
2403 $style2 .= $perusernotbusyadded ?
'' :
'peruser_notbusy ';
2404 $perusernotbusyadded++;
2406 if (!empty($ev[
'css'])) {
2407 $style2 .= $ev[
'css'].
' ';
2411 if (isset($cases3[$h])) {
2413 if (count($cases3[$h]) > 1) {
2414 $title3 .= count($cases3[$h]).
' '.(count($cases3[$h]) == 1 ? $langs->trans(
"Event") : $langs->trans(
"Events"));
2417 $peruserbusyadded = 0;
2418 $perusernotbusyadded = 0;
2419 foreach ($cases3[$h] as
$id => $ev) {
2420 if (!empty($ev[
'busy']) && !
getDolGlobalString(
'AGENDA_NO_TRANSPARENT_ON_NOT_BUSY')) {
2421 $style3 .= $peruserbusyadded ?
'' :
' peruser_busy';
2422 $peruserbusyadded++;
2424 $style3 .= $perusernotbusyadded ?
'' :
'peruser_notbusy ';
2425 $perusernotbusyadded++;
2427 if (!empty($ev[
'css'])) {
2428 $style3 .= $ev[
'css'].
' ';
2432 if (isset($cases4[$h])) {
2434 if (count($cases4[$h]) > 1) {
2435 $title4 .= count($cases4[$h]).
' '.(count($cases4[$h]) == 1 ? $langs->trans(
"Event") : $langs->trans(
"Events"));
2438 $peruserbusyadded = 0;
2439 $perusernotbusyadded = 0;
2440 foreach ($cases4[$h] as
$id => $ev) {
2441 if (!empty($ev[
'busy']) && !
getDolGlobalString(
'AGENDA_NO_TRANSPARENT_ON_NOT_BUSY')) {
2442 $style4 .= $peruserbusyadded ?
'' :
' peruser_busy';
2443 $peruserbusyadded++;
2445 $style4 .= $perusernotbusyadded ?
'' :
'peruser_notbusy ';
2446 $perusernotbusyadded++;
2448 if (!empty($ev[
'css'])) {
2449 $style4 .= $ev[
'css'].
' ';
2458 if (!empty($cases1[$h]) && is_array($cases1[$h]) && count($cases1[$h]) && array_keys($cases1[$h])) {
2459 $ids1 = implode(
', ', array_keys($cases1[$h]));
2461 if (!empty($cases2[$h]) && is_array($cases2[$h]) && count($cases2[$h]) && array_keys($cases2[$h])) {
2462 $ids2 = implode(
', ', array_keys($cases2[$h]));
2464 if (!empty($cases3[$h]) && is_array($cases3[$h]) && count($cases3[$h]) && array_keys($cases3[$h])) {
2465 $ids3 = implode(
',', array_keys($cases3[$h]));
2467 if (!empty($cases4[$h]) && is_array($cases4[$h]) && count($cases4[$h]) && array_keys($cases4[$h])) {
2468 $ids4 = implode(
',', array_keys($cases4[$h]));
2471 if ($h == $begin_h) {
2472 echo
'<td class="'.$style.
'_peruserleft cal_peruser'.($var ?
' cal_impair '.$style.
'_impair' :
'').
'">';
2474 echo
'<td class="'.$style.
' cal_peruser'.($var ?
' cal_impair '.$style.
'_impair' :
'').
'">';
2479 if (!empty($cases1[$h]) && is_array($cases1[$h]) && count($cases1[$h]) == 1) {
2480 $output = array_slice($cases1[$h], 0, 1);
2481 if ($output[0][
'typecode'] ==
'HOLIDAY') {
2483 $title1 = $langs->trans(
"Holiday");
2485 $title1 = $langs->trans(
"Ref").
' '.$ids1.($title1 ?
' - '.$title1 :
'');
2486 if ($output[0][
'string']) {
2487 $title1 .=
' - '.$output[0][
'string'];
2490 if ($output[0][
'color']) {
2491 $color1 = $output[0][
'color'];
2493 } elseif (!empty($cases1[$h]) && is_array($cases1[$h]) && count($cases1[$h]) > 1) {
2494 $title1 = $langs->trans(
"Ref").
' '.$ids1.($title1 ?
' - '.$title1 :
'');
2500 if (!empty($cases2[$h]) && is_array($cases2[$h]) && count($cases2[$h]) == 1) {
2501 $output = array_slice($cases2[$h], 0, 1);
2502 if ($output[0][
'typecode'] ==
'HOLIDAY') {
2504 $title2 = $langs->trans(
"Holiday");
2506 $title2 = $langs->trans(
"Ref").
' '.$ids2.($title2 ?
' - '.$title2 :
'');
2507 if ($output[0][
'string']) {
2508 $title2 .=
' - '.$output[0][
'string'];
2511 if ($output[0][
'color']) {
2512 $color2 = $output[0][
'color'];
2514 } elseif (!empty($cases2[$h]) && is_array($cases2[$h]) && count($cases2[$h]) > 1) {
2515 $title2 = $langs->trans(
"Ref").
' '.$ids2.($title2 ?
' - '.$title2 :
'');
2521 if (!empty($cases3[$h]) && is_array($cases3[$h]) && count($cases3[$h]) == 1) {
2522 $output = array_slice($cases3[$h], 0, 1);
2523 if ($output[0][
'typecode'] ==
'HOLIDAY') {
2525 $title3 = $langs->trans(
"Holiday");
2527 $title3 = $langs->trans(
"Ref").
' '.$ids3.($title3 ?
' - '.$title3 :
'');
2528 if ($output[0][
'string']) {
2529 $title3 .=
' - '.$output[0][
'string'];
2532 if ($output[0][
'color']) {
2533 $color3 = $output[0][
'color'];
2535 } elseif (!empty($cases3[$h]) && is_array($cases3[$h]) && count($cases3[$h]) > 1) {
2536 $title3 = $langs->trans(
"Ref").
' '.$ids3.($title3 ?
' - '.$title3 :
'');
2542 if (!empty($cases4[$h]) && is_array($cases4[$h]) && count($cases4[$h]) == 1) {
2543 $output = array_slice($cases4[$h], 0, 1);
2544 if ($output[0][
'typecode'] ==
'HOLIDAY') {
2546 $title4 = $langs->trans(
"Holiday");
2548 $title4 = $langs->trans(
"Ref").
' '.$ids4.($title4 ?
' - '.$title4 :
'');
2549 if ($output[0][
'string']) {
2550 $title4 .=
' - '.$output[0][
'string'];
2553 if ($output[0][
'color']) {
2554 $color4 = $output[0][
'color'];
2556 } elseif (!empty($cases4[$h]) && is_array($cases4[$h]) && count($cases4[$h]) > 1) {
2557 $title4 = $langs->trans(
"Ref").
' '.$ids4.($title4 ?
' - '.$title4 :
'');
2561 print
'<table class="nobordernopadding case centpercent">';
2564 if (preg_match(
'/peruser_notbusy/', $style1)) {
2565 print
'style="border: 1px solid #'.($color1 ? $color1 :
"888").
' !important" ';
2566 } elseif ($color1) {
2567 print
'style="background: #'.$color1.
'; "';
2571 print
'center'.($title1 ?
' classfortooltip' :
'').($title1 ?
' cursorpointer' :
'').
'"';
2572 print
'ref="'.$ref1.
'_'.$username->id.
'_'.sprintf(
"%04d", $year).
'_'.sprintf(
"%02d", $month).
'_'.sprintf(
"%02d", $day).
'_'.sprintf(
"%02d", $h).
'_00_'.($ids1 ? $ids1 :
'none').
'"';
2573 print ($title1 ?
' title="'.$title1.
'"' :
'').
'>';
2578 if (preg_match(
'/peruser_notbusy/', $style2)) {
2579 print
'style="border: 1px solid #'.($color2 ? $color2 :
"888").
' !important" ';
2580 } elseif ($color2) {
2581 print
'style="background: #'.$color2.
'; "';
2585 print
'center'.($title2 ?
' classfortooltip' :
'').($title2 ?
' cursorpointer' :
'').
'"';
2586 print
' ref="'.$ref2.
'_'.$username->id.
'_'.sprintf(
"%04d", $year).
'_'.sprintf(
"%02d", $month).
'_'.sprintf(
"%02d", $day).
'_'.sprintf(
"%02d", $h).
'_15_'.($ids2 ? $ids2 :
'none').
'"';
2587 print ($title2 ?
' title="'.$title2.
'"' :
'').
'>';
2592 if (preg_match(
'/peruser_notbusy/', $style3)) {
2593 print
'style="border: 1px solid #'.($color3 ? $color3 :
"888").
' !important" ';
2594 } elseif ($color3) {
2595 print
'style="background: #'.$color3.
'; "';
2599 print
'center'.($title3 ?
' classfortooltip' :
'').($title3 ?
' cursorpointer' :
'').
'"';
2600 print
' ref="'.$ref3.
'_'.$username->id.
'_'.sprintf(
"%04d", $year).
'_'.sprintf(
"%02d", $month).
'_'.sprintf(
"%02d", $day).
'_'.sprintf(
"%02d", $h).
'_30_'.($ids3 ? $ids3 :
'none').
'"';
2601 print ($title3 ?
' title="'.$title3.
'"' :
'').
'>';
2606 if (preg_match(
'/peruser_notbusy/', $style4)) {
2607 print
'style="border: 1px solid #'.($color4 ? $color4 :
"888").
' !important" ';
2608 } elseif ($color4) {
2609 print
'style="background: #'.$color4.
'; "';
2613 print
'center'.($title4 ?
' classfortooltip' :
'').($title4 ?
' cursorpointer' :
'').
'"';
2614 print
' ref="'.$ref4.
'_'.$username->id.
'_'.sprintf(
"%04d", $year).
'_'.sprintf(
"%02d", $month).
'_'.sprintf(
"%02d", $day).
'_'.sprintf(
"%02d", $h).
'_45_'.($ids4 ? $ids4 :
'none').
'"';
2615 print ($title4 ?
' title="'.$title4.
'"' :
'').
'>';
$id
Support class for third parties, contacts, members, users or resources.
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 projects.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage Dolibarr users.
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_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_first_day($year, $month=1, $gm=false)
Return GMT time for first day of a month or year.
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)
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_string_nospecial($str, $newstr='_', $badcharstoreplace='', $badcharstoremove='', $keepspaces=0)
Clean a string from all punctuation characters to use it as a ref or login.
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.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
dolGetFirstLastname($firstname, $lastname, $nameorder=-1)
Return firstname and lastname in correct order.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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...
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
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, $realpathconf=null)
Load conf file (file must exists)
print $langs trans("Show") . '< td style="' . $timeColor . '" align="center"> s</td > badge status0 badge status4 badge status3 Error badge status8< td align="center">< span class="badge ' . $badge . '"></span ></td >< td align="center">< a href="#" class="button button-small" onclick="openLogModal(this)" data-req="' . dol_escape_htmltag($reqSafe) . '" data-res="' . dol_escape_htmltag($resSafe) . '" data-err="' . dol_escape_htmltag($errSafe) . '">< span class="fa fa-search-plus"></span ></a ></td ></tr >< tr >< td colspan="' . $colspan . '" class="opacitymedium"></td ></tr ></table ></div ></form > logModal none logModal none s a JSON string
buildzip.php
print $langs trans('Date')." left Ref 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 Paid 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.