public function ajaxAction()
{
/**
* Extract values for common work
* @todo Extract common files
*/
$db =& $this->db;
$table =& $this->table;
if (strlen($this->table) > 0 && strlen($this->db) > 0) {
include './libraries/tbl_common.inc.php';
}
$sql_with_limit = sprintf('SELECT * FROM(%s) AS `temp_res` LIMIT %s, %s', $this->sql_query, $_REQUEST['pos'], $_REQUEST['session_max_rows']);
$data = array();
$result = $this->dbi->tryQuery($sql_with_limit);
while ($row = $this->dbi->fetchAssoc($result)) {
$data[] = $row;
}
if (empty($data)) {
$this->response->setRequestStatus(false);
$this->response->addJSON('message', __('No data to display'));
return;
}
$sanitized_data = array();
foreach ($data as $data_row_number => $data_row) {
$tmp_row = array();
foreach ($data_row as $data_column => $data_value) {
$tmp_row[htmlspecialchars($data_column)] = htmlspecialchars($data_value);
}
$sanitized_data[] = $tmp_row;
}
$this->response->setRequestStatus(true);
$this->response->addJSON('message', null);
$this->response->addJSON('chartData', json_encode($sanitized_data));
}