Copybara bot | be50d49 | 2023-11-30 00:16:42 +0100 | [diff] [blame^] | 1 | <?php |
| 2 | require_once("core.php"); |
| 3 | security::checkType(security::WORKER); |
| 4 | security::checkWorkerUIEnabled(); |
| 5 | |
| 6 | $id = (int)people::userData("id"); |
| 7 | |
| 8 | $p = people::get($id); |
| 9 | |
| 10 | if ($p === false) { |
| 11 | security::go((security::isAdminView() ? "workers.php" : "workerhome.php")); |
| 12 | } |
| 13 | |
| 14 | $cal = calendars::getCurrentCalendarByCategory($p["categoryid"]); |
| 15 | if ($cal === false) security::go("workerhome.php?msg=unexpected"); |
| 16 | |
| 17 | $mdHeaderRowBefore = visual::backBtn("workerschedule.php"); |
| 18 | ?> |
| 19 | <!DOCTYPE html> |
| 20 | <html> |
| 21 | <head> |
| 22 | <title><?php echo $conf["appName"]; ?></title> |
| 23 | <?php visual::includeHead(); ?> |
| 24 | <link rel="stylesheet" href="css/dashboard.css"> |
| 25 | <link rel="stylesheet" href="css/calendar.css"> |
| 26 | </head> |
| 27 | <?php visual::printBodyTag(); ?> |
| 28 | <div class="mdl-layout mdl-js-layout mdl-layout--fixed-header mdl-layout--fixed-drawer"> |
| 29 | <?php visual::includeNav(); ?> |
| 30 | <main class="mdl-layout__content"> |
| 31 | <div class="page-content"> |
| 32 | <div class="main mdl-shadow--4dp"> |
| 33 | <h2>Calendario laboral</h2> |
| 34 | |
| 35 | <?php |
| 36 | if ($cal === calendars::NO_CALENDAR_APPLICABLE) { |
| 37 | echo "<p>Actualmente no tienes asignado ningĂșn calendario laboral.</p>"; |
| 38 | } else { |
| 39 | $current = new DateTime(); |
| 40 | $current->setTimestamp($cal["begins"]); |
| 41 | $ends = new DateTime(); |
| 42 | $ends->setTimestamp($cal["ends"]); |
| 43 | |
| 44 | calendarsView::renderCalendar($current, $ends, function ($timestamp, $id, $dow, $dom, $extra) { |
| 45 | return ($extra[$timestamp] == $id); |
| 46 | }, true, $cal["details"]); |
| 47 | } |
| 48 | ?> |
| 49 | |
| 50 | <?php visual::printDebug("calendars::getCurrentCalendarByCategory(".(int)$p["categoryid"].")", $cal); ?> |
| 51 | </div> |
| 52 | </div> |
| 53 | </main> |
| 54 | </div> |
| 55 | |
| 56 | <script src="js/calendar.js"></script> |
| 57 | |
| 58 | <?php |
| 59 | visual::smartSnackbar([ |
| 60 | ["unexpected", "Ha ocurrido un error inesperado. Inténtelo de nuevo en unos segundos."] |
| 61 | ]); |
| 62 | ?> |
| 63 | </body> |
| 64 | </html> |