Changing Quiz Appearance

Changing Quiz Appearance

by Just H -
Number of replies: 29
Afternoon all

The answer selection in the quiz is default to right aligned. This does not look so good when viewed on a widescreen monitor with the browser set to full screen (tends to disassociate short questions from the answers). A colleague changed it to left aligned for our site.

So, for those who wish to change the right alignment of the answers in your quiz...

Each Question type has a folder and in it is the file 'questiontype.php'... this is the file that needs to be changed.

The location for a multiple choice for example, would be

'mod/quiz/questiontype/multichoice/questiontype.php'

In all of these files you should find the code that outputs the main table.. the easiest way to find this would be to do a search for the word 'right' and then obviously change it as required, then test.

A general knowledge of HTML will show how the php spits out the HTML that we see. This then would be the code to manipulate for any other alterations.

For further info, 2 folders up is a file called 'locallib.php' that controls the overal look of each table.

Hope this is useful!
Average of ratings: -
In reply to Just H

Re: Changing Quiz Appearance

by Timothy Takemoto -

Thanks very much Harry Smith,

I was just looking through the forum to see if anyone was having the same problem as me, and found not only the problem but the solution.

At the same time, I hope this is not disrespectful but, does it really require that we change the php file, and not something in the style sheet? If we need to change the php file then this is a bug I guess. Should I post to the bug tracker?

I append a .jpg with the multiple choice answers aligned right, and thus beginning higgledy piggledy at the right side of the screen.

I don't seem to be getting there. I tried changing align="top" to align="left" but still no joy.

This from ~293 in multichoice/questiontype.php

            // Print the text by the control highlighting if correct responses
            // should be shown and the current answer is the correct answer in
            // the single selection case or has a positive score in the multiple
            // selection case
            if ($options->readonly && $options->correct_responses &&
             in_array($aid, $correctanswers)) {
                echo '<td valign="left" class="highlight"><label for="'.$id.'">'.
                 format_text("$qnumchar. $answer->answer", FORMAT_MOODLE ,
                 $formatoptions) . '</label></td>';
            } else {
                echo '<td valign="left"><label for="'.$id.'">'.
                 format_text("$qnumchar. $answer->answer", FORMAT_MOODLE,
                 $formatoptions) . '</label></td>';
            }

Timothy

Attachment _not_lining_up.jpg
In reply to Timothy Takemoto

Re: Changing Quiz Appearance

by Just H -
Good evening Timothy

As far as I know those should be left as "top".

I haven't actually looked at the files in detail as I got a colleague to fix it up so that the answers start left aligned as per below.

We have only modified matching, muli choice, true false and short answer so far as that's all we've used. I've attached a zip file with the relevant modified and original php files in it if you want to just upload and overwrite for those question types. If there are any other types you need to change let me know and I'll get a better explanation on Monday.

As for being a bug or being able to change it in the CSS I'm not too sure!

Regards
Harry




Attachment LeftAligned.jpg
In reply to Just H

Re: Changing Quiz Appearance

by Just H -
Zip file as mentioned above.
In reply to Just H

Re: Changing Quiz Appearance

by Timothy Takemoto -

Thanks a lot Harry,

I see that they are nicely placed on the left hand side of the screen too.

I will plop them in. Ach...I have no idea why but it does not seem to be working. Please see attached. I guess there is a style sheet interaction.

I like the way that the answers are brought toward the left, but the question and the answers are centered rather than being at the left.

Timothy

Attachment _questiontypes.jpg
In reply to Timothy Takemoto

Re: Changing Quiz Appearance

by Just H -
Hi Timothy

Just got your message and did a quick trial (see below). I changed my theme to Ocean Blue as that's what your theme is based on and I couldn't recreate the issue you are having. I'll have a look into it further some time today and get back to you.

Regards
H

PS I'm actually using Formal White and have only changed logos.
Attachment oceanblue.gif
In reply to Just H

Re: Changing Quiz Appearance

by Just H -
Hello Timothy

I am the collaeuge Harry was refering to in previous posts. I have had a look at your posts and the php files that we have changed and I cant seem to find a solution to your problem. The code that you are changing outputs straight HTML (as you can probably tell) and does not directly refer to and CSS, although the problem may have to do with a theme in yours or our site that influences all html outputted.

Anyway all I can really tell you is what is on our php files which is...

- valign is always top
- table align is left

that seems to make it work for us.

Sorry we couldnt be of more help.

Good Luck


In reply to Just H

Re: Changing Quiz Appearance

