From b0c23ea84327d48e3a4383fac3e795c2dc0a1215 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 31 Jan 2014 16:42:40 +0100 Subject: Remove all studying apps code. --- lib/study/batch.php | 34 ----------------- lib/study/batchreview.php | 25 ------------ lib/study/brresults.php | 41 -------------------- lib/study/deck.php | 96 ----------------------------------------------- lib/study/deckadd.php | 13 ------- lib/study/deckrm.php | 17 --------- lib/study/index.php | 7 ---- lib/study/list.php | 43 --------------------- lib/study/listadd.php | 13 ------- lib/study/listrm.php | 16 -------- lib/study/setcard.php | 37 ------------------ lib/study/setrate.php | 19 ---------- 12 files changed, 361 deletions(-) delete mode 100644 lib/study/batch.php delete mode 100644 lib/study/batchreview.php delete mode 100644 lib/study/brresults.php delete mode 100644 lib/study/deck.php delete mode 100644 lib/study/deckadd.php delete mode 100644 lib/study/deckrm.php delete mode 100644 lib/study/index.php delete mode 100644 lib/study/list.php delete mode 100644 lib/study/listadd.php delete mode 100644 lib/study/listrm.php delete mode 100644 lib/study/setcard.php delete mode 100644 lib/study/setrate.php (limited to 'lib/study') diff --git a/lib/study/batch.php b/lib/study/batch.php deleted file mode 100644 index 60152f1..0000000 --- a/lib/study/batch.php +++ /dev/null @@ -1,34 +0,0 @@ - 0")); -$load = intval($load['l']); - -if ($load < $study['learn_rate']) { - $next_card = mysql_fetch_assoc(sql("SELECT * FROM cards WHERE deck = " . $study['deckid'] . " AND number = " . ($study['last_card'] + 1))); -} - - - -$filters = array( - "what" => array( - "level > 0 AND next_review <= CURDATE()" => "study today", - "level > 0 AND level < 4" => "learning", - "level > 0" => "all except skipped", - "level = 0" => "skipped", - ), - "order" => array( - "level" => "level", - "number" => "card number", - ), - "way" => $ord_ways, -); -$fdefaults = array( - "what" => "level > 0 AND next_review <= CURDATE()", - "order" => "level", - "way" => "ASC", -); - -$study_cards = array(); -$s = sql( - "SELECT cards.id AS id, cards.name AS name, cards.text_html AS text, cards.number AS number, ". - "card_study.level AS level, card_study.next_review <= CURDATE() AS must_study ". - "FROM card_study LEFT JOIN cards ON card_study.card = cards.id WHERE deck_study = $studyid AND " . get_filter("what") . - " ORDER BY " . get_filter("order") . " " . get_filter('way') . (get_filter("order") == "level" ? ", number " . get_filter("way") : "")); -while ($ss = mysql_fetch_assoc($s)) $study_cards[] = $ss; - - - -require("tpl/study/deck.php"); diff --git a/lib/study/deckadd.php b/lib/study/deckadd.php deleted file mode 100644 index b95648c..0000000 --- a/lib/study/deckadd.php +++ /dev/null @@ -1,13 +0,0 @@ -= 3, 'study'); -$studyid = intval($args[2]); - -$study = mysql_fetch_assoc(sql( - "SELECT ". - " deck_study.user AS learn_user ". - "FROM deck_study ". - "WHERE deck_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 deck from your studies ? ALL YOUR PROGRESS WILL BE LOST!", "deck-study-$studyid"); -sql("DELETE FROM card_study WHERE deck_study = $studyid"); -sql("DELETE FROM deck_study WHERE id = $studyid"); -header("Location: study"); -die(); diff --git a/lib/study/index.php b/lib/study/index.php deleted file mode 100644 index 6b43d53..0000000 --- a/lib/study/index.php +++ /dev/null @@ -1,7 +0,0 @@ - array( - "name" => "name", - "lr_score" => "last score", - "lr_date" => "last reviewed" - ), - "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, ba.date AS lr_date, TO_DAYS(NOW()) - TO_DAYS(ba.date) AS lr_days, ". - "ba.score AS lr_score, bc.date AS blr_date, bc.score AS blr_score, ". - "COUNT(bb.id) AS num_reviews ". - "FROM batches ". - "LEFT JOIN batch_study ON batch_study.batch = batches.id AND batch_study.user = " . $user['id'] . " " . - "LEFT JOIN batch_review ba ON ba.id = batch_study.last_review ". - "LEFT JOIN batch_review bb ON bb.batch = batches.id AND bb.user = " . $user['id'] . " ". - "LEFT JOIN batch_review bc ON bc.id = batch_study.before_last_review ". - "WHERE batches.list = " . $study['listid'] . " " . - "GROUP BY batches.id ". - "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 deleted file mode 100644 index 536ab1d..0000000 --- a/lib/study/listadd.php +++ /dev/null @@ -1,13 +0,0 @@ -= 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(); diff --git a/lib/study/setcard.php b/lib/study/setcard.php deleted file mode 100644 index c71bbfe..0000000 --- a/lib/study/setcard.php +++ /dev/null @@ -1,37 +0,0 @@ - 0, "You are not studying this deck."); - -assert_error($info['need_check'] == 0, - 'This deck needs checking first. Please return here first, it should do it.'); - -assert_error($info['cardnumber'] <= $info['last_card'] + 1, "You must first add previous cards to your study list."); - -$level = intval($args[3]); -assert_error($level >= 0 && $level <= 7, "That level is invalid."); -$intervals = array(999999, 1, 2, 4, 8, 16, 32, 999999); - -if ($info['cardnumber'] == $info['last_card'] + 1) { - sql("INSERT INTO card_study(deck_study, card, level, next_review) ". - "VALUES($studyid, $cardid, $level, ADDDATE(CURDATE(), INTERVAL " . $intervals[$level] . " DAY))"); - sql("UPDATE deck_study SET last_card = last_card + 1 WHERE id = $studyid"); -} else { - assert_error($info['csid'] > 0, "Deck is inconsistent."); - sql("UPDATE card_study SET level = $level, next_review = ADDDATE(CURDATE(), INTERVAL " . $intervals[$level] . " DAY) WHERE id = " . $info['csid']); -} - -header("Location: deck-study-$studyid"); -die(); diff --git a/lib/study/setrate.php b/lib/study/setrate.php deleted file mode 100644 index f893eb9..0000000 --- a/lib/study/setrate.php +++ /dev/null @@ -1,19 +0,0 @@ -= 3, 'study'); -$studyid = intval($args[2]); - -$study = mysql_fetch_assoc(sql( - "SELECT decks.id AS deckid, decks.name AS deckname, account.login AS deckowner, ". - " deck_study.learn_rate AS learn_rate, deck_study.user AS learn_user ". - "FROM deck_study LEFT JOIN decks ON deck_study.deck = decks.id LEFT JOIN account ON account.id = decks.owner ". - "WHERE deck_study.id = $studyid")); -assert_error($study && $study['learn_user'] == $user['id'], "You are not at the right place here."); - -if (isset($args[3]) && ($rate = intval($args[3])) > 0) { - sql("UPDATE deck_study SET learn_rate = $rate WHERE id = $studyid"); - header("Location: deck-study-$studyid"); - die(); -} - -include ("tpl/study/setrate.php"); -- cgit v1.2.3