From: moodler Date: Tue, 15 Oct 2002 16:22:18 +0000 (+0000) Subject: Added timeopen and timeclose (instead of days) and did a few cleanups X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=49dcdd18005887972a7ba0342342372dd17e4d16;p=moodle.git Added timeopen and timeclose (instead of days) and did a few cleanups --- diff --git a/lang/en/moodle.php b/lang/en/moodle.php index d705b48136..8d445678f6 100644 --- a/lang/en/moodle.php +++ b/lang/en/moodle.php @@ -337,7 +337,9 @@ $string['never'] = "Never"; $string['no'] = "No"; $string['nocoursesyet'] = "No courses in this category"; $string['noexistingteachers'] = "No existing teachers"; +$string['nofilesyet'] = "No files have been uploaded to your course yet"; $string['nograde'] = "No grade"; +$string['noimagesyet'] = "No images have been uploaded to your course yet"; $string['none'] = "None"; $string['nopotentialteachers'] = "No potential teachers"; $string['normal'] = "Normal"; diff --git a/lang/en/quiz.php b/lang/en/quiz.php index 8bf38ff845..65e2ad4bb7 100644 --- a/lang/en/quiz.php +++ b/lang/en/quiz.php @@ -52,6 +52,11 @@ $string['nomoreattempts'] = "No more attempts are allowed"; $string['noquestions'] = "No questions have been added yet"; $string['question'] = "Question"; $string['questionname'] = "Question name"; +$string['quizavailable'] = "The quiz is available until: \$a"; +$string['quizclose'] = "Close the quiz"; +$string['quizclosed'] = "This quiz closed on \$a"; +$string['quizopen'] = "Open the quiz"; +$string['quiznotavailable'] = "The quiz will not be available until: \$a"; $string['rename'] = "Rename"; $string['report'] = "Reports"; $string['save'] = "Save"; diff --git a/mod/quiz/db/mysql.sql b/mod/quiz/db/mysql.sql index e76a618dad..9755e761a7 100644 --- a/mod/quiz/db/mysql.sql +++ b/mod/quiz/db/mysql.sql @@ -3,7 +3,7 @@ # http://www.phpmyadmin.net/ (download page) # # Host: localhost -# Generation Time: Oct 15, 2002 at 08:22 PM +# Generation Time: Oct 16, 2002 at 12:20 AM # Server version: 3.23.49 # PHP Version: 4.2.3 # Database : `moodle` @@ -18,7 +18,8 @@ CREATE TABLE `quiz` ( `course` int(10) unsigned NOT NULL default '0', `name` varchar(255) NOT NULL default '', `intro` text NOT NULL, - `days` smallint(6) NOT NULL default '0', + `timeopen` int(10) unsigned NOT NULL default '0', + `timeclose` int(10) unsigned NOT NULL default '0', `attempts` smallint(6) NOT NULL default '0', `feedback` tinyint(4) NOT NULL default '0', `correctanswers` tinyint(4) NOT NULL default '1', diff --git a/mod/quiz/lib.php b/mod/quiz/lib.php index 3489c5bd1e..06fda944b2 100644 --- a/mod/quiz/lib.php +++ b/mod/quiz/lib.php @@ -30,7 +30,12 @@ function quiz_add_instance($quiz) { /// will create a new instance and return the id number /// of the new instance. + $quiz->created = time(); $quiz->timemodified = time(); + $quiz->timeopen = make_timestamp($quiz->openyear, $quiz->openmonth, $quiz->openday, + $quiz->openhour, $quiz->openminute, $quiz->opensecond); + $quiz->timeclose = make_timestamp($quiz->closeyear, $quiz->closemonth, $quiz->closeday, + $quiz->closehour, $quiz->closeminute, $quiz->closesecond); if (!$quiz->id = insert_record("quiz", $quiz)) { return false; // some error occurred @@ -61,6 +66,10 @@ function quiz_update_instance($quiz) { /// will update an existing instance with new data. $quiz->timemodified = time(); + $quiz->timeopen = make_timestamp($quiz->openyear, $quiz->openmonth, $quiz->openday, + $quiz->openhour, $quiz->openminute, $quiz->opensecond); + $quiz->timeclose = make_timestamp($quiz->closeyear, $quiz->closemonth, $quiz->closeday, + $quiz->closehour, $quiz->closeminute, $quiz->closesecond); $quiz->id = $quiz->instance; if (!update_record("quiz", $quiz)) { diff --git a/mod/quiz/mod.html b/mod/quiz/mod.html index 2a6f29cf70..5fb1ccc030 100644 --- a/mod/quiz/mod.html +++ b/mod/quiz/mod.html @@ -20,26 +20,28 @@ -

