|
7 | 7 | include '../../../inc/includes.php'; |
8 | 8 |
|
9 | 9 | if (Session::getCurrentInterface() == "helpdesk") { |
10 | | - Html::helpHeader(__('Simplified interface'), $_SERVER['PHP_SELF'], $_SESSION["glpiname"]); |
| 10 | + Html::helpHeader(__('Simplified interface'), $_SERVER['PHP_SELF'], $_SESSION["glpiname"]); |
11 | 11 | } else { |
12 | | - Html::header(PluginReservationMenu::getTypeName(2), $_SERVER['PHP_SELF'], "plugins", "pluginreservationmenu", "reservation"); |
| 12 | + Html::header(PluginReservationMenu::getTypeName(2), $_SERVER['PHP_SELF'], "plugins", "pluginreservationmenu", "reservation"); |
13 | 13 | } |
14 | 14 |
|
15 | 15 | // Check if plugin is activated... |
16 | 16 | $plugin = new Plugin(); |
17 | 17 | if (!$plugin->isInstalled('reservation') || !$plugin->isActivated('reservation')) { |
18 | | - Html::displayNotFoundError(); |
| 18 | + Html::displayNotFoundError(); |
19 | 19 | } |
20 | 20 |
|
21 | 21 | Session::checkRightsOr("reservation", [CREATE, UPDATE, DELETE]); |
|
38 | 38 |
|
39 | 39 | $form_dates["begin"] = date("Y-m-d H:i:s", $begin_time); |
40 | 40 | if ($planning_end_date > date("Y-m-d H:i:s", time())) { |
41 | | - $form_dates['end'] = $planning_end_date; |
| 41 | + $form_dates['end'] = $planning_end_date; |
42 | 42 | } else { |
43 | | - $form_dates['end'] = date("Y-m-d H:i:s", mktime(23, 59, 00, $month, $day, $year)); |
| 43 | + $form_dates['end'] = date("Y-m-d H:i:s", mktime(23, 59, 00, $month, $day, $year)); |
44 | 44 | } |
45 | 45 |
|
46 | 46 | if (isset($_POST['date_begin'])) { |
47 | | - $form_dates["begin"] = $_POST['date_begin']; |
| 47 | + $form_dates["begin"] = $_POST['date_begin']; |
48 | 48 | } |
49 | 49 | if (isset($_GET['date_begin'])) { |
50 | | - $form_dates["begin"] = $_GET['date_begin']; |
| 50 | + $form_dates["begin"] = $_GET['date_begin']; |
51 | 51 | } |
52 | 52 | if (isset($_POST['date_end'])) { |
53 | | - $form_dates["end"] = $_POST['date_end']; |
| 53 | + $form_dates["end"] = $_POST['date_end']; |
54 | 54 | } |
55 | 55 | if (isset($_GET['date_end'])) { |
56 | | - $form_dates["end"] = $_GET['date_end']; |
| 56 | + $form_dates["end"] = $_GET['date_end']; |
57 | 57 | } |
58 | 58 | if (isset($_POST['nextday']) || isset($_GET['nextday'])) { |
59 | | - $form_dates = $_SESSION['glpi_plugin_reservation_form_dates']; |
60 | | - $day = date("d", strtotime($form_dates["begin"]) + DAY_TIMESTAMP); |
61 | | - $month = date("m", strtotime($form_dates["begin"]) + DAY_TIMESTAMP); |
62 | | - $year = date("Y", strtotime($form_dates["begin"]) + DAY_TIMESTAMP); |
| 59 | + $form_dates = $_SESSION['glpi_plugin_reservation_form_dates']; |
| 60 | + $day = date("d", strtotime($form_dates["begin"]) + DAY_TIMESTAMP); |
| 61 | + $month = date("m", strtotime($form_dates["begin"]) + DAY_TIMESTAMP); |
| 62 | + $year = date("Y", strtotime($form_dates["begin"]) + DAY_TIMESTAMP); |
63 | 63 |
|
64 | | - $form_dates["begin"] = date("Y-m-d H:i:s", mktime($planning_begin_time[0], $planning_begin_time[1], 00, $month, $day, $year)); |
65 | | - $form_dates["end"] = date("Y-m-d H:i:s", mktime($planning_end_time[0], $planning_end_time[1], 00, $month, $day, $year)); |
| 64 | + $form_dates["begin"] = date("Y-m-d H:i:s", mktime($planning_begin_time[0], $planning_begin_time[1], 00, $month, $day, $year)); |
| 65 | + $form_dates["end"] = date("Y-m-d H:i:s", mktime($planning_end_time[0], $planning_end_time[1], 00, $month, $day, $year)); |
66 | 66 | } |
67 | 67 | if (isset($_POST['previousday']) || isset($_GET['previousday'])) { |
68 | | - $form_dates = $_SESSION['glpi_plugin_reservation_form_dates']; |
69 | | - $day = date("d", strtotime($form_dates["begin"]) - DAY_TIMESTAMP); |
70 | | - $month = date("m", strtotime($form_dates["begin"]) - DAY_TIMESTAMP); |
71 | | - $year = date("Y", strtotime($form_dates["begin"]) - DAY_TIMESTAMP); |
| 68 | + $form_dates = $_SESSION['glpi_plugin_reservation_form_dates']; |
| 69 | + $day = date("d", strtotime($form_dates["begin"]) - DAY_TIMESTAMP); |
| 70 | + $month = date("m", strtotime($form_dates["begin"]) - DAY_TIMESTAMP); |
| 71 | + $year = date("Y", strtotime($form_dates["begin"]) - DAY_TIMESTAMP); |
72 | 72 |
|
73 | | - $form_dates["begin"] = date("Y-m-d H:i:s", mktime($planning_begin_time[0], $planning_begin_time[1], 00, $month, $day, $year)); |
74 | | - $form_dates["end"] = date("Y-m-d H:i:s", mktime($planning_end_time[0], $planning_end_time[1], 00, $month, $day, $year)); |
| 73 | + $form_dates["begin"] = date("Y-m-d H:i:s", mktime($planning_begin_time[0], $planning_begin_time[1], 00, $month, $day, $year)); |
| 74 | + $form_dates["end"] = date("Y-m-d H:i:s", mktime($planning_end_time[0], $planning_end_time[1], 00, $month, $day, $year)); |
75 | 75 | } |
76 | 76 | if (isset($_GET['reset'])) { |
77 | | - unset($_SESSION['glpi_plugin_reservation_form_dates']); |
| 77 | + unset($_SESSION['glpi_plugin_reservation_form_dates']); |
78 | 78 | } |
79 | 79 | if (isset($_POST['add_item_to_reservation'])) { |
80 | | - $form_dates = $_SESSION['glpi_plugin_reservation_form_dates']; |
81 | | - $current_reservation = $_POST['add_item_to_reservation']; |
82 | | - $item_to_add = $_POST['add_item']; |
83 | | - PluginReservationReservation::addItemToResa($item_to_add, $current_reservation); |
84 | | - |
| 80 | + $form_dates = $_SESSION['glpi_plugin_reservation_form_dates']; |
| 81 | + $current_reservation = $_POST['add_item_to_reservation']; |
| 82 | + $item_to_add = $_POST['add_item']; |
| 83 | + PluginReservationReservation::addItemToResa($item_to_add, $current_reservation); |
85 | 84 | } |
86 | 85 | if (isset($_POST['switch_item_to_reservation'])) { |
87 | | - $form_dates = $_SESSION['glpi_plugin_reservation_form_dates']; |
88 | | - $current_reservation = $_POST['switch_item_to_reservation']; |
89 | | - $item_to_switch = $_POST['switch_item']; |
90 | | - PluginReservationReservation::switchItemToResa($item_to_switch, $current_reservation); |
| 86 | + $form_dates = $_SESSION['glpi_plugin_reservation_form_dates']; |
| 87 | + $current_reservation = $_POST['switch_item_to_reservation']; |
| 88 | + $item_to_switch = $_POST['switch_item']; |
| 89 | + PluginReservationReservation::switchItemToResa($item_to_switch, $current_reservation); |
| 90 | +} |
| 91 | +if (isset($_SESSION['glpi_plugin_reservation_change_in_progress'])) { |
| 92 | + $form_dates = $_SESSION['glpi_plugin_reservation_form_dates']; |
| 93 | + unset($_SESSION['glpi_plugin_reservation_change_in_progress']); |
91 | 94 | } |
92 | 95 |
|
93 | 96 | $_SESSION['glpi_plugin_reservation_form_dates'] = $form_dates; |
|
97 | 100 | $menu->display($_POST); |
98 | 101 |
|
99 | 102 | if ($_SESSION["glpiactiveprofile"]["interface"] == "central") { |
100 | | - Html::footer(); |
| 103 | + Html::footer(); |
101 | 104 | } else { |
102 | | - Html::helpFooter(); |
| 105 | + Html::helpFooter(); |
103 | 106 | } |
0 commit comments