31 require
'../../main.inc.php';
32 require_once DOL_DOCUMENT_ROOT.
'/comm/action/class/actioncomm.class.php';
33 require_once DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php';
34 require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
35 require_once DOL_DOCUMENT_ROOT.
'/user/class/usergroup.class.php';
36 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
37 require_once DOL_DOCUMENT_ROOT.
'/core/lib/agenda.lib.php';
38 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
39 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
42 if (!isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) {
43 $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW = 3;
46 $action =
GETPOST(
'action',
'aZ09');
48 $disabledefaultvalues =
GETPOST(
'disabledefaultvalues',
'int');
50 $filter =
GETPOST(
"search_filter",
'alpha', 3) ?
GETPOST(
"search_filter",
'alpha', 3) :
GETPOST(
"filter",
'alpha', 3);
51 $filtert =
GETPOST(
"search_filtert",
"int", 3) ?
GETPOST(
"search_filtert",
"int", 3) :
GETPOST(
"filtert",
"int", 3);
52 $usergroup =
GETPOST(
"search_usergroup",
"int", 3) ?
GETPOST(
"search_usergroup",
"int", 3) :
GETPOST(
"usergroup",
"int", 3);
63 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
64 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
66 if (empty($page) || $page == -1) {
69 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
70 $offset = $limit * $page;
75 $sortfield =
"a.datec";
80 $socid = $user->socid;
87 if (empty($user->rights->agenda->myactions->read)) {
90 if (empty($user->rights->agenda->allactions->read)) {
93 if (empty($user->rights->agenda->allactions->read) || $filter ==
'mine') {
97 $mode =
'show_peruser';
98 $resourceid =
GETPOST(
"search_resourceid",
"int") ?
GETPOST(
"search_resourceid",
"int") :
GETPOST(
"resourceid",
"int");
99 $year =
GETPOST(
"year",
"int") ?
GETPOST(
"year",
"int") : date(
"Y");
100 $month =
GETPOST(
"month",
"int") ?
GETPOST(
"month",
"int") : date(
"m");
101 $week =
GETPOST(
"week",
"int") ?
GETPOST(
"week",
"int") : date(
"W");
106 $maxprint = ((
GETPOST(
"maxprint",
'int') !=
'') ?
GETPOST(
"maxprint",
'int') : $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW);
107 $optioncss =
GETPOST(
'optioncss',
'aZ');
109 if (
GETPOST(
'search_actioncode',
'array:aZ09')) {
110 $actioncode =
GETPOST(
'search_actioncode',
'array:aZ09', 3);
111 if (!count($actioncode)) {
115 $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));
119 if ($dateselect > 0) {
120 $day =
GETPOST(
'dateselectday',
'int');
121 $month =
GETPOST(
'dateselectmonth',
'int');
122 $year =
GETPOST(
'dateselectyear',
'int');
125 $tmp = empty($conf->global->MAIN_DEFAULT_WORKING_HOURS) ?
'9-18' : $conf->global->MAIN_DEFAULT_WORKING_HOURS;
126 $tmp = str_replace(
' ',
'', $tmp);
127 $tmparray = explode(
'-', $tmp);
128 $begin_h =
GETPOST(
'begin_h',
'int') !=
'' ?
GETPOST(
'begin_h',
'int') : ($tmparray[0] !=
'' ? $tmparray[0] : 9);
129 $end_h =
GETPOST(
'end_h',
'int') ?
GETPOST(
'end_h',
'int') : ($tmparray[1] !=
'' ? $tmparray[1] : 18);
130 if ($begin_h < 0 || $begin_h > 23) {
133 if ($end_h < 1 || $end_h > 24) {
136 if ($end_h <= $begin_h) {
137 $end_h = $begin_h + 1;
140 $tmp = empty($conf->global->MAIN_DEFAULT_WORKING_DAYS) ?
'1-5' : $conf->global->MAIN_DEFAULT_WORKING_DAYS;
141 $tmp = str_replace(
' ',
'', $tmp);
142 $tmparray = explode(
'-', $tmp);
143 $begin_d =
GETPOST(
'begin_d',
'int') ?
GETPOST(
'begin_d',
'int') : ($tmparray[0] !=
'' ? $tmparray[0] : 1);
144 $end_d =
GETPOST(
'end_d',
'int') ?
GETPOST(
'end_d',
'int') : ($tmparray[1] !=
'' ? $tmparray[1] : 5);
145 if ($begin_d < 1 || $begin_d > 7) {
148 if ($end_d < 1 || $end_d > 7) {
151 if ($end_d < $begin_d) {
152 $end_d = $begin_d + 1;
156 $status = ((empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS) || $disabledefaultvalues) ?
'' : $conf->global->AGENDA_DEFAULT_FILTER_STATUS);
160 $mode = (empty($conf->global->AGENDA_DEFAULT_VIEW) ?
'show_month' : $conf->global->AGENDA_DEFAULT_VIEW);
163 if (
GETPOST(
'viewcal',
'alpha') && $mode !=
'show_day' && $mode !=
'show_week' && $mode !=
'show_peruser') {
164 $mode =
'show_month'; $day =
'';
166 if (
GETPOST(
'viewweek',
'alpha') || $mode ==
'show_week') {
167 $mode =
'show_week'; $week = ($week ? $week : date(
"W")); $day = ($day ? $day : date(
"d"));
169 if (
GETPOST(
'viewday',
'alpha') || $mode ==
'show_day') {
170 $mode =
'show_day'; $day = ($day ? $day : date(
"d"));
176 $langs->loadLangs(array(
'users',
'agenda',
'other',
'commercial'));
179 $hookmanager->initHooks(array(
'agenda'));
182 if ($user->socid && $socid) {
186 $search_status = $status;
217 'maxprint' => $maxprint,
219 'filtert' => $filtert,
220 'showbirthday' => $showbirthday,
221 'canedit' => $canedit,
222 'optioncss' => $optioncss,
223 'actioncode' => $actioncode,
225 'resourceid' => $resourceid,
226 'usergroup' => $usergroup,
228 $reshook = $hookmanager->executeHooks(
'beforeAgendaPerUser', $parameters, $object, $action);
234 $companystatic =
new Societe($db);
236 $help_url =
'EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda';
241 $nowyear = $nowarray[
'year'];
242 $nowmonth = $nowarray[
'mon'];
243 $nowday = $nowarray[
'mday'];
247 $listofextcals = array();
250 $first_day = $prev[
'first_day'];
251 $first_month = $prev[
'first_month'];
252 $first_year = $prev[
'first_year'];
254 $week = $prev[
'week'];
258 $next_year = $next[
'year'];
259 $next_month = $next[
'month'];
260 $next_day = $next[
'day'];
262 $max_day_in_month = date(
"t",
dol_mktime(0, 0, 0, $month, 1, $year));
264 $tmpday = $first_day;
268 $title = $langs->trans(
"DoneAndToDoActions");
269 if ($status ==
'done') {
270 $title = $langs->trans(
"DoneActions");
272 if ($status ==
'todo') {
273 $title = $langs->trans(
"ToDoActions");
278 if (is_array($actioncode)) {
279 foreach ($actioncode as $str_action) {
280 $param .=
"&search_actioncode[]=".urlencode($str_action);
283 $param .=
"&search_actioncode=".urlencode($actioncode);
286 if ($resourceid > 0) {
287 $param .=
"&search_resourceid=".urlencode($resourceid);
291 $param .=
"&search_status=".urlencode($status);
294 $param .=
"&search_filter=".urlencode($filter);
297 $param .=
"&search_filtert=".urlencode($filtert);
299 if ($usergroup > 0) {
300 $param .=
"&search_usergroup=".urlencode($usergroup);
303 $param .=
"&search_socid=".urlencode($socid);
306 $param .=
"&search_showbirthday=1";
309 $param .=
"&search_projectid=".urlencode($pid);
312 $param .=
"&search_type=".urlencode($type);
314 if ($mode !=
'show_peruser') {
315 $param .=
'&mode='.urlencode($mode);
317 if ($begin_h !=
'') {
318 $param .=
'&begin_h='.urlencode($begin_h);
321 $param .=
'&end_h='.urlencode($end_h);
323 if ($begin_d !=
'') {
324 $param .=
'&begin_d='.urlencode($begin_d);
327 $param .=
'&end_d='.urlencode($end_d);
329 $param .=
"&maxprint=".urlencode($maxprint);
331 $paramnoactionodate = $param;
336 $prev_year = $prev[
'prev_year'];
337 $prev_month = $prev[
'prev_month'];
338 $prev_day = $prev[
'prev_day'];
339 $first_day = $prev[
'first_day'];
340 $first_month = $prev[
'first_month'];
341 $first_year = $prev[
'first_year'];
343 $week = $prev[
'week'];
347 $next_year = $next[
'year'];
348 $next_month = $next[
'month'];
349 $next_day = $next[
'day'];
352 $firstdaytoshow =
dol_mktime(0, 0, 0, $first_month, $first_day, $first_year,
'gmt');
354 $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;
360 $max_day_in_month = date(
"t",
dol_mktime(0, 0, 0, $month, 1, $year,
'gmt'));
362 $tmpday = $first_day;
363 $picto =
'calendarweek';
365 $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";
366 $nav .=
" <span id=\"month_name\">".dol_print_date(
dol_mktime(0, 0, 0, $first_month, $first_day, $first_year),
"%Y").
", ".$langs->trans(
"Week").
" ".$week;
367 $nav .=
" </span>\n";
368 $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";
369 if (empty($conf->dol_optimize_smallscreen)) {
370 $nav .=
" <a href=\"?year=".$nowyear.
"&month=".$nowmonth.
"&day=".$nowday.$param.
"\">".$langs->trans(
"Today").
"</a> ";
372 $nav .=
$form->selectDate($dateselect,
'dateselect', 0, 0, 1,
'', 1, 0);
373 $nav .=
' <button type="submit" class="liste_titre button_search" name="button_search_x" value="x"><span class="fa fa-search"></span></button>';
376 $param .=
'&year='.urlencode($year).
'&month='.urlencode($month).($day ?
'&day='.urlencode($day) :
'');
380 $paramnoaction = preg_replace(
'/action=[a-z_]+/',
'', $param);
384 print
'<form method="POST" id="searchFormList" class="listactionsfilter" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
386 $showextcals = $listofextcals;
388 if ($conf->use_javascript_ajax) {
390 $s .=
'<script type="text/javascript">'.
"\n";
391 $s .=
'jQuery(document).ready(function () {'.
"\n";
392 $s .=
'jQuery("#check_mytasks").click(function() { jQuery(".family_mytasks").toggle(); jQuery(".family_other").toggle(); });'.
"\n";
393 $s .=
'jQuery("#check_birthday").click(function() { jQuery(".family_birthday").toggle(); });'.
"\n";
394 $s .=
'jQuery(".family_birthday").toggle();'.
"\n";
395 if ($mode ==
"show_week" || $mode ==
"show_month" || empty($mode)) {
396 $s .=
'jQuery( "td.sortable" ).sortable({connectWith: ".sortable",placeholder: "ui-state-highlight",items: "div:not(.unsortable)", receive: function( event, ui ) {';
399 $s .=
'</script>'.
"\n";
400 if (!empty($conf->use_javascript_ajax)) {
401 $s .=
'<div class="nowrap clear float"><input type="checkbox" id="check_mytasks" name="check_mytasks" checked disabled> '.$langs->trans(
"LocalAgenda").
' </div>';
402 if (is_array($showextcals) && count($showextcals) > 0) {
403 foreach ($showextcals as $val) {
404 $htmlname = md5($val[
'name']);
405 $s .=
'<script type="text/javascript">'.
"\n";
406 $s .=
'jQuery(document).ready(function () {'.
"\n";
407 $s .=
' jQuery("#check_ext'.$htmlname.
'").click(function() {';
408 $s .=
' /* alert("'.$htmlname.
'"); */';
409 $s .=
' jQuery(".family_ext'.$htmlname.
'").toggle();';
412 $s .=
'</script>'.
"\n";
413 $s .=
'<div class="nowrap float"><input type="checkbox" id="check_ext'.$htmlname.
'" name="check_ext'.$htmlname.
'" checked> '.$val [
'name'].
' </div>';
420 $parameters = array();
421 $reshook = $hookmanager->executeHooks(
'addCalendarChoice', $parameters, $object, $action);
422 if (empty($reshook)) {
423 $s .= $hookmanager->resPrint;
424 } elseif ($reshook > 1) {
425 $s = $hookmanager->resPrint;
430 $massactionbutton =
'';
433 $viewmode .=
'<a class="btnTitle reposition" href="'.DOL_URL_ROOT.
'/comm/action/list.php?mode=show_list&restore_lastsearch_values=1'.$paramnoactionodate.
'">';
435 $viewmode .=
img_picto($langs->trans(
"List"),
'object_calendarlist',
'class="imgforviewmode pictoactionview block"');
437 $viewmode .=
'<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone">'.$langs->trans(
"ViewList").
'</span></a>';
439 $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.
'">';
441 $viewmode .=
img_picto($langs->trans(
"ViewCal"),
'object_calendarmonth',
'class="pictoactionview block"');
443 $viewmode .=
'<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone">'.$langs->trans(
"ViewCal").
'</span></a>';
445 $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.
'">';
447 $viewmode .=
img_picto($langs->trans(
"ViewWeek"),
'object_calendarweek',
'class="pictoactionview block"');
449 $viewmode .=
'<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone">'.$langs->trans(
"ViewWeek").
'</span></a>';
451 $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.
'">';
453 $viewmode .=
img_picto($langs->trans(
"ViewDay"),
'object_calendarday',
'class="pictoactionview block"');
455 $viewmode .=
'<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone">'.$langs->trans(
"ViewDay").
'</span></a>';
457 $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.
'">';
459 $viewmode .=
img_picto($langs->trans(
"ViewPerUser"),
'object_calendarperuser',
'class="pictoactionview block"');
461 $viewmode .=
'<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone">'.$langs->trans(
"ViewPerUser").
'</span></a>';
463 $viewmode .=
'<span class="marginrightonly"></span>';
466 $parameters = array(); $object = null;
467 $reshook = $hookmanager->executeHooks(
'addCalendarView', $parameters, $object, $action);
468 if (empty($reshook)) {
469 $viewmode .= $hookmanager->resPrint;
470 } elseif ($reshook > 1) {
471 $viewmode = $hookmanager->resPrint;
477 if ($user->rights->agenda->myactions->create || $user->rights->agenda->allactions->create) {
480 $newparam .=
'&month='.urlencode(str_pad($month, 2,
"0", STR_PAD_LEFT)).
'&year='.urlencode($tmpforcreatebutton[
'year']);
481 if ($begin_h !==
'') {
482 $newparam .=
'&begin_h='.urlencode($begin_h);
485 $newparam .=
'&end_h='.urlencode($end_h);
487 if ($begin_d !==
'') {
488 $newparam .=
'&begin_d='.urlencode($begin_d);
491 $newparam .=
'&end_d='.urlencode($end_d);
495 $hourminsec =
'100000';
496 $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 :
'')));
501 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);
507 $newtitle =
'<div class="nowrap clear inline-block minheight30">';
508 $newtitle .=
'<input type="checkbox" id="check_mytasks" name="check_mytasks" checked disabled> '.$langs->trans(
"LocalAgenda").
' ';
509 $newtitle .=
'</div>';
516 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
517 print_actions_filter(
$form, $canedit, $search_status, $year, $month, $day, $showbirthday, 0, $filtert, 0, $pid, $socid, $action, -1, $actioncode, $usergroup,
'', $resourceid);
522 $eventarray = array();
527 if ($usergroup > 0) {
530 $sql .=
' a.id, a.label,';
532 $sql .=
' a.datep2,';
533 $sql .=
' a.percent,';
534 $sql .=
' a.fk_user_author,a.fk_user_action,';
535 $sql .=
' a.transparency, a.priority, a.fulldayevent, a.location,';
536 $sql .=
' a.fk_soc, a.fk_contact, a.fk_element, a.elementtype, a.fk_project,';
537 $sql .=
' ca.code, ca.libelle as type_label, ca.color, ca.type as type_type, ca.picto as type_picto';
538 $sql .=
' FROM '.MAIN_DB_PREFIX.
'c_actioncomm as ca, '.MAIN_DB_PREFIX.
"actioncomm as a";
539 if (empty($user->rights->societe->client->voir) && !$socid) {
540 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
543 if ($resourceid > 0) {
544 $sql .=
", ".MAIN_DB_PREFIX.
"element_resources as r";
547 if ($filtert > 0 || $usergroup > 0) {
548 $sql .=
", ".MAIN_DB_PREFIX.
"actioncomm_resources as ar";
550 if ($usergroup > 0) {
551 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"usergroup_user as ugu ON ugu.fk_user = ar.fk_element";
553 $sql .=
' WHERE a.fk_action = ca.id';
554 $sql .=
' AND a.entity IN ('.getEntity(
'agenda').
')';
556 if (!empty($actioncode)) {
557 if (empty($conf->global->AGENDA_USE_EVENT_TYPE)) {
558 if ($actioncode ==
'AC_NON_AUTO') {
559 $sql .=
" AND ca.type != 'systemauto'";
560 } elseif ($actioncode ==
'AC_ALL_AUTO') {
561 $sql .=
" AND ca.type = 'systemauto'";
563 if ($actioncode ==
'AC_OTH') {
564 $sql .=
" AND ca.type != 'systemauto'";
566 if ($actioncode ==
'AC_OTH_AUTO') {
567 $sql .=
" AND ca.type = 'systemauto'";
571 if ($actioncode ==
'AC_NON_AUTO') {
572 $sql .=
" AND ca.type != 'systemauto'";
573 } elseif ($actioncode ==
'AC_ALL_AUTO') {
574 $sql .=
" AND ca.type = 'systemauto'";
576 if (is_array($actioncode)) {
577 $sql .=
" AND ca.code IN (".$db->sanitize(
"'".implode(
"','", $actioncode).
"'", 1).
")";
579 $sql .=
" AND ca.code IN (".$db->sanitize(
"'".implode(
"','", explode(
',', $actioncode)).
"'", 1).
")";
584 if ($resourceid > 0) {
585 $sql .=
" AND r.element_type = 'action' AND r.element_id = a.id AND r.resource_id = ".((int) $resourceid);
588 $sql .=
" AND a.fk_project = ".((int) $pid);
590 if (empty($user->rights->societe->client->voir) && !$socid) {
591 $sql .=
" AND (a.fk_soc IS NULL OR sc.fk_user = ".((int) $user->id).
")";
594 $sql .=
' AND a.fk_soc = '.((int) $socid);
597 if ($filtert > 0 || $usergroup > 0) {
598 $sql .=
" AND ar.fk_actioncomm = a.id AND ar.element_type='user'";
600 if ($mode ==
'show_day') {
602 $sql .=
" (a.datep BETWEEN '".$db->idate(
dol_mktime(0, 0, 0, $month, $day, $year,
'tzuserrel')).
"'";
603 $sql .=
" AND '".$db->idate(
dol_mktime(23, 59, 59, $month, $day, $year,
'tzuserrel')).
"')";
605 $sql .=
" (a.datep2 BETWEEN '".$db->idate(
dol_mktime(0, 0, 0, $month, $day, $year,
'tzuserrel')).
"'";
606 $sql .=
" AND '".$db->idate(
dol_mktime(23, 59, 59, $month, $day, $year,
'tzuserrel')).
"')";
608 $sql .=
" (a.datep < '".$db->idate(
dol_mktime(0, 0, 0, $month, $day, $year,
'tzuserrel')).
"'";
609 $sql .=
" AND a.datep2 > '".$db->idate(
dol_mktime(23, 59, 59, $month, $day, $year,
'tzuserrel')).
"')";
614 $sql .=
" (a.datep BETWEEN '".$db->idate($firstdaytoshow - (60 * 60 * 24 * 2)).
"'";
615 $sql .=
" AND '".$db->idate($lastdaytoshow + (60 * 60 * 24 * 2)).
"')";
617 $sql .=
" (a.datep2 BETWEEN '".$db->idate($firstdaytoshow - (60 * 60 * 24 * 2)).
"'";
618 $sql .=
" AND '".$db->idate($lastdaytoshow + (60 * 60 * 24 * 2)).
"')";
620 $sql .=
" (a.datep < '".$db->idate($firstdaytoshow - (60 * 60 * 24 * 2)).
"'";
621 $sql .=
" AND a.datep2 > '".$db->idate($lastdaytoshow + (60 * 60 * 24 * 2)).
"')";
625 $sql .=
" AND ca.id = ".((int) $type);
627 if ($status ==
'0') {
628 $sql .=
" AND a.percent = 0";
630 if ($status ==
'-1' || $status ==
'na') {
632 $sql .=
" AND a.percent = -1";
634 if ($status ==
'50') {
636 $sql .=
" AND (a.percent > 0 AND a.percent < 100)";
638 if ($status ==
'done' || $status ==
'100') {
639 $sql .=
" AND (a.percent = 100)";
641 if ($status ==
'todo') {
642 $sql .=
" AND (a.percent >= 0 AND a.percent < 100)";
645 if ($filtert > 0 || $usergroup > 0) {
648 $sql .=
"ar.fk_element = ".$filtert;
650 if ($usergroup > 0) {
651 $sql .= ($filtert > 0 ?
" OR " :
"").
" ugu.fk_usergroup = ".((
int) $usergroup);
656 $sql .=
' ORDER BY fk_user_action, datep';
659 dol_syslog(
"comm/action/peruser.php", LOG_DEBUG);
660 $resql = $db->query($sql);
662 $num = $db->num_rows(
$resql);
666 $obj = $db->fetch_object(
$resql);
669 if (!empty($conf->global->AGENDA_ALWAYS_HIDE_AUTO) && $obj->code ==
'AC_OTH_AUTO') {
674 $datep = $db->jdate($obj->datep);
675 $datep2 = $db->jdate($obj->datep2);
679 $event->id = $obj->id;
680 $event->datep = $datep;
681 $event->datef = $datep2;
682 $event->type_code = $obj->code;
683 $event->type_color = $obj->color;
684 $event->label = $obj->label;
685 $event->percentage = $obj->percent;
686 $event->authorid = $obj->fk_user_author;
687 $event->userownerid = $obj->fk_user_action;
688 $event->priority = $obj->priority;
689 $event->fulldayevent = $obj->fulldayevent;
690 $event->location = $obj->location;
691 $event->transparency = $obj->transparency;
693 $event->fk_project = $obj->fk_project;
695 $event->socid = $obj->fk_soc;
696 $event->contact_id = $obj->fk_contact;
698 $event->fk_element = $obj->fk_element;
699 $event->elementtype = $obj->elementtype;
703 if ($event->percentage <= 0) {
704 $event->date_start_in_calendar = $datep;
705 if ($datep2 !=
'' && $datep2 >= $datep) {
706 $event->date_end_in_calendar = $datep2;
708 $event->date_end_in_calendar = $datep;
711 $event->date_start_in_calendar = $datep;
712 if ($datep2 !=
'' && $datep2 >= $datep) {
713 $event->date_end_in_calendar = $datep2;
715 $event->date_end_in_calendar = $datep;
720 if ($event->date_end_in_calendar < $firstdaytoshow ||
721 $event->date_start_in_calendar >= $lastdaytoshow) {
726 $event->fetch_userassigned();
728 if ($event->date_start_in_calendar < $firstdaytoshow) {
729 $event->date_start_in_calendar = $firstdaytoshow;
731 if ($event->date_end_in_calendar >= $lastdaytoshow) {
732 $event->date_end_in_calendar = ($lastdaytoshow - 1);
736 $daycursor = $event->date_start_in_calendar;
743 $loop =
true; $j = 0;
744 $daykey =
dol_mktime(0, 0, 0, $mois, $jour, $annee,
'gmt');
748 $eventarray[$daykey][] = $event;
751 $daykey += 60 * 60 * 24;
752 if ($daykey > $event->date_end_in_calendar) {
768 $cachethirdparties = array();
769 $cachecontacts = array();
770 $cacheusers = array();
773 $color_file = DOL_DOCUMENT_ROOT.
"/theme/".$conf->theme.
"/theme_vars.inc.php";
774 if (is_readable($color_file)) {
777 if (!is_array($theme_datacolor)) {
778 $theme_datacolor = array(array(120, 130, 150), array(200, 160, 180), array(190, 190, 220));
783 $newparam = preg_replace(
'/showbirthday=/i',
'showbirthday_=', $newparam);
784 $newparam = preg_replace(
'/mode=show_month&?/i',
'', $newparam);
785 $newparam = preg_replace(
'/mode=show_week&?/i',
'', $newparam);
786 $newparam = preg_replace(
'/day=[0-9]+&?/i',
'', $newparam);
787 $newparam = preg_replace(
'/month=[0-9]+&?/i',
'', $newparam);
788 $newparam = preg_replace(
'/year=[0-9]+&?/i',
'', $newparam);
789 $newparam = preg_replace(
'/viewweek=[0-9]+&?/i',
'', $newparam);
790 $newparam = preg_replace(
'/showbirthday_=/i',
'showbirthday=', $newparam);
791 $newparam .=
'&viewweek=1';
793 echo
'<input type="hidden" name="actionmove" value="mupdate">';
794 echo
'<input type="hidden" name="backtopage" value="'.dol_escape_htmltag($_SERVER[
'PHP_SELF']).
'?'.
dol_escape_htmltag($_SERVER[
'QUERY_STRING']).
'">';
795 echo
'<input type="hidden" name="newdate" id="newdate">';
802 $currentdaytoshow = $firstdaytoshow;
803 echo
'<div class="div-table-responsive">';
805 while ($currentdaytoshow < $lastdaytoshow) {
806 echo
'<table class="centpercent noborder nocellnopadd cal_month">';
808 echo
'<tr class="liste_titre">';
809 echo
'<td class="nopaddingtopimp nopaddingbottomimp nowraponsmartphone">';
811 if ($canedit && $mode ==
'show_peruser') {
813 print
img_picto(
'',
'clock',
'class="fawidth30 inline-block paddingleft"');
814 print
'<span class="hideonsmartphone" title="'.$langs->trans(
"VisibleTimeRange").
'">'.$langs->trans(
"Hours").
'</span>';
815 print
"\n".
'<div class="ui-grid-a inline-block"><div class="ui-block-a nowraponall">';
816 print
'<input type="number" class="short" name="begin_h" value="'.$begin_h.
'" min="0" max="23">';
817 if (empty($conf->dol_use_jmobile)) {
820 print
'</div><div class="ui-block-b">';
822 print
'<input type="number" class="short" name="end_h" value="'.$end_h.
'" min="1" max="24">';
823 if (empty($conf->dol_use_jmobile)) {
824 print
' '.$langs->trans(
"H");
826 print
'</div></div>';
831 print
img_picto(
'',
'clock',
'class="fawidth30 inline-block paddingleft"');
832 print
'<span class="hideonsmartphone" title="'.$langs->trans(
"VisibleDaysRange").
'">'.$langs->trans(
"DaysOfWeek").
'</span>';
833 print
"\n".
'<div class="ui-grid-a inline-block"><div class="ui-block-a nowraponall">';
834 print
'<input type="number" class="short" name="begin_d" value="'.$begin_d.
'" min="1" max="7">';
835 if (empty($conf->dol_use_jmobile)) {
838 print
'</div><div class="ui-block-b">';
840 print
'<input type="number" class="short" name="end_d" value="'.$end_d.
'" min="1" max="7">';
841 print
'</div></div>';
847 if (($i + 1) < $begin_d || ($i + 1) > $end_d) {
851 echo
'<td align="center" colspan="'.($end_h - $begin_h).
'">';
852 echo
'<span class="bold spandayofweek">'.$langs->trans(
"Day".(($i + (isset($conf->global->MAIN_START_WEEK) ? $conf->global->MAIN_START_WEEK : 1)) % 7)).
'</span>';
864 echo
'<tr class="liste_titre">';
868 if (($i + 1) < $begin_d || ($i + 1) > $end_d) {
872 for ($h = $begin_h; $h < $end_h; $h++) {
873 echo
'<td class="center">';
874 print
'<small style="font-family: courier">'.sprintf(
"%02d", $h).
'</small>';
884 $usernames = array();
885 $usernamesid = array();
887 if (!empty($conf->global->AGENDA_SHOWOWNERONLY_ONPERUSERVIEW)) {
888 foreach ($eventarray as $daykey => $notused) {
890 foreach ($eventarray[$daykey] as $index => $event) {
891 $event->fetch_userassigned();
892 $listofuserid = $event->userassigned;
893 foreach ($listofuserid as $userid => $tmp) {
894 if (!in_array($userid, $usernamesid)) {
895 $usernamesid[$userid] = $userid;
902 $sql =
"SELECT DISTINCT u.rowid, u.lastname as lastname, u.firstname, u.statut, u.login, u.admin, u.entity";
903 $sql .=
" FROM ".MAIN_DB_PREFIX.
"user as u";
904 if (!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
905 $sql .=
", ".MAIN_DB_PREFIX.
"usergroup_user as ug";
906 $sql .=
" WHERE ug.entity IN (".getEntity(
'usergroup').
")";
907 $sql .=
" AND ug.fk_user = u.rowid ";
909 if ($usergroup > 0) {
910 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"usergroup_user as ug ON u.rowid = ug.fk_user";
912 $sql .=
" WHERE u.entity IN (".getEntity(
'user').
")";
914 $sql .=
" AND u.statut = 1";
915 if ($usergroup > 0) {
916 $sql .=
" AND ug.fk_usergroup = ".((int) $usergroup);
920 $resql = $db->query($sql);
922 $num = $db->num_rows(
$resql);
926 $obj = $db->fetch_object(
$resql);
927 $usernamesid[$obj->rowid] = $obj->rowid;
936 foreach ($usernamesid as $id) {
937 $tmpuser =
new User($db);
938 $result = $tmpuser->fetch($id);
939 $usernames[] = $tmpuser;
963 $colorsbytype = array();
964 $labelbytype = array();
965 $sql =
"SELECT code, color, libelle as label FROM ".MAIN_DB_PREFIX.
"c_actioncomm ORDER BY position";
966 $resql = $db->query($sql);
967 while ($obj = $db->fetch_object(
$resql)) {
968 $colorsbytype[$obj->code] = $obj->color;
969 $labelbytype[$obj->code] = $obj->label;
977 foreach ($usernames as $username) {
980 echo
'<td class="tdoverflowmax100 cal_current_month cal_peruserviewname'.($var ?
' cal_impair' :
'').
'">';
981 print $username->getNomUrl(-1,
'', 0, 0, 20, 1,
'');
987 for ($iter_day = 0; $iter_day < 8; $iter_day++) {
988 if (($i + 1) < $begin_d || ($i + 1) > $end_d) {
996 $tmpday = $tmparray[
'mday'];
997 $tmpmonth = $tmparray[
'mon'];
998 $tmpyear = $tmparray[
'year'];
1001 $style =
'cal_current_month';
1002 if ($iter_day == 6) {
1003 $style .=
' cal_other_month';
1006 if ($todayarray[
'mday'] == $tmpday && $todayarray[
'mon'] == $tmpmonth && $todayarray[
'year'] == $tmpyear) {
1010 $style =
'cal_today_peruser';
1013 show_day_events2($username, $tmpday, $tmpmonth, $tmpyear, 0, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300, $showheader, $colorsbytype, $var);
1018 $showheader =
false;
1029 if (!empty($conf->global->AGENDA_USE_EVENT_TYPE) && !empty($conf->global->AGENDA_USE_COLOR_PER_EVENT_TYPE)) {
1030 $langs->load(
"commercial");
1031 print
'<br>'.$langs->trans(
"Legend").
': <br>';
1032 foreach ($colorsbytype as $code => $color) {
1034 print
'<div style="float: left; padding: 2px; margin-right: 6px;"><div style="'.($color ?
'background: #'.$color.
';' :
'').
'width:16px; float: left; margin-right: 4px;"> </div>';
1035 print $langs->trans(
"Action".$code) !=
"Action".$code ? $langs->trans(
"Action".$code) : $labelbytype[$code];
1041 print
'<div style="float: left; padding: 2px; margin-right: 6px;"><div class="peruser_busy" style="width:16px; float: left; margin-right: 4px;"> </div>';
1042 print $langs->trans(
"Other");
1051 print
"\n".
'</form>';
1055 print
'<script type="text/javascript">
1056 jQuery(document).ready(function() {
1057 jQuery(".onclickopenref").click(function() {
1058 var ref=$(this).attr(\'ref\');
1059 var res = ref.split("_");
1060 var userid = res[1];
1067 if (ids == \'none\') /* No event */
1069 /* alert(\'no event\'); */
1070 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 :
'')).
'"
1071 window.location.href = url;
1073 else if (ids.indexOf(",") > -1) /* There is several events */
1075 /* alert(\'several events\'); */
1076 url = "'.DOL_URL_ROOT.
'/comm/action/list.php?mode=show_list&filtert="+userid+"&dateselectyear="+year+"&dateselectmonth="+month+"&dateselectday="+day;
1077 window.location.href = url;
1079 else /* One event */
1081 /* alert(\'one event\'); */
1082 url = "'.DOL_URL_ROOT.
'/comm/action/card.php?action=view&id="+ids
1083 window.location.href = url;
1116 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)
1119 global $user, $conf, $langs, $hookmanager, $action;
1120 global $filter, $filtert, $status, $actioncode;
1121 global $theme_datacolor;
1122 global $cachethirdparties, $cachecontacts, $cacheusers, $cacheprojects, $colorindexused;
1123 global $begin_h, $end_h;
1128 $i = 0; $numother = 0; $numbirthday = 0; $numical = 0; $numicals = array();
1131 $colorindexused[$user->id] = 0;
1132 $nextindextouse = count($colorindexused);
1138 foreach ($eventarray as $daykey => $notused) {
1143 if ($day == $jour && $month == $mois && $year == $annee) {
1145 foreach ($eventarray[$daykey] as $index => $event) {
1149 $keysofuserassigned = array_keys($event->userassigned);
1150 $ponct = ($event->date_start_in_calendar == $event->date_end_in_calendar);
1152 if (!in_array($username->id, $keysofuserassigned)) {
1157 $parameters = array();
1158 $reshook = $hookmanager->executeHooks(
'formatEvent', $parameters, $event, $action);
1164 $color = -1; $cssclass =
''; $colorindex = -1;
1165 if (in_array($user->id, $keysofuserassigned)) {
1166 $cssclass =
'family_mytasks';
1168 if (empty($cacheusers[$event->userownerid])) {
1169 $newuser =
new User($db);
1170 $newuser->fetch($event->userownerid);
1171 $cacheusers[$event->userownerid] = $newuser;
1176 if (!empty($cacheusers[$event->userownerid]->color)) {
1177 $color = $cacheusers[$event->userownerid]->color;
1180 if (!empty($conf->global->AGENDA_USE_COLOR_PER_EVENT_TYPE)) {
1181 $color = $event->type_color;
1183 } elseif ($event->type_code ==
'ICALEVENT') {
1185 if (!empty($event->icalname)) {
1192 $color = $event->icalcolor;
1193 $cssclass = (!empty($event->icalname) ?
'family_ext'.md5($event->icalname) :
'family_other unsortable');
1194 } elseif ($event->type_code ==
'BIRTHDAY') {
1195 $numbirthday++; $colorindex = 2; $cssclass =
'family_birthday unsortable'; $color = sprintf(
"%02x%02x%02x", $theme_datacolor[$colorindex][0], $theme_datacolor[$colorindex][1], $theme_datacolor[$colorindex][2]);
1198 $color = ($event->icalcolor ? $event->icalcolor : -1);
1199 $cssclass = (!empty($event->icalname) ?
'family_ext'.md5($event->icalname) :
'family_other');
1201 if (empty($cacheusers[$event->userownerid])) {
1202 $newuser =
new User($db);
1203 $newuser->fetch($event->userownerid);
1204 $cacheusers[$event->userownerid] = $newuser;
1209 if (!empty($cacheusers[$event->userownerid]->color)) {
1210 $color = $cacheusers[$event->userownerid]->color;
1213 if (!empty($conf->global->AGENDA_USE_COLOR_PER_EVENT_TYPE)) {
1214 $color = $event->type_color;
1220 $idusertouse = ($event->userownerid ? $event->userownerid : 0);
1221 if (isset($colorindexused[$idusertouse])) {
1222 $colorindex = $colorindexused[$idusertouse];
1224 $colorindex = $nextindextouse;
1225 $colorindexused[$idusertouse] = $colorindex;
1226 if (!empty($theme_datacolor[$nextindextouse + 1])) {
1231 $color = sprintf(
"%02x%02x%02x", $theme_datacolor[$colorindex][0], $theme_datacolor[$colorindex][1], $theme_datacolor[$colorindex][2]);
1235 for ($h = $begin_h; $h < $end_h; $h++) {
1238 if (empty($event->fulldayevent)) {
1239 $a =
dol_mktime((
int) $h, 0, 0, $month, $day, $year,
'tzuserrel', 0);
1240 $b =
dol_mktime((
int) $h, 30, 0, $month, $day, $year,
'tzuserrel', 0);
1241 $c =
dol_mktime((
int) $h + 1, 0, 0, $month, $day, $year,
'tzuserrel', 0);
1243 $dateendtouse = $event->date_end_in_calendar;
1244 if ($dateendtouse == $event->date_start_in_calendar) {
1250 if ($event->date_start_in_calendar < $b && $dateendtouse > $a) {
1251 $busy = $event->transparency;
1252 $cases1[$h][$event->id][
'busy'] = $busy;
1253 $cases1[$h][$event->id][
'string'] =
dol_print_date($event->date_start_in_calendar,
'dayhour',
'tzuserrel');
1254 if ($event->date_end_in_calendar && $event->date_end_in_calendar != $event->date_start_in_calendar) {
1255 $tmpa =
dol_getdate($event->date_start_in_calendar,
true);
1256 $tmpb =
dol_getdate($event->date_end_in_calendar,
true);
1257 if ($tmpa[
'mday'] == $tmpb[
'mday'] && $tmpa[
'mon'] == $tmpb[
'mon'] && $tmpa[
'year'] == $tmpb[
'year']) {
1258 $cases1[$h][$event->id][
'string'] .=
'-'.dol_print_date($event->date_end_in_calendar,
'hour',
'tzuserrel');
1260 $cases1[$h][$event->id][
'string'] .=
'-'.dol_print_date($event->date_end_in_calendar,
'dayhour',
'tzuserrel');
1263 if ($event->label) {
1264 $cases1[$h][$event->id][
'string'] .=
' - '.$event->label;
1266 $cases1[$h][$event->id][
'typecode'] = $event->type_code;
1267 $cases1[$h][$event->id][
'color'] = $color;
1268 if ($event->fk_project > 0) {
1269 if (empty($cacheprojects[$event->fk_project])) {
1271 $tmpproj->fetch($event->fk_project);
1272 $cacheprojects[$event->fk_project] = $tmpproj;
1274 $cases1[$h][$event->id][
'string'] .=
', '.$langs->trans(
"Project").
': '.$cacheprojects[$event->fk_project]->ref.
' - '.$cacheprojects[$event->fk_project]->title;
1276 if ($event->socid > 0) {
1277 if (empty($cachethirdparties[$event->socid])) {
1278 $tmpthirdparty =
new Societe($db);
1279 $tmpthirdparty->fetch($event->socid);
1280 $cachethirdparties[$event->socid] = $tmpthirdparty;
1282 $cases1[$h][$event->id][
'string'] .=
', '.$cachethirdparties[$event->socid]->name;
1284 if ($event->contact_id > 0) {
1285 if (empty($cachecontacts[$event->contact_id])) {
1286 $tmpcontact =
new Contact($db);
1287 $tmpcontact->fetch($event->contact_id);
1288 $cachecontacts[$event->contact_id] = $tmpcontact;
1290 $cases1[$h][$event->id][
'string'] .=
', '.$cachecontacts[$event->contact_id]->getFullName($langs);
1293 if ($event->date_start_in_calendar < $c && $dateendtouse > $b) {
1294 $busy = $event->transparency;
1295 $cases2[$h][$event->id][
'busy'] = $busy;
1296 $cases2[$h][$event->id][
'string'] =
dol_print_date($event->date_start_in_calendar,
'dayhour',
'tzuserrel');
1297 if ($event->date_end_in_calendar && $event->date_end_in_calendar != $event->date_start_in_calendar) {
1298 $tmpa =
dol_getdate($event->date_start_in_calendar,
true);
1299 $tmpb =
dol_getdate($event->date_end_in_calendar,
true);
1300 if ($tmpa[
'mday'] == $tmpb[
'mday'] && $tmpa[
'mon'] == $tmpb[
'mon'] && $tmpa[
'year'] == $tmpb[
'year']) {
1301 $cases2[$h][$event->id][
'string'] .=
'-'.dol_print_date($event->date_end_in_calendar,
'hour',
'tzuserrel');
1303 $cases2[$h][$event->id][
'string'] .=
'-'.dol_print_date($event->date_end_in_calendar,
'dayhour',
'tzuserrel');
1306 if ($event->label) {
1307 $cases2[$h][$event->id][
'string'] .=
' - '.$event->label;
1309 $cases2[$h][$event->id][
'typecode'] = $event->type_code;
1310 $cases2[$h][$event->id][
'color'] = $color;
1311 if ($event->fk_project > 0) {
1312 if (empty($cacheprojects[$event->fk_project])) {
1314 $tmpproj->fetch($event->fk_project);
1315 $cacheprojects[$event->fk_project] = $tmpproj;
1317 $cases2[$h][$event->id][
'string'] .=
', '.$langs->trans(
"Project").
': '.$cacheprojects[$event->fk_project]->ref.
' - '.$cacheprojects[$event->fk_project]->title;
1319 if ($event->socid > 0) {
1320 if (empty($cachethirdparties[$event->socid])) {
1321 $tmpthirdparty =
new Societe($db);
1322 $tmpthirdparty->fetch($event->socid);
1323 $cachethirdparties[$event->socid] = $tmpthirdparty;
1325 $cases2[$h][$event->id][
'string'] .=
', '.$cachethirdparties[$event->socid]->name;
1327 if ($event->contact_id > 0) {
1328 if (empty($cachecontacts[$event->contact_id])) {
1329 $tmpcontact =
new Contact($db);
1330 $tmpcontact->fetch($event->contact_id);
1331 $cachecontacts[$event->contact_id] = $tmpcontact;
1333 $cases2[$h][$event->id][
'string'] .=
', '.$cachecontacts[$event->contact_id]->getFullName($langs);
1337 $busy = $event->transparency;
1338 $cases1[$h][$event->id][
'busy'] = $busy;
1339 $cases2[$h][$event->id][
'busy'] = $busy;
1340 $cases1[$h][$event->id][
'string'] = $event->label;
1341 $cases2[$h][$event->id][
'string'] = $event->label;
1342 $cases1[$h][$event->id][
'typecode'] = $event->type_code;
1343 $cases2[$h][$event->id][
'typecode'] = $event->type_code;
1344 $cases1[$h][$event->id][
'color'] = $color;
1345 $cases2[$h][$event->id][
'color'] = $color;
1356 for ($h = $begin_h; $h < $end_h; $h++) {
1357 $color1 =
''; $color2 =
'';
1358 $style1 =
''; $style2 =
'';
1359 $string1 =
' '; $string2 =
' ';
1360 $title1 =
''; $title2 =
'';
1361 if (isset($cases1[$h]) && $cases1[$h] !=
'') {
1363 if (count($cases1[$h]) > 1) {
1364 $title1 .= count($cases1[$h]).
' '.(count($cases1[$h]) == 1 ? $langs->trans(
"Event") : $langs->trans(
"Events"));
1366 $string1 =
' ';
1367 if (empty($conf->global->AGENDA_NO_TRANSPARENT_ON_NOT_BUSY)) {
1368 $style1 =
'peruser_notbusy';
1370 $style1 =
'peruser_busy';
1372 foreach ($cases1[$h] as $id => $ev) {
1374 $style1 =
'peruser_busy';
1378 if (isset($cases2[$h]) && $cases2[$h] !=
'') {
1380 if (count($cases2[$h]) > 1) {
1381 $title2 .= count($cases2[$h]).
' '.(count($cases2[$h]) == 1 ? $langs->trans(
"Event") : $langs->trans(
"Events"));
1383 $string2 =
' ';
1384 if (empty($conf->global->AGENDA_NO_TRANSPARENT_ON_NOT_BUSY)) {
1385 $style2 =
'peruser_notbusy';
1387 $style2 =
'peruser_busy';
1389 foreach ($cases2[$h] as $id => $ev) {
1391 $style2 =
'peruser_busy';
1398 if (!empty($cases1[$h]) && is_array($cases1[$h]) && count($cases1[$h]) && array_keys($cases1[$h])) {
1399 $ids1 = join(
',', array_keys($cases1[$h]));
1401 if (!empty($cases2[$h]) && is_array($cases2[$h]) && count($cases2[$h]) && array_keys($cases2[$h])) {
1402 $ids2 = join(
',', array_keys($cases2[$h]));
1405 if ($h == $begin_h) {
1406 echo
'<td class="'.$style.
'_peruserleft cal_peruser'.($var ?
' cal_impair '.$style.
'_impair' :
'').
'">';
1408 echo
'<td class="'.$style.
' cal_peruser'.($var ?
' cal_impair '.$style.
'_impair' :
'').
'">';
1410 if (!empty($cases1[$h]) && is_array($cases1[$h]) && count($cases1[$h]) == 1) {
1411 $output = array_slice($cases1[$h], 0, 1);
1412 $title1 = $langs->trans(
"Ref").
' '.$ids1.($title1 ?
' - '.$title1 :
'');
1413 if ($output[0][
'string']) {
1414 $title1 .= ($title1 ?
' - ' :
'').$output[0][
'string'];
1416 if ($output[0][
'color']) {
1417 $color1 = $output[0][
'color'];
1419 } elseif (!empty($cases1[$h]) && is_array($cases1[$h]) && count($cases1[$h]) > 1) {
1420 $title1 = $langs->trans(
"Ref").
' '.$ids1.($title1 ?
' - '.$title1 :
'');
1424 if (!empty($cases2[$h]) && is_array($cases2[$h]) && count($cases2[$h]) == 1) {
1425 $output = array_slice($cases2[$h], 0, 1);
1426 $title2 = $langs->trans(
"Ref").
' '.$ids2.($title2 ?
' - '.$title2 :
'');
1427 if ($output[0][
'string']) {
1428 $title2 .= ($title2 ?
' - ' :
'').$output[0][
'string'];
1430 if ($output[0][
'color']) {
1431 $color2 = $output[0][
'color'];
1433 } elseif (!empty($cases2[$h]) && is_array($cases2[$h]) && count($cases2[$h]) > 1) {
1434 $title2 = $langs->trans(
"Ref").
' '.$ids2.($title2 ?
' - '.$title2 :
'');
1437 print
'<table class="nobordernopadding" width="100%">';
1439 if ($style1 ==
'peruser_notbusy') {
1440 print
'style="border: 1px solid #'.($color1 ? $color1 :
"888").
' !important" ';
1441 } elseif ($color1) {
1442 print ($color1 ?
'style="background: #'.$color1.
';"' :
'');
1445 print ($style1 ? $style1.
' ' :
'');
1446 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.
'"' :
'').
'>';
1449 if ($style2 ==
'peruser_notbusy') {
1450 print
'style="border: 1px solid #'.($color2 ? $color2 :
"888").
' !important" ';
1451 } elseif ($color2) {
1452 print ($color2 ?
'style="background: #'.$color2.
';"' :
'');
1455 print ($style2 ? $style2.
' ' :
'');
1456 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.
'"' :
'').
'>';
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
if($cancel &&!$id) if($action== 'add'&&!$cancel) if($action== 'delete') if($id) $form
Actions.
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...
Class to manage agenda events (actions)
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_get_first_day_week($day, $month, $year, $gm=false)
Return first day of week for a date.
dol_now($mode= 'auto')
Return date for now.
calendars_prepare_head($param)
Define head array for tabs of agenda setup pages.
Class to manage Dolibarr users.
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOCSRFCHECK')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
dol_string_nospecial($str, $newstr= '_', $badcharstoreplace= '', $badcharstoremove= '')
Clean a string from all punctuation characters to use it as a ref or login.
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...
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.
dol_time_plus_duree($time, $duration_value, $duration_unit, $ruleforendofmonth=0)
Add a delay to a date.
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
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.
dol_get_next_week($day, $week, $month, $year)
Return next week.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form...
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage projects.
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_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.
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.
accessforbidden($message= '', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
restrictedArea($user, $features, $objectid=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.
if(isModEnabled('facture')&&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur')&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)&&$user->rights->fournisseur->facture->lire)||(isModEnabled('supplier_invoice')&&$user->rights->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->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
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_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...