764e3a7b0fa15b5429d295c2f99c14f79e81b25a
[acontent.git] / docs / home / course / del_course.php
1 <?php
2 /************************************************************************/
3 /* AContent                                                             */
4 /************************************************************************/
5 /* Copyright (c) 2010                                                   */
6 /* Inclusive Design Institute                                           */
7 /*                                                                      */
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
13 define('TR_INCLUDE_PATH', '../../include/');
14 require(TR_INCLUDE_PATH.'vitals.inc.php');
15 require_once(TR_INCLUDE_PATH.'classes/DAO/CoursesDAO.class.php');
16 require_once(TR_INCLUDE_PATH.'classes/Utility.class.php');
17
18 global $_course_id;
19
20 Utility::authenticate(TR_PRIV_ISAUTHOR_OF_CURRENT_COURSE);
21
22 $coursesDAO = new CoursesDAO();
23 $course_info = $coursesDAO->get($_course_id);
24
25 if (isset($_POST['submit_no'])) {
26         $msg->addFeedback('CANCELLED');
27         header('Location: '.TR_BASE_HREF.'home/course/index.php?_course_id='.$_course_id);
28         exit;
29 } else if (isset($_POST['step']) && ($_POST['step'] == 2) && isset($_POST['submit_yes'])) {
30         $coursesDAO->Delete($_course_id);
31         
32         $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');
33         header('Location: '.TR_BASE_HREF.'home/index.php');
34         exit;
35 }
36
37 require(TR_INCLUDE_PATH.'header.inc.php'); 
38
39 if (!isset($_POST['step'])) {
40         $hidden_vars['step'] = 1;
41         $hidden_vars['_course_id'] = $_course_id;
42         $msg->addConfirm(array('DELETE_COURSE_1', $course_info['title']), $hidden_vars);
43         $msg->printConfirm();
44 } else if ($_POST['step'] == 1) {
45         $hidden_vars['step'] = 2;
46         $hidden_vars['_course_id'] = $_course_id;
47         $msg->addConfirm(array('DELETE_COURSE_2', $course_info['title']), $hidden_vars);
48         $msg->printConfirm();
49 }
50
51 require(TR_INCLUDE_PATH.'footer.inc.php'); 
52 ?>