define('TR_INCLUDE_PATH', '../include/');
require(TR_INCLUDE_PATH.'vitals.inc.php');
require_once(TR_INCLUDE_PATH.'classes/DAO/UserCoursesDAO.class.php');
+require_once(TR_INCLUDE_PATH.'classes/DAO/CoursesDAO.class.php');
global $_current_user;
-// clean up the course level session vars
+// clean up the session vars from the previous course
unset($_SESSION['course_id']);
$userCoursesDAO = new UserCoursesDAO();
+$coursesDAO = new CoursesDAO();
+
+if (isset($_GET['catid']) && trim($_GET['catid']) <> '') $catid = intval($_GET['catid']);
if (isset($_GET['action'], $_GET['cid']) && $_SESSION['user_id'] > 0)
{
}
// retrieve data to display
-if ($_SESSION['user_id'] > 0) {
- $my_courses = $userCoursesDAO->getByUserID($_SESSION['user_id']);
+//if ($_SESSION['user_id'] > 0) {
+// $courses = $userCoursesDAO->getByUserID($_SESSION['user_id']);
+// $is_my_courses = true;
+//}
+
+if (isset($catid)) {
+ $courses = $coursesDAO->getByCategory($catid);
+ $is_for_category = true;
+} else {
+ $courses = $coursesDAO->getByMostRecent();
}
-if (is_array($my_courses))
+require(TR_INCLUDE_PATH.'header.inc.php');
+
+if (is_array($courses))
{
$curr_page_num = intval($_GET['p']);
if (!$curr_page_num) {
$curr_page_num = 1;
- }
- $savant->assign('courses', $my_courses);
+ }
+ $savant->assign('courses', $courses);
$savant->assign('curr_page_num', $curr_page_num);
- $savant->assign('title', _AT('my_courses'));
+ if ($is_for_category) {
+ $savant->assign('title', _AT('search_results'));
+ } else {
+ $savant->assign('title', _AT('most_recent_courses'));
+ }
$savant->display('home/index_course.tmpl.php');
}
{
$savant->display('home/index_search.tmpl.php');
}
+
+require(TR_INCLUDE_PATH.'footer.inc.php');
?>
\ No newline at end of file
else return false;
}
+ /**
+ * Return courses in the order of time stamp
+ * @access public
+ * @param none
+ * @return course row
+ * @author Cindy Qi Li
+ */
+ public function getByMostRecent()
+ {
+ $sql = "SELECT * FROM ".TABLE_PREFIX."courses
+ WHERE access='public'
+ ORDER BY modified_date, created_date";
+ return $this->execute($sql);
+ }
+
+ /**
+ * Return course information by given category id
+ * @access public
+ * @param category id
+ * @return course row
+ * @author Cindy Qi Li
+ */
+ public function getByCategory($categoryID)
+ {
+ $sql = "SELECT * FROM ".TABLE_PREFIX."courses
+ WHERE category_id=".$categoryID."
+ AND access='public'";
+ return $rows = $this->execute($sql);
+ }
+
/**
* Return the array of (category_id, num_of_courses)
* @access public
*/
public function getCategoriesAndNumOfCourses()
{
- $sql = 'SELECT category_id, count(*) num_of_courses FROM '.TABLE_PREFIX.'courses GROUP BY category_id';
+ $sql = "SELECT category_id, count(*) num_of_courses
+ FROM ".TABLE_PREFIX."courses
+ WHERE access = 'public'
+ GROUP BY category_id";
return $this->execute($sql);
}
if (!isset($_SESSION['user_id']) || $_SESSION['user_id'] == 0) {
$side_menu[] = TR_INCLUDE_PATH.'sidemenus/getting_start.inc.php';
- $side_menu[] = TR_INCLUDE_PATH.'sidemenus/categories.inc.php';
+ $side_menu[] = TR_INCLUDE_PATH.'sidemenus/category.inc.php';
}
-if ($_course_id > 0) {
+else if ($_course_id > 0) {
$side_menu[] = TR_INCLUDE_PATH.'sidemenus/content_nav.inc.php';
}
+else {
+ $side_menu[] = TR_INCLUDE_PATH.'sidemenus/my_courses.inc.php';
+ $side_menu[] = TR_INCLUDE_PATH.'sidemenus/category.inc.php';
+}
$savant->assign('side_menu', $side_menu);
$savant->display('include/side_menu.tmpl.php');
$courseCategoriesDAO = new CourseCategoriesDAO();
$coursesDAO = new CoursesDAO();
+$output = '';
+// get the number of courses in each category
$courses_in_category = $coursesDAO->getCategoriesAndNumOfCourses();
if (is_array($courses_in_category)) {
foreach ($courses_in_category as $row){
- $num_of_courses[$row['category_id']] = $row['num_of_courses'];
+ $course_num_summary[$row['category_id']] = $row['num_of_courses'];
}
}
+// get all categories
+$categories = $courseCategoriesDAO->getAll();
+
+if (is_array($categories)) {
+ foreach ($categories as $category) {
+ $output .= '<a href="'.TR_BASE_HREF.'home/index.php?catid='.$category['category_id'].'">';
+
+ if ($_GET['catid'] == $category['category_id']) {
+ $output .= '<span class="selected">';
+ }
+ $output .= $category['category_name'].' ';
+ if (isset($course_num_summary[$category['category_id']])) {
+ $output .= '('.$course_num_summary[$category['category_id']].')';
+ }
+ else {
+ $output .= '(0)';
+ }
+ if ($_GET['catid'] == $category['category_id']) {
+ $output .= '</span>';
+ }
+ $output .= '</a><br />';
+ }
+}
+
+// Uncategorized
+if (isset($course_num_summary[0])) {
+ $output .= '<a href="'.TR_BASE_HREF.'home/index.php?catid=0">';
+ if ($_GET['catid'] == 0) {
+ $output .= '<span class="selected-sidemenu">';
+ }
+
+ $output .= _AT('cats_uncategorized').' ('.$course_num_summary[0].')';
+ if ($_GET['catid'] == 0) {
+ $output .= '</span>';
+ }
+ $output .= '</a><br />';
+}
+
+if ($output == '') {
+ $output = _AT('none_found');
+}
$savant->assign('title', _AT('category'));
-$savant->assign('dropdown_contents', _AT('getting_start_info'));
+$savant->assign('dropdown_contents', $output);
//$savant->assign('default_status', "hide");
$savant->display('include/box.tmpl.php');
--- /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. */
+/************************************************************************/
+
+if (!defined('TR_INCLUDE_PATH')) { exit; }
+require_once(TR_INCLUDE_PATH.'vitals.inc.php');
+require_once(TR_INCLUDE_PATH.'classes/DAO/UserCoursesDAO.class.php');
+
+// can only be used by login user
+if (!isset($_SESSION['user_id']) || $_SESSION['user_id'] == 0) return;
+
+global $savant;
+
+$userCoursesDAO = new UserCoursesDAO();
+$output = '';
+
+// retrieve data to display
+if ($_SESSION['user_id'] > 0) {
+ $my_courses = $userCoursesDAO->getByUserID($_SESSION['user_id']);
+}
+
+if (!is_array($my_courses)) {
+ $num_of_courses = 0;
+ $output = _AT('none_found');
+} else {
+ $num_of_courses = count($my_courses);
+
+ $output .= '<ol style="margin-left:-3em;">'."\n";
+ foreach ($my_courses as $row) {
+ // only display the first 200 character of course description
+
+ $output .= ' <li>'."\n";
+ if ($row['role'] == TR_USERROLE_AUTHOR) {
+ $output .= ' <img src="'. TR_BASE_HREF.'themes/'. $_SESSION['prefs']['PREF_THEME'].'/images/my_own_course.gif" alt="'. _AT('my_authoring_course').'" title="'. _AT('my_authoring_course').'" />'."\n";
+ } else {
+ $output .= ' <img src="'. TR_BASE_HREF.'themes/'. $_SESSION['prefs']['PREF_THEME'].'/images/others_course.png" alt="'. _AT('others_course').'" title="'. _AT('others_course').'" />'."\n";
+ }
+ $output .= ' <a href="'. TR_BASE_HREF.'home/course/index.php?_course_id='. $row['course_id'].'">'.$row['title'].'</a>'."\n";
+ if ($row['role'] == TR_USERROLE_VIEWER) {
+ $output .= ' <a href="'. TR_BASE_HREF.'home/'. $caller_url.'action=remove&cid='. $row['course_id'].'">'."\n";
+ $output .= ' <img src="'. TR_BASE_HREF.'themes/'. $_SESSION['prefs']['PREF_THEME'].'/images/delete.gif" alt="'. htmlspecialchars(_AT('remove_from_list')).'" title="'. htmlspecialchars(_AT('remove_from_list')).'" border="0" />'."\n";
+ $output .= ' </a>'."\n";
+ }
+ if ($row['role'] == NULL && $_SESSION['user_id']>0) {
+ $output .= ' <a href="'. TR_BASE_HREF.'home/'. $caller_url.'action=add&cid='. $row['course_id'].'">'."\n";
+ $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>'."\n";
+ $output .= ' </li>'."\n";
+ } // end of foreach;
+ $output .= '</ol>'."\n";
+}
+$savant->assign('title', _AT('my_courses').' '.'('.$num_of_courses.')');
+$savant->assign('dropdown_contents', $output);
+//$savant->assign('default_status', "hide");
+
+$savant->display('include/box.tmpl.php');
+?>
\ No newline at end of file
INSERT INTO `language_text` VALUES ('en', '_msgs','TR_ERROR_NO_CONTENT_SPACE','Not enough space to import content directory. %s KB over the limit.','2010-01-27 15:48:35','error msg');
INSERT INTO `language_text` VALUES ('en', '_msgs','TR_ERROR_NO_ITEM_SELECTED','You must select an item before using a button.','2010-01-27 15:48:35','');
INSERT INTO `language_text` VALUES ('en', '_msgs','TR_ERROR_NO_PRIV','User has no privilege to do this action.','2010-02-19 14:18:02','');
+INSERT INTO `language_text` VALUES ('en', '_msgs','TR_ERROR_NO_QUESTIONS','Test has no questions.','2010-06-07 14:15:29','');
INSERT INTO `language_text` VALUES ('en', '_msgs','TR_ERROR_NO_QUESTIONS_SELECTED','You did not select any questions to add to this test.','2010-03-31 11:47:10','');
INSERT INTO `language_text` VALUES ('en', '_msgs','TR_ERROR_NO_SEARCH_TEXT','Please provide search text.','2010-01-27 15:48:35','');
INSERT INTO `language_text` VALUES ('en', '_msgs','TR_ERROR_NO_SPACE_LEFT','There is no more space in this lesson to extract this archive.','2010-04-07 15:17:28','');
INSERT INTO `language_text` VALUES ('en', '_template','max_file_size','Maximum File Size','2010-01-27 15:48:35','');
INSERT INTO `language_text` VALUES ('en', '_template','mb','<acronym title=\"Megabyte\">MB</acronym>','2010-04-05 14:22:48','');
INSERT INTO `language_text` VALUES ('en', '_template','missing_content','Missing Content','2010-05-19 14:04:47','');
+INSERT INTO `language_text` VALUES ('en', '_template','most_recent_courses','Most Recent Courses','2010-06-07 16:20:05','');
INSERT INTO `language_text` VALUES ('en', '_template','move','Move','2010-04-01 15:02:37','');
INSERT INTO `language_text` VALUES ('en', '_template','msg_terms','Message Terms','2010-01-27 15:48:35','');
INSERT INTO `language_text` VALUES ('en', '_template','must_be_author','Must be an author','2010-03-16 11:45:52','');
INSERT INTO `language_text` VALUES ('en', '_template','order','Order','2010-03-31 11:04:26','');
INSERT INTO `language_text` VALUES ('en', '_template','organization','Organization','2010-01-27 15:48:35','');
INSERT INTO `language_text` VALUES ('en', '_template','original_resource','Original resource','2010-05-21 15:57:28','');
+INSERT INTO `language_text` VALUES ('en', '_template','others_course','Others\' course','2010-06-07 16:19:47','');
INSERT INTO `language_text` VALUES ('en', '_template','outline','Outline','2003-05-20 12:26:32','');
INSERT INTO `language_text` VALUES ('en', '_template','overwrite','Overwrite','2010-01-27 15:48:35','');
INSERT INTO `language_text` VALUES ('en', '_template','packaged_in','Content Package','2010-05-20 14:44:44','');
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', '', '', now(), '');\r
-INSERT INTO `TR_language_text` VALUES ('en', '_template', '', '', now(), '');\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', '', '', now(), '');\r
INSERT INTO `TR_language_text` VALUES ('en', '_template', '', '', now(), '');\r
INSERT INTO `TR_language_text` VALUES ('en', '_template', '', '', now(), '');\r
// determine the from url is search.php or index.php
global $_base_path;
require_once(TR_INCLUDE_PATH.'classes/Utility.class.php');
+require_once(TR_INCLUDE_PATH.'classes/DAO/UserCoursesDAO.class.php');
// This template is called by home/index.php and home/search.php
// Find out the caller URL and direct the page back to the caller
}
}
-$caller_url = $caller_script. (isset($url_param) ? $url_param : '?');
+$caller_url = $caller_script. '?'.(isset($url_param) ? $url_param : '');
$url_param = substr($url_param, 0, -1);
if (isset($this->search_text)) $keywords = explode(' ', $this->search_text);
-
-require(TR_INCLUDE_PATH.'header.inc.php');
+if (isset($_SESSION['user_id'])) $userCoursesDAO = new UserCoursesDAO();
?>
<div class="input-form">
?>
<li class="course" style="font-weight:bold">
<div><?php echo _AT('results').' '.($start_num+1) .'-'.$end_num.' '._AT('of').' '.$num_results.' '. ($this->search_text<>'' ? _AT('for').' "<em>'.$this->search_text.'</em>"':'');?>
- <span style="float: right"><img src="<?php echo TR_BASE_HREF; ?>themes/<?php echo $_SESSION['prefs']['PREF_THEME']; ?>/images/my_own_course.png" alt="<?php echo _AT('my_authoring_course'); ?>" title="<?php echo _AT('my_authoring_course'); ?>" /> <?php echo _AT('authoring_img_info'); ?></span>
+ <span style="float: right"><img src="<?php echo TR_BASE_HREF; ?>themes/<?php echo $_SESSION['prefs']['PREF_THEME']; ?>/images/my_own_course.gif" alt="<?php echo _AT('my_authoring_course'); ?>" title="<?php echo _AT('my_authoring_course'); ?>" /> <?php echo _AT('authoring_img_info'); ?></span>
</div>
</li>
// only display the first 200 character of course description
$row = $this->courses[$i];
+ // find whether the current user is the author of this course
+ $user_role = $userCoursesDAO->get($_SESSION['user_id'], $row['course_id']);
+
$len_description = 330;
if (strlen($row['description']) > $len_description)
$description = Utility::highlightKeywords(substr($row['description'], 0, $len_description), $keywords).' ...';
?>
<li class="course">
<h3>
-<?php if ($row['role'] == TR_USERROLE_AUTHOR) {?>
- <img src="<?php echo TR_BASE_HREF; ?>themes/<?php echo $_SESSION['prefs']['PREF_THEME']; ?>/images/my_own_course.png" alt="<?php echo _AT('my_authoring_course'); ?>" title="<?php echo _AT('my_authoring_course'); ?>" />
-<?php }?>
+<?php if ($user_role['role'] == TR_USERROLE_AUTHOR) {?>
+ <img src="<?php echo TR_BASE_HREF; ?>themes/<?php echo $_SESSION['prefs']['PREF_THEME']; ?>/images/my_own_course.gif" alt="<?php echo _AT('my_authoring_course'); ?>" title="<?php echo _AT('my_authoring_course'); ?>" />
+<?php } else {?>
+ <img src="<?php echo TR_BASE_HREF; ?>themes/<?php echo $_SESSION['prefs']['PREF_THEME']; ?>/images/others_course.png" alt="<?php echo _AT('others_course'); ?>" title="<?php echo _AT('others_course'); ?>" />
+<?php } ?>
<a href="<?php echo TR_BASE_HREF; ?>home/course/index.php?_course_id=<?php echo $row['course_id']; ?>"><?php echo Utility::highlightKeywords($row['title'], $keywords); ?></a>
-<?php if ($row['role'] == TR_USERROLE_VIEWER) {?>
+<?php if ($user_role['role'] == TR_USERROLE_VIEWER) {?>
<a href="<?php echo TR_BASE_HREF; ?>home/<?php echo $caller_url; ?>action=remove&cid=<?php echo $row['course_id']; ?>">
<img src="<?php echo TR_BASE_HREF; ?>themes/<?php echo $_SESSION['prefs']['PREF_THEME']; ?>/images/delete.gif" alt='<?php echo htmlspecialchars(_AT('remove_from_list')); ?>' title='<?php echo htmlspecialchars(_AT('remove_from_list')); ?>' border="0" />
</a>
-<?php } if ($row['role'] == NULL && $_SESSION['user_id']>0) {?>
+<?php } if ($user_role['role'] == NULL && $_SESSION['user_id']>0) {?>
<a href="<?php echo TR_BASE_HREF; ?>home/<?php echo $caller_url; ?>action=add&cid=<?php echo $row['course_id'];?>">
<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>
} // end of else?>
</fieldset>
</div>
-
-<?php require(TR_INCLUDE_PATH.'footer.inc.php'); ?>
\ No newline at end of file
/* as published by the Free Software Foundation. */
/************************************************************************/
-global $onload;
-$onload .="document.frm_search.search_text.focus();";
-
-require(TR_INCLUDE_PATH.'header.inc.php');
-global $_current_user;
-
-if (!isset($_current_user))
-{
-?>
- <div class="input-form">
- <fieldset class="group_form"><legend class="group_form"><?php echo _AT('getting_start'); ?></legend>
- <?php echo _AT('getting_start_info');?>
- </fieldset>
- </div>
-<?php } // end of if
?>
<div class="input-form">
<fieldset class="group_form"><legend class="group_form"><?php echo _AT('search'); ?></legend>
<?php
include('create_course_tmpl.tmpl.php');
-
-require(TR_INCLUDE_PATH.'footer.inc.php');
?>
\ No newline at end of file
<meta name="keywords" content="Transformable,free, open source, accessibility checker, accessibility reviewer, accessibility evaluator, accessibility evaluation, WCAG evaluation, 508 evaluation, BITV evaluation, evaluate accessibility, test accessibility, review accessibility, ATRC, WCAG 2, STANCA, BITV, Section 508." />\r
<meta name="description" content="Transformable is a Web accessibility evalution tool designed to help Web content developers and Web application developers ensure their Web content is accessible to everyone regardless to the technology they may be using, or their abilities or disabilities." />\r
<base href="<?php echo $this->content_base_href; ?>" />\r
- <link rel="shortcut icon" href="<?php echo $this->base_path; ?>images/favicon.ico" type="image/x-icon" />\r
+ <link rel="shortcut icon" href="<?php echo $this->base_path; ?>favicon.ico" type="image/x-icon" />\r
<link rel="stylesheet" href="<?php echo $this->base_path.'themes/'.$this->theme; ?>/forms.css" type="text/css" />\r
<link rel="stylesheet" href="<?php echo $this->base_path.'themes/'.$this->theme; ?>/styles.css" type="text/css" />\r
<?php echo $this->rtl_css; ?>\r
.nowrap {
white-space: nowrap;
}
+.selected-sidemenu {
+ font-weight:bold;
+}
div#alternatives_shortcuts {
float: right;
margin: 0 2em;