<?php require_once "../core/core.inc"; require_once "../core/view.php"; //$days_array = Dispatcher::get_days_info(); $morning_tours_array = HoursController::getHours("morning", "Default", "get_timetable"); $evening_tours_array = HoursController::getHours("evening", "Default", "get_timetable"); $vouchers_info_array = Dispatcher::booking_get_booking_info("slevomat", ""); $booking_info_array = Dispatcher::booking_get_booking_info("tourists", ""); $directions_info = MainController::getDirInfo(); $json_morning_tours_array = json_encode($morning_tours_array); $json_evening_tours_array = json_encode($evening_tours_array); ?> <div class="modal fade" id="timetable-modal" data-clicked-create-type="Default" data-modal-weekday="" data-modal-date="" data-backdrop="false" tabindex="-1" role="dialog" aria-labelledby="timetable-modal" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content timetable-modal-content"> <div class="modal-header timetable-modal-header"> <button type="button" class="global-close" data-dismiss="modal" aria-hidden="true">×</button> <!--<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>--> <div class="modal-title" id=set-timetable-label>Set timetable</div> </div> <div class="modal-body timetable-modal-body"> <div class="tours_wrapper"> <table class="tours_wrapper_table">
static function booking_get_reservations() { $dateArray = $_POST['dateArray']; $language = $_POST['language']; $directionID = "directions_" . $language . "_id"; $result = array(); $instructors = array(); $resultIndex = 0; for ($i = 0; $i < count($dateArray); $i++) { $date = $dateArray[$i]; $_POST['date'] = $date; $_POST['weekday'] = strtoupper(date('D', strtotime($date))); $result[$resultIndex]['hoursInfo']['morning'] = DateHours::get("morning", "get_timetable"); $result[$resultIndex]['hoursInfo']['evening'] = DateHours::get("evening", "get_timetable"); $reservationCursor = Dispatcher::$mysqli->query("select * from reservation_has_hours where reservation_has_hours.`date`='{$date}'"); if ($reservationCursor->num_rows > 0) { $result[$resultIndex]['date'] = $date; $result[$resultIndex]['eventExist'] = 1; $resIndex = 0; while ($reservationRow = $reservationCursor->fetch_assoc()) { $client_id = $reservationRow['Person_id']; $hours_id = $reservationRow['hours_id']; $directions_id = $reservationRow['directions_en_id']; $clientCursor = Dispatcher::$mysqli->query("select name, telefone, email, `permission` from person where id={$client_id}"); $clientRow = $clientCursor->fetch_assoc(); $hoursCursor = Dispatcher::$mysqli->query("select * from hours_to_display where id={$hours_id}"); $hoursRow = $hoursCursor->fetch_assoc(); $hourType = $hoursRow['type']; for ($hourIndex = 0; $hourIndex < count($result[$resultIndex]['hoursInfo']["{$hourType}"]); $hourIndex++) { if ($result[$resultIndex]['hoursInfo']["{$hourType}"][$hourIndex]['hour_from'] == $hoursRow['hour_from'] && $result[$resultIndex]['hoursInfo']["{$hourType}"][$hourIndex]['hour_to'] == $hoursRow['hour_to']) { $hoursRow['id'] = $result[$resultIndex]['hoursInfo']["{$hourType}"][$hourIndex]['hourID']; $hoursRow['hour_from'] = $result[$resultIndex]['hoursInfo']["{$hourType}"][$hourIndex]['hour_from']; $hoursRow['hour_to'] = $result[$resultIndex]['hoursInfo']["{$hourType}"][$hourIndex]['hour_to']; $hoursRow['hours'] = $result[$resultIndex]['hoursInfo']["{$hourType}"][$hourIndex]['hours']; $hoursRow['type'] = $hourType; $hoursRow['reserve_type'] = $result[$resultIndex]['hoursInfo']["{$hourType}"][$hourIndex]['reserve_type']; $hoursRow['during_type'] = $result[$resultIndex]['hoursInfo']["{$hourType}"][$hourIndex]['during_type']; $hoursRow['create_type'] = $result[$resultIndex]['hoursInfo']["{$hourType}"][$hourIndex]['create_type']; $hoursRow['max_places'] = $result[$resultIndex]['hoursInfo']["{$hourType}"][$hourIndex]['max_places']; $hoursRow['state'] = $result[$resultIndex]['hoursInfo']["{$hourType}"][$hourIndex]['state']; $hoursRow['display'] = $result[$resultIndex]['hoursInfo']["{$hourType}"][$hourIndex]['display']; $hoursRow['date'] = $result[$resultIndex]['hoursInfo']["{$hourType}"][$hourIndex]['date']; $hoursRow['weekday'] = $result[$resultIndex]['hoursInfo']["{$hourType}"][$hourIndex]['weekday']; $hoursRow['has_changes'] = $result[$resultIndex]['hoursInfo']["{$hourType}"][$hourIndex]['has_changes']; $hours_id = $hoursRow['id']; break; } } // MainController::printArray($hoursRow); $instructorCursor = Dispatcher::$mysqli->query("select instructor.`Person_id` as instructor_id, " . " person.`name`, person.email, person.`permission`, person.telefone," . " instructor.color, instructor.calendar_id, instructor.status from instructor_has_hours " . "join hours_to_display on instructor_has_hours.hours_id=hours_to_display.id " . "join instructor on instructor_has_hours.instructor_id=instructor.`Person_id` " . "join person on instructor.`Person_id`=person.id where hours_id={$hours_id}"); $instructorRow = $instructorCursor->fetch_assoc(); $customInstructorCursor = Dispatcher::$mysqli->query("select custom_intsructor.hours_id, custom_intsructor.instructor_id, " . "person.name, person.email, person.`permission`, person.telefone, instructor.color, " . "instructor.calendar_id, instructor.status from custom_intsructor " . "join instructor on custom_intsructor.instructor_id=instructor.`Person_id` " . "join person on instructor.`Person_id`=person.id " . "where custom_intsructor.`date`='{$date}' and custom_intsructor.hours_id={$hours_id}"); if ($customInstructorCursor->num_rows > 0) { $customInstructorRow = $customInstructorCursor->fetch_assoc(); $instructorRow = $customInstructorRow; } $instructorExist = 0; if (isset($result[$resultIndex]['instructorsInfo']["{$hourType}"])) { for ($insIndex = 0; $insIndex < count($result[$resultIndex]['instructorsInfo']["{$hourType}"]); $insIndex++) { if ($result[$resultIndex]['instructorsInfo']["{$hourType}"][$insIndex]['instructor_id'] == $instructorRow['instructor_id']) { $instructorExist = 1; break; } } } if ($instructorExist == 0) { $result[$resultIndex]['instructorsInfo']["{$hourType}"][] = $instructorRow; } $directionCursor = Dispatcher::$mysqli->query("select name from directions_en where id={$directions_id}"); $directionRow = $directionCursor->fetch_assoc(); $during_type = $hoursRow['during_type']; $vouchersInfoCursor = Dispatcher::$mysqli->query("select * from voucher_info where `type`='{$during_type}'"); $vouchersInfoRow = $vouchersInfoCursor->fetch_assoc(); $result[$resultIndex]['reservationInfo'][$resIndex]['date'] = $date; $result[$resultIndex]['reservationInfo'][$resIndex]['choosen_places'] = $reservationRow['choosen_places']; $result[$resultIndex]['reservationInfo'][$resIndex]['clientInfo'] = $clientRow; $result[$resultIndex]['reservationInfo'][$resIndex]['hoursInfo'] = $hoursRow; $result[$resultIndex]['reservationInfo'][$resIndex]['hour_from'] = $hoursRow['hour_from']; $result[$resultIndex]['reservationInfo'][$resIndex]['state'] = $hoursRow['state']; $result[$resultIndex]['reservationInfo'][$resIndex]['has_changes'] = $hoursRow['has_changes']; $result[$resultIndex]['reservationInfo'][$resIndex]['instructorsInfo'] = $instructorRow; $result[$resultIndex]['reservationInfo'][$resIndex]['directionsInfo'] = $directionRow; $result[$resultIndex]['reservationInfo'][$resIndex]['voucherInfo'] = $vouchersInfoRow; HoursController::sortHours($result[$resultIndex]['reservationInfo']); $resIndex++; } // MainController::printArray($reservationRow); } else { $result[$resultIndex]['date'] = $date; $result[$resultIndex]['eventExist'] = 0; } $resultIndex++; } echo json_encode($result); }
static function changeInstructor() { $instructor_id = $_POST['instructor_id']; $prev_instructor_id = $_POST['prev_instructor_id']; $hour_id = $_POST['hour_id']; $hours = HoursController::getHoursById($hour_id); $_POST['from'] = $hours['hour_from']; $_POST['to'] = $hours['hour_to']; $_POST[''] = $hours['hour_to']; $_POST['type'] = $hours['type']; $_POST['reserve_type'] = $hours['reserve_type']; $_POST['during_type'] = $hours['during_type']; $_POST['max_places'] = $hours['max_places']; Dispatcher::$mysqli->query("update instructor_has_hours set " . "instructor_id={$instructor_id} where " . "instructor_id={$prev_instructor_id} and hours_id={$hour_id}"); print_r(Dispatcher::$mysqli->error); }
static function changeInstructor() { $instructor_id = $_POST['instructor_id']; $prev_instructor_id = $_POST['prev_instructor_id']; $hour_id = $_POST['hour_id']; $hour_create_type = $_POST['hour_create_type']; $clicked_create_type = $_POST['clicked_create_type']; $date = $_POST['date']; if ($hour_create_type == "Date") { Dispatcher::$mysqli->query("update instructor_has_hours set " . "instructor_id={$instructor_id} where " . "instructor_id={$prev_instructor_id} and hours_id={$hour_id}"); } else { if ($hour_create_type == "Default") { $cursor = Dispatcher::$mysqli->query("select * from custom_intsructor where " . "create_type='Default' and date='{$date}' and hours_id={$hour_id} and instructor_id={$prev_instructor_id}"); if ($cursor->num_rows > 0) { Dispatcher::$mysqli->query("update custom_intsructor set " . "instructor_id={$instructor_id} where " . "instructor_id={$prev_instructor_id} " . "and hours_id={$hour_id} and create_type='Default' and date='{$date}'"); } else { Dispatcher::$mysqli->query("insert into custom_intsructor(instructor_id, hours_id, create_type, date) " . "values ({$instructor_id}, {$hour_id}, 'Default', '{$date}')"); } print_r(Dispatcher::$mysqli->error); } else { if ($hour_create_type == "Weekday") { echo '<br><br>' . $date . " " . $hour_id . " " . $prev_instructor_id . " in dateHours<br><br>"; $cursor = Dispatcher::$mysqli->query("select * from custom_intsructor where " . "date='{$date}' and hours_id={$hour_id} and instructor_id={$prev_instructor_id}"); if ($cursor->num_rows > 0) { Dispatcher::$mysqli->query("update custom_intsructor set " . "instructor_id={$instructor_id} where " . "instructor_id={$prev_instructor_id} " . "and hours_id={$hour_id} and date='{$date}'"); } else { Dispatcher::$mysqli->query("insert into custom_intsructor(instructor_id, hours_id, create_type, date) " . "values ({$instructor_id}, {$hour_id}, '', '{$date}')"); } } } } print_r(Dispatcher::$mysqli->error); $hoursInfo = HoursController::getHoursById($hour_id); $instructorInfo = instructorController::getInstructorByID($instructor_id); $prevInsrtuctorInfo = instructorController::getInstructorByID($prev_instructor_id); $reservationsInfo = reservationController::getResevationsByDateHour($date, $hoursInfo); $calendarEventController = new InstructorCalendarEvents(); $calendarEventController->addInstructorCalendarEvent($reservationsInfo, $instructorInfo, $prevInsrtuctorInfo, $hoursInfo); }
MainController::changeWeekdayState(); } if ($action == 'booking_create_client') { MainController::booking_create_client(); } if ($action == "booking_get_confirm_code") { MainController::booking_get_confirm_code(); } if ($action == 'remove_hours') { HoursController::remove_hours(); } if ($action == 'edit_hours') { HoursController::edit_hours(); } if ($action == 'change_hour_state') { HoursController::change_hour_state(); } if ($action == 'booking_get_instructors_list_for_clndr_render') { echo json_encode(instructorController::getInstructors()); } if ($action == 'get_reservations_for_booking_calendar') { CalendarController::booking_get_reservations(); } if ($action == 'sync_google_clndr') { $calController = new InstructorCalendarEvents(); $calController->syncGoogleClndr(); } if ($action == 'get_reservations_for_booking_calendar_by_dayhours') { clientsTable(CalendarController::getDateHoursReservations()); } if ($action == 'booking_add_instructor') {
<?php require_once "../../core/core.inc"; require_once "../../core/view.php"; $lang = get_language(); $days_array = Dispatcher::get_days_info(); $morning_tours_array = HoursController::getHours("morning", "Weekday", "get_timetable"); $evening_tours_array = HoursController::getHours("evening", "Weekday", "get_timetable"); $vouchers_info_array = Dispatcher::booking_get_booking_info("slevomat", ""); $booking_info_array = Dispatcher::booking_get_booking_info("tourists", ""); $directions_info = MainController::getDirInfo(); $json_morning_tours_array = json_encode($morning_tours_array); $json_evening_tours_array = json_encode($evening_tours_array); ?> <div class="modal-dialog"> <div class="modal-content timetable-modal-content"> <div class="modal-header timetable-modal-header"> <button type="button" class="global-close" data-dismiss="modal" aria-hidden="true">×</button> <!--<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>--> <div class="modal-title" id="set-timetable-label">Set timetable</div> </div> <div class="modal-body timetable-modal-body"> <div id="days-wrapper"> <div class="days-title-label">Days</div> <table class="days-table" border = 0> <tr> <!-- <td onclick="switchDaysClick(0, 'default', this, 0);" id="weekday-all" class="days_td days-td-active"> <div class="weekday-btn-wrapper">
static function changeInstructor() { $instructor_id = $_POST['instructor_id']; $prev_instructor_id = $_POST['prev_instructor_id']; $hour_id = $_POST['hour_id']; $hour_create_type = $_POST['hour_create_type']; $clicked_create_type = $_POST['clicked_create_type']; $weekday = $_POST['weekday']; $modul = $_POST['modul']; if ($clicked_create_type == $hour_create_type) { Dispatcher::$mysqli->query("update instructor_has_hours set " . "instructor_id={$instructor_id} where " . "instructor_id={$prev_instructor_id} and hours_id={$hour_id}"); } if ($clicked_create_type == "Default") { $cursor = Dispatcher::$mysqli->query("select * from custom_intsructor where " . "weekday='{$weekday}' and hours_id={$hour_id} and instructor_id={$prev_instructor_id}"); if ($cursor->num_rows > 0) { Dispatcher::$mysqli->query("update custom_intsructor set " . "instructor_id={$instructor_id} where " . "instructor_id={$prev_instructor_id} and hours_id={$hour_id}"); } else { Dispatcher::$mysqli->query("insert into custom_intsructor(instructor_id, hours_id, weekday) " . "values ({$instructor_id}, {$hour_id}, '{$weekday}')"); } print_r(Dispatcher::$mysqli->error); } $weekdayDates = $_POST['weekdayDates']; $hoursInfo = HoursController::getHoursById($hour_id); $instructorInfo = instructorController::getInstructorByID($instructor_id); $previnstructorInfo = instructorController::getInstructorByID($prev_instructor_id); for ($i = 0; $i < count($weekdayDates); $i++) { // $_POST['date'] = $weekdayDates[$i]; $reservationsInfo = reservationController::getResevationsByDateHour($weekdayDates[$i], $hoursInfo); // MainController::printArray($reservationsInfo); $calendarEventController = new InstructorCalendarEvents(); $calendarEventController->addInstructorCalendarEvent($reservationsInfo, $instructorInfo, $previnstructorInfo, $hoursInfo); } print_r(Dispatcher::$mysqli->error); }