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;
         }
     }
 }
	/*static */function getQuestionPrefixNames() {
		$question_prefix_names = array(); // prefix => name
		$questions = TestQuestions::getQuestionClasses();
		foreach ($questions as $type => $question) {
			$o = TestQuestions::getQuestion($type);
			$question_prefix_names[$o->getPrefix()] = $o->getName();
		}
		asort($question_prefix_names);
		return $question_prefix_names;
	}
Example #3
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 #6
0
{
    $value = (int) $value;
}
if ((isset($_GET['edit']) || isset($_GET['delete']) || isset($_GET['export']) || isset($_GET['preview']) || isset($_GET['add'])) && !isset($_GET['questions'])) {
    $msg->addError('NO_ITEM_SELECTED');
} else {
    if (isset($_GET['submit_create'], $_GET['question_type'])) {
        header('Location: ' . AT_BASE_HREF . 'mods/_standard/tests/create_question_' . $addslashes($_GET['question_type']) . '.php');
        exit;
    } else {
        if (isset($_GET['edit'])) {
            $id = current($_GET['questions']);
            $num_selected = count($id);
            if ($num_selected == 1) {
                $ids = explode('|', $id[0], 2);
                $o = TestQuestions::getQuestion($ids[1]);
                if ($name = $o->getPrefix()) {
                    header('Location: ' . AT_BASE_HREF . 'mods/_standard/tests/edit_question_' . $name . '.php?qid=' . intval($ids[0]));
                    exit;
                } else {
                    header('Location: ' . AT_BASE_HREF . 'mods/_standard/tests/index.php');
                    exit;
                }
            } else {
                $msg->addError('SELECT_ONE_ITEM');
            }
        } else {
            if (isset($_GET['delete'])) {
                $id = current($_GET['questions']);
                $ids = array();
                foreach ($_GET['questions'] as $category_questions) {