diff --git a/main/exercice/draggable.class.php b/main/exercice/draggable.class.php index 6c10e6ab1b..a6dd6ca5fd 100644 --- a/main/exercice/draggable.class.php +++ b/main/exercice/draggable.class.php @@ -194,15 +194,11 @@ class Draggable extends Matching } /** - * @param null $feedback_type - * @param null $counter - * @param null $score - * @param bool $show_media - * @return string + * {@inheritdoc} */ - public function return_header($feedback_type = null, $counter = null, $score = null, $show_media = false) + public function return_header($feedback_type = null, $counter = null, $score = null, $show_media = false, $hideTitle = 0) { - $header = parent::return_header($feedback_type, $counter, $score, $show_media); + $header = parent::return_header($feedback_type, $counter, $score, $show_media, $hideTitle); $header .= ''; $header .= ' diff --git a/main/exercice/exercise.class.php b/main/exercice/exercise.class.php index 18808be0af..6f75431f85 100644 --- a/main/exercice/exercise.class.php +++ b/main/exercice/exercise.class.php @@ -4,7 +4,7 @@ * Exercise class: This class allows to instantiate an object of type Exercise * @package chamilo.exercise * @author Olivier Brouckaert - * @author Julio Montoya Cleaning exercises + * @author Julio Montoya Cleaning exercises, adding multiple categories, media questions, commitee * Modified by Hubert Borderiou #294 */ /** @@ -734,7 +734,11 @@ class Exercise if (isset($questions_by_category[$category_id])) { // How many question will be picked from this category. $count = $category_info['count_questions']; - if ($count != -1) { + + // -1 means all questions + if ($count == -1) { + $categoryCountArray[$category_id] = 999; + } else { $categoryCountArray[$category_id] = $count; } } @@ -808,6 +812,7 @@ class Exercise $categoriesAddedInExercise = $cat->getCategoryExerciseTree($this->id, $this->course['real_id'], 'title DESC', false, true); $questions_by_category = Testcategory::getQuestionsByCat($this->id, $question_list, $categoriesAddedInExercise); $question_list = $this->pickQuestionsPerCategory($categoriesAddedInExercise, $question_list, $questions_by_category, true, false); + break; case EX_Q_SELECTION_CATEGORIES_RANDOM_QUESTIONS_ORDERED: // 4 case EX_Q_SELECTION_CATEGORIES_RANDOM_QUESTIONS_ORDERED_NO_GROUPED: // 7 @@ -4625,8 +4630,8 @@ class Exercise return false; } - if (0) { - //if (!empty($this->emailNotificationTemplate)) { + //if (0) { + if (!empty($this->emailNotificationTemplate)) { $twig = new \Twig_Environment(new \Twig_Loader_String()); $twig->addFilter('var_dump', new Twig_Filter_Function('var_dump')); $template = $this->emailNotificationTemplate; @@ -6436,8 +6441,8 @@ class Exercise $tempParentId = $objQuestionTmp->parent_id; } - //Shows question title an description - $question_content .= $objQuestionTmp->return_header(null, $counterToShow, $score, $show_media); + // Shows question title an description. + $question_content .= $objQuestionTmp->return_header(null, $counterToShow, $score, $show_media, $this->getHideQuestionTitle()); // display question category, if any $question_content .= Testcategory::getCategoryNamesForQuestion($questionId); diff --git a/main/exercice/exercise_admin.php b/main/exercice/exercise_admin.php index 497c106e82..ce1c66d0eb 100644 --- a/main/exercice/exercise_admin.php +++ b/main/exercice/exercise_admin.php @@ -19,8 +19,8 @@ require_once 'answer.class.php'; require_once '../inc/global.inc.php'; $this_section = SECTION_COURSES; -if (!api_is_allowed_to_edit(null,true)) { - api_not_allowed(true); +if (!api_is_allowed_to_edit(null, true)) { + api_not_allowed(true); } $url = api_get_path(WEB_AJAX_PATH).'exercise.ajax.php?1=1'; @@ -232,12 +232,12 @@ $course_id = api_get_course_int_id(); //INIT FORM if (isset($_GET['exerciseId'])) { - $form = new FormValidator('exercise_admin', 'post', api_get_self().'?'.api_get_cidreq().'&exerciseId='.intval($_GET['exerciseId'])); - $objExercise->read($_GET['exerciseId']); - $form->addElement('hidden','edit','true'); + $form = new FormValidator('exercise_admin', 'post', api_get_self().'?'.api_get_cidreq().'&exerciseId='.intval($_GET['exerciseId'])); + $objExercise->read($_GET['exerciseId']); + $form->addElement('hidden', 'edit', 'true'); } else { - $form = new FormValidator('exercise_admin','post',api_get_self().'?'.api_get_cidreq()); - $form->addElement('hidden','edit','false'); + $form = new FormValidator('exercise_admin','post',api_get_self().'?'.api_get_cidreq()); + $form->addElement('hidden', 'edit', 'false'); } $objExercise->createForm($form); @@ -256,48 +256,48 @@ if ($form->validate()) { exit; } else { // DISPLAY FORM - if (isset($_SESSION['gradebook'])) { - $gradebook= $_SESSION['gradebook']; - - } + if (isset($_SESSION['gradebook'])) { + $gradebook= $_SESSION['gradebook']; + } - if (!empty($gradebook) && $gradebook=='view') { - $interbreadcrumb[]= array ('url' => '../gradebook/'.$_SESSION['gradebook_dest'],'name' => get_lang('ToolGradebook')); - } - $nameTools = get_lang('ExerciseManagement'); - $interbreadcrumb[] = array("url"=>'exercice.php', 'name'=> get_lang('Exercices')); + if (!empty($gradebook) && $gradebook=='view') { + $interbreadcrumb[]= array ('url' => '../gradebook/'.$_SESSION['gradebook_dest'],'name' => get_lang('ToolGradebook')); + } + $nameTools = get_lang('ExerciseManagement'); + $interbreadcrumb[] = array("url"=>'exercice.php', 'name'=> get_lang('Exercices')); $interbreadcrumb[] = array("url"=>"admin.php?exerciseId=".$objExercise->id, "name" => $objExercise->name); - Display::display_header($nameTools,get_lang('Exercise')); + Display::display_header($nameTools,get_lang('Exercise')); echo '
'; - if ($objExercise->id != 0) { - echo '' . Display :: return_icon('back.png', get_lang('GoBackToQuestionList'),'',ICON_SIZE_MEDIUM).''; - } else { - if (!empty($_GET['lp_id']) || !empty($_POST['lp_id'])){ - if (!empty($_POST['lp_id'])){ - $lp_id = Security::remove_XSS($_POST['lp_id']);//TODO:this remains to be implemented after press the first post - } else { - $lp_id = Security::remove_XSS($_GET['lp_id']); - } - echo "".Display::return_icon('back.png', get_lang("BackTo").' '.get_lang("LearningPaths"),'',ICON_SIZE_MEDIUM).""; + if ($objExercise->id != 0) { + echo '' . Display :: return_icon('back.png', get_lang('GoBackToQuestionList'),'',ICON_SIZE_MEDIUM).''; + } else { + if (!empty($_GET['lp_id']) || !empty($_POST['lp_id'])){ + if (!empty($_POST['lp_id'])){ + $lp_id = Security::remove_XSS($_POST['lp_id']);//TODO:this remains to be implemented after press the first post + } else { + $lp_id = Security::remove_XSS($_GET['lp_id']); + } + echo "".Display::return_icon('back.png', get_lang("BackTo").' '.get_lang("LearningPaths"),'',ICON_SIZE_MEDIUM).""; } else { - echo '' . Display :: return_icon('back.png', get_lang('BackToExercisesList'),'',ICON_SIZE_MEDIUM).''; - } - } + echo '' . Display :: return_icon('back.png', get_lang('BackToExercisesList'),'',ICON_SIZE_MEDIUM).''; + } + } echo '
'; - if ($objExercise->feedback_type == 1) - Display::display_normal_message(get_lang('DirectFeedbackCantModifyTypeQuestion')); + if ($objExercise->feedback_type == 1) { + Display::display_normal_message(get_lang('DirectFeedbackCantModifyTypeQuestion')); + } - if (api_get_setting('search_enabled')=='true' && !extension_loaded('xapian')) { - Display::display_error_message(get_lang('SearchXapianModuleNotInstalled')); - } + if (api_get_setting('search_enabled')=='true' && !extension_loaded('xapian')) { + Display::display_error_message(get_lang('SearchXapianModuleNotInstalled')); + } if ($objExercise->id != 0 && $objExercise->edit_exercise_in_lp == false) { $form->freeze(); } - $form->display(); + $form->display(); } Display::display_footer(); diff --git a/main/exercice/exercise_show.php b/main/exercice/exercise_show.php index 2dc4762816..92a2ffc178 100644 --- a/main/exercice/exercise_show.php +++ b/main/exercice/exercise_show.php @@ -285,6 +285,7 @@ foreach ($questionList as $questionId) { $choice = $exerciseResult[$questionId]; // creates a temporary Question object + /** @var Question $objQuestionTmp */ $objQuestionTmp = Question::read($questionId); $questionWeighting = $objQuestionTmp->selectWeighting(); @@ -579,13 +580,6 @@ foreach ($questionList as $questionId) { $category_was_added_for_this_test = false; - // We use now category_list instead of a unique category - /*if (isset($objQuestionTmp->category) && !empty($objQuestionTmp->category)) { - $category_list[$objQuestionTmp->category]['score'] += $my_total_score; - $category_list[$objQuestionTmp->category]['total'] += $my_total_weight; - $category_was_added_for_this_test = true; - }*/ - if (isset($objQuestionTmp->category_list) && !empty($objQuestionTmp->category_list)) { foreach ($objQuestionTmp->category_list as $category_id) { @@ -630,11 +624,8 @@ foreach ($questionList as $questionId) { $i++; $contents = ob_get_clean(); - $question_content = '
'; - $show_media = false; - $counterToShow = $counter; if ($objQuestionTmp->parent_id != 0) { @@ -653,9 +644,10 @@ foreach ($questionList as $questionId) { } if ($show_results) { - //Shows question title an description + // Shows question title an description + //$question_content .= $objQuestionTmp->return_header(null, $counterToShow, $score, $show_media, $mediaCounter, ); - $question_content .= $objQuestionTmp->return_header(null, $counterToShow, $score, $show_media, $mediaCounter); + $question_content .= $objQuestionTmp->return_header(null, $counterToShow, $score, $show_media, $objExercise->getHideQuestionTitle()); // display question category, if any $question_content .= Testcategory::getCategoryNamesForQuestion($questionId); @@ -712,7 +704,7 @@ if ($is_allowedToEdit && $locked == false && !api_is_drh()) { echo ' '; echo ' '; } else { - echo '
'; + echo ''; } if ($origin !='learnpath' && $origin!='student_progress') { diff --git a/main/exercice/exercise_submit.php b/main/exercice/exercise_submit.php index 4c4d1c16a6..359456db6e 100644 --- a/main/exercice/exercise_submit.php +++ b/main/exercice/exercise_submit.php @@ -340,8 +340,6 @@ if (api_is_allowed_to_edit(null, true) && isset($_GET['preview']) && $_GET['prev /** @var \Exercise $exerciseInSession */ $exerciseInSession = Session::read('objExercise'); - - // 1. Loading the $objExercise variable if (!isset($exerciseInSession) || isset($exerciseInSession) && ($exerciseInSession->id != $_GET['exerciseId'])) { // Construction of Exercise @@ -369,11 +367,13 @@ if (!isset($exerciseInSession) || isset($exerciseInSession) && ($exerciseInSessi } } -// $objExercise = new Exercise(); $objExercise->read($exerciseId); +//$objExercise = new Exercise(); $objExercise->read($exerciseId); //2. Checking if $objExercise is set if (!isset($objExercise) && isset($exerciseInSession)) { - if ($debug) { error_log('2. Loading $objExercise from session'); }; + if ($debug) { + error_log('2. Loading $objExercise from session'); + } $objExercise = $exerciseInSession; } @@ -403,7 +403,7 @@ if ($objExercise->expired_time != 0) { $time_control = true; } -//Generating the time control key for the user +// Generating the time control key for the user. $current_expired_time_key = ExerciseLib::get_time_control_key($objExercise->id, $learnpath_id, $learnpath_item_id); if ($debug) { error_log("4. current_expired_time_key: $current_expired_time_key"); @@ -485,7 +485,7 @@ if ($objExercise->selectAttempts() > 0) { if ($origin == 'learnpath') { Display::display_reduced_header(); } else { - Display::display_header($nameTools,'Exercises'); + Display::display_header($nameTools, 'Exercises'); } echo $attempt_html; @@ -517,9 +517,9 @@ if (!isset($questionListInSession)) { error_log('$_SESSION[questionList] was set'); } } else { - if (isset($objExercise) && isset($exerciseInSession)) { + if (isset($objExercise) && isset($exerciseInSession)) { $questionList = Session::read('questionList'); - } + } } //Fix in order to get the correct question list @@ -530,7 +530,7 @@ Session::write('question_list_uncompressed', $questionListUncompressed); $clock_expired_time = null; if (empty($exercise_stat_info)) { - if ($debug) { + if ($debug) { error_log('5 $exercise_stat_info is empty '); } $total_weight = 0; @@ -542,19 +542,18 @@ if (empty($exercise_stat_info)) { if ($time_control) { $expected_time = $current_timestamp + $total_seconds; - - if ($debug) error_log('5.1. $current_timestamp '.$current_timestamp); - if ($debug) error_log('5.2. $expected_time '.$expected_time); - $clock_expired_time = api_get_utc_datetime($expected_time); - if ($debug) error_log('5.3. $expected_time '.$clock_expired_time); - //Sessions that contain the expired time $expiredTime = array( $current_expired_time_key => $clock_expired_time ); - Session::write('expired_time', $expiredTime); - if ($debug) { error_log('5.4. Setting the $expiredTime: '.$expiredTime[$current_expired_time_key] ); }; + + if ($debug) { + error_log('5.1. $current_timestamp '.$current_timestamp); + error_log('5.2. $expected_time '.$expected_time); + error_log('5.3. $expected_time '.$clock_expired_time); + error_log('5.4. Setting the $expiredTime: '.$expiredTime[$current_expired_time_key]); + } } $exe_id = $objExercise->save_stat_track_exercise_info($clock_expired_time, $learnpath_id, $learnpath_item_id, $learnpath_item_view_id, $questionListUncompressed, $total_weight); $exercise_stat_info = $objExercise->getStatTrackExerciseInfo($learnpath_id, $learnpath_item_id, $learnpath_item_view_id); @@ -567,13 +566,16 @@ if (empty($exercise_stat_info)) { // Array to check in order to block the chat ExerciseLib::create_chat_exercise_session($exe_id); -if ($debug) { error_log('6. $objExercise->getStatTrackExerciseInfo function called:: '.print_r($exercise_stat_info, 1)); }; +if ($debug) { + error_log('6. $objExercise->getStatTrackExerciseInfo function called:: '.print_r($exercise_stat_info, 1)); +} if (!empty($exercise_stat_info['questions_to_check'])) { $my_remind_list = $exercise_stat_info['questions_to_check']; $my_remind_list = explode(',', $my_remind_list); $my_remind_list = array_filter($my_remind_list); } + if ($debug) { error_log("6.0 my_remind_list array: ".print_r($my_remind_list, 1)); } $params = "exe_id=$exe_id&exerciseId=$exerciseId&origin=$origin&learnpath_id=$learnpath_id&learnpath_item_id=$learnpath_item_id&learnpath_item_view_id=$learnpath_item_view_id&".api_get_cidreq(); @@ -593,8 +595,10 @@ if ($reminder == 2 && empty($my_remind_list)) { if ($time_control) { $expiredTimeInSession = Session::read('expired_time'); - if ($debug) error_log('7.1. Time control is enabled.'); - if ($debug) error_log('7.2. $current_expired_time_key:'.$current_expired_time_key); + if ($debug) { + error_log('7.1. Time control is enabled.'); + error_log('7.2. $current_expired_time_key:'.$current_expired_time_key); + } if (!isset($expiredTimeInSession[$current_expired_time_key])) { if ($debug) error_log('7.3. $expiredTimeInSession[$current_expired_time_key] not set.'); //Timer - Get expired_time for a student @@ -716,8 +720,10 @@ if ($formSent && isset($_POST)) { } } } - if ($debug) { error_log('9.3. $choice is an array - end'); } - if ($debug) { error_log('9.4. $exerciseResult '.print_r($exerciseResult,1)); } + if ($debug) { + error_log('9.3. $choice is an array - end'); + error_log('9.4. $exerciseResult '.print_r($exerciseResult,1)); + } } // the script "exercise_result.php" will take the variable $exerciseResult from the session @@ -950,7 +956,7 @@ if (isset($_custom['exercises_hidden_when_no_start_date']) && $_custom['exercise } } -//Timer control +// Timer control. if ($time_control) { echo $objExercise->returnTimeLeftDiv(); echo ''; @@ -1023,7 +1029,7 @@ if ($objExercise->review_answers) { if (!empty($error)) { - Display :: display_error_message($error, false); + Display::display_error_message($error, false); } else { if (!empty($exercise_sound)) { echo ' diff --git a/main/exercice/fill_blanks.class.php b/main/exercice/fill_blanks.class.php index 2a34a63a05..fb55e0d88e 100644 --- a/main/exercice/fill_blanks.class.php +++ b/main/exercice/fill_blanks.class.php @@ -193,9 +193,12 @@ class FillBlanks extends Question $objAnswer->save(); } - function return_header($feedback_type = null, $counter = null, $score = null, $show_media = false) + /** + * {@inheritdoc} + */ + function return_header($feedback_type = null, $counter = null, $score = null, $show_media = false, $hideTitle = 0) { - $header = parent::return_header($feedback_type, $counter, $score, $show_media); + $header = parent::return_header($feedback_type, $counter, $score, $show_media, $hideTitle); $header .= '
'.get_lang('ElementList').'
diff --git a/main/exercice/freeanswer.class.php b/main/exercice/freeanswer.class.php index 58453aa96f..b7f84f1dae 100644 --- a/main/exercice/freeanswer.class.php +++ b/main/exercice/freeanswer.class.php @@ -63,14 +63,17 @@ class FreeAnswer extends Question $this->save(); } - function return_header($feedback_type = null, $counter = null, $score = null, $show_media = false) + /** + * {@inheritdoc} + */ + function return_header($feedback_type = null, $counter = null, $score = null, $show_media = false, $hideTitle = 0) { if (!empty($score['comments']) || $score['score'] > 0) { $score['revised'] = true; } else { $score['revised'] = false; } - $header = parent::return_header($feedback_type, $counter, $score, $show_media); + $header = parent::return_header($feedback_type, $counter, $score, $show_media, $hideTitle); $header .= '
'.get_lang("Answer").'
diff --git a/main/exercice/global_multiple_answer.class.php b/main/exercice/global_multiple_answer.class.php index 2324ac3855..611c677e7a 100644 --- a/main/exercice/global_multiple_answer.class.php +++ b/main/exercice/global_multiple_answer.class.php @@ -269,9 +269,12 @@ class GlobalMultipleAnswer extends Question $this->save(); } - function return_header($feedback_type = null, $counter = null, $score = null, $show_media = false) + /** + * {@inheritdoc} + */ + function return_header($feedback_type = null, $counter = null, $score = null, $show_media = false, $hideTitle = 0) { - $header = parent::return_header($feedback_type, $counter, $score, $show_media); + $header = parent::return_header($feedback_type, $counter, $score, $show_media, $hideTitle); $header .= '
'.get_lang("Answer").'
diff --git a/main/exercice/matching.class.php b/main/exercice/matching.class.php index 05d2c6e52b..5b7d07a5ed 100644 --- a/main/exercice/matching.class.php +++ b/main/exercice/matching.class.php @@ -255,15 +255,11 @@ class Matching extends Question } /** - * @param null $feedback_type - * @param null $counter - * @param null $score - * @param bool $show_media - * @return string + * {@inheritdoc} */ - function return_header($feedback_type = null, $counter = null, $score = null, $show_media = false) + function return_header($feedback_type = null, $counter = null, $score = null, $show_media = false, $hideTitle = 0) { - $header = parent::return_header($feedback_type, $counter, $score, $show_media); + $header = parent::return_header($feedback_type, $counter, $score, $show_media, $hideTitle); if ($this->type == MATCHING) { $header .= '
'.get_lang("Choice").'
'; $header .= ' diff --git a/main/exercice/multiple_answer.class.php b/main/exercice/multiple_answer.class.php index 2fa0bfc93f..7599aa4b07 100644 --- a/main/exercice/multiple_answer.class.php +++ b/main/exercice/multiple_answer.class.php @@ -255,15 +255,11 @@ class MultipleAnswer extends Question } /** - * @param int $feedback_type - * @param int $counter - * @param string $score - * @param bool $show_media - * @return string + * {@inheritdoc} */ - public function return_header($feedback_type = null, $counter = null, $score = null, $show_media = false) + public function return_header($feedback_type = null, $counter = null, $score = null, $show_media = false, $hideTitle = 0) { - $header = parent::return_header($feedback_type, $counter, $score, $show_media); + $header = parent::return_header($feedback_type, $counter, $score, $show_media, $hideTitle); $header .= '
diff --git a/main/exercice/multiple_answer_combination.class.php b/main/exercice/multiple_answer_combination.class.php index c96a1eba84..353566fb80 100644 --- a/main/exercice/multiple_answer_combination.class.php +++ b/main/exercice/multiple_answer_combination.class.php @@ -250,9 +250,12 @@ class MultipleAnswerCombination extends Question $this->save(); } - function return_header($feedback_type = null, $counter = null, $score = null, $show_media = false) + /** + * {@inheritdoc} + */ + function return_header($feedback_type = null, $counter = null, $score = null, $show_media = false, $hideTitle = 0) { - $header = parent::return_header($feedback_type, $counter, $score, $show_media); + $header = parent::return_header($feedback_type, $counter, $score, $show_media, $hideTitle); $header .= '
'.get_lang("Choice").'
diff --git a/main/exercice/multiple_answer_true_false.class.php b/main/exercice/multiple_answer_true_false.class.php index 84fec8f180..90cbde4963 100644 --- a/main/exercice/multiple_answer_true_false.class.php +++ b/main/exercice/multiple_answer_true_false.class.php @@ -343,9 +343,12 @@ class MultipleAnswerTrueFalse extends Question $this->save(); } - function return_header($feedback_type = null, $counter = null, $score = null, $show_media = false) + /** + * {@inheritdoc} + */ + function return_header($feedback_type = null, $counter = null, $score = null, $show_media = false, $hideTitle = 0) { - $header = parent::return_header($feedback_type, $counter, $score, $show_media); + $header = parent::return_header($feedback_type, $counter, $score, $show_media, $hideTitle); $header .= '
'.get_lang("Choice").'
diff --git a/main/exercice/oral_expression.class.php b/main/exercice/oral_expression.class.php index 3cee6b4221..e202b08a87 100644 --- a/main/exercice/oral_expression.class.php +++ b/main/exercice/oral_expression.class.php @@ -47,27 +47,32 @@ class OralExpression extends Question } } - /** - * abstract function which creates the form to create / edit the answers of the question - * @param the formvalidator instance - */ - function processAnswersCreation($form) { - $this->weighting = $form -> getSubmitValue('weighting'); - $this->save(); - } + /** + * abstract function which creates the form to create / edit the answers of the question + * @param FormValidator instance + */ + function processAnswersCreation($form) + { + $this->weighting = $form -> getSubmitValue('weighting'); + $this->save(); + } - function return_header($feedback_type = null, $counter = null, $score = null, $show_media = false) { - $header = parent::return_header($feedback_type, $counter, $score, $show_media); - $header .= '
'.get_lang("Choice").'
- + /** + * {@inheritdoc} + */ + function return_header($feedback_type = null, $counter = null, $score = null, $show_media = false, $hideTitle = 0) + { + $header = parent::return_header($feedback_type, $counter, $score, $show_media, $hideTitle); + $header .= '
+ - - + + - - + + - '; + '; return $header; - } + } } diff --git a/main/exercice/question.class.php b/main/exercice/question.class.php index 5a260a46dc..4f81fb7fe2 100644 --- a/main/exercice/question.class.php +++ b/main/exercice/question.class.php @@ -39,7 +39,8 @@ abstract class Question public static $explanationLangVar = ''; public $question_table_class = 'table table-striped'; public $editionMode = 'normal'; - public $exercise; // exercise obj + /** @var Exercise $exercise */ + public $exercise; public $setDefaultValues = false; public $submitClass; public $submitText; @@ -129,7 +130,7 @@ abstract class Question } /** - * Reads question informations from the data base + * Reads question information from the database * * @author Olivier Brouckaert * @param int $id - question ID @@ -1770,47 +1771,53 @@ abstract class Question * * @param int $feedback_type * @param int $counter - * @param type $score + * @param array $score * @param bool $show_media + * @param int $hideTitle * * @return string */ - public function return_header($feedback_type = null, $counter = null, $score = null, $show_media) + public function return_header($feedbackType = null, $counter = null, $score = null, $show_media = false, $hideTitle = 0) { - $counterLabel = ''; + $counterLabel = null; if (!empty($counter)) { $counterLabel = $counter; } $score_label = get_lang('Wrong'); - $class = 'error'; + $class = 'error'; if ($score['pass'] == true) { $score_label = get_lang('Correct'); - $class = 'success'; + $class = 'success'; } if ($this->type == FREE_ANSWER || $this->type == ORAL_EXPRESSION) { if ($score['revised'] == true) { $score_label = get_lang('Revised'); - $class = ''; + $class = ''; } else { $score_label = get_lang('NotRevised'); - $class = 'error'; + $class = 'error'; } } - $question_title = $this->question; - $header = null; // Display question category, if any if ($show_media) { $header .= $this->show_media_content(); } - $header .= Display::page_subheader2($counterLabel.". ".$question_title); + + if ($hideTitle == 1) { + $header .= Display::page_subheader2($counterLabel); + } else { + $header .= Display::page_subheader2($counterLabel.". ".$this->question); + } + $header .= Display::div( '