by Timothy Takemoto -
Thank you very much indeed, Harry and Harry's colleague.

I am using your questiontype.php and the theme that Harry tested so it is pretty strange.

But you have done far more than I could expect. Thank you very much indeed.

Timothy
In reply to Timothy Takemoto

Re: Changing Quiz Appearance

by Just H -
Hi Timothy

Sorry we couldn't pinpoint the issue for you. I only discovered Moodle a couple of months back and Simon (the guy who replied above) only got involved a few weeks back. Neither of us have any previous php experience (Simon is a bit of a Flash and xml guru) but can't see why it wouldn't work.

Only thing I can think of is that the issues you face running Moodle in Japanese may somehow affect it.

Hopefully someone with some expertise will be able to help.

Good luck.

Harry
In reply to Just H

Re: Changing Quiz Appearance

by Charles Libby -
Which Browser and browser version are you using?  This may be a bug in your language rendering of that browser?
Charles Libby
In reply to Timothy Takemoto

Re: Changing Quiz Appearance

by Urs Hunkler -
Picture of Core developers

Timothy, are you still following this thread?

Please look in MoodleDocs in the Theme Scrapbook. There you find a CSS solution I wrote to left align questions and answers. Please give your feedback if it works for your Moodle installation too.

I hope this helps.
Urs

In reply to Urs Hunkler

Re: Changing Quiz Appearance

by Timothy Takemoto -

Dear Urs, Harry

As Harry guess it was partly a browser problem as I realised later. When I viewed the quizes in firefox, they were displayed as Harry said they would be, but when I viewed them in IE, they were not. So the problem was not solved.

However, shortly afterwords, I moved to a new theme which supports IE on Mac (since I had a problem with some students using IE on Mac), which is called standard_hsu_ForMac and is highly recommended, and in that theme the problem by chance happend to disppear in both browsers.

I have another installation where I have not installed the new theme. I will try and do your CSS fix before I change to the new theme.

Thanks again to Harry and you URS.

Tim

In reply to Urs Hunkler

Re: Changing Quiz Appearance

by Karl Peltomaa -
Urs,
You (and CSS) rock! Thank you. Those few lines solved the issue with aligning the answers. Simple and beautiful.
Attachment left-aligned-answers.jpg
In reply to Karl Peltomaa

Re: Changing Quiz Appearance

by Dan Hilke -
Thanks to code Urs provided for the CSS file, I've got my quiz answers left-alligned... however, for answers that have lengthy feedback it's still scrunching up in an undesireable fashion. (This is regarding Multichoice)

I really want to make the feedback print below ALL the answers, but I'm not sure how to edit the code to make that happen.  Attached is part of the file I believe holds the key; can anyone see what I would have to change?
(mod/quiz/questiontypes/multichoice/questiontype.php)

If anyone can help, I'd sure appreciate it!
Dan


Attachment quizformatcode.jpg
In reply to Just H

Re: Changing Quiz Appearance

by Ian Ellis -
Thanks greatly. Much needed.
While changing, isn't the caption "Answer" somewhat redundant and takes up real estate unnecessarily? If removed, the check buttons, etc., still signify that answers follow.

In reply to Ian Ellis

Re: Changing Quiz Appearance

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Hi Ian
I totally agree with you that the prompt "Answer" is redundant, and takes up valuable real estate. Things are worse in Moodle 1.6 where now the prompt has been made longer : "Choose one answer".
Do we think our students are so dumb that when they are confronted with a question and a set of choices they will not understand that they have to tick a choice?
Joseph
In reply to Joseph Rézeau

Re: Changing Quiz Appearance

by Jeff Forssell -
I also like to save "screen real estate" (some users still have 600*800 screens) and don't like to unnecessarily "overexplain" things. But students don't necessarily have to be stupid to be unsure what teachers want them to do. For example: Sometimes when they see a simple question they assume ("It couldn't be that easy.") that we are trying to trick them.

So I like to include plenty of explaination if someone feels the need.

The methods I've used are:
  • title attributes on various things (links, form elements, or whole groups of things with a label). (Unfortunately, in spite of hundreds of votes and several years, the Mozilla browzers display titles poorly, truncated, no linebreaks). Therefore an even better alternative is an OverLib popup (such as is used for the feedback in CLOZE questions). Is there any way to use the OverLib at will in Moodle? They work well in FF, and are highly formattable.
  • expanded text blocks that kan be displayed/hidden with JavaScript connected to a link/button/mouse event. I'm not sure which types of pages allow JavaScript written in the page editor, but I believe I found that it couldn't be done in quiz. (Or is that an Adm setting?)
  • (?) linked to a page in new window explaining how that question type functions.
