| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- <?php
- Lib::loadClass('RouteBase');
- Lib::loadClass('Config');
- Lib::loadClass('UI');
- Lib::loadClass('Request');
- Lib::loadClass('ProcesHelper');
- class Route_UrlAction_Calendar extends RouteBase {// TODO: UrlActionBase @see Route_UrlAction
- public function handleAuth() {
- if (!User::logged()) {
- //throw new HttpException('Unauthorized', 401);
- User::authByRequest();
- }
- }
- public function defaultAction() {
- UI::gora();
- UI::menu();
- try {
- $userLogin = V::get('USER_ID', '', $_REQUEST, 'string');
- if (empty($userLogin)) {
- $userLogin = User::getLogin();
- }
- $this->showCalendar($userLogin);
- } catch (Exception $e) {
- UI::alert('danger', "Error: " . $e->getMessage());
- }
- UI::dol();
- }
- public function showCalendar($userLogin) {
- echo '<div class="container-fluid">';
- echo '<div class="row">';
- echo '<div class="col-md-12">';
- echo '<div id="calendar" style="margin-top:15px"></div>';
- echo "</div>";
- echo "</div>";
- // echo "<script>var BASE_URL = '".Request::getPathUri()."';var USER='".$userLogin."';var TableId=".ProcesHelper::getZasobTableID('GRAFIK_PRACY').";</script>";
- echo '<script src="static/sweetalert2.min.js"></script>';
- echo '<link rel="stylesheet" type="text/css" href="static/sweetalert2.min.css">';
- echo '<script src="static/fullcalendar.min.js"></script>';
- echo '<link rel="stylesheet" href="static/fullcalendar.min.css" type="text/css" />';
- // echo '<script src="static/calendar.js?11.1"></script>';
- UI::inlineJS(APP_PATH_WWW . '/static/calendar.js', [
- 'BASE_URL' => Request::getPathUri(),
- 'USER' => $userLogin,
- 'TableId' => ProcesHelper::getZasobTableID('GRAFIK_PRACY'),
- 'CALENDAR_NODE_ID' => 'calendar',
- 'DBG' => (V::get('DBG', '', $_GET)) ? 1 : 0
- ]);
- $this->showCss();
- //echo '<link rel="stylesheet" type="text/css" href="//cdnjs.cloudflare.com/ajax/libs/fullcalendar/2.9.0/fullcalendar.print.css">';
- }
- public function showCss(){
- ?>
- <style>
- .workingHours{
- padding:10px;
- text-align:center;
- font-size:1.3em;
- }
- .empty{
- padding:10px;
- text-align:center;
- color:black;
- opacity:0.8;
- font-size:1.3em;
- background-color:#ededed;
- }
- .empty:hover{
- opacity:1;
- color:black;
- }
- </style>
- <?php
- }
- }
|