$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";
$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";
# 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`
`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',
/// 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
/// 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)) {
</TD>
</TR>
<TR valign=top>
- <TD align=right><P><B><? print_string("daysavailable", "quiz") ?>:</B></P></TD>
+ <TD align=right><P><B><? print_string("quizopen", "quiz") ?>:</B></P></TD>
<TD>
<?
- $options = array();
- $options[0] = get_string("alwaysavailable", "quiz");
- for ($i=1;$i<=13;$i++) {
- $options[$i] = get_string("numdays", "", $i);
- }
- for ($i=2;$i<=16;$i++) {
- $days = $i * 7;
- $options[$days] = get_string("numweeks", "", $i);
- }
- $options[365] = get_string("numweeks", "", 52);
- if ($form->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);
?>
</TD>
</TR>
+<TR valign=top>
+ <TD align=right><P><B><? print_string("quizclose", "quiz") ?>:</B></P></TD>
+ <TD>
+ <?
+ if (!$form->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);
+ ?>
+ </TD>
<TR valign=top>
<TD align=right><P><B><? print_string("attemptsallowed", "quiz") ?>:</B></P></TD>
<TD>
<TR valign=top>\r
<TD align=right><P><B><? print_string("imagedisplay", "quiz") ?>:</B></P></TD>\r
<TD>\r
- <? choose_from_menu($images, "image", "$question->image", get_string("none"),"",""); ?>\r
+ <? if (!$images) {\r
+ print_string("noimagesyet");\r
+ } else {\r
+ choose_from_menu($images, "image", "$question->image", get_string("none"),"","");\r
+ }\r
+ ?>\r
</TD>\r
</TR>\r
<TR valign=top>\r
<TR valign=top>\r
<TD align=right><P><B><? print_string("imagedisplay", "quiz") ?>:</B></P></TD>\r
<TD>\r
- <? choose_from_menu($images, "image", "$question->image", get_string("none"),"",""); ?>\r
+ <? if (!$images) {\r
+ print_string("noimagesyet");\r
+ } else {\r
+ choose_from_menu($images, "image", "$question->image", get_string("none"),"","");\r
+ }\r
+ ?>\r
</TD>\r
</TR>\r
<TR valign=top>\r
<TR valign=top>\r
<TD align=right><P><B><? print_string("imagedisplay", "quiz") ?>:</B></P></TD>\r
<TD>\r
- <? choose_from_menu($images, "image", "$question->image", get_string("none"),"",""); ?>\r
+ <? if (!$images) {\r
+ print_string("noimagesyet");\r
+ } else {\r
+ choose_from_menu($images, "image", "$question->image", get_string("none"),"","");\r
+ }\r
+ ?>\r
</TD>\r
</TR>\r
\r
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
print_simple_box($quiz->intro, "CENTER");
- if (isset($timestart) and isset($timefinish)) {
- if ($available) {
- echo "<P ALIGN=CENTER>The quiz is available: ";
- } else {
- echo "<P ALIGN=CENTER>The quiz is not available: ";
- }
- echo userdate($timestart)." - ".userdate($timefinish)." </P>";
+ if ($available) {
+ echo "<P ALIGN=CENTER>".get_string("quizavailable", "quiz", userdate($quiz->timeclose));
+ } else if ($timenow < $quiz->timeopen) {
+ echo "<P ALIGN=CENTER>".get_string("quiznotavailable", "quiz", userdate($quiz->timeopen));
+ } else {
+ echo "<P ALIGN=CENTER>".get_string("quizclosed", "quiz", userdate($quiz->timeclose));
}
if ($attempts = quiz_get_user_attempts($quiz->id, $USER->id)) {