summaryrefslogtreecommitdiff
path: root/lib/study/list.php
diff options
context:
space:
mode:
authorNicolas BERNSTEIN <alexis211@gmail.com>2011-11-20 13:39:47 +0100
committerNicolas BERNSTEIN <alexis211@gmail.com>2011-11-20 13:39:47 +0100
commitd45c7f14891d951f8a6987cc6492073b97e05b5b (patch)
treed6467b1202c27f67fd8e894d25fd4aea0085b559 /lib/study/list.php
parent4d7e065c2d2ec407b6a7ebfc7569628bac9149d1 (diff)
downloadBits-d45c7f14891d951f8a6987cc6492073b97e05b5b.tar.gz
Bits-d45c7f14891d951f8a6987cc6492073b97e05b5b.zip
Added the bit list study system
Diffstat (limited to 'lib/study/list.php')
-rw-r--r--lib/study/list.php37
1 files changed, 37 insertions, 0 deletions
diff --git a/lib/study/list.php b/lib/study/list.php
new file mode 100644
index 0000000..2f0031f
--- /dev/null
+++ b/lib/study/list.php
@@ -0,0 +1,37 @@
+<?php
+
+assert_redir(count($args) == 3, 'study');
+$studyid = intval($args[2]);
+
+$study = mysql_fetch_assoc(sql(
+ "SELECT lists.id AS listid, lists.name AS listname, account.login AS listowner, ".
+ " list_study.user AS learn_user ".
+ "FROM list_study LEFT JOIN lists ON list_study.list = lists.id LEFT JOIN account ON account.id = lists.owner ".
+ "WHERE list_study.id = $studyid"));
+assert_error($study && $study['learn_user'] == $user['id'], "You are not at the right place here.");
+
+$filters = array(
+ "order" => array(
+ "name" => "name",
+ "lr_score" => "last score"
+ ),
+ "way" => $ord_ways,
+);
+$fdefaults = array(
+ "order" => "name",
+ "way" => "ASC",
+);
+
+$batches = array();
+$n = sql(
+ "SELECT batches.id AS id, batches.name AS name, ".
+ "batch_study.id AS bs_id, batch_review.date AS lr_date, batch_review.score AS lr_score ".
+ "FROM batches ".
+ "LEFT JOIN batch_study ON batch_study.batch = batches.id AND batch_study.user = " . $user['id'] . " " .
+ "LEFT JOIN batch_review ON batch_review.id = batch_study.last_review ".
+ "WHERE batches.list = " . $study['listid'] . " " .
+ "ORDER BY " . get_filter("order") . " " . get_filter("way")
+ );
+while ($b = mysql_fetch_assoc($n)) $batches[] = $b;
+
+require("tpl/study/list.php");