'.$score_label.'

'.$score['result'].'

', array('class' => 'ribbon') ); + $header .= Display::div($this->description, array('id' => 'question_description')); return $header; diff --git a/main/exercice/testcategory.class.php b/main/exercice/testcategory.class.php index 0e2ce02c0a..a46aff8269 100644 --- a/main/exercice/testcategory.class.php +++ b/main/exercice/testcategory.class.php @@ -1039,9 +1039,12 @@ class Testcategory //$list = array(); while ($row = Database::fetch_array($result, 'ASSOC')) { if ($excludeCategoryWithNoQuestions) { - if ($row['count_questions'] == 0 || $row['count_questions'] == -1) { - continue; - } + //if ($row['count_questions'] == 0 || $row['count_questions'] == -1) { + /*0 means no questions selected this options is also filtered in the function: + Exercise::pickQuestionsPerCategory() */ + if ($row['count_questions'] == 0) { + continue; + } } $categories[$row['category_id']] = $row; } @@ -1073,6 +1076,7 @@ class Testcategory $real_question_count = count($exercise_obj->getQuestionList()); $warning = null; + if ($nbQuestionsTotal != $real_question_count) { $warning = Display::return_message(get_lang('CheckThatYouHaveEnoughQuestionsInYourCategories'), 'warning'); } @@ -1090,12 +1094,14 @@ class Testcategory $return .= Display::div($category['parent_path']); $return .= ''; $return .= '
'; $return .= ''; } $return .= '
 