If one wanted to not show "choose an answer", could one set its ID to "display:none" in the CSS?
In reply to Jeff Forssell

Re: Changing Quiz Appearance

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

Hi Jeff!, thanks for taking the time for a detailed response to my rant about "overexplaining" in quiz directions!wink

Normally I quite agree that one never explains too much, and I also spend a lot of time making sure that everything is clear in my instructions to the students.

I use a lot the "title" attribute and, like you, I lament its poor implementation in Mozilla (truncated, no line break, etc.). I agree that it would be nice to be able to use a more elaborate pop-up system, like the OverLib popup. Unfortunately, because main-core Moodle stubbornly refuses teachers the right to use Javascript in our courses, we can't use OverLib.angry

Finally I have found a work-around - as you suggest - for hiding unwanted "prompt" in quiz questions, but only in forthcoming version 1.6. But more of that when 1.6 becomes the standard version.

Joseph

In reply to Joseph Rézeau

Re: Changing Quiz Appearance

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Time to post my workaround for hiding superfluous prompts in quizzes (for 1.6+).
Simply add to one of your current theme's CSS files:
.que .prompt {
  display:none;
}
Joseph
In reply to Joseph Rézeau

Re: Changing Quiz Appearance

by Gustav W Delius -
It is unfortunately difficult to get things right for all audiences. The reason Moodle 1.6 says "Choose one answer" or "Choose at least one answer" is that this was a feature request by someone who was concerned that students would not know the difference between checkboxes and radio buttons and would need this extra hint to know when they could choose more than one answer.

Because everyone has different requirements the questions in Moodle 1.6 are using templates, simple html files that determine the layout. The one for the multiple choice questions is in question/type/multichoice/display.html. To get rid of the answer prompt you just have to delete the lines

  <div class="prompt">
    <?php echo $answerprompt; ?>
  </div>
In reply to Gustav W Delius

Re: Changing Quiz Appearance

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

Dear Gustav,

1- It is unfortunately difficult to get things right for all audiences.

How true, and you are making a very good job of this impossible task, as regards the Quiz module, Gustav!

2- The reason Moodle 1.6 says "Choose one answer" or "Choose at least one answer" is that this was a feature request by someone who was concerned that students would not know the difference between checkboxes and radio buttons and would need this extra hint to know when they could choose more than one answer.

Well, an easy answer for that would be for that teacher to introduce her quiz with an explanatory screen making this difference clear.

3- Because everyone has different requirements the questions in Moodle 1.6 are using templates, simple html files that determine the layout.To get rid of the answer prompt you just have to delete the lines etc.

That is excellent. However, we must never forget that some of us are teaching in huge institutions (where I work we have 20,000 students) where the Moodle site is in the hands of admin, and making such a "simple" change to our installed Moodle php code is quite out of question for two reasons: a) admin (especially computer people) are very much against hacking anything if they can avoid it and b) such a change would affect all courses site-wide and would require agreement of a majority of users (a nightmare...).

Once more may I say that what is needed in Moodle is to have more control over such things at teacher level, not at admin level. I have pointed this out many times in my posts, but I must be one of a tiny fraction of Moodle users wanting this, so...dead

All the best,

Joseph

PS As I said in my previous post, I have found a workaround to get rid of unwanted prompt, using the CSS in a theme (for version 1.6). I'm waiting for 1.6 to stabilize before posting the workaround (if anyone wants it).

In reply to Joseph Rézeau

Re: Changing Quiz Appearance

by Don Hinkelman -
Picture of Particularly helpful Moodlers Picture of Plugin developers
Once more may I say that what is needed in Moodle is to have more control over such things at teacher level, not at admin level. I have pointed this out many times in my posts, but I must be one of a tiny fraction of Moodle users wanting this, so...

Au contraire, Joseph!  smile  Almost *everyone* agrees with you that control should be pushed down to teachers and then to students as much as possible and as often as appropriate.  It is simply the exhausted resources of a handful of programmers, who usually are volunteering their time, that limits this possibility. 

So, like three did teachers at our school did, recruit a programmer, or get funding to make these changes, and they will eventually get into the releases.  Or change your school policies to give teachers more say in admin.  Or best of all, give a donation to version 1.7, where *flexible, definable roles* are scheduled to be included--which allow you to create broader permissions for teachers, or give students teacher-rights at the course or activity level.  big grin
In reply to Joseph Rézeau

