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';
45if (!isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) {
46 $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW = 3;
50 $conf->global->AGENDA_EXT_NB = 5;
55$disabledefaultvalues =
GETPOSTINT(
'disabledefaultvalues');
58$filter =
GETPOST(
"search_filter",
'alpha', 3) ?
GETPOST(
"search_filter",
'alpha', 3) :
GETPOST(
"filter",
'alpha', 3);
59$filtert =
GETPOST(
"search_filtert",
"intcomma", 3) ?
GETPOST(
"search_filtert",
"intcomma", 3) :
GETPOST(
"filtert",
"intcomma", 3);
60$usergroup =
GETPOST(
"search_usergroup",
"intcomma", 3) ?
GETPOST(
"search_usergroup",
"intcomma", 3) :
GETPOST(
"usergroup",
"intcomma", 3);
61$showbirthday = empty($conf->use_javascript_ajax) ?
GETPOSTINT(
"showbirthday") : 1;
62$search_categ_cus =
GETPOST(
"search_categ_cus",
'intcomma', 3) ?
GETPOST(
"search_categ_cus",
'intcomma', 3) : 0;
71$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
72$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
74if (empty($page) || $page == -1) {
78$offset = $limit * $page;
83 $sortfield =
"a.datec";
89 $socid = $user->socid;
96if (!$user->hasRight(
'agenda',
'myactions',
'read')) {
99if (!$user->hasRight(
'agenda',
'allactions',
'read')) {
102if (!$user->hasRight(
'agenda',
'allactions',
'read') || $filter ==
'mine') {
103 $filtert = $user->id;
106$action =
GETPOST(
'action',
'aZ09');
108$mode =
GETPOST(
'mode',
'aZ09');
109if (empty($mode) && preg_match(
'/show_/', $action)) {
112$resourceid =
GETPOST(
"search_resourceid",
'int');
118$status = GETPOSTISSET(
"search_status") ?
GETPOST(
"search_status",
'aZ09') :
GETPOST(
"status",
'aZ09');
119$type = GETPOSTISSET(
"search_type") ?
GETPOST(
"search_type",
'aZ09') :
GETPOST(
"type",
'aZ09');
121$optioncss =
GETPOST(
'optioncss',
'aZ');
124if ($dateselect > 0) {
131if (
GETPOST(
'search_actioncode',
'array:aZ09')) {
132 $actioncode =
GETPOST(
'search_actioncode',
'array:aZ09', 3);
133 if (!count($actioncode)) {
137 $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')));
139if (is_scalar($actioncode) && $actioncode ==
'-1') {
143if ($status ==
'' && !GETPOSTISSET(
'search_status')) {
144 $status = ((!
getDolGlobalString(
'AGENDA_DEFAULT_FILTER_STATUS') || $disabledefaultvalues) ?
'' : $conf->global->AGENDA_DEFAULT_FILTER_STATUS);
149if (empty($mode) && !GETPOSTISSET(
'mode')) {
150 $mode = $defaultview;
152if ($mode ==
'default') {
153 $mode = (($defaultview !=
'show_list') ? $defaultview :
'show_month');
156 $mode =
'show_month';
161 $week = ($week ? $week : date(
"W"));
162 $day = ($day ? $day : date(
"d"));
166 $day = ($day ? $day : date(
"d"));
172$langs->loadLangs(array(
'agenda',
'other',
'commercial'));
175$hookmanager->initHooks(array(
'agenda'));
177$result =
restrictedArea($user,
'agenda', 0,
'actioncomm&societe',
'myactions|allactions',
'fk_soc',
'id');
178if ($user->socid && $socid) {
187if (
GETPOST(
"viewlist",
'alpha') || $mode ==
'show_list') {
189 if (is_array($_POST)) {
190 foreach ($_POST as $key => $val) {
191 if ($key ==
'token') {
194 $param .=
'&'.$key.
'='.urlencode($val);
197 if (!preg_match(
'/action=/', $param)) {
198 $param .= ($param ?
'&' :
'').
'mode=show_list';
201 header(
"Location: ".DOL_URL_ROOT.
'/comm/action/list.php?'.$param);
205if (
GETPOST(
"viewperuser",
'alpha') || $mode ==
'show_peruser') {
207 if (is_array($_POST)) {
208 foreach ($_POST as $key => $val) {
209 if ($key ==
'token') {
212 $param .=
'&'.$key.
'='.urlencode($val);
216 header(
"Location: ".DOL_URL_ROOT.
'/comm/action/peruser.php?'.$param);
232 'maxprint' => $maxprint,
234 'filtert' => $filtert,
235 'showbirthday' => $showbirthday,
236 'canedit' => $canedit,
237 'optioncss' => $optioncss,
238 'actioncode' => $actioncode,
240 'resourceid' => $resourceid,
241 'usergroup' => $usergroup,
243$reshook = $hookmanager->executeHooks(
'beforeAgenda', $parameters, $object, $action);
248$help_url =
'EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda|DE:Modul_Terminplanung';
249llxHeader(
'', $langs->trans(
"Agenda"), $help_url);
251$form =
new Form($db);
252$companystatic =
new Societe($db);
253$contactstatic =
new Contact($db);
254$userstatic =
new User($db);
258$nowyear = $nowarray[
'year'];
259$nowmonth = $nowarray[
'mon'];
260$nowday = $nowarray[
'mday'];
262$listofextcals = array();
267 while ($i < $MAXAGENDA) {
269 $source =
'AGENDA_EXT_SRC'.$i;
270 $name =
'AGENDA_EXT_NAME'.$i;
271 $offsettz =
'AGENDA_EXT_OFFSETTZ'.$i;
272 $color =
'AGENDA_EXT_COLOR'.$i;
273 $default =
'AGENDA_EXT_ACTIVEBYDEFAULT'.$i;
274 $buggedfile =
'AGENDA_EXT_BUGGEDFILE'.$i;
277 $listofextcals[] = array(
278 'type' =>
'globalsetup',
294 while ($i < $MAXAGENDA) {
296 $source =
'AGENDA_EXT_SRC_'.$user->id.
'_'.$i;
297 $name =
'AGENDA_EXT_NAME_'.$user->id.
'_'.$i;
298 $offsettz =
'AGENDA_EXT_OFFSETTZ_'.$user->id.
'_'.$i;
299 $color =
'AGENDA_EXT_COLOR_'.$user->id.
'_'.$i;
300 $enabled =
'AGENDA_EXT_ENABLED_'.$user->id.
'_'.$i;
301 $default =
'AGENDA_EXT_ACTIVEBYDEFAULT_'.$user->id.
'_'.$i;
302 $buggedfile =
'AGENDA_EXT_BUGGEDFILE_'.$user->id.
'_'.$i;
306 $listofextcals[] = array(
307 'type' =>
'usersetup',
310 'offsettz' => (
int) (empty($user->conf->$offsettz) ? 0 : $user->
conf->$offsettz),
320$max_day_in_month = 0;
331$max_day_in_prev_month = 0;
335if (empty($mode) || $mode ==
'show_month') {
337 $prev_year = $prev[
'year'];
338 $prev_month = $prev[
'month'];
340 $next_year = $next[
'year'];
341 $next_month = $next[
'month'];
343 $max_day_in_prev_month = (int) date(
"t",
dol_mktime(12, 0, 0, $prev_month, 1, $prev_year,
'gmt'));
344 $max_day_in_month = (int) date(
"t",
dol_mktime(12, 0, 0, $month, 1, $year,
'gmt'));
346 $tmpday = - (int) date(
"w",
dol_mktime(12, 0, 0, $month, 1, $year,
'gmt')) + 2;
347 $tmpday += ((isset($conf->global->MAIN_START_WEEK) ? $conf->global->MAIN_START_WEEK : 1) - 1);
352 $firstdaytoshow =
dol_mktime(0, 0, 0, $prev_month, $max_day_in_prev_month + $tmpday, $prev_year,
'tzuserrel');
353 $next_day = 7 - ($max_day_in_month + 1 - $tmpday) % 7;
357 $lastdaytoshow =
dol_mktime(0, 0, 0, $next_month, $next_day, $next_year,
'tzuserrel');
359if ($mode ==
'show_week') {
361 $prev_year = $prev[
'prev_year'];
362 $prev_month = $prev[
'prev_month'];
363 $prev_day = $prev[
'prev_day'];
364 $first_day = $prev[
'first_day'];
365 $first_month = $prev[
'first_month'];
366 $first_year = $prev[
'first_year'];
368 $week = $prev[
'week'];
372 $next_year = $next[
'year'];
373 $next_month = $next[
'month'];
374 $next_day = $next[
'day'];
377 $firstdaytoshow =
dol_mktime(0, 0, 0, $first_month, $first_day, $first_year,
'tzuserrel');
380 $max_day_in_month = date(
"t",
dol_mktime(0, 0, 0, $month, 1, $year,
'gmt'));
382 $tmpday = $first_day;
384if ($mode ==
'show_day') {
386 $prev_year = $prev[
'year'];
387 $prev_month = $prev[
'month'];
388 $prev_day = $prev[
'day'];
390 $next_year = $next[
'year'];
391 $next_month = $next[
'month'];
392 $next_day = $next[
'day'];
394 $firstdaytoshow =
dol_mktime(0, 0, 0, $prev_month, $prev_day, $prev_year,
'tzuserrel');
395 $lastdaytoshow =
dol_mktime(0, 0, 0, $next_month, $next_day, $next_year,
'tzuserrel');
407if ($actioncode || GETPOSTISSET(
'search_actioncode')) {
408 if (is_array($actioncode)) {
409 foreach ($actioncode as $str_action) {
410 $param .=
"&search_actioncode[]=".urlencode($str_action);
413 $param .=
"&search_actioncode=".urlencode($actioncode);
416if ($resourceid > 0) {
417 $param .=
"&search_resourceid=".urlencode((
string) ($resourceid));
419if ($status || GETPOSTISSET(
'status') || GETPOSTISSET(
'search_status')) {
420 $param .=
"&search_status=".urlencode($status);
423 $param .=
"&search_filter=".urlencode($filter);
426 $param .=
"&search_filtert=".urlencode($filtert);
429 $param .=
"&search_usergroup=".urlencode((
string) ($usergroup));
432 $param .=
"&search_socid=".urlencode((
string) ($socid));
435 $param .=
"&search_showbirthday=1";
438 $param .=
"&search_projectid=".urlencode((
string) ($pid));
441 $param .=
"&search_type=".urlencode($type);
443$param .=
"&maxprint=".urlencode((
string) ($maxprint));
444if ($mode ==
'show_day' || $mode ==
'show_week' || $mode ==
'show_month') {
445 $param .=
'&mode='.urlencode($mode);
447if ($search_categ_cus != 0) {
448 $param .=
'&search_categ_cus='.urlencode((
string) ($search_categ_cus));
453$nav .=
'<div class="navselectiondate inline-block nowraponall">';
454if (empty($mode) || $mode ==
'show_month') {
455 $nav .=
"<a href=\"?year=".$prev_year.
"&month=".$prev_month.$param.
"\"><i class=\"fa fa-chevron-left\"></i></a> \n";
456 $nav .=
" <span id=\"month_name\">".dol_print_date(
dol_mktime(0, 0, 0, $month, 1, $year),
"%b %Y");
457 $nav .=
" </span>\n";
458 $nav .=
" <a href=\"?year=".$next_year.
"&month=".$next_month.$param.
"\"><i class=\"fa fa-chevron-right\"></i></a>\n";
461if ($mode ==
'show_week') {
462 $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";
463 $nav .=
" <span id=\"month_name\">".dol_print_date(
dol_mktime(0, 0, 0, $first_month, $first_day, $first_year),
"%Y").
", ".$langs->trans(
"WeekShort").
" ".$week;
464 $nav .=
" </span>\n";
465 $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";
466 $picto =
'calendarweek';
468if ($mode ==
'show_day') {
469 $nav .=
"<a href=\"?year=".$prev_year.
"&month=".$prev_month.
"&day=".$prev_day.$param.
"\"><i class=\"fa fa-chevron-left\"></i></a> \n";
470 $nav .=
" <span id=\"month_name\">".dol_print_date(
dol_mktime(0, 0, 0, $month, $day, $year),
"daytextshort");
471 $nav .=
" </span>\n";
472 $nav .=
" <a href=\"?year=".$next_year.
"&month=".$next_month.
"&day=".$next_day.$param.
"\"><i class=\"fa fa-chevron-right\"></i></a>\n";
473 $picto =
'calendarday';
475if (empty($conf->dol_optimize_smallscreen)) {
476 $nav .=
' <a href="?year='.$nowyear.
'&month='.$nowmonth.
'&day='.$nowday.$param.
'" class="datenowlink">'.$langs->trans(
"Today").
'</a> ';
480$nav .= $form->selectDate($dateselect,
'dateselect', 0, 0, 1,
'', 1, 0);
482$nav .=
'<button type="submit" class="liste_titre button_search valignmiddle" name="button_search_x" value="x"><span class="fa fa-search"></span></button>';
485$paramnodate = $param;
486$param .=
'&year='.$year.
'&month='.$month.($day ?
'&day='.$day :
'');
501$paramnoaction = preg_replace(
'/mode=[a-z_]+/',
'', preg_replace(
'/action=[a-z_]+/',
'', $param));
502$paramnoactionodate = preg_replace(
'/mode=[a-z_]+/',
'', preg_replace(
'/action=[a-z_]+/',
'', $paramnodate));
506print
'<form method="POST" id="searchFormList" class="listactionsfilter" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
507if ($optioncss !=
'') {
508 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
510print
'<input type="hidden" name="token" value="'.newToken().
'">';
511print
'<input type="hidden" name="mode" value="'.$mode.
'">';
514$viewmode =
'<div class="navmode inline-block">';
516$viewmode .=
'<a class="btnTitle'.($mode ==
'list' ?
' btnTitleSelected' :
'').
' reposition" href="'.DOL_URL_ROOT.
'/comm/action/list.php?mode=show_list&restore_lastsearch_values=1'.$paramnoactionodate.
'">';
518$viewmode .=
img_picto($langs->trans(
"List"),
'object_calendarlist',
'class="imgforviewmode pictoactionview block"');
520$viewmode .=
'<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone inline-block width75 divoverflow">'.$langs->trans(
"ViewList").
'</span></a>';
522$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.
'">';
524$viewmode .=
img_picto($langs->trans(
"ViewCal"),
'object_calendarmonth',
'class="pictoactionview block"');
526$viewmode .=
'<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone inline-block width75 divoverflow">'.$langs->trans(
"ViewCal").
'</span></a>';
528$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.
'">';
530$viewmode .=
img_picto($langs->trans(
"ViewWeek"),
'object_calendarweek',
'class="pictoactionview block"');
532$viewmode .=
'<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone inline-block width75 divoverflow">'.$langs->trans(
"ViewWeek").
'</span></a>';
534$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.
'">';
536$viewmode .=
img_picto($langs->trans(
"ViewDay"),
'object_calendarday',
'class="pictoactionview block"');
538$viewmode .=
'<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone inline-block width75 divoverflow">'.$langs->trans(
"ViewDay").
'</span></a>';
540$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.
'">';
542$viewmode .=
img_picto($langs->trans(
"ViewPerUser"),
'object_calendarperuser',
'class="pictoactionview block"');
544$viewmode .=
'<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone inline-block width75 divoverflow" title="'.dolPrintHTML($langs->trans(
"ViewPerUser")).
'">'.$langs->trans(
"ViewPerUser").
'</span></a>';
547$parameters = array();
549$reshook = $hookmanager->executeHooks(
'addCalendarView', $parameters, $object, $action);
550if (empty($reshook)) {
551 $viewmode .= $hookmanager->resPrint;
552} elseif ($reshook > 1) {
553 $viewmode = $hookmanager->resPrint;
556$viewmode .=
'</div>';
558$viewmode .=
'<span class="marginrightonly"></span>';
563if ($user->hasRight(
'agenda',
'myactions',
'create') || $user->hasRight(
'agenda',
'allactions',
'create')) {
566 $newparam .=
'&month='.((int) $month).
'&year='.((int) $tmpforcreatebutton[
'year']).
'&mode='.urlencode($mode);
571 $urltocreateaction = DOL_URL_ROOT.
'/comm/action/card.php?action=create';
572 $urltocreateaction .=
'&apyear='.$tmpforcreatebutton[
'year'].
'&apmonth='.$tmpforcreatebutton[
'mon'].
'&apday='.$tmpforcreatebutton[
'mday'].
'&aphour='.$tmpforcreatebutton[
'hours'].
'&apmin='.$tmpforcreatebutton[
'minutes'];
573 $urltocreateaction .=
'&backtopage='.urlencode($_SERVER[
"PHP_SELF"].($newparam ?
'?'.$newparam :
''));
575 $newcardbutton .=
dolGetButtonTitle($langs->trans(
"AddAction"),
'',
'fa fa-plus-circle', $urltocreateaction);
583$showextcals = $listofextcals;
584$bookcalcalendars = array();
587if (isModEnabled(
"bookcal")) {
588 $sql =
"SELECT ba.rowid, bc.label, bc.ref, bc.rowid as id_cal";
589 $sql .=
" FROM ".MAIN_DB_PREFIX.
"bookcal_availabilities as ba";
590 $sql .=
" JOIN ".MAIN_DB_PREFIX.
"bookcal_calendar as bc";
591 $sql .=
" ON bc.rowid = ba.fk_bookcal_calendar";
592 $sql .=
" WHERE bc.status = 1";
593 $sql .=
" AND ba.status = 1";
594 if (!empty($filtert) && $filtert != -1) {
595 $sql .=
" AND bc.visibility = ".(int) $filtert ;
597 $resql = $db->query($sql);
599 $num = $db->num_rows($resql);
602 $objp = $db->fetch_object($resql);
603 $label = !empty($objp->label) ? $objp->label : $objp->ref;
604 $bookcalcalendars[
"calendars"][] = array(
"id" => $objp->id_cal,
"label" => $label);
605 $bookcalcalendars[
"availabilitieslink"][$objp->rowid] = $objp->id_cal;
613if (!empty($conf->use_javascript_ajax)) {
614 $s .=
"\n".
'<!-- Div to calendars selectors -->'.
"\n";
616 $s .=
'<script type="text/javascript">'.
"\n";
617 $s .=
'jQuery(document).ready(function () {'.
"\n";
618 $s .=
'jQuery(".check_birthday").click(function() { console.log("Toggle birthdays"); jQuery(".family_birthday").toggle(); });'.
"\n";
619 $s .=
'jQuery(".check_holiday").click(function() { console.log("Toggle holidays"); jQuery(".family_holiday").toggle(); });'.
"\n";
620 if (isModEnabled(
"bookcal") && !empty($bookcalcalendars[
"calendars"])) {
621 foreach ($bookcalcalendars[
"calendars"] as $key => $value) {
622 $s .=
'jQuery(".check_bookcal_calendar_'.$value[
'id'].
'").click(function() { console.log("Toggle Bookcal Calendar '.$value[
'id'].
'"); jQuery(".family_bookcal_calendar_'.$value[
'id'].
'").toggle(); });'.
"\n";
625 if ($mode ==
"show_week" || $mode ==
"show_month" || empty($mode)) {
627 $s .=
'jQuery( "div.sortable" ).sortable({connectWith: ".sortable", placeholder: "ui-state-highlight", items: "div.movable", receive: function( event, ui ) {'.
"\n";
629 $s .=
'console.log("submit form to record new event");'.
"\n";
631 $s .=
'var newval = jQuery(event.target).closest("div.dayevent").attr("id");'.
"\n";
632 $s .=
'console.log("found parent div.dayevent with id = "+newval);'.
"\n";
633 $s .=
'var frm=jQuery("#searchFormList");'.
"\n";
634 $s .=
'var newurl = ui.item.find("a.cal_event").attr("href");'.
"\n";
635 $s .=
'console.log("Found url on href of a.cal_event"+newurl+", we submit form with actionmove=mupdate");'.
"\n";
636 $s .=
'frm.attr("action", newurl).children("#newdate").val(newval);frm.submit();}'.
"\n";
640 $s .=
'</script>'.
"\n";
643 $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>';
646 if ($user->hasRight(
"holiday",
"read")) {
648 <div class="nowrap inline-block minheight30"><input type="checkbox" id="check_holiday" name="check_holiday" value="1" class="check_holiday"' . ($check_holiday
649 ?
' checked' :
'') .
'>
650 <label for="check_holiday" class="labelcalendar">
651 <span class="check_holiday_text">' . $langs->trans(
"Holidays") .
'</span>
657 if (is_array($showextcals) && count($showextcals) > 0) {
658 $s .=
'<script type="text/javascript">'.
"\n";
659 $s .=
'jQuery(document).ready(function () {
660 jQuery("div input[name^=\"check_ext\"]").each(function(index, elem) {
661 var name = jQuery(elem).attr("name");
662 if (jQuery(elem).is(":checked")) {
663 jQuery(".family_ext" + name.replace("check_ext", "")).show();
665 jQuery(".family_ext" + name.replace("check_ext", "")).hide();
669 jQuery("div input[name^=\"check_ext\"]").click(function() {
670 var name = $(this).attr("name");
671 jQuery(".family_ext" + name.replace("check_ext", "")).toggle();
674 $s .=
'</script>'.
"\n";
676 foreach ($showextcals as $val) {
677 $htmlname = md5($val[
'name']);
679 if (!empty($val[
'default']) ||
GETPOSTINT(
'check_ext'.$htmlname)) {
680 $default =
"checked";
685 $tooltip = $langs->trans(
"Cache").
' '.round($DELAYFORCACHE / 60).
'mn';
687 $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>';
692 $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>';
695 if (isModEnabled(
"bookcal")) {
696 if (!empty($bookcalcalendars[
"calendars"])) {
697 foreach ($bookcalcalendars[
"calendars"] as $key => $value) {
698 $label = $value[
'label'];
699 $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>';
705 $parameters = array();
706 $reshook = $hookmanager->executeHooks(
'addCalendarChoice', $parameters, $object, $action);
707 if (empty($reshook)) {
708 $s .= $hookmanager->resPrint;
709 } elseif ($reshook > 1) {
710 $s = $hookmanager->resPrint;
713 $s .=
"\n".
'<!-- End div to calendars selectors -->'.
"\n";
716 $newparam = preg_replace(
'/showbirthday=[0-1]/i',
'showbirthday='.(empty($showbirthday) ? 1 : 0), $newparam);
717 if (!preg_match(
'/showbirthday=/i', $newparam)) {
718 $newparam .=
'&showbirthday=1';
722 if (empty($showbirthday)) {
723 $link .= $langs->trans(
"AgendaShowBirthdayEvents");
725 $link .= $langs->trans(
"AgendaHideBirthdayEvents");
732$eventarray = array();
740$sql .=
' a.id, a.label,';
743$sql .=
' a.percent,';
744$sql .=
' a.fk_user_author,a.fk_user_action,';
745$sql .=
' a.transparency, a.priority, a.fulldayevent, a.location,';
746$sql .=
' a.fk_soc, a.fk_contact, a.fk_project, a.fk_bookcal_calendar,';
747$sql .=
' a.fk_element, a.elementtype,';
748$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';
750$parameters = array();
751$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters);
752$sql .= $hookmanager->resPrint;
754$sql .=
' FROM '.MAIN_DB_PREFIX.
'c_actioncomm as ca, '.MAIN_DB_PREFIX.
"actioncomm as a";
756if ($resourceid > 0) {
757 $sql .=
", ".MAIN_DB_PREFIX.
"element_resources as r";
760if ($filtert > 0 || $usergroup > 0) {
761 $sql .=
", ".MAIN_DB_PREFIX.
"actioncomm_resources as ar";
764 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"usergroup_user as ugu ON ugu.fk_user = ar.fk_element";
766$sql .=
' WHERE a.fk_action = ca.id';
767$sql .=
' AND a.entity IN ('.getEntity(
'agenda').
')';
769if (!empty($actioncode)) {
771 if ($actioncode ==
'AC_NON_AUTO') {
772 $sql .=
" AND ca.type != 'systemauto'";
773 } elseif ($actioncode ==
'AC_ALL_AUTO') {
774 $sql .=
" AND ca.type = 'systemauto'";
776 if ($actioncode ==
'AC_OTH') {
777 $sql .=
" AND ca.type != 'systemauto'";
779 if ($actioncode ==
'AC_OTH_AUTO') {
780 $sql .=
" AND ca.type = 'systemauto'";
784 if ($actioncode ==
'AC_NON_AUTO') {
785 $sql .=
" AND ca.type != 'systemauto'";
786 } elseif ($actioncode ==
'AC_ALL_AUTO') {
787 $sql .=
" AND ca.type = 'systemauto'";
789 if (is_array($actioncode)) {
790 $sql .=
" AND ca.code IN (".$db->sanitize(
"'".implode(
"','", $actioncode).
"'", 1).
")";
792 $sql .=
" AND ca.code IN (".$db->sanitize(
"'".implode(
"','", explode(
',', $actioncode)).
"'", 1).
")";
797if ($resourceid > 0) {
798 $sql .=
" AND r.element_type = 'action' AND r.element_id = a.id AND r.resource_id = ".((int) $resourceid);
801 $sql .=
" AND a.fk_project=".((int) $pid);
805if (isModEnabled(
"societe") && !$user->hasRight(
'societe',
'client',
'voir')) {
806 $search_sale = $user->id;
809if ($search_sale && $search_sale !=
'-1') {
810 if ($search_sale == -2) {
811 $sql .=
" AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = a.fk_soc)";
812 } elseif ($search_sale > 0) {
813 $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).
")";
818 $sql .=
" AND a.fk_soc = ".((int) $socid);
821if ($filtert > 0 || $usergroup > 0) {
822 $sql .=
" AND ar.fk_actioncomm = a.id AND ar.element_type='user'";
825if ($mode ==
'show_day') {
827 $sql .=
" (a.datep BETWEEN '".$db->idate(
dol_mktime(0, 0, 0, $month, $day, $year,
'tzuserrel')).
"'";
828 $sql .=
" AND '".$db->idate(
dol_mktime(23, 59, 59, $month, $day, $year,
'tzuserrel')).
"')";
830 $sql .=
" (a.datep2 BETWEEN '".$db->idate(
dol_mktime(0, 0, 0, $month, $day, $year,
'tzuserrel')).
"'";
831 $sql .=
" AND '".$db->idate(
dol_mktime(23, 59, 59, $month, $day, $year,
'tzuserrel')).
"')";
833 $sql .=
" (a.datep < '".$db->idate(
dol_mktime(0, 0, 0, $month, $day, $year,
'tzuserrel')).
"'";
834 $sql .=
" AND a.datep2 > '".$db->idate(
dol_mktime(23, 59, 59, $month, $day, $year,
'tzuserrel')).
"')";
839 $sql .=
" (a.datep BETWEEN '".$db->idate(
dol_mktime(0, 0, 0, $month, 1, $year) - (60 * 60 * 24 * 7)).
"'";
840 $sql .=
" AND '".$db->idate(
dol_mktime(23, 59, 59, $month, 28, $year) + (60 * 60 * 24 * 10)).
"')";
842 $sql .=
" (a.datep2 BETWEEN '".$db->idate(
dol_mktime(0, 0, 0, $month, 1, $year) - (60 * 60 * 24 * 7)).
"'";
843 $sql .=
" AND '".$db->idate(
dol_mktime(23, 59, 59, $month, 28, $year) + (60 * 60 * 24 * 10)).
"')";
845 $sql .=
" (a.datep < '".$db->idate(
dol_mktime(0, 0, 0, $month, 1, $year) - (60 * 60 * 24 * 7)).
"'";
846 $sql .=
" AND a.datep2 > '".$db->idate(
dol_mktime(23, 59, 59, $month, 28, $year) + (60 * 60 * 24 * 10)).
"')";
850 $sql .=
" AND ca.id = ".((int) $type);
854 $sql .=
" AND a.percent = 0";
856if ($status ==
'na') {
858 $sql .=
" AND a.percent = -1";
860if ($status ==
'50') {
862 $sql .=
" AND (a.percent > 0 AND a.percent < 100)";
864if ($status ==
'done' || $status ==
'100') {
865 $sql .=
" AND (a.percent = 100)";
867if ($status ==
'todo') {
868 $sql .=
" AND (a.percent >= 0 AND a.percent < 100)";
871if ($filtert > 0 || $usergroup > 0) {
874 $sql .=
"ar.fk_element = ".((int) $filtert);
876 if ($usergroup > 0) {
877 $sql .= ($filtert > 0 ?
" OR " :
"").
" ugu.fk_usergroup = ".((
int) $usergroup);
883if ($search_categ_cus != -1) {
884 if ($search_categ_cus == -2) {
885 $sql .=
" AND NOT EXISTS (SELECT ca.fk_actioncomm FROM ".MAIN_DB_PREFIX.
"categorie_actioncomm as ca WHERE ca.fk_actioncomm = a.id)";
886 } elseif ($search_categ_cus > 0) {
887 $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).
"))";
892$sql .=
' ORDER BY datep';
895dol_syslog(
"comm/action/index.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);
906 if (
getDolGlobalString(
'AGENDA_ALWAYS_HIDE_AUTO') && $obj->type_code ==
'AC_OTH_AUTO') {
914 $event->id = $obj->id;
915 $event->ref = $event->id;
917 $event->fulldayevent = $obj->fulldayevent;
920 if ($event->fulldayevent) {
922 $event->datep = $db->jdate($obj->datep, $tzforfullday ?
'tzuser' :
'tzserver');
923 $event->datef = $db->jdate($obj->datep2, $tzforfullday ?
'tzuser' :
'tzserver');
926 $event->datep = $db->jdate($obj->datep,
'tzserver');
927 $event->datef = $db->jdate($obj->datep2,
'tzserver');
933 $event->type_code = $obj->type_code;
934 $event->type_label = $obj->type_label;
935 $event->type_color = $obj->type_color;
936 $event->type = $obj->type_type;
937 $event->type_picto = $obj->type_picto;
939 $event->label = $obj->label;
940 $event->percentage = $obj->percent;
942 $event->authorid = $obj->fk_user_author;
943 $event->userownerid = $obj->fk_user_action;
944 $event->fetch_userassigned();
946 $event->priority = $obj->priority;
947 $event->location = $obj->location;
948 $event->transparency = $obj->transparency;
949 $event->fk_element = $obj->fk_element;
950 $event->elementid = $obj->fk_element;
951 $event->elementtype = $obj->elementtype;
953 $event->fk_project = $obj->fk_project;
955 $event->socid = $obj->fk_soc;
956 $event->contact_id = $obj->fk_contact;
957 $event->fk_bookcal_calendar = $obj->fk_bookcal_calendar;
958 if (!empty($event->fk_bookcal_calendar)) {
959 $event->type =
"bookcal_calendar";
964 $event->date_start_in_calendar = $event->datep;
965 if ($event->datef !=
'' && $event->datef >= $event->datep) {
966 $event->date_end_in_calendar = $event->datef;
968 $event->date_end_in_calendar = $event->datep;
972 if ($event->date_end_in_calendar < $firstdaytoshow || $event->date_start_in_calendar >= $lastdaytoshow) {
975 if ($event->date_start_in_calendar < $firstdaytoshow) {
976 $event->date_start_in_calendar = $firstdaytoshow;
978 if ($event->date_end_in_calendar >= $lastdaytoshow) {
979 $event->date_end_in_calendar = ($lastdaytoshow - 1);
983 $daycursor = $event->date_start_in_calendar;
988 $daycursorend = $event->date_end_in_calendar;
989 $anneeend = (int)
dol_print_date($daycursorend,
'%Y',
'tzuserrel');
990 $moisend = (int)
dol_print_date($daycursorend,
'%m',
'tzuserrel');
991 $jourend = (int)
dol_print_date($daycursorend,
'%d',
'tzuserrel');
1000 $daykey =
dol_mktime(0, 0, 0, $mois, $jour, $annee,
'gmt');
1001 $daykeyend =
dol_mktime(0, 0, 0, $moisend, $jourend, $anneeend,
'gmt');
1015 $eventarray[$daykey][] = $event;
1018 $daykey += 60 * 60 * 24;
1020 if ($daykey > $daykeyend) {
1029 $parameters[
'obj'] = $obj;
1030 $reshook = $hookmanager->executeHooks(
'hookEventElements', $parameters, $event, $action);
1031 $event = $hookmanager->resPrint;
1048 $sql =
'SELECT sp.rowid, sp.lastname, sp.firstname, sp.birthday';
1049 $sql .=
' FROM '.MAIN_DB_PREFIX.
'socpeople as sp';
1050 $sql .=
' WHERE (priv=0 OR (priv=1 AND fk_user_creat='.((int) $user->id).
'))';
1051 $sql .=
" AND sp.entity IN (".getEntity(
'contact').
")";
1052 if ($mode ==
'show_day') {
1053 $sql .=
' AND MONTH(birthday) = '.((int) $month);
1054 $sql .=
' AND DAY(birthday) = '.((int) $day);
1056 $sql .=
' AND MONTH(birthday) = '.((int) $month);
1058 $sql .=
' ORDER BY birthday';
1060 dol_syslog(
"comm/action/index.php", LOG_DEBUG);
1061 $resql = $db->query($sql);
1063 $num = $db->num_rows($resql);
1066 $obj = $db->fetch_object($resql);
1070 $event->id = $obj->rowid;
1071 $event->ref = $event->id;
1076 $event->datep =
dol_mktime(0, 0, 0, $datearray[
'mon'], $datearray[
'mday'], $year,
true);
1077 $event->datef = $event->datep;
1079 $event->type_code =
'BIRTHDAY';
1080 $event->type_label =
'';
1081 $event->type_color =
'';
1082 $event->type =
'birthdate';
1083 $event->type_picto =
'birthdate';
1085 $event->label = $langs->trans(
"Birthday").
' '.
dolGetFirstLastname($obj->firstname, $obj->lastname);
1086 $event->percentage = 100;
1087 $event->fulldayevent = 1;
1089 $event->contact_id = $obj->rowid;
1091 $event->date_start_in_calendar = $db->jdate($event->datep);
1092 $event->date_end_in_calendar = $db->jdate($event->datef);
1095 $daycursor = $event->datep;
1100 $daykey =
dol_mktime(0, 0, 0, $mois, $jour, $annee,
'gmt');
1102 $eventarray[$daykey][] = $event;
1119if ($user->hasRight(
"holiday",
"read")) {
1121 $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";
1122 $sql .=
" FROM ".MAIN_DB_PREFIX.
"holiday as x, ".MAIN_DB_PREFIX.
"user as u";
1123 $sql .=
" WHERE u.rowid = x.fk_user";
1124 $sql .=
" AND u.statut = '1'";
1125 $sql .=
" AND (x.statut = '2' OR x.statut = '3')";
1127 if ($mode ==
'show_day') {
1129 $sql .=
" AND '".$db->escape($year).
"-".$db->escape($month).
"-".$db->escape($day).
"' BETWEEN x.date_debut AND x.date_fin";
1130 } elseif ($mode ==
'show_week') {
1132 $sql .=
" AND date_debut < '".$db->idate(
dol_get_last_day($year, $month)).
"'";
1134 } elseif ($mode ==
'show_month') {
1136 $sql .=
" AND date_debut <= '".$db->idate(
dol_get_last_day($year, $month)).
"'";
1140 $resql = $db->query($sql);
1142 $num = $db->num_rows($resql);
1146 $obj = $db->fetch_object($resql);
1151 $event->id = $obj->rowid;
1152 $event->ref = $event->id;
1154 $event->type_code =
'HOLIDAY';
1155 $event->type_label =
'';
1156 $event->type_color =
'';
1157 $event->type =
'holiday';
1158 $event->type_picto =
'holiday';
1160 $event->datep = $db->jdate($obj->date_start) + (empty($halfday) || $halfday == 1 ? 0 : 12 * 60 * 60 - 1);
1161 $event->datef = $db->jdate($obj->date_end) + (empty($halfday) || $halfday == -1 ? 24 : 12) * 60 * 60 - 1;
1162 $event->date_start_in_calendar = $event->datep;
1163 $event->date_end_in_calendar = $event->datef;
1165 if ($obj->status == 3) {
1167 $event->percentage = -1;
1168 } elseif ($obj->status == 2) {
1170 $event->percentage = 0;
1173 if ($obj->halfday == 1) {
1174 $event->label = $obj->lastname.
' ('.$langs->trans(
"Morning").
')';
1175 } elseif ($obj->halfday == -1) {
1176 $event->label = $obj->lastname.
' ('.$langs->trans(
"Afternoon").
')';
1178 $event->label = $obj->lastname;
1181 $daycursor = $event->date_start_in_calendar;
1186 $daykey =
dol_mktime(0, 0, 0, $mois, $jour, $annee,
'gmt');
1188 $eventarray[$daykey][] = $event;
1190 $daykey += 60 * 60 * 24;
1191 }
while ($daykey <= $event->date_end_in_calendar);
1200if (count($listofextcals)) {
1201 require_once DOL_DOCUMENT_ROOT.
'/comm/action/class/ical.class.php';
1203 foreach ($listofextcals as $key => $extcal) {
1204 $url = $extcal[
'src'];
1205 $namecal = $extcal[
'name'];
1206 $offsettz = $extcal[
'offsettz'];
1207 $colorcal = $extcal[
'color'];
1208 $buggedfile = $extcal[
'buggedfile'];
1214 $ical->parse($url, $pathforcachefile, $DELAYFORCACHE);
1217 $listofextcals[$key][
'error'] = $ical->error;
1218 $s .=
'<br><div class="warning">'.dol_escape_htmltag($listofextcals[$key][
'name']).
': '.$url.
'<br>Error message: '.
dol_escape_htmltag($ical->error).
'</div>';
1223 $icalevents = array();
1224 if (is_array($ical->get_event_list())) {
1225 $icalevents = array_merge($icalevents, $ical->get_event_list());
1227 if (is_array($ical->get_freebusy_list())) {
1228 $icalevents = array_merge($icalevents, $ical->get_freebusy_list());
1231 if (count($icalevents) > 0) {
1233 $moreicalevents = array();
1234 foreach ($icalevents as $icalevent) {
1235 if (isset($icalevent[
'RRULE']) && is_array($icalevent[
'RRULE'])) {
1238 if ($icalevent[
'DTSTART;VALUE=DATE']) {
1241 } elseif (is_array($icalevent[
'DTSTART']) && !empty($icalevent[
'DTSTART'][
'unixtime'])) {
1242 $datecurstart = $icalevent[
'DTSTART'][
'unixtime'];
1243 $datecurend = $icalevent[
'DTEND'][
'unixtime'];
1244 if (!empty($ical->cal[
'DAYLIGHT'][
'DTSTART']) && $datecurstart) {
1246 $tmpcurstart = $datecurstart;
1247 $tmpcurend = $datecurend;
1248 $tmpdaylightstart =
dol_mktime(0, 0, 0, 1, 1, 1970, 1) + (int) $ical->cal[
'DAYLIGHT'][
'DTSTART'];
1249 $tmpdaylightend =
dol_mktime(0, 0, 0, 1, 1, 1970, 1) + (int) $ical->cal[
'STANDARD'][
'DTSTART'];
1252 if ($tmpcurstart >= $tmpdaylightstart && $tmpcurstart < $tmpdaylightend) {
1253 $datecurstart -= ((int) $ical->cal[
'DAYLIGHT'][
'TZOFFSETTO']) * 36;
1255 $datecurstart -= ((int) $ical->cal[
'STANDARD'][
'TZOFFSETTO']) * 36;
1257 if ($tmpcurend >= $tmpdaylightstart && $tmpcurstart < $tmpdaylightend) {
1258 $datecurend -= ((int) $ical->cal[
'DAYLIGHT'][
'TZOFFSETTO']) * 36;
1260 $datecurend -= ((int) $ical->cal[
'STANDARD'][
'TZOFFSETTO']) * 36;
1267 dol_syslog(
"Found a not recognized repeatable record with unknown date start", LOG_ERR);
1272 $interval = (empty($icalevent[
'RRULE'][
'INTERVAL']) ? 1 : $icalevent[
'RRULE'][
'INTERVAL']);
1273 $until = empty($icalevent[
'RRULE'][
'UNTIL']) ? 0 :
dol_stringtotime($icalevent[
'RRULE'][
'UNTIL'], 1);
1274 $maxrepeat = empty($icalevent[
'RRULE'][
'COUNT']) ? 0 : $icalevent[
'RRULE'][
'COUNT'];
1275 if ($until && ($until + ($datecurend - $datecurstart)) < $firstdaytoshow) {
1278 if ($datecurstart >= $lastdaytoshow) {
1283 while (($datecurstart < $lastdaytoshow) && (empty($maxrepeat) || ($numofevent < $maxrepeat))) {
1284 if ($datecurend >= $firstdaytoshow) {
1285 $newevent = $icalevent;
1286 unset($newevent[
'RRULE']);
1287 if ($icalevent[
'DTSTART;VALUE=DATE']) {
1288 $newevent[
'DTSTART;VALUE=DATE'] =
dol_print_date($datecurstart,
'%Y%m%d');
1289 $newevent[
'DTEND;VALUE=DATE'] =
dol_print_date($datecurend + 1,
'%Y%m%d');
1291 $newevent[
'DTSTART'] = $datecurstart;
1292 $newevent[
'DTEND'] = $datecurend;
1294 $moreicalevents[] = $newevent;
1298 $savdatecurstart = $datecurstart;
1299 if ($icalevent[
'RRULE'][
'FREQ'] ==
'DAILY') {
1303 if ($icalevent[
'RRULE'][
'FREQ'] ==
'WEEKLY') {
1306 } elseif ($icalevent[
'RRULE'][
'FREQ'] ==
'MONTHLY') {
1309 } elseif ($icalevent[
'RRULE'][
'FREQ'] ==
'YEARLY') {
1314 if ($savdatecurstart >= $datecurstart) {
1315 dol_syslog(
"Found a rule freq ".$icalevent[
'RRULE'][
'FREQ'].
" not managed by dolibarr code. Assume 1 week frequency.", LOG_ERR);
1316 $datecurstart += 3600 * 24 * 7;
1317 $datecurend += 3600 * 24 * 7;
1322 $icalevents = array_merge($icalevents, $moreicalevents);
1325 foreach ($icalevents as $icalevent) {
1330 if (!empty($icalevent[
'RRULE'])) {
1337 if (isset($icalevent[
'DTSTART;VALUE=DATE'])) {
1340 if (empty($icalevent[
'DTEND;VALUE=DATE'])) {
1341 $dateend = $datestart + 86400 - 1;
1347 $event->fulldayevent = 1;
1349 } elseif (!is_array($icalevent[
'DTSTART'])) {
1350 $datestart = $icalevent[
'DTSTART'];
1351 $dateend = empty($icalevent[
'DTEND']) ? $datestart : $icalevent[
'DTEND'];
1353 $datestart += +($offsettz * 3600);
1354 $dateend += +($offsettz * 3600);
1359 } elseif (isset($icalevent[
'DTSTART'][
'unixtime'])) {
1360 $datestart = $icalevent[
'DTSTART'][
'unixtime'];
1361 $dateend = $icalevent[
'DTEND'][
'unixtime'];
1363 $datestart += +($offsettz * 3600);
1364 $dateend += +($offsettz * 3600);
1367 if ($buggedfile ===
'uselocalandtznodaylight') {
1371 if ($buggedfile ===
'uselocalandtzdaylight') {
1372 $localtzs =
new DateTimeZone(preg_replace(
'/"/',
'', $icalevent[
'DTSTART'][
'TZID']));
1373 $localtze =
new DateTimeZone(preg_replace(
'/"/',
'', $icalevent[
'DTEND'][
'TZID']));
1374 $localdts =
new DateTime(
dol_print_date($datestart,
'dayrfc',
'gmt'), $localtzs);
1375 $localdte =
new DateTime(
dol_print_date($dateend,
'dayrfc',
'gmt'), $localtze);
1376 $tmps = -1 * $localtzs->getOffset($localdts);
1377 $tmpe = -1 * $localtze->getOffset($localdte);
1378 $datestart += $tmps;
1386 $event->id = $icalevent[
'UID'];
1387 $event->ref = $event->id;
1388 $userId = $userstatic->findUserIdByEmail($namecal);
1389 if (!empty($userId) && $userId > 0) {
1390 $event->userassigned[$userId] = $userId;
1391 $event->percentage = -1;
1394 $event->type_code =
"ICALEVENT";
1395 $event->type_label = $namecal;
1396 $event->type_color = $colorcal;
1397 $event->type =
'icalevent';
1398 $event->type_picto =
'rss';
1400 $event->icalname = $namecal;
1401 $event->icalcolor = $colorcal;
1403 $event->datep = $datestart + $usertime;
1404 $event->datef = $dateend + $usertime;
1406 if ($icalevent[
'SUMMARY']) {
1408 } elseif ($icalevent[
'DESCRIPTION']) {
1411 $event->label = $langs->trans(
"ExtSiteNoLabel");
1418 if (!empty($icalevent[
'PRIORITY'])) {
1419 $event->priority = $icalevent[
'PRIORITY'];
1423 if (!empty($icalevent[
'TRANSP'])) {
1424 if ($icalevent[
'TRANSP'] ==
"TRANSPARENT") {
1425 $event->transparency = 0;
1427 if ($icalevent[
'TRANSP'] ==
"OPAQUE") {
1428 $event->transparency = 1;
1439 if (!empty($icalevent[
'LOCATION'])) {
1440 $event->location = $icalevent[
'LOCATION'];
1443 $event->date_start_in_calendar = $event->datep;
1445 if ($event->datef !=
'' && $event->datef >= $event->datep) {
1446 $event->date_end_in_calendar = $event->datef;
1448 $event->date_end_in_calendar = $event->datep;
1452 if ($event->date_end_in_calendar < $firstdaytoshow || $event->date_start_in_calendar >= $lastdaytoshow) {
1458 if ($event->date_start_in_calendar < $firstdaytoshow) {
1459 $event->date_start_in_calendar = $firstdaytoshow;
1461 if ($event->date_end_in_calendar >= $lastdaytoshow) {
1462 $event->date_end_in_calendar = ($lastdaytoshow - 1);
1466 $daycursor = $event->date_start_in_calendar;
1475 $daykey =
dol_mktime(0, 0, 0, $mois, $jour, $annee,
'gmt');
1476 $daykeygmt =
dol_mktime(0, 0, 0, $mois, $jour, $annee,
'gmt');
1479 $eventarray[$daykey][] = $event;
1480 $daykey += 60 * 60 * 24;
1481 $daykeygmt += 60 * 60 * 24;
1482 if (($event->fulldayevent ? $daykeygmt : $daykey) > $event->date_end_in_calendar) {
1494$parameters = array();
1496$reshook = $hookmanager->executeHooks(
'getCalendarEvents', $parameters, $object, $action);
1497if (!empty($hookmanager->resArray[
'eventarray'])) {
1498 foreach ($hookmanager->resArray[
'eventarray'] as $keyDate => $events) {
1499 if (!isset($eventarray[$keyDate])) {
1500 $eventarray[$keyDate] = array();
1502 $eventarray[$keyDate] = array_merge($eventarray[$keyDate], $events);
1507foreach ($eventarray as $keyDate => &$dateeventarray) {
1508 usort($dateeventarray,
'sort_events_by_date');
1513$cachethirdparties = array();
1514$cachecontacts = array();
1515$cacheusers = array();
1518$color_file = DOL_DOCUMENT_ROOT.
"/theme/".$conf->theme.
"/theme_vars.inc.php";
1519if (is_readable($color_file)) {
1520 include $color_file;
1522if (!is_array($theme_datacolor)) {
1523 $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));
1526$massactionbutton =
'';
1528print_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);
1534if (empty($mode) || $mode ==
'show_month') {
1536 $newparam = preg_replace(
'/showbirthday=/i',
'showbirthday_=', $newparam);
1537 $newparam = preg_replace(
'/mode=show_month&?/i',
'', $newparam);
1538 $newparam = preg_replace(
'/mode=show_week&?/i',
'', $newparam);
1539 $newparam = preg_replace(
'/day=[0-9]+&?/i',
'', $newparam);
1540 $newparam = preg_replace(
'/month=[0-9]+&?/i',
'', $newparam);
1541 $newparam = preg_replace(
'/year=[0-9]+&?/i',
'', $newparam);
1542 $newparam = preg_replace(
'/viewcal=[0-9]+&?/i',
'', $newparam);
1543 $newparam = preg_replace(
'/showbirthday_=/i',
'showbirthday=', $newparam);
1544 $newparam .=
'&viewcal=1';
1546 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1547 print_actions_filter($form, $canedit, $status, $year, $month, $day, $showbirthday,
'', $filtert,
'', $pid, $socid, $action, -1, $actioncode, $usergroup,
'', $resourceid, $search_categ_cus);
1550 print
'<div class="div-table-responsive-no-min sectioncalendarbymonth maxscreenheightless300">';
1551 print
'<table class="centpercent noborder nocellnopadd cal_pannel cal_month listwithfilterbefore">';
1552 print
' <tr class="liste_titre">';
1554 echo
' <td class="center">#</td>';
1557 print
' <td class="center bold uppercase tdfordaytitle'.($i == 0 ?
' borderleft' :
'').
'">';
1558 $numdayinweek = (($i + (isset($conf->global->MAIN_START_WEEK) ? $conf->global->MAIN_START_WEEK : 1)) % 7);
1559 if (!empty($conf->dol_optimize_smallscreen)) {
1560 $labelshort = array(0 =>
'SundayMin', 1 =>
'MondayMin', 2 =>
'TuesdayMin', 3 =>
'WednesdayMin', 4 =>
'ThursdayMin', 5 =>
'FridayMin', 6 =>
'SaturdayMin');
1561 print $langs->trans($labelshort[$numdayinweek]);
1563 print $langs->trans(
"Day".$numdayinweek);
1565 print
' </td>'.
"\n";
1571 $todaytms =
dol_mktime(0, 0, 0, $todayarray[
'mon'], $todayarray[
'mday'], $todayarray[
'year']);
1575 for ($iter_week = 0; $iter_week < 6; $iter_week++) {
1579 $currdate0 = sprintf(
"%04d", $prev_year).sprintf(
"%02d", $prev_month).sprintf(
"%02d", $max_day_in_prev_month + $tmpday);
1580 } elseif ($tmpday <= $max_day_in_month) {
1581 $currdate0 = sprintf(
"%04d", $year).sprintf(
"%02d", $month).sprintf(
"%02d", $tmpday);
1583 $currdate0 = sprintf(
"%04d", $next_year).sprintf(
"%02d", $next_month).sprintf(
"%02d", $tmpday - $max_day_in_month);
1586 $numweek0 = date(
"W", strtotime(date($currdate0)));
1588 echo
' <td class="center weeknumber opacitymedium" width="2%">'.$numweek0.
'</td>';
1590 for ($iter_day = 0; $iter_day < 7; $iter_day++) {
1593 $style =
'cal_other_month cal_past';
1594 if ($iter_day == 6) {
1595 $style .=
' cal_other_month_right';
1597 echo
' <td class="'.$style.
' nowrap tdtop" width="14%">';
1599 show_day_events($db, $max_day_in_prev_month + $tmpday, $prev_month, $prev_year, $month, $style, $eventarray, $maxprint, $maxnbofchar, $newparam);
1601 } elseif ($tmpday <= $max_day_in_month) {
1603 $curtime =
dol_mktime(0, 0, 0, $month, $tmpday, $year);
1604 $style =
'cal_current_month';
1605 if ($iter_day == 6) {
1606 $style .=
' cal_current_month_right';
1609 if ($todayarray[
'mday'] == $tmpday && $todayarray[
'mon'] == $month && $todayarray[
'year'] == $year) {
1613 $style =
'cal_today';
1615 if ($curtime < $todaytms) {
1616 $style .=
' cal_past';
1619 echo
' <td class="'.$style.
' nowrap tdtop" width="14%">';
1621 show_day_events($db, $tmpday, $month, $year, $month, $style, $eventarray, $maxprint, $maxnbofchar, $newparam, 0, 60, 0, $bookcalcalendars);
1625 $style =
'cal_other_month';
1626 if ($iter_day == 6) {
1627 $style .=
' cal_other_month_right';
1629 echo
' <td class="'.$style.
' nowrap tdtop" width="14%">';
1631 show_day_events($db, $tmpday - $max_day_in_month, $next_month, $next_year, $month, $style, $eventarray, $maxprint, $maxnbofchar, $newparam);
1641 print
'<input type="hidden" name="actionmove" value="mupdate">';
1642 print
'<input type="hidden" name="backtopage" value="'.dol_escape_htmltag($_SERVER[
'PHP_SELF']).
'?mode=show_month&'.
dol_escape_htmltag($_SERVER[
'QUERY_STRING']).
'">';
1643 print
'<input type="hidden" name="newdate" id="newdate">';
1644} elseif ($mode ==
'show_week') {
1647 $newparam = preg_replace(
'/showbirthday=/i',
'showbirthday_=', $newparam);
1648 $newparam = preg_replace(
'/mode=show_month&?/i',
'', $newparam);
1649 $newparam = preg_replace(
'/mode=show_week&?/i',
'', $newparam);
1650 $newparam = preg_replace(
'/day=[0-9]+&?/i',
'', $newparam);
1651 $newparam = preg_replace(
'/month=[0-9]+&?/i',
'', $newparam);
1652 $newparam = preg_replace(
'/year=[0-9]+&?/i',
'', $newparam);
1653 $newparam = preg_replace(
'/viewweek=[0-9]+&?/i',
'', $newparam);
1654 $newparam = preg_replace(
'/showbirthday_=/i',
'showbirthday=', $newparam);
1655 $newparam .=
'&viewweek=1';
1657 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1658 print_actions_filter($form, $canedit, $status, $year, $month, $day, $showbirthday,
'', $filtert,
'', $pid, $socid, $action, -1, $actioncode, $usergroup,
'', $resourceid);
1661 print
'<div class="div-table-responsive-no-min sectioncalendarbyweek maxscreenheightless300">';
1662 print
'<table class="centpercent noborder nocellnopadd cal_pannel cal_month listwithfilterbefore">';
1663 print
' <tr class="liste_titre">';
1666 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";
1673 for ($iter_day = 0; $iter_day < 7; $iter_day++) {
1680 $style =
'cal_current_month';
1681 if ($iter_day == 6) {
1682 $style .=
' cal_other_month_right';
1687 if ($todayarray[
'mday'] == $tmpday && $todayarray[
'mon'] == $tmpmonth && $todayarray[
'year'] == $tmpyear) {
1691 $style =
'cal_today';
1694 echo
' <td class="'.$style.
'" width="14%" valign="top">';
1696 show_day_events($db, $tmpday, $tmpmonth, $tmpyear, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300, 0, $bookcalcalendars);
1704 echo
'<input type="hidden" name="actionmove" value="mupdate">';
1705 echo
'<input type="hidden" name="backtopage" value="'.dol_escape_htmltag($_SERVER[
'PHP_SELF']).
'?mode=show_week&'.
dol_escape_htmltag($_SERVER[
'QUERY_STRING']).
'">';
1706 echo
'<input type="hidden" name="newdate" id="newdate">';
1709 $newparam = preg_replace(
'/mode=show_month&?/i',
'', $newparam);
1710 $newparam = preg_replace(
'/mode=show_week&?/i',
'', $newparam);
1711 $newparam = preg_replace(
'/viewday=[0-9]+&?/i',
'', $newparam);
1712 $newparam .=
'&viewday=1';
1714 $style =
'cal_current_month cal_current_month_oneday';
1717 if ($todayarray[
'mday'] == $day && $todayarray[
'mon'] == $month && $todayarray[
'year'] == $year) {
1722 $timestamp =
dol_mktime(12, 0, 0, $month, $day, $year);
1725 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1726 print_actions_filter($form, $canedit, $status, $year, $month, $day, $showbirthday,
'', $filtert,
'', $pid, $socid, $action, -1, $actioncode, $usergroup,
'', $resourceid);
1729 print
'<div class="div-table-responsive-no-min sectioncalendarbyday maxscreenheightless300">';
1730 echo
'<table class="tagtable centpercent noborder nocellnopadd cal_pannel cal_month listwithfilterbefore" style="margin-bottom: 10px !important;">';
1732 echo
' <tr class="tagtr liste_titre">';
1733 echo
' <td class="tagtd center bold uppercase">'.$langs->trans(
"Day".$arraytimestamp[
'wday']).
"</td>\n";
1750 print
'<div class="div-table-responsive-no-min">';
1752 $maxheightwin = (isset($_SESSION[
"dol_screenheight"]) && $_SESSION[
"dol_screenheight"] > 500) ? ($_SESSION[
"dol_screenheight"] - 200) : 660;
1754 echo
'<div style="max-height: '.$maxheightwin.
'px;">';
1755 echo
'<div class="tagtable centpercent calendarviewcontainer">';
1760 $minhour = round((
float) $tmp[0], 0);
1761 $maxhour = round((
float) $tmp[1], 0);
1762 if ($minhour > 23) {
1768 if ($maxhour <= $minhour) {
1769 $maxhour = $minhour + 1;
1775 echo
' <div class="tagtr calendarviewcontainertr">'.
"\n";
1776 echo
' <div class="tagtd width100 tdtop">'.dol_print_date($i * 3600,
'hour',
'gmt').
'</div>';
1777 echo
' <div class="tagtd '.$style.
' tdtop"></div>'.
"\n";
1778 echo
' </div>'.
"\n";
1783 echo
'</div></div>';
1786 show_day_events($db, $day, $month, $year, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300, 1, $bookcalcalendars);
1790 print
'<div class="div-table-responsive-no-min">';
1793 show_day_events($db, $day, $month, $year, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300, 0, $bookcalcalendars);
1805print
"\n".
'</form>';
1831function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventarray, $maxprint = 0, $maxnbofchar = 16, $newparam =
'', $showinfo = 0, $minheight = 60, $nonew = 0, $bookcalcalendarsarray = array())
1833 global $user, $conf, $langs;
1834 global $action, $mode, $filter, $filtert, $status, $actioncode, $usergroup;
1835 global $theme_datacolor;
1836 global $cachethirdparties, $cachecontacts, $cacheusers, $colorindexused;
1837 global $hookmanager;
1839 '@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
1840 @phan-var-force User[] $cacheusers
1841 @phan-var-force array<int<0,3>> $colorindexused';
1843 if ($conf->use_javascript_ajax) {
1844 $conf->global->MAIN_JS_SWITCH_AGENDA = 1;
1847 $dateint = sprintf(
"%04d", $year).sprintf(
"%02d", $month).sprintf(
"%02d", $day);
1853 $curtime =
dol_mktime(0, 0, 0, $month, $day, $year);
1854 $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;
1856 if ($user->hasRight(
'agenda',
'myactions',
'create') || $user->hasRight(
'agenda',
'allactions',
'create')) {
1857 $newparam .=
'&month='.str_pad((
string) $month, 2,
"0", STR_PAD_LEFT).
'&year='.$year;
1858 $hourminsec =
'100000';
1859 $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 :
''));
1863 print
'<div id="dayevent_'.$dateint.
'" class="dayevent tagtable centpercent nobordernopadding">'.
"\n";
1866 print
'<div class="tagtr cursorpointer" onclick="window.location=\''.$urltocreate.
'\';
"><div class="nowrap tagtd
"><div class="left
inline-block
">';
1867 print '<a class="dayevent-aday
" style="color: #666
" href="'.$urltoshow.'">';
1869 print dol_print_date($curtime, 'daytextshort');
1871 print dol_print_date($curtime, '%d');
1874 print '</div><div class="nowrap floatright
inline-block marginrightonly
">';
1875 if ($user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda', 'allactions', 'create')) {
1876 print '<a class="cursoradd
" href="'.$urltocreate.'">'; // Explicit link, useful for nojs interfaces
1877 print img_picto($langs->trans("NewAction
"), 'edit_add.png');
1880 print '</div></div></div>'."\n
";
1888 // Line with td contains all div of each events
1889 print '<div class="tagtr
">';
1890 print '<div class="tagtd centpercent agendacell sortable
">';
1892 //$curtime = dol_mktime (0, 0, 0, $month, $day, $year);
1899 $numicals = array();
1900 $ymd = sprintf("%04d
", $year).sprintf("%02d
", $month).sprintf("%02d
", $day);
1902 $colorindexused[$user->id] = 0; // Color index for current user (user->id) is always 0
1903 $nextindextouse = is_array($colorindexused) ? count($colorindexused) : 0; // At first run this is 0, so fist user has 0, next 1, ...
1904 //var_dump($colorindexused);
1906 include_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php';
1907 $tmpholiday = new Holiday($db);
1909 foreach ($eventarray as $daykey => $notused) { // daykey is the 'YYYYMMDD' to show according to user
1910 $annee = (int) dol_print_date($daykey, '%Y', 'gmt'); // We use gmt because we want the value represented by string 'YYYYMMDD'
1911 $mois = (int) dol_print_date($daykey, '%m', 'gmt'); // We use gmt because we want the value represented by string 'YYYYMMDD'
1912 $jour = (int) dol_print_date($daykey, '%d', 'gmt'); // We use gmt because we want the value represented by string 'YYYYMMDD'
1914 //print 'event daykey='.$daykey.' dol_print_date(daykey)='.dol_print_date($daykey, 'dayhour', 'gmt').' jour='.$jour.' mois='.$mois.' annee='.$annee."<br>\n
";
1915 //print 'event daykey='.$daykey.' dol_print_date(daykey)='.dol_print_date($daykey, 'dayhour', 'gmt').' day='.$day.' month='.$month.' year='.$year."<br>\n
";
1917 if ($day == $jour && $month == $mois && $year == $annee) {
1918 foreach ($eventarray[$daykey] as $index => $event) {
1919 if ($i < $maxprint || $maxprint == 0 || getDolGlobalString('MAIN_JS_SWITCH_AGENDA')) {
1920 $keysofuserassigned = array_keys($event->userassigned);
1921 $ponct = ($event->date_start_in_calendar == $event->date_end_in_calendar);
1923 // Define $color (Hex string like '0088FF') and $cssclass of event
1927 if (in_array($user->id, $keysofuserassigned)) {
1928 $cssclass = 'family_mytasks';
1930 if (empty($cacheusers[$event->userownerid])) {
1931 $newuser = new User($db);
1932 $newuser->fetch($event->userownerid);
1933 $cacheusers[$event->userownerid] = $newuser;
1935 //var_dump($cacheusers[$event->userownerid]->color);
1937 // We decide to choose color of owner of event (event->userownerid is user id of owner, event->userassigned contains all users assigned to event)
1938 if (!empty($cacheusers[$event->userownerid]->color)) {
1939 $color = $cacheusers[$event->userownerid]->color;
1941 } elseif ($event->type_code == 'ICALEVENT') { // Event come from external ical file
1943 if (!empty($event->icalname)) {
1944 if (!isset($numicals[dol_string_nospecial($event->icalname)])) {
1945 $numicals[dol_string_nospecial($event->icalname)] = 0;
1947 $numicals[dol_string_nospecial($event->icalname)]++;
1950 $color = ($event->icalcolor ? $event->icalcolor : -1);
1951 $cssclass = (!empty($event->icalname) ? 'family_ext'.md5($event->icalname) : 'family_other');
1952 } elseif ($event->type_code == 'BIRTHDAY') {
1955 $cssclass = 'family_birthday ';
1956 $color = sprintf("%02x%02x%02x
", $theme_datacolor[$colorindex][0], $theme_datacolor[$colorindex][1], $theme_datacolor[$colorindex][2]);
1957 } elseif ($event->type == 'bookcal_calendar') {
1960 $cssclass = 'family_bookcal_calendar_'.(!empty($bookcalcalendarsarray["availabilitieslink
"]) ? $bookcalcalendarsarray["availabilitieslink
"][$event->fk_bookcal_calendar] : "");
1961 $color = sprintf("%02x%02x%02x
", $theme_datacolor[$colorindex][0], $theme_datacolor[$colorindex][1], $theme_datacolor[$colorindex][2]);
1964 $color = ($event->icalcolor ? $event->icalcolor : -1);
1965 $cssclass = (!empty($event->icalname) ? 'family_ext'.md5($event->icalname) : 'family_other');
1967 if (empty($cacheusers[$event->userownerid])) {
1968 $newuser = new User($db);
1969 $newuser->fetch($event->userownerid);
1970 $cacheusers[$event->userownerid] = $newuser;
1972 //var_dump($cacheusers[$event->userownerid]->color);
1974 // We decide to choose color of owner of event (event->userownerid is user id of owner, event->userassigned contains all users assigned to event)
1975 if (!empty($cacheusers[$event->userownerid]->color)) {
1976 $color = $cacheusers[$event->userownerid]->color;
1980 if ($color < 0) { // Color was not set on user card. Set color according to color index.
1981 // Define color index if not yet defined
1982 $idusertouse = ($event->userownerid ? $event->userownerid : 0);
1983 if (isset($colorindexused[$idusertouse])) {
1984 $colorindex = $colorindexused[$idusertouse]; // Color already assigned to this user
1986 $colorindex = $nextindextouse;
1987 $colorindexused[$idusertouse] = $colorindex;
1988 if (!empty($theme_datacolor[$nextindextouse + 1])) {
1989 $nextindextouse++; // Prepare to use next color
1992 //print '|'.($color).'='.($idusertouse?$idusertouse:0).'='.$colorindex.'<br>';
1993 // Define color // @suppress-next-line PhanPluginPrintfIncompatibleArgumentType
1994 $color = sprintf("%02x%02x%02x
", $theme_datacolor[$colorindex][0], $theme_datacolor[$colorindex][1], $theme_datacolor[$colorindex][2]);
1996 $cssclass = $cssclass.' eventday_'.$ymd;
1998 // Defined style to disable drag and drop feature
1999 if ($event->type_code == 'AC_OTH_AUTO') {
2000 $cssclass .= " unmovable
";
2001 } elseif ($event->type_code == 'HOLIDAY') {
2002 $cssclass .= " unmovable
";
2003 } elseif ($event->type_code == 'BIRTHDAY') {
2004 $cssclass .= " unmovable
";
2005 } elseif ($event->type_code == 'ICALEVENT') {
2006 $cssclass .= " unmovable
";
2007 } 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)) {
2008 // If the event is on several days
2009 $tmpyearend = dol_print_date($event->date_start_in_calendar, '%Y', 'tzuserrel');
2010 $tmpmonthend = dol_print_date($event->date_start_in_calendar, '%m', 'tzuserrel');
2011 $tmpdayend = dol_print_date($event->date_start_in_calendar, '%d', 'tzuserrel');
2012 //var_dump($tmpyearend.' '.$tmpmonthend.' '.$tmpdayend);
2013 if ($tmpyearend != $annee || $tmpmonthend != $mois || $tmpdayend != $jour) {
2014 $cssclass .= " unmovable unmovable-mustusefirstdaytodrag
";
2016 $cssclass .= ' movable cursormove';
2019 if ($user->hasRight('agenda', 'allactions', 'create') ||
2020 (($event->authorid == $user->id || $event->userownerid == $user->id) && $user->hasRight('agenda', 'myactions', 'create'))) {
2021 $cssclass .= " movable cursormove
";
2023 $cssclass .= " unmovable
";
2029 if ($mode == 'show_day') {
2030 $h = 'height: 100%; ';
2033 if ($mode == 'show_week') {
2034 $h = 'height: 100%; ';
2040 print '<!-- start event '.$i.' -->'."\n
";
2043 if ($maxprint && $ireallyshown >= $maxprint) {
2044 $morecss = 'showifmore';
2046 if ($event->type == 'birthdate' && !GETPOST('check_birthday')) {
2047 $morecss = 'hidden';
2049 if ($event->type == 'holiday' && !GETPOST('check_holiday')) {
2050 $morecss = 'hidden';
2052 /* I comment this because it hides event recorded from bookcal online page
2053 if ($event->type == 'bookcal_calendar' && !GETPOST('check_bookcal_calendar_'.$bookcalcalendarsarray["availabilitieslink
"][$event->fk_bookcal_calendar])) {
2054 $morecss = 'hidden';
2056 if ($morecss != 'hidden') {
2059 if ($morecss != 'showifmore' && $morecss != 'hidden') {
2063 //var_dump($event->type.' - '.$morecss.' - '.$cssclass.' - '.$i.' - '.$ireallyshown.' - '.$itoshow);
2064 if (isModEnabled("bookcal
") && $event->type == 'bookcal_calendar') {
2065 print '<div id="event_
'.$ymd.'_
'.$i.'" class="event family_
'.$event->type.'_
'.$bookcalcalendarsarray["availabilitieslink"][$event->fk_bookcal_calendar].' '.$cssclass.($morecss ? ' '.$morecss : '').'"';
2067 print '<div id="event_
'.$ymd.'_
'.$i.'" class="event family_
'.$event->type.' '.$cssclass.($morecss ? ' '.$morecss : '').'"';
2069 //print ' style="height: 100px;
';
2070 //print ' position: absolute; top: 40px; width: 50%;
';
2074 //var_dump($event->userassigned);
2075 //var_dump($event->transparency);
2076 print '<table class="centpercent cal_event
';
2077 print(empty($event->transparency) ? ' cal_event_notbusy
' : ' cal_event_busy
');
2078 //if (empty($event->transparency) && empty($conf->global->AGENDA_NO_TRANSPARENT_ON_NOT_BUSY)) print ' opacitymedium
'; // Not busy
2079 print '" style="'.$h;
2080 $colortouse = $color;
2081 // If colortouse is similar than background, we force to change it.
2082 if (empty($event->transparency) && !getDolGlobalString('AGENDA_NO_TRANSPARENT_ON_NOT_BUSY
')) {
2083 print 'background: #f0f0f0;
';
2084 print 'border-left: 5px solid #
'.$colortouse.';
';
2086 print 'background: #f0f0f0;
';
2087 print 'border-left: 5px solid #
'.dol_color_minus($colortouse, -3).';
';
2088 //print 'background: -webkit-gradient(linear, left top, left bottom, from(#
'.dol_color_minus($colortouse, -3).'), to(#
'.dol_color_minus($colortouse, -1).'));
';
2090 //print 'background: #
'.$colortouse.';
';
2091 //print 'background: -webkit-gradient(linear, left top, left bottom, from(#
'.dol_color_minus($color, -3).'), to(#
'.dol_color_minus($color, -1).'));
';
2092 //if (!empty($event->transparency)) print 'background: #
'.$color.'; background: -webkit-gradient(linear, left top, left bottom, from(#
'.$color.'), to(#
'.dol_color_minus($color,1).'));
';
2093 //else print 'background-color: transparent !important; background: none; border: 1px solid #bbb;
';
2094 //print ' -moz-border-radius:4px;
"';
2095 //print 'border: 1px solid #ccc" width=
"100%"';
2098 print '<td class="tdoverflow nobottom small centpercent
'.($nowrapontd ? 'nowrap
' : '').'cal_event
'.($event->type_code == 'BIRTHDAY
' ? ' cal_event_birthday
' : '').'">';
2099 print '<!-- left section of event -->';
2103 if ($event->type_code == 'BIRTHDAY') {
2104 // It's birthday calendar
2105 $picb = '<i class="fas fa-birthday-cake
inline-block valignmiddle
"></i>';
2106 //$pice = '<i class="fas fa-briefcase
inline-block
"></i>';
2107 //$typea = ($objp->typea == 'birth') ? $picb : $pice;
2109 print $picb.' '.$langs->trans("Birthday
").'<br>';
2110 //print img_picto($langs->trans("Birthday
"), 'birthday-cake').' ';
2112 $tmpid = $event->id;
2114 if (empty($cachecontacts[$tmpid])) {
2115 $newcontact = new Contact($db);
2116 $newcontact->fetch($tmpid);
2117 $cachecontacts[$tmpid] = $newcontact;
2119 print $cachecontacts[$tmpid]->getNomUrl(1, '', 0, '', -1, 0, 'valignmiddle inline-block');
2121 //$event->picto = 'birthday-cake';
2122 //print $event->getNomUrl(1, $maxnbofchar, 'cal_event', 'birthday', 'contact');
2123 /*$listofcontacttoshow = '';
2124 $listofcontacttoshow .= '<br>'.$cacheusers[$tmpid]->getNomUrl(-1, '', 0, 0, 0, 0, '', 'paddingright valignmiddle');
2125 print $listofcontacttoshow;
2127 } elseif ($event->type_code == 'HOLIDAY') {
2128 // It's holiday calendar
2129 $tmpholiday->fetch($event->id);
2131 print $tmpholiday->getNomUrl(1, -1, 0, 'valignmiddle inline-block');
2133 $tmpid = $tmpholiday->fk_user;
2134 if (empty($cacheusers[$tmpid])) {
2135 $newuser = new User($db);
2136 $newuser->fetch($tmpid);
2137 $cacheusers[$tmpid] = $newuser;
2140 $listofusertoshow = '';
2141 $listofusertoshow .= '<br>'.$cacheusers[$tmpid]->getNomUrl(-1, '', 0, 0, 0, 0, '', 'paddingright valignmiddle inline-block');
2142 print $listofusertoshow;
2145 $parameters = array();
2146 $reshook = $hookmanager->executeHooks('eventOptions', $parameters, $event, $action); // Note that $action and $object may have been modified by some hooks
2148 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
2150 '@phan-var-force ActionComm $event';
2151 if (empty($reshook)) {
2153 if (empty($event->fulldayevent)) {
2154 //print $event->getNomUrl(2).' ';
2158 if (empty($event->fulldayevent)) {
2159 // Show hours (start ... end)
2160 $tmpyearstart = dol_print_date($event->date_start_in_calendar, '%Y', 'tzuserrel');
2161 $tmpmonthstart = dol_print_date($event->date_start_in_calendar, '%m', 'tzuserrel');
2162 $tmpdaystart = dol_print_date($event->date_start_in_calendar, '%d', 'tzuserrel');
2163 $tmpyearend = dol_print_date($event->date_end_in_calendar, '%Y', 'tzuserrel');
2164 $tmpmonthend = dol_print_date($event->date_end_in_calendar, '%m', 'tzuserrel');
2165 $tmpdayend = dol_print_date($event->date_end_in_calendar, '%d', 'tzuserrel');
2168 if ($tmpyearstart == $annee && $tmpmonthstart == $mois && $tmpdaystart == $jour) {
2169 $daterange .= dol_print_date($event->date_start_in_calendar, 'hour', 'tzuserrel');
2170 if ($event->date_end_in_calendar && $event->date_start_in_calendar != $event->date_end_in_calendar) {
2171 if ($tmpyearstart == $tmpyearend && $tmpmonthstart == $tmpmonthend && $tmpdaystart == $tmpdayend) {
2178 if ($event->date_end_in_calendar && $event->date_start_in_calendar != $event->date_end_in_calendar) {
2179 if ($tmpyearstart != $tmpyearend || $tmpmonthstart != $tmpmonthend || $tmpdaystart != $tmpdayend) {
2180 $daterange .= '...';
2184 if ($event->date_end_in_calendar && $event->date_start_in_calendar != $event->date_end_in_calendar) {
2185 if ($tmpyearend == $annee && $tmpmonthend == $mois && $tmpdayend == $jour) {
2186 $daterange .= dol_print_date($event->date_end_in_calendar, 'hour', 'tzuserrel');
2191 print $langs->trans("EventOnFullDay
")."<br>\n
";
2196 $titletoshow = $daterange;
2197 $titletoshow .= ($titletoshow ? ' ' : '').dol_escape_htmltag($event->label);
2199 if ($event->type_code != 'ICALEVENT') {
2200 $savlabel = $event->label;
2201 $event->label = $titletoshow;
2202 // Note: List of users are inside $event->userassigned. Link may be clickable depending on permissions of user.
2203 $titletoshow = (($event->type_picto || $event->type_code) ? $event->getTypePicto() : '');
2204 $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 '...'
2205 $event->label = $savlabel;
2208 // Loop on each assigned user
2209 $listofusertoshow = '';
2210 $posuserassigned = 0;
2211 foreach ($event->userassigned as $tmpid => $tmpdata) {
2212 if (!$posuserassigned && $titletoshow) {
2213 $listofusertoshow .= '<br>';
2216 if (empty($cacheusers[$tmpid])) {
2217 $newuser = new User($db);
2218 $newuser->fetch($tmpid);
2219 $cacheusers[$tmpid] = $newuser;
2222 $listofusertoshow .= $cacheusers[$tmpid]->getNomUrl(-3, '', 0, 0, 0, 0, '', 'valignmiddle inline-block');
2226 print $listofusertoshow.' ';
2228 if ($event->type_code == 'ICALEVENT') {
2229 print '<br>('.dol_trunc($event->icalname, $maxnbofchar).')';
2232 $thirdparty_id = ($event->socid > 0 ? $event->socid : ((is_object($event->societe) && $event->societe->id > 0) ? $event->societe->id : 0));
2233 $contact_id = ($event->contact_id > 0 ? $event->contact_id : ((is_object($event->contact) && $event->contact->id > 0) ? $event->contact->id : 0));
2235 // If action related to company / contact
2236 $linerelatedto = '';
2237 if ($thirdparty_id > 0) {
2238 if (!isset($cachethirdparties[$thirdparty_id]) || !is_object($cachethirdparties[$thirdparty_id])) {
2239 $thirdparty = new Societe($db);
2240 $thirdparty->fetch($thirdparty_id);
2241 $cachethirdparties[$thirdparty_id] = $thirdparty;
2243 $thirdparty = $cachethirdparties[$thirdparty_id];
2245 if (!empty($thirdparty->id)) {
2246 $linerelatedto .= $thirdparty->getNomUrl(1, '', 0, 0, -1, 0, '', 'valignmiddle inline-block');
2249 if (!empty($contact_id) && $contact_id > 0) {
2250 if (empty($cachecontacts[$contact_id]) || !is_object($cachecontacts[$contact_id])) {
2251 $contact = new Contact($db);
2252 $contact->fetch($contact_id);
2253 $cachecontacts[$contact_id] = $contact;
2255 $contact = $cachecontacts[$contact_id];
2257 if ($linerelatedto) {
2258 $linerelatedto .= ' ';
2260 if (!empty($contact->id)) {
2261 $linerelatedto .= $contact->getNomUrl(1, '', 0, '', -1, 0, 'valignmiddle inline-block');
2264 if (!empty($event->fk_element) && $event->fk_element > 0 && !empty($event->elementtype) && getDolGlobalString('AGENDA_SHOW_LINKED_OBJECT')) {
2265 include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
2266 if ($linerelatedto) {
2267 $linerelatedto .= '<br>';
2269 $linerelatedto .= dolGetElementUrl($event->fk_element, $event->elementtype, 1);
2271 if ($linerelatedto) {
2272 print ' '.$linerelatedto;
2274 } elseif (!empty($reshook)) {
2275 print $hookmanager->resPrint;
2281 if ($event->location) {
2283 print $langs->trans("Location
").': '.$event->location;
2290 if ($event->type_code != 'BIRTHDAY' && $event->type_code != 'ICALEVENT') {
2292 if ($event->percentage >= 0) {
2296 print '<td class="nobottom right nowrap cal_event_right
'.($withstatus >= 2 ? ' cal_event_right_status
' : '').'">';
2298 print $event->getLibStatut(3, 1);
2302 print '</td></tr></table>';
2303 print '</div><!-- end event '.$i.' -->'."\n
";
2307 print '<a href="'.DOL_URL_ROOT.'/comm/action/index.php?mode=
'.$mode.'&maxprint=0&month=
'.((int) $monthshown).'&year=
'.((int) $year);
2308 print($status ? '&
status=
'.$status : '').($filter ? '&filter=
'.urlencode($filter) : '');
2309 print($filtert ? '&search_filtert=
'.urlencode((string) $filtert) : '');
2310 print($usergroup ? '&search_usergroup=
'.urlencode($usergroup) : '');
2311 print($actioncode != '' ? '&search_actioncode=
'.urlencode($actioncode) : '');
2312 print '">'.img_picto("all
", "1downarrow_selected.png
").' ...';
2313 print ' +'.(count($eventarray[$daykey]) - $maxprint);
2316 //$ok=false; // To avoid to show twice the link
2323 if (!$i) { // No events
2327 if (getDolGlobalString('MAIN_JS_SWITCH_AGENDA') && $itoshow > $ireallyshown && $maxprint) {
2328 print '<div class="center cursorpointer
" id="more_
'.$ymd.'">'.img_picto("All
", "angle-
double-down
", 'class="warning
"').' +'.($itoshow - $ireallyshown).'</div>';
2329 //print ' +'.(count($eventarray[$daykey])-$maxprint);
2331 print '<script type="text/javascript
">'."\n
";
2332 print 'jQuery(document).ready(function () {'."\n
";
2333 print ' var open=0;'."\n
";
2334 print ' jQuery("#more_
'.$ymd.'").click(function() { console.log("Click on showmore
for '.$ymd.'"); reinit_day_'.$ymd.'(); event.stopImmediatePropagation(); });'."\n
";
2335 print ' function reinit_day_'.$ymd.'() {'."\n
";
2336 print ' jQuery(".eventday_
'.$ymd.'.showifmore
").toggle();'."\n
";
2337 print ' open = open + 1; if (open > 1) { open = 0; }'."\n
";
2338 print ' if (open) { ';
2339 print ' jQuery("#more_
'.$ymd.'").html(\''.img_picto("All
", "angle-
double-up
", 'class="warning
"').'\');'."\n
";
2341 print ' jQuery("#more_
'.$ymd.'").html(\''.img_picto("All
", "angle-
double-down
", 'class="warning
"').' +'.($itoshow - $ireallyshown).'\');'."\n
";
2345 print '</script>'."\n
";
2348 print '</div></div>'; // td tr
2350 print '</div>'; // table
2363function dol_color_minus($color, $minus, $minusunit = 16)
2366 if ($minusunit == 16) {
2367 $newcolor[0] = dechex(max(min(hexdec($newcolor[0]) - $minus, 15), 0));
2368 $newcolor[2] = dechex(max(min(hexdec($newcolor[2]) - $minus, 15), 0));
2369 $newcolor[4] = dechex(max(min(hexdec($newcolor[4]) - $minus, 15), 0));
2371 // Not yet implemented
2383function sort_events_by_date($a, $b)
2385 // Sort holidays at first
2386 if ($a->type_code === 'HOLIDAY') {
2389 if ($b->type_code === 'HOLIDAY') {
2393 // datep => Event start time
2394 // datef => Event end time
2396 // Events have different start time
2397 if ($a->datep !== $b->datep) {
2398 return $a->datep - $b->datep;
2401 // Events have same start time and no end time
2402 if ((!is_numeric($b->datef)) || (!is_numeric($a->datef))) {
2403 return sort_events_by_percentage($a, $b);
2406 // Events have the same start time and same end time
2407 if ($b->datef === $a->datef) {
2408 return sort_events_by_percentage($a, $b);
2411 // Events have the same start time, but have different end time -> longest event first
2412 return $b->datef - $a->datef;
2422function sort_events_by_percentage($a, $b)
2424 // Sort events with no percentage before each other
2425 // (useful to sort holidays, sick days or similar on the top)
2427 if ($a->percentage < 0) {
2431 if ($b->percentage < 0) {
2435 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)
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.