remove old readme
[atutor.git] / mods / _core / courses / admin / auto_enroll.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 define('AT_INCLUDE_PATH', '../../../../include/');\r
16 require(AT_INCLUDE_PATH.'vitals.inc.php');\r
17 require(AT_INCLUDE_PATH.'../mods/_core/themes/lib/themes.inc.php');\r
18 admin_authenticate(AT_ADMIN_PRIV_ADMIN);\r
19 \r
20 if (isset($_POST['delete'], $_POST['auto_enroll_id'])) {\r
21         header('Location: auto_enroll_delete.php?auto_enroll_id='.$_POST['auto_enroll_id']);\r
22         exit;\r
23 } else if (isset($_POST['edit'], $_POST['auto_enroll_id'])) {\r
24         header('Location: auto_enroll_edit.php?auto_enroll_id='.$_POST['auto_enroll_id']);\r
25         exit;\r
26 } else if (!empty($_POST)) {\r
27         $msg->addError('NO_ITEM_SELECTED');\r
28 }\r
29 \r
30 require(AT_INCLUDE_PATH.'header.inc.php'); \r
31 \r
32 ?>\r
33 <form name="form" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">\r
34 <table summary="" class="data" rules="cols" align="center" style="width: 95%;">\r
35 \r
36 <thead>\r
37 <tr>\r
38         <th scope="col">&nbsp;</th>\r
39         <th scope="col"><?php echo _AT('name'); ?></th>\r
40         <th scope="col"><?php echo _AT('courses'); ?></th>\r
41         <th scope="col"><?php echo _AT('url'); ?></th>\r
42 </tr>\r
43 </thead>\r
44 <tfoot>\r
45 <tr>\r
46         <td colspan="4">\r
47                 <div class="row buttons">\r
48                 <input type="submit" name="edit" value="<?php echo _AT('edit'); ?>" /> <input type="submit" name="delete" value="<?php echo _AT('delete'); ?>" /> \r
49                 </div>\r
50         </td>\r
51 </tr>\r
52 </tfoot>\r
53 <tbody>\r
54 <?php\r
55 $sql    = "SELECT * FROM ".TABLE_PREFIX."auto_enroll ae ORDER BY name";\r
56 $result = mysql_query($sql, $db) or die(mysql_error());\r
57 \r
58 if ($row = mysql_fetch_assoc($result)): ?>\r
59         <?php\r
60         do {\r
61                 $courses = "";\r
62                 $sql_courses = "SELECT c.title FROM ". TABLE_PREFIX."auto_enroll_courses aec, " . \r
63                                          TABLE_PREFIX ."courses c \r
64                           WHERE aec.auto_enroll_id = ". $row["auto_enroll_id"] . "\r
65                             AND aec.course_id = c.course_id\r
66                           ORDER BY c.title";\r
67 \r
68                 $result_courses = mysql_query($sql_courses, $db) or die(mysql_error());\r
69 \r
70                 while ($row_courses = mysql_fetch_assoc($result_courses))\r
71                         $courses .= $row_courses["title"] . "<br>";\r
72         ?>\r
73                 <tr onmousedown="document.form['m<?php echo $row['auto_enroll_id']; ?>'].checked = true; rowselect(this);" id="r_<?php echo $row['auto_enroll_id']; ?>">\r
74                         <td width="10"><input type="radio" name="auto_enroll_id" value="<?php echo $row['auto_enroll_id']; ?>" id="m<?php echo $row['auto_enroll_id']; ?>" /></td>\r
75                         <td><label for="m<?php echo $row['auto_enroll_id']; ?>"><?php if ($row['name']=="") echo _AT('na'); else echo $row['name']; ?></label></td>\r
76                         <td><?php echo $courses; ?></td>\r
77                         <td nowrap><?php echo $_base_href. "registration.php?en_id=". $row['associate_string']; ?></td>\r
78                 </tr>\r
79         <?php } while ($row = mysql_fetch_assoc($result)); ?>\r
80 <?php else: ?>\r
81         <tr>\r
82                 <td colspan="4"><?php echo _AT('none_found'); ?></td>\r
83         </tr>\r
84 <?php endif; ?>\r
85 </tbody>\r
86 </table>\r
87 \r
88 </form>\r
89 \r
90 \r
91 <?php require(AT_INCLUDE_PATH.'footer.inc.php'); ?>