summaryrefslogtreecommitdiff
path: root/includes/tablesort.inc
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2004-01-25 10:07:24 +0000
committerDries Buytaert <dries@buytaert.net>2004-01-25 10:07:24 +0000
commitfe1a74709aba725ae442b5720083148ccac7e151 (patch)
tree40a50f2311bbeb1ab351d6f71a3147bd2fa72928 /includes/tablesort.inc
parentcdfa6b8e4d834a2635f310fbf40b7144fc6163fc (diff)
downloadbrdo-fe1a74709aba725ae442b5720083148ccac7e151.tar.gz
brdo-fe1a74709aba725ae442b5720083148ccac7e151.tar.bz2
- Code improvements: changed some " to '.
Diffstat (limited to 'includes/tablesort.inc')
-rw-r--r--includes/tablesort.inc36
1 files changed, 18 insertions, 18 deletions
diff --git a/includes/tablesort.inc b/includes/tablesort.inc
index 040858643..58f269225 100644
--- a/includes/tablesort.inc
+++ b/includes/tablesort.inc
@@ -5,10 +5,10 @@ function tablesort_init($header) {
static $ts;
if (empty($ts)) {
- $ts["order"] = tablesort_get_order($header);
- $ts["order_sql"] = tablesort_get_order_sql($header, $ts["order"]);
- $ts["sort"] = tablesort_get_sort($header);
- $ts["query_string"] = tablesort_get_querystring();
+ $ts['order'] = tablesort_get_order($header);
+ $ts['order_sql'] = tablesort_get_order_sql($header, $ts['order']);
+ $ts['sort'] = tablesort_get_sort($header);
+ $ts['query_string'] = tablesort_get_querystring();
}
return $ts;
@@ -16,38 +16,38 @@ function tablesort_init($header) {
function tablesort_pager() {
$cgi = $_SERVER['REQUEST_METHOD'] == 'GET' ? $_GET : $_POST;
- unset($cgi["q"], $cgi["from"]);
+ unset($cgi['q'], $cgi["from"]);
return $cgi;
}
function tablesort_sql($header) {
$ts = tablesort_init($header);
- return " ORDER BY ". $ts["order_sql"]. " ". strtoupper($ts["sort"]);
+ return " ORDER BY ". $ts['order_sql']. " ". strtoupper($ts['sort']);
}
function tablesort($cell, $header) {
$ts = tablesort_init($header);
- $title = t("sort by %s", array("%s" => $cell["data"]));
+ $title = t("sort by %s", array("%s" => $cell['data']));
// special formatting for the currently sorted column header
- if ($cell["data"] == $ts["order"]) {
- $cell["class"] = "cell-highlight";
- $image = "&nbsp;<img border=\"0\" src=\"". theme("image", "arrow-". $ts["sort"]. ".gif"). "\"></img>";
+ if ($cell['data'] == $ts['order']) {
+ $cell['class'] = 'cell-highlight';
+ $image = "&nbsp;<img border=\"0\" src=\"". theme('image', "arrow-". $ts['sort']. ".gif"). "\"></img>";
$dir = array("asc" => "ascending", "desc" => "descending");
- $title = t("sort ". $dir[$ts["sort"]]);
+ $title = t("sort ". $dir[$ts['sort']]);
} else {
// If the user clicks a different header, we want to sort ascending initially.
- $ts["sort"] = "asc";
+ $ts['sort'] = "asc";
}
- $cell["data"] = l($cell["data"] . $image, $_GET["q"], array("title" => $title), "sort=". $ts["sort"]. "&order=". urlencode($cell["data"]). $ts["query_string"]);
+ $cell['data'] = l($cell['data'] . $image, $_GET['q'], array("title" => $title), "sort=". $ts['sort']. "&order=". urlencode($cell['data']). $ts['query_string']);
return $cell;
}
function tablesort_get_querystring() {
$cgi = $_SERVER['REQUEST_METHOD'] == 'GET' ? $_GET : $_POST;
foreach ($cgi as $key => $val) {
- if ($key != "order" && $key != "sort" && $key != "q") {
+ if ($key != 'order' && $key != 'sort' && $key != 'q') {
$query_string .= "&" . $key . "=" . $val;
}
}
@@ -78,8 +78,8 @@ function tablesort_get_order($headers) {
function tablesort_get_order_sql($header, $order) {
foreach ($header as $cell) {
- if ($cell["data"] == $order) {
- return $cell["field"];
+ if ($cell['data'] == $order) {
+ return $cell['field'];
}
}
}
@@ -91,8 +91,8 @@ function tablesort_get_sort($headers) {
// user has not specified a sort. check module for default and if none, use 'asc'
else {
foreach ($headers as $header) {
- if (isset($header["sort"])) {
- return $header["sort"];
+ if (isset($header['sort'])) {
+ return $header['sort'];
}
}
}