with
all_ranges as (
SELECT tsrange(generate_series,
generate_series + interval '30' minute,
'()') as range
FROM generate_series(current_date::timestamp + interval '9' hour,
current_date::timestamp + interval '18' hour,
'30 minutes'))
select rooms.id as room_id,
concat(to_char(lower(ar.range), 'HH24:MI'),
' - ',
to_char(upper(ar.range), 'HH24:MI')) as timerange
from all_ranges as ar
cross join rooms
where not exists (select 1
from reservations as rt
where rooms.id=rt.room_id and
ar.range && rt.occurrence)
order by 1;
$results = $xpath->query( '//div[@class="reports"]/div[@class="ERROR"]/div[@class="author"]' );
foreach ($results as $node)
{
echo $node->nodeValue;
}
$results = $xpath->query( '//div[@class="reports"]/div[@class="SUCCESS"]/div[@class="name"]' );
foreach ($results as $node)
{
echo $node->nodeValue;
}
$results = $xpath->query( '//div[@class="reports"]/div' );
foreach ($results as $node)
{
$class=($node->getAttribute('class')==='SUCCESS') ? 'name' : 'author';
foreach ($node->childNodes as $child)
{
if ($child->nodeName=='div' && $child->getAttribute('class')===$class)
{
echo $child->nodeValue;
break;
}
}
}