Quizz limit to one question per page with no access to previous or next question

Quizz limit to one question per page with no access to previous or next question

by Sylvain Houmeau -
Number of replies: 20

Hi,

Using Moodle 1.8

Setting up a quizz, I am trying to find out if there is a way to limit the number of question per page (like 1 or 2). I know this is possible. I have tried it and it works but:

if you have 50 questions in your quizz, and you want to limit the quizz to 1 question per page: the system will set up the quizz with 50 pages and each page will have links to the previous or next questions.

I am trying to do the same thing but without the links to previous or next question.

Is this possible? and if yes, HOW???

If someone knows, please tell me.

Thank you very much.

Average of ratings: -
In reply to Sylvain Houmeau

Re: Quizz limit to one question per page with no access to previous or next question

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Sylvain,
If each question page does not display links to - at least - the next question, how will the students be able to get there? Or maybe what you want is instead of
Page: (Previous) 1 2 3 4 5 6 7 8 9 10 (Next)
this:
Page: (Previous) ... (Next)
What exactly do you want?
Joseph
In reply to Joseph Rézeau

Re: Quizz limit to one question per page with no access to previous or next question

by Sylvain Houmeau -

thank you for responding.

What i want exactly is to set to 1 question per page, have a link leading to the next question (obviously) but no possibility to go back to the previous questions.

Maybe I think wrong. But i would like to keep my students from returning back to check previous questions because this might give hints to answer the following questions.

Hope you can help.

Thanks again.

In reply to Sylvain Houmeau

Re: Quizz limit to one question per page with no access to previous or next question

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
To display only the Next link on each page of a quiz set to "one question per page", you can hack the Moodle code. In Moodle 1.8.2, go to file moodle/mod/quiz/locallib.php, and comment out lines 217-230:
/*
echo '<span class="title">' . get_string('page') . ':</span>';
if ($page > 0) {
// Print previous link
$strprev = get_string('previous');
echo '<a href="javascript:navigate(' . ($page - 1) . ');" title="'
. $strprev . '">(' . $strprev . ')</a>';
}
for ($i = 0; $i < $pages; $i++) {
if ($i == $page) {
echo '<span class="thispage">'.($i+1).'</span>';
} else {
echo '<a href="javascript:navigate(' . ($i) . ');">'.($i+1).'</a>';
}
}
*/
See attached result.
However, I agree with you that this ought to be offered as a quiz setting, and I am surprised that it does not exist already. Anyone interested please vote for bug report MDL-11047.
Joseph
In reply to Joseph Rézeau

Re: Quizz limit to one question per page with no access to previous or next question

by Sylvain Houmeau -

Hello Joseph,

Sorry I was busy with other things. I come back on the solution you provided me with (dated mercredi 29 août 2007, 10:03). Question: is this going to make all my quizzes work the same, like all of them will be formatted with each question on the next page? or is this going to affect one quizz, or become an option for all subsequent quizzes?

Thank you.

sylvain

In reply to Sylvain Houmeau

Re: Quizz limit to one question per page with no access to previous or next question

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
>Question: is this going to make all my quizzes work the same, like all of them will be formatted with each question on the next page?

The answer is Yes, of course. For the hack to work with one quiz only we would need to have a special setting in the Quiz edit module...

Joseph

In reply to Joseph Rézeau

Re: Quizz limit to one question per page with no access to previous or next question

by Maria B. -
Hallo,
I was wondering if I could put this part of code only in case when my quiz is setted in one question per page mod.

Something like this:

If (one question per page)

function quiz_print_navigation_panel($page, $pages) {
//$page++;
if ($page < $pages - 1) {
// Print next link
$strnext = get_string('next');
echo '<a href="javascript:navigate(' . ($page + 1) . ');" title="'
. $strnext . '">(' . $strnext . ')</a>';
}
}

else


function quiz_print_navigation_panel($page, $pages) {
//$page++;
echo '<div class="pagingbar">';
echo '<span class="title">' . get_string('page') . ':</span>';
if ($page > 0) {
// Print previous link
$strprev = get_string('previous');
echo '<a href="javascript:navigate(' . ($page - 1) . ');" title="'
. $strprev . '">(' . $strprev . ')</a>';
}
for ($i = 0; $i < $pages; $i++) {
if ($i == $page) {
echo '<span class="thispage">'.($i+1).'</span>';
} else {
echo '<a href="javascript:navigate(' . ($i) . ');">'.($i+1).'</a>';
}
}

if ($page < $pages - 1) {
// Print next link
$strnext = get_string('next');
echo '<a href="javascript:navigate(' . ($page + 1) . ');" title="'
. $strnext . '">(' . $strnext . ')</a>';
}
echo '</div>';
}

But, I do not know how to make this condition: one question per page
In reply to Maria B.

Re: Quizz limit to one question per page with no access to previous or next question

by Maria B. -
I made two alternative function in locallib.php

The first is mine:

function quiz_print_nextpage_link($page, $pages) {
//$page++;
if ($page < $pages - 1) {
// Print next link
$strnext = get_string('next');
echo '<a href="javascript:navigate(' . ($page + 1) . ');" title="'
. $strnext . '">Prika&#382;i naredno pitanje</a>';
}
}

The second is standard:

