tablesort_get_sort
includes/tablesort.inc, строка 180
- Версии
- 5 – 6
tablesort_get_sort($headers)
Determine the current sort direction.
Параметры
$headers
An array of column headers in the format described in theme_table().
Возвращаемое значение
The current sort direction ('asc'
or 'desc'
).
Код
<?php
function tablesort_get_sort($headers) {
if (isset($_GET['sort'])) {
return ($_GET['sort'] == 'desc') ? 'desc' : 'asc';
}
// User has not specified a sort. Use default if specified; otherwise use "asc".
else {
foreach ($headers as $header) {
if (is_array($header) && array_key_exists('sort', $header)) {
return $header['sort'];
}
}
}
return 'asc';
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии