diff options
Diffstat (limited to 'tpl')
-rw-r--r-- | tpl/deck/ef.php | 16 | ||||
-rw-r--r-- | tpl/deck/index.php | 20 | ||||
-rw-r--r-- | tpl/deck/new.php | 8 | ||||
-rw-r--r-- | tpl/deck/view.php | 33 | ||||
-rw-r--r-- | tpl/general/top.php | 9 | ||||
-rw-r--r-- | tpl/notes/index.php | 2 | ||||
-rw-r--r-- | tpl/study/index.php | 16 | ||||
-rw-r--r-- | tpl/study/lib_sidebar.php | 18 |
8 files changed, 119 insertions, 3 deletions
diff --git a/tpl/deck/ef.php b/tpl/deck/ef.php new file mode 100644 index 0000000..40d0ecc --- /dev/null +++ b/tpl/deck/ef.php @@ -0,0 +1,16 @@ + +<?php +require("tpl/general/top.php"); + +if (isset($fields)) + require("tpl/general/inc_form.php"); + +echo '</div><div class="contents-left">'; + +echo '<h1>' . $deck['name'] . '</h1>'; +echo '<ul><li><a href="view-deck-' . $deck['id'] . '">Back to deck</a></li>'; +echo '<li><a href="edit-deck-' . $deck['id'] . '">Edit deck</a></li>'; +echo '<li><a href="addent-deck-' . $deck['id'] . '">Add card to deck</a></li>'; +echo '</ul>'; + +require("tpl/general/bottom.php"); diff --git a/tpl/deck/index.php b/tpl/deck/index.php new file mode 100644 index 0000000..b8e9a76 --- /dev/null +++ b/tpl/deck/index.php @@ -0,0 +1,20 @@ +<?php + +$title = "Study decks"; + +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 ($decks as $deck) { + echo '<tr><td><code>' . $deck["owner"] . ':<a href="view-deck-' . $deck['id'] . '">' . $deck["name"] . '</a></code></td>'; + echo '<td>' . $deck["nbUsers"] . '</td></tr>'; +} +echo "</table>"; + +require("tpl/study/lib_sidebar.php"); + +require("tpl/general/bottom.php"); diff --git a/tpl/deck/new.php b/tpl/deck/new.php new file mode 100644 index 0000000..1f7e81e --- /dev/null +++ b/tpl/deck/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/deck/view.php b/tpl/deck/view.php new file mode 100644 index 0000000..f54da3d --- /dev/null +++ b/tpl/deck/view.php @@ -0,0 +1,33 @@ +<?php + +$title = $deck["owner"] . ':' . $deck["name"]; + +require("tpl/general/top.php"); + +if ($can_edit) { + echo '<div class="small_right"><a href="edit-deck-' . $deck['id'] . '">edit</a> | '; + echo '<a href="addent-deck-' . $deck['id'] . '">add card</a></div>'; +} + +echo '<h3>Description</h3>'; +echo $deck["comment"]; + +echo '<h3>Cards</h3>'; +echo '<div class="ordering_links">' . filters_html_full() . '</div>'; +foreach ($cards as $card) { + echo '<div class="study_card">'; + if ($can_edit) { + echo '<div class="small_right"><a href="edent-deck-' . $card['id'] . '">edit</a> | <a href="rment-deck-' . $card['id'] . '">remove</a> | '; + echo '<a href="#" onclick="if (pos = prompt(\'What position do you want to move this card to ?\', ' . $card['number'] . ')) { window.location = \'mvent-deck-' . $card['id'] . '-\' + pos; }">move</a>'; + echo '</div>'; + } + echo '<code>#' . $card["number"] . ": " . $card["name"] . '</code>'; + echo '<br />' . $card['text']; + echo '</div>'; +} +if ($can_edit) + echo '<a class="tool_link" href="addent-deck-' . $deck['id'] . '">[+] add card</a>'; + +require("tpl/study/lib_sidebar.php"); + +require("tpl/general/bottom.php"); diff --git a/tpl/general/top.php b/tpl/general/top.php index e87e466..28a9658 100644 --- a/tpl/general/top.php +++ b/tpl/general/top.php @@ -24,9 +24,12 @@ if ($user['id'] == 0) { <a href="notes">Notebooks</a> <?php if ($user['id'] != 0) { - echo '<a href="image">Uploaded images</a>'; -} elseif ($user['priv'] >= $apps['image']['upload']) { - echo '<a href="upload-image">Upload image</a>'; + echo '<a href="image">Uploaded images</a><a href="study">My studies</a>'; +} else { + if ($user['priv'] >= $apps['image']['upload']) { + echo '<a href="upload-image">Upload image</a>'; + } + echo '<a href="deck">Study decks</a>'; } ?> </div> diff --git a/tpl/notes/index.php b/tpl/notes/index.php index 1be4cd5..6c0eb99 100644 --- a/tpl/notes/index.php +++ b/tpl/notes/index.php @@ -2,6 +2,8 @@ $title = "User's notebooks"; require("tpl/general/top.php"); +echo '<div class="ordering_links">' . filters_html_full() . '</div>'; + echo "<ul>"; foreach($users as $u) { echo '<li><a href="user-notes-' . $u['id'] . '">' . $u['name'] . '</a> (' . $u['nbNotes'] . ' notes)</li>'; diff --git a/tpl/study/index.php b/tpl/study/index.php new file mode 100644 index 0000000..26ecd6d --- /dev/null +++ b/tpl/study/index.php @@ -0,0 +1,16 @@ +<?php + +$title = "My studies"; +require("tpl/general/top.php"); + +?> + +<p>Welcome to the <em>My studies section</em>. 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> + +<?php + +require ("lib_sidebar.php"); +require("tpl/general/bottom.php"); diff --git a/tpl/study/lib_sidebar.php b/tpl/study/lib_sidebar.php new file mode 100644 index 0000000..61bb11a --- /dev/null +++ b/tpl/study/lib_sidebar.php @@ -0,0 +1,18 @@ +<?php + +if ($user['id'] != 0) { + $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 + 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><a class="tool_link" href="new-deck">[+] Create deck</a></li></ul>'; +} |