From d45c7f14891d951f8a6987cc6492073b97e05b5b Mon Sep 17 00:00:00 2001 From: Nicolas BERNSTEIN Date: Sun, 20 Nov 2011 13:39:47 +0100 Subject: Added the bit list study system --- lib/study/batch.php | 31 +++++++++++++++++++++++++++++++ lib/study/batchreview.php | 23 +++++++++++++++++++++++ lib/study/brresults.php | 35 +++++++++++++++++++++++++++++++++++ lib/study/list.php | 37 +++++++++++++++++++++++++++++++++++++ lib/study/listadd.php | 13 +++++++++++++ lib/study/listrm.php | 16 ++++++++++++++++ 6 files changed, 155 insertions(+) create mode 100644 lib/study/batch.php create mode 100644 lib/study/batchreview.php create mode 100644 lib/study/brresults.php create mode 100644 lib/study/list.php create mode 100644 lib/study/listadd.php create mode 100644 lib/study/listrm.php (limited to 'lib/study') diff --git a/lib/study/batch.php b/lib/study/batch.php new file mode 100644 index 0000000..d8df526 --- /dev/null +++ b/lib/study/batch.php @@ -0,0 +1,31 @@ + 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"); diff --git a/lib/study/listadd.php b/lib/study/listadd.php new file mode 100644 index 0000000..536ab1d --- /dev/null +++ b/lib/study/listadd.php @@ -0,0 +1,13 @@ += 3, 'study'); +$studyid = intval($args[2]); + +$study = mysql_fetch_assoc(sql( + "SELECT ". + " list_study.user AS learn_user ". + "FROM list_study ". + "WHERE list_study.id = $studyid")); +assert_error($study && $study['learn_user'] == $user['id'], "You are not at the right place here."); + +token_validate("Do you really want to remove this list from your studies ? Your progress will not be lost.", "list-study-$studyid"); +sql("DELETE FROM list_study WHERE id = $studyid"); +header("Location: study"); +die(); -- cgit v1.2.3