}
// generate array of all the content ids in the same order that they appear in "content navigation"
- $this->_menu_in_order[] = $next_content_id = $this->getNextContentID(0);
+ if ($this->getNextContentID(0) > 0) {
+ $this->_menu_in_order[] = $next_content_id = $this->getNextContentID(0);
+ }
while ($next_content_id > 0)
{
$next_content_id = $this->getNextContentID($next_content_id);
$coursesDAO = new CoursesDAO();
-Utility::authenticate(TR_PRIV_ISAUTHOR_OF_CURRENT_COURSE);
+if ($_course_id > 0) {
+ Utility::authenticate(TR_PRIV_ISAUTHOR_OF_CURRENT_COURSE);
+} else {
+ Utility::authenticate(TR_PRIV_ISAUTHOR);
+}
if (isset($_POST['cancel'])) {
$msg->addFeedback('CANCELLED');
exit;
}
else if($_POST['submit']){
- $coursesDAO->UpdateField($_course_id, 'title', $_POST['title']);
- $coursesDAO->UpdateField($_course_id, 'category_id', $_POST['category_id']);
- $coursesDAO->UpdateField($_course_id, 'primary_language', $_POST['pri_lang']);
- $coursesDAO->UpdateField($_course_id, 'description', $_POST['description']);
- $coursesDAO->UpdateField($_course_id, 'copyright', $_POST['copyright']);
-
- if (isset($_POST['hide_course']))
- $access = 'private';
- else
- $access = 'public';
-
- $coursesDAO->UpdateField($_course_id, 'access', $access);
- $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');
+ if (isset($_POST['hide_course']))
+ $access = 'private';
+ else
+ $access = 'public';
+
+ if ($_course_id > 0) { // update an existing course
+ $coursesDAO->UpdateField($_course_id, 'title', $_POST['title']);
+ $coursesDAO->UpdateField($_course_id, 'category_id', $_POST['category_id']);
+ $coursesDAO->UpdateField($_course_id, 'primary_language', $_POST['pri_lang']);
+ $coursesDAO->UpdateField($_course_id, 'description', $_POST['description']);
+ $coursesDAO->UpdateField($_course_id, 'copyright', $_POST['copyright']);
+
+ $coursesDAO->UpdateField($_course_id, 'access', $access);
+ $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');
+ }
+ else { // create a new course
+ if ($course_id = $coursesDAO->Create($_SESSION['user_id'], 'top', $access, $_POST['title'], $_POST['description'],
+ null, null, null, $_POST['copyright'], $_POST['pri_lang'], null, null))
+ {
+ $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');
+ header('Location: '.TR_BASE_HREF.'home/course/index.php?_course_id='.$course_id);
+ exit;
+ }
+ }
}
-$savant->assign('course_id', $_course_id);
-$savant->assign('course_row', $coursesDAO->get($_course_id));
+// display
+if ($_course_id > 0) {
+ $savant->assign('course_id', $_course_id);
+ $savant->assign('course_row', $coursesDAO->get($_course_id));
+}
global $onload;
$onload = "document.form.title.focus();";
--- /dev/null
+<?php
+/************************************************************************/
+/* Transformable */
+/************************************************************************/
+/* Copyright (c) 2009 */
+/* Adaptive Technology Resource Centre / University of Toronto */
+/* */
+/* This program is free software. You can redistribute it and/or */
+/* modify it under the terms of the GNU General Public License */
+/* as published by the Free Software Foundation. */
+/************************************************************************/
+
+define('TR_INCLUDE_PATH', '../../include/');
+require_once(TR_INCLUDE_PATH.'vitals.inc.php');
+require_once(TR_INCLUDE_PATH.'classes/DAO/CoursesDAO.class.php');
+
+global $msg, $contentManager, $_course_id;
+
+if ($_course_id <= 0)
+{
+ $msg->addError('MISSING_COURSE_ID');
+ header('Location: '.TR_BASE_HREF.'home/index.php');
+ exit;
+}
+
+$coursesDAO = new CoursesDAO();
+
+require(TR_INCLUDE_PATH.'header.inc.php');
+
+$savant->assign('course_id', $_course_id);
+$savant->display('home/course/course_start.tmpl.php');
+
+require(TR_INCLUDE_PATH.'footer.inc.php');
+?>
\ No newline at end of file
/************************************************************************/
define('TR_INCLUDE_PATH', '../../include/');
-require(TR_INCLUDE_PATH.'vitals.inc.php');
+require_once(TR_INCLUDE_PATH.'vitals.inc.php');
+require_once(TR_INCLUDE_PATH.'classes/DAO/CoursesDAO.class.php');
global $msg, $contentManager, $_course_id;
$url = $_sequence_links['first']['url'];
else
{
- // go to content wizard
+ $url = TR_BASE_HREF.'home/course/course_start.php?_course_id='.$_course_id;
}
header('Location: '.$url);
if (($current_tab == 0) || ($current_tab == 2)) {
if ($_POST['formatting'] == null){
// this is a fresh load from just logged in
- if ($_SESSION['prefs']['PREF_CONTENT_EDITOR'] == 0) {
+ if (isset($_SESSION['prefs']['PREF_CONTENT_EDITOR']) && $_SESSION['prefs']['PREF_CONTENT_EDITOR'] == 0) {
$_POST['formatting'] = 0;
} else {
$_POST['formatting'] = 1;
require_once(TR_INCLUDE_PATH.'vitals.inc.php');
global $_course_id, $_content_id;
- $course_id = (isset($_REQUEST['course_id']) ? intval($_REQUEST['course_id']) : $_course_id);
- $cid = isset($_REQUEST['cid']) ? intval($_REQUEST['cid']) : $_content_id; /* content id of an optional chapter */
+ $_course_id = $course_id = (isset($_REQUEST['course_id']) ? intval($_REQUEST['course_id']) : $_course_id);
+ $_content_id = $cid = isset($_REQUEST['cid']) ? intval($_REQUEST['cid']) : $_content_id; /* content id of an optional chapter */
$c = isset($_REQUEST['c']) ? intval($_REQUEST['c']) : 0;
}
}
else
{
- return mysql_insert_id();
+ $course_id = mysql_insert_id();
+ // create the user and course relationship
+ $sql = "INSERT INTO ".TABLE_PREFIX."user_courses (user_id, course_id, role, last_cid)
+ VALUES (".$user_id.", ".$course_id.", ".TR_USERROLE_AUTHOR.", 0)";
+ $this->execute($sql);
+ return $course_id;
}
}
else
$_pages['home/create_course.php']['guide'] = 'TR_HELP_CREATE_COURSE';\r
}\r
\r
+ $_pages['home/course/course_start.php']['title_var'] = 'course_start';\r
+ $_pages['home/course/course_start.php']['parent'] = 'home/index.php';\r
+ $_pages['home/course/course_start.php']['guide'] = 'TR_HELP_CONTENT_WIZARD';\r
+ \r
$_pages['home/course/del_course.php']['title_var'] = 'del_course';\r
$_pages['home/course/del_course.php']['parent'] = 'home/index.php';\r
\r
$output .= ' <img src="'. TR_BASE_HREF.'themes/'. $_SESSION['prefs']['PREF_THEME'].'/images/add.gif" alt="'. htmlspecialchars(_AT('add_into_list')).'" title="'. htmlspecialchars(_AT('add_into_list')).'" border="0" />'."\n";
$output .= ' </a>'."\n";
}
- $output .= ' <a href="'. TR_BASE_HREF.'home/imscc/ims_export.php?course_id='. $row['course_id'].'">'."\n";
- $output .= ' <img src="'. TR_BASE_HREF.'themes/'. $_SESSION['prefs']['PREF_THEME'].'/images/export.png" alt="'. _AT('export').'" title="'. _AT('export').'" border="0" />'."\n";
+ $output .= ' <a href="'. TR_BASE_HREF.'home/ims/ims_export.php?course_id='. $row['course_id'].'">'."\n";
+ $output .= ' <img src="'. TR_BASE_HREF.'themes/'. $_SESSION['prefs']['PREF_THEME'].'/images/export.png" alt="'. _AT('download_content_package').'" title="'. _AT('download_content_package').'" border="0" />'."\n";
$output .= ' </a>'."\n";
+ if ($row['role'] == TR_USERROLE_AUTHOR) {
+ $output .= ' <a href="'. TR_BASE_HREF.'home/imscc/ims_export.php?course_id='. $row['course_id'].'">'."\n";
+ $output .= ' <img src="'. TR_BASE_HREF.'themes/'. $_SESSION['prefs']['PREF_THEME'].'/images/export_cc.png" alt="'. _AT('download_common_cartridge').'" title="'. _AT('download_common_cartridge').'" border="0" />'."\n";
+ $output .= ' </a>'."\n";
+ }
$output .= ' </li>'."\n";
} // end of foreach;
$output .= '</ol>'."\n";
INSERT INTO `TR_language_text` VALUES ('en', '_template', 'test_import_package', 'Import available tests.', now(), '');\r
INSERT INTO `TR_language_text` VALUES ('en', '_template', 'a4a_import_package', 'Import available AccessForAll adapted content.', now(), '');\r
INSERT INTO `TR_language_text` VALUES ('en', '_template', 'upload_content_package', 'Upload a Content Package or Common Cartridge', now(), '');\r
-\r
INSERT INTO `TR_language_text` VALUES ('en', '_template', 'others_course', 'Others\' course', now(), '');\r
INSERT INTO `TR_language_text` VALUES ('en', '_template', 'most_recent_courses', 'Most Recent Courses', now(), '');\r
INSERT INTO `TR_language_text` VALUES ('en', '_template', 'all_categories', 'All Categories', now(), '');\r
INSERT INTO `TR_language_text` VALUES ('en', '_template', 'ims_files_missing', 'In this package, the file, %1$s, is missing or misplaced.', now(), '');\r
-\r
INSERT INTO `TR_language_text` VALUES ('en', '_template', 'metadata', 'Meta-data', now(), '');\r
-INSERT INTO `TR_language_text` VALUES ('en', '_template', '', '', now(), '');\r
-INSERT INTO `TR_language_text` VALUES ('en', '_template', '', '', now(), '');\r
-INSERT INTO `TR_language_text` VALUES ('en', '_template', '', '', now(), '');\r
-INSERT INTO `TR_language_text` VALUES ('en', '_template', '', '', now(), '');\r
-INSERT INTO `TR_language_text` VALUES ('en', '_template', '', '', now(), '');\r
+INSERT INTO `TR_language_text` VALUES ('en', '_template', 'download_content_package', 'Download Content Package', now(), '');\r
+INSERT INTO `TR_language_text` VALUES ('en', '_template', 'download_common_cartridge', 'Download Common Cartridge', now(), '');\r
+\r
+INSERT INTO `TR_language_text` VALUES ('en', '_template', 'course_start', 'How to create course content', now(), '');\r
+INSERT INTO `TR_language_text` VALUES ('en', '_template','create_content_1','<span style="font-weight:bold">Method 1</span>: Use',now(),'');\r
+INSERT INTO `TR_language_text` VALUES ('en', '_template','create_content_2','<span style="font-weight:bold">Method 2</span>: Manually <a href="%1s">create a content</a> or <a href="%2s">create a content folder</a>. These tools are also available as "Add top page" or "Add top folder" links in "Content Navigation" side menu.',now(),'');\r
+INSERT INTO `TR_language_text` VALUES ('en', '_template', 'create_content', 'Create Content', now(), '');\r
+INSERT INTO `TR_language_text` VALUES ('en', '_template', 'content_wizard', '"Create Content" Wizard', now(), '');\r
INSERT INTO `TR_language_text` VALUES ('en', '_template', '', '', now(), '');\r
INSERT INTO `TR_language_text` VALUES ('en', '_template', '', '', now(), '');\r
INSERT INTO `TR_language_text` VALUES ('en', '_template', '', '', now(), '');\r
--- /dev/null
+<?php
+/************************************************************************/
+/* Transformable */
+/************************************************************************/
+/* Copyright (c) 2009 */
+/* Adaptive Technology Resource Centre / University of Toronto */
+/* */
+/* This program is free software. You can redistribute it and/or */
+/* modify it under the terms of the GNU General Public License */
+/* as published by the Free Software Foundation. */
+/************************************************************************/
+
+?>
+ <div class="input-form">
+ <fieldset class="group_form"><legend class="group_form"><?php echo _AT('create_content'); ?></legend>
+ <table class="form_data">
+ <tr><td>
+ <?php echo _AT('create_content_1'); ?>
+ <a href="home/course/content_wizard.php"><?php echo _AT('content_wizard'); ?></a><br /><br />
+ </td></tr>
+
+ <tr><td>
+ <?php echo _AT('create_content_2', TR_BASE_HREF.'home/editor/edit_content.php?_course_id='.$this->course_id, TR_BASE_HREF.'home/editor/edit_content_folder.php?_course_id='.$this->course_id); ?>
+ </td></tr>
+ </table>
+ </fieldset>
+ </div>
+
<table class="form_data">
<tr><td>
<?php echo _AT('create_course_1'); ?>
- <a href="course_wizard.php"><?php echo htmlentities(_AT('course_wizard')); ?></a><br /><br />
+ <a href="home/course/course_property.php"><?php echo htmlentities(_AT('course_wizard')); ?></a><br /><br />
</td></tr>
<tr><td>
<img src="<?php echo TR_BASE_HREF; ?>themes/<?php echo $_SESSION['prefs']['PREF_THEME']; ?>/images/add.gif" alt="<?php echo htmlspecialchars(_AT('add_into_list')); ?>" title="<?php echo htmlspecialchars(_AT('add_into_list')); ?>" border="0" />
</a>
<?php }?>
+ <a href="<?php echo TR_BASE_HREF; ?>home/ims/ims_export.php?course_id=<?php echo $row['course_id']; ?>">
+ <img src="<?php echo TR_BASE_HREF; ?>themes/<?php echo $_SESSION['prefs']['PREF_THEME']; ?>/images/export.png" alt="<?php echo _AT('download_content_package'); ?>" title="<?php echo _AT('download_content_package'); ?>" border="0" />
+ </a>
+<?php if ($user_role['role'] == TR_USERROLE_AUTHOR) {?>
<a href="<?php echo TR_BASE_HREF; ?>home/imscc/ims_export.php?course_id=<?php echo $row['course_id']; ?>">
- <img src="<?php echo TR_BASE_HREF; ?>themes/<?php echo $_SESSION['prefs']['PREF_THEME']; ?>/images/export.png" alt="<?php echo _AT('export'); ?>" title="<?php echo _AT('export'); ?>" border="0" />
+ <img src="<?php echo TR_BASE_HREF; ?>themes/<?php echo $_SESSION['prefs']['PREF_THEME']; ?>/images/export_cc.png" alt="<?php echo _AT('download_common_cartridge'); ?>" title="<?php echo _AT('download_common_cartridge'); ?>" border="0" />
</a>
+<?php }?>
</h3>
<div><?php echo $description; ?></div>
</li>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" name="form1">\r
<fieldset class="group_form"><legend class="group_form"><?php echo _AT("language"); ?></legend>\r
\r
-<table class="data" rules="rows">\r
+<table class="data" rules="rows" id="editable_table">\r
<thead>\r
<tr>\r
<th scope="col"> </th>\r