36require
'../../main.inc.php';
44require_once DOL_DOCUMENT_ROOT.
'/comm/action/class/actioncomm.class.php';
45require_once DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php';
46require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
47require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
48require_once DOL_DOCUMENT_ROOT.
'/core/lib/agenda.lib.php';
49require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
50require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
55$action =
GETPOST(
'action',
'aZ09');
56$optioncss =
GETPOST(
'optioncss',
'aZ');
58if (empty($mode) && preg_match(
'/show_/', $action)) {
62$disabledefaultvalues =
GETPOSTINT(
'disabledefaultvalues');
65$check_birthday = !empty(
$conf->use_javascript_ajax) ?
GETPOSTINT(
"check_birthday") : 1;
66$filter =
GETPOST(
"search_filter",
'alpha', 3) ?
GETPOST(
"search_filter",
'alpha', 3) :
GETPOST(
"filter",
'alpha', 3);
67$filtert =
GETPOST(
"search_filtert",
"intcomma", 3) ?
GETPOST(
"search_filtert",
"intcomma", 3) :
GETPOST(
"filtert",
"intcomma", 3);
68$usergroup =
GETPOST(
"search_usergroup",
"intcomma", 3) ?
GETPOST(
"search_usergroup",
"intcomma", 3) :
GETPOST(
"usergroup",
"intcomma", 3);
69$usergroupids = array_map(
'intval', array_filter(explode(
',', $usergroup)));
70$search_categ_cus =
GETPOST(
"search_categ_cus",
'intcomma', 3) ?
GETPOST(
"search_categ_cus",
'intcomma', 3) : 0;
74 $filtert = (
string) $user->id;
84$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
85$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
87if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
91$offset = $limit * $page;
96 $sortfield =
"a.datec";
102 $socid = $user->socid;
109if (!$user->hasRight(
'agenda',
'myactions',
'read')) {
112if (!$user->hasRight(
'agenda',
'allactions',
'read')) {
115if (!$user->hasRight(
'agenda',
'allactions',
'read') || $filter ==
'mine') {
116 $filtert = (
string) $user->id;
124$pid = GETPOSTISSET(
"search_projectid") ?
GETPOSTINT(
"search_projectid", 3) :
GETPOSTINT(
"projectid", 3);
125$status = GETPOSTISSET(
"search_status") ?
GETPOST(
"search_status",
'aZ09') :
GETPOST(
"status",
'aZ09');
126$type = GETPOSTISSET(
"search_type") ?
GETPOST(
"search_type",
'aZ09') :
GETPOST(
"type",
'aZ09');
130if ($dateselect > 0) {
137if (
GETPOST(
'search_actioncode',
'array:aZ09')) {
138 $actioncode =
GETPOST(
'search_actioncode',
'array:aZ09', 3);
139 if (!count($actioncode)) {
143 $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')));
145if (is_scalar($actioncode) && $actioncode ==
'-1') {
149if ($status ==
'' && !GETPOSTISSET(
'search_status')) {
155if (empty($mode) && !GETPOSTISSET(
'mode')) {
156 $mode = $defaultview;
158if ($mode ==
'default') {
159 $mode = (($defaultview !=
'show_list') ? $defaultview :
'show_month');
163 $mode =
'show_month';
169 $week = ($week ? $week :
date(
"W"));
170 $day = ($day ? $day :
date(
"d"));
175 $day = ($day ? $day :
date(
"d"));
181$langs->loadLangs(array(
'agenda',
'other',
'commercial'));
184$hookmanager->initHooks(array(
'agenda'));
186$result =
restrictedArea($user,
'agenda', 0,
'actioncomm&societe',
'myactions|allactions',
'fk_soc',
'id');
187if ($user->socid && $socid) {
191require_once DOL_DOCUMENT_ROOT.
'/core/redirect_if_setup_not_complete.inc.php';
198if (
GETPOST(
"viewlist",
'alpha') || $mode ==
'show_list') {
200 if (is_array($_POST)) {
201 foreach ($_POST as $key => $val) {
202 if ($key ==
'token') {
205 $param .=
'&'.urlencode($key).
'='.urlencode($val);
208 if (!preg_match(
'/action=/', $param)) {
209 $param .= ($param ?
'&' :
'').
'mode=show_list';
212 header(
"Location: ".DOL_URL_ROOT.
'/comm/action/list.php?'.$param);
216if (
GETPOST(
"viewperuser",
'alpha') || $mode ==
'show_peruser') {
218 if (is_array($_POST)) {
219 foreach ($_POST as $key => $val) {
220 if ($key ==
'token') {
223 $param .=
'&'.urlencode($key).
'='.urlencode($val);
227 header(
"Location: ".DOL_URL_ROOT.
'/comm/action/peruser.php?'.$param);
243 'maxprint' => $maxprint,
245 'filtert' => $filtert,
246 'showbirthday' => $check_birthday,
247 'canedit' => $canedit,
248 'optioncss' => $optioncss,
249 'actioncode' => $actioncode,
251 'resourceid' => $resourceid,
252 'usergroup' => $usergroup,
254$reshook = $hookmanager->executeHooks(
'beforeAgenda', $parameters, $object, $action);
264$help_url =
'EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda|DE:Modul_Terminplanung';
265llxHeader(
'', $langs->trans(
"Agenda"), $help_url);
269$nowyear = $nowarray[
'year'];
270$nowmonth = $nowarray[
'mon'];
271$nowday = $nowarray[
'mday'];
273$listofextcals = array();
277while ($i < $MAXAGENDA) {
279 $source =
'AGENDA_EXT_SRC'.$i;
280 $name =
'AGENDA_EXT_NAME'.$i;
281 $offsettz =
'AGENDA_EXT_OFFSETTZ'.$i;
282 $color =
'AGENDA_EXT_COLOR'.$i;
283 $enabled =
'AGENDA_EXT_ENABLED'.$i;
284 $default =
'AGENDA_EXT_ACTIVEBYDEFAULT'.$i;
285 $buggedfile =
'AGENDA_EXT_BUGGEDFILE'.$i;
288 $listofextcals[] = array(
289 'type' =>
'globalsetup',
303while ($i < $MAXAGENDA) {
305 $source =
'AGENDA_EXT_SRC_'.$user->id.
'_'.$i;
306 $name =
'AGENDA_EXT_NAME_'.$user->id.
'_'.$i;
307 $offsettz =
'AGENDA_EXT_OFFSETTZ_'.$user->id.
'_'.$i;
308 $color =
'AGENDA_EXT_COLOR_'.$user->id.
'_'.$i;
309 $enabled =
'AGENDA_EXT_ENABLED_'.$user->id.
'_'.$i;
310 $default =
'AGENDA_EXT_ACTIVEBYDEFAULT_'.$user->id.
'_'.$i;
311 $buggedfile =
'AGENDA_EXT_BUGGEDFILE_'.$user->id.
'_'.$i;
315 $listofextcals[] = array(
316 'type' =>
'usersetup',
319 'offsettz' => (
int) (empty($user->conf->$offsettz) ? 0 : $user->
conf->$offsettz),
329$max_day_in_month = 0;
340$max_day_in_prev_month = 0;
344if (empty($mode) || $mode ==
'show_month') {
346 $prev_year = $prev[
'year'];
347 $prev_month = $prev[
'month'];
349 $next_year = $next[
'year'];
350 $next_month = $next[
'month'];
352 $max_day_in_prev_month = (int)
date(
"t",
dol_mktime(12, 0, 0, $prev_month, 1, $prev_year,
'gmt'));
353 $max_day_in_month = (int)
date(
"t",
dol_mktime(12, 0, 0, $month, 1, $year,
'gmt'));
355 $tmpday = - (int)
date(
"w",
dol_mktime(12, 0, 0, $month, 1, $year,
'gmt')) + 2;
361 $firstdaytoshow =
dol_mktime(0, 0, 0, $prev_month, $max_day_in_prev_month + $tmpday, $prev_year,
'tzuserrel');
362 $next_day = 7 - ($max_day_in_month + 1 - $tmpday) % 7;
366 $lastdaytoshow =
dol_mktime(0, 0, 0, $next_month, $next_day, $next_year,
'tzuserrel');
368if ($mode ==
'show_week') {
370 $prev_year = $prev[
'prev_year'];
371 $prev_month = $prev[
'prev_month'];
372 $prev_day = $prev[
'prev_day'];
373 $first_day = $prev[
'first_day'];
374 $first_month = $prev[
'first_month'];
375 $first_year = $prev[
'first_year'];
377 $week = $prev[
'week'];
381 $next_year = $next[
'year'];
382 $next_month = $next[
'month'];
383 $next_day = $next[
'day'];
386 $firstdaytoshow =
dol_mktime(0, 0, 0, $first_month, $first_day, $first_year,
'tzuserrel');
389 $max_day_in_month =
date(
"t",
dol_mktime(0, 0, 0, $month, 1, $year,
'gmt'));
391 $tmpday = $first_day;
393if ($mode ==
'show_day') {
395 $prev_year = $prev[
'year'];
396 $prev_month = $prev[
'month'];
397 $prev_day = $prev[
'day'];
399 $next_year = $next[
'year'];
400 $next_month = $next[
'month'];
401 $next_day = $next[
'day'];
403 $firstdaytoshow =
dol_mktime(0, 0, 0, $prev_month, $prev_day, $prev_year,
'tzuserrel');
404 $lastdaytoshow =
dol_mktime(0, 0, 0, $next_month, $next_day, $next_year,
'tzuserrel');
420if (($actioncode && $actioncode !==
'-1') || GETPOSTISSET(
'search_actioncode')) {
421 if (is_array($actioncode)) {
422 foreach ($actioncode as $str_action) {
423 if ($str_action !=
'-1') {
424 $param .=
"&search_actioncode[]=".urlencode($str_action);
428 $param .=
"&search_actioncode=".urlencode($actioncode);
431if ($resourceid > 0) {
432 $param .=
"&search_resourceid=".urlencode((
string) ($resourceid));
434if ($status || GETPOSTISSET(
'status') || GETPOSTISSET(
'search_status')) {
435 $param .=
"&search_status=".urlencode($status);
438 $param .=
"&search_filter=".urlencode((
string) $filter);
441 $param .=
"&search_filtert=".urlencode((
string) $filtert);
444 $param .=
"&search_usergroup=".urlencode((
string) ($usergroup));
447 $param .=
"&search_socid=".urlencode((
string) ($socid));
449if ($check_birthday) {
450 $param .=
"&check_birthday=1";
453 $param .=
"&check_holiday=1";
456 $param .=
"&search_projectid=".urlencode((
string) ($pid));
459 $param .=
"&search_type=".urlencode($type);
461$param .=
"&maxprint=".urlencode((
string) ($maxprint));
462if ($mode ==
'show_day' || $mode ==
'show_week' || $mode ==
'show_month') {
463 $param .=
'&mode='.urlencode($mode);
465if ($search_categ_cus != 0) {
466 $param .=
'&search_categ_cus='.urlencode((
string) ($search_categ_cus));
469 $param .=
'&check_holiday=1';
474$nav .=
'<div class="navselectiondate inline-block nowraponall">';
475if (empty($mode) || $mode ==
'show_month') {
476 $nav .=
"<a href=\"?year=".$prev_year.
"&month=".$prev_month.$param.
"\"><i class=\"fa fa-chevron-left\"></i></a> \n";
477 $nav .=
" <span id=\"month_name\">".dol_print_date(
dol_mktime(0, 0, 0, $month, 1, $year),
"%b %Y");
478 $nav .=
" </span>\n";
479 $nav .=
" <a href=\"?year=".$next_year.
"&month=".$next_month.$param.
"\"><i class=\"fa fa-chevron-right\"></i></a>\n";
482if ($mode ==
'show_week') {
483 $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";
484 $nav .=
" <span id=\"month_name\">".dol_print_date(
dol_mktime(0, 0, 0, $first_month, $first_day, $first_year),
"%Y").
", ".$langs->trans(
"WeekShort").
" ".$week;
485 $nav .=
" </span>\n";
486 $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";
487 $picto =
'calendarweek';
489if ($mode ==
'show_day') {
490 $nav .=
"<a href=\"?year=".$prev_year.
"&month=".$prev_month.
"&day=".$prev_day.$param.
"\"><i class=\"fa fa-chevron-left\"></i></a> \n";
491 $nav .=
" <span id=\"month_name\">".dol_print_date(
dol_mktime(0, 0, 0, $month, $day, $year),
"daytextshort");
492 $nav .=
" </span>\n";
493 $nav .=
" <a href=\"?year=".$next_year.
"&month=".$next_month.
"&day=".$next_day.$param.
"\"><i class=\"fa fa-chevron-right\"></i></a>\n";
494 $picto =
'calendarday';
496if (empty(
$conf->dol_optimize_smallscreen)) {
497 $nav .=
' <a href="?year='.$nowyear.
'&month='.$nowmonth.
'&day='.$nowday.$param.
'" class="datenowlink marginleftonly marginrightonly">'.$langs->trans(
"Today").
'</a> ';
501$nav .= $form->selectDate($dateselect,
'dateselect', 0, 0, 1,
'', 1, 0);
503$nav .=
'<button type="submit" class="liste_titre button_search valignmiddle" name="button_search_x" value="x"><span class="fa fa-search"></span></button>';
506$paramnodate = $param;
507$param .=
'&year='.$year.
'&month='.$month.($day ?
'&day='.$day :
'');
522$paramnoaction = preg_replace(
'/mode=[a-z_]+/',
'', preg_replace(
'/action=[a-z_]+/',
'', $param));
523$paramnoactionodate = preg_replace(
'/mode=[a-z_]+/',
'', preg_replace(
'/action=[a-z_]+/',
'', $paramnodate));
527print
'<form method="POST" id="searchFormList" class="listactionsfilter" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
528if ($optioncss !=
'') {
529 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
531print
'<input type="hidden" name="token" value="'.newToken().
'">';
532print
'<input type="hidden" name="mode" value="'.$mode.
'">';
535$viewmode =
'<div class="navmode inline-block">';
537$viewmode .=
'<a class="btnTitle'.($mode ==
'list' ?
' btnTitleSelected' :
'').
' reposition" href="'.DOL_URL_ROOT.
'/comm/action/list.php?mode=show_list&restore_lastsearch_values=1'.$paramnoactionodate.
'">';
539$viewmode .=
img_picto($langs->trans(
"List"),
'object_calendarlist',
'class="imgforviewmode pictoactionview block"');
541$viewmode .=
'<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone inline-block width75 divoverflow">'.$langs->trans(
"ViewList").
'</span></a>';
543$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.
'">';
545$viewmode .=
img_picto($langs->trans(
"ViewCal"),
'object_calendarmonth',
'class="pictoactionview block"');
547$viewmode .=
'<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone inline-block width75 divoverflow">'.$langs->trans(
"ViewCal").
'</span></a>';
549$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.
'">';
551$viewmode .=
img_picto($langs->trans(
"ViewWeek"),
'object_calendarweek',
'class="pictoactionview block"');
553$viewmode .=
'<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone inline-block width75 divoverflow">'.$langs->trans(
"ViewWeek").
'</span></a>';
555$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.
'">';
557$viewmode .=
img_picto($langs->trans(
"ViewDay"),
'object_calendarday',
'class="pictoactionview block"');
559$viewmode .=
'<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone inline-block width75 divoverflow">'.$langs->trans(
"ViewDay").
'</span></a>';
561$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.
'">';
563$viewmode .=
img_picto($langs->trans(
"ViewPerUser"),
'object_calendarperuser',
'class="pictoactionview block"');
565$viewmode .=
'<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone inline-block width75 divoverflow" title="'.dolPrintHTML($langs->trans(
"ViewPerUser")).
'">'.$langs->trans(
"ViewPerUser").
'</span></a>';
568$parameters = array();
570$reshook = $hookmanager->executeHooks(
'addCalendarView', $parameters, $object, $action);
571if (empty($reshook)) {
572 $viewmode .= $hookmanager->resPrint;
573} elseif ($reshook > 1) {
574 $viewmode = $hookmanager->resPrint;
577$viewmode .=
'</div>';
579$viewmode .=
'<span class="marginrightonly"></span>';
584if ($user->hasRight(
'agenda',
'myactions',
'create') || $user->hasRight(
'agenda',
'allactions',
'create')) {
587 $newparam .=
'&month='.((int) $month).
'&year='.((int) $tmpforcreatebutton[
'year']).
'&mode='.urlencode($mode);
592 $urltocreateaction = DOL_URL_ROOT.
'/comm/action/card.php?action=create';
593 $urltocreateaction .=
'&apyear='.$tmpforcreatebutton[
'year'].
'&apmonth='.$tmpforcreatebutton[
'mon'].
'&apday='.$tmpforcreatebutton[
'mday'].
'&aphour='.$tmpforcreatebutton[
'hours'].
'&apmin='.$tmpforcreatebutton[
'minutes'];
594 $urltocreateaction .=
'&backtopage='.urlencode($_SERVER[
"PHP_SELF"].($newparam ?
'?'.$newparam :
''));
596 $newcardbutton .=
dolGetButtonTitle($langs->trans(
"AddAction"),
'',
'fa fa-plus-circle', $urltocreateaction);
603$showextcals = $listofextcals;
604$bookcalcalendars = array();
608 $sql =
"SELECT ba.rowid, bc.label, bc.ref, bc.rowid as id_cal";
609 $sql .=
" FROM ".MAIN_DB_PREFIX.
"bookcal_availabilities as ba";
610 $sql .=
" JOIN ".MAIN_DB_PREFIX.
"bookcal_calendar as bc";
611 $sql .=
" ON bc.rowid = ba.fk_bookcal_calendar";
612 $sql .=
" WHERE bc.status = 1";
613 $sql .=
" AND ba.status = 1";
614 $sql .=
" AND bc.entity IN (".getEntity(
'agenda').
")";
615 if (!empty($filtert) && $filtert !=
'-1') {
616 $sql .=
" AND bc.visibility IN (".$db->sanitize($filtert, 0, 0, 0, 0).
")";
618 $resql =
$db->query($sql);
620 $num =
$db->num_rows($resql);
623 $objp =
$db->fetch_object($resql);
624 $label = !empty($objp->label) ? $objp->label : $objp->ref;
625 $bookcalcalendars[
"calendars"][$objp->id_cal] = array(
"id" => $objp->id_cal,
"label" => $label);
626 $bookcalcalendars[
"availabilitieslink"][$objp->rowid] = $objp->id_cal;
634if (!empty(
$conf->use_javascript_ajax)) {
635 $s .=
"\n".
'<!-- Div to calendars selectors -->'.
"\n";
637 $s .=
'<script type="text/javascript">'.
"\n";
638 $s .=
'jQuery(document).ready(function () {'.
"\n";
639 $s .=
'jQuery(".check_birthday").click(function() { console.log("Toggle class .family_birthday"); jQuery(".family_birthday").toggle(); });'.
"\n";
640 $s .=
'jQuery(".check_holiday").click(function() { console.log("Toggle class .family_holiday"); jQuery(".family_holiday").toggle(); jQuery(this).closest("form").submit(); });'.
"\n";
641 if (
isModEnabled(
"bookcal") && !empty($bookcalcalendars[
"calendars"])) {
642 foreach ($bookcalcalendars[
"calendars"] as $key => $value) {
643 $s .=
'jQuery(".check_bookcal_calendar_'.$value[
'id'].
'").click(function() { console.log("Toggle Bookcal Calendar '.$value[
'id'].
'"); jQuery(".family_bookcal_calendar_'.$value[
'id'].
'").toggle(); });'.
"\n";
646 if ($mode ==
"show_week" || $mode ==
"show_month" || empty($mode)) {
648 $s .=
'jQuery( "div.sortable" ).sortable({connectWith: ".sortable", placeholder: "ui-state-highlight", items: "div.movable", receive: function( event, ui ) {'.
"\n";
650 $s .=
'console.log("submit form to record new event");'.
"\n";
652 $s .=
'var newval = jQuery(event.target).closest("div.dayevent").attr("id");'.
"\n";
653 $s .=
'console.log("found parent div.dayevent with id = "+newval);'.
"\n";
654 $s .=
'var frm=jQuery("#searchFormList");'.
"\n";
655 $s .=
'var newurl = ui.item.find("a.cal_event").attr("href");'.
"\n";
656 $s .=
'console.log("Found url on href of a.cal_event"+newurl+", we submit form with actionmove=mupdate");'.
"\n";
657 $s .=
'frm.attr("action", newurl).children("#newdate").val(newval);frm.submit();}'.
"\n";
661 $s .=
'</script>'.
"\n";
664 $s .=
'<div class="nowrap inline-block minheight30 hideonsmartphone"><input type="checkbox" id="check_mytasks" name="check_mytasks" value="1" checked disabled><label class="labelcalendar"><span class="check_local_text small"> '.$langs->trans(
"LocalAgenda").
' </span></label></div>';
667 if ($user->hasRight(
"holiday",
"read")) {
669 <div class="nowrap inline-block minheight30"><input type="checkbox" id="check_holiday" name="check_holiday" value="1" class="marginleftonly check_holiday"' . ($check_holiday ?
' checked' :
'') .
'>
670 <label for="check_holiday" class="labelcalendar">
671 <span class="check_holiday_text small">' . $langs->trans(
"Holidays") .
'</span>
677 if (is_array($showextcals) && count($showextcals) > 0) {
678 $s .=
'<script type="text/javascript">'.
"\n";
679 $s .=
'jQuery(document).ready(function () {
680 jQuery("div input[name^=\"check_ext\"]").each(function(index, elem) {
681 var name = jQuery(elem).attr("name");
682 if (jQuery(elem).is(":checked")) {
683 jQuery(".family_ext" + name.replace("check_ext", "")).show();
685 jQuery(".family_ext" + name.replace("check_ext", "")).hide();
689 jQuery("div input[name^=\"check_ext\"]").click(function() {
690 var name = $(this).attr("name");
691 jQuery(".family_ext" + name.replace("check_ext", "")).toggle();
694 $s .=
'</script>'.
"\n";
696 foreach ($showextcals as $val) {
697 $htmlname = md5($val[
'name']);
699 if (!empty($val[
'default']) ||
GETPOSTINT(
'check_ext'.$htmlname)) {
700 $default =
"checked";
705 $tooltip = $langs->trans(
"Cache").
' '.round($DELAYFORCACHE / 60).
'mn';
707 $s .=
'<div class="nowrap inline-block minheight30"><input type="checkbox" id="check_ext'.$htmlname.
'" class="marginleftonly check_ext_'.$htmlname.
'" name="check_ext'.$htmlname.
'" value="1" '.$default.
'><label for="check_ext'.$htmlname.
'" title="'.
dol_escape_htmltag($tooltip).
'" class="labelcalendar"><span class="check_ext_text small">'.
dol_escape_htmltag($val[
'name']).
'</small></label> </div>';
712 $s .=
'<div class="nowrap inline-block minheight30"><input type="checkbox" id="check_birthday" name="check_birthday" class="marginleftonly check_birthday" value="1" '. (
GETPOSTINT(
'check_birthday') ?
' checked' :
'') .
'><label for="check_birthday" class="labelcalendar"><span class="check_birthday_text small">'.$langs->trans(
"AgendaShowBirthdayEvents").
'</span></label> </div>';
716 if (!empty($bookcalcalendars[
"calendars"])) {
717 foreach ($bookcalcalendars[
"calendars"] as $key => $value) {
718 $label = $value[
'label'];
719 $s .=
'<div class="nowrap inline-block minheight30">';
720 $s .=
'<input '.(GETPOST(
'check_bookcal_calendar_'.$value[
'id']) ?
"checked" :
"").
' type="checkbox" id="check_bookcal_calendar_'.$value[
'id'].
'" name="check_bookcal_calendar_'.$value[
'id'].
'" class="marginleftonly check_bookcal_calendar_'.$value[
'id'].
'">';
721 $s .=
'<label for="check_bookcal_calendar_'.$value[
'id'].
'" class="labelcalendar">';
722 $s .=
'<span class="check_bookcal_calendar_'.$value[
'id'].
'_text">'.$langs->trans(
"AgendaShowBookcalCalendar", $label).
'</span>';
723 $s .=
'</label> </div>';
729 $parameters = array();
730 $reshook = $hookmanager->executeHooks(
'addCalendarChoice', $parameters, $object, $action);
731 if (empty($reshook)) {
732 $s .= $hookmanager->resPrint;
733 } elseif ($reshook > 1) {
734 $s = $hookmanager->resPrint;
737 $s .=
"\n".
'<!-- End div to calendars selectors -->'.
"\n";
740 $newparam = preg_replace(
'/check_birthday=[0-1]/i',
'check_birthday='.(empty($check_birthday) ? 1 : 0), $newparam);
741 if (!preg_match(
'/check_birthday=/i', $newparam)) {
742 $newparam .=
'&check_birthday=1';
746 if (empty($check_birthday)) {
747 $s .= $langs->trans(
"AgendaShowBirthdayEvents");
749 $s .= $langs->trans(
"AgendaHideBirthdayEvents");
757 'usergroup' => $usergroup,
758 'filtert' => $filtert,
759 'resourceid' => $resourceid,
760 'actioncode' => $actioncode,
765 'search_categ_cus' => $search_categ_cus,
767$agendaeventresult =
agenda_build_eventarray(
$db, $hookmanager, $user, $object, $action, $mode, $year, $month, $day, $firstdaytoshow, $lastdaytoshow, $filters);
768$eventarray = $agendaeventresult[
'eventarray'];
769$nbevents = $agendaeventresult[
'nbevents'];
770$MAXONSAMEPAGE = $agendaeventresult[
'maxonsamepage'];
775if ($check_birthday) {
780if ($user->hasRight(
"holiday",
"read")) {
781 $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";
782 $sql .=
" FROM ".MAIN_DB_PREFIX.
"holiday as x, ".MAIN_DB_PREFIX.
"user as u";
783 $sql .=
" WHERE u.rowid = x.fk_user";
784 $sql .=
" AND u.statut = '1'";
785 $sql .=
" AND (x.statut = '2' OR x.statut = '3')";
786 if ($mode ==
'show_day') {
788 $sql .=
" AND '".$db->escape($year.
"-".$month.
"-".$day).
"' BETWEEN x.date_debut AND x.date_fin";
789 } elseif ($mode ==
'show_week') {
791 $sql .=
" AND x.date_debut < '".$db->idate(
dol_get_last_day($year, $month)).
"'";
793 } elseif ($mode ==
'show_month') {
795 $sql .=
" AND x.date_debut <= '".$db->idate(
dol_get_last_day($year, $month)).
"'";
798 if (!$user->hasRight(
'holiday',
'readall') || $filtert ==
'-3') {
800 $sql .=
" AND x.fk_user IN(".$db->sanitize(implode(
", ", $user->getAllChildIds(1))).
") ";
804 $sql .=
" AND x.fk_user = ".((int) $filtert);
807 $resql =
$db->query($sql);
809 $num =
$db->num_rows($resql);
814 $obj =
$db->fetch_object($resql);
819 $event->id = $obj->rowid;
820 $event->ref = (
string) $event->id;
822 $event->type_code =
'HOLIDAY';
823 $event->type_label =
'';
824 $event->type_color =
'';
825 $event->type =
'holiday';
826 $event->type_picto =
'holiday';
830 $event->datep = (int)
$db->jdate($obj->date_start,
'gmt') + (empty($obj->halfday) || $obj->halfday == 1 ? 0 : 12) * 60 * 60;
831 $event->datef = (int)
$db->jdate($obj->date_end,
'gmt') + (empty($obj->halfday) || $obj->halfday == -1 ? 24 : 12) * 60 * 60 - 1;
832 $event->date_start_in_calendar = $event->datep;
833 $event->date_end_in_calendar = $event->datef;
835 if ($obj->status == 3) {
837 $event->percentage = -1;
838 } elseif ($obj->status == 2) {
840 $event->percentage = 0;
843 $event->label = $langs->trans(
"Holiday");
845 $daycursor = $event->date_start_in_calendar;
850 $daycursorend = $event->date_end_in_calendar;
856 $daykey =
dol_mktime(0, 0, 0, $mois, $jour, $annee,
'gmt');
857 $daykeygmt =
dol_mktime(0, 0, 0, $mois, $jour, $annee,
'gmt');
862 $firstdayofholiday = ($ifornbofdays == 1);
863 $lastdayofholiday = ($daykeygmt ==
dol_get_first_hour($event->date_end_in_calendar,
'gmt'));
872 if ((in_array($obj->halfday, array(1, 2)) == 1 && $lastdayofholiday) || (in_array($obj->halfday, array(-1, 2)) && $firstdayofholiday)) {
875 if (in_array($obj->halfday, array(1, 2)) && $lastdayofholiday) {
876 $newevent->label .=
' ('.$langs->trans(
"Morning").
')';
877 } elseif (in_array($obj->halfday, array(-1, 2)) && $firstdayofholiday) {
878 $newevent->label .=
' ('.$langs->trans(
"Afternoon").
')';
880 $eventarray[$daykey][] = $newevent;
882 $eventarray[$daykey][] = $event;
885 $daykey += 60 * 60 * 24;
886 $daykeygmt += 60 * 60 * 24;
887 }
while ($daykey <= $event->date_end_in_calendar);
896if (count($listofextcals)) {
897 require_once DOL_DOCUMENT_ROOT.
'/comm/action/class/ical.class.php';
899 foreach ($listofextcals as $key => $extcal) {
900 $url = $extcal[
'src'];
901 $namecal = $extcal[
'name'];
902 $offsettz = $extcal[
'offsettz'];
903 $colorcal = $extcal[
'color'];
904 $buggedfile = $extcal[
'buggedfile'];
910 $ical->parse($url, $pathforcachefile, $DELAYFORCACHE);
913 $listofextcals[$key][
'error'] = $ical->error;
914 $s .=
'<br><div class="warning">'.dol_escape_htmltag($listofextcals[$key][
'name']).
': '.$url.
'<br>Error message: '.
dol_escape_htmltag($ical->error).
'</div>';
919 $icalevents = array();
920 $tmparray = $ical->get_event_list();
921 if (is_array($tmparray)) {
922 $icalevents = array_merge($icalevents, $tmparray);
924 $tmparray = $ical->get_freebusy_list();
925 if (is_array($tmparray)) {
926 $icalevents = array_merge($icalevents, $tmparray);
929 $nbevents += count($icalevents);
931 if (count($icalevents) > 0) {
933 $moreicalevents = array();
934 foreach ($icalevents as $icalevent) {
935 if (isset($icalevent[
'RRULE']) && is_array($icalevent[
'RRULE'])) {
938 if ($icalevent[
'DTSTART;VALUE=DATE']) {
941 } elseif (is_array($icalevent[
'DTSTART']) && !empty($icalevent[
'DTSTART'][
'unixtime'])) {
942 $datecurstart = $icalevent[
'DTSTART'][
'unixtime'];
943 $datecurend = $icalevent[
'DTEND'][
'unixtime'];
944 if (!empty($ical->cal[
'DAYLIGHT'][
'DTSTART']) && $datecurstart) {
946 $tmpcurstart = $datecurstart;
947 $tmpcurend = $datecurend;
948 $tmpdaylightstart =
dol_mktime(0, 0, 0, 1, 1, 1970, 1) + (int) $ical->cal[
'DAYLIGHT'][
'DTSTART'];
949 $tmpdaylightend =
dol_mktime(0, 0, 0, 1, 1, 1970, 1) + (int) $ical->cal[
'STANDARD'][
'DTSTART'];
952 if ($tmpcurstart >= $tmpdaylightstart && $tmpcurstart < $tmpdaylightend) {
953 $datecurstart -= ((int) $ical->cal[
'DAYLIGHT'][
'TZOFFSETTO']) * 36;
955 $datecurstart -= ((int) $ical->cal[
'STANDARD'][
'TZOFFSETTO']) * 36;
957 if ($tmpcurend >= $tmpdaylightstart && $tmpcurstart < $tmpdaylightend) {
958 $datecurend -= ((int) $ical->cal[
'DAYLIGHT'][
'TZOFFSETTO']) * 36;
960 $datecurend -= ((int) $ical->cal[
'STANDARD'][
'TZOFFSETTO']) * 36;
967 dol_syslog(
"Found a not recognized repeatable record with unknown date start", LOG_ERR);
972 $interval = (empty($icalevent[
'RRULE'][
'INTERVAL']) ? 1 : $icalevent[
'RRULE'][
'INTERVAL']);
973 $until = empty($icalevent[
'RRULE'][
'UNTIL']) ? 0 :
dol_stringtotime($icalevent[
'RRULE'][
'UNTIL'], 1);
974 $maxrepeat = empty($icalevent[
'RRULE'][
'COUNT']) ? 0 : $icalevent[
'RRULE'][
'COUNT'];
975 if ($until && ($until + ($datecurend - $datecurstart)) < $firstdaytoshow) {
978 if ($datecurstart >= $lastdaytoshow) {
983 while (($datecurstart < $lastdaytoshow) && (empty($maxrepeat) || ($numofevent < $maxrepeat))) {
984 if ($datecurend >= $firstdaytoshow) {
985 $newevent = $icalevent;
986 unset($newevent[
'RRULE']);
987 if ($icalevent[
'DTSTART;VALUE=DATE']) {
988 $newevent[
'DTSTART;VALUE=DATE'] =
dol_print_date($datecurstart,
'%Y%m%d');
989 $newevent[
'DTEND;VALUE=DATE'] =
dol_print_date($datecurend + 1,
'%Y%m%d');
991 $newevent[
'DTSTART'] = $datecurstart;
992 $newevent[
'DTEND'] = $datecurend;
994 $moreicalevents[] = $newevent;
998 $savdatecurstart = $datecurstart;
999 if ($icalevent[
'RRULE'][
'FREQ'] ==
'DAILY') {
1003 if ($icalevent[
'RRULE'][
'FREQ'] ==
'WEEKLY') {
1006 } elseif ($icalevent[
'RRULE'][
'FREQ'] ==
'MONTHLY') {
1009 } elseif ($icalevent[
'RRULE'][
'FREQ'] ==
'YEARLY') {
1014 if ($savdatecurstart >= $datecurstart) {
1015 dol_syslog(
"Found a rule freq ".$icalevent[
'RRULE'][
'FREQ'].
" not managed by dolibarr code. Assume 1 week frequency.", LOG_ERR);
1016 $datecurstart += 3600 * 24 * 7;
1017 $datecurend += 3600 * 24 * 7;
1022 $icalevents = array_merge($icalevents, $moreicalevents);
1025 foreach ($icalevents as $icalevent) {
1030 if (!empty($icalevent[
'RRULE'])) {
1037 if (isset($icalevent[
'DTSTART;VALUE=DATE'])) {
1040 if (empty($icalevent[
'DTEND;VALUE=DATE'])) {
1041 $dateend = $datestart + 86400 - 1;
1047 $event->fulldayevent = 1;
1049 } elseif (!is_array($icalevent[
'DTSTART'])) {
1050 $datestart = $icalevent[
'DTSTART'];
1051 $dateend = empty($icalevent[
'DTEND']) ? $datestart : $icalevent[
'DTEND'];
1053 $datestart += +($offsettz * 3600);
1054 $dateend += +($offsettz * 3600);
1059 } elseif (isset($icalevent[
'DTSTART'][
'unixtime'])) {
1060 $datestart = $icalevent[
'DTSTART'][
'unixtime'];
1061 $dateend = $icalevent[
'DTEND'][
'unixtime'];
1063 $datestart += +($offsettz * 3600);
1064 $dateend += +($offsettz * 3600);
1067 if ($buggedfile ===
'uselocalandtznodaylight') {
1071 if ($buggedfile ===
'uselocalandtzdaylight') {
1072 $localtzs =
new DateTimeZone((
string) preg_replace(
'/"/',
'', $icalevent[
'DTSTART'][
'TZID']));
1073 $localtze =
new DateTimeZone((
string) preg_replace(
'/"/',
'', $icalevent[
'DTEND'][
'TZID']));
1074 $localdts =
new DateTime(
dol_print_date($datestart,
'dayrfc',
'gmt'), $localtzs);
1075 $localdte =
new DateTime(
dol_print_date($dateend,
'dayrfc',
'gmt'), $localtze);
1076 $tmps = -1 * $localtzs->getOffset($localdts);
1077 $tmpe = -1 * $localtze->getOffset($localdte);
1078 $datestart += $tmps;
1086 $event->id = $icalevent[
'UID'];
1087 $event->ref = (
string) $event->id;
1088 $userId = $userstatic->findUserIdByEmail($namecal);
1089 if (!empty($userId) && $userId > 0) {
1090 $event->userassigned[$userId] = $userId;
1091 $event->percentage = -1;
1094 $event->type_code =
"ICALEVENT";
1095 $event->type_label = $namecal;
1096 $event->type_color = $colorcal;
1097 $event->type =
'icalevent';
1098 $event->type_picto =
'rss';
1100 $event->icalname = $namecal;
1101 $event->icalcolor = $colorcal;
1103 $event->datep = (int) ($datestart + $usertime);
1104 $event->datef = (int) ($dateend + $usertime);
1106 if (isset($icalevent[
'SUMMARY']) && $icalevent[
'SUMMARY']) {
1108 } elseif (isset($icalevent[
'DESCRIPTION']) && $icalevent[
'DESCRIPTION']) {
1111 $event->label = $langs->trans(
"ExtSiteNoLabel");
1118 if (!empty($icalevent[
'PRIORITY'])) {
1119 $event->priority = $icalevent[
'PRIORITY'];
1123 if (!empty($icalevent[
'TRANSP'])) {
1124 if ($icalevent[
'TRANSP'] ==
"TRANSPARENT") {
1125 $event->transparency = 0;
1127 if ($icalevent[
'TRANSP'] ==
"OPAQUE") {
1128 $event->transparency = 1;
1139 if (!empty($icalevent[
'LOCATION'])) {
1140 $event->location = $icalevent[
'LOCATION'];
1143 $event->date_start_in_calendar = $event->datep;
1145 if ((
int) $event->datef != 0 && $event->datef >= $event->datep) {
1146 $event->date_end_in_calendar = $event->datef;
1148 $event->date_end_in_calendar = $event->datep;
1152 if ($event->date_end_in_calendar < $firstdaytoshow || $event->date_start_in_calendar >= $lastdaytoshow) {
1158 if ($event->date_start_in_calendar < $firstdaytoshow) {
1159 $event->date_start_in_calendar = $firstdaytoshow;
1161 if ($event->date_end_in_calendar >= $lastdaytoshow) {
1162 $event->date_end_in_calendar = ($lastdaytoshow - 1);
1166 $daycursor = $event->date_start_in_calendar;
1175 $daykey =
dol_mktime(0, 0, 0, $mois, $jour, $annee,
'gmt');
1176 $daykeygmt =
dol_mktime(0, 0, 0, $mois, $jour, $annee,
'gmt');
1179 $eventarray[$daykey][] = $event;
1180 $daykey += 60 * 60 * 24;
1181 $daykeygmt += 60 * 60 * 24;
1182 if (($event->fulldayevent ? $daykeygmt : $daykey) > $event->date_end_in_calendar) {
1194$parameters = array();
1196$reshook = $hookmanager->executeHooks(
'getCalendarEvents', $parameters, $object, $action);
1197if (!empty($hookmanager->resArray[
'eventarray'])) {
1198 foreach ($hookmanager->resArray[
'eventarray'] as $keyDate => $events) {
1199 if (!isset($eventarray[$keyDate])) {
1200 $eventarray[$keyDate] = array();
1202 $eventarray[$keyDate] = array_merge($eventarray[$keyDate], $events);
1207foreach ($eventarray as $keyDate => &$dateeventarray) {
1208 usort($dateeventarray,
'sort_events_by_date');
1213$cachethirdparties = array();
1214$cachecontacts = array();
1218 array(137, 86, 161),
1219 array(60, 147, 183),
1220 array(250, 190, 80),
1222 array(190, 190, 100),
1223 array(91, 115, 247),
1224 array(140, 140, 220),
1225 array(190, 120, 120),
1226 array(115, 125, 150),
1227 array(100, 170, 20),
1228 array(150, 135, 125),
1229 array(85, 135, 150),
1230 array(150, 135, 80),
1235$color_file = DOL_DOCUMENT_ROOT.
"/theme/".
$conf->theme.
"/theme_vars.inc.php";
1236if (is_readable($color_file)) {
1238 include $color_file;
1242$massactionbutton =
'';
1244print_barre_liste($langs->trans(
"Agenda"), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, 1, -1,
'object_action', 0, $nav.
'<span class="marginleftonly"></span>'.$newcardbutton,
'', $limit, 1, 0, 1, $viewmode);
1246if ($nbevents > $MAXONSAMEPAGE) {
1247 print
info_admin(
'Number of results has been truncated to '.$MAXONSAMEPAGE, 0, 0,
'warning').
'<br>';
1254if (empty($mode) || $mode ==
'show_month') {
1256 $newparam = preg_replace(
'/check_birthday=/i',
'check_birthday_=', $newparam);
1257 $newparam = preg_replace(
'/mode=show_month&?/i',
'', $newparam);
1258 $newparam = preg_replace(
'/mode=show_week&?/i',
'', $newparam);
1259 $newparam = preg_replace(
'/day=[0-9]+&?/i',
'', $newparam);
1260 $newparam = preg_replace(
'/month=[0-9]+&?/i',
'', $newparam);
1261 $newparam = preg_replace(
'/year=[0-9]+&?/i',
'', $newparam);
1262 $newparam = preg_replace(
'/viewcal=[0-9]+&?/i',
'', $newparam);
1263 $newparam = preg_replace(
'/check_birthday_=/i',
'check_birthday=', $newparam);
1264 $newparam .=
'&viewcal=1';
1266 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1267 print_actions_filter($form, $canedit, $status, $year, $month, $day, $check_birthday,
'', $filtert,
'', $pid, $socid, $action, -1, $actioncode, $usergroupids,
'', $resourceid, $search_categ_cus);
1270 print
'<div class="div-table-responsive-no-min sectioncalendarbymonth maxscreenheightless300">';
1271 print
'<table class="centpercent noborder nocellnopadd cal_pannel cal_month listwithfilterbefore">';
1272 print
' <tr class="liste_titre sticky">';
1274 echo
' <td class="center">#</td>';
1277 print
' <td class="center bold uppercase tdfordaytitle'.($i == 0 ?
' borderleft' :
'').
'">';
1279 if (!empty(
$conf->dol_optimize_smallscreen)) {
1280 $labelshort = array(0 =>
'SundayMin', 1 =>
'MondayMin', 2 =>
'TuesdayMin', 3 =>
'WednesdayMin', 4 =>
'ThursdayMin', 5 =>
'FridayMin', 6 =>
'SaturdayMin');
1281 print $langs->trans($labelshort[$numdayinweek]);
1283 print $langs->trans(
"Day".$numdayinweek);
1285 print
' </td>'.
"\n";
1291 $todaytms =
dol_mktime(0, 0, 0, $todayarray[
'mon'], $todayarray[
'mday'], $todayarray[
'year']);
1295 for ($iter_week = 0; $iter_week < 6; $iter_week++) {
1299 $currdate0 = sprintf(
"%04d", $prev_year).sprintf(
"%02d", $prev_month).sprintf(
"%02d", $max_day_in_prev_month + $tmpday);
1300 } elseif ($tmpday <= $max_day_in_month) {
1301 $currdate0 = sprintf(
"%04d", $year).sprintf(
"%02d", $month).sprintf(
"%02d", $tmpday);
1303 $currdate0 = sprintf(
"%04d", $next_year).sprintf(
"%02d", $next_month).sprintf(
"%02d", $tmpday - $max_day_in_month);
1306 $numweek0 =
date(
"W", strtotime(
date($currdate0)));
1308 echo
' <td class="center weeknumber opacitymedium" width="2%">'.$numweek0.
'</td>';
1310 for ($iter_day = 0; $iter_day < 7; $iter_day++) {
1313 $style =
'cal_other_month cal_past';
1314 if ($iter_day == 6) {
1315 $style .=
' cal_other_month_right';
1317 echo
' <td class="'.$style.
' nowrap tdtop" width="14%">';
1319 show_day_events(
$db, $max_day_in_prev_month + $tmpday, $prev_month, $prev_year, $month, $style, $eventarray, $maxprint, $maxnbofchar, $newparam);
1321 } elseif ($tmpday <= $max_day_in_month) {
1323 $curtime =
dol_mktime(0, 0, 0, $month, $tmpday, $year);
1324 $style =
'cal_current_month';
1325 if ($iter_day == 6) {
1326 $style .=
' cal_current_month_right';
1329 if ($todayarray[
'mday'] == $tmpday && $todayarray[
'mon'] == $month && $todayarray[
'year'] == $year) {
1333 $style =
'cal_today';
1335 if ($curtime < $todaytms) {
1336 $style .=
' cal_past';
1339 echo
' <td class="'.$style.
' nowrap tdtop" width="14%">';
1341 show_day_events(
$db, $tmpday, $month, $year, $month, $style, $eventarray, $maxprint, $maxnbofchar, $newparam, 0, 60, 0, $bookcalcalendars);
1345 $style =
'cal_other_month';
1346 if ($iter_day == 6) {
1347 $style .=
' cal_other_month_right';
1349 echo
' <td class="'.$style.
' nowrap tdtop" width="14%">';
1351 show_day_events(
$db, $tmpday - $max_day_in_month, $next_month, $next_year, $month, $style, $eventarray, $maxprint, $maxnbofchar, $newparam);
1361 print
'<input type="hidden" name="actionmove" value="mupdate">';
1362 print
'<input type="hidden" name="backtopage" value="'.dol_escape_htmltag($_SERVER[
'PHP_SELF']).
'?mode=show_month&'.
dol_escape_htmltag($_SERVER[
'QUERY_STRING']).
'">';
1363 print
'<input type="hidden" name="newdate" id="newdate">';
1364} elseif ($mode ==
'show_week') {
1367 $newparam = preg_replace(
'/check_birthday=/i',
'check_birthday_=', $newparam);
1368 $newparam = preg_replace(
'/mode=show_month&?/i',
'', $newparam);
1369 $newparam = preg_replace(
'/mode=show_week&?/i',
'', $newparam);
1370 $newparam = preg_replace(
'/day=[0-9]+&?/i',
'', $newparam);
1371 $newparam = preg_replace(
'/month=[0-9]+&?/i',
'', $newparam);
1372 $newparam = preg_replace(
'/year=[0-9]+&?/i',
'', $newparam);
1373 $newparam = preg_replace(
'/viewweek=[0-9]+&?/i',
'', $newparam);
1374 $newparam = preg_replace(
'/check_birthday_=/i',
'check_birthday=', $newparam);
1375 $newparam .=
'&viewweek=1';
1377 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1378 print_actions_filter($form, $canedit, $status, $year, $month, $day, $check_birthday,
'', $filtert,
'', $pid, $socid, $action, -1, $actioncode, $usergroupids,
'', $resourceid);
1381 print
'<div class="div-table-responsive-no-min sectioncalendarbyweek maxscreenheightless300">';
1382 print
'<table class="centpercent noborder nocellnopadd cal_pannel cal_month listwithfilterbefore">';
1383 print
' <tr class="liste_titre">';
1386 echo
' <td class="center bold uppercase tdfordaytitle">'.$langs->trans(
"Day".(($i + (
getDolGlobalInt(
'MAIN_START_WEEK', 1))) % 7)).
"</td>\n";
1391 echo
' <tr class="trcalweek">'.
"\n";
1393 for ($iter_day = 0; $iter_day < 7; $iter_day++) {
1400 $style =
'cal_current_month';
1401 if ($iter_day == 6) {
1402 $style .=
' cal_other_month_right';
1407 if ($todayarray[
'mday'] == $tmpday && $todayarray[
'mon'] == $tmpmonth && $todayarray[
'year'] == $tmpyear) {
1411 $style =
'cal_today';
1414 echo
' <td class="'.$style.
'" width="14%" valign="top">';
1416 show_day_events(
$db, $tmpday, $tmpmonth, $tmpyear, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300, 0, $bookcalcalendars);
1424 echo
'<input type="hidden" name="actionmove" value="mupdate">';
1425 echo
'<input type="hidden" name="backtopage" value="'.dol_escape_htmltag($_SERVER[
'PHP_SELF']).
'?mode=show_week&'.
dol_escape_htmltag($_SERVER[
'QUERY_STRING']).
'">';
1426 echo
'<input type="hidden" name="newdate" id="newdate">';
1429 $newparam = preg_replace(
'/mode=show_month&?/i',
'', $newparam);
1430 $newparam = preg_replace(
'/mode=show_week&?/i',
'', $newparam);
1431 $newparam = preg_replace(
'/viewday=[0-9]+&?/i',
'', $newparam);
1432 $newparam .=
'&viewday=1';
1434 $style =
'cal_current_month cal_current_month_oneday';
1437 if ($todayarray[
'mday'] == $day && $todayarray[
'mon'] == $month && $todayarray[
'year'] == $year) {
1442 $timestamp =
dol_mktime(12, 0, 0, $month, $day, $year);
1445 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1446 print_actions_filter($form, $canedit, $status, $year, $month, $day, $check_birthday,
'', $filtert,
'', $pid, $socid, $action, -1, $actioncode, $usergroupids,
'', $resourceid);
1449 print
'<div class="div-table-responsive-no-min sectioncalendarbyday maxscreenheightless300">';
1450 echo
'<table class="tagtable centpercent noborder nocellnopadd cal_pannel cal_month listwithfilterbefore" style="margin-bottom: 10px !important;">';
1452 echo
' <tr class="tagtr liste_titre">';
1453 echo
' <td class="tagtd center bold uppercase">'.$langs->trans(
"Day".$arraytimestamp[
'wday']).
"</td>\n";
1465 print
'<tr class="trcalday"><td class="tdtop">';
1470 print
'<div class="div-table-responsive-no-min">';
1472 $maxheightwin = (isset($_SESSION[
"dol_screenheight"]) && $_SESSION[
"dol_screenheight"] > 500) ? ($_SESSION[
"dol_screenheight"] - 200) : 660;
1474 echo
'<div style="max-height: '.$maxheightwin.
'px;">';
1475 echo
'<div class="tagtable centpercent calendarviewcontainer">';
1480 $minhour = round((
float) $tmp[0], 0);
1481 $maxhour = round((
float) $tmp[1], 0);
1482 if ($minhour > 23) {
1488 if ($maxhour <= $minhour) {
1489 $maxhour = $minhour + 1;
1495 echo
' <div class="tagtr calendarviewcontainertr">'.
"\n";
1496 echo
' <div class="tagtd width100 tdtop">'.dol_print_date($i * 3600,
'hour',
'gmt').
'</div>';
1497 echo
' <div class="tagtd '.$style.
' tdtop"></div>'.
"\n";
1498 echo
' </div>'.
"\n";
1503 echo
'</div></div>';
1506 show_day_events(
$db, $day, $month, $year, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300, 1, $bookcalcalendars);
1510 print
'<div class="div-table-responsive-no-min">';
1513 show_day_events(
$db, $day, $month, $year, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300, 0, $bookcalcalendars);
1525print
"\n".
'</form>';
1542 if ($a->type_code ===
'HOLIDAY') {
1545 if ($b->type_code ===
'HOLIDAY') {
1553 if ($a->datep !== $b->datep) {
1554 return (
int) ($a->datep - $b->datep);
1558 if ((!is_numeric($b->datef)) || (!is_numeric($a->datef))) {
1563 if ($b->datef === $a->datef) {
1568 return (
int) ($b->datef - $a->datef);
1583 if ($a->percentage < 0) {
1587 if ($b->percentage < 0) {
1591 return (
int) ($b->percentage - $a->percentage);
if(! $sortfield) if(! $sortorder) $object
agenda_get_birthday_events($db, $langs, $user, $mode, $month, $day, $year, &$eventarray, &$nbevents)
Complete an agenda calendar event array with contact birthday pseudo-events.
print_actions_filter( $form, $canedit, $status, $year, $month, $day, $showbirthday, $filtera, $filtert, $filtered, $pid, $socid, $action, $showextcals=array(), $actioncode='', $usergroupid=0, $excludetype='', $resourceid=0, $search_categ_cus=0, $search_import_key='')
Show filter form in agenda view.
calendars_prepare_head($param)
Define head array for tabs of agenda setup pages.
agenda_build_eventarray($db, $hookmanager, $user, &$object, &$action, $mode, $year, $month, $day, $firstdaytoshow, $lastdaytoshow, $filters, $sincedatec=null)
Build $eventarray (list of ActionComm objects, indexed by day) for the agenda calendar views (month/w...
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage agenda events (actions)
Class to read/parse ICal calendars.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage Dolibarr users.
sort_events_by_percentage($a, $b)
Sort events by percentage.
sort_events_by_date($a, $b)
Sort events by date.
dol_get_prev_month($month, $year)
Return previous month.
dol_get_first_hour($date, $gm='tzserver')
Return GMT time for first hour of a given GMT date (it removes hours, min and second part)
dol_get_next_day($day, $month, $year)
Return next day.
dol_get_next_week($day, $week, $month, $year)
Return next week.
dol_get_first_day_week($day, $month, $year, $gm=false)
Return first day of week for a date.
dol_get_prev_day($day, $month, $year)
Return previous day.
dol_get_first_day($year, $month=1, $gm=false)
Return GMT time for first day of a month or year.
dol_get_next_month($month, $year)
Return next month.
dol_time_plus_duree($time, $duration_value, $duration_unit, $ruleforendofmonth=0)
Add a delay to a date.
dol_stringtotime($string, $gm=1)
Convert a string date into a GM Timestamps date Warning: YYYY-MM-DDTHH:MM:SS+02:00 (RFC3339) is not s...
dol_get_last_day($year, $month=12, $gm=false)
Return GMT time for last day of a month or year.
dol_now($mode='gmt')
Return date for now.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
dol_string_nohtmltag($stringtoclean, $removelinefeed=1, $pagecodeto='UTF-8', $strip_tags=0, $removedoublespaces=1)
Clean a string from all HTML tags and entities.
dol_nl2br($stringtoencode, $nl2brmode=0, $forxml=false)
Replace CRLF in string with a HTML BR tag.
dol_sanitizePathName($str, $newstr='_', $unaccent=0, $allowdash=0)
Clean a string to use it as a path name.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0, $allowdash=0)
Clean a string to use it as a file name.
getDolUserString($key, $default='', $tmpuser=null)
Return Dolibarr user constant string value.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_clone($srcobject, $native=2)
Create a clone of instance of object (new instance with same value for each properties) With native =...
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_getdate($timestamp, $fast=false, $forcetimezone='')
Return an array with locale date info.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
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_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='', $textonpictotooltip='', $cssfordropdown='info_admin')
Show information in HTML for admin users or standard users.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
conf($dolibarr_main_document_root, $realpathconf=null)
Load conf file (file must exists)
print $langs trans("Show") . '< td style="' . $timeColor . '" align="center"> s</td > badge status0 badge status4 badge status3 Error badge status8< td align="center">< span class="badge ' . $badge . '"></span ></td >< td align="center">< a href="#" class="button button-small" onclick="openLogModal(this)" data-req="' . dol_escape_htmltag($reqSafe) . '" data-res="' . dol_escape_htmltag($resSafe) . '" data-err="' . dol_escape_htmltag($errSafe) . '">< span class="fa fa-search-plus"></span ></a ></td ></tr >< tr >< td colspan="' . $colspan . '" class="opacitymedium"></td ></tr ></table ></div ></form > logModal none logModal none s a JSON string
print $langs trans('Date')." left Ref Label right Qty right Price right TotalHT right TotalTTC right right right right right right right right right centpercent right TotalHT right n right VAT right n right TotalVAT right n No sujeto a RE IRPF right TotalLT1 right n right TotalLT2 right n right TotalTTC right n takeposcustomercurrency takeposcustomercurrency takeposcustomercurrency takeposcustomercurrency right TotalTTC takeposcustomercurrency right takeposcustomercurrency n right Paid right PaymentTypeShortLIQ right SELECT p pos_change as p datep as date
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.