bug fixes and re-do the index page
authorCindy Li <cli@ocad.ca>
Tue, 8 Jun 2010 20:23:41 +0000 (20:23 -0000)
committerCindy Li <cli@ocad.ca>
Tue, 8 Jun 2010 20:23:41 +0000 (20:23 -0000)
18 files changed:
docs/home/classes/ContentManager.class.php
docs/home/editor/edit_content.php
docs/home/editor/editor_tab_functions.inc.php
docs/home/editor/editor_tabs/properties.inc.php
docs/home/editor/editor_tabs/tests.inc.php [new file with mode: 0644]
docs/home/index.php
docs/home/search.php
docs/include/classes/DAO/CoursesDAO.class.php
docs/include/side_menu.inc.php
docs/include/sidemenus/category.inc.php
docs/include/sidemenus/my_courses.inc.php
docs/install/db/language_text.sql
docs/install/db/language_text_temp.sql
docs/search.php
docs/themes/default/home/course/content.tmpl.php
docs/themes/default/home/index_course.tmpl.php
docs/themes/default/include/header.tmpl.php
docs/themes/default/styles.css

index bb19e94..be0fea8 100644 (file)
@@ -443,7 +443,11 @@ class ContentManager
         * @author      Harris
         */
        function & getContentTestsAssoc($content_id){
-               $sql    = "SELECT ct.test_id, t.title FROM (SELECT * FROM ".TABLE_PREFIX."content_tests_assoc WHERE content_id=$content_id) AS ct LEFT JOIN ".TABLE_PREFIX."tests t ON ct.test_id=t.test_id";
+               $sql    = "SELECT ct.test_id, t.title 
+                            FROM (SELECT * FROM ".TABLE_PREFIX."content_tests_assoc 
+                                   WHERE content_id=$content_id) AS ct 
+                            LEFT JOIN ".TABLE_PREFIX."tests t ON ct.test_id=t.test_id
+                           ORDER BY t.title";
                return $this->dao->execute($sql);
        }
 
@@ -875,7 +879,7 @@ initContentMenu();
                                        //if this is a test link.
                                        if (isset($content['test_id'])){
                                                $title_n_alt =  $content['title'];
-                                               $in_link = 'tools/test_intro.php?tid='.$content['test_id'];
+                                               $in_link = $_base_path.'tests/preview.php?tid='.$content['test_id'].'&_cid='.$parent_id;
                                                $img_link = ' <img src="'.$_base_path.'images/check.gif" title="'.$title_n_alt.'" alt="'.$title_n_alt.'" />';
                                        } else {
                                                $in_link = $_base_path.'home/course/content.php?_cid='.$content['content_id'];
index a72835a..c0f2282 100644 (file)
@@ -137,7 +137,7 @@ if ($cid) {
        }
 }
 
-if (($current_tab == 0) || ($_current_tab == 2)) {
+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) {
@@ -348,15 +348,16 @@ $pid = intval($_REQUEST['pid']);
        }
        
        //tests
