本文整理汇总了PHP中Presenter::listTableData方法的典型用法代码示例。如果您正苦于以下问题:PHP Presenter::listTableData方法的具体用法?PHP Presenter::listTableData怎么用?PHP Presenter::listTableData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Presenter
的用法示例。
在下文中一共展示了Presenter::listTableData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: runQueryWithView
private static function runQueryWithView($query, $fields, $printArray)
{
$_SESSION['tableData'] = array();
$exec_time_row = array();
$records = '';
try {
// turn on query profiling
Flight::get('db')->query('SET profiling = 1;');
$stmt = Flight::get('db')->query($query);
// find out time above query was ran for
$exec_time_result = Flight::get('db')->query('SELECT query_id, SUM(duration) FROM information_schema.profiling GROUP BY query_id ORDER BY query_id DESC LIMIT 1;');
$exec_time_row = $exec_time_result->fetchAll(PDO::FETCH_NUM);
// run query and fetch array
$data = $stmt->fetchAll(PDO::FETCH_ASSOC);
// store table fields/columns + data rows in session for exporting later
$_SESSION['tableData'] = array_merge($fields, $data);
$records = Presenter::listTableData($data);
} catch (PDOException $e) {
setFlashMessage('Error: ' . $e->getMessage());
}
Flight::render('table', array('title' => Flight::get('lastSegment'), 'icon' => self::$icon, 'table_data' => $records, 'fields' => getOptions($fields), 'query' => SqlFormatter::format($query), 'printArray' => $printArray, 'timetaken' => $exec_time_row[0][1]));
}