Commit edc2f13d authored by Steven Wittens's avatar Steven Wittens

- #9287: More doxygen/documentation fixes by JonBob

parent b2882bf2
......@@ -3,7 +3,6 @@
/**
* @file
*
* Functions that need to be loaded on every Drupal request.
*/
......
......@@ -3,7 +3,6 @@
/**
* @file
*
* Common functions that many Drupal modules will need to reference.
*
* The functions that are critical and need to be available even when serving
......@@ -760,7 +759,10 @@ function search_type($type, $action = NULL, $keys = NULL, $options = NULL) {
return search_form($action, $keys, $options) . '<br />'. search_data($keys);
}
/* @} */
/**
* @} end of defgroup search
*/
function check_form($text) {
return drupal_specialchars($text, ENT_QUOTES);
......@@ -1004,6 +1006,8 @@ function format_name($object) {
/**
* @defgroup form Form generation
* @{
*
*
*/
/**
......@@ -1446,7 +1450,10 @@ function form_weight($title = NULL, $name = 'weight', $value = 0, $delta = 10, $
return form_select($title, $name, $value, $weights, $description, $extra);
}
/* @} */
/**
* @} end of defgroup form
*/
/**
* Generate an internal Drupal URL.
......
<?php
/* $Id$ */
/**
* @file
* API for the Drupal menu system.
*/
/**
* @defgroup menu Menu system
* @{
......@@ -493,7 +498,9 @@ function menu_rebuild() {
_menu_build();
}
/** @} end of "menu" function group */
/**
* @} end of defgroup menu
*/
/**
* @addtogroup themeable
......@@ -591,7 +598,9 @@ function theme_menu_local_task($mid, $active) {
}
}
/** @} End of addtogroup themeable */
/**
* @} end of addtogroup themeable
*/
/**
* Returns an array with the menu items that lead to the current menu item.
......
<?php
// $Id$
/**
* @file
* API for loading and interacting with Drupal modules.
*/
/**
* Initialize all modules.
*
......
This diff is collapsed.
<?php
// $Id$
/**
* @file
* Functions to aid in the creation of sortable tables.
*
* All tables created with a call to theme('table') have the option of having
* column headers that the user can click on to sort the table by that column.
*/
/**
* Initialize the table sort context.
*/
function tablesort_init($header) {
$ts = tablesort_get_order($header);
$ts['sort'] = tablesort_get_sort($header);
......@@ -8,13 +19,35 @@ function tablesort_init($header) {
return $ts;
}
/**
* Fetch pager link arguments.
*
* When producing a sortable table that presents paged data, pass the output
* of this function into theme('pager') to preserve the current sort order.
*/
function tablesort_pager() {
$cgi = $_SERVER['REQUEST_METHOD'] == 'GET' ? $_GET : $_POST;
unset($cgi['q'], $cgi['from']);
return $cgi;
}
function tablesort_sql($header, $before = "") {
/**
* Create an SQL sort clause.
* @ingroup database
*
* This function produces the ORDER BY clause to insert in your SQL queries,
* assuring that the returned database table rows match the sort order chosen
* by the user.
*
* @param $header
* An array of column headers in the format described in theme_table().
* @param $before
* An SQL string to insert after ORDER BY and before the table sorting code.
* Useful for sorting by important attributes like "sticky" first.
* @return
* An SQL string to append to the end of a query.
*/
function tablesort_sql($header, $before = '') {
$ts = tablesort_init($header);
if ($ts['sql']) {
$sql = check_query($ts['sql']);
......@@ -23,8 +56,23 @@ function tablesort_sql($header, $before = "") {
}
}
/**
* Format a column header.
*
* If the cell in question is the column header for the current sort criterion,
* it gets special formatting. All possible sort criteria become links.
*
* @param $cell
* The cell to format.
* @param $header
* An array of column headers in the format described in theme_table().
* @param $ts
* The current table sort context as returned from tablesort_init().
* @return
* A properly formatted cell, ready for _theme_table_cell().
*/
function tablesort_header($cell, $header, $ts) {
// special formatting for the currently sorted column header
// Special formatting for the currently sorted column header.
if (is_array($cell) && $cell['field']) {
if ($cell['data'] == $ts['name']) {
$ts['sort'] = (($ts['sort'] == 'asc') ? 'desc' : 'asc');
......@@ -37,13 +85,29 @@ function tablesort_header($cell, $header, $ts) {
$ts['sort'] = 'asc';
}
$title = t('sort by %s', array('%s' => $cell['data']));
$cell['data'] = l($cell['data'] . $image, $_GET['q'], array('title' => $title), "sort=". $ts['sort']. "&amp;order=". urlencode($cell['data']). $ts['query_string']);
$cell['data'] = l($cell['data'] . $image, $_GET['q'], array('title' => $title), 'sort="'. $ts['sort'] .'&amp;order='. urlencode($cell['data']). $ts['query_string']);
unset($cell['field'], $cell['sort']);
}
return $cell;
}
/**
* Format a table cell.
*
* Adds a class attribute to all cells in the currently active column.
*
* @param $cell
* The cell to format.
* @param $header
* An array of column headers in the format described in theme_table().
* @param $ts
* The current table sort context as returned from tablesort_init().
* @param $i
* The index of the cell's table column.
* @return
* A properly formatted cell, ready for _theme_table_cell().
*/
function tablesort_cell($cell, $header, $ts, $i) {
if ($header[$i]['data'] == $ts['name'] && $header[$i]['field']) {
if (is_array($cell)) {
......@@ -56,6 +120,13 @@ function tablesort_cell($cell, $header, $ts, $i) {
return $cell;
}
/**
* Compose a query string to append to table sorting requests.
*
* @return
* A query string that consists of all components of the current page request
* except for those pertaining to table sorting.
*/
function tablesort_get_querystring() {
$cgi = $_SERVER['REQUEST_METHOD'] == 'GET' ? $_GET : $_POST;
foreach ($cgi as $key => $val) {
......@@ -66,6 +137,16 @@ function tablesort_get_querystring() {
return $query_string;
}
/**
* Determine the current sort criterion.
*
* @param $headers
* An array of column headers in the format described in theme_table().
* @return
* An associative array describing the criterion, containing the keys:
* - "name": The localized title of the table column.
* - "sql": The name of the database field to sort on.
*/
function tablesort_get_order($headers) {
$order = $_GET['order'];
foreach ($headers as $header) {
......@@ -93,14 +174,22 @@ function tablesort_get_order($headers) {
}
}
/**
* Determine the current sort direction.
*
* @param $headers
* An array of column headers in the format described in theme_table().
* @return
* The current sort direction ("asc" or "desc").
*/
function tablesort_get_sort($headers) {
if ($_GET['sort']) {
return ($_GET['sort'] == 'desc') ? 'desc' : 'asc';
}
// user has not specified a sort. check module for default and if none, use 'asc'
// User has not specified a sort. Use default if specified; otherwise use "asc".
else {
foreach ($headers as $header) {
if (is_array($header) && isset($header['sort'])) {
if (is_array($header) && array_key_exists('sort', $header)) {
return $header['sort'];
}
}
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment