function livereport($name, $entityName, $pars) { $item = new Template("dtml/liveReport.html"); $length = $pars['length']; $index = false; foreach ($_SESSION['user']['services'] as $k => $v) { if ($v['script'] == basename($_SERVER['SCRIPT_FILENAME'])) { $index = $k; break; } } if (!$index) { $item->setContent("title", "Report"); } else { $item->setContent("title", $_SESSION['user']['services'][$index]['serviceName']); } $entity = $GLOBALS['database']->getEntityByName($entityName); $count = $entity->getReference(COUNT); #$data = aux::getResult("SELECT COUNT(*) AS count FROM {$entityName}"); $item->setContent("length", $length); #$item->setContent("total", $data[0]['count']); $item->setContent("total", $count); $item->setContent("entity", $entityName); $item->setContent("script", basename($_SERVER['SCRIPT_FILENAME'])); $item->setContent("query", aux::encrypt($GLOBALS['currentform']->reportQuery)); return $item->get(); }