2 /****************************************************************/
\r
4 /****************************************************************/
\r
5 /* Copyright (c) 2002-2010 */
\r
6 /* Inclusive Design Institute */
\r
7 /* http://atutor.ca */
\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
14 define('AT_INCLUDE_PATH', '../../../include/');
\r
15 require(AT_INCLUDE_PATH.'vitals.inc.php');
\r
16 authenticate(AT_PRIV_CONTENT);
\r
18 global $contentManager;
\r
20 if (isset($_GET['edit'], $_GET['ctid'])) {
\r
21 $cid = intval($_GET['ctid']);
\r
22 $result = $contentManager->getContentPage($cid);
\r
23 $row = mysql_fetch_assoc($result);
\r
25 if ($row['content_type'] == CONTENT_TYPE_CONTENT || $row['content_type'] == CONTENT_TYPE_WEBLINK) {
\r
26 header('Location: '.AT_BASE_HREF.'mods/_core/editor/edit_content.php?cid='.$cid);
\r
27 } else if ($row['content_type'] == CONTENT_TYPE_FOLDER) {
\r
28 header('Location: '.AT_BASE_HREF.'mods/_core/editor/edit_content_folder.php?cid='.$cid);
\r
31 } else if (isset($_GET['delete'], $_GET['ctid'])) {
\r
32 header('Location: '.AT_BASE_HREF.'mods/_core/editor/delete_content.php?cid='.intval($_GET['ctid']));
\r
34 } else if (isset($_GET['view'], $_GET['ctid'])) {
\r
35 $cid = intval($_GET['ctid']);
\r
36 $result = $contentManager->getContentPage($cid);
\r
37 $row = mysql_fetch_assoc($result);
\r
39 if ($row['content_type'] == CONTENT_TYPE_CONTENT || $row['content_type'] == CONTENT_TYPE_WEBLINK) {
\r
40 header('Location: '.AT_BASE_HREF.'content.php?cid='.intval($_GET['ctid']));
\r
41 } else if ($row['content_type'] == CONTENT_TYPE_FOLDER) {
\r
42 header('Location: '.AT_BASE_HREF.'mods/_core/editor/edit_content_folder.php?cid='.$cid);
\r
45 } else if (isset($_GET['usage'], $_GET['ctid'])) {
\r
46 header('Location: '.AT_BASE_HREF.'mods/_standard/tracker/tools/page_student_stats.php?content_id='.intval($_GET['ctid']));
\r
48 } else if (!isset($_GET['ctid']) && !isset($_GET['sub_content']) && (isset($_GET['usage']) || isset($_GET['view']) || isset($_GET['delete']) || isset($_GET['edit']))) {
\r
49 $msg->addError('NO_ITEM_SELECTED');
\r
52 require(AT_INCLUDE_PATH.'header.inc.php');
\r
55 $col = addslashes($_GET['col']);
\r
57 $col = 'content_parent_id, ordering';
\r
60 if ($_GET['order']) {
\r
61 $order = addslashes($_GET['order']);
\r
66 if (!isset($_GET['sub_content'])) {
\r
69 $parent_id = intval($_GET['ctid']);
\r
73 $all_content = $contentManager->getContent();
\r
75 $content = $all_content[$parent_id];
\r
77 function print_select($pid, $depth) {
\r
78 global $all_content;
\r
80 if (!isset($all_content[$pid])) {
\r
84 foreach ($all_content[$pid] as $row) {
\r
85 if (isset($all_content[$row['content_id']])) {
\r
86 echo '<option value="'.$row['content_id'].'"';
\r
87 if ($_GET['ctid'] == $row['content_id']) {
\r
88 echo ' selected="selected"';
\r
91 echo str_repeat(' ', $depth * 5);
\r
92 echo $row['title'].'</option>';
\r
94 print_select($row['content_id'], $depth+1);
\r
98 $savant->assign('all_content', $all_content);
\r
99 $savant->assign('content', $content);
\r
100 $savant->display('instructor/content/index.tmpl.php');
\r
101 require(AT_INCLUDE_PATH.'footer.inc.php'); ?>