public function onAfterRoute() { $app = JFactory::getApplication(); $doc = JFactory::getDocument(); $retorno = array('total' => 0, 'layout' => ''); if ($app->isAdmin()) { return; } if ($app->get('droide-ajax', 0, 'STRING')) { if ($app->get('droide-ajax', 0, 'STRING') == 'json') { $items = array(); $retorno = array(); if ($app->get('cat_id', 0, 'INT') && $app->get('limit', 0, 'INT') && $app->get('menu_limit', 0, 'INT')) { $catid = $app->get('cat_id', 0, 'INT'); $start = $app->get('start', 0, 'INT'); $limit = $app->get('limit', 0, 'INT'); $menu_limit = $app->get('menu_limit', 0, 'INT'); $colunas = $app->get('colunas', 1, 'INT'); $menuparans = $app->get('menuparans', 0, 'STRING'); require_once __DIR__ . '/helper.php'; $items = BlogHelper::getList($start, $limit, $catid, $menuparans, $menu_limit); } $retorno['total'] = count($items); $retorno['layout'] = JLayoutHelper::render($this->params->get('layoutbloco'), array('data' => $items, 'col' => $colunas), JPATH_SITE . '/plugins/system/droideajaxscroll/tmpl/'); $doc->setMimeEncoding('application/json'); JResponse::setHeader('Content-Disposition', 'attachment;filename="progress-report-results.json"'); echo json_encode($retorno); $app->close(); } else { $items = array(); if ($app->get('cat_id', 0) && $app->get('limit', 0)) { $catid = $app->get('cat_id', 0, 'INT'); $limit = $app->get('limit', 0, 'INT'); $start = $app->get('start', 0, 'INT'); $colunas = $app->get('colunas', 1, 'INT'); $menuparans = $app->get('menuparans', 0, 'STRING'); require_once __DIR__ . '/helper.php'; $items = BlogHelper::getList($start, $limit, $catid, $menuparans); } echo $items; $app->close(); } } }