widgetName = JText::_('VRCDASHTODAYPICKUP');
$this->widgetDescr = JText::_('VRC_W_COLLECTTOD_DESCR');
$this->widgetId = basename(__FILE__);
}
public function render($data = null)
{
$vrc_auth_orders = JFactory::getUser()->authorise('core.vrc.orders', 'com_vikrentcar');
$today_start_ts = mktime(0, 0, 0, date("n"), date("j"), date("Y"));
$today_end_ts = mktime(23, 59, 59, date("n"), date("j"), date("Y"));
$pickup_today = array();
$dbo = JFactory::getDbo();
$q = "SELECT `id`,`custdata`,`status`,`idcar`,`ritiro`,`consegna`,`idplace`,`idreturnplace`,`country`,`nominative`,`reg` FROM `#__vikrentcar_orders` WHERE `ritiro`>=" . $today_start_ts . " AND `ritiro`<=" . $today_end_ts . " ORDER BY `#__vikrentcar_orders`.`ritiro` ASC;";
$dbo->setQuery($q);
$dbo->execute();
if ($dbo->getNumRows() > 0) {
$pickup_today = $dbo->loadAssocList();
}
$tot_arrivals = 0;
foreach ($pickup_today as $in_today) {
if ($in_today['status'] == 'confirmed') {
$tot_arrivals++;
}
}
// render the necessary PHP/JS code for the modal window only once
if (!defined('VRC_JMODAL_ORDER_REGISTRATION')) {
define('VRC_JMODAL_ORDER_REGISTRATION', 1);
echo $this->vrc_app->getJmodalScript();
echo $this->vrc_app->getJmodalHtml('vrc-order-registration', JText::_('VRC_ORDER_REGISTRATION'));
}
?>