32 require
'../../main.inc.php';
33 require_once DOL_DOCUMENT_ROOT.
'/comm/action/class/actioncomm.class.php';
34 require_once DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php';
35 require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
36 require_once DOL_DOCUMENT_ROOT.
'/user/class/usergroup.class.php';
37 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
38 require_once DOL_DOCUMENT_ROOT.
'/core/lib/agenda.lib.php';
39 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
40 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
43 if (!isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) {
44 $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW = 3;
47 $action =
GETPOST(
'action',
'aZ09');
49 $disabledefaultvalues =
GETPOST(
'disabledefaultvalues',
'int');
51 $filter =
GETPOST(
"search_filter",
'alpha', 3) ?
GETPOST(
"search_filter",
'alpha', 3) :
GETPOST(
"filter",
'alpha', 3);
52 $filtert =
GETPOST(
"search_filtert",
"int", 3) ?
GETPOST(
"search_filtert",
"int", 3) :
GETPOST(
"filtert",
"int", 3);
53 $usergroup =
GETPOST(
"search_usergroup",
"int", 3) ?
GETPOST(
"search_usergroup",
"int", 3) :
GETPOST(
"usergroup",
"int", 3);
64 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
65 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
67 if (empty($page) || $page == -1) {
70 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
71 $offset = $limit * $page;
76 $sortfield =
"a.datec";
81 $socid = $user->socid;
88 if (empty($user->rights->agenda->myactions->read)) {
91 if (empty($user->rights->agenda->allactions->read)) {
94 if (empty($user->rights->agenda->allactions->read) || $filter ==
'mine') {
98 $mode =
'show_peruser';
99 $resourceid =
GETPOST(
"search_resourceid",
"int") ?
GETPOST(
"search_resourceid",
"int") :
GETPOST(
"resourceid",
"int");
100 $year =
GETPOST(
"year",
"int") ?
GETPOST(
"year",
"int") : date(
"Y");
101 $month =
GETPOST(
"month",
"int") ?
GETPOST(
"month",
"int") : date(
"m");
102 $week =
GETPOST(
"week",
"int") ?
GETPOST(
"week",
"int") : date(
"W");
107 $maxprint = ((
GETPOST(
"maxprint",
'int') !=
'') ?
GETPOST(
"maxprint",
'int') : $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW);
108 $optioncss =
GETPOST(
'optioncss',
'aZ');
110 if (
GETPOST(
'search_actioncode',
'array:aZ09')) {
111 $actioncode =
GETPOST(
'search_actioncode',
'array:aZ09', 3);
112 if (!count($actioncode)) {
116 $actioncode =
GETPOST(
"search_actioncode",
"alpha", 3) ?
GETPOST(
"search_actioncode",
"alpha", 3) : (
GETPOST(
"search_actioncode",
"alpha") ==
'0' ?
'0' : ((empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) || $disabledefaultvalues) ?
'' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE));
120 if ($dateselect > 0) {
121 $day =
GETPOST(
'dateselectday',
'int');
122 $month =
GETPOST(
'dateselectmonth',
'int');
123 $year =
GETPOST(
'dateselectyear',
'int');
126 $tmp = empty($conf->global->MAIN_DEFAULT_WORKING_HOURS) ?
'9-18' : $conf->global->MAIN_DEFAULT_WORKING_HOURS;
127 $tmp = str_replace(
' ',
'', $tmp);
128 $tmparray = explode(
'-', $tmp);
129 $begin_h =
GETPOST(
'begin_h',
'int') !=
'' ?
GETPOST(
'begin_h',
'int') : ($tmparray[0] !=
'' ? $tmparray[0] : 9);
130 $end_h =
GETPOST(
'end_h',
'int') ?
GETPOST(
'end_h',
'int') : ($tmparray[1] !=
'' ? $tmparray[1] : 18);
131 if ($begin_h < 0 || $begin_h > 23) {
134 if ($end_h < 1 || $end_h > 24) {
137 if ($end_h <= $begin_h) {
138 $end_h = $begin_h + 1;
141 $tmp = empty($conf->global->MAIN_DEFAULT_WORKING_DAYS) ?
'1-5' : $conf->global->MAIN_DEFAULT_WORKING_DAYS;
142 $tmp = str_replace(
' ',
'', $tmp);
143 $tmparray = explode(
'-', $tmp);
144 $begin_d =
GETPOST(
'begin_d',
'int') ?
GETPOST(
'begin_d',
'int') : ($tmparray[0] !=
'' ? $tmparray[0] : 1);
145 $end_d =
GETPOST(
'end_d',
'int') ?
GETPOST(
'end_d',
'int') : ($tmparray[1] !=
'' ? $tmparray[1] : 5);
146 if ($begin_d < 1 || $begin_d > 7) {
149 if ($end_d < 1 || $end_d > 7) {
152 if ($end_d < $begin_d) {
153 $end_d = $begin_d + 1;
157 $status = ((empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS) || $disabledefaultvalues) ?
'' : $conf->global->AGENDA_DEFAULT_FILTER_STATUS);
161 $mode = (empty($conf->global->AGENDA_DEFAULT_VIEW) ?
'show_month' : $conf->global->AGENDA_DEFAULT_VIEW);
164 if (
GETPOST(
'viewcal',
'alpha') && $mode !=
'show_day' && $mode !=
'show_week' && $mode !=
'show_peruser') {
165 $mode =
'show_month'; $day =
'';
167 if (
GETPOST(
'viewweek',
'alpha') || $mode ==
'show_week') {
168 $mode =
'show_week'; $week = ($week ? $week : date(
"W")); $day = ($day ? $day : date(
"d"));
170 if (
GETPOST(
'viewday',
'alpha') || $mode ==
'show_day') {
171 $mode =
'show_day'; $day = ($day ? $day : date(
"d"));
177 $langs->loadLangs(array(
'users',
'agenda',
'other',
'commercial'));
180 $hookmanager->initHooks(array(
'agenda'));
183 if ($user->socid && $socid) {
187 $search_status = $status;
218 'maxprint' => $maxprint,
220 'filtert' => $filtert,
221 'showbirthday' => $showbirthday,
222 'canedit' => $canedit,
223 'optioncss' => $optioncss,
224 'actioncode' => $actioncode,
226 'resourceid' => $resourceid,
227 'usergroup' => $usergroup,
229 $reshook = $hookmanager->executeHooks(
'beforeAgendaPerUser', $parameters, $object, $action);
235 $companystatic =
new Societe($db);
237 $help_url =
'EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda';
242 $nowyear = $nowarray[
'year'];
243 $nowmonth = $nowarray[
'mon'];
244 $nowday = $nowarray[
'mday'];
248 $listofextcals = array();
251 $first_day = $prev[
'first_day'];
252 $first_month = $prev[
'first_month'];
253 $first_year = $prev[
'first_year'];
255 $week = $prev[
'week'];
259 $next_year = $next[
'year'];
260 $next_month = $next[
'month'];
261 $next_day = $next[
'day'];
263 $max_day_in_month = date(
"t",
dol_mktime(0, 0, 0, $month, 1, $year));
265 $tmpday = $first_day;
269 $title = $langs->trans(
"DoneAndToDoActions");
270 if ($status ==
'done') {
271 $title = $langs->trans(
"DoneActions");
273 if ($status ==
'todo') {
274 $title = $langs->trans(
"ToDoActions");
279 if (is_array($actioncode)) {
280 foreach ($actioncode as $str_action) {
281 $param .=
"&search_actioncode[]=".urlencode($str_action);
284 $param .=
"&search_actioncode=".urlencode($actioncode);
287 if ($resourceid > 0) {
288 $param .=
"&search_resourceid=".urlencode($resourceid);
292 $param .=
"&search_status=".urlencode($status);
295 $param .=
"&search_filter=".urlencode($filter);
298 $param .=
"&search_filtert=".urlencode($filtert);
300 if ($usergroup > 0) {
301 $param .=
"&search_usergroup=".urlencode($usergroup);
304 $param .=
"&search_socid=".urlencode($socid);
307 $param .=
"&search_showbirthday=1";
310 $param .=
"&search_projectid=".urlencode($pid);
313 $param .=
"&search_type=".urlencode($type);
315 if ($mode !=
'show_peruser') {
316 $param .=
'&mode='.urlencode($mode);
318 if ($begin_h !=
'') {
319 $param .=
'&begin_h='.urlencode($begin_h);
322 $param .=
'&end_h='.urlencode($end_h);
324 if ($begin_d !=
'') {
325 $param .=
'&begin_d='.urlencode($begin_d);
328 $param .=
'&end_d='.urlencode($end_d);
330 $param .=
"&maxprint=".urlencode($maxprint);
332 $paramnoactionodate = $param;
337 $prev_year = $prev[
'prev_year'];
338 $prev_month = $prev[
'prev_month'];
339 $prev_day = $prev[
'prev_day'];
340 $first_day = $prev[
'first_day'];
341 $first_month = $prev[
'first_month'];
342 $first_year = $prev[
'first_year'];
344 $week = $prev[
'week'];
348 $next_year = $next[
'year'];
349 $next_month = $next[
'month'];
350 $next_day = $next[
'day'];
354 $firstdaytoshow =
dol_mktime(0, 0, 0, $first_month, $first_day, $first_year,
'tzuserrel');
355 $nb_weeks_to_show = (!empty($conf->global->AGENDA_NB_WEEKS_IN_VIEW_PER_USER)) ? ((
int) $conf->global->AGENDA_NB_WEEKS_IN_VIEW_PER_USER * 7) : 7;
361 $max_day_in_month = date(
"t",
dol_mktime(0, 0, 0, $month, 1, $year,
'gmt'));
363 $tmpday = $first_day;
364 $picto =
'calendarweek';
366 $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";
367 $nav .=
" <span id=\"month_name\">".dol_print_date(
dol_mktime(0, 0, 0, $first_month, $first_day, $first_year),
"%Y").
", ".$langs->trans(
"Week").
" ".$week;
368 $nav .=
" </span>\n";
369 $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";
370 if (empty($conf->dol_optimize_smallscreen)) {
371 $nav .=
" <a href=\"?year=".$nowyear.
"&month=".$nowmonth.
"&day=".$nowday.$param.
"\">".$langs->trans(
"Today").
"</a> ";
373 $nav .=
$form->selectDate($dateselect,
'dateselect', 0, 0, 1,
'', 1, 0);
374 $nav .=
' <button type="submit" class="liste_titre button_search" name="button_search_x" value="x"><span class="fa fa-search"></span></button>';
377 $param .=
'&year='.urlencode($year).
'&month='.urlencode($month).($day ?
'&day='.urlencode($day) :
'');
381 $paramnoaction = preg_replace(
'/action=[a-z_]+/',
'', $param);
385 print
'<form method="POST" id="searchFormList" class="listactionsfilter" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
387 $showextcals = $listofextcals;
389 if ($conf->use_javascript_ajax) {
391 $s .=
'<script type="text/javascript">'.
"\n";
392 $s .=
'jQuery(document).ready(function () {'.
"\n";
393 $s .=
'jQuery("#check_mytasks").click(function() { jQuery(".family_mytasks").toggle(); jQuery(".family_other").toggle(); });'.
"\n";
394 $s .=
'jQuery("#check_birthday").click(function() { jQuery(".family_birthday").toggle(); });'.
"\n";
395 $s .=
'jQuery(".family_birthday").toggle();'.
"\n";
396 if ($mode ==
"show_week" || $mode ==
"show_month" || empty($mode)) {
397 $s .=
'jQuery( "td.sortable" ).sortable({connectWith: ".sortable",placeholder: "ui-state-highlight",items: "div:not(.unsortable)", receive: function( event, ui ) {';
400 $s .=
'</script>'.
"\n";
401 if (!empty($conf->use_javascript_ajax)) {
402 $s .=
'<div class="nowrap clear float"><input type="checkbox" id="check_mytasks" name="check_mytasks" checked disabled> '.$langs->trans(
"LocalAgenda").
' </div>';
403 if (is_array($showextcals) && count($showextcals) > 0) {
404 foreach ($showextcals as $val) {
405 $htmlname = md5($val[
'name']);
406 $s .=
'<script type="text/javascript">'.
"\n";
407 $s .=
'jQuery(document).ready(function () {'.
"\n";
408 $s .=
' jQuery("#check_ext'.$htmlname.
'").click(function() {';
409 $s .=
' /* alert("'.$htmlname.
'"); */';
410 $s .=
' jQuery(".family_ext'.$htmlname.
'").toggle();';
413 $s .=
'</script>'.
"\n";
414 $s .=
'<div class="nowrap float"><input type="checkbox" id="check_ext'.$htmlname.
'" name="check_ext'.$htmlname.
'" checked> '.$val [
'name'].
' </div>';
421 $parameters = array();
422 $reshook = $hookmanager->executeHooks(
'addCalendarChoice', $parameters, $object, $action);
423 if (empty($reshook)) {
424 $s .= $hookmanager->resPrint;
425 } elseif ($reshook > 1) {
426 $s = $hookmanager->resPrint;
431 $massactionbutton =
'';
434 $viewmode .=
'<a class="btnTitle reposition" href="'.DOL_URL_ROOT.
'/comm/action/list.php?mode=show_list&restore_lastsearch_values=1'.$paramnoactionodate.
'">';
436 $viewmode .=
img_picto($langs->trans(
"List"),
'object_calendarlist',
'class="imgforviewmode pictoactionview block"');
438 $viewmode .=
'<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone">'.$langs->trans(
"ViewList").
'</span></a>';
440 $viewmode .=
'<a class="btnTitle reposition" href="'.DOL_URL_ROOT.
'/comm/action/index.php?mode=show_month&year='.
dol_print_date($object->datep,
'%Y').
'&month='.
dol_print_date($object->datep,
'%m').
'&day='.
dol_print_date($object->datep,
'%d').$paramnoactionodate.
'">';
442 $viewmode .=
img_picto($langs->trans(
"ViewCal"),
'object_calendarmonth',
'class="pictoactionview block"');
444 $viewmode .=
'<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone">'.$langs->trans(
"ViewCal").
'</span></a>';
446 $viewmode .=
'<a class="btnTitle reposition" href="'.DOL_URL_ROOT.
'/comm/action/index.php?mode=show_week&year='.
dol_print_date($object->datep,
'%Y').
'&month='.
dol_print_date($object->datep,
'%m').
'&day='.
dol_print_date($object->datep,
'%d').$paramnoactionodate.
'">';
448 $viewmode .=
img_picto($langs->trans(
"ViewWeek"),
'object_calendarweek',
'class="pictoactionview block"');
450 $viewmode .=
'<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone">'.$langs->trans(
"ViewWeek").
'</span></a>';
452 $viewmode .=
'<a class="btnTitle reposition" href="'.DOL_URL_ROOT.
'/comm/action/index.php?mode=show_day&year='.
dol_print_date($object->datep,
'%Y').
'&month='.
dol_print_date($object->datep,
'%m').
'&day='.
dol_print_date($object->datep,
'%d').$paramnoactionodate.
'">';
454 $viewmode .=
img_picto($langs->trans(
"ViewDay"),
'object_calendarday',
'class="pictoactionview block"');
456 $viewmode .=
'<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone">'.$langs->trans(
"ViewDay").
'</span></a>';
458 $viewmode .=
'<a class="btnTitle btnTitleSelected reposition marginrightonly" href="'.DOL_URL_ROOT.
'/comm/action/peruser.php?mode=show_peruser&year='.
dol_print_date($object->datep,
'%Y').
'&month='.
dol_print_date($object->datep,
'%m').
'&day='.
dol_print_date($object->datep,
'%d').$paramnoactionodate.
'">';
460 $viewmode .=
img_picto($langs->trans(
"ViewPerUser"),
'object_calendarperuser',
'class="pictoactionview block"');
462 $viewmode .=
'<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone">'.$langs->trans(
"ViewPerUser").
'</span></a>';
464 $viewmode .=
'<span class="marginrightonly"></span>';
467 $parameters = array(); $object =
null;
468 $reshook = $hookmanager->executeHooks(
'addCalendarView', $parameters, $object, $action);
469 if (empty($reshook)) {
470 $viewmode .= $hookmanager->resPrint;
471 } elseif ($reshook > 1) {
472 $viewmode = $hookmanager->resPrint;
478 if ($user->rights->agenda->myactions->create || $user->rights->agenda->allactions->create) {
481 $newparam .=
'&month='.urlencode(str_pad($month, 2,
"0", STR_PAD_LEFT)).
'&year='.urlencode($tmpforcreatebutton[
'year']);
482 if ($begin_h !==
'') {
483 $newparam .=
'&begin_h='.urlencode($begin_h);
486 $newparam .=
'&end_h='.urlencode($end_h);
488 if ($begin_d !==
'') {
489 $newparam .=
'&begin_d='.urlencode($begin_d);
492 $newparam .=
'&end_d='.urlencode($end_d);
496 $hourminsec =
'100000';
497 $newcardbutton .=
dolGetButtonTitle($langs->trans(
"AddAction"),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/comm/action/card.php?action=create&datep='.sprintf(
"%04d%02d%02d", $tmpforcreatebutton[
'year'], $tmpforcreatebutton[
'mon'], $tmpforcreatebutton[
'mday']).$hourminsec.
'&backtopage='.urlencode($_SERVER[
"PHP_SELF"].($newparam ?
'?'.$newparam :
'')));
502 print_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);
508 $newtitle =
'<div class="nowrap clear inline-block minheight30">';
509 $newtitle .=
'<input type="checkbox" id="check_mytasks" name="check_mytasks" checked disabled> '.$langs->trans(
"LocalAgenda").
' ';
510 $newtitle .=
'</div>';
517 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
518 print_actions_filter(
$form, $canedit, $search_status, $year, $month, $day, $showbirthday, 0, $filtert, 0, $pid, $socid, $action, -1, $actioncode, $usergroup,
'', $resourceid);
523 $eventarray = array();
528 if ($usergroup > 0) {
531 $sql .=
' a.id, a.label,';
533 $sql .=
' a.datep2,';
534 $sql .=
' a.percent,';
535 $sql .=
' a.fk_user_author,a.fk_user_action,';
536 $sql .=
' a.transparency, a.priority, a.fulldayevent, a.location,';
537 $sql .=
' a.fk_soc, a.fk_contact, a.fk_element, a.elementtype, a.fk_project,';
538 $sql .=
' ca.code, ca.libelle as type_label, ca.color, ca.type as type_type, ca.picto as type_picto';
539 $sql .=
' FROM '.MAIN_DB_PREFIX.
'c_actioncomm as ca, '.MAIN_DB_PREFIX.
"actioncomm as a";
540 if (empty($user->rights->societe->client->voir) && !$socid) {
541 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
544 if ($resourceid > 0) {
545 $sql .=
", ".MAIN_DB_PREFIX.
"element_resources as r";
548 if ($filtert > 0 || $usergroup > 0) {
549 $sql .=
", ".MAIN_DB_PREFIX.
"actioncomm_resources as ar";
551 if ($usergroup > 0) {
552 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"usergroup_user as ugu ON ugu.fk_user = ar.fk_element";
554 $sql .=
' WHERE a.fk_action = ca.id';
555 $sql .=
' AND a.entity IN ('.getEntity(
'agenda').
')';
557 if (!empty($actioncode)) {
558 if (empty($conf->global->AGENDA_USE_EVENT_TYPE)) {
559 if ($actioncode ==
'AC_NON_AUTO') {
560 $sql .=
" AND ca.type != 'systemauto'";
561 } elseif ($actioncode ==
'AC_ALL_AUTO') {
562 $sql .=
" AND ca.type = 'systemauto'";
564 if ($actioncode ==
'AC_OTH') {
565 $sql .=
" AND ca.type != 'systemauto'";
567 if ($actioncode ==
'AC_OTH_AUTO') {
568 $sql .=
" AND ca.type = 'systemauto'";
572 if ($actioncode ==
'AC_NON_AUTO') {
573 $sql .=
" AND ca.type != 'systemauto'";
574 } elseif ($actioncode ==
'AC_ALL_AUTO') {
575 $sql .=
" AND ca.type = 'systemauto'";
577 if (is_array($actioncode)) {
578 $sql .=
" AND ca.code IN (".$db->sanitize(
"'".implode(
"','", $actioncode).
"'", 1).
")";
580 $sql .=
" AND ca.code IN (".$db->sanitize(
"'".implode(
"','", explode(
',', $actioncode)).
"'", 1).
")";
585 if ($resourceid > 0) {
586 $sql .=
" AND r.element_type = 'action' AND r.element_id = a.id AND r.resource_id = ".((int) $resourceid);
589 $sql .=
" AND a.fk_project = ".((int) $pid);
591 if (empty($user->rights->societe->client->voir) && !$socid) {
592 $sql .=
" AND (a.fk_soc IS NULL OR sc.fk_user = ".((int) $user->id).
")";
595 $sql .=
' AND a.fk_soc = '.((int) $socid);
598 if ($filtert > 0 || $usergroup > 0) {
599 $sql .=
" AND ar.fk_actioncomm = a.id AND ar.element_type='user'";
601 if ($mode ==
'show_day') {
603 $sql .=
" (a.datep BETWEEN '".$db->idate(
dol_mktime(0, 0, 0, $month, $day, $year,
'tzuserrel')).
"'";
604 $sql .=
" AND '".$db->idate(
dol_mktime(23, 59, 59, $month, $day, $year,
'tzuserrel')).
"')";
606 $sql .=
" (a.datep2 BETWEEN '".$db->idate(
dol_mktime(0, 0, 0, $month, $day, $year,
'tzuserrel')).
"'";
607 $sql .=
" AND '".$db->idate(
dol_mktime(23, 59, 59, $month, $day, $year,
'tzuserrel')).
"')";
609 $sql .=
" (a.datep < '".$db->idate(
dol_mktime(0, 0, 0, $month, $day, $year,
'tzuserrel')).
"'";
610 $sql .=
" AND a.datep2 > '".$db->idate(
dol_mktime(23, 59, 59, $month, $day, $year,
'tzuserrel')).
"')";
615 $sql .=
" (a.datep BETWEEN '".$db->idate($firstdaytoshow - (60 * 60 * 24 * 2)).
"'";
616 $sql .=
" AND '".$db->idate($lastdaytoshow + (60 * 60 * 24 * 2)).
"')";
618 $sql .=
" (a.datep2 BETWEEN '".$db->idate($firstdaytoshow - (60 * 60 * 24 * 2)).
"'";
619 $sql .=
" AND '".$db->idate($lastdaytoshow + (60 * 60 * 24 * 2)).
"')";
621 $sql .=
" (a.datep < '".$db->idate($firstdaytoshow - (60 * 60 * 24 * 2)).
"'";
622 $sql .=
" AND a.datep2 > '".$db->idate($lastdaytoshow + (60 * 60 * 24 * 2)).
"')";
626 $sql .=
" AND ca.id = ".((int) $type);
628 if ($status ==
'0') {
629 $sql .=
" AND a.percent = 0";
631 if ($status ==
'na') {
633 $sql .=
" AND a.percent = -1";
635 if ($status ==
'50') {
637 $sql .=
" AND (a.percent > 0 AND a.percent < 100)";
639 if ($status ==
'done' || $status ==
'100') {
640 $sql .=
" AND (a.percent = 100)";
642 if ($status ==
'todo') {
643 $sql .=
" AND (a.percent >= 0 AND a.percent < 100)";
646 if ($filtert > 0 || $usergroup > 0) {
649 $sql .=
"ar.fk_element = ".$filtert;
651 if ($usergroup > 0) {
652 $sql .= ($filtert > 0 ?
" OR " :
"").
" ugu.fk_usergroup = ".((
int) $usergroup);
657 $sql .=
' ORDER BY fk_user_action, datep';
661 dol_syslog(
"comm/action/peruser.php", LOG_DEBUG);
662 $resql = $db->query($sql);
664 $num = $db->num_rows(
$resql);
668 $obj = $db->fetch_object(
$resql);
672 if (!empty($conf->global->AGENDA_ALWAYS_HIDE_AUTO) && $obj->code ==
'AC_OTH_AUTO') {
677 $datep = $db->jdate($obj->datep);
678 $datep2 = $db->jdate($obj->datep2);
683 $event->id = $obj->id;
684 $event->datep = $datep;
685 $event->datef = $datep2;
686 $event->type_code = $obj->code;
687 $event->type_color = $obj->color;
688 $event->label = $obj->label;
689 $event->percentage = $obj->percent;
690 $event->authorid = $obj->fk_user_author;
691 $event->userownerid = $obj->fk_user_action;
692 $event->priority = $obj->priority;
693 $event->fulldayevent = $obj->fulldayevent;
694 $event->location = $obj->location;
695 $event->transparency = $obj->transparency;
697 $event->fk_project = $obj->fk_project;
699 $event->socid = $obj->fk_soc;
700 $event->contact_id = $obj->fk_contact;
702 $event->fk_element = $obj->fk_element;
703 $event->elementtype = $obj->elementtype;
707 if ($event->percentage <= 0) {
708 $event->date_start_in_calendar = $datep;
709 if ($datep2 !=
'' && $datep2 >= $datep) {
710 $event->date_end_in_calendar = $datep2;
712 $event->date_end_in_calendar = $datep;
715 $event->date_start_in_calendar = $datep;
716 if ($datep2 !=
'' && $datep2 >= $datep) {
717 $event->date_end_in_calendar = $datep2;
719 $event->date_end_in_calendar = $datep;
726 if ($event->date_end_in_calendar < $firstdaytoshow ||
727 $event->date_start_in_calendar >= $lastdaytoshow) {
732 $event->fetch_userassigned();
734 if ($event->date_start_in_calendar < $firstdaytoshow) {
735 $event->date_start_in_calendar = $firstdaytoshow;
737 if ($event->date_end_in_calendar >= $lastdaytoshow) {
738 $event->date_end_in_calendar = ($lastdaytoshow - 1);
742 $daycursor = $event->date_start_in_calendar;
749 $loop =
true; $j = 0;
750 $daykey =
dol_mktime(0, 0, 0, $mois, $jour, $annee,
'gmt');
754 $eventarray[$daykey][] = $event;
757 $daykey += 60 * 60 * 24;
758 if ($daykey > $event->date_end_in_calendar) {
774 $cachethirdparties = array();
775 $cachecontacts = array();
776 $cacheusers = array();
779 $color_file = DOL_DOCUMENT_ROOT.
"/theme/".$conf->theme.
"/theme_vars.inc.php";
780 if (is_readable($color_file)) {
783 if (!is_array($theme_datacolor)) {
784 $theme_datacolor = array(array(120, 130, 150), array(200, 160, 180), array(190, 190, 220));
789 $newparam = preg_replace(
'/showbirthday=/i',
'showbirthday_=', $newparam);
790 $newparam = preg_replace(
'/mode=show_month&?/i',
'', $newparam);
791 $newparam = preg_replace(
'/mode=show_week&?/i',
'', $newparam);
792 $newparam = preg_replace(
'/day=[0-9]+&?/i',
'', $newparam);
793 $newparam = preg_replace(
'/month=[0-9]+&?/i',
'', $newparam);
794 $newparam = preg_replace(
'/year=[0-9]+&?/i',
'', $newparam);
795 $newparam = preg_replace(
'/viewweek=[0-9]+&?/i',
'', $newparam);
796 $newparam = preg_replace(
'/showbirthday_=/i',
'showbirthday=', $newparam);
797 $newparam .=
'&viewweek=1';
799 echo
'<input type="hidden" name="actionmove" value="mupdate">';
800 echo
'<input type="hidden" name="backtopage" value="'.dol_escape_htmltag($_SERVER[
'PHP_SELF']).
'?'.
dol_escape_htmltag($_SERVER[
'QUERY_STRING']).
'">';
801 echo
'<input type="hidden" name="newdate" id="newdate">';
808 $currentdaytoshow = $firstdaytoshow;
809 echo
'<div class="div-table-responsive">';
812 while ($currentdaytoshow < $lastdaytoshow) {
813 echo
'<table class="centpercent noborder nocellnopadd cal_month">';
815 echo
'<tr class="liste_titre">';
816 echo
'<td class="nopaddingtopimp nopaddingbottomimp nowraponsmartphone">';
818 if ($canedit && $mode ==
'show_peruser') {
820 print
img_picto(
'',
'clock',
'class="fawidth30 inline-block paddingleft"');
821 print
'<span class="hideonsmartphone" title="'.$langs->trans(
"VisibleTimeRange").
'">'.$langs->trans(
"Hours").
'</span>';
822 print
"\n".
'<div class="ui-grid-a inline-block"><div class="ui-block-a nowraponall">';
823 print
'<input type="number" class="short" name="begin_h" value="'.$begin_h.
'" min="0" max="23">';
824 if (empty($conf->dol_use_jmobile)) {
827 print
'</div><div class="ui-block-b">';
829 print
'<input type="number" class="short" name="end_h" value="'.$end_h.
'" min="1" max="24">';
830 if (empty($conf->dol_use_jmobile)) {
831 print
' '.$langs->trans(
"H");
833 print
'</div></div>';
838 print
img_picto(
'',
'clock',
'class="fawidth30 inline-block paddingleft"');
839 print
'<span class="hideonsmartphone" title="'.$langs->trans(
"VisibleDaysRange").
'">'.$langs->trans(
"DaysOfWeek").
'</span>';
840 print
"\n".
'<div class="ui-grid-a inline-block"><div class="ui-block-a nowraponall">';
841 print
'<input type="number" class="short" name="begin_d" value="'.$begin_d.
'" min="1" max="7">';
842 if (empty($conf->dol_use_jmobile)) {
845 print
'</div><div class="ui-block-b">';
847 print
'<input type="number" class="short" name="end_d" value="'.$end_d.
'" min="1" max="7">';
848 print
'</div></div>';
854 if (($i + 1) < $begin_d || ($i + 1) > $end_d) {
858 echo
'<td align="center" colspan="'.($end_h - $begin_h).
'">';
859 echo
'<span class="bold spandayofweek">'.$langs->trans(
"Day".(($i + (isset($conf->global->MAIN_START_WEEK) ? $conf->global->MAIN_START_WEEK : 1)) % 7)).
'</span>';
871 echo
'<tr class="liste_titre">';
875 if (($i + 1) < $begin_d || ($i + 1) > $end_d) {
879 for ($h = $begin_h; $h < $end_h; $h++) {
880 echo
'<td class="center">';
881 print
'<small style="font-family: courier">'.sprintf(
"%02d", $h).
'</small>';
891 $usernames = array();
892 $usernamesid = array();
894 if (!empty($conf->global->AGENDA_SHOWOWNERONLY_ONPERUSERVIEW)) {
895 foreach ($eventarray as $daykey => $notused) {
897 foreach ($eventarray[$daykey] as $index => $event) {
898 $event->fetch_userassigned();
899 $listofuserid = $event->userassigned;
900 foreach ($listofuserid as $userid => $tmp) {
901 if (!in_array($userid, $usernamesid)) {
902 $usernamesid[$userid] = $userid;
909 $sql =
"SELECT DISTINCT u.rowid, u.lastname as lastname, u.firstname, u.statut, u.login, u.admin, u.entity";
910 $sql .=
" FROM ".MAIN_DB_PREFIX.
"user as u";
911 if (
isModEnabled(
'multicompany') && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
912 $sql .=
", ".MAIN_DB_PREFIX.
"usergroup_user as ug";
913 $sql .=
" WHERE ug.entity IN (".getEntity(
'usergroup').
")";
914 $sql .=
" AND ug.fk_user = u.rowid ";
916 if ($usergroup > 0) {
917 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"usergroup_user as ug ON u.rowid = ug.fk_user";
919 $sql .=
" WHERE u.entity IN (".getEntity(
'user').
")";
921 $sql .=
" AND u.statut = 1";
922 if ($usergroup > 0) {
923 $sql .=
" AND ug.fk_usergroup = ".((int) $usergroup);
925 if ($user->socid > 0) {
927 $sql .=
" AND u.fk_soc = ".((int) $user->socid);
931 $resql = $db->query($sql);
933 $num = $db->num_rows(
$resql);
937 $obj = $db->fetch_object(
$resql);
938 $usernamesid[$obj->rowid] = $obj->rowid;
947 foreach ($usernamesid as $id) {
948 $tmpuser =
new User($db);
949 $result = $tmpuser->fetch($id);
950 $usernames[] = $tmpuser;
954 $colorsbytype = array();
955 $labelbytype = array();
956 $sql =
"SELECT code, color, libelle as label FROM ".MAIN_DB_PREFIX.
"c_actioncomm ORDER BY position";
957 $resql = $db->query($sql);
958 while ($obj = $db->fetch_object(
$resql)) {
959 $colorsbytype[$obj->code] = $obj->color;
960 $labelbytype[$obj->code] = $obj->label;
968 foreach ($usernames as $username) {
973 echo
'<td class="tdoverflowmax100 cal_current_month cal_peruserviewname'.($var ?
' cal_impair' :
'').
'">';
974 print $username->getNomUrl(-1,
'', 0, 0, 20, 1,
'');
980 for ($iter_day = 0; $iter_day < 8; $iter_day++) {
981 if (($i + 1) < $begin_d || ($i + 1) > $end_d) {
994 $style =
'cal_current_month';
995 if ($iter_day == 6) {
996 $style .=
' cal_other_month';
999 if ($todayarray[
'mday'] == $tmpday && $todayarray[
'mon'] == $tmpmonth && $todayarray[
'year'] == $tmpyear) {
1003 $style =
'cal_today_peruser';
1006 show_day_events2($username, $tmpday, $tmpmonth, $tmpyear, 0, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300, $showheader, $colorsbytype, $var);
1011 $showheader =
false;
1022 if (!empty($conf->global->AGENDA_USE_EVENT_TYPE) && !empty($conf->global->AGENDA_USE_COLOR_PER_EVENT_TYPE)) {
1023 $langs->load(
"commercial");
1024 print
'<br>'.$langs->trans(
"Legend").
': <br>';
1025 foreach ($colorsbytype as $code => $color) {
1027 print
'<div style="float: left; padding: 2px; margin-right: 6px;"><div style="'.($color ?
'background: #'.$color.
';' :
'').
'width:16px; float: left; margin-right: 4px;"> </div>';
1028 print $langs->trans(
"Action".$code) !=
"Action".$code ? $langs->trans(
"Action".$code) : $labelbytype[$code];
1034 print
'<div style="float: left; padding: 2px; margin-right: 6px;"><div class="peruser_busy" style="width:16px; float: left; margin-right: 4px;"> </div>';
1035 print $langs->trans(
"Other");
1044 print
"\n".
'</form>';
1048 print
'<script type="text/javascript">
1049 jQuery(document).ready(function() {
1050 jQuery(".onclickopenref").click(function() {
1051 var ref=$(this).attr(\'ref\');
1052 var res = ref.split("_");
1053 var userid = res[1];
1060 if (ids == \'none\') /* No event */
1062 /* alert(\'no event\'); */
1063 url = "'.DOL_URL_ROOT.
'/comm/action/card.php?action=create&assignedtouser="+userid+"&datep="+year+month+day+hour+min+"00&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?year='.$year.
'&month='.$month.
'&day='.$day.($begin_h !==
'' ?
'&begin_h='.$begin_h :
'').($end_h !==
'' ?
'&end_h='.$end_h :
'').($begin_d !==
'' ?
'&begin_d='.$begin_d :
'').($end_d !==
'' ?
'&end_d='.$end_d :
'')).
'"
1064 window.location.href = url;
1066 else if (ids.indexOf(",") > -1) /* There is several events */
1068 /* alert(\'several events\'); */
1069 url = "'.DOL_URL_ROOT.
'/comm/action/list.php?mode=show_list&filtert="+userid+"&dateselectyear="+year+"&dateselectmonth="+month+"&dateselectday="+day;
1070 window.location.href = url;
1072 else /* One event */
1074 /* alert(\'one event\'); */
1075 url = "'.DOL_URL_ROOT.
'/comm/action/card.php?action=view&id="+ids
1076 window.location.href = url;
1109 function show_day_events2($username, $day, $month, $year, $monthshown, $style, &$eventarray, $maxprint = 0, $maxnbofchar = 16, $newparam =
'', $showinfo = 0, $minheight = 60, $showheader =
false, $colorsbytype = array(), $var =
false)
1112 global $user, $conf, $langs, $hookmanager, $action;
1113 global $filter, $filtert, $status, $actioncode;
1114 global $theme_datacolor;
1115 global $cachethirdparties, $cachecontacts, $cacheusers, $cacheprojects, $colorindexused;
1116 global $begin_h, $end_h;
1121 $i = 0; $numother = 0; $numbirthday = 0; $numical = 0; $numicals = array();
1124 $colorindexused[$user->id] = 0;
1125 $nextindextouse = count($colorindexused);
1132 foreach ($eventarray as $daykey => $notused) {
1139 if ($day == $jour && (
int) $month == (
int) $mois && $year == $annee) {
1143 foreach ($eventarray[$daykey] as $index => $event) {
1147 $keysofuserassigned = array_keys($event->userassigned);
1148 $ponct = ($event->date_start_in_calendar == $event->date_end_in_calendar);
1150 if (!in_array($username->id, $keysofuserassigned)) {
1155 $parameters = array();
1156 $reshook = $hookmanager->executeHooks(
'formatEvent', $parameters, $event, $action);
1162 $color = -1; $cssclass =
''; $colorindex = -1;
1163 if (in_array($user->id, $keysofuserassigned)) {
1164 $cssclass =
'family_mytasks';
1166 if (empty($cacheusers[$event->userownerid])) {
1167 $newuser =
new User($db);
1168 $newuser->fetch($event->userownerid);
1169 $cacheusers[$event->userownerid] = $newuser;
1174 if (!empty($cacheusers[$event->userownerid]->color)) {
1175 $color = $cacheusers[$event->userownerid]->color;
1178 if (!empty($conf->global->AGENDA_USE_COLOR_PER_EVENT_TYPE)) {
1179 $color = $event->type_color;
1181 } elseif ($event->type_code ==
'ICALEVENT') {
1183 if (!empty($event->icalname)) {
1190 $color = $event->icalcolor;
1191 $cssclass = (!empty($event->icalname) ?
'family_ext'.md5($event->icalname) :
'family_other unsortable');
1192 } elseif ($event->type_code ==
'BIRTHDAY') {
1193 $numbirthday++; $colorindex = 2; $cssclass =
'family_birthday unsortable'; $color = sprintf(
"%02x%02x%02x", $theme_datacolor[$colorindex][0], $theme_datacolor[$colorindex][1], $theme_datacolor[$colorindex][2]);
1196 $color = ($event->icalcolor ? $event->icalcolor : -1);
1197 $cssclass = (!empty($event->icalname) ?
'family_ext'.md5($event->icalname) :
'family_other');
1199 if (empty($cacheusers[$event->userownerid])) {
1200 $newuser =
new User($db);
1201 $newuser->fetch($event->userownerid);
1202 $cacheusers[$event->userownerid] = $newuser;
1207 if (!empty($cacheusers[$event->userownerid]->color)) {
1208 $color = $cacheusers[$event->userownerid]->color;
1211 if (!empty($conf->global->AGENDA_USE_COLOR_PER_EVENT_TYPE)) {
1212 $color = $event->type_color;
1218 $idusertouse = ($event->userownerid ? $event->userownerid : 0);
1219 if (isset($colorindexused[$idusertouse])) {
1220 $colorindex = $colorindexused[$idusertouse];
1222 $colorindex = $nextindextouse;
1223 $colorindexused[$idusertouse] = $colorindex;
1224 if (!empty($theme_datacolor[$nextindextouse + 1])) {
1229 $color = sprintf(
"%02x%02x%02x", $theme_datacolor[$colorindex][0], $theme_datacolor[$colorindex][1], $theme_datacolor[$colorindex][2]);
1233 for ($h = $begin_h; $h < $end_h; $h++) {
1236 if (empty($event->fulldayevent)) {
1237 $a =
dol_mktime((
int) $h, 0, 0, $month, $day, $year,
'tzuserrel', 0);
1238 $b =
dol_mktime((
int) $h, 30, 0, $month, $day, $year,
'tzuserrel', 0);
1239 $c =
dol_mktime((
int) $h + 1, 0, 0, $month, $day, $year,
'tzuserrel', 0);
1241 $dateendtouse = $event->date_end_in_calendar;
1242 if ($dateendtouse == $event->date_start_in_calendar) {
1248 if ($event->date_start_in_calendar < $b && $dateendtouse > $a) {
1249 $busy = $event->transparency;
1250 $cases1[$h][$event->id][
'busy'] = $busy;
1251 $cases1[$h][$event->id][
'string'] =
dol_print_date($event->date_start_in_calendar,
'dayhour',
'tzuserrel');
1252 if ($event->date_end_in_calendar && $event->date_end_in_calendar != $event->date_start_in_calendar) {
1253 $tmpa =
dol_getdate($event->date_start_in_calendar,
true);
1254 $tmpb =
dol_getdate($event->date_end_in_calendar,
true);
1255 if ($tmpa[
'mday'] == $tmpb[
'mday'] && $tmpa[
'mon'] == $tmpb[
'mon'] && $tmpa[
'year'] == $tmpb[
'year']) {
1256 $cases1[$h][$event->id][
'string'] .=
'-'.dol_print_date($event->date_end_in_calendar,
'hour',
'tzuserrel');
1258 $cases1[$h][$event->id][
'string'] .=
'-'.dol_print_date($event->date_end_in_calendar,
'dayhour',
'tzuserrel');
1261 if ($event->label) {
1262 $cases1[$h][$event->id][
'string'] .=
' - '.$event->label;
1264 $cases1[$h][$event->id][
'typecode'] = $event->type_code;
1265 $cases1[$h][$event->id][
'color'] = $color;
1266 if ($event->fk_project > 0) {
1267 if (empty($cacheprojects[$event->fk_project])) {
1269 $tmpproj->fetch($event->fk_project);
1270 $cacheprojects[$event->fk_project] = $tmpproj;
1272 $cases1[$h][$event->id][
'string'] .=
', '.$langs->trans(
"Project").
': '.$cacheprojects[$event->fk_project]->ref.
' - '.$cacheprojects[$event->fk_project]->title;
1274 if ($event->socid > 0) {
1275 if (empty($cachethirdparties[$event->socid])) {
1276 $tmpthirdparty =
new Societe($db);
1277 $tmpthirdparty->fetch($event->socid);
1278 $cachethirdparties[$event->socid] = $tmpthirdparty;
1280 $cases1[$h][$event->id][
'string'] .=
', '.$cachethirdparties[$event->socid]->name;
1282 if ($event->contact_id > 0) {
1283 if (empty($cachecontacts[$event->contact_id])) {
1284 $tmpcontact =
new Contact($db);
1285 $tmpcontact->fetch($event->contact_id);
1286 $cachecontacts[$event->contact_id] = $tmpcontact;
1288 $cases1[$h][$event->id][
'string'] .=
', '.$cachecontacts[$event->contact_id]->getFullName($langs);
1291 if ($event->date_start_in_calendar < $c && $dateendtouse > $b) {
1292 $busy = $event->transparency;
1293 $cases2[$h][$event->id][
'busy'] = $busy;
1294 $cases2[$h][$event->id][
'string'] =
dol_print_date($event->date_start_in_calendar,
'dayhour',
'tzuserrel');
1295 if ($event->date_end_in_calendar && $event->date_end_in_calendar != $event->date_start_in_calendar) {
1296 $tmpa =
dol_getdate($event->date_start_in_calendar,
true);
1297 $tmpb =
dol_getdate($event->date_end_in_calendar,
true);
1298 if ($tmpa[
'mday'] == $tmpb[
'mday'] && $tmpa[
'mon'] == $tmpb[
'mon'] && $tmpa[
'year'] == $tmpb[
'year']) {
1299 $cases2[$h][$event->id][
'string'] .=
'-'.dol_print_date($event->date_end_in_calendar,
'hour',
'tzuserrel');
1301 $cases2[$h][$event->id][
'string'] .=
'-'.dol_print_date($event->date_end_in_calendar,
'dayhour',
'tzuserrel');
1304 if ($event->label) {
1305 $cases2[$h][$event->id][
'string'] .=
' - '.$event->label;
1307 $cases2[$h][$event->id][
'typecode'] = $event->type_code;
1308 $cases2[$h][$event->id][
'color'] = $color;
1309 if ($event->fk_project > 0) {
1310 if (empty($cacheprojects[$event->fk_project])) {
1312 $tmpproj->fetch($event->fk_project);
1313 $cacheprojects[$event->fk_project] = $tmpproj;
1315 $cases2[$h][$event->id][
'string'] .=
', '.$langs->trans(
"Project").
': '.$cacheprojects[$event->fk_project]->ref.
' - '.$cacheprojects[$event->fk_project]->title;
1317 if ($event->socid > 0) {
1318 if (empty($cachethirdparties[$event->socid])) {
1319 $tmpthirdparty =
new Societe($db);
1320 $tmpthirdparty->fetch($event->socid);
1321 $cachethirdparties[$event->socid] = $tmpthirdparty;
1323 $cases2[$h][$event->id][
'string'] .=
', '.$cachethirdparties[$event->socid]->name;
1325 if ($event->contact_id > 0) {
1326 if (empty($cachecontacts[$event->contact_id])) {
1327 $tmpcontact =
new Contact($db);
1328 $tmpcontact->fetch($event->contact_id);
1329 $cachecontacts[$event->contact_id] = $tmpcontact;
1331 $cases2[$h][$event->id][
'string'] .=
', '.$cachecontacts[$event->contact_id]->getFullName($langs);
1335 $busy = $event->transparency;
1336 $cases1[$h][$event->id][
'busy'] = $busy;
1337 $cases2[$h][$event->id][
'busy'] = $busy;
1338 $cases1[$h][$event->id][
'string'] = $event->label;
1339 $cases2[$h][$event->id][
'string'] = $event->label;
1340 $cases1[$h][$event->id][
'typecode'] = $event->type_code;
1341 $cases2[$h][$event->id][
'typecode'] = $event->type_code;
1342 $cases1[$h][$event->id][
'color'] = $color;
1343 $cases2[$h][$event->id][
'color'] = $color;
1354 for ($h = $begin_h; $h < $end_h; $h++) {
1355 $color1 =
''; $color2 =
'';
1356 $style1 =
''; $style2 =
'';
1357 $string1 =
' '; $string2 =
' ';
1358 $title1 =
''; $title2 =
'';
1359 if (isset($cases1[$h]) && $cases1[$h] !=
'') {
1361 if (count($cases1[$h]) > 1) {
1362 $title1 .= count($cases1[$h]).
' '.(count($cases1[$h]) == 1 ? $langs->trans(
"Event") : $langs->trans(
"Events"));
1364 $string1 =
' ';
1365 if (empty($conf->global->AGENDA_NO_TRANSPARENT_ON_NOT_BUSY)) {
1366 $style1 =
'peruser_notbusy';
1368 $style1 =
'peruser_busy';
1370 foreach ($cases1[$h] as $id => $ev) {
1372 $style1 =
'peruser_busy';
1376 if (isset($cases2[$h]) && $cases2[$h] !=
'') {
1378 if (count($cases2[$h]) > 1) {
1379 $title2 .= count($cases2[$h]).
' '.(count($cases2[$h]) == 1 ? $langs->trans(
"Event") : $langs->trans(
"Events"));
1381 $string2 =
' ';
1382 if (empty($conf->global->AGENDA_NO_TRANSPARENT_ON_NOT_BUSY)) {
1383 $style2 =
'peruser_notbusy';
1385 $style2 =
'peruser_busy';
1387 foreach ($cases2[$h] as $id => $ev) {
1389 $style2 =
'peruser_busy';
1396 if (!empty($cases1[$h]) && is_array($cases1[$h]) && count($cases1[$h]) && array_keys($cases1[$h])) {
1397 $ids1 = join(
', ', array_keys($cases1[$h]));
1399 if (!empty($cases2[$h]) && is_array($cases2[$h]) && count($cases2[$h]) && array_keys($cases2[$h])) {
1400 $ids2 = join(
', ', array_keys($cases2[$h]));
1403 if ($h == $begin_h) {
1404 echo
'<td class="'.$style.
'_peruserleft cal_peruser'.($var ?
' cal_impair '.$style.
'_impair' :
'').
'">';
1406 echo
'<td class="'.$style.
' cal_peruser'.($var ?
' cal_impair '.$style.
'_impair' :
'').
'">';
1408 if (!empty($cases1[$h]) && is_array($cases1[$h]) && count($cases1[$h]) == 1) {
1409 $output = array_slice($cases1[$h], 0, 1);
1410 $title1 = $langs->trans(
"Ref").
' '.$ids1.($title1 ?
' - '.$title1 :
'');
1411 if ($output[0][
'string']) {
1412 $title1 .= ($title1 ?
' - ' :
'').$output[0][
'string'];
1414 if ($output[0][
'color']) {
1415 $color1 = $output[0][
'color'];
1417 } elseif (!empty($cases1[$h]) && is_array($cases1[$h]) && count($cases1[$h]) > 1) {
1418 $title1 = $langs->trans(
"Ref").
' '.$ids1.($title1 ?
' - '.$title1 :
'');
1422 if (!empty($cases2[$h]) && is_array($cases2[$h]) && count($cases2[$h]) == 1) {
1423 $output = array_slice($cases2[$h], 0, 1);
1424 $title2 = $langs->trans(
"Ref").
' '.$ids2.($title2 ?
' - '.$title2 :
'');
1425 if ($output[0][
'string']) {
1426 $title2 .= ($title2 ?
' - ' :
'').$output[0][
'string'];
1428 if ($output[0][
'color']) {
1429 $color2 = $output[0][
'color'];
1431 } elseif (!empty($cases2[$h]) && is_array($cases2[$h]) && count($cases2[$h]) > 1) {
1432 $title2 = $langs->trans(
"Ref").
' '.$ids2.($title2 ?
' - '.$title2 :
'');
1435 print
'<table class="nobordernopadding case centpercent">';
1437 if ($style1 ==
'peruser_notbusy') {
1438 print
'style="border: 1px solid #'.($color1 ? $color1 :
"888").
' !important" ';
1439 } elseif ($color1) {
1440 print ($color1 ?
'style="background: #'.$color1.
';"' :
'');
1443 print ($style1 ? $style1.
' ' :
'');
1444 print
'onclickopenref center'.($title2 ?
' classfortooltip' :
'').($title1 ?
' cursorpointer' :
'').
'" ref="ref_'.$username->id.
'_'.sprintf(
"%04d", $year).
'_'.sprintf(
"%02d", $month).
'_'.sprintf(
"%02d", $day).
'_'.sprintf(
"%02d", $h).
'_00_'.($ids1 ? $ids1 :
'none').
'"'.($title1 ?
' title="'.$title1.
'"' :
'').
'>';
1447 if ($style2 ==
'peruser_notbusy') {
1448 print
'style="border: 1px solid #'.($color2 ? $color2 :
"888").
' !important" ';
1449 } elseif ($color2) {
1450 print ($color2 ?
'style="background: #'.$color2.
';"' :
'');
1453 print ($style2 ? $style2.
' ' :
'');
1454 print
'onclickopenref center'.($title2 ?
' classfortooltip' :
'').($title1 ?
' cursorpointer' :
'').
'" ref="ref_'.$username->id.
'_'.sprintf(
"%04d", $year).
'_'.sprintf(
"%02d", $month).
'_'.sprintf(
"%02d", $day).
'_'.sprintf(
"%02d", $h).
'_30_'.($ids2 ? $ids2 :
'none').
'"'.($title2 ?
' title="'.$title2.
'"' :
'').
'>';
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $help_url
View.
print_actions_filter($form, $canedit, $status, $year, $month, $day, $showbirthday, $filtera, $filtert, $filterd, $pid, $socid, $action, $showextcals=array(), $actioncode='', $usergroupid='', $excludetype='', $resourceid=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()
Empty header.
Class to manage agenda events (actions)
Class to manage projects.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage Dolibarr users.
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
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_time_plus_duree($time, $duration_value, $duration_unit, $ruleforendofmonth=0)
Add a delay to a date.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_now($mode='auto')
Return date for now.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_string_nospecial($str, $newstr='_', $badcharstoreplace='', $badcharstoremove='')
Clean a string from all punctuation characters to use it as a ref or login.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
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.
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.