- Posts: 6
- Thank you received: 2
The developer takes a few days off for Holidays...
...and will be back with charged battery!
From 23 December to 2 January included
During this period, assistance from developer will not be provided.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
<?php // Show remaining seats for event ?>
<?php
$tempdb = JFactory::getDbo();
$query = $tempdb->getQuery(true);
$query
->select(array('count(*)', 't1.date', 't2.title', 'JSON_UNQUOTE(JSON_EXTRACT(t2.params,"$.maxReg")) AS capacity', '(JSON_UNQUOTE(JSON_EXTRACT(t2.params,"$.maxReg")) - count(*)) AS available'))
->from($tempdb->quoteName('#__icagenda_registration', 't1'))
->join('LEFT', $tempdb->quoteName('#__icagenda_events', 't2') . ' ON ' . $tempdb->quoteName('t1.eventid') . ' = ' . $tempdb->quoteName('t2.id'))
->where($tempdb->quoteName('t1.date') . ' LIKE "%' . $item->next . '%"')
->where($tempdb->quoteName('t2.title') . ' LIKE "%' . $item->title . '%"')
->where($tempdb->quoteName('t1.state') . ' = "1"')
->group($tempdb->quoteName('title'));
$tempdb->setQuery($query);
$tempResults = $tempdb->loadAssoc();
if ($tempResults["available"] > 0) {
echo $tempResults["available"]." seats available.";
} else {
echo "There are no seats available.";
}
?>
<?php // Show remaining seats for event ?>
<?php
$tempdb = JFactory::getDbo();
$query = $tempdb->getQuery(true);
$query
->select(array('t1.title', 'JSON_UNQUOTE(JSON_EXTRACT(t1.params,"$.maxReg")) AS capacity'))
->from($tempdb->quoteName('#__icagenda_events', 't1'))
->where($tempdb->quoteName('t1.period') . ' LIKE "%' . $evt . '%"')
->where($tempdb->quoteName('t1.title') . ' LIKE "%' . $item->title . '%"');
$tempdb->setQuery($query);
$tempResults = $tempdb->loadAssoc();
$capacity = $tempResults["capacity"];
$query = $tempdb->getQuery(true);
$query
->select(array('count(*)', 't1.date', 't2.title', 'JSON_UNQUOTE(JSON_EXTRACT(t2.params,"$.maxReg")) AS capacity', '(JSON_UNQUOTE(JSON_EXTRACT(t2.params,"$.maxReg")) - count(*)) AS available'))
->from($tempdb->quoteName('#__icagenda_registration', 't1'))
->join('LEFT', $tempdb->quoteName('#__icagenda_events', 't2') . ' ON ' . $tempdb->quoteName('t1.eventid') . ' = ' . $tempdb->quoteName('t2.id'))
->where($tempdb->quoteName('t1.date') . ' LIKE "%' . $evt . '%"')
->where($tempdb->quoteName('t2.title') . ' LIKE "%' . $item->title . '%"')
->where($tempdb->quoteName('t1.state') . ' = "1"')
->group($tempdb->quoteName('title'));
$tempdb->setQuery($query);
$tempResults = $tempdb->loadAssoc();
if ($tempResults == NULL) {
echo "$capacity seats available.";
} elseif ($tempResults["available"] > 0) {
echo $tempResults["available"]." seats available.";
} else {
echo "This venue is fully booked.";
}
?>
Please Log in or Create an account to join the conversation.