35require
'../../main.inc.php';
36require_once DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php';
37require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
38require_once DOL_DOCUMENT_ROOT.
'/comm/action/class/actioncomm.class.php';
39require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/lib/agenda.lib.php';
41if (isModEnabled(
'project')) {
42 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
53if (!isset(
$conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) {
54 $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW = 3;
58 $conf->global->AGENDA_EXT_NB = 5;
63$disabledefaultvalues =
GETPOSTINT(
'disabledefaultvalues');
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$showbirthday = empty(
$conf->use_javascript_ajax) ?
GETPOSTINT(
"showbirthday") : 1;
70$search_categ_cus =
GETPOST(
"search_categ_cus",
'intcomma', 3) ?
GETPOST(
"search_categ_cus",
'intcomma', 3) : 0;
79$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
80$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
82if (empty($page) || $page == -1) {
86$offset = $limit * $page;
91 $sortfield =
"a.datec";
97 $socid = $user->socid;
104if (!$user->hasRight(
'agenda',
'myactions',
'read')) {
107if (!$user->hasRight(
'agenda',
'allactions',
'read')) {
110if (!$user->hasRight(
'agenda',
'allactions',
'read') || $filter ==
'mine') {
111 $filtert = $user->id;
114$action =
GETPOST(
'action',
'aZ09');
116$mode =
GETPOST(
'mode',
'aZ09');
117if (empty($mode) && preg_match(
'/show_/', $action)) {
120$resourceid =
GETPOST(
"search_resourceid",
'int');
126$status = GETPOSTISSET(
"search_status") ?
GETPOST(
"search_status",
'aZ09') :
GETPOST(
"status",
'aZ09');
127$type = GETPOSTISSET(
"search_type") ?
GETPOST(
"search_type",
'aZ09') :
GETPOST(
"type",
'aZ09');
129$optioncss =
GETPOST(
'optioncss',
'aZ');
132if ($dateselect > 0) {
139if (
GETPOST(
'search_actioncode',
'array:aZ09')) {
140 $actioncode =
GETPOST(
'search_actioncode',
'array:aZ09', 3);
141 if (!count($actioncode)) {
145 $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')));
147if (is_scalar($actioncode) && $actioncode ==
'-1') {
151if ($status ==
'' && !GETPOSTISSET(
'search_status')) {
152 $status = ((!
getDolGlobalString(
'AGENDA_DEFAULT_FILTER_STATUS') || $disabledefaultvalues) ?
'' :
$conf->global->AGENDA_DEFAULT_FILTER_STATUS);
157if (empty($mode) && !GETPOSTISSET(
'mode')) {
158 $mode = $defaultview;
160if ($mode ==
'default') {
161 $mode = (($defaultview !=
'show_list') ? $defaultview :
'show_month');
164 $mode =
'show_month';
169 $week = ($week ? $week : date(
"W"));
170 $day = ($day ? $day : date(
"d"));
174 $day = ($day ? $day : date(
"d"));
180$langs->loadLangs(array(
'agenda',
'other',
'commercial'));
183$hookmanager->initHooks(array(
'agenda'));
185$result =
restrictedArea($user,
'agenda', 0,
'actioncomm&societe',
'myactions|allactions',
'fk_soc',
'id');
186if ($user->socid && $socid) {
195if (
GETPOST(
"viewlist",
'alpha') || $mode ==
'show_list') {
197 if (is_array($_POST)) {
198 foreach ($_POST as $key => $val) {
199 if ($key ==
'token') {
202 $param .=
'&'.$key.
'='.urlencode($val);
205 if (!preg_match(
'/action=/', $param)) {
206 $param .= ($param ?
'&' :
'').
'mode=show_list';
209 header(
"Location: ".DOL_URL_ROOT.
'/comm/action/list.php?'.$param);
213if (
GETPOST(
"viewperuser",
'alpha') || $mode ==
'show_peruser') {
215 if (is_array($_POST)) {
216 foreach ($_POST as $key => $val) {
217 if ($key ==
'token') {
220 $param .=
'&'.$key.
'='.urlencode($val);
224 header(
"Location: ".DOL_URL_ROOT.
'/comm/action/peruser.php?'.$param);
240 'maxprint' => $maxprint,
242 'filtert' => $filtert,
243 'showbirthday' => $showbirthday,
244 'canedit' => $canedit,
245 'optioncss' => $optioncss,
246 'actioncode' => $actioncode,
248 'resourceid' => $resourceid,
249 'usergroup' => $usergroup,
251$reshook = $hookmanager->executeHooks(
'beforeAgenda', $parameters, $object, $action);
256$help_url =
'EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda|DE:Modul_Terminplanung';
257llxHeader(
'', $langs->trans(
"Agenda"), $help_url);
259$form =
new Form($db);
260$companystatic =
new Societe($db);
261$contactstatic =
new Contact($db);
262$userstatic =
new User($db);
266$nowyear = $nowarray[
'year'];
267$nowmonth = $nowarray[
'mon'];
268$nowday = $nowarray[
'mday'];
270$listofextcals = array();
275 while ($i < $MAXAGENDA) {
277 $source =
'AGENDA_EXT_SRC'.$i;
278 $name =
'AGENDA_EXT_NAME'.$i;
279 $offsettz =
'AGENDA_EXT_OFFSETTZ'.$i;
280 $color =
'AGENDA_EXT_COLOR'.$i;
281 $default =
'AGENDA_EXT_ACTIVEBYDEFAULT'.$i;
282 $buggedfile =
'AGENDA_EXT_BUGGEDFILE'.$i;
285 $listofextcals[] = array(
286 'type' =>
'globalsetup',
302 while ($i < $MAXAGENDA) {
304 $source =
'AGENDA_EXT_SRC_'.$user->id.
'_'.$i;
305 $name =
'AGENDA_EXT_NAME_'.$user->id.
'_'.$i;
306 $offsettz =
'AGENDA_EXT_OFFSETTZ_'.$user->id.
'_'.$i;
307 $color =
'AGENDA_EXT_COLOR_'.$user->id.
'_'.$i;
308 $enabled =
'AGENDA_EXT_ENABLED_'.$user->id.
'_'.$i;
309 $default =
'AGENDA_EXT_ACTIVEBYDEFAULT_'.$user->id.
'_'.$i;
310 $buggedfile =
'AGENDA_EXT_BUGGEDFILE_'.$user->id.
'_'.$i;
314 $listofextcals[] = array(
315 'type' =>
'usersetup',
318 'offsettz' => (
int) (empty($user->conf->$offsettz) ? 0 : $user->
conf->$offsettz),
328$max_day_in_month = 0;
339$max_day_in_prev_month = 0;
343if (empty($mode) || $mode ==
'show_month') {
345 $prev_year = $prev[
'year'];
346 $prev_month = $prev[
'month'];
348 $next_year = $next[
'year'];
349 $next_month = $next[
'month'];
351 $max_day_in_prev_month = (int) date(
"t",
dol_mktime(12, 0, 0, $prev_month, 1, $prev_year,
'gmt'));
352 $max_day_in_month = (int) date(
"t",
dol_mktime(12, 0, 0, $month, 1, $year,
'gmt'));
354 $tmpday = - (int) date(
"w",
dol_mktime(12, 0, 0, $month, 1, $year,
'gmt')) + 2;
355 $tmpday += ((isset(
$conf->global->MAIN_START_WEEK) ?
$conf->global->MAIN_START_WEEK : 1) - 1);
360 $firstdaytoshow =
dol_mktime(0, 0, 0, $prev_month, $max_day_in_prev_month + $tmpday, $prev_year,
'tzuserrel');
361 $next_day = 7 - ($max_day_in_month + 1 - $tmpday) % 7;
365 $lastdaytoshow =
dol_mktime(0, 0, 0, $next_month, $next_day, $next_year,
'tzuserrel');
367if ($mode ==
'show_week') {
369 $prev_year = $prev[
'prev_year'];
370 $prev_month = $prev[
'prev_month'];
371 $prev_day = $prev[
'prev_day'];
372 $first_day = $prev[
'first_day'];
373 $first_month = $prev[
'first_month'];
374 $first_year = $prev[
'first_year'];
376 $week = $prev[
'week'];
380 $next_year = $next[
'year'];
381 $next_month = $next[
'month'];
382 $next_day = $next[
'day'];
385 $firstdaytoshow =
dol_mktime(0, 0, 0, $first_month, $first_day, $first_year,
'tzuserrel');
388 $max_day_in_month = date(
"t",
dol_mktime(0, 0, 0, $month, 1, $year,
'gmt'));
390 $tmpday = $first_day;
392if ($mode ==
'show_day') {
394 $prev_year = $prev[
'year'];
395 $prev_month = $prev[
'month'];
396 $prev_day = $prev[
'day'];
398 $next_year = $next[
'year'];
399 $next_month = $next[
'month'];
400 $next_day = $next[
'day'];
402 $firstdaytoshow =
dol_mktime(0, 0, 0, $prev_month, $prev_day, $prev_year,
'tzuserrel');
403 $lastdaytoshow =
dol_mktime(0, 0, 0, $next_month, $next_day, $next_year,
'tzuserrel');
415if ($actioncode || GETPOSTISSET(
'search_actioncode')) {
416 if (is_array($actioncode)) {
417 foreach ($actioncode as $str_action) {
418 $param .=
"&search_actioncode[]=".urlencode($str_action);
421 $param .=
"&search_actioncode=".urlencode($actioncode);
424if ($resourceid > 0) {
425 $param .=
"&search_resourceid=".urlencode((
string) ($resourceid));
427if ($status || GETPOSTISSET(
'status') || GETPOSTISSET(
'search_status')) {
428 $param .=
"&search_status=".urlencode($status);
431 $param .=
"&search_filter=".urlencode($filter);
434 $param .=
"&search_filtert=".urlencode($filtert);
437 $param .=
"&search_usergroup=".urlencode((
string) ($usergroup));
440 $param .=
"&search_socid=".urlencode((
string) ($socid));
443 $param .=
"&search_showbirthday=1";
446 $param .=
"&search_projectid=".urlencode((
string) ($pid));
449 $param .=
"&search_type=".urlencode($type);
451$param .=
"&maxprint=".urlencode((
string) ($maxprint));
452if ($mode ==
'show_day' || $mode ==
'show_week' || $mode ==
'show_month') {
453 $param .=
'&mode='.urlencode($mode);
455if ($search_categ_cus != 0) {
456 $param .=
'&search_categ_cus='.urlencode((
string) ($search_categ_cus));
461$nav .=
'<div class="navselectiondate inline-block nowraponall">';
462if (empty($mode) || $mode ==
'show_month') {
463 $nav .=
"<a href=\"?year=".$prev_year.
"&month=".$prev_month.$param.
"\"><i class=\"fa fa-chevron-left\"></i></a> \n";
464 $nav .=
" <span id=\"month_name\">".dol_print_date(
dol_mktime(0, 0, 0, $month, 1, $year),
"%b %Y");
465 $nav .=
" </span>\n";
466 $nav .=
" <a href=\"?year=".$next_year.
"&month=".$next_month.$param.
"\"><i class=\"fa fa-chevron-right\"></i></a>\n";
469if ($mode ==
'show_week') {
470 $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";
471 $nav .=
" <span id=\"month_name\">".dol_print_date(
dol_mktime(0, 0, 0, $first_month, $first_day, $first_year),
"%Y").
", ".$langs->trans(
"WeekShort").
" ".$week;
472 $nav .=
" </span>\n";
473 $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";
474 $picto =
'calendarweek';
476if ($mode ==
'show_day') {
477 $nav .=
"<a href=\"?year=".$prev_year.
"&month=".$prev_month.
"&day=".$prev_day.$param.
"\"><i class=\"fa fa-chevron-left\"></i></a> \n";
478 $nav .=
" <span id=\"month_name\">".dol_print_date(
dol_mktime(0, 0, 0, $month, $day, $year),
"daytextshort");
479 $nav .=
" </span>\n";
480 $nav .=
" <a href=\"?year=".$next_year.
"&month=".$next_month.
"&day=".$next_day.$param.
"\"><i class=\"fa fa-chevron-right\"></i></a>\n";
481 $picto =
'calendarday';
483if (empty(
$conf->dol_optimize_smallscreen)) {
484 $nav .=
' <a href="?year='.$nowyear.
'&month='.$nowmonth.
'&day='.$nowday.$param.
'" class="datenowlink">'.$langs->trans(
"Today").
'</a> ';
488$nav .= $form->selectDate($dateselect,
'dateselect', 0, 0, 1,
'', 1, 0);
490$nav .=
'<button type="submit" class="liste_titre button_search valignmiddle" name="button_search_x" value="x"><span class="fa fa-search"></span></button>';
493$paramnodate = $param;
494$param .=
'&year='.$year.
'&month='.$month.($day ?
'&day='.$day :
'');
509$paramnoaction = preg_replace(
'/mode=[a-z_]+/',
'', preg_replace(
'/action=[a-z_]+/',
'', $param));
510$paramnoactionodate = preg_replace(
'/mode=[a-z_]+/',
'', preg_replace(
'/action=[a-z_]+/',
'', $paramnodate));
514print
'<form method="POST" id="searchFormList" class="listactionsfilter" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
515if ($optioncss !=
'') {
516 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
518print
'<input type="hidden" name="token" value="'.newToken().
'">';
519print
'<input type="hidden" name="mode" value="'.$mode.
'">';
522$viewmode =
'<div class="navmode inline-block">';
524$viewmode .=
'<a class="btnTitle'.($mode ==
'list' ?
' btnTitleSelected' :
'').
' reposition" href="'.DOL_URL_ROOT.
'/comm/action/list.php?mode=show_list&restore_lastsearch_values=1'.$paramnoactionodate.
'">';
526$viewmode .=
img_picto($langs->trans(
"List"),
'object_calendarlist',
'class="imgforviewmode pictoactionview block"');
528$viewmode .=
'<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone inline-block width75 divoverflow">'.$langs->trans(
"ViewList").
'</span></a>';
530$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.
'">';
532$viewmode .=
img_picto($langs->trans(
"ViewCal"),
'object_calendarmonth',
'class="pictoactionview block"');
534$viewmode .=
'<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone inline-block width75 divoverflow">'.$langs->trans(
"ViewCal").
'</span></a>';
536$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.
'">';
538$viewmode .=
img_picto($langs->trans(
"ViewWeek"),
'object_calendarweek',
'class="pictoactionview block"');
540$viewmode .=
'<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone inline-block width75 divoverflow">'.$langs->trans(
"ViewWeek").
'</span></a>';
542$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.
'">';
544$viewmode .=
img_picto($langs->trans(
"ViewDay"),
'object_calendarday',
'class="pictoactionview block"');
546$viewmode .=
'<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone inline-block width75 divoverflow">'.$langs->trans(
"ViewDay").
'</span></a>';
548$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.
'">';
550$viewmode .=
img_picto($langs->trans(
"ViewPerUser"),
'object_calendarperuser',
'class="pictoactionview block"');
552$viewmode .=
'<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone inline-block width75 divoverflow" title="'.dolPrintHTML($langs->trans(
"ViewPerUser")).
'">'.$langs->trans(
"ViewPerUser").
'</span></a>';
555$parameters = array();
557$reshook = $hookmanager->executeHooks(
'addCalendarView', $parameters, $object, $action);
558if (empty($reshook)) {
559 $viewmode .= $hookmanager->resPrint;
560} elseif ($reshook > 1) {
561 $viewmode = $hookmanager->resPrint;
564$viewmode .=
'</div>';
566$viewmode .=
'<span class="marginrightonly"></span>';
571if ($user->hasRight(
'agenda',
'myactions',
'create') || $user->hasRight(
'agenda',
'allactions',
'create')) {
574 $newparam .=
'&month='.((int) $month).
'&year='.((int) $tmpforcreatebutton[
'year']).
'&mode='.urlencode($mode);
579 $urltocreateaction = DOL_URL_ROOT.
'/comm/action/card.php?action=create';
580 $urltocreateaction .=
'&apyear='.$tmpforcreatebutton[
'year'].
'&apmonth='.$tmpforcreatebutton[
'mon'].
'&apday='.$tmpforcreatebutton[
'mday'].
'&aphour='.$tmpforcreatebutton[
'hours'].
'&apmin='.$tmpforcreatebutton[
'minutes'];
581 $urltocreateaction .=
'&backtopage='.urlencode($_SERVER[
"PHP_SELF"].($newparam ?
'?'.$newparam :
''));
583 $newcardbutton .=
dolGetButtonTitle($langs->trans(
"AddAction"),
'',
'fa fa-plus-circle', $urltocreateaction);
591$showextcals = $listofextcals;
592$bookcalcalendars = array();
595if (isModEnabled(
"bookcal")) {
596 $sql =
"SELECT ba.rowid, bc.label, bc.ref, bc.rowid as id_cal";
597 $sql .=
" FROM ".MAIN_DB_PREFIX.
"bookcal_availabilities as ba";
598 $sql .=
" JOIN ".MAIN_DB_PREFIX.
"bookcal_calendar as bc";
599 $sql .=
" ON bc.rowid = ba.fk_bookcal_calendar";
600 $sql .=
" WHERE bc.status = 1";
601 $sql .=
" AND ba.status = 1";
602 if (!empty($filtert) && $filtert != -1) {
603 $sql .=
" AND bc.visibility = ".(int) $filtert ;
605 $resql = $db->query($sql);
607 $num = $db->num_rows($resql);
610 $objp = $db->fetch_object($resql);
611 $label = !empty($objp->label) ? $objp->label : $objp->ref;
612 $bookcalcalendars[
"calendars"][] = array(
"id" => $objp->id_cal,
"label" => $label);
613 $bookcalcalendars[
"availabilitieslink"][$objp->rowid] = $objp->id_cal;
621if (!empty(
$conf->use_javascript_ajax)) {
622 $s .=
"\n".
'<!-- Div to calendars selectors -->'.
"\n";
624 $s .=
'<script type="text/javascript">'.
"\n";
625 $s .=
'jQuery(document).ready(function () {'.
"\n";
626 $s .=
'jQuery(".check_birthday").click(function() { console.log("Toggle birthdays"); jQuery(".family_birthday").toggle(); });'.
"\n";
627 $s .=
'jQuery(".check_holiday").click(function() { console.log("Toggle holidays"); jQuery(".family_holiday").toggle(); });'.
"\n";
628 if (isModEnabled(
"bookcal") && !empty($bookcalcalendars[
"calendars"])) {
629 foreach ($bookcalcalendars[
"calendars"] as $key => $value) {
630 $s .=
'jQuery(".check_bookcal_calendar_'.$value[
'id'].
'").click(function() { console.log("Toggle Bookcal Calendar '.$value[
'id'].
'"); jQuery(".family_bookcal_calendar_'.$value[
'id'].
'").toggle(); });'.
"\n";
633 if ($mode ==
"show_week" || $mode ==
"show_month" || empty($mode)) {
635 $s .=
'jQuery( "div.sortable" ).sortable({connectWith: ".sortable", placeholder: "ui-state-highlight", items: "div.movable", receive: function( event, ui ) {'.
"\n";
637 $s .=
'console.log("submit form to record new event");'.
"\n";
639 $s .=
'var newval = jQuery(event.target).closest("div.dayevent").attr("id");'.
"\n";
640 $s .=
'console.log("found parent div.dayevent with id = "+newval);'.
"\n";
641 $s .=
'var frm=jQuery("#searchFormList");'.
"\n";
642 $s .=
'var newurl = ui.item.find("a.cal_event").attr("href");'.
"\n";
643 $s .=
'console.log("Found url on href of a.cal_event"+newurl+", we submit form with actionmove=mupdate");'.
"\n";
644 $s .=
'frm.attr("action", newurl).children("#newdate").val(newval);frm.submit();}'.
"\n";
648 $s .=
'</script>'.
"\n";
651 $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>';
654 if ($user->hasRight(
"holiday",
"read")) {
656 <div class="nowrap inline-block minheight30"><input type="checkbox" id="check_holiday" name="check_holiday" value="1" class="check_holiday"' . ($check_holiday
657 ?
' checked' :
'') .
'>
658 <label for="check_holiday" class="labelcalendar">
659 <span class="check_holiday_text">' . $langs->trans(
"Holidays") .
'</span>
665 if (is_array($showextcals) && count($showextcals) > 0) {
666 $s .=
'<script type="text/javascript">'.
"\n";
667 $s .=
'jQuery(document).ready(function () {
668 jQuery("div input[name^=\"check_ext\"]").each(function(index, elem) {
669 var name = jQuery(elem).attr("name");
670 if (jQuery(elem).is(":checked")) {
671 jQuery(".family_ext" + name.replace("check_ext", "")).show();
673 jQuery(".family_ext" + name.replace("check_ext", "")).hide();
677 jQuery("div input[name^=\"check_ext\"]").click(function() {
678 var name = $(this).attr("name");
679 jQuery(".family_ext" + name.replace("check_ext", "")).toggle();
682 $s .=
'</script>'.
"\n";
684 foreach ($showextcals as $val) {
685 $htmlname = md5($val[
'name']);
687 if (!empty($val[
'default']) ||
GETPOSTINT(
'check_ext'.$htmlname)) {
688 $default =
"checked";
693 $tooltip = $langs->trans(
"Cache").
' '.round($DELAYFORCACHE / 60).
'mn';
695 $s .=
'<div class="nowrap inline-block minheight30"><input type="checkbox" id="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>';
700 $s .=
'<div class="nowrap inline-block minheight30"><input type="checkbox" id="check_birthday" name="check_birthday" class="check_birthday"><label for="check_birthday" class="labelcalendar"> <span class="check_birthday_text">'.$langs->trans(
"AgendaShowBirthdayEvents").
'</span></label> </div>';
703 if (isModEnabled(
"bookcal")) {
704 if (!empty($bookcalcalendars[
"calendars"])) {
705 foreach ($bookcalcalendars[
"calendars"] as $key => $value) {
706 $label = $value[
'label'];
707 $s .=
'<div class="nowrap inline-block minheight30"><input '.(GETPOST(
'check_bookcal_calendar_'.$value[
'id']) ?
"checked" :
"").
' type="checkbox" id="check_bookcal_calendar_'.$value[
'id'].
'" name="check_bookcal_calendar_'.$value[
'id'].
'" class="check_bookcal_calendar_'.$value[
'id'].
'"><label for="check_bookcal_calendar_'.$value[
'id'].
'" class="labelcalendar"> <span class="check_bookcal_calendar_'.$value[
'id'].
'_text">'.$langs->trans(
"AgendaShowBookcalCalendar", $label).
'</span></label> </div>';
713 $parameters = array();
714 $reshook = $hookmanager->executeHooks(
'addCalendarChoice', $parameters, $object, $action);
715 if (empty($reshook)) {
716 $s .= $hookmanager->resPrint;
717 } elseif ($reshook > 1) {
718 $s = $hookmanager->resPrint;
721 $s .=
"\n".
'<!-- End div to calendars selectors -->'.
"\n";
724 $newparam = preg_replace(
'/showbirthday=[0-1]/i',
'showbirthday='.(empty($showbirthday) ? 1 : 0), $newparam);
725 if (!preg_match(
'/showbirthday=/i', $newparam)) {
726 $newparam .=
'&showbirthday=1';
730 if (empty($showbirthday)) {
731 $link .= $langs->trans(
"AgendaShowBirthdayEvents");
733 $link .= $langs->trans(
"AgendaHideBirthdayEvents");
740$eventarray = array();
748$sql .=
' a.id, a.label,';
751$sql .=
' a.percent,';
752$sql .=
' a.fk_user_author,a.fk_user_action,';
753$sql .=
' a.transparency, a.priority, a.fulldayevent, a.location,';
754$sql .=
' a.fk_soc, a.fk_contact, a.fk_project, a.fk_bookcal_calendar,';
755$sql .=
' a.fk_element, a.elementtype,';
756$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';
758$parameters = array();
759$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters);
760$sql .= $hookmanager->resPrint;
762$sql .=
' FROM '.MAIN_DB_PREFIX.
'c_actioncomm as ca, '.MAIN_DB_PREFIX.
"actioncomm as a";
764if ($resourceid > 0) {
765 $sql .=
", ".MAIN_DB_PREFIX.
"element_resources as r";
768if ($filtert > 0 || $usergroup > 0) {
769 $sql .=
", ".MAIN_DB_PREFIX.
"actioncomm_resources as ar";
772 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"usergroup_user as ugu ON ugu.fk_user = ar.fk_element";
774$sql .=
' WHERE a.fk_action = ca.id';
775$sql .=
' AND a.entity IN ('.getEntity(
'agenda').
')';
777if (!empty($actioncode)) {
779 if ($actioncode ==
'AC_NON_AUTO') {
780 $sql .=
" AND ca.type != 'systemauto'";
781 } elseif ($actioncode ==
'AC_ALL_AUTO') {
782 $sql .=
" AND ca.type = 'systemauto'";
784 if ($actioncode ==
'AC_OTH') {
785 $sql .=
" AND ca.type != 'systemauto'";
787 if ($actioncode ==
'AC_OTH_AUTO') {
788 $sql .=
" AND ca.type = 'systemauto'";
792 if ($actioncode ==
'AC_NON_AUTO') {
793 $sql .=
" AND ca.type != 'systemauto'";
794 } elseif ($actioncode ==
'AC_ALL_AUTO') {
795 $sql .=
" AND ca.type = 'systemauto'";
797 if (is_array($actioncode)) {
798 $sql .=
" AND ca.code IN (".$db->sanitize(
"'".implode(
"','", $actioncode).
"'", 1).
")";
800 $sql .=
" AND ca.code IN (".$db->sanitize(
"'".implode(
"','", explode(
',', $actioncode)).
"'", 1).
")";
805if ($resourceid > 0) {
806 $sql .=
" AND r.element_type = 'action' AND r.element_id = a.id AND r.resource_id = ".((int) $resourceid);
809 $sql .=
" AND a.fk_project=".((int) $pid);
813if (isModEnabled(
"societe") && !$user->hasRight(
'societe',
'client',
'voir')) {
814 $search_sale = $user->id;
817if ($search_sale && $search_sale !=
'-1') {
818 if ($search_sale == -2) {
819 $sql .=
" AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = a.fk_soc)";
820 } elseif ($search_sale > 0) {
821 $sql .=
" AND 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).
")";
826 $sql .=
" AND a.fk_soc = ".((int) $socid);
829if ($filtert > 0 || $usergroup > 0) {
830 $sql .=
" AND ar.fk_actioncomm = a.id AND ar.element_type='user'";
833if ($mode ==
'show_day') {
835 $sql .=
" (a.datep BETWEEN '".$db->idate(
dol_mktime(0, 0, 0, $month, $day, $year,
'tzuserrel')).
"'";
836 $sql .=
" AND '".$db->idate(
dol_mktime(23, 59, 59, $month, $day, $year,
'tzuserrel')).
"')";
838 $sql .=
" (a.datep2 BETWEEN '".$db->idate(
dol_mktime(0, 0, 0, $month, $day, $year,
'tzuserrel')).
"'";
839 $sql .=
" AND '".$db->idate(
dol_mktime(23, 59, 59, $month, $day, $year,
'tzuserrel')).
"')";
841 $sql .=
" (a.datep < '".$db->idate(
dol_mktime(0, 0, 0, $month, $day, $year,
'tzuserrel')).
"'";
842 $sql .=
" AND a.datep2 > '".$db->idate(
dol_mktime(23, 59, 59, $month, $day, $year,
'tzuserrel')).
"')";
847 $sql .=
" (a.datep BETWEEN '".$db->idate(
dol_mktime(0, 0, 0, $month, 1, $year) - (60 * 60 * 24 * 7)).
"'";
848 $sql .=
" AND '".$db->idate(
dol_mktime(23, 59, 59, $month, 28, $year) + (60 * 60 * 24 * 10)).
"')";
850 $sql .=
" (a.datep2 BETWEEN '".$db->idate(
dol_mktime(0, 0, 0, $month, 1, $year) - (60 * 60 * 24 * 7)).
"'";
851 $sql .=
" AND '".$db->idate(
dol_mktime(23, 59, 59, $month, 28, $year) + (60 * 60 * 24 * 10)).
"')";
853 $sql .=
" (a.datep < '".$db->idate(
dol_mktime(0, 0, 0, $month, 1, $year) - (60 * 60 * 24 * 7)).
"'";
854 $sql .=
" AND a.datep2 > '".$db->idate(
dol_mktime(23, 59, 59, $month, 28, $year) + (60 * 60 * 24 * 10)).
"')";
858 $sql .=
" AND ca.id = ".((int) $type);
862 $sql .=
" AND a.percent = 0";
864if ($status ==
'na') {
866 $sql .=
" AND a.percent = -1";
868if ($status ==
'50') {
870 $sql .=
" AND (a.percent > 0 AND a.percent < 100)";
872if ($status ==
'done' || $status ==
'100') {
873 $sql .=
" AND (a.percent = 100)";
875if ($status ==
'todo') {
876 $sql .=
" AND (a.percent >= 0 AND a.percent < 100)";
879if ($filtert > 0 || $usergroup > 0) {
882 $sql .=
"ar.fk_element = ".((int) $filtert);
884 if ($usergroup > 0) {
885 $sql .= ($filtert > 0 ?
" OR " :
"").
" ugu.fk_usergroup = ".((
int) $usergroup);
891if ($search_categ_cus != -1) {
892 if ($search_categ_cus == -2) {
893 $sql .=
" AND NOT EXISTS (SELECT ca.fk_actioncomm FROM ".MAIN_DB_PREFIX.
"categorie_actioncomm as ca WHERE ca.fk_actioncomm = a.id)";
894 } elseif ($search_categ_cus > 0) {
895 $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).
"))";
900$sql .=
' ORDER BY datep';
903dol_syslog(
"comm/action/index.php", LOG_DEBUG);
904$resql = $db->query($sql);
906 $num = $db->num_rows($resql);
908 $MAXONSAMEPAGE = 10000;
910 while ($i < $num && $i < $MAXONSAMEPAGE) {
911 $obj = $db->fetch_object($resql);
914 if (
getDolGlobalString(
'AGENDA_ALWAYS_HIDE_AUTO') && $obj->type_code ==
'AC_OTH_AUTO') {
922 $event->id = $obj->id;
923 $event->ref = $event->id;
925 $event->fulldayevent = $obj->fulldayevent;
928 if ($event->fulldayevent) {
930 $event->datep = $db->jdate($obj->datep, $tzforfullday ?
'tzuser' :
'tzserver');
931 $event->datef = $db->jdate($obj->datep2, $tzforfullday ?
'tzuser' :
'tzserver');
934 $event->datep = $db->jdate($obj->datep,
'tzserver');
935 $event->datef = $db->jdate($obj->datep2,
'tzserver');
941 $event->type_code = $obj->type_code;
942 $event->type_label = $obj->type_label;
943 $event->type_color = $obj->type_color;
944 $event->type = $obj->type_type;
945 $event->type_picto = $obj->type_picto;
947 $event->label = $obj->label;
948 $event->percentage = $obj->percent;
950 $event->authorid = $obj->fk_user_author;
951 $event->userownerid = $obj->fk_user_action;
952 $event->fetch_userassigned();
954 $event->priority = $obj->priority;
955 $event->location = $obj->location;
956 $event->transparency = $obj->transparency;
957 $event->fk_element = $obj->fk_element;
958 $event->elementid = $obj->fk_element;
959 $event->elementtype = $obj->elementtype;
961 $event->fk_project = $obj->fk_project;
963 $event->socid = $obj->fk_soc;
964 $event->contact_id = $obj->fk_contact;
965 $event->fk_bookcal_calendar = $obj->fk_bookcal_calendar;
966 if (!empty($event->fk_bookcal_calendar)) {
967 $event->type =
"bookcal_calendar";
972 $event->date_start_in_calendar = $event->datep;
973 if ($event->datef !=
'' && $event->datef >= $event->datep) {
974 $event->date_end_in_calendar = $event->datef;
976 $event->date_end_in_calendar = $event->datep;
980 if ($event->date_end_in_calendar < $firstdaytoshow || $event->date_start_in_calendar >= $lastdaytoshow) {
983 if ($event->date_start_in_calendar < $firstdaytoshow) {
984 $event->date_start_in_calendar = $firstdaytoshow;
986 if ($event->date_end_in_calendar >= $lastdaytoshow) {
987 $event->date_end_in_calendar = ($lastdaytoshow - 1);
991 $daycursor = $event->date_start_in_calendar;
996 $daycursorend = $event->date_end_in_calendar;
997 $anneeend = (int)
dol_print_date($daycursorend,
'%Y',
'tzuserrel');
998 $moisend = (int)
dol_print_date($daycursorend,
'%m',
'tzuserrel');
999 $jourend = (int)
dol_print_date($daycursorend,
'%d',
'tzuserrel');
1008 $daykey =
dol_mktime(0, 0, 0, $mois, $jour, $annee,
'gmt');
1009 $daykeyend =
dol_mktime(0, 0, 0, $moisend, $jourend, $anneeend,
'gmt');
1023 $eventarray[$daykey][] = $event;
1026 $daykey += 60 * 60 * 24;
1028 if ($daykey > $daykeyend) {
1037 $parameters[
'obj'] = $obj;
1038 $reshook = $hookmanager->executeHooks(
'hookEventElements', $parameters, $event, $action);
1039 $event = $hookmanager->resPrint;
1056 $sql =
'SELECT sp.rowid, sp.lastname, sp.firstname, sp.birthday';
1057 $sql .=
' FROM '.MAIN_DB_PREFIX.
'socpeople as sp';
1058 $sql .=
' WHERE (priv=0 OR (priv=1 AND fk_user_creat='.((int) $user->id).
'))';
1059 $sql .=
" AND sp.entity IN (".getEntity(
'contact').
")";
1060 if ($mode ==
'show_day') {
1061 $sql .=
' AND MONTH(birthday) = '.((int) $month);
1062 $sql .=
' AND DAY(birthday) = '.((int) $day);
1064 $sql .=
' AND MONTH(birthday) = '.((int) $month);
1066 $sql .=
' ORDER BY birthday';
1068 dol_syslog(
"comm/action/index.php", LOG_DEBUG);
1069 $resql = $db->query($sql);
1071 $num = $db->num_rows($resql);
1074 $obj = $db->fetch_object($resql);
1078 $event->id = $obj->rowid;
1079 $event->ref = $event->id;
1084 $event->datep =
dol_mktime(0, 0, 0, $datearray[
'mon'], $datearray[
'mday'], $year,
true);
1085 $event->datef = $event->datep;
1087 $event->type_code =
'BIRTHDAY';
1088 $event->type_label =
'';
1089 $event->type_color =
'';
1090 $event->type =
'birthdate';
1091 $event->type_picto =
'birthdate';
1093 $event->label = $langs->trans(
"Birthday").
' '.
dolGetFirstLastname($obj->firstname, $obj->lastname);
1094 $event->percentage = 100;
1095 $event->fulldayevent = 1;
1097 $event->contact_id = $obj->rowid;
1099 $event->date_start_in_calendar = $db->jdate($event->datep);
1100 $event->date_end_in_calendar = $db->jdate($event->datef);
1103 $daycursor = $event->datep;
1108 $daykey =
dol_mktime(0, 0, 0, $mois, $jour, $annee,
'gmt');
1110 $eventarray[$daykey][] = $event;
1127if ($user->hasRight(
"holiday",
"read")) {
1129 $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";
1130 $sql .=
" FROM ".MAIN_DB_PREFIX.
"holiday as x, ".MAIN_DB_PREFIX.
"user as u";
1131 $sql .=
" WHERE u.rowid = x.fk_user";
1132 $sql .=
" AND u.statut = '1'";
1133 $sql .=
" AND (x.statut = '2' OR x.statut = '3')";
1135 if ($mode ==
'show_day') {
1137 $sql .=
" AND '".$db->escape($year).
"-".$db->escape($month).
"-".$db->escape($day).
"' BETWEEN x.date_debut AND x.date_fin";
1138 } elseif ($mode ==
'show_week') {
1140 $sql .=
" AND date_debut < '".$db->idate(
dol_get_last_day($year, $month)).
"'";
1142 } elseif ($mode ==
'show_month') {
1144 $sql .=
" AND date_debut <= '".$db->idate(
dol_get_last_day($year, $month)).
"'";
1148 $resql = $db->query($sql);
1150 $num = $db->num_rows($resql);
1154 $obj = $db->fetch_object($resql);
1159 $event->id = $obj->rowid;
1160 $event->ref = $event->id;
1162 $event->type_code =
'HOLIDAY';
1163 $event->type_label =
'';
1164 $event->type_color =
'';
1165 $event->type =
'holiday';
1166 $event->type_picto =
'holiday';
1168 $event->datep = $db->jdate($obj->date_start) + (empty($halfday) || $halfday == 1 ? 0 : 12 * 60 * 60 - 1);
1169 $event->datef = $db->jdate($obj->date_end) + (empty($halfday) || $halfday == -1 ? 24 : 12) * 60 * 60 - 1;
1170 $event->date_start_in_calendar = $event->datep;
1171 $event->date_end_in_calendar = $event->datef;
1173 if ($obj->status == 3) {
1175 $event->percentage = -1;
1176 } elseif ($obj->status == 2) {
1178 $event->percentage = 0;
1181 if ($obj->halfday == 1) {
1182 $event->label = $obj->lastname.
' ('.$langs->trans(
"Morning").
')';
1183 } elseif ($obj->halfday == -1) {
1184 $event->label = $obj->lastname.
' ('.$langs->trans(
"Afternoon").
')';
1186 $event->label = $obj->lastname;
1189 $daycursor = $event->date_start_in_calendar;
1194 $daykey =
dol_mktime(0, 0, 0, $mois, $jour, $annee,
'gmt');
1196 $eventarray[$daykey][] = $event;
1198 $daykey += 60 * 60 * 24;
1199 }
while ($daykey <= $event->date_end_in_calendar);
1208if (count($listofextcals)) {
1209 require_once DOL_DOCUMENT_ROOT.
'/comm/action/class/ical.class.php';
1211 foreach ($listofextcals as $key => $extcal) {
1212 $url = $extcal[
'src'];
1213 $namecal = $extcal[
'name'];
1214 $offsettz = $extcal[
'offsettz'];
1215 $colorcal = $extcal[
'color'];
1216 $buggedfile = $extcal[
'buggedfile'];
1222 $ical->parse($url, $pathforcachefile, $DELAYFORCACHE);
1225 $listofextcals[$key][
'error'] = $ical->error;
1226 $s .=
'<br><div class="warning">'.dol_escape_htmltag($listofextcals[$key][
'name']).
': '.$url.
'<br>Error message: '.
dol_escape_htmltag($ical->error).
'</div>';
1231 $icalevents = array();
1232 if (is_array($ical->get_event_list())) {
1233 $icalevents = array_merge($icalevents, $ical->get_event_list());
1235 if (is_array($ical->get_freebusy_list())) {
1236 $icalevents = array_merge($icalevents, $ical->get_freebusy_list());
1239 if (count($icalevents) > 0) {
1241 $moreicalevents = array();
1242 foreach ($icalevents as $icalevent) {
1243 if (isset($icalevent[
'RRULE']) && is_array($icalevent[
'RRULE'])) {
1246 if ($icalevent[
'DTSTART;VALUE=DATE']) {
1249 } elseif (is_array($icalevent[
'DTSTART']) && !empty($icalevent[
'DTSTART'][
'unixtime'])) {
1250 $datecurstart = $icalevent[
'DTSTART'][
'unixtime'];
1251 $datecurend = $icalevent[
'DTEND'][
'unixtime'];
1252 if (!empty($ical->cal[
'DAYLIGHT'][
'DTSTART']) && $datecurstart) {
1254 $tmpcurstart = $datecurstart;
1255 $tmpcurend = $datecurend;
1256 $tmpdaylightstart =
dol_mktime(0, 0, 0, 1, 1, 1970, 1) + (int) $ical->cal[
'DAYLIGHT'][
'DTSTART'];
1257 $tmpdaylightend =
dol_mktime(0, 0, 0, 1, 1, 1970, 1) + (int) $ical->cal[
'STANDARD'][
'DTSTART'];
1260 if ($tmpcurstart >= $tmpdaylightstart && $tmpcurstart < $tmpdaylightend) {
1261 $datecurstart -= ((int) $ical->cal[
'DAYLIGHT'][
'TZOFFSETTO']) * 36;
1263 $datecurstart -= ((int) $ical->cal[
'STANDARD'][
'TZOFFSETTO']) * 36;
1265 if ($tmpcurend >= $tmpdaylightstart && $tmpcurstart < $tmpdaylightend) {
1266 $datecurend -= ((int) $ical->cal[
'DAYLIGHT'][
'TZOFFSETTO']) * 36;
1268 $datecurend -= ((int) $ical->cal[
'STANDARD'][
'TZOFFSETTO']) * 36;
1275 dol_syslog(
"Found a not recognized repeatable record with unknown date start", LOG_ERR);
1280 $interval = (empty($icalevent[
'RRULE'][
'INTERVAL']) ? 1 : $icalevent[
'RRULE'][
'INTERVAL']);
1281 $until = empty($icalevent[
'RRULE'][
'UNTIL']) ? 0 :
dol_stringtotime($icalevent[
'RRULE'][
'UNTIL'], 1);
1282 $maxrepeat = empty($icalevent[
'RRULE'][
'COUNT']) ? 0 : $icalevent[
'RRULE'][
'COUNT'];
1283 if ($until && ($until + ($datecurend - $datecurstart)) < $firstdaytoshow) {
1286 if ($datecurstart >= $lastdaytoshow) {
1291 while (($datecurstart < $lastdaytoshow) && (empty($maxrepeat) || ($numofevent < $maxrepeat))) {
1292 if ($datecurend >= $firstdaytoshow) {
1293 $newevent = $icalevent;
1294 unset($newevent[
'RRULE']);
1295 if ($icalevent[
'DTSTART;VALUE=DATE']) {
1296 $newevent[
'DTSTART;VALUE=DATE'] =
dol_print_date($datecurstart,
'%Y%m%d');
1297 $newevent[
'DTEND;VALUE=DATE'] =
dol_print_date($datecurend + 1,
'%Y%m%d');
1299 $newevent[
'DTSTART'] = $datecurstart;
1300 $newevent[
'DTEND'] = $datecurend;
1302 $moreicalevents[] = $newevent;
1306 $savdatecurstart = $datecurstart;
1307 if ($icalevent[
'RRULE'][
'FREQ'] ==
'DAILY') {
1311 if ($icalevent[
'RRULE'][
'FREQ'] ==
'WEEKLY') {
1314 } elseif ($icalevent[
'RRULE'][
'FREQ'] ==
'MONTHLY') {
1317 } elseif ($icalevent[
'RRULE'][
'FREQ'] ==
'YEARLY') {
1322 if ($savdatecurstart >= $datecurstart) {
1323 dol_syslog(
"Found a rule freq ".$icalevent[
'RRULE'][
'FREQ'].
" not managed by dolibarr code. Assume 1 week frequency.", LOG_ERR);
1324 $datecurstart += 3600 * 24 * 7;
1325 $datecurend += 3600 * 24 * 7;
1330 $icalevents = array_merge($icalevents, $moreicalevents);
1333 foreach ($icalevents as $icalevent) {
1338 if (!empty($icalevent[
'RRULE'])) {
1345 if (isset($icalevent[
'DTSTART;VALUE=DATE'])) {
1348 if (empty($icalevent[
'DTEND;VALUE=DATE'])) {
1349 $dateend = $datestart + 86400 - 1;
1355 $event->fulldayevent = 1;
1357 } elseif (!is_array($icalevent[
'DTSTART'])) {
1358 $datestart = $icalevent[
'DTSTART'];
1359 $dateend = empty($icalevent[
'DTEND']) ? $datestart : $icalevent[
'DTEND'];
1361 $datestart += +($offsettz * 3600);
1362 $dateend += +($offsettz * 3600);
1367 } elseif (isset($icalevent[
'DTSTART'][
'unixtime'])) {
1368 $datestart = $icalevent[
'DTSTART'][
'unixtime'];
1369 $dateend = $icalevent[
'DTEND'][
'unixtime'];
1371 $datestart += +($offsettz * 3600);
1372 $dateend += +($offsettz * 3600);
1375 if ($buggedfile ===
'uselocalandtznodaylight') {
1379 if ($buggedfile ===
'uselocalandtzdaylight') {
1380 $localtzs =
new DateTimeZone(preg_replace(
'/"/',
'', $icalevent[
'DTSTART'][
'TZID']));
1381 $localtze =
new DateTimeZone(preg_replace(
'/"/',
'', $icalevent[
'DTEND'][
'TZID']));
1382 $localdts =
new DateTime(
dol_print_date($datestart,
'dayrfc',
'gmt'), $localtzs);
1383 $localdte =
new DateTime(
dol_print_date($dateend,
'dayrfc',
'gmt'), $localtze);
1384 $tmps = -1 * $localtzs->getOffset($localdts);
1385 $tmpe = -1 * $localtze->getOffset($localdte);
1386 $datestart += $tmps;
1394 $event->id = $icalevent[
'UID'];
1395 $event->ref = $event->id;
1396 $userId = $userstatic->findUserIdByEmail($namecal);
1397 if (!empty($userId) && $userId > 0) {
1398 $event->userassigned[$userId] = $userId;
1399 $event->percentage = -1;
1402 $event->type_code =
"ICALEVENT";
1403 $event->type_label = $namecal;
1404 $event->type_color = $colorcal;
1405 $event->type =
'icalevent';
1406 $event->type_picto =
'rss';
1408 $event->icalname = $namecal;
1409 $event->icalcolor = $colorcal;
1411 $event->datep = $datestart + $usertime;
1412 $event->datef = $dateend + $usertime;
1414 if (isset($icalevent[
'SUMMARY']) && $icalevent[
'SUMMARY']) {
1416 } elseif (isset($icalevent[
'DESCRIPTION']) && $icalevent[
'DESCRIPTION']) {
1419 $event->label = $langs->trans(
"ExtSiteNoLabel");
1426 if (!empty($icalevent[
'PRIORITY'])) {
1427 $event->priority = $icalevent[
'PRIORITY'];
1431 if (!empty($icalevent[
'TRANSP'])) {
1432 if ($icalevent[
'TRANSP'] ==
"TRANSPARENT") {
1433 $event->transparency = 0;
1435 if ($icalevent[
'TRANSP'] ==
"OPAQUE") {
1436 $event->transparency = 1;
1447 if (!empty($icalevent[
'LOCATION'])) {
1448 $event->location = $icalevent[
'LOCATION'];
1451 $event->date_start_in_calendar = $event->datep;
1453 if ($event->datef !=
'' && $event->datef >= $event->datep) {
1454 $event->date_end_in_calendar = $event->datef;
1456 $event->date_end_in_calendar = $event->datep;
1460 if ($event->date_end_in_calendar < $firstdaytoshow || $event->date_start_in_calendar >= $lastdaytoshow) {
1466 if ($event->date_start_in_calendar < $firstdaytoshow) {
1467 $event->date_start_in_calendar = $firstdaytoshow;
1469 if ($event->date_end_in_calendar >= $lastdaytoshow) {
1470 $event->date_end_in_calendar = ($lastdaytoshow - 1);
1474 $daycursor = $event->date_start_in_calendar;
1483 $daykey =
dol_mktime(0, 0, 0, $mois, $jour, $annee,
'gmt');
1484 $daykeygmt =
dol_mktime(0, 0, 0, $mois, $jour, $annee,
'gmt');
1487 $eventarray[$daykey][] = $event;
1488 $daykey += 60 * 60 * 24;
1489 $daykeygmt += 60 * 60 * 24;
1490 if (($event->fulldayevent ? $daykeygmt : $daykey) > $event->date_end_in_calendar) {
1502$parameters = array();
1504$reshook = $hookmanager->executeHooks(
'getCalendarEvents', $parameters, $object, $action);
1505if (!empty($hookmanager->resArray[
'eventarray'])) {
1506 foreach ($hookmanager->resArray[
'eventarray'] as $keyDate => $events) {
1507 if (!isset($eventarray[$keyDate])) {
1508 $eventarray[$keyDate] = array();
1510 $eventarray[$keyDate] = array_merge($eventarray[$keyDate], $events);
1515foreach ($eventarray as $keyDate => &$dateeventarray) {
1516 usort($dateeventarray,
'sort_events_by_date');
1521$cachethirdparties = array();
1522$cachecontacts = array();
1523$cacheusers = array();
1526$color_file = DOL_DOCUMENT_ROOT.
"/theme/".
$conf->theme.
"/theme_vars.inc.php";
1527if (is_readable($color_file)) {
1528 include $color_file;
1530if (!is_array($theme_datacolor)) {
1531 $theme_datacolor = array(array(137, 86, 161), array(60, 147, 183), array(250, 190, 80), array(80, 166, 90), array(190, 190, 100), array(91, 115, 247), array(140, 140, 220), array(190, 120, 120), array(115, 125, 150), array(100, 170, 20), array(150, 135, 125), array(85, 135, 150), array(150, 135, 80), array(150, 80, 150));
1534$massactionbutton =
'';
1536print_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);
1542if (empty($mode) || $mode ==
'show_month') {
1544 $newparam = preg_replace(
'/showbirthday=/i',
'showbirthday_=', $newparam);
1545 $newparam = preg_replace(
'/mode=show_month&?/i',
'', $newparam);
1546 $newparam = preg_replace(
'/mode=show_week&?/i',
'', $newparam);
1547 $newparam = preg_replace(
'/day=[0-9]+&?/i',
'', $newparam);
1548 $newparam = preg_replace(
'/month=[0-9]+&?/i',
'', $newparam);
1549 $newparam = preg_replace(
'/year=[0-9]+&?/i',
'', $newparam);
1550 $newparam = preg_replace(
'/viewcal=[0-9]+&?/i',
'', $newparam);
1551 $newparam = preg_replace(
'/showbirthday_=/i',
'showbirthday=', $newparam);
1552 $newparam .=
'&viewcal=1';
1554 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1555 print_actions_filter($form, $canedit, $status, $year, $month, $day, $showbirthday,
'', $filtert,
'', $pid, $socid, $action, -1, $actioncode, $usergroup,
'', $resourceid, $search_categ_cus);
1558 print
'<div class="div-table-responsive-no-min sectioncalendarbymonth maxscreenheightless300">';
1559 print
'<table class="centpercent noborder nocellnopadd cal_pannel cal_month listwithfilterbefore">';
1560 print
' <tr class="liste_titre">';
1562 echo
' <td class="center">#</td>';
1565 print
' <td class="center bold uppercase tdfordaytitle'.($i == 0 ?
' borderleft' :
'').
'">';
1566 $numdayinweek = (($i + (isset(
$conf->global->MAIN_START_WEEK) ?
$conf->global->MAIN_START_WEEK : 1)) % 7);
1567 if (!empty(
$conf->dol_optimize_smallscreen)) {
1568 $labelshort = array(0 =>
'SundayMin', 1 =>
'MondayMin', 2 =>
'TuesdayMin', 3 =>
'WednesdayMin', 4 =>
'ThursdayMin', 5 =>
'FridayMin', 6 =>
'SaturdayMin');
1569 print $langs->trans($labelshort[$numdayinweek]);
1571 print $langs->trans(
"Day".$numdayinweek);
1573 print
' </td>'.
"\n";
1579 $todaytms =
dol_mktime(0, 0, 0, $todayarray[
'mon'], $todayarray[
'mday'], $todayarray[
'year']);
1583 for ($iter_week = 0; $iter_week < 6; $iter_week++) {
1587 $currdate0 = sprintf(
"%04d", $prev_year).sprintf(
"%02d", $prev_month).sprintf(
"%02d", $max_day_in_prev_month + $tmpday);
1588 } elseif ($tmpday <= $max_day_in_month) {
1589 $currdate0 = sprintf(
"%04d", $year).sprintf(
"%02d", $month).sprintf(
"%02d", $tmpday);
1591 $currdate0 = sprintf(
"%04d", $next_year).sprintf(
"%02d", $next_month).sprintf(
"%02d", $tmpday - $max_day_in_month);
1594 $numweek0 = date(
"W", strtotime(date($currdate0)));
1596 echo
' <td class="center weeknumber opacitymedium" width="2%">'.$numweek0.
'</td>';
1598 for ($iter_day = 0; $iter_day < 7; $iter_day++) {
1601 $style =
'cal_other_month cal_past';
1602 if ($iter_day == 6) {
1603 $style .=
' cal_other_month_right';
1605 echo
' <td class="'.$style.
' nowrap tdtop" width="14%">';
1607 show_day_events($db, $max_day_in_prev_month + $tmpday, $prev_month, $prev_year, $month, $style, $eventarray, $maxprint, $maxnbofchar, $newparam);
1609 } elseif ($tmpday <= $max_day_in_month) {
1611 $curtime =
dol_mktime(0, 0, 0, $month, $tmpday, $year);
1612 $style =
'cal_current_month';
1613 if ($iter_day == 6) {
1614 $style .=
' cal_current_month_right';
1617 if ($todayarray[
'mday'] == $tmpday && $todayarray[
'mon'] == $month && $todayarray[
'year'] == $year) {
1621 $style =
'cal_today';
1623 if ($curtime < $todaytms) {
1624 $style .=
' cal_past';
1627 echo
' <td class="'.$style.
' nowrap tdtop" width="14%">';
1629 show_day_events($db, $tmpday, $month, $year, $month, $style, $eventarray, $maxprint, $maxnbofchar, $newparam, 0, 60, 0, $bookcalcalendars);
1633 $style =
'cal_other_month';
1634 if ($iter_day == 6) {
1635 $style .=
' cal_other_month_right';
1637 echo
' <td class="'.$style.
' nowrap tdtop" width="14%">';
1639 show_day_events($db, $tmpday - $max_day_in_month, $next_month, $next_year, $month, $style, $eventarray, $maxprint, $maxnbofchar, $newparam);
1649 print
'<input type="hidden" name="actionmove" value="mupdate">';
1650 print
'<input type="hidden" name="backtopage" value="'.dol_escape_htmltag($_SERVER[
'PHP_SELF']).
'?mode=show_month&'.
dol_escape_htmltag($_SERVER[
'QUERY_STRING']).
'">';
1651 print
'<input type="hidden" name="newdate" id="newdate">';
1652} elseif ($mode ==
'show_week') {
1655 $newparam = preg_replace(
'/showbirthday=/i',
'showbirthday_=', $newparam);
1656 $newparam = preg_replace(
'/mode=show_month&?/i',
'', $newparam);
1657 $newparam = preg_replace(
'/mode=show_week&?/i',
'', $newparam);
1658 $newparam = preg_replace(
'/day=[0-9]+&?/i',
'', $newparam);
1659 $newparam = preg_replace(
'/month=[0-9]+&?/i',
'', $newparam);
1660 $newparam = preg_replace(
'/year=[0-9]+&?/i',
'', $newparam);
1661 $newparam = preg_replace(
'/viewweek=[0-9]+&?/i',
'', $newparam);
1662 $newparam = preg_replace(
'/showbirthday_=/i',
'showbirthday=', $newparam);
1663 $newparam .=
'&viewweek=1';
1665 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1666 print_actions_filter($form, $canedit, $status, $year, $month, $day, $showbirthday,
'', $filtert,
'', $pid, $socid, $action, -1, $actioncode, $usergroup,
'', $resourceid);
1669 print
'<div class="div-table-responsive-no-min sectioncalendarbyweek maxscreenheightless300">';
1670 print
'<table class="centpercent noborder nocellnopadd cal_pannel cal_month listwithfilterbefore">';
1671 print
' <tr class="liste_titre">';
1674 echo
' <td class="center bold uppercase tdfordaytitle">'.$langs->trans(
"Day".(($i + (isset(
$conf->global->MAIN_START_WEEK) ?
$conf->global->MAIN_START_WEEK : 1)) % 7)).
"</td>\n";
1681 for ($iter_day = 0; $iter_day < 7; $iter_day++) {
1688 $style =
'cal_current_month';
1689 if ($iter_day == 6) {
1690 $style .=
' cal_other_month_right';
1695 if ($todayarray[
'mday'] == $tmpday && $todayarray[
'mon'] == $tmpmonth && $todayarray[
'year'] == $tmpyear) {
1699 $style =
'cal_today';
1702 echo
' <td class="'.$style.
'" width="14%" valign="top">';
1704 show_day_events($db, $tmpday, $tmpmonth, $tmpyear, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300, 0, $bookcalcalendars);
1712 echo
'<input type="hidden" name="actionmove" value="mupdate">';
1713 echo
'<input type="hidden" name="backtopage" value="'.dol_escape_htmltag($_SERVER[
'PHP_SELF']).
'?mode=show_week&'.
dol_escape_htmltag($_SERVER[
'QUERY_STRING']).
'">';
1714 echo
'<input type="hidden" name="newdate" id="newdate">';
1717 $newparam = preg_replace(
'/mode=show_month&?/i',
'', $newparam);
1718 $newparam = preg_replace(
'/mode=show_week&?/i',
'', $newparam);
1719 $newparam = preg_replace(
'/viewday=[0-9]+&?/i',
'', $newparam);
1720 $newparam .=
'&viewday=1';
1722 $style =
'cal_current_month cal_current_month_oneday';
1725 if ($todayarray[
'mday'] == $day && $todayarray[
'mon'] == $month && $todayarray[
'year'] == $year) {
1730 $timestamp =
dol_mktime(12, 0, 0, $month, $day, $year);
1733 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1734 print_actions_filter($form, $canedit, $status, $year, $month, $day, $showbirthday,
'', $filtert,
'', $pid, $socid, $action, -1, $actioncode, $usergroup,
'', $resourceid);
1737 print
'<div class="div-table-responsive-no-min sectioncalendarbyday maxscreenheightless300">';
1738 echo
'<table class="tagtable centpercent noborder nocellnopadd cal_pannel cal_month listwithfilterbefore" style="margin-bottom: 10px !important;">';
1740 echo
' <tr class="tagtr liste_titre">';
1741 echo
' <td class="tagtd center bold uppercase">'.$langs->trans(
"Day".$arraytimestamp[
'wday']).
"</td>\n";
1758 print
'<div class="div-table-responsive-no-min">';
1760 $maxheightwin = (isset($_SESSION[
"dol_screenheight"]) && $_SESSION[
"dol_screenheight"] > 500) ? ($_SESSION[
"dol_screenheight"] - 200) : 660;
1762 echo
'<div style="max-height: '.$maxheightwin.
'px;">';
1763 echo
'<div class="tagtable centpercent calendarviewcontainer">';
1768 $minhour = round((
float) $tmp[0], 0);
1769 $maxhour = round((
float) $tmp[1], 0);
1770 if ($minhour > 23) {
1776 if ($maxhour <= $minhour) {
1777 $maxhour = $minhour + 1;
1783 echo
' <div class="tagtr calendarviewcontainertr">'.
"\n";
1784 echo
' <div class="tagtd width100 tdtop">'.dol_print_date($i * 3600,
'hour',
'gmt').
'</div>';
1785 echo
' <div class="tagtd '.$style.
' tdtop"></div>'.
"\n";
1786 echo
' </div>'.
"\n";
1791 echo
'</div></div>';
1794 show_day_events($db, $day, $month, $year, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300, 1, $bookcalcalendars);
1798 print
'<div class="div-table-responsive-no-min">';
1801 show_day_events($db, $day, $month, $year, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300, 0, $bookcalcalendars);
1813print
"\n".
'</form>';
1839function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventarray, $maxprint = 0, $maxnbofchar = 16, $newparam =
'', $showinfo = 0, $minheight = 60, $nonew = 0, $bookcalcalendarsarray = array())
1841 global $user,
$conf, $langs;
1842 global $action, $mode, $filter, $filtert, $status, $actioncode, $usergroup;
1843 global $theme_datacolor;
1844 global $cachethirdparties, $cachecontacts, $cacheusers, $colorindexused;
1845 global $hookmanager;
1847 '@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
1848 @phan-var-force User[] $cacheusers
1849 @phan-var-force array<int<0,3>> $colorindexused';
1851 if (
$conf->use_javascript_ajax) {
1852 $conf->global->MAIN_JS_SWITCH_AGENDA = 1;
1855 $dateint = sprintf(
"%04d", $year).sprintf(
"%02d", $month).sprintf(
"%02d", $day);
1861 $curtime =
dol_mktime(0, 0, 0, $month, $day, $year);
1862 $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;
1864 if ($user->hasRight(
'agenda',
'myactions',
'create') || $user->hasRight(
'agenda',
'allactions',
'create')) {
1865 $newparam .=
'&month='.str_pad((
string) $month, 2,
"0", STR_PAD_LEFT).
'&year='.$year;
1866 $hourminsec =
'100000';
1867 $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 :
''));
1871 print
'<div id="dayevent_'.$dateint.
'" class="dayevent tagtable centpercent nobordernopadding">'.
"\n";
1874 print
'<div class="tagtr cursorpointer" onclick="window.location=\''.$urltocreate.
'\';
"><div class="nowrap tagtd
"><div class="left
inline-block
">';
1875 print '<a class="dayevent-aday
" style="color: #666
" href="'.$urltoshow.'">';
1877 print dol_print_date($curtime, 'daytextshort');
1879 print dol_print_date($curtime, '%d');
1882 print '</div><div class="nowrap floatright
inline-block marginrightonly
">';
1883 if ($user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda', 'allactions', 'create')) {
1884 print '<a class="cursoradd
" href="'.$urltocreate.'">'; // Explicit link, useful for nojs interfaces
1885 print img_picto($langs->trans("NewAction
"), 'edit_add.png');
1888 print '</div></div></div>'."\n
";
1896 // Line with td contains all div of each events
1897 print '<div class="tagtr
">';
1898 print '<div class="tagtd centpercent agendacell sortable
">';
1900 //$curtime = dol_mktime (0, 0, 0, $month, $day, $year);
1907 $numicals = array();
1908 $ymd = sprintf("%04d
", $year).sprintf("%02d
", $month).sprintf("%02d
", $day);
1910 $colorindexused[$user->id] = 0; // Color index for current user (user->id) is always 0
1911 $nextindextouse = is_array($colorindexused) ? count($colorindexused) : 0; // At first run this is 0, so fist user has 0, next 1, ...
1912 //var_dump($colorindexused);
1914 include_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php';
1915 $tmpholiday = new Holiday($db);
1917 foreach ($eventarray as $daykey => $notused) { // daykey is the 'YYYYMMDD' to show according to user
1918 $annee = (int) dol_print_date($daykey, '%Y', 'gmt'); // We use gmt because we want the value represented by string 'YYYYMMDD'
1919 $mois = (int) dol_print_date($daykey, '%m', 'gmt'); // We use gmt because we want the value represented by string 'YYYYMMDD'
1920 $jour = (int) dol_print_date($daykey, '%d', 'gmt'); // We use gmt because we want the value represented by string 'YYYYMMDD'
1922 //print 'event daykey='.$daykey.' dol_print_date(daykey)='.dol_print_date($daykey, 'dayhour', 'gmt').' jour='.$jour.' mois='.$mois.' annee='.$annee."<br>\n
";
1923 //print 'event daykey='.$daykey.' dol_print_date(daykey)='.dol_print_date($daykey, 'dayhour', 'gmt').' day='.$day.' month='.$month.' year='.$year."<br>\n
";
1925 if ($day == $jour && $month == $mois && $year == $annee) {
1926 foreach ($eventarray[$daykey] as $index => $event) {
1927 if ($i < $maxprint || $maxprint == 0 || getDolGlobalString('MAIN_JS_SWITCH_AGENDA')) {
1928 $keysofuserassigned = array_keys($event->userassigned);
1929 $ponct = ($event->date_start_in_calendar == $event->date_end_in_calendar);
1931 // Define $color (Hex string like '0088FF') and $cssclass of event
1935 if (in_array($user->id, $keysofuserassigned)) {
1936 $cssclass = 'family_mytasks';
1938 if (empty($cacheusers[$event->userownerid])) {
1939 $newuser = new User($db);
1940 $newuser->fetch($event->userownerid);
1941 $cacheusers[$event->userownerid] = $newuser;
1943 //var_dump($cacheusers[$event->userownerid]->color);
1945 // We decide to choose color of owner of event (event->userownerid is user id of owner, event->userassigned contains all users assigned to event)
1946 if (!empty($cacheusers[$event->userownerid]->color)) {
1947 $color = $cacheusers[$event->userownerid]->color;
1949 } elseif ($event->type_code == 'ICALEVENT') { // Event come from external ical file
1951 if (!empty($event->icalname)) {
1952 if (!isset($numicals[dol_string_nospecial($event->icalname)])) {
1953 $numicals[dol_string_nospecial($event->icalname)] = 0;
1955 $numicals[dol_string_nospecial($event->icalname)]++;
1958 $color = ($event->icalcolor ? $event->icalcolor : -1);
1959 $cssclass = (!empty($event->icalname) ? 'family_ext'.md5($event->icalname) : 'family_other');
1960 } elseif ($event->type_code == 'BIRTHDAY') {
1963 $cssclass = 'family_birthday ';
1964 $color = sprintf("%02x%02x%02x
", $theme_datacolor[$colorindex][0], $theme_datacolor[$colorindex][1], $theme_datacolor[$colorindex][2]);
1965 } elseif ($event->type == 'bookcal_calendar') {
1968 $cssclass = 'family_bookcal_calendar_'.(!empty($bookcalcalendarsarray["availabilitieslink
"]) ? $bookcalcalendarsarray["availabilitieslink
"][$event->fk_bookcal_calendar] : "");
1969 $color = sprintf("%02x%02x%02x
", $theme_datacolor[$colorindex][0], $theme_datacolor[$colorindex][1], $theme_datacolor[$colorindex][2]);
1972 $color = ($event->icalcolor ? $event->icalcolor : -1);
1973 $cssclass = (!empty($event->icalname) ? 'family_ext'.md5($event->icalname) : 'family_other');
1975 if (empty($cacheusers[$event->userownerid])) {
1976 $newuser = new User($db);
1977 $newuser->fetch($event->userownerid);
1978 $cacheusers[$event->userownerid] = $newuser;
1980 //var_dump($cacheusers[$event->userownerid]->color);
1982 // We decide to choose color of owner of event (event->userownerid is user id of owner, event->userassigned contains all users assigned to event)
1983 if (!empty($cacheusers[$event->userownerid]->color)) {
1984 $color = $cacheusers[$event->userownerid]->color;
1988 if ($color < 0) { // Color was not set on user card. Set color according to color index.
1989 // Define color index if not yet defined
1990 $idusertouse = ($event->userownerid ? $event->userownerid : 0);
1991 if (isset($colorindexused[$idusertouse])) {
1992 $colorindex = $colorindexused[$idusertouse]; // Color already assigned to this user
1994 $colorindex = $nextindextouse;
1995 $colorindexused[$idusertouse] = $colorindex;
1996 if (!empty($theme_datacolor[$nextindextouse + 1])) {
1997 $nextindextouse++; // Prepare to use next color
2000 //print '|'.($color).'='.($idusertouse?$idusertouse:0).'='.$colorindex.'<br>';
2001 // Define color // @suppress-next-line PhanPluginPrintfIncompatibleArgumentType
2002 $color = sprintf("%02x%02x%02x
", $theme_datacolor[$colorindex][0], $theme_datacolor[$colorindex][1], $theme_datacolor[$colorindex][2]);
2004 $cssclass = $cssclass.' eventday_'.$ymd;
2006 // Defined style to disable drag and drop feature
2007 if ($event->type_code == 'AC_OTH_AUTO') {
2008 $cssclass .= " unmovable
";
2009 } elseif ($event->type_code == 'HOLIDAY') {
2010 $cssclass .= " unmovable
";
2011 } elseif ($event->type_code == 'BIRTHDAY') {
2012 $cssclass .= " unmovable
";
2013 } elseif ($event->type_code == 'ICALEVENT') {
2014 $cssclass .= " unmovable
";
2015 } 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)) {
2016 // If the event is on several days
2017 $tmpyearend = dol_print_date($event->date_start_in_calendar, '%Y', 'tzuserrel');
2018 $tmpmonthend = dol_print_date($event->date_start_in_calendar, '%m', 'tzuserrel');
2019 $tmpdayend = dol_print_date($event->date_start_in_calendar, '%d', 'tzuserrel');
2020 //var_dump($tmpyearend.' '.$tmpmonthend.' '.$tmpdayend);
2021 if ($tmpyearend != $annee || $tmpmonthend != $mois || $tmpdayend != $jour) {
2022 $cssclass .= " unmovable unmovable-mustusefirstdaytodrag
";
2024 $cssclass .= ' movable cursormove';
2027 if ($user->hasRight('agenda', 'allactions', 'create') ||
2028 (($event->authorid == $user->id || $event->userownerid == $user->id) && $user->hasRight('agenda', 'myactions', 'create'))) {
2029 $cssclass .= " movable cursormove
";
2031 $cssclass .= " unmovable
";
2037 if ($mode == 'show_day') {
2038 $h = 'height: 100%; ';
2041 if ($mode == 'show_week') {
2042 $h = 'height: 100%; ';
2048 print '<!-- start event '.$i.' -->'."\n
";
2051 if ($maxprint && $ireallyshown >= $maxprint) {
2052 $morecss = 'showifmore';
2054 if ($event->type == 'birthdate' && !GETPOST('check_birthday')) {
2055 $morecss = 'hidden';
2057 if ($event->type == 'holiday' && !GETPOST('check_holiday')) {
2058 $morecss = 'hidden';
2060 /* I comment this because it hides event recorded from bookcal online page
2061 if ($event->type == 'bookcal_calendar' && !GETPOST('check_bookcal_calendar_'.$bookcalcalendarsarray["availabilitieslink
"][$event->fk_bookcal_calendar])) {
2062 $morecss = 'hidden';
2064 if ($morecss != 'hidden') {
2067 if ($morecss != 'showifmore' && $morecss != 'hidden') {
2071 //var_dump($event->type.' - '.$morecss.' - '.$cssclass.' - '.$i.' - '.$ireallyshown.' - '.$itoshow);
2072 if (isModEnabled("bookcal
") && $event->type == 'bookcal_calendar') {
2073 print '<div id="event_
'.$ymd.'_
'.$i.'" class="event family_
'.$event->type.'_
'.$bookcalcalendarsarray["availabilitieslink"][$event->fk_bookcal_calendar].' '.$cssclass.($morecss ? ' '.$morecss : '').'"';
2075 print '<div id="event_
'.$ymd.'_
'.$i.'" class="event family_
'.$event->type.' '.$cssclass.($morecss ? ' '.$morecss : '').'"';
2077 //print ' style="height: 100px;
';
2078 //print ' position: absolute; top: 40px; width: 50%;
';
2082 //var_dump($event->userassigned);
2083 //var_dump($event->transparency);
2084 print '<table class="centpercent cal_event
';
2085 print(empty($event->transparency) ? ' cal_event_notbusy
' : ' cal_event_busy
');
2086 //if (empty($event->transparency) && empty($conf->global->AGENDA_NO_TRANSPARENT_ON_NOT_BUSY)) print ' opacitymedium
'; // Not busy
2087 print '" style="'.$h;
2088 $colortouse = $color;
2089 // If colortouse is similar than background, we force to change it.
2090 if (empty($event->transparency) && !getDolGlobalString('AGENDA_NO_TRANSPARENT_ON_NOT_BUSY
')) {
2091 print 'background: #f0f0f0;
';
2092 print 'border-left: 5px solid #
'.$colortouse.';
';
2094 print 'background: #f0f0f0;
';
2095 print 'border-left: 5px solid #
'.dol_color_minus($colortouse, -3).';
';
2096 //print 'background: -webkit-gradient(linear, left top, left bottom, from(#
'.dol_color_minus($colortouse, -3).'), to(#
'.dol_color_minus($colortouse, -1).'));
';
2098 //print 'background: #
'.$colortouse.';
';
2099 //print 'background: -webkit-gradient(linear, left top, left bottom, from(#
'.dol_color_minus($color, -3).'), to(#
'.dol_color_minus($color, -1).'));
';
2100 //if (!empty($event->transparency)) print 'background: #
'.$color.'; background: -webkit-gradient(linear, left top, left bottom, from(#
'.$color.'), to(#
'.dol_color_minus($color,1).'));
';
2101 //else print 'background-color: transparent !important; background: none; border: 1px solid #bbb;
';
2102 //print ' -moz-border-radius:4px;
"';
2103 //print 'border: 1px solid #ccc" width=
"100%"';
2106 print '<td class="tdoverflow nobottom small centpercent
'.($nowrapontd ? 'nowrap
' : '').'cal_event
'.($event->type_code == 'BIRTHDAY
' ? ' cal_event_birthday
' : '').'">';
2107 print '<!-- left section of event -->';
2111 if ($event->type_code == 'BIRTHDAY') {
2112 // It's birthday calendar
2113 $picb = '<i class="fas fa-birthday-cake
inline-block valignmiddle
"></i>';
2114 //$pice = '<i class="fas fa-briefcase
inline-block
"></i>';
2115 //$typea = ($objp->typea == 'birth') ? $picb : $pice;
2117 print $picb.' '.$langs->trans("Birthday
").'<br>';
2118 //print img_picto($langs->trans("Birthday
"), 'birthday-cake').' ';
2120 $tmpid = $event->id;
2122 if (empty($cachecontacts[$tmpid])) {
2123 $newcontact = new Contact($db);
2124 $newcontact->fetch($tmpid);
2125 $cachecontacts[$tmpid] = $newcontact;
2127 print $cachecontacts[$tmpid]->getNomUrl(1, '', 0, '', -1, 0, 'valignmiddle inline-block');
2129 //$event->picto = 'birthday-cake';
2130 //print $event->getNomUrl(1, $maxnbofchar, 'cal_event', 'birthday', 'contact');
2131 /*$listofcontacttoshow = '';
2132 $listofcontacttoshow .= '<br>'.$cacheusers[$tmpid]->getNomUrl(-1, '', 0, 0, 0, 0, '', 'paddingright valignmiddle');
2133 print $listofcontacttoshow;
2135 } elseif ($event->type_code == 'HOLIDAY') {
2136 // It's holiday calendar
2137 $tmpholiday->fetch($event->id);
2139 print $tmpholiday->getNomUrl(1, -1, 0, 'valignmiddle inline-block');
2141 $tmpid = $tmpholiday->fk_user;
2142 if (empty($cacheusers[$tmpid])) {
2143 $newuser = new User($db);
2144 $newuser->fetch($tmpid);
2145 $cacheusers[$tmpid] = $newuser;
2148 $listofusertoshow = '';
2149 $listofusertoshow .= '<br>'.$cacheusers[$tmpid]->getNomUrl(-1, '', 0, 0, 0, 0, '', 'paddingright valignmiddle inline-block');
2150 print $listofusertoshow;
2153 $parameters = array();
2154 $reshook = $hookmanager->executeHooks('eventOptions', $parameters, $event, $action); // Note that $action and $object may have been modified by some hooks
2156 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
2158 '@phan-var-force ActionComm $event';
2159 if (empty($reshook)) {
2162 if (empty($event->fulldayevent)) {
2163 //print $event->getNomUrl(2).' ';
2168 if (empty($event->fulldayevent)) {
2169 // Show hours (start ... end)
2170 $tmpyearstart = dol_print_date($event->date_start_in_calendar, '%Y', 'tzuserrel');
2171 $tmpmonthstart = dol_print_date($event->date_start_in_calendar, '%m', 'tzuserrel');
2172 $tmpdaystart = dol_print_date($event->date_start_in_calendar, '%d', 'tzuserrel');
2173 $tmpyearend = dol_print_date($event->date_end_in_calendar, '%Y', 'tzuserrel');
2174 $tmpmonthend = dol_print_date($event->date_end_in_calendar, '%m', 'tzuserrel');
2175 $tmpdayend = dol_print_date($event->date_end_in_calendar, '%d', 'tzuserrel');
2178 if ($tmpyearstart == $annee && $tmpmonthstart == $mois && $tmpdaystart == $jour) {
2179 $daterange .= dol_print_date($event->date_start_in_calendar, 'hour', 'tzuserrel');
2180 if ($event->date_end_in_calendar && $event->date_start_in_calendar != $event->date_end_in_calendar) {
2181 if ($tmpyearstart == $tmpyearend && $tmpmonthstart == $tmpmonthend && $tmpdaystart == $tmpdayend) {
2188 if ($event->date_end_in_calendar && $event->date_start_in_calendar != $event->date_end_in_calendar) {
2189 if ($tmpyearstart != $tmpyearend || $tmpmonthstart != $tmpmonthend || $tmpdaystart != $tmpdayend) {
2190 $daterange .= '...';
2194 if ($event->date_end_in_calendar && $event->date_start_in_calendar != $event->date_end_in_calendar) {
2195 if ($tmpyearend == $annee && $tmpmonthend == $mois && $tmpdayend == $jour) {
2196 $daterange .= dol_print_date($event->date_end_in_calendar, 'hour', 'tzuserrel');
2201 print $langs->trans("EventOnFullDay
")."<br>\n
";
2206 $titletoshow = $daterange;
2207 $titletoshow .= ($titletoshow ? ' ' : '').dol_escape_htmltag($event->label);
2209 if ($event->type_code != 'ICALEVENT') {
2210 $savlabel = $event->label;
2211 $event->label = $titletoshow;
2212 // Note: List of users are inside $event->userassigned. Link may be clickable depending on permissions of user.
2213 $titletoshow = (($event->type_picto || $event->type_code) ? $event->getTypePicto() : '');
2214 $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 '...'
2215 $event->label = $savlabel;
2218 // Loop on each assigned user
2219 $listofusertoshow = '';
2220 $posuserassigned = 0;
2221 foreach ($event->userassigned as $tmpid => $tmpdata) {
2222 if (!$posuserassigned && $titletoshow) {
2223 $listofusertoshow .= '<br>';
2226 if (empty($cacheusers[$tmpid])) {
2227 $newuser = new User($db);
2228 $newuser->fetch($tmpid);
2229 $cacheusers[$tmpid] = $newuser;
2232 $listofusertoshow .= $cacheusers[$tmpid]->getNomUrl(-3, '', 0, 0, 0, 0, '', 'valignmiddle inline-block');
2236 print $listofusertoshow.' ';
2238 if ($event->type_code == 'ICALEVENT') {
2239 print '<br>('.dol_trunc($event->icalname, $maxnbofchar).')';
2242 $thirdparty_id = ($event->socid > 0 ? $event->socid : ((is_object($event->societe) && $event->societe->id > 0) ? $event->societe->id : 0));
2243 $contact_id = ($event->contact_id > 0 ? $event->contact_id : ((is_object($event->contact) && $event->contact->id > 0) ? $event->contact->id : 0));
2245 // If action related to company / contact
2246 $linerelatedto = '';
2247 if ($thirdparty_id > 0) {
2248 if (!isset($cachethirdparties[$thirdparty_id]) || !is_object($cachethirdparties[$thirdparty_id])) {
2249 $thirdparty = new Societe($db);
2250 $thirdparty->fetch($thirdparty_id);
2251 $cachethirdparties[$thirdparty_id] = $thirdparty;
2253 $thirdparty = $cachethirdparties[$thirdparty_id];
2255 if (!empty($thirdparty->id)) {
2256 $linerelatedto .= $thirdparty->getNomUrl(1, '', 0, 0, -1, 0, '', 'valignmiddle inline-block');
2259 if (!empty($contact_id) && $contact_id > 0) {
2260 if (empty($cachecontacts[$contact_id]) || !is_object($cachecontacts[$contact_id])) {
2261 $contact = new Contact($db);
2262 $contact->fetch($contact_id);
2263 $cachecontacts[$contact_id] = $contact;
2265 $contact = $cachecontacts[$contact_id];
2267 if ($linerelatedto) {
2268 $linerelatedto .= ' ';
2270 if (!empty($contact->id)) {
2271 $linerelatedto .= $contact->getNomUrl(1, '', 0, '', -1, 0, 'valignmiddle inline-block');
2274 if (!empty($event->fk_element) && $event->fk_element > 0 && !empty($event->elementtype) && getDolGlobalString('AGENDA_SHOW_LINKED_OBJECT')) {
2275 include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
2276 if ($linerelatedto) {
2277 $linerelatedto .= '<br>';
2279 $linerelatedto .= dolGetElementUrl($event->fk_element, $event->elementtype, 1);
2281 if ($linerelatedto) {
2282 print ' '.$linerelatedto;
2284 } elseif (!empty($reshook)) {
2285 print $hookmanager->resPrint;
2291 if ($event->location) {
2293 print $langs->trans("Location
").': '.$event->location;
2300 if ($event->type_code != 'BIRTHDAY' && $event->type_code != 'ICALEVENT') {
2302 if ($event->percentage >= 0) {
2306 print '<td class="nobottom right nowrap cal_event_right
'.($withstatus >= 2 ? ' cal_event_right_status
' : '').'">';
2308 print $event->getLibStatut(3, 1);
2312 print '</td></tr></table>';
2313 print '</div><!-- end event '.$i.' -->'."\n
";
2317 print '<a href="'.DOL_URL_ROOT.'/comm/action/index.php?mode=
'.$mode.'&maxprint=0&month=
'.((int) $monthshown).'&year=
'.((int) $year);
2318 print($status ? '&
status=
'.$status : '').($filter ? '&filter=
'.urlencode($filter) : '');
2319 print($filtert ? '&search_filtert=
'.urlencode((string) $filtert) : '');
2320 print($usergroup ? '&search_usergroup=
'.urlencode($usergroup) : '');
2321 print($actioncode != '' ? '&search_actioncode=
'.urlencode($actioncode) : '');
2322 print '">'.img_picto("all
", "1downarrow_selected.png
").' ...';
2323 print ' +'.(count($eventarray[$daykey]) - $maxprint);
2326 //$ok=false; // To avoid to show twice the link
2333 if (!$i) { // No events
2337 if (getDolGlobalString('MAIN_JS_SWITCH_AGENDA') && $itoshow > $ireallyshown && $maxprint) {
2338 print '<div class="center cursorpointer
" id="more_
'.$ymd.'">'.img_picto("All
", "angle-
double-down
", 'class="warning
"').' +'.($itoshow - $ireallyshown).'</div>';
2339 //print ' +'.(count($eventarray[$daykey])-$maxprint);
2341 print '<script type="text/javascript
">'."\n
";
2342 print 'jQuery(document).ready(function () {'."\n
";
2343 print ' var open=0;'."\n
";
2344 print ' jQuery("#more_
'.$ymd.'").click(function() { console.log("Click on showmore
for '.$ymd.'"); reinit_day_'.$ymd.'(); event.stopImmediatePropagation(); });'."\n
";
2345 print ' function reinit_day_'.$ymd.'() {'."\n
";
2346 print ' jQuery(".eventday_
'.$ymd.'.showifmore
").toggle();'."\n
";
2347 print ' open = open + 1; if (open > 1) { open = 0; }'."\n
";
2348 print ' if (open) { ';
2349 print ' jQuery("#more_
'.$ymd.'").html(\''.img_picto("All
", "angle-
double-up
", 'class="warning
"').'\');'."\n
";
2351 print ' jQuery("#more_
'.$ymd.'").html(\''.img_picto("All
", "angle-
double-down
", 'class="warning
"').' +'.($itoshow - $ireallyshown).'\');'."\n
";
2355 print '</script>'."\n
";
2358 print '</div></div>'; // td tr
2360 print '</div>'; // table
2373function dol_color_minus($color, $minus, $minusunit = 16)
2376 if ($minusunit == 16) {
2377 $newcolor[0] = dechex(max(min(hexdec($newcolor[0]) - $minus, 15), 0));
2378 $newcolor[2] = dechex(max(min(hexdec($newcolor[2]) - $minus, 15), 0));
2379 $newcolor[4] = dechex(max(min(hexdec($newcolor[4]) - $minus, 15), 0));
2381 // Not yet implemented
2393function sort_events_by_date($a, $b)
2395 // Sort holidays at first
2396 if ($a->type_code === 'HOLIDAY') {
2399 if ($b->type_code === 'HOLIDAY') {
2403 // datep => Event start time
2404 // datef => Event end time
2406 // Events have different start time
2407 if ($a->datep !== $b->datep) {
2408 return $a->datep - $b->datep;
2411 // Events have same start time and no end time
2412 if ((!is_numeric($b->datef)) || (!is_numeric($a->datef))) {
2413 return sort_events_by_percentage($a, $b);
2416 // Events have the same start time and same end time
2417 if ($b->datef === $a->datef) {
2418 return sort_events_by_percentage($a, $b);
2421 // Events have the same start time, but have different end time -> longest event first
2422 return $b->datef - $a->datef;
2432function sort_events_by_percentage($a, $b)
2434 // Sort events with no percentage before each other
2435 // (useful to sort holidays, sick days or similar on the top)
2437 if ($a->percentage < 0) {
2441 if ($b->percentage < 0) {
2445 return $b->percentage - $a->percentage;
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $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)
Show filter form in agenda view.
calendars_prepare_head($param)
Define head array for tabs of agenda setup pages.
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.
show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventarray, $maxprint=0, $maxnbofchar=16, $newparam='', $showinfo=0, $minheight=60, $nonew=0, $bookcalcalendarsarray=array())
Show event of a particular day.
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_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_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)
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.
getDolUserString($key, $default='', $tmpuser=null)
Return Dolibarr user constant string value.
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
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_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
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.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_sanitizePathName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a path name.
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)
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
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.