diff options
author | Nicolas BERNSTEIN <alexis211@gmail.com> | 2011-11-20 13:39:47 +0100 |
---|---|---|
committer | Nicolas BERNSTEIN <alexis211@gmail.com> | 2011-11-20 13:39:47 +0100 |
commit | d45c7f14891d951f8a6987cc6492073b97e05b5b (patch) | |
tree | d6467b1202c27f67fd8e894d25fd4aea0085b559 /tpl | |
parent | 4d7e065c2d2ec407b6a7ebfc7569628bac9149d1 (diff) | |
download | Bits-d45c7f14891d951f8a6987cc6492073b97e05b5b.tar.gz Bits-d45c7f14891d951f8a6987cc6492073b97e05b5b.zip |
Added the bit list study system
Diffstat (limited to 'tpl')
-rw-r--r-- | tpl/general/top.php | 11 | ||||
-rw-r--r-- | tpl/list/ef.php | 15 | ||||
-rw-r--r-- | tpl/list/index.php | 20 | ||||
-rw-r--r-- | tpl/list/new.php | 8 | ||||
-rw-r--r-- | tpl/list/view.php | 29 | ||||
-rw-r--r-- | tpl/study/batch.php | 20 | ||||
-rw-r--r-- | tpl/study/batch_review.php | 13 | ||||
-rw-r--r-- | tpl/study/index.php | 10 | ||||
-rw-r--r-- | tpl/study/lib_sidebar.php | 24 | ||||
-rw-r--r-- | tpl/study/list.php | 37 |
10 files changed, 185 insertions, 2 deletions
diff --git a/tpl/general/top.php b/tpl/general/top.php index 28a9658..2ddc84e 100644 --- a/tpl/general/top.php +++ b/tpl/general/top.php @@ -7,9 +7,17 @@ global $user, $apps; //These might be hidden because this page is called from sq <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title><?php echo $title; ?></title> <link href="design/style.css" rel="stylesheet" type="text/css" media="screen" /> + <?php + if (isset($js_include)) { + foreach($js_include as $e) { + echo '<script type="text/javascript" src="' . $e . '"></script>'; + } + } + if (isset($javascript)) echo '<script type="text/javascript">' . $javascript . '</script>'; + ?> </head> - <body> + <body<?php if (isset($onload_js)) echo ' onload="' . $onload_js . '"'; ?>> <div class="menu"> <div class="right"> <?php @@ -30,6 +38,7 @@ if ($user['id'] != 0) { echo '<a href="upload-image">Upload image</a>'; } echo '<a href="deck">Study decks</a>'; + echo '<a href="list">Study lists</a>'; } ?> </div> diff --git a/tpl/list/ef.php b/tpl/list/ef.php new file mode 100644 index 0000000..1e7387a --- /dev/null +++ b/tpl/list/ef.php @@ -0,0 +1,15 @@ +<?php +require("tpl/general/top.php"); + +if (isset($fields)) + require("tpl/general/inc_form.php"); + +echo '</div><div class="contents-left">'; + +echo '<h1>' . $list['name'] . '</h1>'; +echo '<ul><li><a href="view-list-' . $list['id'] . '">Back to list</a></li>'; +echo '<li><a href="edit-list-' . $list['id'] . '">Edit list</a></li>'; +echo '<li><a href="addbatch-list-' . $list['id'] . '">Add batch to list</a></li>'; +echo '</ul>'; + +require("tpl/general/bottom.php"); diff --git a/tpl/list/index.php b/tpl/list/index.php new file mode 100644 index 0000000..85a503c --- /dev/null +++ b/tpl/list/index.php @@ -0,0 +1,20 @@ +<?php + +$title = "Study lists"; + +if ($user['id'] == 0) $message = "Hey, you should create an account so that you can study with us!"; + +require("tpl/general/top.php"); + +echo '<div class="ordering_links">' . filters_html_full() . '</div>'; + +echo "<table><tr><th>Name</th><th>Users</th>"; +foreach ($lists as $list) { + echo '<tr><td><code>' . $list["owner"] . ':<a href="view-list-' . $list['id'] . '">' . $list["name"] . '</a></code></td>'; + echo '<td>' . $list["nbUsers"] . '</td></tr>'; +} +echo "</table>"; + +require("tpl/study/lib_sidebar.php"); + +require("tpl/general/bottom.php"); diff --git a/tpl/list/new.php b/tpl/list/new.php new file mode 100644 index 0000000..1f7e81e --- /dev/null +++ b/tpl/list/new.php @@ -0,0 +1,8 @@ +<?php +require("tpl/general/top.php"); + +require("tpl/general/inc_form.php"); + +require("tpl/study/lib_sidebar.php"); + +require("tpl/general/bottom.php"); diff --git a/tpl/list/view.php b/tpl/list/view.php new file mode 100644 index 0000000..8b2c292 --- /dev/null +++ b/tpl/list/view.php @@ -0,0 +1,29 @@ +<?php + +$title = $list['owner'] . ':' . $list['name']; +require("tpl/general/top.php"); + +if ($can_edit) { + echo '<div class="small_right"><a href="edit-list-' . $list['id'] . '">edit</a> | '; + echo '<a href="addbatch-list-' . $list['id'] . '">add batch</a></div>'; +} + +echo $list['comment']; + +if ($can_start_study) { + echo '<p style="text-align: center; font-size: 1.2em;"><a href="listadd-study-' . $listid . '">>> start studying this list <<</a></p>'; +} + +echo '<table><tr><th>Batch name</th>' . ($can_edit ? '<th>actions</th>' : '') . '</tr>'; +foreach ($batches as $batch) { + echo '<tr><td>' . $batch['name'] . '</td>'; + if ($can_edit) { + echo '<td><a href="edbatch-list-' . $batch['id'] . '">edit</a> | <a href="rmbatch-list-' . $batch['id'] . '">remove</a></td>'; + } + echo '</tr>'; +} +echo '</table>'; + +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 @@ +<?php + +$title = $info['uname'] . ':' . $info['lname'] . ' - ' . $info['bname']; + +$javascript = "\n\nconst batch_data = " . $info['json_data'] . ";\n\nconst reviews_data = $reviews;\n\n"; +$js_include = array("js/prototype.js", "js/liststudy.js"); +$onload_js = 'show_batch_table();'; + +require("tpl/general/top.php"); + +echo '<div class="small_right"><a href="batchreview-study-' . $info['batchid'] . '">test now</a></div>'; + +echo '<h2>Items in this list</h2>'; +echo '<div id="items">Please wait, processing...</div>'; +echo '<h2>Reviews</h2>'; +echo '<div id="reviews">Please wait, processing...</div>'; + +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 @@ +<?php + +$title = "Testing " . $info['uname'] . ':' . $info['lname'] . ' - ' . $info['bname']; + +$javascript = "\n\nconst batchid = " . $info['batchid'] . "\nconst batch_data = " . $info['json_data'] . ";\n\n"; +$js_include = array("js/prototype.js", "js/reviewdesu.js"); +$onload_js = 'start_review();'; + +require("tpl/general/top.php"); + +echo '<div id="core">Please wait, processing...</div>'; + +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"); ?> -<p>Welcome to the <em>My studies</em> section. This is a simple study program based on +<p>Welcome to the <em>My studies</em> section. This is a simple study program, with two methods of studying available.</p> + +<h3>First method : cards</h3> +<p>The first method is 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 start learning whatever you want to learn.</p> @@ -26,6 +29,11 @@ Cards you are supposed to study or review today appear with a bold title : that 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> +<h3>Second method : study lists</h3> +<p>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.</p> + <?php require ("lib_sidebar.php"); diff --git a/tpl/study/lib_sidebar.php b/tpl/study/lib_sidebar.php index 820d0bd..c82d0a4 100644 --- a/tpl/study/lib_sidebar.php +++ b/tpl/study/lib_sidebar.php @@ -11,6 +11,16 @@ if ($user['id'] != 0) { $d = sql("SELECT id, name FROM decks WHERE owner = " . $user['id']); while ($dd = mysql_fetch_assoc($d)) $my_decks[] = $dd; + $studying_lists = array(); + $d = sql("SELECT list_study.id AS id, lists.name AS name, account.login AS username FROM list_study ". + "LEFT JOIN lists ON lists.id = list_study.list LEFT JOIN account ON account.id = lists.owner ". + "WHERE list_study.user = " . $user['id']); + while($dd = mysql_fetch_assoc($d)) $studying_lists[] = $dd; + + $my_lists = array(); + $d = sql("SELECT id, name FROM lists WHERE owner = " . $user['id']); + while ($dd = mysql_fetch_assoc($d)) $my_lists[] = $dd; + echo '</div><div class="contents-left">'; echo '<h1>Studying decks</h1><ul>'; foreach($studying_decks as $deck) { @@ -23,4 +33,18 @@ if ($user['id'] != 0) { 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>'; + + + echo '<h1>Studying lists</h1><ul>'; + foreach($studying_lists as $list) { + echo '<li><code>'.$list['username'].':<a href="list-study-' . $list['id'] . '">' . $list['name'] . '</a></code></li>'; + } + echo '<li><a class="tool_link" href="list">[+] Show all lists</a></li></ul>'; + + echo '<h1>My lists</h1><ul>'; + foreach($my_lists as $list) { + echo '<li><code><a href="view-list-' . $list['id'] . '">' . $list['name'] . '</a></code></li>'; + } + echo '<li><a class="tool_link" href="new-list">[+] Create list</a></li></ul>'; + } 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 @@ +<?php + +$title = "Studying " . $study['listowner'] . ':' . $study['listname']; +require("tpl/general/top.php"); + +echo '<div class="small_right"><a href="listrm-study-' . $studyid . '">stop studying</a></div>'; + +echo '<div class="ordering_links">' . filters_html_full() . '</div>'; + +echo '<table><tr><th>Batch name</th><th>actions</th><th>last test</th><th>score</th></tr>'; +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 '<tr>'; + echo '<td><code>' . $batch['name'] . '</code></td>'; + echo '<td><a href="batch-study-' . $batch['id'] . '">view</a> | <a href="batchreview-study-' . $batch['id'] . '">test</a></td>'; + echo '<td>' . ($batch['lr_date'] ? $batch['lr_date'] : "never") . '</td>'; + echo '<td'.$color.'>' . ($batch['lr_date'] ? $batch['lr_score'] . '/100' : 'N/A') . '</td>'; + echo '</tr>'; +} +echo '</table>'; + +require("lib_sidebar.php"); +require("tpl/general/bottom.php"); |