TUCAL module for opening hours
Information on opening hours of TU Chemnitz facilities is needed in many places: on different websites (German and English), for displays, in the "TU Chemnitz" app, on the phone, etc. If there are changes, e. g. during the holiday period, it is desirable to enter them in only one place and all systems display the changed times. This is exactly what the "TUCopeningHours" module is for.
Creating and changing opening hours
Each institution is responsible for updating its own opening hours. To create and maintain them, the URZ offers a web portal at https://www-apps.hrz.tu-chemnitz.de/tucopen/. As a registered administrator, you can see your opening hours here and edit them centrally. Websites and services that use the "TUCopeningHours" module directly display the current opening hours without having to make any further adjustments.
How to register?
Write an e-mail to support@hrz.tu-chemnitz.de. Please include the following information:
- Title/name for the opening hours (e. g. „URZ user service Straße der Nationen“)
- Group name – To do this, create a group in the IdM portal with all users authorised to write. Please select "LDAP (public)" as the target system.
- Room number (optional)
Create and change opening hours
After registering, you will find a list of all opening hours in the web portal at https://www-apps.hrz.tu-chemnitz.de/tucopen/. These are initially empty. To edit them, click on the title of the respective data. You can conveniently enter the times in the calendar by dragging them.
Several time periods can be defined at the same time, e. g. to distinguish between lecture periods and lecture-free periods. Possible time periods:
- Permanent opening hours
- in the months ... (period of individual months from – to)
- in the weeks ... (period of individual weeks from – to)
- from ... to (exact period)
Complete the editing by clicking the Submit button at the bottom of the page.
Use for websites
There are PHP functions for TUCAL to integrate opening hours on websites. These are explained in the following examples.
1. Fetching the information about an opening time
This must always be called before the actual display:
require_once('php/openinghours.inc');
$open = new tucal_openinghours('87229ad8-c468-483a-9e0d-bb028bd822fe');
# tucal_openinghours('uuid'[, 'sprache']);
# uuid determined by admins in the administrator interface
# language: 'de' or 'en', can be omitted, then it is the language of the page
2. Output information
echo $open->is_open(); # output whether currently open or closed
echo $open->status(); # … , whether currently open (until when) or closed (from when open)
echo $open->opening_hours([array $format]); # output the current opening hours (current week)
# $format – omitted: every day that is open
# array('all'): every day, even if closed
# array('week'): every day, even if closed, without weekend
# array('short'): weekdays are abbreviated with two letters
Example
echo '<p>1. At the moment … ' . $open->is_open() . '.</p>';
echo '<p>2. At the moment … ' . $open->status() . '.</p>';
echo '<p>3. Our opening hours (this week):</p><p>' . $open->opening_hours() .'</p>';
echo '<p>4. Our opening hours (this week) complete:</p><p>' . $open->opening_hours(array('all')) .'</p>';
echo '<p>5. Our opening hours without weekend:</p><p>' . $open->opening_hours(array('week')) .'</p>';
1. At the moment … opened.
2. At the moment … opened, closes today at 11:45 am.
3. Our opening hours (this week):
4. Our opening hours (this week) complete:
5. Our opening hours without weekend:
All available data on opening hours are available in the PHP object $open->opening
and can be used for own outputs.
# Output everything for testing:
echo '<pre>' . print_r($open->opening, 1) . '</pre>';
stdClass Object ( [title] => URZ Nutzerservice Str. d. Nationen [uuid] => 87229ad8-c468-483a-9e0d-bb028bd822fe [url] => https://www-apps.hrz.tu-chemnitz.de/tucopen/api/v1/openinghours/87229ad8-c468-483a-9e0d-bb028bd822fe/ [description] => allgemeine Öffnungszeit URZ-Nutzerservice [room] => stdClass Object ( [code2017] => A13.072 [building] => stdClass Object ( [code] => A13 [name] => Böttcher-Bau [coordinates] => 50.838983, 12.929071 [postaladdress] => Straße der Nationen 62 [postalcode] => 09111 [localityname] => Chemnitz [uuid] => ec7aa419-86eb-4233-9610-497bc618ea5e [url] => https://tucrooms.hrz.tu-chemnitz.de/tucrooms/api/v1/building/ec7aa419-86eb-4233-9610-497bc618ea5e/?format=json ) [uuid] => a40203d4-0e41-4fa9-a05a-ac4d4b8e8ad3 [url] => https://tucrooms.hrz.tu-chemnitz.de/tucrooms/api/v1/room/a40203d4-0e41-4fa9-a05a-ac4d4b8e8ad3/?format=json [display_name] => A13.072 (alt: 1/072) [campus_finder_url] => https://mytuc.org/r/A13.072 ) [hours] => Tu,Th 08:45-11:45,12:30-15:30; PH off; Dec 05 off [hours_parsed] => stdClass Object ( [hours_list] => Array ( [0] => Array ( [0] => 2024-12-10T08:45:00 [1] => 2024-12-10T11:45:00 ) [1] => Array ( [0] => 2024-12-10T12:30:00 [1] => 2024-12-10T15:30:00 ) [2] => Array ( [0] => 2024-12-12T08:45:00 [1] => 2024-12-12T11:45:00 ) [3] => Array ( [0] => 2024-12-12T12:30:00 [1] => 2024-12-12T15:30:00 ) ) [hours_by_date] => stdClass Object ( [2024-12-10] => Array ( [0] => Array ( [0] => 08:45:00 [1] => 11:45:00 ) [1] => Array ( [0] => 12:30:00 [1] => 15:30:00 ) ) [2024-12-11] => [2024-12-12] => Array ( [0] => Array ( [0] => 08:45:00 [1] => 11:45:00 ) [1] => Array ( [0] => 12:30:00 [1] => 15:30:00 ) ) [2024-12-13] => [2024-12-14] => [2024-12-15] => [2024-12-16] => ) [hours_by_weekday] => stdClass Object ( [Mo] => [Tu] => Array ( [0] => Array ( [0] => 08:45:00 [1] => 11:45:00 ) [1] => Array ( [0] => 12:30:00 [1] => 15:30:00 ) ) [We] => [Th] => Array ( [0] => Array ( [0] => 08:45:00 [1] => 11:45:00 ) [1] => Array ( [0] => 12:30:00 [1] => 15:30:00 ) ) [Fr] => [Sa] => [Su] => ) [week_description_en] => stdClass Object ( [Monday] => closed [Tuesday] => 8:45 AM – 11:45 AM and 12:30 PM – 3:30 PM [Wednesday] => closed [Thursday] => 8:45 AM – 11:45 AM and 12:30 PM – 3:30 PM [Friday] => closed [Saturday] => closed [Sunday] => closed ) [description_en] => Array ( [0] => On Tuesday and on Thursday: 8:45 AM – 11:45 AM and 12:30 PM – 3:30 PM. [1] => On public holidays: closed. [2] => December 5: closed. ) [is_open] => 1 [next_change] => 2024-12-10T11:45:00 [week_description_de] => stdClass Object ( [Montag] => geschlossen [Dienstag] => 08:45 – 11:45 und 12:30 – 15:30 [Mittwoch] => geschlossen [Donnerstag] => 08:45 – 11:45 und 12:30 – 15:30 [Freitag] => geschlossen [Samstag] => geschlossen [Sonntag] => geschlossen ) [description_de] => Array ( [0] => Am Dienstag und am Donnerstag: 08:45 – 11:45 und 12:30 – 15:30. [1] => An Feiertagen: geschlossen. [2] => December 5: geschlossen. ) ) )
You can access this data directly, for example the title:
# Output title and opening hours in a structured way with formatting:
# class spacebold is defined like this:
# div.openinghours div.spcb {padding:1em 0} div.openinghours div.spcb div:first-child {font-weight:bold}
echo '<div class="row"><div class="col-xm-3"><strong>' .
htmlspecialchars($open->opening->title) . '</strong></div>' .
'<div class="col-xm-9">' .
$open->opening_hours(array('short', 'class-row' => 'linie grey spcb')) . '</div></div></p>';