'.get_lang("Answer").'
 
'; - $value = isset($saved_categories) && isset($saved_categories[$cat_id]) ? $saved_categories[$cat_id]['count_questions'] : 0; + $value = isset($saved_categories) && isset($saved_categories[$cat_id]) ? $saved_categories[$cat_id]['count_questions'] : -1; $return .= ''; $return .= '
'; + + $return .= get_lang('ZeroMeansNoQuestionWillBeSelectedMinusOneMeansThatAllQuestionsWillBeSelected'); return $return; } } diff --git a/main/exercice/unique_answer.class.php b/main/exercice/unique_answer.class.php index 4ebfc8c0c1..2fe3752b10 100644 --- a/main/exercice/unique_answer.class.php +++ b/main/exercice/unique_answer.class.php @@ -414,9 +414,12 @@ class UniqueAnswer extends Question $this->save(); } - public function return_header($feedback_type = null, $counter = null, $score = null, $show_media = false) + /** + * {@inheritdoc} + */ + public function return_header($feedback_type = null, $counter = null, $score = null, $show_media = false, $hideTitle = 0) { - $header = parent::return_header($feedback_type, $counter, $score, $show_media); + $header = parent::return_header($feedback_type, $counter, $score, $show_media, $hideTitle); $header .= ' diff --git a/main/exercice/unique_answer_image.class.php b/main/exercice/unique_answer_image.class.php index 761379d44d..22eba42766 100644 --- a/main/exercice/unique_answer_image.class.php +++ b/main/exercice/unique_answer_image.class.php @@ -354,14 +354,10 @@ class UniqueAnswerImage extends UniqueAnswer } /** - * @param int $feedback_type - * @param int $counter - * @param int $score - * @param bool $show_media - * @return string + * {@inheritdoc} */ - public function return_header($feedback_type = null, $counter = null, $score = null, $show_media = false) + public function return_header($feedback_type = null, $counter = null, $score = null, $show_media = false, $hideTitle = 0) { - return parent::return_header($feedback_type, $counter, $score, $show_media); + return parent::return_header($feedback_type, $counter, $score, $show_media, $hideTitle); } } diff --git a/main/exercice/unique_answer_no_option.class.php b/main/exercice/unique_answer_no_option.class.php index 2b6b6cfb69..932f3eb5e7 100644 --- a/main/exercice/unique_answer_no_option.class.php +++ b/main/exercice/unique_answer_no_option.class.php @@ -396,8 +396,12 @@ class UniqueAnswerNoOption extends Question $this -> save(); } - function return_header($feedback_type = null, $counter = null, $score = null, $show_media = false) { - $header = parent::return_header($feedback_type, $counter, $score, $show_media); + /** + * {@inheritdoc} + */ + function return_header($feedback_type = null, $counter = null, $score = null, $show_media = false, $hideTitle = 0) + { + $header = parent::return_header($feedback_type, $counter, $score, $show_media, $hideTitle); $header .= '
'.get_lang("Choice").'
diff --git a/main/locale/en.po b/main/locale/en.po index da5ca857b6..b68cab845c 100644 --- a/main/locale/en.po +++ b/main/locale/en.po @@ -8719,11 +8719,11 @@ msgstr "Skills ranking updated" msgid "CertificateWCertifiesStudentXFinishedCourseYWithGradeZ" msgstr "%s certifies that - %s + %s -has successfully completed the course +has successfully completed the course - '%s' + '%s' with a grade of @@ -19454,7 +19454,7 @@ msgid "ButtonPublishAnnouncement" msgstr "Send announcement" msgid "YourAccountIsActiveYouCanLoginAndCheckYourCourses" -msgstr "Dear user, +msgstr "Dear user, Your account has now been activated on the platform. Please login and enjoy your courses." @@ -20881,7 +20881,7 @@ msgid "langAddress" msgstr "The address of" msgid "langSettings" -msgstr "with the following settings : +msgstr "with the following settings : Login :" msgid "langYouAreReg" @@ -23634,3 +23634,5 @@ msgstr "Description updated" msgid "CourseDescriptions" msgstr "Course descriptions" +msgid "ZeroMeansNoQuestionWillBeSelectedMinusOneMeansThatAllQuestionsWillBeSelected" +msgstr "-1 = All questions will be selected. 0 = No questions will be selected." diff --git a/main/locale/es.po b/main/locale/es.po index 20c7b7cac4..7436e13718 100644 --- a/main/locale/es.po +++ b/main/locale/es.po @@ -3062,7 +3062,7 @@ La carpeta de los usuarios y las carpetas que contiene de cada uno de ellos, se Si se hace visible la carpeta de los usuarios y la carpeta de uno o más alumnos, el resto de los alumnos podrán ver todo su contenido. En este caso, el alumno propietario de la carpeta también podrá desde la herramienta documentos (sólo dentro de su carpeta): crear y editar documentos web, convertir un documento web en una plantilla para uso personal, crear y editar dibujos SVG y PNG, grabar archivos de audio en formato WAV, convertir texto en audio en formato MP3, realizar capturas a través de su webcam, enviar documentos, crear carpetas, mover carpetas y archivos, borrar carpetas y archivos, y descargar copias de seguridad de su carpeta. -Por otra parte, la herramienta documentos se sincroniza con el gestor de archivos del editor web, así que los cambios en la gestión de los documentos realizados en una u otra afectarán a ambas. +Por otra parte, la herramienta documentos se sincroniza con el gestor de archivos del editor web, así que los cambios en la gestión de los documentos realizados en una u otra afectarán a ambas. Así pues, la carpeta de usuario no sólo es un lugar para depositar los archivos, sino que se convierte en un completo gestor de los documentos que los estudiantes utilizan durante el curso. Además, recuerde que cualquier usuario podrá copiar un archivo, que sea visible, de cualquier carpeta de la herramienta documentos (sea o no la suya) a su portafolios o área personal de documentos de la red social, donde estará disponible para que lo pueda usar en otros cursos." @@ -8721,13 +8721,13 @@ msgstr "Puntuación actualizada" msgid "CertificateWCertifiesStudentXFinishedCourseYWithGradeZ" msgstr "%s certifica que - %s + %s -ha realizado el curso +ha realizado el curso - '%s' + '%s' -con la calificación de +con la calificación de '%s'" @@ -12864,7 +12864,7 @@ msgid "UseUsersTimezoneTitle" msgstr "Utilizar las zonas horarias de los usuarios" msgid "UseUsersTimezoneComment" -msgstr "Activar la selección por los usuarios de su zona horaria. El campo de zona horaria debe seleccionarse como visible y modificable antes de que los usuarios elijan su cuenta. +msgstr "Activar la selección por los usuarios de su zona horaria. El campo de zona horaria debe seleccionarse como visible y modificable antes de que los usuarios elijan su cuenta. Una vez configurada los usuarios podrán verla." msgid "FieldTypeTimezone" @@ -13484,7 +13484,7 @@ msgstr "Herramienta de videoconferencia BigBlueButton" msgid "BigBlueButtonEnableComment" msgstr "Seleccione si desea habilitar la herramienta de videoconferencia BigBlueButton. Una vez activada, se mostrará como una herramienta en la página principal todos los curso. Los profesores podrán lanzar una videoconferencia en cualquier momento, pero los estudiantes sólo podrán unirse a una ya lanzada. -Si no dispone de un servidor BigBlueButton, pruebe a +Si no dispone de un servidor BigBlueButton, pruebe a configurar uno o pida ayuda a los proveedores oficiales de Chamilo. BigBlueButton es libre, pero su instalación requiere ciertas habilidades técnicas que no todo el mundo posee. Puede instalarlo por su cuenta o buscar ayuda profesional con el consiguiente costo. En la lógica del software libre, nosotros le ofrecemos las herramientas para hacer más fácil su trabajo y le recomendamos profesionales (los proveedores oficiales de Chamilo) que serán capaces de ayudarle." @@ -16261,13 +16261,13 @@ msgstr "Aceptar los términos legales" msgid "EmailNotificationTemplateDescription" -msgstr "Puede modificar el correo enviado a los usuarios al terminar el ejercicio. Puede usar los siguientes términos: +msgstr "Puede modificar el correo enviado a los usuarios al terminar el ejercicio. Puede usar los siguientes términos: {{ student.username }} -{{ student.firstname }} +{{ student.firstname }} {{ student.lastname }} -{{ student.official_code }} -{{ exercise.title }} +{{ student.official_code }} +{{ exercise.title }} {{ exercise.start_time }} {{ exercise.end_time }} {{ course.title }} @@ -22853,12 +22853,12 @@ msgid "ReservationDenied" msgstr "Su reserva #ITEM# ha sido negada" msgid "ReservationForItemAccepted" -msgstr "Estimado/a Señor(a), +msgstr "Estimado/a Señor(a), Su reserva para #ITEM# de #BEGIN hasta #END ha sido aceptado." msgid "ReservationForItemDenied" -msgstr "Estado/a Señor(a), +msgstr "Estado/a Señor(a), su reservación para #ITEM# de #BEGIN hasta #END ha sido rechazada." @@ -22875,7 +22875,7 @@ msgstr "Estimado/a Señor(a), Usted recibirá un correo electrónico cuando este disponible nuevamente, disculpenos por los inconvenientes." msgid "ReservationAvailable" -msgstr "Estimado/a Señor(a), +msgstr "Estimado/a Señor(a), Queremos informarle que #NAME# está disponible otra vez por lo que su reserva de #BEGIN# hasta #END# está de nuevamente activa." @@ -23514,3 +23514,5 @@ msgstr "Descripción actualizada" msgid "CourseDescriptions" msgstr "Descripción del curso" +msgid "ZeroMeansNoQuestionWillBeSelectedMinusOneMeansThatAllQuestionsWillBeSelected" +msgstr "-1 = Todas las preguntas serán seleccionadas. 0 = Ninguna pregunta será seleccionada."
'.get_lang("Choice").'