Example #1
0
 function getQuestionType($question_type)
 {
     $qti_obj = TestQuestions::getQuestion($question_type);
     if ($qti_obj != null) {
         $qid = $qti_obj->importQTI($this->qti_params);
         if ($qid > 0) {
             $this->qid = $qid;
         }
     }
 }
Example #2
0
if ($_REQUEST['efs']) {
    ?>
	<input type="hidden" name="efs" value=<?php 
    echo $_REQUEST['efs'];
    ?>
 />
	<?php 
}
?>
	
	<?php 
// retrieve the answer to re-populate the form (so we can edit our answer)
$sql = "SELECT answer FROM " . TABLE_PREFIX . "tests_answers WHERE result_id={$result_id} AND question_id={$question_row['question_id']}";
$result = mysql_query($sql, $db);
$row = mysql_fetch_assoc($result);
$obj = TestQuestions::getQuestion($question_row['type']);
$obj->display($question_row, $row['answer']);
?>
	<div class="row buttons">
		 <div style="display:none"><input type="submit" value="<?php 
echo _AT('next');
?>
" name="next"/></div>
		<?php 
if ($pos > 0) {
    ?>
			<input type="submit" name="previous" value="<?php 
    echo _AT('previous');
    ?>
" />
		<?php 
		<input type="submit" name="reset_filter" value="<?php echo _AT('reset_filter'); ?>" />
		<input type="hidden" name="test_id" value="<?php echo $tid; ?>" />
	</div>
</form>
</div>

<?php
echo '<img src="images/checkmark.gif" alt="'._AT('correct_answer').'" />- '._AT('correct_answer').'<br /></p>';

$ans = array();	
while ($row = mysql_fetch_assoc($result)) {
	$ans[$row['question_id']][$row['answer']] = array('count'=>$row['count(*)'], 'score'=>$row['score']);
}

//print out rows
foreach ($questions as $q_id => $q) {
	/* for random: num_results is going to be specific to each question.
	 * This is a randomized test which means that it is possible each question has been answered a 
	 * different number of times.  Statistics are therefore based on the number of times each 
	 * question was answered, not the number of times the test has been taken.
	 */

	//catch random unanswered
	if($ans[$q_id]) {
		$obj = TestQuestions::getQuestion($q['type']);
		$obj->displayResultStatistics($q, $ans[$q_id]);
	}
}

require(AT_INCLUDE_PATH.'footer.inc.php');
?>
        echo '<tr>';
        echo '<th colspan="' . $cols . '">';
        echo '<input type="checkbox" name="cat' . $cat['category_id'] . '" id="cat' . $cat['category_id'] . '" onclick="javascript:selectCat(' . $cat['category_id'] . ', this);" /><label for="cat' . $cat['category_id'] . '">' . $cat['title'] . '</label>';
        echo '</th>';
        echo '</tr>';
        do {
            echo '<tr onmousedown="document.form[\'q' . $row['question_id'] . '\'].checked = !document.form[\'q' . $row['question_id'] . '\'].checked; togglerowhighlight(this, \'q' . $row['question_id'] . '\');" id="rq' . $row['question_id'] . '">';
            echo '<td>';
            echo '<input type="checkbox" value="' . $row['question_id'] . '|' . $row['type'] . '" name="questions[' . $cat['category_id'] . '][]" id="q' . $row['question_id'] . '" onmouseup="this.checked=!this.checked" /></td>';
            echo '<td>';
            echo '<a title="' . strip_tags($row[question]) . '">';
            echo AT_print(validate_length($row['question'], 100, VALIDATE_LENGTH_FOR_DISPLAY), 'tests_questions.question');
            echo '</a>';
            echo '</td>';
            echo '<td>';
            $o = TestQuestions::getQuestion($row['type']);
            $o->printName();
            echo '</td>';
            echo '</tr>';
        } while ($row = mysql_fetch_assoc($result));
    }
}
if (!$question_flag) {
    echo '<tr><td colspan="' . $cols . '">' . _AT('none_found') . '</td></tr>';
}
?>
</tbody>
</table>
</form>

<script language="javascript" type="text/javascript">
Example #5
0
?>
</legend>
		<form method="get" action="<?php 
echo $_SERVER['PHP_SELF'];
?>
">
			<input type="hidden" name="tid" value="<?php 
echo $tid;
?>
" />
			<label for="question"><?php 
echo _AT('create_new_question');
?>
</label><br />
			<?php 
$questions = TestQuestions::getQuestionPrefixNames();
?>
			<select name="question_type" class="dropdown" id="question" size="8">
			<?php 
foreach ($questions as $type => $name) {
    ?>
				<option value="<?php 
    echo $type;
    ?>
"><?php 
    echo $name;
    ?>
</option>
			<?php 
}
?>
 function &getQuestion($question_type)
 {
     static $objs, $question_classes;
     if (isset($objs[$question_type])) {
         return $objs[$question_type];
     }
     $question_classes = TestQuestions::getQuestionClasses();
     if (isset($question_classes[$question_type])) {
         global $savant;
         $objs[$question_type] = new $question_classes[$question_type]($savant);
     } else {
         return FALSE;
     }
     return $objs[$question_type];
 }
Example #7
0
                            $ids = array();
                            foreach ($_GET['questions'] as $category_questions) {
                                $ids = array_merge($ids, $category_questions);
                            }
                            array_walk($ids, 'intval_array');
                            if ($_GET['qti_export_version'] == '2.1') {
                                test_question_qti_export_v2p1($ids);
                            } else {
                                test_question_qti_export($ids);
                            }
                            exit;
                        }
                    }
                }
            }
        }
    }
}
require_once TR_INCLUDE_PATH . 'header.inc.php';
$savant->assign('course_id', $_course_id);
$savant->assign('tid', $tid);
$savant->assign('questions', TestQuestions::getQuestionPrefixNames());
$savant->display('tests/question_db_top.tmpl.php');
$tid = 0;
require_once TR_INCLUDE_PATH . '../tests/html/tests_questions.inc.php';
?>
<br style="clear:both;" />


<?php 
require_once TR_INCLUDE_PATH . 'footer.inc.php';