ATutor

Learning Management Tools







Pages:1 2 3 4 5 6 7 8 9 10 11 12 13 14 15


Tests and Surveys question


  • 2008-12-26 13:22:06

    Tests and Surveys question

    Hello. I have Atutor 1.6.2 installed and I have a question about "Tests and Surveys"

    I did a mock quiz and on the "View Results" page, if I got one wrong, it displayed the red "x" for wrong answer next to the correct answer. So, I had a red "x" next to my incorrect answer as well as a red "x" next to the correct answer.

    Shouldn't there be a green checkmark next to the correct answer instead of the red "x"? Can I adjust this somehow?

    Thanks.

  • 2008-12-27 11:05:02

    Re:

    It should be. If not, it is likely to be a bug.

    Can you tell me which question type this is?

  • 2008-12-27 12:01:05

    Re:

    It was a multiple choice question.

    Thanks.

  • 2009-01-02 12:31:24

    Re:

    A red X for incorrectly not selecting the correct answer, and a red X for incorrectly selecting the wrong answer.

  • 2009-01-02 12:50:07

    Re:

    OK. I get that.

    Is there a way to make it so the green check mark is displayed next to the correct answer?

    Thanks.

  • 2009-01-02 15:18:47

    Re:

    There isn't a setting, if that's what you mean. You could change the code yourself, to replace the X with a check.

    You'll probably want to create a patch if you want to keep the change for future upgrades. See the handbook for details about patches.

  • 2009-01-02 19:29:42

    Re:

    Greg,

    I found the file where the commands are given to display the checkmark or red "x": Atutor/tools/view_results.php

    Specifically at this spot in the file...

    $mark_right = ' <img src="'.$_base_path.'images/checkmark.gif" alt="'._AT('correct_answer').'" title="'._AT('correct_answer').'" />';
    $mark_wrong = ' <img src="'.$_base_path.'images/x.gif" alt="'._AT('wrong_answer').'" title="'._AT('wrong_answer').'" />';


    Do you see an easy adjustment to make here or would it be something more complicated?

    Thanks.

  • 2009-01-05 09:07:05

    Re:

    Now look for places $mark_right gets used, and experiment by removing the variable.

  • 2009-01-08 13:11:39

    Re:

    Greg,

    I found the file that's causing the display of the checkmarks and red "x's".....

    It's: ATutor/themes/default/test_questions/multichoice_result.tmpl.php

    I've been messing with a section of the code and I'm very close to figuring it out. I changed the original section from....

    <?php if (($this->row['answer_'.$i] == 1) && in_array($i, $this->answers)): ?>
    <img src="<?php echo $this->base_path; ?>images/checkmark.gif" alt="<?php echo _AT('correct_answer'); ?>" title="<?php echo _AT('correct_answer'); ?>" height="16" width="16" style="vertical-align: middle" />
    <?php elseif (($this->row['answer_'.$i] == 1) || in_array($i, $this->answers)): ?>
    <img src="<?php echo $this->base_path; ?>images/x.gif" alt="<?php echo _AT('wrong_answer'); ?>" title="<?php echo _AT('wrong_answer'); ?>" height="16" width="16" style="vertical-align: middle" />
    <?php else: ?>
    <img src="<?php echo $this->base_path; ?>images/clr.gif" alt="" title="" height="16" width="16" style="vertical-align: middle" />
    <?php endif; ?>


    to....

    <?php if (($this->row['answer_'.$i] == 1) && in_array($i, $this->answers)): ?>
    <img src="<?php echo $this->base_path; ?>images/checkmark.gif" alt="<?php echo _AT('correct_answer'); ?>" title="<?php echo _AT('correct_answer'); ?>" height="16" width="16" style="vertical-align: middle" />
    <?php elseif (!($this->row['answer_'.$i] == 1) && in_array($i, $this->answers)): ?>
    <img src="<?php echo $this->base_path; ?>images/x.gif" alt="<?php echo _AT('wrong_answer'); ?>" title="<?php echo _AT('wrong_answer'); ?>" height="16" width="16" style="vertical-align: middle" />
    <?php else: ?>
    <img src="<?php echo $this->base_path; ?>images/clr.gif" alt="" title="" height="16" width="16" style="vertical-align: middle" />
    <?php endif; ?>


    Making this change made it so that there would be a red "x" next to the selected wrong answer only. Now I just need a statement that will put a checkmark next to the correct answer that wasn't chosen.

    Can you help me with this?

    Thanks.

  • 2009-01-08 13:25:58

    Re:

    Don't really have the time to spend this right now.

    Instead of removing the x, did you try replacing the x with the check image?

  • 2009-01-08 15:16:37

    Re:

    Ok. Whenever you get around to it would be great.

    I did try changing the image to the checkmark, but that didn't work.

    Thanks.

  • 2009-01-09 01:46:25

    Re:

    Greg,

    I ended up figuring it out. Below is the code for the ATutor/themes/default/test_questions/multichoice_result.tmpl.php file if it would be useful to others.....


    <p><?php echo AT_print($this->row['question'], 'tests_questions.question'); ?></p>

    <ul style="padding: 0px; margin: 0px; list-style-type: none">
    <?php for ($i=0; $i < 10; $i++): ?>
    <?php if ($this->row['choice_'.$i] != ''): ?>
    <li style="padding: 4px">
    <?php if (($this->row['answer_'.$i] == 1) && in_array($i, $this->answers)): ?>
    <img src="<?php echo $this->base_path; ?>images/checkmark.gif" alt="<?php echo _AT('correct_answer'); ?>" title="<?php echo _AT('correct_answer'); ?>" height="16" width="16" style="vertical-align: middle" />

    <?php elseif (!($this->row['answer_'.$i] == 1) && in_array($i, $this->answers)): ?>
    <img src="<?php echo $this->base_path; ?>images/x.gif" alt="<?php echo _AT('wrong_answer'); ?>" title="<?php echo _AT('wrong_answer'); ?>" height="16" width="16" style="vertical-align: middle" />

    <?php elseif (($this->row['answer_'.$i] == 1) || in_array($i, $this->answers)): ?>
    <img src="<?php echo $this->base_path; ?>images/checkmark.gif" alt="<?php echo _AT('correct_answer'); ?>" title="<?php echo _AT('correct_answer'); ?>" height="16" width="16" style="vertical-align: middle" />

    <?php else: ?>
    <img src="<?php echo $this->base_path; ?>images/clr.gif" alt="" title="" height="16" width="16" style="vertical-align: middle" />
    <?php endif; ?>


    <?php if (in_array($i, $this->answers)): ?>
    <img src="<?php echo $this->base_path; ?>images/checkbox_check.gif" alt="<?php echo _AT('checked'); ?>" title="<?php echo _AT('checked'); ?>" height="13" width="13" style="vertical-align: middle" />
    <?php else: ?>
    <img src="<?php echo $this->base_path; ?>images/checkbox_empty.gif" alt="<?php echo _AT('unchecked'); ?>" title="<?php echo _AT('unchecked'); ?>" height="13" width="13" style="vertical-align: middle" />
    <?php endif; ?>
    <?php echo AT_print($this->row['choice_'.$i], 'tests_questions.choice_'.$i); ?>
    <?php endif; ?>
    <?php endfor; ?>
    </ul>