Call self::showSingleLinePlanningFilter for each filters and plannings
static public showPlanningFilter ( ) : Nothing | ||
return | Nothing | (display function) |
/** * Show the planning * * Function name change since version 0.84 show() => showPlanning * Function prototype changes in 9.1 (no more parameters) * * @return Nothing (display function) **/ static function showPlanning($fullview = true) { global $CFG_GLPI, $DB; if (!static::canView()) { return false; } $fullview_str = $fullview ? "true" : "false"; $pl_height = "\$(document).height()-280"; if ($_SESSION['glpilayout'] == "vsplit") { $pl_height = "\$('.ui-tabs-panel').height()-30"; } $date_formats = array(0 => __('YYYY MMM DD'), 1 => __('DD MMM YYYY'), 2 => __('MMM DD YYYY')); $date_format = $date_formats[$_SESSION["glpidate_format"]]; self::initSessionForCurrentUser(); if ($fullview) { Planning::showPlanningFilter(); $default_view = "agendaWeek"; $header = "{\n left: 'prev,next,today',\n center: 'title',\n right: 'month,agendaWeek,agendaDay'\n }"; } else { $default_view = "basicDay"; $header = "false"; $pl_height = "400"; } echo "<div id='planning'></div>"; echo Html::scriptBlock("\n \$(document).ready(function() {\n var disable_qtip = false,\n disable_edit = false;\n \$('html')\n .mousedown(function() {\n disable_qtip = true;\n \$('.qtip').hide();\n })\n .mouseup(function() {\n disable_qtip = false;\n });\n\n var window_focused = true;\n window.onblur = function() { window_focused = false; }\n window.onfocus = function() { window_focused = true; }\n\n \$('#planning').fullCalendar({\n height: {$pl_height},\n theme: true,\n weekNumbers: " . ($fullview ? 'true' : 'false') . ",\n defaultView: '{$default_view}',\n timeFormat: 'H:mm',\n eventLimit: true, // show 'more' button when too mmany events\n minTime: '" . $CFG_GLPI['planning_begin'] . "',\n maxTime: '" . $CFG_GLPI['planning_end'] . "',\n windowResize: function(view) {\n \$(this).fullCalendar('option', 'height', {$pl_height});\n },\n header: {$header},\n views: {\n month: {\n titleFormat: '{$date_format}'\n },\n agendaWeek: {\n titleFormat: '{$date_format}'\n },\n agendaDay: {\n titleFormat: '{$date_format}'\n }\n },\n viewRender: function(view){ // on date changes, replicate to datepicker\n var currentdate = view.intervalStart;\n \$('#planning_datepicker').datepicker('setDate', new Date(currentdate));\n },\n eventRender: function(event, element, view) {\n element.find('.fc-content')\n .after('<span class=\"event_type\" style=\"background-color: '+event.typeColor+'\"> </span>');\n\n var content = event.content;\n if(view.name !== 'month' && !event.allDay){\n element\n .append('<div class=\"content\">'+content+'</div>');\n }\n\n // add tooltip to event\n if (!disable_qtip) {\n element.qtip({\n position: {\n viewport: \$(window)\n },\n content: content,\n style: {\n classes: 'qtip-shadow qtip-bootstrap'\n },\n show: {\n solo: true,\n delay: 400\n },\n hide: {\n fixed: true,\n delay: 100\n },\n events: {\n show: function(event, api) {\n if(!window_focused) {\n event.preventDefault();\n }\n }\n }\n });\n }\n },\n eventSources: [{\n url: '" . $CFG_GLPI['root_doc'] . "/ajax/planning.php',\n type: 'POST',\n data: {\n action: 'get_events'\n },\n success: function(data) {\n if (!{$fullview_str} && data.length == 0) {\n \$('#planning').fullCalendar('option', 'height', 0);\n }\n },\n error: function() {\n console.log('there was an error while fetching events!');\n }\n }],\n\n // EDIT EVENTS\n editable: true, // we can drag and resize events\n eventResize: function(event, delta, revertFunc) {\n editEventTimes(event, revertFunc);\n },\n eventResizeStart: function() {\n disable_edit = true;\n },\n eventResizeStop: function() {\n setTimeout(function(){\n disable_edit = false;\n }, 300);\n },\n eventDrop: function(event, delta, revertFunc) {\n editEventTimes(event, revertFunc);\n },\n eventClick: function(event) {\n if (event.ajaxurl && !disable_edit) {\n \$('<div>')\n .dialog({\n modal: true,\n width: 'auto',\n height: 'auto'\n })\n .load(event.ajaxurl, function() {\n \$(this).dialog('option', 'position', ['center', 'center'] );\n });\n return false;\n };\n },\n\n\n // ADD EVENTS\n selectable: true,\n /*selectHelper: function(start, end) {\n return \$('<div class=\"planning-select-helper\" />').text(start+' '+end);\n },*/ // doesn't work anymore: see https://github.com/fullcalendar/fullcalendar/issues/2832\n select: function(start, end, jsEvent) {\n \$('<div>').dialog({\n modal: true,\n width: 'auto',\n height: 'auto',\n open: function () {\n \$(this).load(\n '" . $CFG_GLPI['root_doc'] . "/ajax/planning.php?action=add_event_fromselect',\n {\n begin: start.format(),\n end: end.format()\n },\n function() {\n \$(this).dialog('option', 'position', ['center', 'center'] );\n }\n );\n },\n position: {\n my: 'center',\n at: 'center',\n viewport: \$(window)\n }\n });\n\n \$('#planning').fullCalendar('unselect');\n }\n });\n\n\n // send ajax for event storage (on event drag/resize)\n var editEventTimes = function(event, revertFunc) {\n if (event._allDay) {\n var start = event.start.format()+'T00:00:00';\n var end = start;\n if (typeof event.end != 'undefined') {\n if (event.end == null) {\n end = \$.fullCalendar.moment(event.start)\n .add(1, 'days')\n .format()+'T00:00:00';\n } else {\n end = event.end.format()+'T00:00:00';\n }\n }\n\n } else {\n var start = event.start.format();\n if (event.end == null) {\n var end = \$.fullCalendar.moment(event.start)\n .add(2, 'hours')\n .format();\n } else {\n var end = event.end.format();\n }\n }\n\n \$.ajax({\n url: '" . $CFG_GLPI['root_doc'] . "/ajax/planning.php',\n type: 'POST',\n data: {\n action: 'update_event_times',\n start: start,\n end: end,\n itemtype: event.itemtype,\n items_id: event.items_id\n },\n success: function(html) {\n if (!html) {\n revertFunc();\n }\n \$('#planning').fullCalendar('updateEvent', event);\n displayAjaxMessageAfterRedirect();\n },\n error: function() {\n revertFunc();\n }\n });\n };\n\n // attach button (planning and refresh) in planning header\n \$('#planning .fc-toolbar .fc-center h2')\n .after(\n \$('<img id=\"refresh_planning\" class=\"pointer\" src=\"" . $CFG_GLPI['root_doc'] . "/pics/refresh.png\">')\n ).after(\n \$('<input type=\"hidden\" id=\"planning_datepicker\">')\n );\n\n \$('#refresh_planning').click(function() {\n \$('#planning').fullCalendar('refetchEvents')\n })\n\n // datepicker behavior\n \$('#planning_datepicker').datepicker({\n changeMonth: true,\n changeYear: true,\n numberOfMonths: 3,\n showOn: 'button',\n buttonImage: '" . $CFG_GLPI['root_doc'] . "/pics/calendar.png',\n buttonImageOnly: true,\n dateFormat: 'DD, d MM, yy',\n onSelect: function(dateText, inst) {\n var selected_date = \$(this).datepicker('getDate');\n \$('#planning').fullCalendar('gotoDate', selected_date);\n }\n });\n });"); return; }
if ($_REQUEST["action"] == "add_planning_form") { Planning::showAddPlanningForm(); } if ($_REQUEST["action"] == "add_user_form") { Planning::showAddUserForm(); } if ($_REQUEST["action"] == "add_group_users_form") { Planning::showAddGroupUsersForm(); } if ($_REQUEST["action"] == "add_group_form") { Planning::showAddGroupForm(); } if ($_REQUEST["action"] == "add_event_classic_form") { Planning::showAddEventClassicForm($_REQUEST); } if ($_REQUEST["action"] == "edit_event_form") { Planning::editEventForm($_REQUEST); } if ($_REQUEST["action"] == "get_filters_form") { Planning::showPlanningFilter(); } if ($_REQUEST["action"] == "toggle_filter") { Planning::toggleFilter($_REQUEST); } if ($_REQUEST["action"] == "color_filter") { Planning::colorFilter($_REQUEST); } if ($_REQUEST["action"] == "delete_filter") { Planning::deleteFilter($_REQUEST); } Html::ajaxFooter();