* Copyright (C) 2003 Eric Seigne * Copyright (C) 2004-2018 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2011 Juanjo Menent * Copyright (C) 2014 Cedric GROSS * Copyright (C) 2015 Marcos García * Copyright (C) 2017 Open-DSI * Copyright (C) 2018-2021 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ /** * \file htdocs/custom/booking/booking_agenda.php * \ingroup agenda * \brief Home page of calendar events */ // Load Dolibarr environment require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT . '/custom/booking/reservation.class.php'; if (isModEnabled('project')) { require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php'; } if (!isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) { $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW = 3; } if (empty($conf->global->AGENDA_EXT_NB)) { $conf->global->AGENDA_EXT_NB = 5; } $MAXAGENDA = $conf->global->AGENDA_EXT_NB; $disabledefaultvalues = GETPOST('disabledefaultvalues', 'int'); $check_holiday = GETPOST('check_holiday', 'int'); $filter = GETPOST("search_filter", 'alpha', 3) ? GETPOST("search_filter", 'alpha', 3) : GETPOST("filter", 'alpha', 3); $filtert = GETPOST("search_filtert", "int", 3) ? GETPOST("search_filtert", "int", 3) : GETPOST("filtert", "int", 3); $usergroup = GETPOST("search_usergroup", "int", 3) ? GETPOST("search_usergroup", "int", 3) : GETPOST("usergroup", "int", 3); $showbirthday = empty($conf->use_javascript_ajax) ? GETPOST("showbirthday", "int") : 1; // If not choice done on calendar owner (like on left menu link "Agenda"), we filter on user. if (empty($filtert) && empty($conf->global->AGENDA_ALL_CALENDARS)) { $filtert = $user->id; } $newparam = ''; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $offset = $limit * $page; if (!$sortorder) { $sortorder = "ASC"; } if (!$sortfield) { $sortfield = "a.datec"; } // Security check $socid = GETPOST("search_socid", "int") ? GETPOST("search_socid", "int") : GETPOST("socid", "int"); if ($user->socid) { $socid = $user->socid; } if ($socid < 0) { $socid = ''; } $canedit = 1; if (empty($user->rights->agenda->myactions->read)) { accessforbidden(); } if (empty($user->rights->agenda->allactions->read)) { $canedit = 0; } if (empty($user->rights->agenda->allactions->read) || $filter == 'mine') { // If no permission to see all, we show only affected to me $filtert = $user->id; } $action = GETPOST('action', 'aZ09'); $time1 = GETPOST('time1', 'none'); $time2 = GETPOST('time2', 'none'); $facilitie = GETPOST('facilitie', 'numeric'); $area = GETPOST('area', 'numeric'); $profile = GETPOST('profile', 'numeric'); $daterange = GETPOST('daterange', 'none'); $addreservation = GETPOST('addreservation', 'numeric'); $mode = GETPOST('mode', 'aZ09'); if (empty($mode) && preg_match('/show_/', $action)) { $mode = $action; // For backward compatibility } // Load translation files required by the page $langs->loadLangs(array('agenda', 'other', 'commercial')); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('agenda')); $result = restrictedArea($user, 'agenda', 0, 'actioncomm&societe', 'myactions|allactions', 'fk_soc', 'id'); if ($user->socid && $socid) { $result = restrictedArea($user, 'societe', $socid); } $reshook = $hookmanager->executeHooks('beforeAgenda', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } $help_url = 'EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda'; llxHeader('', $langs->trans("Agenda"), $help_url); $form = new Form($db); $reservation = new Reservation(); $facilities = ["1" => "Gellért fürdő", "2" => "Széchenyi fürdő", "3" => "Lukács fürdő"]; $area2 = [ "1" => ["1" => "Medence_1", "2" => "Medence_2", "3" => "Focipálya"], "2" => ["1" => "Medence_1", "2" => "Medence_2"], "3" => ["1" => "Medence_1", "2" => "Focipálya"] ]; $areas = ["1" => "Medence_1", "2" => "Medence_2", "3" => "Focipálya"]; $profiles = [ "1" => ["id" => 1, "idclass" => "SwimmingPoolLine", "name" => "SwimmingPool", "lines" => "6", "type" => 'H', "frameName" => "SwimmingPoolTitle"], "2" => ["id" => 2, "idclass" => "PoolLine", "name" => "Pool", "lines" => "4", "type" => 'V', "frameName" => "PoolTitle"], "3" => ["id" => 3, "idclass" => "PoloLine", "name" => "Polo", "lines" => "3", "type" => 'V', "frameName" => "PoloTitle"] ]; //print_r($_REQUEST); if ($addreservation == 1) { print_r($_REQUEST); /* $reservation = new stdClass(); $reservation->facilitie = $facilitie; $reservation->area = $area; $reservation->daterange = $daterange; $reservation->profile = $profile; $reservation->fromtime = $time1; $reservation->totime = $time2; print_r($reservation);exit; */ } // Fürdő és Medence választás print '

' . $langs->trans("reservationTitle") . '

'; print '
'; print '
'; print '
'; print '
'; if ($daterange == '') { $daterange = date("Y-m-d", dol_now()) . ' - ' . date("Y-m-d", dol_now()); } $reservation->generateSelectorInput('facilitie', $facilities, $facilitie); print '
'; $reservation->generateSelectorDateInput('date', $daterange); print '
'; print '
'; $time1Value = $time1 == '' ? '06:00' : $time1; $time2Value = $time2 == '' ? '22:00' : $time2; //$reservation->generateTimerLine($time1Value, $time2Value); print '
-
'; print '
'; print '
'; print '
'; print ''; ?>