summaryrefslogtreecommitdiff
path: root/tpl/study
diff options
context:
space:
mode:
authorNicolas BERNSTEIN <alexis211@gmail.com>2011-09-18 12:07:29 +0200
committerNicolas BERNSTEIN <alexis211@gmail.com>2011-09-18 12:07:29 +0200
commita565e649898c629874ef812a13806b1c384f68e4 (patch)
treeafc03ed12ec7e82ce17bcfff5ba76440ff43eb97 /tpl/study
parent8d9321225140a3db0b72796d4d0236d6cacfeb8a (diff)
downloadBits-a565e649898c629874ef812a13806b1c384f68e4.tar.gz
Bits-a565e649898c629874ef812a13806b1c384f68e4.zip
Added study program. Yay!
Diffstat (limited to 'tpl/study')
-rw-r--r--tpl/study/deck.php68
-rw-r--r--tpl/study/index.php20
-rw-r--r--tpl/study/lib_sidebar.php12
-rw-r--r--tpl/study/setrate.php18
4 files changed, 114 insertions, 4 deletions
diff --git a/tpl/study/deck.php b/tpl/study/deck.php
new file mode 100644
index 0000000..d231705
--- /dev/null
+++ b/tpl/study/deck.php
@@ -0,0 +1,68 @@
+<?php
+
+$title = "Studying " . $study['deckowner'] . ':' . $study['deckname'];
+require("tpl/general/top.php");
+
+echo '<div class="small_right"><a href="deckrm-study-' . $studyid . '">stop studying</a></div>';
+
+echo '<div style="margin-top: 20px;text-align: center; font-size: 1.2em;">';
+echo 'Load : ' . $load . '/' . $study['learn_rate'] . ' - <a href="setrate-study-' . $studyid . '">change study rate</a></div>';
+
+if (isset($next_card)) {
+ if ($next_card) {
+ echo '<div class="study_card">';
+ echo '<div class="small_right"><a href="setcard-study-'.$next_card['id'].'-0">skip this card (0)</a><br />';
+ echo '<a href="setcard-study-'.$next_card['id'].'-1">learn this card (1)</a><br />';
+ echo '<a href="setcard-study-'.$next_card['id'].'-4">I know this already (4)</a><br />';
+ echo '<a href="setcard-study-'.$next_card['id'].'-7">I totally know this already (7)</a></div>';
+ echo '<code style="font-weight: bold">(next card) #'.$next_card['number'].': '.$next_card['name'].'</code>';
+ echo $next_card['text_html'];
+ echo '<div style="clear: both"></div></div>';
+ } else {
+ echo '<p>No more cards to study !</p>';
+ }
+}
+
+echo '<div class="ordering_links">' . filters_html_full() . '</div>';
+
+if (count($study_cards) == 0) {
+ echo '<p>Nothing in this list at the moment.</p>';
+} else {
+ foreach($study_cards as $card) {
+ echo '<div class="study_card scb'.$card['level'].'">';
+
+ $l = array();
+ if ($card['level'] > 0) {
+ $l[] = '<a href="setcard-study-'.$card['id'].'-0">'. ($card['level'] >= 4 ? 'put in skip list' : 'skip this card') . '</a>';
+ }
+ if ($card['must_study'] || $card['level'] == 0 || $card['level'] == 7) {
+ $l[] = '<a href="setcard-study-'.$card['id'].'-1">'. ($card['level'] == 0 ? 'learn this card' : 'I forgot all about this'). ' (1)</a>';
+ if ($card['level'] > 0 and $card['level'] < 3) {
+ $l[] = '<a href="setcard-study-'.$card['id'].'-'.($card['level']+1).'" style="font-weight: bold">I\'m learning this ('.($card['level']+1).')</a>';
+ }
+ if ($card['level'] < 4) {
+ $l[] = '<a href="setcard-study-'.$card['id'].'-4"'.
+ ($card['level'] == 3 ? ' style="font-weight: bold"' : '')
+ .'>I know this (4)</a>';
+ }
+ if ($card['level'] > 3 and $card['level'] < 6) {
+ $l[] = '<a href="setcard-study-'.$card['id'].'-'.($card['level']+1).'" style="font-weight: bold">I know this ('.($card['level']+1).')</a>';
+ }
+ }
+ if ($card['level'] < 7) {
+ $l[] = '<a href="setcard-study-'.$card['id'].'-7"' .
+ ($card['level'] == 6 && $card['must_study'] ? ' style="font-weight: bold"' : '')
+ .'>I totally know this (7)</a>';
+ }
+ echo '<div class="small_right">';
+ echo implode("<br />\n", $l);
+ echo '</div>';
+
+ echo '<code' . ($card['must_study'] ? ' style="font-weight: bold"' : '') . '>(' . ($card['level'] == 0 ? 'skipped' : 'level '.$card['level']) .') #'.$card['number'].': '.$card['name'].'</code>';
+ echo $card['text'];
+ echo '<div style="clear: both"></div></div>';
+ }
+}
+
+require ("lib_sidebar.php");
+require("tpl/general/bottom.php");
diff --git a/tpl/study/index.php b/tpl/study/index.php
index 26ecd6d..be78f22 100644
--- a/tpl/study/index.php
+++ b/tpl/study/index.php
@@ -5,10 +5,26 @@ require("tpl/general/top.php");
?>
-<p>Welcome to the <em>My studies section</em>. This is a simple study program based on
+<p>Welcome to the <em>My studies</em> section. This is a simple study program based on
decks of cards, keeping track of your progress and everything.</p>
-<p>Please take a look in the <a href="deck">List of decks</a> and look at whatever you want to learn.</p>
+<p>Please take a look in the <a href="deck">List of decks</a> and start learning whatever you want to learn.</p>
+
+<p>The cards you are studying are classified in the following <em>boxes</em> :</p>
+<ul>
+<li><strong>Skipped cards :</strong> cards you can't really say you know, but you don't want to study right now.</li>
+<li><strong>Levels 1 to 3 :</strong> you are reviewing these cards daily (or almost), in order to <em>learn</em> them.</li>
+<li><strong>Level 4 to 6 :</strong> we consider you <em>know</em> that card, and you are just reviewing it from times to times,
+ making sure you didn't forget it.</li>
+<li><strong>Level 7 :</strong> you totally know that card and will never be asked about it again.</li>
+</ul>
+<p>You can freely move cards into different boxes using the links that appear at the right of the card, the number in the parenthesis being
+ the level that card will have if you click it.
+Cards you are supposed to study or review today appear with a bold title : that means that <em>today</em>,
+ you should decide to put it either in the next box, or somewhere else.</p>
+<p>The <em>load</em> is calculated as a function of the number of cards with levels from 1 to 3 : it represents the quantity of
+ stuff you are <em>learning</em> right now. When the load is smaller than the study rate you ask for, new cards will be suggested for
+ you to learn.</p>
<?php
diff --git a/tpl/study/lib_sidebar.php b/tpl/study/lib_sidebar.php
index 61bb11a..820d0bd 100644
--- a/tpl/study/lib_sidebar.php
+++ b/tpl/study/lib_sidebar.php
@@ -1,18 +1,26 @@
<?php
if ($user['id'] != 0) {
+ $studying_decks = array();
+ $d = sql("SELECT deck_study.id AS id, decks.name AS name, account.login AS username FROM deck_study ".
+ "LEFT JOIN decks ON decks.id = deck_study.deck LEFT JOIN account ON account.id = decks.owner ".
+ "WHERE deck_study.user = ".$user['id']);
+ while($dd = mysql_fetch_assoc($d)) $studying_decks[] = $dd;
+
$my_decks = array();
$d = sql("SELECT id, name FROM decks WHERE owner = " . $user['id']);
while ($dd = mysql_fetch_assoc($d)) $my_decks[] = $dd;
echo '</div><div class="contents-left">';
echo '<h1>Studying decks</h1><ul>';
- //LIST
+ foreach($studying_decks as $deck) {
+ echo '<li><code>'.$deck['username'].':<a href="deck-study-' . $deck['id'] . '">' . $deck['name'] . '</a></code></li>';
+ }
echo '<li><a class="tool_link" href="deck">[+] Show all decks</a></li></ul>';
echo '<h1>My decks</h1><ul>';
foreach($my_decks as $deck) {
- echo '<li><a href="view-deck-' . $deck['id'] . '">' . $deck['name'] . '</a></li>';
+ echo '<li><code><a href="view-deck-' . $deck['id'] . '">' . $deck['name'] . '</a></code></li>';
}
echo '<li><a class="tool_link" href="new-deck">[+] Create deck</a></li></ul>';
}
diff --git a/tpl/study/setrate.php b/tpl/study/setrate.php
new file mode 100644
index 0000000..f632b33
--- /dev/null
+++ b/tpl/study/setrate.php
@@ -0,0 +1,18 @@
+<?php
+
+$title = "Change learn rate for " . $study['deckowner'] . ':' . $study['deckname'];
+require("tpl/general/top.php");
+
+echo '<p><strong>Current learn rate :</strong> ' . $study['learn_rate'] . ' - <a href="deck-study-' . $studyid . '">keep this rate</a></p>';
+
+echo '<p>Please choose how much you intend on studying :</p><ul>';
+echo '<li><a href="setrate-study-' . $studyid . '-5">Just a tiny bit (5)</a></li>';
+echo '<li><a href="setrate-study-' . $studyid . '-10">A little (10)</a></li>';
+echo '<li><a href="setrate-study-' . $studyid . '-15">Some (15)</a></li>';
+echo '<li><a href="setrate-study-' . $studyid . '-20">A lot (20)</a></li>';
+echo '<li><a href="setrate-study-' . $studyid . '-30">A real lot (30)</a></li>';
+echo '<li><a href="#" onclick="if (rate = prompt(\'Desired learn rate :\', 10)) { window.location = \'setrate-study-' . $studyid . '-\' + rate; }">Custom</a></li>';
+echo '</ul>';
+
+require ("lib_sidebar.php");
+require("tpl/general/bottom.php");