remove old readme
[atutor.git] / docs / mods / _standard / tests / question_cats.php
1 <?php\r
2 /************************************************************************/\r
3 /* ATutor                                                                                                                               */\r
4 /************************************************************************/\r
5 /* Copyright (c) 2002-2010                                              */\r
6 /* Inclusive Design Institute                                           */\r
7 /* http://atutor.ca                                                                                                             */\r
8 /*                                                                                                                                              */\r
9 /* This program is free software. You can redistribute it and/or        */\r
10 /* modify it under the terms of the GNU General Public License          */\r
11 /* as published by the Free Software Foundation.                        */\r
12 /************************************************************************/\r
13 // $Id$\r
14 \r
15 $page = 'tests';\r
16 define('AT_INCLUDE_PATH', '../../../include/');\r
17 require(AT_INCLUDE_PATH.'vitals.inc.php');\r
18 \r
19 authenticate(AT_PRIV_TESTS);\r
20 \r
21 if (isset($_POST['edit'], $_POST['category'])) {\r
22         header('Location: question_cats_manage.php?catid='.$_POST['category']);\r
23         exit;\r
24 } else if (isset($_POST['delete'], $_POST['category'])) {\r
25         header('Location: question_cats_delete.php?catid='.$_POST['category']);\r
26         exit;\r
27 } else if (!empty($_POST)) {\r
28         $msg->addError('NO_ITEM_SELECTED');\r
29 }\r
30 \r
31 require(AT_INCLUDE_PATH.'header.inc.php');\r
32 \r
33 $sql    = "SELECT * FROM ".TABLE_PREFIX."tests_questions_categories WHERE course_id=$_SESSION[course_id] ORDER BY title";\r
34 $result = mysql_query($sql, $db);\r
35 \r
36 if ($row = mysql_fetch_assoc($result)) {\r
37 ?>\r
38         <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" name="form">\r
39         <div class="input-form">\r
40         <fieldset class="group_form"><legend class="group_form"><?php echo _AT('question_categories'); ?></legend>\r
41 <?php   do { ?>\r
42                         <div class="row">\r
43                                 <input type="radio" id="cat_<?php echo $row['category_id']; ?>" name="category" value="<?php echo $row['category_id']; ?>" />   <label for="cat_<?php echo $row['category_id']; ?>"><?php echo AT_print($row['title'], 'tests_questions_categories.title'); ?></label>\r
44                         </div>\r
45 <?php \r
46                 } while ($row = mysql_fetch_assoc($result));\r
47 ?>\r
48 \r
49                 <div class="row buttons">\r
50                         <input type="submit" value="<?php echo _AT('edit'); ?>"   name="edit" />\r
51                         <input type="submit" value="<?php echo _AT('delete'); ?>" name="delete" />\r
52                 </div>\r
53         </div>\r
54         </form>\r
55 <?php\r
56 \r
57         } else {\r
58         echo '<div class="input-form">';\r
59                 echo '<p>&nbsp;'._AT('cats_no_categories').'</p>';\r
60         echo'</div>';\r
61         }\r
62 ?>\r
63 \r
64 \r
65 <?php require(AT_INCLUDE_PATH.'footer.inc.php'); ?>