|
|
@ -35,6 +35,7 @@ class Exercise |
|
|
|
public $course; |
|
|
|
public $course; |
|
|
|
public $course_id; |
|
|
|
public $course_id; |
|
|
|
public $propagate_neg; |
|
|
|
public $propagate_neg; |
|
|
|
|
|
|
|
public $saveCorrectAnswers; |
|
|
|
public $review_answers; |
|
|
|
public $review_answers; |
|
|
|
public $randomByCat; |
|
|
|
public $randomByCat; |
|
|
|
public $text_when_finished; |
|
|
|
public $text_when_finished; |
|
|
@ -91,6 +92,7 @@ class Exercise |
|
|
|
$this->results_disabled = 1; |
|
|
|
$this->results_disabled = 1; |
|
|
|
$this->expired_time = '0000-00-00 00:00:00'; |
|
|
|
$this->expired_time = '0000-00-00 00:00:00'; |
|
|
|
$this->propagate_neg = 0; |
|
|
|
$this->propagate_neg = 0; |
|
|
|
|
|
|
|
$this->saveCorrectAnswers = 0; |
|
|
|
$this->review_answers = false; |
|
|
|
$this->review_answers = false; |
|
|
|
$this->randomByCat = 0; |
|
|
|
$this->randomByCat = 0; |
|
|
|
$this->text_when_finished = ''; |
|
|
|
$this->text_when_finished = ''; |
|
|
@ -152,6 +154,7 @@ class Exercise |
|
|
|
$this->attempts = $object->max_attempt; |
|
|
|
$this->attempts = $object->max_attempt; |
|
|
|
$this->feedback_type = $object->feedback_type; |
|
|
|
$this->feedback_type = $object->feedback_type; |
|
|
|
$this->propagate_neg = $object->propagate_neg; |
|
|
|
$this->propagate_neg = $object->propagate_neg; |
|
|
|
|
|
|
|
$this->saveCorrectAnswers = $object->save_correct_answers; |
|
|
|
$this->randomByCat = $object->random_by_category; |
|
|
|
$this->randomByCat = $object->random_by_category; |
|
|
|
$this->text_when_finished = $object->text_when_finished; |
|
|
|
$this->text_when_finished = $object->text_when_finished; |
|
|
|
$this->display_category_name = $object->display_category_name; |
|
|
|
$this->display_category_name = $object->display_category_name; |
|
|
@ -1133,6 +1136,14 @@ class Exercise |
|
|
|
return $this->propagate_neg; |
|
|
|
return $this->propagate_neg; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* @return int |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public function selectSaveCorrectAnswers() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return $this->saveCorrectAnswers; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Selects questions randomly in the question list |
|
|
|
* Selects questions randomly in the question list |
|
|
|
* |
|
|
|
* |
|
|
@ -1275,6 +1286,14 @@ class Exercise |
|
|
|
$this->propagate_neg = $value; |
|
|
|
$this->propagate_neg = $value; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* @param $value int |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public function updateSaveCorrectAnswers($value) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
$this->saveCorrectAnswers = $value; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* @param $value |
|
|
|
* @param $value |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -1523,6 +1542,7 @@ class Exercise |
|
|
|
$random_answers = $this->random_answers; |
|
|
|
$random_answers = $this->random_answers; |
|
|
|
$active = $this->active; |
|
|
|
$active = $this->active; |
|
|
|
$propagate_neg = $this->propagate_neg; |
|
|
|
$propagate_neg = $this->propagate_neg; |
|
|
|
|
|
|
|
$saveCorrectAnswers = isset($this->saveCorrectAnswers) && $this->saveCorrectAnswers ? true : false; |
|
|
|
$review_answers = isset($this->review_answers) && $this->review_answers ? 1 : 0; |
|
|
|
$review_answers = isset($this->review_answers) && $this->review_answers ? 1 : 0; |
|
|
|
$randomByCat = intval($this->randomByCat); |
|
|
|
$randomByCat = intval($this->randomByCat); |
|
|
|
$text_when_finished = $this->text_when_finished; |
|
|
|
$text_when_finished = $this->text_when_finished; |
|
|
@ -1573,6 +1593,7 @@ class Exercise |
|
|
|
'max_attempt' => $attempts, |
|
|
|
'max_attempt' => $attempts, |
|
|
|
'expired_time' => $expired_time, |
|
|
|
'expired_time' => $expired_time, |
|
|
|
'propagate_neg' => $propagate_neg, |
|
|
|
'propagate_neg' => $propagate_neg, |
|
|
|
|
|
|
|
'save_correct_answers' => $saveCorrectAnswers, |
|
|
|
'review_answers' => $review_answers, |
|
|
|
'review_answers' => $review_answers, |
|
|
|
'random_by_category' => $randomByCat, |
|
|
|
'random_by_category' => $randomByCat, |
|
|
|
'text_when_finished' => $text_when_finished, |
|
|
|
'text_when_finished' => $text_when_finished, |
|
|
@ -1643,7 +1664,8 @@ class Exercise |
|
|
|
'random_by_category' => $randomByCat, |
|
|
|
'random_by_category' => $randomByCat, |
|
|
|
'text_when_finished' => $text_when_finished, |
|
|
|
'text_when_finished' => $text_when_finished, |
|
|
|
'display_category_name' => $display_category_name, |
|
|
|
'display_category_name' => $display_category_name, |
|
|
|
'pass_percentage' => $pass_percentage |
|
|
|
'pass_percentage' => $pass_percentage, |
|
|
|
|
|
|
|
'save_correct_answers' => $saveCorrectAnswers |
|
|
|
]; |
|
|
|
]; |
|
|
|
|
|
|
|
|
|
|
|
$this->id = Database::insert($TBL_EXERCISES, $params); |
|
|
|
$this->id = Database::insert($TBL_EXERCISES, $params); |
|
|
@ -2154,6 +2176,11 @@ class Exercise |
|
|
|
//$check_option=$this->selectType(); |
|
|
|
//$check_option=$this->selectType(); |
|
|
|
$diplay = 'block'; |
|
|
|
$diplay = 'block'; |
|
|
|
$form->addElement('checkbox', 'propagate_neg', null, get_lang('PropagateNegativeResults')); |
|
|
|
$form->addElement('checkbox', 'propagate_neg', null, get_lang('PropagateNegativeResults')); |
|
|
|
|
|
|
|
$form->addCheckBox( |
|
|
|
|
|
|
|
'save_correct_answers', |
|
|
|
|
|
|
|
null, |
|
|
|
|
|
|
|
get_lang('Save the correct answers for the next attempt') |
|
|
|
|
|
|
|
); |
|
|
|
$form->addElement('html','<div class="clear"> </div>'); |
|
|
|
$form->addElement('html','<div class="clear"> </div>'); |
|
|
|
$form->addElement('checkbox', 'review_answers', null, get_lang('ReviewAnswers')); |
|
|
|
$form->addElement('checkbox', 'review_answers', null, get_lang('ReviewAnswers')); |
|
|
|
|
|
|
|
|
|
|
@ -2275,6 +2302,7 @@ class Exercise |
|
|
|
$defaults['exerciseFeedbackType'] = $this->selectFeedbackType(); |
|
|
|
$defaults['exerciseFeedbackType'] = $this->selectFeedbackType(); |
|
|
|
$defaults['results_disabled'] = $this->selectResultsDisabled(); |
|
|
|
$defaults['results_disabled'] = $this->selectResultsDisabled(); |
|
|
|
$defaults['propagate_neg'] = $this->selectPropagateNeg(); |
|
|
|
$defaults['propagate_neg'] = $this->selectPropagateNeg(); |
|
|
|
|
|
|
|
$defaults['save_correct_answers'] = $this->selectSaveCorrectAnswers(); |
|
|
|
$defaults['review_answers'] = $this->review_answers; |
|
|
|
$defaults['review_answers'] = $this->review_answers; |
|
|
|
$defaults['randomByCat'] = $this->selectRandomByCat(); |
|
|
|
$defaults['randomByCat'] = $this->selectRandomByCat(); |
|
|
|
$defaults['text_when_finished'] = $this->selectTextWhenFinished(); |
|
|
|
$defaults['text_when_finished'] = $this->selectTextWhenFinished(); |
|
|
@ -2366,6 +2394,7 @@ class Exercise |
|
|
|
$this->updateResultsDisabled($form->getSubmitValue('results_disabled')); |
|
|
|
$this->updateResultsDisabled($form->getSubmitValue('results_disabled')); |
|
|
|
$this->updateExpiredTime($form->getSubmitValue('enabletimercontroltotalminutes')); |
|
|
|
$this->updateExpiredTime($form->getSubmitValue('enabletimercontroltotalminutes')); |
|
|
|
$this->updatePropagateNegative($form->getSubmitValue('propagate_neg')); |
|
|
|
$this->updatePropagateNegative($form->getSubmitValue('propagate_neg')); |
|
|
|
|
|
|
|
$this->updateSaveCorrectAnswers($form->getSubmitValue('save_correct_answers')); |
|
|
|
$this->updateRandomByCat($form->getSubmitValue('randomByCat')); |
|
|
|
$this->updateRandomByCat($form->getSubmitValue('randomByCat')); |
|
|
|
$this->updateTextWhenFinished($form->getSubmitValue('text_when_finished')); |
|
|
|
$this->updateTextWhenFinished($form->getSubmitValue('text_when_finished')); |
|
|
|
$this->updateDisplayCategoryName($form->getSubmitValue('display_category_name')); |
|
|
|
$this->updateDisplayCategoryName($form->getSubmitValue('display_category_name')); |
|
|
|