Year dropdown listbox - how to add more year?

Year dropdown listbox - how to add more year?

by Melissa Bolin -
Number of replies: 5
I am very new to moodle development and php. In the 'ADD A QUIZ' section, in the dropdowns for adding OPEN THE QUIZ and CLOSE THE QUIZ details the dropdown for YEAR display '2010' as the last option. I want to add more years to the dropdowns in whole application. How can I do that? I will really appreciate the quick response. Thanks in advance. Divya divya@hea.biz
Average of ratings: -
In reply to Melissa Bolin

Re: Year dropdown listbox - how to add more year?

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
What version of Moodle are you using. I would guess it is a very old version. You should upgrade.
In reply to Tim Hunt

Re: Year dropdown listbox - how to add more year?

by Divya Bansal -
Thank you very much for the reply Tim. Yes, it is very old - 1.3.3(2004052503). Is there any fix without updating to the latest version?
In reply to Divya Bansal

Re: Year dropdown listbox - how to add more year?

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
1.3.3 is ancient (July 2004, Moodle_version_history#Moodle_1.3). There will be lots of known security holes. The only sensible thing to do is to update it.


However, if you insist, it is probably trivial to fix it if you know PHP code. But I can't help you. In 2004 I had not even heard of Moodle. Just about everything about the code has changed since then.
In reply to Melissa Bolin

Re: Year dropdown listbox - how to add more year?

by Chris Collman -
Picture of Documentation writers

Thanks Melissa for the post.

The answer in 1.5.3 is /lib/weblib.php. Look for

function print_date_selector($day, $month, $year, $currenttime=0, $return=false
Then find:

for ($i=1970; $i<=2010; $i++) {

Change the 2010 to the year of your choice, this will change it on all year selector dates and Tim's your uncle ! smile

I had the same issue, wanting to extend a the life of a old Moodle (just in case).  What was frustrating is that in 2006  I figured out how to do it on a localhost still working here at home, when I knew nothing about Moodle .  Guess it does say that I am truly the perpetual Newbie thanks to a very selective memory.

Hope this helps you and others.

Chris

Average of ratings: Useful (1)
In reply to Chris Collman

Re: Year dropdown listbox - how to add more year?

by Randy Sullivan -

Thank you very much for the tip Chris! I'm still going to work on upgrading, but at least the old version will still be functional after the end of the year. This should satisfy my superiors until the full upgrade is complete.

Thanks again,

Randy Sullivan