tablesort_sql

Хочешь помочь с переводом? Это очень просто и быстро. Лишь зарегистрируйся, и можешь тут же начать переводить.

includes/tablesort.inc, строка 38

Версии
5 – 6
tablesort_sql($header, $before = '')

Создает сортировочную часть SQL запроса.

Эта функция обеспечивает создание 'ORDER BY' части SQL-запроса.

Параметры

$header Массив заголовков столбцов в формате, описанном в theme_table().

$before SQL строка для вставки после 'ORDER BY', но перед кодом сортировки. Полезно в случаях, когда нужно отсортировать сначала по важным атрибутам, таким как 'sticky'.

Возвращаемое значение

SQL строка для вставки в конец запроса.

Связанные темы

▾ 14 функции вызывают tablesort_sql()

comment_admin_overview in modules/comment/comment.module
Конструктор формы; генерирует форму с кратким содержанием комментариев для администратора.
forum_get_topics in modules/forum/forum.module
path_overview in modules/path/path.module
Return a listing of all defined URL aliases.
poll_votes in modules/poll/poll.module
Callback for the 'votes' tab for polls you can see other votes on
statistics_node_tracker in modules/statistics/statistics.module
statistics_recent_hits in modules/statistics/statistics.module
Menu callback; presents the 'recent hits' page.
statistics_top_pages in modules/statistics/statistics.module
Menu callback; presents the 'top pages' page.
statistics_top_referrers in modules/statistics/statistics.module
Menu callback; presents the 'referrer' page.
statistics_top_visitors in modules/statistics/statistics.module
Menu callback; presents the 'top visitors' page.
statistics_user_tracker in modules/statistics/statistics.module
user_admin_access in modules/user/user.module
Menu callback: list all access rules
user_admin_account in modules/user/user.module
watchdog_overview in modules/watchdog/watchdog.module
Menu callback; displays a listing of log messages.
watchdog_top in modules/watchdog/watchdog.module
Menu callback; generic function to display a page of the most frequent watchdog events of a specified type.

Код

<?php
function tablesort_sql($header, $before = '') {
  $ts = tablesort_init($header);
  if ($ts['sql']) {
    $sql = db_escape_string($ts['sql']);
    $sort = drupal_strtoupper(db_escape_string($ts['sort']));
    return " ORDER BY $before $sql $sort";
  }
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии

Вход в систему