if starttime and endtime are empty, set them to zero

This commit is contained in:
gbateson 2006-01-13 07:57:50 +00:00
parent 729b2dfad2
commit abe2308eab

View File

@ -35,12 +35,17 @@
$attempt->starttime = optional_param('starttime', NULL, PARAM_ALPHA);
$attempt->timefinish = $time;
if ($attempt->endtime) {
$attempt->endtime = strtotime($attempt->endtime);
}
if ($attempt->starttime) {
// convert times, if necessary
if (empty($attempt->starttime)) {
$attempt->starttime = 0;
} else {
$attempt->starttime = strtotime($attempt->starttime);
}
if (empty($attempt->endtime)) {
$attempt->endtime = 0;
} else {
$attempt->endtime = strtotime($attempt->endtime);
}
// set clickreportid, (for click reporting)
$attempt->clickreportid = $attempt->id;