diff options
author | Nicolas BERNSTEIN <alexis211@gmail.com> | 2011-11-20 13:39:47 +0100 |
---|---|---|
committer | Nicolas BERNSTEIN <alexis211@gmail.com> | 2011-11-20 13:39:47 +0100 |
commit | d45c7f14891d951f8a6987cc6492073b97e05b5b (patch) | |
tree | d6467b1202c27f67fd8e894d25fd4aea0085b559 /lib/list/view.php | |
parent | 4d7e065c2d2ec407b6a7ebfc7569628bac9149d1 (diff) | |
download | Bits-d45c7f14891d951f8a6987cc6492073b97e05b5b.tar.gz Bits-d45c7f14891d951f8a6987cc6492073b97e05b5b.zip |
Added the bit list study system
Diffstat (limited to 'lib/list/view.php')
-rw-r--r-- | lib/list/view.php | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/lib/list/view.php b/lib/list/view.php new file mode 100644 index 0000000..7a05bf2 --- /dev/null +++ b/lib/list/view.php @@ -0,0 +1,31 @@ +<?php + +assert_redir(count($args) == 3, 'list'); +$listid = intval($args[2]); + +$list = mysql_fetch_assoc(sql( + "SELECT lists.id AS id, lists.name AS name, lists.comment_html AS comment, account.login AS owner, ". + "account.id AS owner_id ". + "FROM lists LEFT JOIN account ON account.id = lists.owner ". + "WHERE lists.id = $listid")); +assert_error($list, "This list does not exist."); + +$can_edit = false; +if ($list["owner_id"] == $user['id']) $can_edit = true; + +$batches = array(); +$n = sql( + "SELECT id, name FROM batches WHERE list = $listid ". + "ORDER BY name ASC" + ); +while ($nn = mysql_fetch_assoc($n)) $batches[] = $nn; + +$can_start_study = false; +if ($user['id'] != 0) { + if (!mysql_fetch_assoc(sql("SELECT id FROM list_study WHERE list = $listid AND user = " . $user['id']))); + $can_start_study = true; +} else { + $message = "You should create an account in order to study this list."; +} + +require("tpl/list/view.php"); |