_class, $this->_baseUrl); } else { echo Datatables::getTable($this->_class, $this->_baseUrl, false); } } function searchTable() { $records = []; $total = 0; try { if ($_POST['search']['value'] != '') { $search = []; foreach ($this->_class::_searchable as $searchable) { $search[$searchable] = ['OR like', $_POST['search']['value']]; } $records = $this->_class::findMany($search, $this->_class::_listable)->get(true); } else { $records = $this->_class::findAll($this->_class::_listable, ['limit' => $_POST['length'], 'offset' => $_POST['start']])->get(); } $total = DBInstance::queryOne("SELECT count(*) as count FROM {" . $this->_class::_tableName . '}')->count; } catch (Exception $e) { if (APP_STATUS != 'production') { for ($i = $_POST['start']; $i <= $_POST['length'] + $_POST['start']; $i++) { $line = new stdClass(); $line->id = $i; $line->name = md5($i); $records[] = $line; } $total = 10000; } } if (!is_array($records)) { $records = [$records]; } foreach ($records as $record) { if ($_GET['selective'] == 'true') { $record->id = Datatables::getActionMenu($record->id, $this->_baseUrl); } else { $record->id = Datatables::getSelectMenu($record->id); } } \RR\Response::json([ 'draw' => $_POST['draw'], 'recordsTotal' => $total, 'recordsFiltered' => $total, 'data' => $records ])->send(); } } /** * Request obtainers helpers */ function request($param, $default = false) { if (is_string($param)) { return requestString($param, $default = false); } if (is_array($param)) { return requestArray($param, $default); } } function requestString($param, $default = false) { if (isset($_POST[$param])) { return $_POST[$param]; } if (isset($_GET[$param])) { return $_GET[$param]; } return $default; } function requestArray($params, $default = false) : array { $return = []; foreach ($params as $param) { $return[] = requestString($param, $default); } return $return; } /** * Development helpers */ function dd($param, $die = true) : void { if ($param) { echo '
';
var_dump($param);
}
if ($die) {
die;
}
}
function ddd($param, $die = true) : void
{
if ($param) {
error_log(print_r($param, true));
}
if ($die) {
die;
}
}
/**
* Summary of icon
* @return void
*/
function icon($icon) : String
{
return "";
}
// Just a change for git