:

+

:

days == "") { - $form->days == "14"; + if (!$form->timeopen and $course->format == "weeks") { + $form->timeopen = $course->startdate + (($form->section - 1) * 608400); } - choose_from_menu($options, "days", "$form->days", ""); + print_date_selector("openday", "openmonth", "openyear", $form->timeopen); + print_time_selector("openhour", "openminute", $form->timeopen); ?> + +

:

+ + timeclose and $course->format == "weeks") { + $form->timeclose = $course->startdate + (($form->section) * 608400); + } + print_date_selector("closeday", "closemonth", "closeyear", $form->timeclose); + print_time_selector("closehour", "closeminute", $form->timeclose); + ?> +

:

diff --git a/mod/quiz/multichoice.html b/mod/quiz/multichoice.html index e727ff0bcb..a6b8e57df6 100644 --- a/mod/quiz/multichoice.html +++ b/mod/quiz/multichoice.html @@ -23,7 +23,12 @@

:

- image", get_string("none"),"",""); ?> + image", get_string("none"),"",""); + } + ?> diff --git a/mod/quiz/shortanswer.html b/mod/quiz/shortanswer.html index 703921ccc2..0fd7a11257 100644 --- a/mod/quiz/shortanswer.html +++ b/mod/quiz/shortanswer.html @@ -23,7 +23,12 @@

:

- image", get_string("none"),"",""); ?> + image", get_string("none"),"",""); + } + ?> diff --git a/mod/quiz/truefalse.html b/mod/quiz/truefalse.html index 7ec480a697..fd2184c10d 100644 --- a/mod/quiz/truefalse.html +++ b/mod/quiz/truefalse.html @@ -23,7 +23,12 @@

:

- image", get_string("none"),"",""); ?> + image", get_string("none"),"",""); + } + ?> diff --git a/mod/quiz/view.php b/mod/quiz/view.php index dfdb4d95ce..1918955454 100644 --- a/mod/quiz/view.php +++ b/mod/quiz/view.php @@ -37,14 +37,8 @@ add_to_log($course->id, "quiz", "view", "view.php?id=$cm->id", "$quiz->id"); - if ($course->format == "weeks" and $quiz->days) { - $timenow = time(); - $timestart = $course->startdate + (($cw->section - 1) * 608400); - $timefinish = $timestart + (3600 * 24 * $quiz->days); - $available = ($timestart < $timenow and $timenow < $timefinish); - } else { - $available = true; - } + $timenow = time(); + $available = ($quiz->timeopen < $timenow and $timenow < $quiz->timeclose); // Print the page header @@ -74,13 +68,12 @@ print_simple_box($quiz->intro, "CENTER"); - if (isset($timestart) and isset($timefinish)) { - if ($available) { - echo "

The quiz is available: "; - } else { - echo "

The quiz is not available: "; - } - echo userdate($timestart)." - ".userdate($timefinish)."

"; + if ($available) { + echo "

".get_string("quizavailable", "quiz", userdate($quiz->timeclose)); + } else if ($timenow < $quiz->timeopen) { + echo "

".get_string("quiznotavailable", "quiz", userdate($quiz->timeopen)); + } else { + echo "

".get_string("quizclosed", "quiz", userdate($quiz->timeclose)); } if ($attempts = quiz_get_user_attempts($quiz->id, $USER->id)) {