本文整理匯總了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]));
}