remove old readme
[atutor.git] / docs / mods / _core / properties / admin / edit_course.php
1 <?php
2 /************************************************************************/
3 /* ATutor                                                                                                                               */
4 /************************************************************************/
5 /* Copyright (c) 2002-2010                                              */
6 /* Inclusive Design Institute                                           */
7 /* http://atutor.ca                                                     */
8 /* This program is free software. You can redistribute it and/or        */
9 /* modify it under the terms of the GNU General Public License          */
10 /* as published by the Free Software Foundation.                        */
11 /************************************************************************/
12 // $Id$
13
14 define('AT_INCLUDE_PATH', '../../../../include/');
15 require(AT_INCLUDE_PATH.'vitals.inc.php');
16 admin_authenticate(AT_ADMIN_PRIV_COURSES);
17
18 require(AT_INCLUDE_PATH.'../mods/_core/backups/classes/Backup.class.php');
19
20 if (isset($_POST['cancel'])) {
21         $msg->addFeedback('CANCELLED');
22         header('Location: ../../courses/admin/courses.php');
23         exit;
24 } else if (isset($_POST['submit'])) {
25         require(AT_INCLUDE_PATH.'../mods/_core/courses/lib/course.inc.php');
26         $errors = add_update_course($_POST, TRUE);
27
28         if (is_numeric($errors)) {
29                 $msg->addFeedback('COURSE_PROPERTIES');
30                 header('Location: '.AT_BASE_HREF.'mods/_core/courses/admin/courses.php');
31                 exit;
32         }
33 }
34
35 require(AT_INCLUDE_PATH.'header.inc.php'); 
36
37 $msg->printAll();
38
39 $course = intval($_REQUEST['course']);
40 $isadmin   = TRUE;
41
42 if ($isadmin){
43         $sql = "SELECT member_id, login FROM ".TABLE_PREFIX."members WHERE status=".AT_STATUS_INSTRUCTOR;
44         $result = mysql_query($sql, $db);
45         //$savant->assign('result', $result);
46 }
47 if (!$course){
48         $Backup = new Backup($db);
49
50                         if ($isadmin) {
51                                 $sql    = "SELECT course_id, title FROM ".TABLE_PREFIX."courses ORDER BY title";
52                         } else {
53                                 $sql    = "SELECT course_id, title FROM ".TABLE_PREFIX."courses WHERE member_id=$_SESSION[member_id] ORDER BY title";
54                         }
55
56                         $result2 = mysql_query($sql, $db);
57 }
58
59 $savant->assign('isadmin', $isadmin);
60 $savant->assign('course', $course);
61 $savant->assign('result', $result);
62 require(AT_INCLUDE_PATH.'../mods/_core/courses/html/course_properties.inc.php');
63
64 require(AT_INCLUDE_PATH.'footer.inc.php'); 
65 ?>