diff --git a/lists.php b/lists.php index e73166f..7d80396 100644 --- a/lists.php +++ b/lists.php @@ -103,6 +103,18 @@ function LoadFromDB() $s->Attach(array("list_items"=>"itemid"),array("prods as prod"=>"id")); $s->AddWhere(sprintf_esc("list_items.list=%d",$this->id)); $s->AddWhere("list_items.type='prod'"); + + $dir = "ASC"; + if ($_GET["reverse"]) + $dir = "DESC"; + switch($_GET["order"]) + { + case "type": $s->AddOrder("list_items_prod.type ".$dir); break; + case "name": $s->AddOrder("list_items_prod.name ".$dir); break; + case "party": $s->AddOrder("list_items_prod_party.name ".$dir); break; + case "release date": $s->AddOrder("list_items_prod_releaseDate ".$dir); break; + } + $this->prods = $s->perform(); $a = array(); @@ -193,29 +205,52 @@ function Render() if ($this->prods) { echo "
%s | \n", + adjust_query_header(array("order"=>$key)),$_GET["order"]==$key?"selected":"",($_GET["order"]==$key && $_GET["reverse"])?" reverse":"","sort_".$key,$text); + if ($key == "type" || $key == "name") $out = str_replace("","",$out); + if ($key == "platform" || $key == "name") $out = str_replace(""," ",$out); + echo $out; + } + if ($this->CanEdit()) + { + echo " | "; + } + echo " | |
---|---|---|---|
\n"; echo $d->prod->RenderTypeIcons(); echo $d->prod->RenderPlatformIcons(); echo $d->prod->RenderSingleRowShort(); - echo "\n"; - echo "\n"; + echo " | \n"; + echo "\n"; if ($d->prod->placings) echo $d->prod->placings[0]->PrintResult($p->year); - echo "\n"; - echo "\n"; + echo " | \n"; + echo "\n"; echo $d->prod->RenderReleaseDate(); - echo "\n"; + echo " | \n"; if ($this->CanEdit()) { - printf(" ",$d->prod->id); + printf("",$d->prod->id); } - echo "\n"; + echo " |