diff options
-rw-r--r-- | lib/deck/view.php | 8 | ||||
-rw-r--r-- | lib/functions.php | 19 |
2 files changed, 9 insertions, 18 deletions
diff --git a/lib/deck/view.php b/lib/deck/view.php index 5604395..e9a83e6 100644 --- a/lib/deck/view.php +++ b/lib/deck/view.php @@ -9,6 +9,9 @@ $deck = mysql_fetch_assoc(sql( "WHERE decks.id = $deckid")); assert_error($deck, "This deck does not exist."); +$can_edit = false; +if ($deck["owner_id"] == $user['id']) $can_edit = true; + $filters = array ( "order" => array ( "name" => "card name", @@ -18,7 +21,7 @@ $filters = array ( ); $fdefaults = array ( "order" => "number", - "way" => "ASC", + "way" => ($can_edit ? "DESC" : "ASC"), ); $cards = array(); @@ -28,9 +31,6 @@ $n = sql( ); while ($nn = mysql_fetch_assoc($n)) $cards[] = $nn; -$can_edit = false; -if ($deck["owner_id"] == $user['id']) $can_edit = true; - $can_start_study = false; if ($user['id'] != 0) { if (!mysql_fetch_assoc(sql("SELECT id FROM deck_study WHERE deck = $deckid AND user = " . $user['id']))) diff --git a/lib/functions.php b/lib/functions.php index 6190818..0aadba0 100644 --- a/lib/functions.php +++ b/lib/functions.php @@ -89,22 +89,13 @@ function filter_html($name) { return implode(", ", $r); } -function filters_html() { - global $filters; - $r = array(); - foreach ($filters as $k => $filter) { - $r[$k] = filter_html($k); - } - return $r; -} - function filters_html_full() { - global $filters_names; - $r = array(); - foreach (filters_html() as $f => $h) { - $r[] = $f . " (" . $h . ")"; + global $filters; + $ra = array(); + foreach (array_keys($filters) as $k) { + $ra[] = $k . " (" . filter_html($k) . ")"; } - return implode(", ", $r); + return implode(", ", $ra); } $ord_ways = array ( |