|
|
|
@ -89,6 +89,7 @@ class Exercise |
|
|
|
|
public $autolaunch; |
|
|
|
|
public $exerciseCategoryId; |
|
|
|
|
public $pageResultConfiguration; |
|
|
|
|
public $preventBackwards; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Constructor of the class. |
|
|
|
@ -129,6 +130,7 @@ class Exercise |
|
|
|
|
$this->notifications = []; |
|
|
|
|
$this->exerciseCategoryId = null; |
|
|
|
|
$this->pageResultConfiguration; |
|
|
|
|
$this->preventBackwards = 0; |
|
|
|
|
|
|
|
|
|
if (!empty($courseId)) { |
|
|
|
|
$courseInfo = api_get_course_info_by_id($courseId); |
|
|
|
@ -201,6 +203,7 @@ class Exercise |
|
|
|
|
$this->hideQuestionTitle = isset($object->hide_question_title) ? (int) $object->hide_question_title : 0; |
|
|
|
|
$this->autolaunch = isset($object->autolaunch) ? (int) $object->autolaunch : 0; |
|
|
|
|
$this->exerciseCategoryId = isset($object->exercise_category_id) ? (int) $object->exercise_category_id : null; |
|
|
|
|
$this->preventBackwards = isset($object->prevent_backwards) ? (int) $object->prevent_backwards : 0; |
|
|
|
|
|
|
|
|
|
$this->notifications = []; |
|
|
|
|
if (!empty($object->notifications)) { |
|
|
|
@ -1588,6 +1591,10 @@ class Exercise |
|
|
|
|
$paramsExtra['show_previous_button'] = $this->showPreviousButton(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (api_get_configuration_value('quiz_prevent_backwards_move')) { |
|
|
|
|
$paramsExtra['prevent_backwards'] = $this->getPreventBackwards(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$allow = api_get_configuration_value('allow_exercise_categories'); |
|
|
|
|
if ($allow === true) { |
|
|
|
|
if (!empty($this->getExerciseCategoryId())) { |
|
|
|
@ -1678,6 +1685,10 @@ class Exercise |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (api_get_configuration_value('quiz_prevent_backwards_move')) { |
|
|
|
|
$params['prevent_backwards'] = $this->getPreventBackwards(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$allow = api_get_configuration_value('allow_quiz_show_previous_button_setting'); |
|
|
|
|
if ($allow === true) { |
|
|
|
|
$params['show_previous_button'] = $this->showPreviousButton(); |
|
|
|
@ -2372,6 +2383,14 @@ class Exercise |
|
|
|
|
get_lang('UpdateTitleInLps') |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
if (api_get_configuration_value('quiz_prevent_backwards_move')) { |
|
|
|
|
$form->addCheckBox( |
|
|
|
|
'prevent_backwards', |
|
|
|
|
null, |
|
|
|
|
get_lang('QuizPreventBackwards') |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$defaults = []; |
|
|
|
|
if (api_get_setting('search_enabled') === 'true') { |
|
|
|
|
require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php'; |
|
|
|
@ -2451,6 +2470,7 @@ class Exercise |
|
|
|
|
$defaults['hide_question_title'] = $this->getHideQuestionTitle(); |
|
|
|
|
$defaults['show_previous_button'] = $this->showPreviousButton(); |
|
|
|
|
$defaults['exercise_category_id'] = $this->getExerciseCategoryId(); |
|
|
|
|
$defaults['prevent_backwards'] = $this->getPreventBackwards(); |
|
|
|
|
|
|
|
|
|
if (!empty($this->start_time)) { |
|
|
|
|
$defaults['activate_start_date_check'] = 1; |
|
|
|
@ -2632,6 +2652,7 @@ class Exercise |
|
|
|
|
$this->setNotifications($form->getSubmitValue('notifications')); |
|
|
|
|
$this->setExerciseCategoryId($form->getSubmitValue('exercise_category_id')); |
|
|
|
|
$this->setPageResultConfiguration($form->getSubmitValues()); |
|
|
|
|
$this->preventBackwards = (int) $form->getSubmitValue('prevent_backwards'); |
|
|
|
|
|
|
|
|
|
$this->start_time = null; |
|
|
|
|
if ($form->getSubmitValue('activate_start_date_check') == 1) { |
|
|
|
@ -3224,7 +3245,7 @@ class Exercise |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ($showPreview) { |
|
|
|
|
if ($showPreview && 0 === $this->getPreventBackwards()) { |
|
|
|
|
$buttonList[] = Display::button( |
|
|
|
|
'previous_question_and_save', |
|
|
|
|
get_lang('PreviousQuestion'), |
|
|
|
@ -7941,6 +7962,16 @@ class Exercise |
|
|
|
|
return $this->showPreviousButton; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function getPreventBackwards() |
|
|
|
|
{ |
|
|
|
|
$allow = api_get_configuration_value('quiz_prevent_backwards_move'); |
|
|
|
|
if ($allow === false) { |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return (int) $this->preventBackwards; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @return int |
|
|
|
|
*/ |
|
|
|
|