-       if ($current_tab != 1){
+       if ($current_tab != 3){
                // set content associated tests
-               if (is_array($_POST['tid'])) {
-                       foreach ($_POST['tid'] as $i=>$tid){
-                               echo '<input type="hidden" name="tid['.$i.']" value="'.$tid.'" />';
+               if (isset($_POST['visited_tests'])) {
+                       echo '<input type="hidden" name="visited_tests" value="1" />'."\n";
+                       if (is_array($_POST['tid'])) {
+                               foreach ($_POST['tid'] as $i=>$tid){
+                                       echo '<input type="hidden" name="tid['.$i.']" value="'.$tid.'" />';
+                               }
                        }
-               }
-               else
-               {
+               } else {
                        $i = 0;
                        if (is_array($content_tests)) {
                                foreach ($content_tests as $content_test_row) {
@@ -382,7 +383,7 @@ $pid = intval($_REQUEST['pid']);
 //             }
        } 
        
-       if (!isset($_POST['allow_test_export']) && $current_tab != 1) {
+       if (!isset($_POST['allow_test_export']) && $current_tab != 3) {
                //export flag handling.
 //             $sql = "SELECT `allow_test_export` FROM ".TABLE_PREFIX."content WHERE content_id=$_REQUEST[cid]";
 //             $result2 = mysql_query($sql, $db);
index 4fe111e..b42b17e 100644 (file)
@@ -31,6 +31,7 @@ function get_tabs() {
        $tabs[0] = array('content',                     'edit.inc.php',          'n');
        $tabs[1] = array('properties',                  'properties.inc.php',    'p');
        $tabs[2] = array('alternative_content', 'alternatives.inc.php',  'l');  
+       $tabs[3] = array('tests',               'tests.inc.php',         't');  
        
        return $tabs;
 }
@@ -439,7 +440,7 @@ function check_for_changes($row, $row_alternatives) {
        {
                foreach ($_POST as $alt_id => $alt_value) {
                        if (substr($alt_id, 0 ,4) == 'alt_' && $alt_value != $row_alternatives[$alt_id]){
-                               $changes[5] = true;
+                               $changes[2] = true;
                                break;
                        }
                }
@@ -447,10 +448,26 @@ function check_for_changes($row, $row_alternatives) {
        
        /* test & survey */     
        if ($row && isset($_POST['test_message']) && $_POST['test_message'] != $row['test_message']){
-               $changes[6] = true;
+               $changes[3] = true;
        }
        if ($row && isset($_POST['allow_test_export']) && $_POST['allow_test_export'] != $row['allow_test_export']){
-               $changes[6] = true;
+               $changes[3] = true;
+       }
+       
+       $content_tests = $contentManager->getContentTestsAssoc($cid);
+       
+       if (isset($_POST['visited_tests'])) {
+               if (!is_array($content_tests) && is_array($_POST['tid'])) {
+                       $changes[3] = true;
+               }
+               if (is_array($content_tests)) {
+                       for ($i = 0; $i < count($content_tests); $i++) {
+                               if ($content_tests[$i]['test_id'] <> $_POST['tid'][$i]) {
+                                       $changes[3] = true;
+                                       break;
+                               }
+                       }
+               }
        }
 
        return $changes;
index 44a6516..6dfa60b 100644 (file)
@@ -18,119 +18,8 @@ include_once(TR_INCLUDE_PATH.'classes/DAO/TestsDAO.class.php');
 /* Get the list of associated tests with this content on page load */
 $cid = $_REQUEST['cid'] = $_content_id;        //uses request 'cause after 'saved', the cid will become $_GET.
 
-$contentTestsAssocDAO = new ContentTestsAssocDAO();
-$testsDAO = new TestsDAO();
-
-$test_rows = $contentTestsAssocDAO->getByContent($cid);
-//$sql = 'SELECT * FROM '.TABLE_PREFIX."content_tests_assoc WHERE content_id=$_REQUEST[cid]";
-//$result = mysql_query($sql, $db);
-if (is_array($test_rows)) {
-       foreach ($test_rows as $row) {
-               $_POST['tid'][] = $row['test_id'];
-       }
-}
-$num_tests = 0;
-$all_tests = $testsDAO->getByCourseID($_course_id);
-/* get a list of all the tests we have, and links to create, edit, delete, preview */
-//$sql = "SELECT *, UNIX_TIMESTAMP(start_date) AS us, UNIX_TIMESTAMP(end_date) AS ue 
-//             FROM ".TABLE_PREFIX."tests 
-//            WHERE course_id=$_SESSION[course_id] 
-//            ORDER BY start_date DESC";
-//$result      = mysql_query($sql, $db);
-if (is_array($all_tests)) $num_tests = count($all_tests);
-
-//If there are no tests, don't display anything except a message
-if ($num_tests == 0){
-       $msg->addInfo('NO_TESTS');
-//     $msg->printInfos();
-//     return;
-}
-else {
-       $i = 0;
-       foreach ($all_tests as $row) {
-               $results[$i]['test_id'] = $row['test_id'];
-               $results[$i]['title'] = $row['title'];
-                       
-               $i++;
-       }
-}
 ?>
 <div class="row">
        <span style="font-weight:bold"><label for="keys"><?php echo _AT('keywords'); ?></label></span><br />
        <textarea name="keywords" class="formfield" cols="73" rows="2" id="keys"><?php echo ContentManager::cleanOutput($_POST['keywords']); ?></textarea>
 </div>
-
-<div class="row">
-       <span style="font-weight:bold"><?php echo _AT('about_content_tests'); ?></span>
-</div>
-
-<div class="row">
-       <?php
-       //Need radio button 'cause one checkbox makes the states indeterministic
-       //@harris
-       $test_export_y_checked = '';
-       $test_export_n_checked = '';
-       if ($_POST['allow_test_export'] == 1){
-               $test_export_y_checked = ' checked="checked"';
-       } else {
-               $test_export_n_checked = ' checked="checked"';
-       }
-       
-       echo _AT('allow_test_export');
-?>
-
-       <input type="radio" name="allow_test_export" id="allow_test_export" value="1" <?php echo $test_export_y_checked; ?>/>
-       <label for="allow_test_export"><?php echo _AT('yes'); ?></label>
-       <input type="radio" name="allow_test_export" id="disallow_test_export" value="0" <?php echo $test_export_n_checked; ?>/>
-       <label for="disallow_test_export"><?php echo _AT('no'); ?></label>
-</div>
-
-
-<div class="row">
-       <p><?php echo _AT('custom_test_message'); ?></p>
-       <textarea name="test_message"><?php echo $_POST['test_message']; ?></textarea>
-</div>
-
-<?php 
-print_test_table($results, $_POST['tid']);
-
-function print_test_table($results, $post_tids, $id_prefix='') {?>
-       <div>
-       <table class="data" summary="" style="width: 90%" rules="cols">
-       <thead>
-       <tr>
-               <th scope="col">&nbsp;</th>
-               <th scope="col"><?php echo _AT('title');          ?></th>
-       </tr>
-       </thead>
-       <tbody>
-       <?php foreach ($results as $row) { ?>
-       <?php
-               $checkMe = '';
-               if (is_array($post_tids) && in_array($row['test_id'], $post_tids)){
-                       $checkMe = ' checked="checked"';
-               } 
-       ?>
-       <tr onmousedown="toggleTestSelect('<?php echo $id_prefix; ?>r_<?php echo $row['test_id']; ?>');rowselect(this);" id="<?php echo $id_prefix; ?>r_<?php echo $row['test_id']; ?>">
-               <td><input type="checkbox" name="<?php echo $id_prefix; ?>tid[]" value="<?php echo $row['test_id']; ?>" id="<?php echo $id_prefix; ?>t<?php echo $row['test_id']; ?>" <?php echo $checkMe; ?> onmouseup="this.checked=!this.checked" /></td>
-               <td><?php echo $row['title']; ?></td>
-       </tr>
-       <?php } ?>
-       </tbody>
-       </table>
-       </div>
-       <br />
-<?php }?>
-
-<script language="javascript" type="text/javascript">
-       function toggleTestSelect(r_id){
-               var row = document.getElementById(r_id);
-               var checkBox = row.cells[0].firstChild;
-
-               if (checkBox.checked == true){
-                       checkBox.checked = false;
-               } else {
-                       checkBox.checked = true;
-               }
-       }
-</script>
diff --git a/docs/home/editor/editor_tabs/tests.inc.php b/docs/home/editor/editor_tabs/tests.inc.php
new file mode 100644 (file)
index 0000000..c0f99ef
--- /dev/null
@@ -0,0 +1,123 @@
+<?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; }
+global $_course_id, $_content_id;
+
+include_once(TR_INCLUDE_PATH.'classes/DAO/ContentTestsAssocDAO.class.php');
+include_once(TR_INCLUDE_PATH.'classes/DAO/TestsDAO.class.php');
+/* Get the list of associated tests with this content on page load */
+$cid = $_REQUEST['cid'] = $_content_id;        //uses request 'cause after 'saved', the cid will become $_GET.
+
+$testsDAO = new TestsDAO();
+
+$num_tests = 0;
+$all_tests = $testsDAO->getByCourseID($_course_id);
+/* get a list of all the tests we have, and links to create, edit, delete, preview */
+//$sql = "SELECT *, UNIX_TIMESTAMP(start_date) AS us, UNIX_TIMESTAMP(end_date) AS ue 
+//             FROM ".TABLE_PREFIX."tests 
+//            WHERE course_id=$_SESSION[course_id] 
+//            ORDER BY start_date DESC";
+//$result      = mysql_query($sql, $db);
+if (is_array($all_tests)) $num_tests = count($all_tests);
+
+//If there are no tests, don't display anything except a message
+if ($num_tests == 0){
+       $msg->addInfo('NO_TESTS');
+//     $msg->printInfos();
+//     return;
+}
+else {
+       $i = 0;
+       foreach ($all_tests as $row) {
+               $results[$i]['test_id'] = $row['test_id'];
+               $results[$i]['title'] = $row['title'];
+                       
+               $i++;
+       }
+}
+?>
+<div class="row">
+       <span style="font-weight:bold"><?php echo _AT('about_content_tests'); ?></span>
+</div>
+
+<div class="row">
+       <?php
+       //Need radio button 'cause one checkbox makes the states indeterministic
+       //@harris
+       $test_export_y_checked = '';
+       $test_export_n_checked = '';
+       if ($_POST['allow_test_export'] == 1){
+               $test_export_y_checked = ' checked="checked"';
+       } else {
+               $test_export_n_checked = ' checked="checked"';
+       }
+       
+       echo _AT('allow_test_export');
+?>
+
+       <input type="radio" name="allow_test_export" id="allow_test_export" value="1" <?php echo $test_export_y_checked; ?>/>
+       <label for="allow_test_export"><?php echo _AT('yes'); ?></label>
+       <input type="radio" name="allow_test_export" id="disallow_test_export" value="0" <?php echo $test_export_n_checked; ?>/>
+       <label for="disallow_test_export"><?php echo _AT('no'); ?></label>
+</div>
+
+
+<div class="row">
+       <p><?php echo _AT('custom_test_message'); ?></p>
+       <textarea name="test_message"><?php echo $_POST['test_message']; ?></textarea>
+</div>
+
+<?php 
+print_test_table($results, $_POST['tid']);
+
+function print_test_table($results, $post_tids, $id_prefix='') {?>
+       <div>
+       <input type="hidden" name="visited_tests" value="1" />
+       <table class="data" summary="" style="width: 90%" rules="cols">
+       <thead>
+       <tr>
+               <th scope="col">&nbsp;</th>
+               <th scope="col"><?php echo _AT('title');          ?></th>
+       </tr>
+       </thead>
+       <tbody>
+       <?php foreach ($results as $row) { ?>
+       <?php
+               $checkMe = '';
+               if (is_array($post_tids) && in_array($row['test_id'], $post_tids)){
+                       $checkMe = ' checked="checked"';
+               } 
+       ?>
+       <tr onmousedown="toggleTestSelect('<?php echo $id_prefix; ?>r_<?php echo $row['test_id']; ?>');rowselect(this);" id="<?php echo $id_prefix; ?>r_<?php echo $row['test_id']; ?>">
+               <td><input type="checkbox" name="<?php echo $id_prefix; ?>tid[]" value="<?php echo $row['test_id']; ?>" id="<?php echo $id_prefix; ?>t<?php echo $row['test_id']; ?>" <?php echo $checkMe; ?> onmouseup="this.checked=!this.checked" /></td>
+               <td><?php echo $row['title']; ?></td>
+       </tr>
+       <?php } ?>
+       </tbody>
+       </table>
+       </div>
+       <br />
+<?php }?>
+
+<script language="javascript" type="text/javascript">
+       function toggleTestSelect(r_id){
+               var row = document.getElementById(r_id);
+               var checkBox = row.cells[0].firstChild;
+
+               if (checkBox.checked == true){
+                       checkBox.checked = false;
+               } else {
+                       checkBox.checked = true;
+               }
+       }
+</script>
index 0b56299..6d1f954 100644 (file)
@@ -14,6 +14,7 @@ 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');
+require_once(TR_INCLUDE_PATH.'classes/DAO/CourseCategoriesDAO.class.php');
 
 global $_current_user;
 
@@ -22,6 +23,7 @@ unset($_SESSION['course_id']);
 
 $userCoursesDAO = new UserCoursesDAO();
 $coursesDAO = new CoursesDAO();
+$courseCategoriesDAO = new CourseCategoriesDAO();
 
 if (isset($_GET['catid']) && trim($_GET['catid']) <> '') $catid = intval($_GET['catid']);
 
@@ -48,13 +50,14 @@ if (isset($catid)) {
 
 require(TR_INCLUDE_PATH.'header.inc.php'); 
 
-if (is_array($courses))
-{
+//if (is_array($courses))
+//{
        $curr_page_num = intval($_GET['p']);
        if (!$curr_page_num) {
                $curr_page_num = 1;
        }
        $savant->assign('courses', $courses);
+       $savant->assign('categories', $courseCategoriesDAO->getAll());
        $savant->assign('curr_page_num', $curr_page_num);
        if ($is_for_category) {
                $savant->assign('title', _AT('search_results'));
@@ -63,11 +66,11 @@ if (is_array($courses))
        }
        
        $savant->display('home/index_course.tmpl.php');
-}
-else
-{
-       $savant->display('home/index_search.tmpl.php');
-}
+//}
+//else
+//{
+//     $savant->display('home/index_search.tmpl.php');
+//}
 
 require(TR_INCLUDE_PATH.'footer.inc.php'); 
 ?>
\ No newline at end of file
index 66dfa25..0c2accf 100644 (file)
@@ -14,23 +14,25 @@ define('TR_INCLUDE_PATH', '../include/');
 require(TR_INCLUDE_PATH.'vitals.inc.php');
 require_once(TR_INCLUDE_PATH.'classes/DAO/CoursesDAO.class.php');
 require_once(TR_INCLUDE_PATH.'classes/DAO/UserCoursesDAO.class.php');
+require_once(TR_INCLUDE_PATH.'classes/DAO/CourseCategoriesDAO.class.php');
 
 global $_current_user;
 
-if (trim($_GET['search_text'] == ''))
-{
-       global $msg;
-       $msg->addError('NO_SEARCH_TEXT');
-       
-       header('Location: index.php?id='.$ids);
-}
+//if (trim($_GET['search_text'] == ''))
+//{
+//     global $msg;
+//     $msg->addError('NO_SEARCH_TEXT');
+//     
+//     header('Location: index.php?id='.$ids);
+//}
 
 $coursesDAO = new CoursesDAO();
 $userCoursesDAO = new UserCoursesDAO();
+$courseCategoriesDAO = new CourseCategoriesDAO();
 
-$my_courses = array();
+//$my_courses = array();
 $search_text = trim($_GET['search_text']);
-$results = $coursesDAO->getSearchResult($search_text);
+$courses = $coursesDAO->getSearchResult($search_text, $_GET['catid']);
 
 // handle submits
 if (isset($_GET['action'], $_GET['cid']) && $_SESSION['user_id'] > 0)
@@ -43,39 +45,41 @@ if (isset($_GET['action'], $_GET['cid']) && $_SESSION['user_id'] > 0)
 
 // -- display results
 // no results found
-if (!is_array($results))
-{
-       $savant->assign('title', _AT("results"));
-       $savant->assign('search_text', $search_text);
-       $savant->assign('courses', '');
-       $savant->display('home/index_course.tmpl.php');
-       exit;
-}
+//if (!is_array($results))
+//{
+//     $savant->assign('title', _AT("search_results"));
+//     $savant->assign('search_text', $search_text);
+//     $savant->assign('courses', '');
+//     $savant->display('home/index_course.tmpl.php');
+//     exit;
+//}
 
 // retrieve data to display
-if ($_SESSION['user_id'] > 0) {
-       // get login user's authoring courses
-       $my_courses = $userCoursesDAO->getByUserID($_SESSION['user_id']);
+//if ($_SESSION['user_id'] > 0) {
+//     // get login user's authoring courses
+//     $my_courses = $userCoursesDAO->getByUserID($_SESSION['user_id']);
+//     
+//     if (is_array($my_courses))
+//     {
+//             foreach ($my_courses as $course)
+//                     $my_courses[$course['course_id']] = $course['role'];
+//     }
+//}    
        
-       if (is_array($my_courses))
-       {
-               foreach ($my_courses as $course)
-                       $my_courses[$course['course_id']] = $course['role'];
-       }
-}      
-       
-foreach ($results as $result)
-{
-       if (isset($my_courses[$result['course_id']]))
-               $result['role'] = $my_courses[$result['course_id']];
-       else
-               $result['role'] = NULL;
-       
-       $courses[] = $result;
-}
+//foreach ($results as $result)
+//{
+//     if (isset($my_courses[$result['course_id']]))
+//             $result['role'] = $my_courses[$result['course_id']];
+//     else
+//             $result['role'] = NULL;
+//     
+//     $courses[] = $result;
+//}
+
+//if (is_array($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;
@@ -84,9 +88,12 @@ if (is_array($courses))
        $savant->assign('title', _AT("results"));
        $savant->assign('courses', $courses);
        $savant->assign('curr_page_num', $curr_page_num);
+       $savant->assign('categories', $courseCategoriesDAO->getAll());
        $savant->assign('search_text', $search_text);
        
        $savant->display('home/index_course.tmpl.php');
-}
+require(TR_INCLUDE_PATH.'footer.inc.php'); 
+
+//}
 
 ?>
\ No newline at end of file
index 69ab24d..f5d780e 100644 (file)
@@ -234,7 +234,8 @@ class CoursesDAO extends DAO {
        {
                $sql = "SELECT * FROM ".TABLE_PREFIX."courses 
                         WHERE category_id=".$categoryID."
-                          AND access='public'";
+                          AND access='public'
+                        ORDER BY title";
                return $rows = $this->execute($sql);
        }
 
@@ -260,12 +261,13 @@ class CoursesDAO extends DAO {
         * @param   keywords: for keywords to include, use '+' in front.
         *                    for keywords to exclude, use '-' in front.
         *                    for example '+a -b' means find all courses with keyword 'a', without 'b'
+        *          catid: category id
         *          start: start receiving from this record number, 0 if not specified
         *          maxResults: Number of results desired. If 0, returns all
         * @return  course row if successful, otherwise, return false
         * @author  Cindy Qi Li
         */
-       public function getSearchResult($keywords, $start=0, $maxResults=0)
+       public function getSearchResult($keywords, $catid='', $start=0, $maxResults=0)
        {
                require_once(TR_INCLUDE_PATH.'classes/Utility.class.php');
                // full-text search
@@ -282,24 +284,28 @@ class CoursesDAO extends DAO {
         
                // if the keywords is not given, return false
                $keywords = trim($keywords);
-               if ($keywords == '') return false;
+//             if ($keywords == '') return false;
                
                $all_keywords = Utility::removeEmptyItemsFromArray(explode(' ', $keywords));
                
-               if (!is_array($all_keywords) || count($all_keywords) == 0) return false;
+//             if (!is_array($all_keywords) || count($all_keywords) == 0) return false;
                
                list($sql_where, $sql_order) = $this->getSearchSqlParams($all_keywords);
                
+               if ($sql_where <> '') $sql_where = ' AND '. $sql_where;
+               if (trim($catid) <> '') $sql_where .= ' AND category_id='.intval($catid);
+               
                // sql search
                $sql = "SELECT DISTINCT cs.course_id, cs.title, cs.description, cs.created_date
                          FROM ".TABLE_PREFIX."courses cs, ".TABLE_PREFIX."content ct, ".TABLE_PREFIX."users u
                         WHERE cs.access='public'
                           AND cs.course_id = ct.course_id
-                          AND cs.user_id = u.user_id
-                          AND ".$sql_where."
-                        ORDER BY ".$sql_order." DESC ";
+                          AND cs.user_id = u.user_id";
+               if ($sql_where <> '') $sql .= $sql_where;
+               if ($sql_order <> '') $sql .= " ORDER BY ".$sql_order." DESC ";
                
                if ($maxResults > 0) $sql .= " LIMIT ".$start.", ".$maxResults;
+
                return $this->execute($sql);
        }
 
index 0e750ca..7f40dc8 100644 (file)
 if (!defined('TR_INCLUDE_PATH')) { exit; }
 require_once(TR_INCLUDE_PATH.'vitals.inc.php');
 
-global $savant, $_course_id;
+global $savant, $_course_id, $_content_id;
 
+if ($_course_id > 0) {
+       $side_menu[] = TR_INCLUDE_PATH.'sidemenus/content_nav.inc.php';
+}
 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/category.inc.php';
-}
-else if ($_course_id > 0) {
-       $side_menu[] = TR_INCLUDE_PATH.'sidemenus/content_nav.inc.php';
-}
-else {
+} else {
        $side_menu[] = TR_INCLUDE_PATH.'sidemenus/my_courses.inc.php';
        $side_menu[] = TR_INCLUDE_PATH.'sidemenus/category.inc.php';
 }
index 81e211b..f14e8cb 100644 (file)
@@ -37,8 +37,8 @@ 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">';
+               if ($_GET['catid'] <> '' && $_GET['catid'] == $category['category_id']) {
+                       $output .= '<span class="selected-sidemenu">';
                }
                $output .= $category['category_name'].'&nbsp;';
                if (isset($course_num_summary[$category['category_id']])) {
@@ -47,7 +47,7 @@ if (is_array($categories)) {
                else {
                        $output .= '(0)';
                }
-               if ($_GET['catid'] == $category['category_id']) {
+               if ($_GET['catid'] <> '' && $_GET['catid'] == $category['category_id']) {
                        $output .= '</span>';
                }
                $output .= '</a><br />';
@@ -57,12 +57,13 @@ if (is_array($categories)) {
 // Uncategorized
 if (isset($course_num_summary[0])) {
        $output .= '<a href="'.TR_BASE_HREF.'home/index.php?catid=0">';
-       if ($_GET['catid'] == 0) {
+       
+       if ($_GET['catid'] <> '' && $_GET['catid'] == 0) {
                $output .= '<span class="selected-sidemenu">';
        }
                
        $output .= _AT('cats_uncategorized').'&nbsp;('.$course_num_summary[0].')';
-       if ($_GET['catid'] == 0) {
+       if ($_GET['catid'] <> '' && $_GET['catid'] == 0) {
                $output .= '</span>';
        }
        $output .= '</a><br />';
index 89c513e..939b1cf 100644 (file)
@@ -33,7 +33,7 @@ if (!is_array($my_courses)) {
 } else {
        $num_of_courses = count($my_courses);
 
-    $output .= '<ol style="margin-left:-3em;">'."\n";
+    $output .= '<ol class="remove-margin-left">'."\n";
        foreach ($my_courses as $row) {
                // only display the first 200 character of course description
 
index 238897a..087d26c 100644 (file)
@@ -575,7 +575,7 @@ INSERT INTO `language_text` VALUES ('en', '_template','or','Or','2010-01-27 15:4
 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','others_course','Others\' Lesson','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','');
index 04719cb..4ad452f 100644 (file)
@@ -461,7 +461,7 @@ INSERT INTO `TR_language_text` VALUES ('en', '_template', 'upload_content_packag
 \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', 'all_categories', 'All Categories', 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
index 2fccfa7..8029e98 100644 (file)
@@ -63,7 +63,7 @@ if (is_array($errors))
 }\r
 \r
 $coursesDAO = new CoursesDAO();\r
-$results = $coursesDAO->getSearchResult($keywords, $start, $maxResults);\r
+$results = $coursesDAO->getSearchResult($keywords, '', $start, $maxResults);\r
 \r
 // get total number of search results regardless of $maxResults\r
 $all_results = $coursesDAO->getSearchResult($keywords);\r
index da3d352..0a7db79 100644 (file)
@@ -79,7 +79,7 @@ if ($_SESSION["prefs"]["PREF_SHOW_CONTENTS"] && $this->content_table <> "")
                <?php \r
                        foreach ($this->test_ids as $id => $test_obj){\r
 //                             echo '<li><a href="'.url_rewrite('tools/test_intro.php?tid='.$test_obj['test_id'], AT_PRETTY_URL_IS_HEADER).'">'.\r
-                               echo '<li><a href="tools/test_intro.php?tid='.$test_obj['test_id'].'">'.\r
+                               echo '<li><a href="'.TR_BASE_HREF.'tests/preview.php?tid='.$test_obj['test_id'].'&_cid='.$this->cid.'">'.\r
                                AT_print($test_obj['title'], 'tests.title').'</a><br /></li>';\r
                        }\r
                ?>\r
index d426d7d..a9cb54f 100644 (file)
@@ -21,27 +21,6 @@ require_once(TR_INCLUDE_PATH.'classes/DAO/UserCoursesDAO.class.php');
 $caller_url_parts = explode('/', $_SERVER['PHP_SELF']); 
 $caller_script = $caller_url_parts[count($caller_url_parts)-1];
 
-// construct the caller query string
-//if (count($_GET) > 0)
-//{
-////   $url_param = '?';
-//     $counter = 0;
-//     foreach ($_GET as $param => $value)
-//     {
-//             $counter++;
-//             if ($param == 'action' || $param == 'cid') 
-//             {
-//                     $counter--;
-//                     continue;
-//             }
-//             else if ($counter > 1)
-//             {
-//                     $url_param .= '&';
-//             }
-//             $url_param .= $param.'='.urlencode($value);
-//     }
-//}
-
 if (count($_GET) > 0)
 {
        foreach ($_GET as $param => $value)
@@ -57,15 +36,34 @@ $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);
-if (isset($_SESSION['user_id'])) $userCoursesDAO = new UserCoursesDAO();
 ?>
+<div class="input-form">
+<fieldset class="group_form"><legend class="group_form"><?php echo _AT('search'); ?></legend>
+       <form target="_top" action="<?php echo TR_BASE_HREF; ?>home/search.php" method="get" name="frm_search">
+       <input type="text" name="search_text" id="search_text" value="<?php if (isset($_REQUEST['search_text'])) echo $_REQUEST['search_text']; ?>" size="50"   />
+<?php if (is_array($this->categories)) { // print category dropdown list box?>
+    <select name="catid">
+      <option value="" <?php if (!isset($_GET['catid']) || $_GET['catid'] == '') echo 'selected'; ?>><?php echo _AT('all_categories'); ?></option>
+      <option value="">---------------------------------</option>
+<?php foreach ($this->categories as $category) {?>
+      <option value="<?php echo $category['category_id']; ?>" <?php if ($_GET['catid'] == $category['category_id']) echo 'selected'; ?>><?php echo $category['category_name']; ?></option>
+<?php }?>
+      <option value="0" <?php if ($_GET['catid'] == 0 && $_GET['catid'] <> '') echo 'selected'; ?>><?php echo _AT('cats_uncategorized'); ?></option>
+    </select>
+<?php }?>
+       <input type="submit" name="search" size="100" value="<?php echo _AT("search"); ?>" />
+       </form>
+</fieldset>
+</div>
 
 <div class="input-form">
 <fieldset class="group_form"><legend class="group_form"><?php echo $this->title; ?></legend>
 <?php if (is_array($this->courses)) { ?>
   <div class="results">
-    <ol>
+    <ol class="remove-margin-left">
 <?php 
+       if (isset($_SESSION['user_id'])) $userCoursesDAO = new UserCoursesDAO();
+       
        $num_results = count($this->courses);
        
        // if the requested page number exceeds the max number of pages, set the current page to the last page
@@ -124,7 +122,8 @@ if (isset($_SESSION['user_id'])) $userCoursesDAO = new UserCoursesDAO();
   </div>
 <?php } // end of if
 else {
-       echo _AT("no_results_for_keywords", $this->search_text);
+//     echo _AT("no_results_for_keywords", $this->search_text);
+       echo _AT("none_found");
 } // end of else?>
 </fieldset>
 </div>
index 3f98f7a..cd701aa 100644 (file)
@@ -327,7 +327,7 @@ foreach ($this->top_level_pages as $page) {
     <div id="sub-navigation">
          <?php if (isset($this->back_to_page)): ?>
            <div id="subnavbacktopage">   
-             <a href="<?php echo $this->back_to_page['url']; ?>" id="back-to"><?php echo '<img src="'.$_base_href.'images/arrowicon.gif"  alt="'._AT('back_to').':'.$this->back_to_page['title'].'" title="'._AT('back_to').':'.$this->back_to_page['title'].'" style="vertical-align:center;">'?></a> 
+             <a href="<?php echo $this->back_to_page['url']; ?>" id="back-to"><?php echo '<img src="'.TR_BASE_HREF.'images/arrowicon.gif"  alt="'._AT('back_to').':'.$this->back_to_page['title'].'" title="'._AT('back_to').':'.$this->back_to_page['title'].'" style="vertical-align:center;">'?></a> 
            </div>
          <?php endif; ?>
        <ul id="subnavlist">
index dba67b3..1e27a6a 100644 (file)
@@ -963,15 +963,16 @@ ul.topnavlist li a.selected {
     color: #555;
     font-weight: normal;
 }
-
+ol.remove-margin-left {
+  margin-left:-3em;
+}
 /*  form fields grouping for WCAG 2.0 conformance*/
 fieldset.group_form{
   margin:.5em;
   border:thin #cccccc solid;
-  min-height: 100px;
-border-radius:.5em .5em .5em .5em;
--moz-border-radius:.5em .5em .5em .5em;
-
+  min-height: 40px;
+  border-radius:.5em .5em .5em .5em;
+  -moz-border-radius:.5em .5em .5em .5em;
 }
 
 legend.group_form{