remove old readme
[atutor.git] / docs / include / html / auto_enroll_list_courses.inc.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: auto_enroll_list_courses.php 7208 2008-01-09 16:07:24Z cindy $\r
14 \r
15 // Lists all courses to auto enroll\r
16 if (isset($_REQUEST["en_id"]) && $_REQUEST["en_id"] <> "")\r
17 {\r
18         $associate_string = $_REQUEST["en_id"];\r
19         \r
20         $cats   = array();\r
21         $cats[0] = _AT('cats_uncategorized');\r
22         \r
23         $sql = "SELECT cat_id, cat_name FROM ".TABLE_PREFIX."course_cats";\r
24         $result = mysql_query($sql,$db);\r
25         while($row = mysql_fetch_array($result)) {\r
26                 $cats[$row['cat_id']] = $row['cat_name'];\r
27         }\r
28         \r
29         $sql_courses = "SELECT aec.auto_enroll_courses_id auto_enroll_courses_id, \r
30                                aec.course_id,\r
31                                c.cat_id,\r
32                                c.title title\r
33                           FROM " . TABLE_PREFIX."auto_enroll a, " . \r
34                                    TABLE_PREFIX."auto_enroll_courses aec, " . \r
35                                    TABLE_PREFIX ."courses c\r
36                          where a.associate_string='".$associate_string ."'\r
37                            and a.auto_enroll_id = aec.auto_enroll_id\r
38                            and aec.course_id = c.course_id";\r
39 \r
40         $result_courses = mysql_query($sql_courses, $db) or die(mysql_error());\r
41         \r
42         if (mysql_num_rows($result_courses) > 0)\r
43         {\r
44 ?>\r
45 \r
46 <fieldset>\r
47         <legend><?php echo _AT('course_to_auto_enroll'); ?></legend>\r
48                 <?php echo $table_title; ?>\r
49         \r
50         <div class="row">\r
51                 <table summary="" class="data" rules="cols" align="left" style="width: 100%;">\r
52                 \r
53                 <thead>\r
54                 <tr>\r
55                         <th scope="col"><?php echo _AT('title'); ?></th>\r
56                         <th scope="col"><?php echo _AT('category'); ?></th>\r
57                 </tr>\r
58                 </thead>\r
59 \r
60                 <tbody>\r
61 <?php\r
62         if ($row_courses = mysql_fetch_assoc($result_courses)): \r
63                 do {\r
64                 ?>\r
65                         <tr>\r
66                                 <td><label for="m<?php echo $row_courses['auto_enroll_courses_id']; ?>"><?php echo $row_courses['title']; ?></label></td>\r
67                                 <td><?php echo $cats[$row_courses['cat_id']]; ?></td>\r
68                         </tr>\r
69                 <?php } while ($row_courses = mysql_fetch_assoc($result_courses)); ?>\r
70         <?php else: ?>\r
71                         <tr>\r
72                                 <td colspan="3"><?php echo _AT('none_found'); ?></td>\r
73                         </tr>\r
74         <?php endif; ?>\r
75                 </tbody>\r
76                 </table>\r
77         </div>\r
78         </legend>\r
79 </fieldset>\r
80 \r
81         <?php\r
82         }\r
83 \r
84 }\r
85 ?>\r