diff options
author | Nicolas BERNSTEIN <alexis211@gmail.com> | 2011-09-17 19:36:41 +0200 |
---|---|---|
committer | Nicolas BERNSTEIN <alexis211@gmail.com> | 2011-09-17 19:36:41 +0200 |
commit | 8d9321225140a3db0b72796d4d0236d6cacfeb8a (patch) | |
tree | 766e25ed98b86ed4cbf6d0517d9daaecc5ce3c18 /lib/deck/view.php | |
parent | b6b341d949437c913fcce3d1a7c302945f67b22b (diff) | |
download | Bits-8d9321225140a3db0b72796d4d0236d6cacfeb8a.tar.gz Bits-8d9321225140a3db0b72796d4d0236d6cacfeb8a.zip |
Started working on a study program.
Diffstat (limited to 'lib/deck/view.php')
-rw-r--r-- | lib/deck/view.php | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/lib/deck/view.php b/lib/deck/view.php new file mode 100644 index 0000000..eda2ca0 --- /dev/null +++ b/lib/deck/view.php @@ -0,0 +1,34 @@ +<?php + +assert_redir(count($args) == 3, 'deck'); +$deckid = intval($args[2]); + +$deck = mysql_fetch_assoc(sql( + "SELECT decks.id AS id, decks.name AS name, decks.comment_html AS comment, account.login AS owner, account.id AS owner_id ". + "FROM decks LEFT JOIN account ON account.id = decks.owner ". + "WHERE decks.id = $deckid")); +assert_error($deck, "This deck does not exist."); + +$filters = array ( + "order" => array ( + "name" => "card name", + "number" => "card number", + ), + "way" => $ord_ways, +); +$fdefaults = array ( + "order" => "number", + "way" => "ASC", +); + +$cards = array(); +$n = sql( + "SELECT id, number, name, text_html AS text FROM cards WHERE deck = $deckid ". + "ORDER BY " . get_filter("order") . " " . get_filter("way") + ); +while ($nn = mysql_fetch_assoc($n)) $cards[] = $nn; + +$can_edit = false; +if ($deck["owner_id"] == $user['id']) $can_edit = true; + +require("tpl/deck/view.php"); |