Re: Changing Quiz Appearance

by . madea -

Gustav:
2- The reason Moodle 1.6 says "Choose one answer" or "Choose at least one answer" is that this was a feature request by someone who was concerned that students would not know the difference between checkboxes and radio buttons and would need this extra hint to know when they could choose more than one answer.

Joseph:
Well, an easy answer for that would be for that teacher to introduce her quiz with an explanatory screen making this difference clear.
~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~

I agree with Joseph on this... Instructions in in the introductory text or even embedded in the question itself is the way to go. 

What's going to happen when moodle 1.6 automatically states "Choose one answer" or "Choose at least one answer" when the student must select TWO or more items from a list in order to get a correct answer? 

What's going to happen when the student is faced with text in a question that states:  "From the following list, select the item(s) that are correct" and moodle 1.6 automatically states: "Choose one answer"?  But, to get a correct answer, the student must select 2 items from a list of 6?

The statement "Choose one answer" or "Choose at least one answer" seems to be restrictive and dangerously misleading for the student.  At the most, just a simple "Answer(s):" would be sufficient.

madea
In reply to Gustav W Delius

Re: Changing Quiz Appearance

by Klaus Schramm -
Great. The template feature alone will make upgrading to a stable 1.6 worthwhile. Will the template concept be extended to the layout of blocks and lists, too?
Regards, Klaus
In reply to Gustav W Delius

Re: Changing Quiz Appearance

by Anthony Borrow -
Picture of Core developers Picture of Plugin developers Picture of Testers
I've had a student raise an issue (and some of our faculty seem to agree) that the language used on multiple choice questions with multiple answers allowed (checkboxes) can be misleading to students. The current phrasing tells the student to "check at least one"; however, really we are asking the student to "check all that apply". The argument as it was stated to me was that the student followed directions by checking at least one answer. He knew others were correct; however, he checked one of the correct answers and still lost points. I believe that I can change this by changing the language string; however, I wanted to throw this out to the larger Moodle community for consideration. What is it that we really want the student to do? I tend to agree that we want the student to "check all that apply" rather than "check at least one".  Perhaps a combo is needed, to avoid the situation where a student might believe that it is possible to have a correct answer where none of the options should be checked. In reality, we want the student to check at least one and all others that may apply. Any thoughts?
In reply to Anthony Borrow

Re: Changing Quiz Appearance

by Dr S Bhatia -
Your contention is bang-on Anthonythoughtful

BUT

whenever a software is created for public, any standard notification is usually very broad in its sense so as to apply to the maximum number of people.

Therefore

If we change it now to anything, you will find people clamouring for the older string or even a newer one.black eye

OPTIONS:
Simply hack the file and change the string in YOUR version. I don;t know how to hackblush. Ask Tim or Chris

Option2: Just add 'Click all that apply' in the instructions for the quiz. Students are not that dumb and we are not fighting a legal battle with them for accuracy of the sentence. wink I use moodle mainly for quizzes and I feel it's OK to say click at least one coz I write instructions at the beginning of quiz.
In reply to Dr S Bhatia

Re: Changing Quiz Appearance

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

option #3 : hide the superfluous prompt message (see this post) and replace it with clear instructions at the start of the quiz...

Joseph

In reply to Dr S Bhatia

Re: Changing Quiz Appearance

by Anthony Borrow -
Picture of Core developers Picture of Plugin developers Picture of Testers
Thanks for your feedback. On my site I can make the change easily enough by changing the language string and with the increased ease to change a string on a site that may be the best way to handle it. I was just curious if others had run into this with students and wanted throw it out there for the larger Moodle community for consideration. I hear your point about changing a string once it has been around. 
In reply to Gustav W Delius

Re: Changing Quiz Appearance

by Bert Kramer -

Because everyone has different requirements the questions in Moodle 1.6 are using templates, simple html files that determine the layout. The one for the multiple choice questions is in question/type/multichoice/display.html. To get rid of the answer prompt you just have to delete the lines

  <div class="prompt">
    <?php echo $answerprompt; ?>
  </div>

I'm trying to get rid of the answer prompt as wel. I have deleted the lines from the file as mentioned above. No result. Whatever I change in this file, nothing will change on the screen. When I rename the file, the question disappears from the screen. When I delete all the code in the file, the screen remains the same. This is driving me crazy.  Can anybody point me in the right direction? I'm using the latest Moodle version 1.9.

Bert