public function Delete($courseID)
{
require_once(TR_INCLUDE_PATH.'classes/FileUtility.class.php');
+ require_once(TR_INCLUDE_PATH.'classes/DAO/ContentDAO.class.php');
+ $contentDAO = new ContentDAO();
unset($_SESSION['s_cid']);
$sql = "DELETE FROM ".TABLE_PREFIX."tests_questions_categories WHERE course_id = ".$courseID;
$this->execute($sql);
- $sql = "DELETE FROM ".TABLE_PREFIX."tests_results
- WHERE test_id in (SELECT test_id FROM ".TABLE_PREFIX."tests WHERE course_id = ".$courseID.")";
- $this->execute($sql);
-
$sql = "DELETE FROM ".TABLE_PREFIX."tests_questions_assoc
WHERE test_id in (SELECT test_id FROM ".TABLE_PREFIX."tests WHERE course_id = ".$courseID.")";
$this->execute($sql);
WHERE test_id in (SELECT test_id FROM ".TABLE_PREFIX."tests WHERE course_id = ".$courseID.")";
$this->execute($sql);
- $sql = "DELETE FROM ".TABLE_PREFIX."tests_answers
- WHERE question_id in (SELECT question_id FROM ".TABLE_PREFIX."tests WHERE course_id = ".$courseID.")";
- $this->execute($sql);
-
$sql = "DELETE FROM ".TABLE_PREFIX."tests_questions WHERE course_id = ".$courseID;
$this->execute($sql);
$sql = "DELETE FROM ".TABLE_PREFIX."tests WHERE course_id = ".$courseID;
$this->execute($sql);
- // delete content
+ // loop thru content to delete using ContentDAO->Delete(), which deletes a4a objects as well
+ $content_rows = $contentDAO->getContentByCourseID($courseID);
+ if (is_array($content_rows)) {
+ foreach ($content_rows as $content) {
+ $contentDAO->Delete($content['content_id']);
+ }
+ }
$sql = "DELETE FROM ".TABLE_PREFIX."content WHERE course_id = ".$courseID;
$this->execute($sql);
Because the Utility::authenticate on the following each page section \r
messes up the oauth user authentication. \r
*/\r
-global $oauth_import;\r
+global $oauth_import, $_course_id, $_content_id;\r
if ($oauth_import) return;\r
\r
// constants to map privileges.privilege_id, used to load constant pages\r
\r
if (isset($_current_user) && $_current_user->isAuthor())\r
{\r
- $_pages['home/index.php']['children'] = array_merge(array('home/create_course.php'), isset($_pages['home/index.php']['children']) ? $_pages['home/index.php']['children'] : array());\r
- \r
- $_pages['home/create_course.php']['title_var'] = 'create_course';\r
- $_pages['home/create_course.php']['parent'] = 'home/index.php';\r
- $_pages['home/create_course.php']['guide'] = 'TR_HELP_CREATE_COURSE';\r
+ if (!isset($_course_id) || $_course_id == 0) {\r
+ $_pages['home/index.php']['children'] = array_merge(array('home/create_course.php'), isset($_pages['home/index.php']['children']) ? $_pages['home/index.php']['children'] : array());\r
+ \r
+ $_pages['home/create_course.php']['title_var'] = 'create_course';\r
+ $_pages['home/create_course.php']['parent'] = 'home/index.php';\r
+ $_pages['home/create_course.php']['guide'] = 'TR_HELP_CREATE_COURSE';\r
+ }\r
\r
$_pages['home/course/del_course.php']['title_var'] = 'del_course';\r
$_pages['home/course/del_course.php']['parent'] = 'home/index.php';\r