function quiz_print_navigation_panel($page, $pages) {
//$page++;
echo '<div class="pagingbar">';
echo '<span class="title">' . get_string('page') . ':</span>';
if ($page > 0) {
// Print previous link
$strprev = get_string('previous');
echo '<a href="javascript:navigate(' . ($page - 1) . ');" title="'
. $strprev . '">(' . $strprev . ')</a>';
}
for ($i = 0; $i < $pages; $i++) {
if ($i == $page) {
echo '<span class="thispage">'.($i+1).'</span>';
} else {
echo '<a href="javascript:navigate(' . ($i) . ');">'.($i+1).'</a>';
}
}

if ($page < $pages - 1) {
// Print next link
$strnext = get_string('next');
echo '<a href="javascript:navigate(' . ($page + 1) . ');" title="'
. $strnext . '">(' . $strnext . ')</a>';
}
echo '</div>';
}

Then, I had put these lines of code in attempt.php

// Print the navigation panel if required
if ($numpages > 1 and $questionperpage > 1) {
echo "<br />\n";
quiz_print_navigation_panel($page, $numpages);
echo '<br />'
}

if ($numpages > 1 and $questionperpage <2 ) {
echo "<br />\n";
quiz_print_nextpage_link($page, $numpages);
echo '<br />';
}

but something went wrong since every time I get quiz_print_nextpage_link function, even I have a few questions per page.

I suppose that I have to get number of questions per page somehow.



In reply to Maria B.

Re: Quizz limit to one question per page with no access to previous or next question

by Maria B. -
OK, I figured it out.

$questionperpage = $quiz->questionsperpage;
In reply to Joseph Rézeau

Re: Quizz limit to one question per page with no access to previous or next question

by Kenneth Candelaria -

Hello Joseph,

I know its been a few years after you gave this suggestion. I tried it anyway on Moodle 1.9.8 and it does what it should do - place just a link to the 'Next' question and you could not go back to the previous quiz item.

However, if the quiz was set with a time limit, and you exit the quiz (without submitting), and then you try logging back to Moodle on a future date to continue the quiz, you will find that the time has expired on you. At this point you could no longer continue the quiz - unless you had set that you can take it more than once.

Prior to making this modification on locallib.php, you can still log back in to the quiz and take it with the same time remaining as when you had last logged out or exited.

Just thought you would like to know if someone tried it. Thanks.

In reply to Sylvain Houmeau

Re: Quizz limit to one question per page with no access to previous or next question

by Michelle Moore -
Since the quiz does not have this functionality built in, you might take a look at the lesson module. You can set up a lesson with just questions and always link the answers to the next page--eliminating any option to go back and only allowing the user to go forward after answering the question. The only downside to using the lesson is that you don't get quite the same item analysis, but for most, the data is sufficient.

If you need more detail about how to set this up, let me know. smile
In reply to Michelle Moore

Re: Quizz limit to one question per page with no access to previous or next question

by Sylvain Houmeau -
Thank you for the idea Michelle. Would a lesson allow questions to be chosen randomly though? and MCQ answers to be set randomly also? I am making short and long quizzes (25 questions or 50 questions) out of a bank of 175 questions for now. And I will add more questions.
In reply to Sylvain Houmeau

Re: Quizz limit to one question per page with no access to previous or next question

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Sylvain,
I don't think you'll be able to do what you want with the Lesson module. Have you tried my hack for the Quiz module?
Joseph
In reply to Joseph Rézeau

Re: Quizz limit to one question per page with no access to previous or next question

by Sylvain Houmeau -

Hi Joseph,

I've been a little long to reply but in short I have not tried your suggestion just yet. I've been very busy.

You say, in your post, that I should comment out the following lines... what do you mean?

sylvain

In reply to Sylvain Houmeau

Re: Quizz limit to one question per page with no access to previous or next question

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Sylvain
"comment out" just means putting those lines between comment markers /* ... */ as shown in the example in my post
Joseph
In reply to Joseph Rézeau

Re: Quizz limit to one question per page with no access to previous or next question

by Carrie Meyer -
Has anything been done on this topic in the past year? I see the tracker is still open with no progress.
I really would like this feature. Thanks!
In reply to Carrie Meyer

Re: Quizz limit to one question per page with no access to previous or next question

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Well, not as such. What has happened is that quiz navigation has been changed for the Moodle 2.0 release. If anything, those code changes should make it easier, rather than harder, to implement this. But it is not on anyone's priority list at the moment.

Also, MDL-3054 probably needs to be implemented first, but that is relatively easy.

Lots of people seem to ask for this feature, but no one wants it badly enough to implement it themself wink
In reply to Tim Hunt

Re: Quizz limit to one question per page with no access to previous or next question

by Noob User -
I would also love to see this feature enabled. I'm running the latest version of moodle, and would like to have the ability for one question per page with no backtracking. Similar to Lessons but I need the ability to randomize questions.

In the current release, if I have 20 questions with the 1 question per page option shown, it will display links for the 20 pages across the top. Plus it prompts the user to Submit after each questions. I would prefer to just have a next button with no extra links or backtracking abilities.
In reply to Joseph Rézeau

Re: Quizz limit to one question per page with no access to previous or next question

by Azhar Ghani -

Joseph,

How about removing paging numbers links from bottom or top of the page.

and How to replace word "Page" with "Question" on this quiz page.

Regards

In reply to Sylvain Houmeau

Re: Quizz limit to one question per page with no access to previous or next question

by Anthony Basile -
I've seen this request come in from many different sources now and so I wrote a patch against CVS MOODLE_1.9.9 which effectively turns all "free" quizzes into "sequential" quizzes.

The biggest limitation is that you don't get a choice. Your entire site goes to sequential.

I'm willing to work on this more if the community lets me know what they think.
In reply to Anthony Basile

Re: Quizz limit to one question per page with no access to previous or next question

by Jules Mathews -

This feature is absolutely essential to one of the projects I have in mind for Moodle. I am using Moodle 2.0.2. Please implement this.

Many thanks.