[svn r16686] fixed exercise timelimit error

skala
Daniel Perales 17 years ago
parent 1efc9de23b
commit 4cabe663d5
  1. 5
      main/exercice/exercice_submit.php
  2. 17
      main/exercice/exercise.class.php

@ -37,7 +37,7 @@
* @package dokeos.exercise
* @author Olivier Brouckaert
* @author Julio Montoya multiple fill in blank option added
* @version $Id: exercice_submit.php 16674 2008-11-05 23:19:46Z dperales $
* @version $Id: exercice_submit.php 16686 2008-11-06 16:31:22Z dperales $
*/
@ -556,7 +556,8 @@ if($limit_time_exists){
$time_now = convert_date_to_number(date('Y-m-d H:i:s'));
$permission_to_start = (($time_now - $exercise_start_time)>0)?true:false;
if($_SERVER['REQUEST_METHOD']!='POST')$exercise_timeover = (($time_now - $exercise_end_time)>0)?true:false;
if($permission_to_start == false || $exercise_timeover = true){ //
if($permission_to_start === false || $exercise_timeover == true){ //
if(!api_is_allowed_to_edit()){
$message_warning = ($permission_to_start == false)? get_lang('ExerciseNoStartedYet').' %s' : get_lang('ReachedTimeLimit') ;
Display::display_warning_message(sprintf($message_warning,(($permission_to_start == false)?$Exe_starttime:$Exe_endttime)));

@ -25,7 +25,7 @@
* Exercise class: This class allows to instantiate an object of type Exercise
* @package dokeos.exercise
* @author Olivier Brouckaert
* @version $Id: exercise.class.php 16674 2008-11-05 23:19:46Z dperales $
* @version $Id: exercise.class.php 16686 2008-11-06 16:31:22Z dperales $
*/
@ -63,6 +63,8 @@ class Exercise
$this->active=1;
$this->questionList=array();
$this->timeLimit = 0;
$this->end_time = '0000-00-00 00:00:00';
$this->start_time = '0000-00-00 00:00:00';
}
/**
@ -115,7 +117,7 @@ class Exercise
$this->questionList[$object->question_order]=$object->question_id;
}
//var_dump($this->end_time,$object->start_time);
if($this->random > 0){
$this->questionList = $this->selectRandomList();
}
@ -874,17 +876,16 @@ class Exercise
if($form -> getSubmitValue('enabletimelimit')==1)
{
$start_time = $form -> getSubmitValue('start_time');
$start_time = $start_time['Y'].'-'.$start_time['M'].'-'.$start_time['d'].' '.$start_time['H'].':'.$start_time['i'].':00';
$this->start_time = $start_time['Y'].'-'.$start_time['M'].'-'.$start_time['d'].' '.$start_time['H'].':'.$start_time['i'].':00';
$end_time = $form -> getSubmitValue('end_time');
$end_time = $end_time['Y'].'-'.$end_time['M'].'-'.$end_time['d'].' '.$end_time['H'].':'.$end_time['i'].':00';
$this -> start_time = $start_time;
$this -> end_time = $end_time;
$this->end_time = $end_time['Y'].'-'.$end_time['M'].'-'.$end_time['d'].' '.$end_time['H'].':'.$end_time['i'].':00';
}
else
{
$this -> start_time = '0000-00-00 00:00:00';
$this -> end_time = '0000-00-00 00:00:00';
$this->start_time = '0000-00-00 00:00:00';
$this->end_time = '0000-00-00 00:00:00';
}
//echo $end_time;exit;
$this -> save();
}
}

Loading…
Cancel
Save