2 /************************************************************************/
\r
4 /************************************************************************/
\r
5 /* Copyright (c) 2010 */
\r
6 /* Inclusive Design Institute */
\r
8 /* This program is free software. You can redistribute it and/or */
\r
9 /* modify it under the terms of the GNU General Public License */
\r
10 /* as published by the Free Software Foundation. */
\r
11 /************************************************************************/
\r
14 * Tests Utility functions
\r
16 * @author Cindy Qi Li
\r
19 if (!defined('TR_INCLUDE_PATH')) exit;
\r
21 class TestsUtility {
\r
24 * This function prints the drop down list box for question categories
\r
27 * @author Cindy Qi Li
\r
29 public static function printQuestionCatsInDropDown($categoryID = 0) {
\r
32 require_once(TR_INCLUDE_PATH."classes/DAO/TestsQuestionsCategoriesDAO.class.php");
\r
34 echo '<option value="0"';
\r
35 if ($categoryID == 0) {
\r
36 echo ' selected="selected"';
\r
38 echo '>'._AT('cats_uncategorized').'</option>' . "\n";
\r
40 $testsQuestionsCategoriesDAO = new TestsQuestionsCategoriesDAO();
\r
41 $rows = $testsQuestionsCategoriesDAO->getByCourseID($_course_id);
\r
43 if (is_array($rows)) {
\r
44 foreach ($rows as $row) {
\r
45 echo '<option value="'.$row['category_id'].'"';
\r
46 if ($row['category_id'] == $categoryID) {
\r
47 echo ' selected="selected"';
\r
49 echo '>'.$row['title'].'</option>'."\n";
\r
55 * This function prints the link to open up the visual editor popup page
\r
57 * @param area: One of the values: question
\r
58 * @author Cindy Qi Li
\r
60 public static function printVisualEditorLink ($area) {
\r
63 <script type="text/javascript" language="javascript">
\r
64 document.writeln('<a href="#" onclick="javascript:window.open(\'<?php echo TR_BASE_HREF; ?>tests/form_editor.php?area=<?php echo $area; ?>&_course_id=<?php echo $_course_id; ?>\',\'formEditorWin\',\'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,copyhistory=0,width=640,height=480\'); return false;" style="cursor: pointer; text-decoration: none" ><?php echo _AT('use_visual_editor'); ?></a>');
\r