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
---
.gitignore | 1 +
js/liststudy.js | 92 +
js/prototype.js | 6082 ++++++++++++++++++++++++++++++++++++++++++++
js/reviewdesu.js | 91 +
lib/JSON/JSON.php | 806 ++++++
lib/JSON/inc_json.php | 22 +
lib/conf/apps.php | 18 +
lib/deck/edit.php | 2 +-
lib/list/addbatch.php | 43 +
lib/list/edbatch.php | 47 +
lib/list/edit.php | 43 +
lib/list/inc_process.php | 28 +
lib/list/index.php | 25 +
lib/list/new.php | 33 +
lib/list/rmbatch.php | 20 +
lib/list/view.php | 31 +
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 +
schema.sql | 101 +-
tpl/general/top.php | 11 +-
tpl/list/ef.php | 15 +
tpl/list/index.php | 20 +
tpl/list/new.php | 8 +
tpl/list/view.php | 29 +
tpl/study/batch.php | 20 +
tpl/study/batch_review.php | 13 +
tpl/study/index.php | 10 +-
tpl/study/lib_sidebar.php | 24 +
tpl/study/list.php | 37 +
33 files changed, 7818 insertions(+), 9 deletions(-)
create mode 100644 js/liststudy.js
create mode 100644 js/prototype.js
create mode 100644 js/reviewdesu.js
create mode 100644 lib/JSON/JSON.php
create mode 100644 lib/JSON/inc_json.php
create mode 100644 lib/list/addbatch.php
create mode 100644 lib/list/edbatch.php
create mode 100644 lib/list/edit.php
create mode 100644 lib/list/inc_process.php
create mode 100644 lib/list/index.php
create mode 100644 lib/list/new.php
create mode 100644 lib/list/rmbatch.php
create mode 100644 lib/list/view.php
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
create mode 100644 tpl/list/ef.php
create mode 100644 tpl/list/index.php
create mode 100644 tpl/list/new.php
create mode 100644 tpl/list/view.php
create mode 100644 tpl/study/batch.php
create mode 100644 tpl/study/batch_review.php
create mode 100644 tpl/study/list.php
diff --git a/.gitignore b/.gitignore
index 948f794..b792c3e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
lib/conf/sql.php
+*.swp
nohup.out
_old
images/*
diff --git a/js/liststudy.js b/js/liststudy.js
new file mode 100644
index 0000000..a0be379
--- /dev/null
+++ b/js/liststudy.js
@@ -0,0 +1,92 @@
+/*
+ liststudy.js
+ this script formats the data in batch_data and reviews_data to make a nice table out of it.
+*/
+
+var items = [];
+
+function show_batch_table() {
+ process_items();
+ show_contents_table();
+ show_reviews_table();
+}
+
+function process_items() {
+ for (var i = 0; i < batch_data.items.length; i++) {
+ items.push(
+ {"info": batch_data.items[i],
+ "win": 0, "fail": 0, "score": 0}
+ );
+ }
+ for (var i = 0; i < reviews_data.length; i++) {
+ for (var j = 0; j < reviews_data[i].results.length; j++) {
+ var n = reviews_data[i].results[j][0];
+ var s = reviews_data[i].results[j][1];
+ for (var k = 0; k < items.length; k++) {
+ if (items[k].info[0] == n) {
+ if (s == 1) {
+ items[k].win++;
+ items[k].score++;
+ } else if (s == -1) {
+ items[k].fail++;
+ items[k].score--;
+ }
+ }
+ }
+ }
+ }
+}
+
+function show_contents_table() {
+ var html = '';
+ for (var i = 0; i < batch_data.columns.length; i++) {
+ var c = batch_data.columns[i];
+ html += '' + c.name + ' - hide | ';
+ }
+ html += 'win | fail | score |
';
+ for (var i = 0; i < items.length; i++) {
+ html += '';
+ for (var j = 0; j < items[i].info.length; j++) {
+ html += '' + items[i].info[j] + ' | ';
+ }
+ html += '' + items[i].win + ' | ' + items[i].fail + ' | ' + items[i].score + ' |
';
+ }
+ html += '
';
+ $("items").innerHTML = html;
+}
+
+function ch(col) {
+ $$(".cd"+col).invoke("hide");
+ $("chsl"+col).innerHTML = 'show';
+ $("chsl"+col).onclick = function() { cs(col); };
+}
+
+function cs(col) {
+ $$(".cd"+col).invoke("show");
+ $("chsl"+col).innerHTML = 'hide';
+ $("chsl"+col).onclick = function() { ch(col); };
+}
+
+function show_reviews_table() {
+ // eventually, will also show a graph of progress. or maybee not.
+ if (reviews_data.length == 0) {
+ $("reviews").innerHTML = "No reviews... yet.";
+ } else {
+ var html = 'review date | score |
';
+ for (var i = 0; i < reviews_data.length; i++) {
+ var color = '';
+ if (reviews_data[i].score == 100)
+ color = '#00CC00';
+ else if (reviews_data[i].score >= 90)
+ color = '#55FF55';
+ else if (reviews_data[i].score >= 50)
+ color = '#FFFF00';
+ else
+ color = '#FF7777';
+ html += '' + reviews_data[i].date + ' | ' + reviews_data[i].score + '/100 |
';
+ }
+ html += '
';
+
+ $("reviews").innerHTML = html;
+ }
+}
diff --git a/js/prototype.js b/js/prototype.js
new file mode 100644
index 0000000..474b223
--- /dev/null
+++ b/js/prototype.js
@@ -0,0 +1,6082 @@
+/* Prototype JavaScript framework, version 1.7
+ * (c) 2005-2010 Sam Stephenson
+ *
+ * Prototype is freely distributable under the terms of an MIT-style license.
+ * For details, see the Prototype web site: http://www.prototypejs.org/
+ *
+ *--------------------------------------------------------------------------*/
+
+var Prototype = {
+
+ Version: '1.7',
+
+ Browser: (function(){
+ var ua = navigator.userAgent;
+ var isOpera = Object.prototype.toString.call(window.opera) == '[object Opera]';
+ return {
+ IE: !!window.attachEvent && !isOpera,
+ Opera: isOpera,
+ WebKit: ua.indexOf('AppleWebKit/') > -1,
+ Gecko: ua.indexOf('Gecko') > -1 && ua.indexOf('KHTML') === -1,
+ MobileSafari: /Apple.*Mobile/.test(ua)
+ }
+ })(),
+
+ BrowserFeatures: {
+ XPath: !!document.evaluate,
+
+ SelectorsAPI: !!document.querySelector,
+
+ ElementExtensions: (function() {
+ var constructor = window.Element || window.HTMLElement;
+ return !!(constructor && constructor.prototype);
+ })(),
+ SpecificElementExtensions: (function() {
+ if (typeof window.HTMLDivElement !== 'undefined')
+ return true;
+
+ var div = document.createElement('div'),
+ form = document.createElement('form'),
+ isSupported = false;
+
+ if (div['__proto__'] && (div['__proto__'] !== form['__proto__'])) {
+ isSupported = true;
+ }
+
+ div = form = null;
+
+ return isSupported;
+ })()
+ },
+
+ ScriptFragment: '';
+ }
+ }
+ if (isset($javascript)) echo '';
+ ?>
-
+ >
';
+}
+
+echo $list['comment'];
+
+if ($can_start_study) {
+ echo '>> start studying this list <<
';
+}
+
+echo 'Batch name | ' . ($can_edit ? 'actions | ' : '') . '
';
+foreach ($batches as $batch) {
+ echo '' . $batch['name'] . ' | ';
+ if ($can_edit) {
+ echo 'edit | remove | ';
+ }
+ echo '
';
+}
+echo '
';
+
+require("tpl/study/lib_sidebar.php");
+
+require("tpl/general/bottom.php");
diff --git a/tpl/study/batch.php b/tpl/study/batch.php
new file mode 100644
index 0000000..666fdc8
--- /dev/null
+++ b/tpl/study/batch.php
@@ -0,0 +1,20 @@
+test now';
+
+echo 'Items in this list
';
+echo 'Please wait, processing...
';
+echo 'Reviews
';
+echo 'Please wait, processing...
';
+
+require("tpl/study/lib_sidebar.php");
+require("tpl/general/bottom.php");
+
diff --git a/tpl/study/batch_review.php b/tpl/study/batch_review.php
new file mode 100644
index 0000000..ed81b75
--- /dev/null
+++ b/tpl/study/batch_review.php
@@ -0,0 +1,13 @@
+Please wait, processing...';
+
+require("tpl/general/bottom.php");
diff --git a/tpl/study/index.php b/tpl/study/index.php
index be78f22..82178df 100644
--- a/tpl/study/index.php
+++ b/tpl/study/index.php
@@ -5,7 +5,10 @@ require("tpl/general/top.php");
?>
-Welcome to the My studies section. This is a simple study program based on
+
Welcome to the My studies section. This is a simple study program, with two methods of studying available.
+
+First method : cards
+The first method is based on
decks of cards, keeping track of your progress and everything.
Please take a look in the List of decks and start learning whatever you want to learn.
@@ -26,6 +29,11 @@ Cards you are supposed to study or review today appear with a bold title : that
stuff you are learning right now. When the load is smaller than the study rate you ask for, new cards will be suggested for
you to learn.
+Second method : study lists
+In this method, we have lists of stuff to learn (like vocabulary), divided into batches (the batches are sorted
+for a given list). You will study one batch at a time, and take a test for one batch at a time. All your test results
+ are kept in storage and are used to display your progress.
+
';
echo '
Studying decks
';
+
+
+ echo '
Studying lists
';
+
+ echo '
My lists
';
+
}
diff --git a/tpl/study/list.php b/tpl/study/list.php
new file mode 100644
index 0000000..feffc72
--- /dev/null
+++ b/tpl/study/list.php
@@ -0,0 +1,37 @@
+
stop studying ';
+
+echo '' . filters_html_full() . '
';
+
+echo 'Batch name | actions | last test | score |
';
+foreach ($batches as $batch) {
+ $color = "";
+ if ($batch['lr_date']) {
+ if ($batch['lr_score'] == 100)
+ $color = "#00CC00";
+ else if ($batch['lr_score'] >= 90)
+ $color = "#55FF55";
+ else if ($batch['lr_score'] >= 50)
+ $color = "#FFFF00";
+ else
+ $color = "#FF7777";
+
+ }
+ if ($color != "") $color = ' style="background-color: ' . $color . '"';
+
+
+ echo '';
+ echo '' . $batch['name'] . ' | ';
+ echo 'view | test | ';
+ echo '' . ($batch['lr_date'] ? $batch['lr_date'] : "never") . ' | ';
+ echo '' . ($batch['lr_date'] ? $batch['lr_score'] . '/100' : 'N/A') . ' | ';
+ echo '
';
+}
+echo '
';
+
+require("lib_sidebar.php");
+require("tpl/general/bottom.php");
--
cgit v1.2.3