blob: 3417a2134d9e1b855431a15cb04c8f3166df24ce (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
<?php
class OpeningTimes
{
/**
* Get opening times for given location.
*/
public static function forLocation(int $locationId)
{
static $openingTimesList = false;
if ($openingTimesList === false) {
$openingTimesList = Database::queryKeyValueList("SELECT locationid, openingtime FROM location
WHERE openingtime IS NOT NULL");
}
$chain = Location::getLocationRootChain($locationId);
$openingTimes = null;
foreach ($chain as $lid) {
if (isset($openingTimesList[$lid])) {
if (is_string($openingTimesList[$lid])) {
$openingTimesList[$lid] = json_decode($openingTimesList[$lid], true);
}
return $openingTimesList[$lid];
}
}
return null;
}
}
|