diff --git a/main/css/base.css b/main/css/base.css index 7895e666ac..861190ff43 100755 --- a/main/css/base.css +++ b/main/css/base.css @@ -5865,3 +5865,41 @@ ul.holder li.bit-box{ border-radius: 50%; border: 5px solid rgba(0,0,30,0.8); } + +.question_options .exercise-unique-answer-image { + +} + +@media (min-width: 768px) { + .question_options .exercise-unique-answer-image:nth-child(2n-1) { + clear: both; + } +} + +@media (min-width: 992px) { + .question_options .exercise-unique-answer-image:nth-child(2n-1) { + clear: none; + } + + .question_options .exercise-unique-answer-image:nth-child(3n-2) { + clear: both; + } +} + +.question_options label > input + div.thumbnail { + border-color: transparent; + border-width: 5px; +} + +.question_options label > input:checked + div.thumbnail { + border: 5px solid red; +} + +.question_options div.thumbnail p { + margin: 0; +} + +.question_options div.thumbnail img { + height: auto !important; + max-width: 100%; +} diff --git a/main/exercice/UniqueAnswerImage.php b/main/exercice/UniqueAnswerImage.php new file mode 100644 index 0000000000..d3877275ac --- /dev/null +++ b/main/exercice/UniqueAnswerImage.php @@ -0,0 +1,360 @@ + + */ +class UniqueAnswerImage extends UniqueAnswer +{ + + static $typePicture = 'mcua.png'; + static $explanationLangVar = 'UniqueAnswerImage'; + + public function __construct() + { + //this is highly important + parent::__construct(); + $this->type = UNIQUE_ANSWER_IMAGE; + $this->isContent = $this->getIsContent(); + } + + public function createAnswersForm($form) + { + $objExercise = $_SESSION['objExercise']; + + $editorConfig = array( + 'ToolbarSet' => 'UniqueAnswerImage', + 'Width' => '100%', + 'Height' => '125' + ); + + //this line defines how many questions by default appear when creating a choice question + // The previous default value was 2. See task #1759. + $numberAnswers = isset($_POST['nb_answers']) ? (int) $_POST['nb_answers'] : 4; + $numberAnswers += (isset($_POST['lessAnswers']) ? -1 : (isset($_POST['moreAnswers']) ? 1 : 0)); + + $feedbackTitle = ''; + + if ($objExercise->selectFeedbackType() == EXERCISE_FEEDBACK_TYPE_DIRECT) { + //Scenario + $commentTitle = '' . get_lang('Comment') . ''; + $feedbackTitle = '' . get_lang('Scenario') . ''; + } else { + $commentTitle = '' . get_lang('Comment') . ''; + } + + $html = ' + + + + + + ' . $commentTitle . ' + ' . $feedbackTitle . ' + + + + '; + + $form->addHeader(get_lang('Answers')); + $form->addHtml($html); + + $defaults = array(); + $correct = 0; + + if (!empty($this->id)) { + $answer = new Answer($this->id); + $answer->read(); + + if (count($answer->nbrAnswers) > 0 && !$form->isSubmitted()) { + $numberAnswers = $answer->nbrAnswers; + } + } + + $form->addElement('hidden', 'nb_answers'); + + //Feedback SELECT + $questionList = $objExercise->selectQuestionList(); + $selectQuestion = array(); + $selectQuestion[0] = get_lang('SelectTargetQuestion'); + + if (is_array($questionList)) { + foreach ($questionList as $key => $questionid) { + //To avoid warning messages + if (!is_numeric($questionid)) { + continue; + } + + $question = Question::read($questionid); + $selectQuestion[$questionid] = 'Q' . $key . ' :' . cut( + $question->selectTitle(), 20 + ); + } + } + + $selectQuestion[-1] = get_lang('ExitTest'); + + $list = new LearnpathList(api_get_user_id()); + $flatList = $list->get_flat_list(); + $selectLpId = array(); + $selectLpId[0] = get_lang('SelectTargetLP'); + + foreach ($flatList as $id => $details) { + $selectLpId[$id] = cut($details['lp_name'], 20); + } + + $tempScenario = array(); + + if ($numberAnswers < 1) { + $numberAnswers = 1; + Display::display_normal_message( + get_lang('YouHaveToCreateAtLeastOneAnswer') + ); + } + + for ($i = 1; $i <= $numberAnswers; ++$i) { + $form->addHtml(''); + if (isset($answer) && is_object($answer)) { + if ($answer->correct[$i]) { + $correct = $i; + } + + $defaults['answer[' . $i . ']'] = $answer->answer[$i]; + $defaults['comment[' . $i . ']'] = $answer->comment[$i]; + $defaults['weighting[' . $i . ']'] = float_format( + $answer->weighting[$i], 1 + ); + + $itemList = explode('@@', $answer->destination[$i]); + + $try = $itemList[0]; + $lp = $itemList[1]; + $listDestination = $itemList[2]; + $url = $itemList[3]; + + $try = 0; + + if ($try != 0) { + $tryResult = 1; + } + + $urlResult = ''; + + if ($url != 0) { + $urlResult = $url; + } + + $tempScenario['url' . $i] = $urlResult; + $tempScenario['try' . $i] = $tryResult; + $tempScenario['lp' . $i] = $lp; + $tempScenario['destination' . $i] = $listDestination; + } else { + $defaults['answer[1]'] = get_lang('DefaultUniqueAnswer1'); + $defaults['weighting[1]'] = 10; + $defaults['answer[2]'] = get_lang('DefaultUniqueAnswer2'); + $defaults['weighting[2]'] = 0; + + $tempScenario['destination' . $i] = array('0'); + $tempScenario['lp' . $i] = array('0'); + } + + $defaults['scenario'] = $tempScenario; + + $renderer = $form->defaultRenderer(); + + $renderer->setElementTemplate( + '', + 'correct' + ); + $renderer->setElementTemplate( + '', + 'counter[' . $i . ']' + ); + $renderer->setElementTemplate( + '', + 'answer[' . $i . ']' + ); + $renderer->setElementTemplate( + '', + 'comment[' . $i . ']' + ); + $renderer->setElementTemplate( + '', + 'weighting[' . $i . ']' + ); + + $answerNumber = $form->addElement('text', 'counter[' . $i . ']', null, ' value = "' . $i . '"'); + $answerNumber->freeze(); + + $form->addElement('radio', 'correct', null, null, $i, 'class="checkbox"'); + $form->addHtmlEditor('answer[' . $i . ']', null, null, true, $editorConfig); + + $form->addRule('answer[' . $i . ']', get_lang('ThisFieldIsRequired'), 'required'); + + if ($objExercise->selectFeedbackType() == EXERCISE_FEEDBACK_TYPE_DIRECT) { + $form->addHtmlEditor('comment[' . $i . ']', null, null, false, $editorConfig); + // Direct feedback + //Adding extra feedback fields + $group = array(); + $group['try' . $i] = $form->createElement('checkbox', 'try' . $i, null, get_lang('TryAgain')); + $group['lp' . $i] = $form->createElement( + 'select', + 'lp' . $i, + get_lang('SeeTheory') . ': ', + $selectLpId + ); + $group['destination' . $i] = $form->createElement( + 'select', + 'destination' . $i, + get_lang('GoToQuestion') . ': ', + $selectQuestion + ); + $group['url' . $i] = $form->createElement( + 'text', 'url' . $i, + get_lang('Other') . ': ', + array( + 'class' => 'col-md-2', + 'placeholder' => get_lang('Other') + ) + ); + $form->addGroup($group, 'scenario'); + + $renderer->setElementTemplate( + ''); + } + + $form->addHtml(''); + $form->addHtml('
' . get_lang('Number') . '' . get_lang('True') . '' . get_lang('Answer') . '' . get_lang('Weighting') . '
{error}
{element}
{error}
{element}
{error}
{element}
{error}
{element}
{error}
{element}
{error}
{element}', + 'scenario' + ); + } else { + $form->addHtmlEditor('comment[' . $i . ']', null, null, false, $editorConfig); + } + $form->addText('weighting[' . $i . ']', null, null, array('class' => "col-md-1", 'value' => '0')); + $form->addHtml('
'); + + global $text, $class; + + $buttonGroup = []; + + if ($objExercise->edit_exercise_in_lp == true) { + //setting the save button here and not in the question class.php + $buttonGroup[] = $form->addButtonDelete(get_lang('LessAnswer'), 'lessAnswers', true); + $buttonGroup[] = $form->addButtonCreate(get_lang('PlusAnswer'), 'moreAnswers', true); + $buttonGroup[] = $form->addButtonSave($text, 'submitQuestion', true); + + $form->addGroup($buttonGroup); + } + + // We check the first radio button to be sure a radio button will be check + if ($correct == 0) { + $correct = 1; + } + + $defaults['correct'] = $correct; + + if (!empty($this->id)) { + $form->setDefaults($defaults); + } else { + if ($this->isContent == 1) { + // Default sample content. + $form->setDefaults($defaults); + } else { + $form->setDefaults(array('correct' => 1)); + } + } + + $form->setConstants(array('nb_answers' => $numberAnswers)); + } + + public function processAnswersCreation($form) + { + $questionWeighting = $nbrGoodAnswers = 0; + $correct = $form->getSubmitValue('correct'); + $objAnswer = new Answer($this->id); + $numberAnswers = $form->getSubmitValue('nb_answers'); + + for ($i = 1; $i <= $numberAnswers; $i++) { + $answer = trim($form->getSubmitValue('answer[' . $i . ']')); + $comment = trim($form->getSubmitValue('comment[' . $i . ']')); + $weighting = trim($form->getSubmitValue('weighting[' . $i . ']')); + + $scenario = $form->getSubmitValue('scenario'); + + //$listDestination = $form -> getSubmitValue('destination'.$i); + //$destinationStr = $form -> getSubmitValue('destination'.$i); + + $try = $scenario['try' . $i]; + $lp = $scenario['lp' . $i]; + $destination = $scenario['destination' . $i]; + $url = trim($scenario['url' . $i]); + + /* + How we are going to parse the destination value + + here we parse the destination value which is a string + 1@@3@@2;4;4;@@http://www.chamilo.org + + where: try_again@@lp_id@@selected_questions@@url + + try_again = is 1 || 0 + lp_id = id of a learning path (0 if dont select) + selected_questions= ids of questions + url= an url + + $destinationStr=''; + foreach ($listDestination as $destination_id) + { + $destinationStr.=$destination_id.';'; + } */ + + $goodAnswer = ($correct == $i) ? true : false; + + if ($goodAnswer) { + $nbrGoodAnswers++; + $weighting = abs($weighting); + + if ($weighting > 0) { + $questionWeighting += $weighting; + } + } + + if (empty($try)) { + $try = 0; + } + + if (empty($lp)) { + $lp = 0; + } + + if (empty($destination)) { + $destination = 0; + } + + if ($url == '') { + $url = 0; + } + + //1@@1;2;@@2;4;4;@@http://www.chamilo.org + $dest = $try . '@@' . $lp . '@@' . $destination . '@@' . $url; + + $objAnswer->createAnswer($answer, $goodAnswer, $comment, $weighting, $i, null, null, $dest); + } + + // saves the answers into the data base + $objAnswer->save(); + + // sets the total weighting of the question + $this->updateWeighting($questionWeighting); + $this->save(); + } + + public function return_header($feedback_type = null, $counter = null, $score = null) + { + return parent::return_header($feedback_type, $counter, $score); + } + +} diff --git a/main/exercice/exercise.class.php b/main/exercice/exercise.class.php index 5fb5c680e0..e42dcf19b5 100755 --- a/main/exercice/exercise.class.php +++ b/main/exercice/exercise.class.php @@ -2277,6 +2277,7 @@ class Exercise switch ($answerType) { // for unique answer case UNIQUE_ANSWER: + case UNIQUE_ANSWER_IMAGE: case UNIQUE_ANSWER_NO_OPTION: if ($from_database) { $sql = "SELECT answer FROM $TBL_TRACK_ATTEMPT @@ -2937,17 +2938,62 @@ class Exercise if ($debug) error_log('Showing questions $from '.$from); //display answers (if not matching type, or if the answer is correct) if ($answerType != MATCHING || $answerCorrect) { - if (in_array($answerType, array(UNIQUE_ANSWER, UNIQUE_ANSWER_NO_OPTION, MULTIPLE_ANSWER, MULTIPLE_ANSWER_COMBINATION, GLOBAL_MULTIPLE_ANSWER))) { + if ( + in_array( + $answerType, + array( + UNIQUE_ANSWER, + UNIQUE_ANSWER_IMAGE, + UNIQUE_ANSWER_NO_OPTION, + MULTIPLE_ANSWER, + MULTIPLE_ANSWER_COMBINATION, + GLOBAL_MULTIPLE_ANSWER + ) + ) + ) { //if ($origin != 'learnpath') { - ExerciseShowFunctions::display_unique_or_multiple_answer($feedback_type, $answerType, $studentChoice, $answer, $answerComment, $answerCorrect, 0, 0, 0, $results_disabled); + ExerciseShowFunctions::display_unique_or_multiple_answer( + $feedback_type, + $answerType, + $studentChoice, + $answer, + $answerComment, + $answerCorrect, + 0, + 0, + 0, + $results_disabled + ); //} } elseif ($answerType == MULTIPLE_ANSWER_TRUE_FALSE) { //if ($origin!='learnpath') { - ExerciseShowFunctions::display_multiple_answer_true_false($feedback_type, $answerType, $studentChoice, $answer, $answerComment, $answerCorrect,0,$questionId,0, $results_disabled); + ExerciseShowFunctions::display_multiple_answer_true_false( + $feedback_type, + $answerType, + $studentChoice, + $answer, + $answerComment, + $answerCorrect, + 0, + $questionId, + 0, + $results_disabled + ); //} } elseif ($answerType == MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE ) { // if ($origin!='learnpath') { - ExerciseShowFunctions::display_multiple_answer_combination_true_false($feedback_type, $answerType, $studentChoice, $answer, $answerComment, $answerCorrect,0,0,0, $results_disabled); + ExerciseShowFunctions::display_multiple_answer_combination_true_false( + $feedback_type, + $answerType, + $studentChoice, + $answer, + $answerComment, + $answerCorrect, + 0, + 0, + 0, + $results_disabled + ); //} } elseif ($answerType == FILL_IN_BLANKS) { //if ($origin!='learnpath') { @@ -2959,20 +3005,44 @@ class Exercise // } } elseif ($answerType == FREE_ANSWER) { //if($origin != 'learnpath') { - ExerciseShowFunctions::display_free_answer($feedback_type, $choice, $exeId, $questionId, $questionScore); + ExerciseShowFunctions::display_free_answer( + $feedback_type, + $choice, + $exeId, + $questionId, + $questionScore + ); //} } elseif ($answerType == ORAL_EXPRESSION) { // to store the details of open questions in an array to be used in mail //if ($origin != 'learnpath') { - ExerciseShowFunctions::display_oral_expression_answer($feedback_type, $choice, 0, 0, $nano); + ExerciseShowFunctions::display_oral_expression_answer( + $feedback_type, + $choice, + 0, + 0, + $nano); //} } elseif ($answerType == HOT_SPOT) { //if ($origin != 'learnpath') { - ExerciseShowFunctions::display_hotspot_answer($feedback_type, $answerId, $answer, $studentChoice, $answerComment, $results_disabled); + ExerciseShowFunctions::display_hotspot_answer( + $feedback_type, + $answerId, + $answer, + $studentChoice, + $answerComment, + $results_disabled + ); // } } elseif ($answerType == HOT_SPOT_ORDER) { //if ($origin != 'learnpath') { - ExerciseShowFunctions::display_hotspot_order_answer($feedback_type, $answerId, $answer, $studentChoice, $answerComment); + ExerciseShowFunctions::display_hotspot_order_answer( + $feedback_type, + $answerId, + $answer, + $studentChoice, + $answerComment + ); //} } elseif ($answerType == HOT_SPOT_DELINEATION) { $user_answer = $_SESSION['exerciseResultCoordinates'][$questionId]; @@ -2991,16 +3061,16 @@ class Exercise $user_answer = $user_array; // we compare only the delineation not the other points - $answer_question = $_SESSION['hotspot_coord'][1]; - $answerDestination = $_SESSION['hotspot_dest'][1]; + $answer_question = $_SESSION['hotspot_coord'][1]; + $answerDestination = $_SESSION['hotspot_dest'][1]; //calculating the area - $poly_user = convert_coordinates($user_answer,'/'); - $poly_answer = convert_coordinates($answer_question,'|'); - $max_coord = poly_get_max($poly_user,$poly_answer); - $poly_user_compiled = poly_compile($poly_user,$max_coord); - $poly_answer_compiled = poly_compile($poly_answer,$max_coord); - $poly_results = poly_result($poly_answer_compiled,$poly_user_compiled,$max_coord); + $poly_user = convert_coordinates($user_answer, '/'); + $poly_answer = convert_coordinates($answer_question, '|'); + $max_coord = poly_get_max($poly_user, $poly_answer); + $poly_user_compiled = poly_compile($poly_user, $max_coord); + $poly_answer_compiled = poly_compile($poly_answer, $max_coord); + $poly_results = poly_result($poly_answer_compiled, $poly_user_compiled, $max_coord); $overlap = $poly_results['both']; $poly_answer_area = $poly_results['s1']; @@ -3008,8 +3078,11 @@ class Exercise $missing = $poly_results['s1Only']; $excess = $poly_results['s2Only']; - //$overlap = round(polygons_overlap($poly_answer,$poly_user)); //this is an area in pixels - if ($debug>0) error_log(__LINE__.' - Polygons results are '.print_r($poly_results,1),0); + //$overlap = round(polygons_overlap($poly_answer,$poly_user)); + // //this is an area in pixels + if ($debug > 0) { + error_log(__LINE__ . ' - Polygons results are ' . print_r($poly_results, 1), 0); + } if ($overlap < 1) { //shortcut to avoid complicated calculations @@ -3017,18 +3090,23 @@ class Exercise $final_missing = 100; $final_excess = 100; } else { - // the final overlap is the percentage of the initial polygon that is overlapped by the user's polygon - $final_overlap = round(((float)$overlap / (float)$poly_answer_area)*100); - if ($debug>1) error_log(__LINE__.' - Final overlap is '.$final_overlap,0); - // the final missing area is the percentage of the initial polygon that is not overlapped by the user's polygon + // the final overlap is the percentage of the initial polygon + // that is overlapped by the user's polygon + $final_overlap = round(((float) $overlap / (float) $poly_answer_area) * 100); + if ($debug > 1) { + error_log(__LINE__ . ' - Final overlap is ' . $final_overlap, 0); + } + // the final missing area is the percentage of the initial polygon + // that is not overlapped by the user's polygon $final_missing = 100 - $final_overlap; - if ($debug>1) { - error_log(__LINE__.' - Final missing is '.$final_missing,0); + if ($debug > 1) { + error_log(__LINE__ . ' - Final missing is ' . $final_missing, 0); } - // the final excess area is the percentage of the initial polygon's size that is covered by the user's polygon outside of the initial polygon - $final_excess = round((((float)$poly_user_area-(float)$overlap)/(float)$poly_answer_area)*100); - if ($debug>1) { - error_log(__LINE__.' - Final excess is '.$final_excess,0); + // the final excess area is the percentage of the initial polygon's size + // that is covered by the user's polygon outside of the initial polygon + $final_excess = round((((float) $poly_user_area - (float) $overlap) / (float) $poly_answer_area) * 100); + if ($debug > 1) { + error_log(__LINE__ . ' - Final excess is ' . $final_excess, 0); } } @@ -3056,7 +3134,11 @@ class Exercise } // if pass - if ($final_overlap>=$threadhold1 && $final_missing<=$threadhold3 && $final_excess<=$threadhold2) { + if ( + $final_overlap >= $threadhold1 && + $final_missing <= $threadhold3 && + $final_excess <= $threadhold2 + ) { $next=1; //go to the oars $result_comment=get_lang('Acceptable'); $final_answer = 1; // do not update with update_exercise_attempt @@ -3122,8 +3204,10 @@ class Exercise } } elseif($answerType == MATCHING) { echo ''; - echo ''.$answerMatching[$answerId].''; - echo ''.$user_answer.' / '.$answerMatching[$answerCorrect].''; + echo '' . $answerMatching[$answerId] . ''; + echo '' . $user_answer . ' / ' + . '' . $answerMatching[$answerCorrect] . '' + . ''; echo ''; } } @@ -3132,70 +3216,180 @@ class Exercise switch ($answerType) { case UNIQUE_ANSWER : + case UNIQUE_ANSWER_IMAGE: case UNIQUE_ANSWER_NO_OPTION: case MULTIPLE_ANSWER : case GLOBAL_MULTIPLE_ANSWER : case MULTIPLE_ANSWER_COMBINATION : - if ($answerId==1) { - ExerciseShowFunctions::display_unique_or_multiple_answer($feedback_type, $answerType, $studentChoice, $answer, $answerComment, $answerCorrect,$exeId,$questionId,$answerId, $results_disabled); + if ($answerId == 1) { + ExerciseShowFunctions::display_unique_or_multiple_answer( + $feedback_type, + $answerType, + $studentChoice, + $answer, + $answerComment, + $answerCorrect, + $exeId, + $questionId, + $answerId, + $results_disabled + ); } else { - ExerciseShowFunctions::display_unique_or_multiple_answer($feedback_type, $answerType, $studentChoice, $answer, $answerComment, $answerCorrect,$exeId,$questionId,"", $results_disabled); + ExerciseShowFunctions::display_unique_or_multiple_answer( + $feedback_type, + $answerType, + $studentChoice, + $answer, + $answerComment, + $answerCorrect, + $exeId, + $questionId, + "", + $results_disabled + ); } break; case MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE: - if ($answerId==1) { - ExerciseShowFunctions::display_multiple_answer_combination_true_false($feedback_type, $answerType, $studentChoice, $answer, $answerComment, $answerCorrect,$exeId,$questionId,$answerId, $results_disabled); + if ($answerId == 1) { + ExerciseShowFunctions::display_multiple_answer_combination_true_false( + $feedback_type, + $answerType, + $studentChoice, + $answer, + $answerComment, + $answerCorrect, + $exeId, + $questionId, + $answerId, + $results_disabled + ); } else { - ExerciseShowFunctions::display_multiple_answer_combination_true_false($feedback_type, $answerType, $studentChoice, $answer, $answerComment, $answerCorrect,$exeId,$questionId,"", $results_disabled); + ExerciseShowFunctions::display_multiple_answer_combination_true_false( + $feedback_type, + $answerType, + $studentChoice, + $answer, + $answerComment, + $answerCorrect, + $exeId, + $questionId, + "", + $results_disabled + ); } break; case MULTIPLE_ANSWER_TRUE_FALSE : - if ($answerId==1) { - ExerciseShowFunctions::display_multiple_answer_true_false($feedback_type, $answerType, $studentChoice, $answer, $answerComment, $answerCorrect,$exeId,$questionId,$answerId, $results_disabled); + if ($answerId == 1) { + ExerciseShowFunctions::display_multiple_answer_true_false( + $feedback_type, + $answerType, + $studentChoice, + $answer, + $answerComment, + $answerCorrect, + $exeId, + $questionId, + $answerId, + $results_disabled + ); } else { - ExerciseShowFunctions::display_multiple_answer_true_false($feedback_type, $answerType, $studentChoice, $answer, $answerComment, $answerCorrect,$exeId,$questionId, "", $results_disabled); + ExerciseShowFunctions::display_multiple_answer_true_false( + $feedback_type, + $answerType, + $studentChoice, + $answer, + $answerComment, + $answerCorrect, + $exeId, + $questionId, + "", + $results_disabled + ); } break; case FILL_IN_BLANKS: - ExerciseShowFunctions::display_fill_in_blanks_answer($feedback_type, $answer,$exeId,$questionId); + ExerciseShowFunctions::display_fill_in_blanks_answer( + $feedback_type, + $answer, + $exeId, + $questionId + ); break; case CALCULATED_ANSWER: - ExerciseShowFunctions::display_calculated_answer($feedback_type, $answer, $exeId, $questionId); + ExerciseShowFunctions::display_calculated_answer( + $feedback_type, + $answer, + $exeId, + $questionId + ); break; case FREE_ANSWER: - echo ExerciseShowFunctions::display_free_answer($feedback_type, $choice, $exeId, $questionId, $questionScore); + echo ExerciseShowFunctions::display_free_answer( + $feedback_type, + $choice, + $exeId, + $questionId, + $questionScore + ); break; case ORAL_EXPRESSION: echo ' - '.ExerciseShowFunctions::display_oral_expression_answer($feedback_type, $choice, $exeId, $questionId, $nano).' - - '; + ' . ExerciseShowFunctions::display_oral_expression_answer( + $feedback_type, + $choice, + $exeId, + $questionId, + $nano + ) . ' + + '; break; case HOT_SPOT: - ExerciseShowFunctions::display_hotspot_answer($feedback_type, $answerId, $answer, $studentChoice, $answerComment, $results_disabled); + ExerciseShowFunctions::display_hotspot_answer( + $feedback_type, + $answerId, + $answer, + $studentChoice, + $answerComment, + $results_disabled); break; case HOT_SPOT_DELINEATION: $user_answer = $user_array; if ($next) { //$tbl_track_e_hotspot = Database::get_main_table(TABLE_STATISTIC_TRACK_E_HOTSPOT); // Save into db - /* $sql = "INSERT INTO $tbl_track_e_hotspot (hotspot_user_id, hotspot_course_code, hotspot_exe_id, hotspot_question_id, hotspot_answer_id, hotspot_correct, hotspot_coordinate ) - VALUES ('".Database::escape_string($_user['user_id'])."', '".Database::escape_string($_course['id'])."', '".Database::escape_string($exeId)."', '".Database::escape_string($questionId)."', '".Database::escape_string($answerId)."', '".Database::escape_string($studentChoice)."', '".Database::escape_string($user_array)."')"; - $result = Database::query($sql,__FILE__,__LINE__);*/ + /* $sql = "INSERT INTO $tbl_track_e_hotspot ( + * hotspot_user_id, + * hotspot_course_code, + * hotspot_exe_id, + * hotspot_question_id, + * hotspot_answer_id, + * hotspot_correct, + * hotspot_coordinate + * ) + VALUES ( + * '".Database::escape_string($_user['user_id'])."', + * '".Database::escape_string($_course['id'])."', + * '".Database::escape_string($exeId)."', '".Database::escape_string($questionId)."', + * '".Database::escape_string($answerId)."', + * '".Database::escape_string($studentChoice)."', + * '".Database::escape_string($user_array)."')"; + $result = Database::query($sql,__FILE__,__LINE__); + */ $user_answer = $user_array; // we compare only the delineation not the other points - $answer_question = $_SESSION['hotspot_coord'][1]; - $answerDestination = $_SESSION['hotspot_dest'][1]; + $answer_question = $_SESSION['hotspot_coord'][1]; + $answerDestination = $_SESSION['hotspot_dest'][1]; //calculating the area - $poly_user = convert_coordinates($user_answer,'/'); - $poly_answer = convert_coordinates($answer_question,'|'); + $poly_user = convert_coordinates($user_answer, '/'); + $poly_answer = convert_coordinates($answer_question, '|'); - $max_coord = poly_get_max($poly_user,$poly_answer); - $poly_user_compiled = poly_compile($poly_user,$max_coord); - $poly_answer_compiled = poly_compile($poly_answer,$max_coord); - $poly_results = poly_result($poly_answer_compiled,$poly_user_compiled,$max_coord); + $max_coord = poly_get_max($poly_user, $poly_answer); + $poly_user_compiled = poly_compile($poly_user, $max_coord); + $poly_answer_compiled = poly_compile($poly_answer, $max_coord); + $poly_results = poly_result($poly_answer_compiled, $poly_user_compiled, $max_coord); $overlap = $poly_results['both']; $poly_answer_area = $poly_results['s1']; @@ -3204,8 +3398,8 @@ class Exercise $excess = $poly_results['s2Only']; //$overlap = round(polygons_overlap($poly_answer,$poly_user)); //this is an area in pixels - if ($debug>0) { - error_log(__LINE__.' - Polygons results are '.print_r($poly_results,1),0); + if ($debug > 0) { + error_log(__LINE__ . ' - Polygons results are ' . print_r($poly_results, 1), 0); } if ($overlap < 1) { //shortcut to avoid complicated calculations @@ -3214,82 +3408,81 @@ class Exercise $final_excess = 100; } else { // the final overlap is the percentage of the initial polygon that is overlapped by the user's polygon - $final_overlap = round(((float)$overlap / (float)$poly_answer_area)*100); - if ($debug>1) { - error_log(__LINE__.' - Final overlap is '.$final_overlap,0); + $final_overlap = round(((float) $overlap / (float) $poly_answer_area) * 100); + if ($debug > 1) { + error_log(__LINE__ . ' - Final overlap is ' . $final_overlap, 0); } // the final missing area is the percentage of the initial polygon that is not overlapped by the user's polygon $final_missing = 100 - $final_overlap; - if ($debug>1) { - error_log(__LINE__.' - Final missing is '.$final_missing,0); + if ($debug > 1) { + error_log(__LINE__ . ' - Final missing is ' . $final_missing, 0); } // the final excess area is the percentage of the initial polygon's size that is covered by the user's polygon outside of the initial polygon - $final_excess = round((((float)$poly_user_area-(float)$overlap)/(float)$poly_answer_area)*100); - if ($debug>1) { - error_log(__LINE__.' - Final excess is '.$final_excess,0); + $final_excess = round((((float) $poly_user_area - (float) $overlap) / (float) $poly_answer_area) * 100); + if ($debug > 1) { + error_log(__LINE__ . ' - Final excess is ' . $final_excess, 0); } } //checking the destination parameters parsing the "@@" - $destination_items= explode('@@', $answerDestination); + $destination_items = explode('@@', $answerDestination); $threadhold_total = $destination_items[0]; - $threadhold_items=explode(';',$threadhold_total); + $threadhold_items = explode(';', $threadhold_total); $threadhold1 = $threadhold_items[0]; // overlap $threadhold2 = $threadhold_items[1]; // excess - $threadhold3 = $threadhold_items[2]; //missing - + $threadhold3 = $threadhold_items[2]; //missing // if is delineation - if ($answerId===1) { + if ($answerId === 1) { //setting colors - if ($final_overlap>=$threadhold1) { - $overlap_color=true; //echo 'a'; + if ($final_overlap >= $threadhold1) { + $overlap_color = true; //echo 'a'; } //echo $excess.'-'.$threadhold2; - if ($final_excess<=$threadhold2) { - $excess_color=true; //echo 'b'; + if ($final_excess <= $threadhold2) { + $excess_color = true; //echo 'b'; } //echo '--------'.$missing.'-'.$threadhold3; - if ($final_missing<=$threadhold3) { - $missing_color=true; //echo 'c'; + if ($final_missing <= $threadhold3) { + $missing_color = true; //echo 'c'; } // if pass - if ($final_overlap>=$threadhold1 && $final_missing<=$threadhold3 && $final_excess<=$threadhold2) { - $next=1; //go to the oars - $result_comment=get_lang('Acceptable'); - $final_answer = 1; // do not update with update_exercise_attempt + if ($final_overlap >= $threadhold1 && $final_missing <= $threadhold3 && $final_excess <= $threadhold2) { + $next = 1; //go to the oars + $result_comment = get_lang('Acceptable'); + $final_answer = 1; // do not update with update_exercise_attempt } else { - $next=0; - $result_comment=get_lang('Unacceptable'); - $comment=$answerDestination=$objAnswerTmp->selectComment(1); - $answerDestination=$objAnswerTmp->selectDestination(1); + $next = 0; + $result_comment = get_lang('Unacceptable'); + $comment = $answerDestination = $objAnswerTmp->selectComment(1); + $answerDestination = $objAnswerTmp->selectDestination(1); //checking the destination parameters parsing the "@@" - $destination_items= explode('@@', $answerDestination); + $destination_items = explode('@@', $answerDestination); } - } elseif($answerId>1) { + } elseif ($answerId > 1) { if ($objAnswerTmp->selectHotspotType($answerId) == 'noerror') { - if ($debug>0) { - error_log(__LINE__.' - answerId is of type noerror',0); + if ($debug > 0) { + error_log(__LINE__ . ' - answerId is of type noerror', 0); } //type no error shouldn't be treated $next = 1; continue; } - if ($debug>0) { - error_log(__LINE__.' - answerId is >1 so we\'re probably in OAR',0); + if ($debug > 0) { + error_log(__LINE__ . ' - answerId is >1 so we\'re probably in OAR', 0); } //check the intersection between the oar and the user //echo 'user'; print_r($x_user_list); print_r($y_user_list); //echo 'official';print_r($x_list);print_r($y_list); //$result = get_intersection_data($x_list,$y_list,$x_user_list,$y_user_list); - $inter= $result['success']; + $inter = $result['success']; //$delineation_cord=$objAnswerTmp->selectHotspotCoordinates($answerId); - $delineation_cord=$objAnswerTmp->selectHotspotCoordinates($answerId); + $delineation_cord = $objAnswerTmp->selectHotspotCoordinates($answerId); - $poly_answer = convert_coordinates($delineation_cord,'|'); - $max_coord = poly_get_max($poly_user,$poly_answer); - $poly_answer_compiled = poly_compile($poly_answer,$max_coord); + $poly_answer = convert_coordinates($delineation_cord, '|'); + $max_coord = poly_get_max($poly_user, $poly_answer); + $poly_answer_compiled = poly_compile($poly_answer, $max_coord); $overlap = poly_touch($poly_user_compiled, $poly_answer_compiled,$max_coord); if ($overlap == false) { @@ -3297,35 +3490,43 @@ class Exercise $next = 1; continue; } else { - if ($debug>0) { - error_log(__LINE__.' - Overlap is '.$overlap.': OAR hit',0); + if ($debug > 0) { + error_log(__LINE__ . ' - Overlap is ' . $overlap . ': OAR hit', 0); } $organs_at_risk_hit++; //show the feedback - $next=0; - $comment=$answerDestination=$objAnswerTmp->selectComment($answerId); - $answerDestination=$objAnswerTmp->selectDestination($answerId); - - $destination_items= explode('@@', $answerDestination); - $try_hotspot=$destination_items[1]; - $lp_hotspot=$destination_items[2]; - $select_question_hotspot=$destination_items[3]; + $next = 0; + $comment = $answerDestination = $objAnswerTmp->selectComment($answerId); + $answerDestination = $objAnswerTmp->selectDestination($answerId); + + $destination_items = explode('@@', $answerDestination); + $try_hotspot = $destination_items[1]; + $lp_hotspot = $destination_items[2]; + $select_question_hotspot = $destination_items[3]; $url_hotspot=$destination_items[4]; } } } else { // the first delineation feedback - if ($debug>0) { - error_log(__LINE__.' first',0); + if ($debug > 0) { + error_log(__LINE__ . ' first', 0); } } break; case HOT_SPOT_ORDER: - ExerciseShowFunctions::display_hotspot_order_answer($feedback_type, $answerId, $answer, $studentChoice, $answerComment); + ExerciseShowFunctions::display_hotspot_order_answer( + $feedback_type, + $answerId, + $answer, + $studentChoice, + $answerComment + ); break; case MATCHING: echo ''; - echo ''.$answerMatching[$answerId].''; - echo ''.$user_answer.' / '.$answerMatching[$answerCorrect].''; + echo '' . $answerMatching[$answerId] . ''; + echo '' . $user_answer . ' / ' + . '' . $answerMatching[$answerCorrect] . '' + . ''; echo ''; break; @@ -3348,9 +3549,9 @@ class Exercise if ($answerType == MULTIPLE_ANSWER_COMBINATION || $answerType == MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE ) { if ($final_answer) { //getting only the first score where we save the weight of all the question - $answerWeighting = $objAnswerTmp->selectWeighting(1); - $questionScore += $answerWeighting; - $totalScore += $answerWeighting; + $answerWeighting = $objAnswerTmp->selectWeighting(1); + $questionScore += $answerWeighting; + $totalScore += $answerWeighting; } } @@ -3364,7 +3565,8 @@ class Exercise $counter = 1; $correct_answer = true; foreach ($real_answers as $my_answer) { - if ($debug) error_log(" my_answer: $my_answer answer_correct_array[counter]: ".$answer_correct_array[$counter]); + if ($debug) + error_log(" my_answer: $my_answer answer_correct_array[counter]: ".$answer_correct_array[$counter]); if ($my_answer != $answer_correct_array[$counter]) { $correct_answer = false; break; @@ -3398,8 +3600,10 @@ class Exercise 'threadhold3'=> $threadhold3, ); if ($from == 'exercise_result') { - // if answer is hotspot. To the difference of exercise_show.php, we use the results from the session (from_db=0) - // TODO Change this, because it is wrong to show the user some results that haven't been stored in the database yet + // if answer is hotspot. To the difference of exercise_show.php, + // we use the results from the session (from_db=0) + // TODO Change this, because it is wrong to show the user + // some results that haven't been stored in the database yet if ($answerType == HOT_SPOT || $answerType == HOT_SPOT_ORDER || $answerType == HOT_SPOT_DELINEATION ) { if ($debug) error_log('$from AND this is a hotspot kind of question '); @@ -3438,65 +3642,76 @@ class Exercise } $table_resume=' - - - - - - - - - - - - - - - - - - - - -
'.get_lang('Requirements').''.get_lang('YourAnswer').'
'.get_lang('Overlap').''.get_lang('Min').' '.$threadhold1.'
'.(($final_overlap < 0)?0:intval($final_overlap)).'
'.get_lang('Excess').''.get_lang('Max').' '.$threadhold2.'
'.(($final_excess < 0)?0:intval($final_excess)).'
'.get_lang('Missing').''.get_lang('Max').' '.$threadhold3.'
'.(($final_missing < 0)?0:intval($final_missing)).'
'; - if ($next==0) { + + + ' . get_lang('Requirements') . ' + ' . get_lang('YourAnswer') . ' + + + ' . get_lang('Overlap') . ' + ' . get_lang('Min') . ' ' . $threadhold1 . ' +
' + . (($final_overlap < 0) ? 0 : intval($final_overlap)) . '
+ + + ' . get_lang('Excess') . ' + ' . get_lang('Max') . ' ' . $threadhold2 . ' +
' + . (($final_excess < 0) ? 0 : intval($final_excess)) . '
+ + + ' . get_lang('Missing') . ' + ' . get_lang('Max') . ' ' . $threadhold3 . ' +
' + . (($final_missing < 0) ? 0 : intval($final_missing)) . '
+ + '; + if ($next == 0) { $try = $try_hotspot; $lp = $lp_hotspot; - $destinationid= $select_question_hotspot; - $url=$url_hotspot; + $destinationid = $select_question_hotspot; + $url = $url_hotspot; } else { //show if no error //echo 'no error'; - $comment=$answerComment=$objAnswerTmp->selectComment($nbrAnswers); - $answerDestination=$objAnswerTmp->selectDestination($nbrAnswers); + $comment = $answerComment = $objAnswerTmp->selectComment($nbrAnswers); + $answerDestination = $objAnswerTmp->selectDestination($nbrAnswers); } - echo '

'.get_lang('Feedback').'

-

'; + echo '

' . get_lang('Feedback') . '

+

'; - $message='

'.get_lang('YourDelineation').'

'; - $message.=$table_resume; - $message.='
'.get_lang('ResultIs').' '.$result_comment.'
'; - if ($organs_at_risk_hit>0) { - $message.='

'.get_lang('OARHit').'

'; + $message = '

' . get_lang('YourDelineation') . '

'; + $message .= $table_resume; + $message .= '
' . get_lang('ResultIs') . ' ' . $result_comment . '
'; + if ($organs_at_risk_hit > 0) { + $message .= '

' . get_lang('OARHit') . '

'; } - $message.='

'.$comment.'

'; + $message .='

' . $comment . '

'; echo $message; } else { echo $hotspot_delineation_result[0]; //prints message - $from_database = 1; // the hotspot_solution.swf needs this variable + $from_database = 1; // the hotspot_solution.swf needs this variable } //save the score attempts if (1) { - $final_answer = $hotspot_delineation_result[1]; //getting the answer 1 or 0 comes from exercise_submit_modal.php + //getting the answer 1 or 0 comes from exercise_submit_modal.php + $final_answer = $hotspot_delineation_result[1]; if ($final_answer == 0) { $questionScore = 0; } - Event::saveQuestionAttempt($questionScore, 1, $quesId, $exeId, 0); // we always insert the answer_id 1 = delineation + // we always insert the answer_id 1 = delineation + Event::saveQuestionAttempt($questionScore, 1, $quesId, $exeId, 0); //in delineation mode, get the answer from $hotspot_delineation_result[1] - Event::saveExerciseAttemptHotspot($exeId,$quesId,1, $hotspot_delineation_result[1], $exerciseResultCoordinates[$quesId]); + Event::saveExerciseAttemptHotspot( + $exeId, + $quesId, + 1, + $hotspot_delineation_result[1], + $exerciseResultCoordinates[$quesId] + ); } else { if ($final_answer==0) { $questionScore = 0; @@ -3530,9 +3745,19 @@ class Exercise '; echo ''.get_lang('HotSpot').'

'; - echo ' - - '; + echo ' + + '; echo ' '; // } @@ -3559,13 +3784,22 @@ class Exercise if (empty($choice)) { $choice = 0; } - if ($answerType == MULTIPLE_ANSWER_TRUE_FALSE || $answerType == MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE ) { + if ($answerType == MULTIPLE_ANSWER_TRUE_FALSE || $answerType == MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE) { if ($choice != 0) { $reply = array_keys($choice); for ($i = 0; $i < sizeof($reply); $i++) { $ans = $reply[$i]; - Event::saveQuestionAttempt($questionScore, $ans.':'.$choice[$ans], $quesId, $exeId, $i, $this->id); - if ($debug) error_log('result =>'.$questionScore.' '.$ans.':'.$choice[$ans]); + Event::saveQuestionAttempt( + $questionScore, + $ans . ':' . $choice[$ans], + $quesId, + $exeId, + $i, + $this->id + ); + if ($debug) { + error_log('result =>' . $questionScore . ' ' . $ans . ':' . $choice[$ans]); + } } } else { Event::saveQuestionAttempt($questionScore, 0, $quesId, $exeId, 0, $this->id); @@ -3574,7 +3808,9 @@ class Exercise if ($choice != 0) { $reply = array_keys($choice); - if ($debug) error_log("reply ".print_r($reply, 1).""); + if ($debug) { + error_log("reply " . print_r($reply, 1) . ""); + } for ($i = 0; $i < sizeof($reply); $i++) { $ans = $reply[$i]; Event::saveQuestionAttempt($questionScore, $ans, $quesId, $exeId, $i, $this->id); @@ -3604,8 +3840,7 @@ class Exercise } elseif ($answerType == ORAL_EXPRESSION) { $answer = $choice; Event::saveQuestionAttempt($questionScore, $answer, $quesId, $exeId, 0, $this->id, $nano); - - } elseif ($answerType == UNIQUE_ANSWER || $answerType == UNIQUE_ANSWER_NO_OPTION) { + } elseif (in_array($answerType, [UNIQUE_ANSWER, UNIQUE_ANSWER_IMAGE, UNIQUE_ANSWER_NO_OPTION])) { $answer = $choice; Event::saveQuestionAttempt($questionScore, $answer, $quesId, $exeId, 0, $this->id); // } elseif ($answerType == HOT_SPOT || $answerType == HOT_SPOT_DELINEATION) { @@ -3613,7 +3848,7 @@ class Exercise Event::saveQuestionAttempt($questionScore, $answer, $quesId, $exeId, 0, $this->id); if (isset($exerciseResultCoordinates[$questionId]) && !empty($exerciseResultCoordinates[$questionId])) { foreach ($exerciseResultCoordinates[$questionId] as $idx => $val) { - Event::saveExerciseAttemptHotspot($exeId,$quesId,$idx,$choice[$idx],$val,$this->id); + Event::saveExerciseAttemptHotspot($exeId, $quesId, $idx, $choice[$idx], $val, $this->id); } } } else { @@ -3664,7 +3899,14 @@ class Exercise return false; } - $url_email = api_get_path(WEB_CODE_PATH).'exercice/exercise_show.php?'.api_get_cidreq().'&id_session='.$sessionId.'&id='.$exe_id.'&action=qualify'; + $url_email = api_get_path(WEB_CODE_PATH) + . 'exercice/exercise_show.php?' + . api_get_cidreq() + . '&id_session=' + . $sessionId + . '&id=' + . $exe_id + . '&action=qualify'; $user_info = UserManager::get_user_info_by_id(api_get_user_id()); $msg = '

'.get_lang('ExerciseAttempted').' :

@@ -3733,7 +3975,14 @@ class Exercise $courseCode = api_get_course_id(); $course_info = api_get_course_info($courseCode); - $url_email = api_get_path(WEB_CODE_PATH).'exercice/exercise_show.php?'.api_get_cidreq().'&id_session='.api_get_session_id().'&id='.$exe_id.'&action=qualify'; + $url_email = api_get_path(WEB_CODE_PATH) + . 'exercice/exercise_show.php?' + . api_get_cidreq() + . '&id_session=' + . api_get_session_id() + . '&id=' + . $exe_id + . '&action=qualify'; $user_info = UserManager::get_user_info_by_id(api_get_user_id()); $msg = '

'.get_lang('OpenQuestionsAttempted').' :

@@ -3823,7 +4072,14 @@ class Exercise $courseCode = api_get_course_id(); $course_info = api_get_course_info($courseCode); - $url_email = api_get_path(WEB_CODE_PATH).'exercice/exercise_show.php?'.api_get_cidreq().'&id_session='.api_get_session_id().'&id='.$exe_id.'&action=qualify'; + $url_email = api_get_path(WEB_CODE_PATH) + . 'exercice/exercise_show.php?' + . api_get_cidreq() + . '&id_session=' + . api_get_session_id() + . '&id=' + . $exe_id + . '&action=qualify'; $user_info = UserManager::get_user_info_by_id(api_get_user_id()); $oral_question_list = null; @@ -3833,14 +4089,15 @@ class Exercise $answer_type = $item['answer_type']; if (!empty($question) && !empty($answer) && $answer_type == ORAL_EXPRESSION) { - $oral_question_list.='
- - - - - - -
  '.get_lang('Question').''.$question.'
  '.get_lang('Answer').''.$answer.'
'; + $oral_question_list.='
+ + + + + + + +
  '.get_lang('Question').''.$question.'
  '.get_lang('Answer').''.$answer.'
'; } } @@ -3983,8 +4240,36 @@ class Exercise $sessionId = api_get_session_id(); $course_id = api_get_course_int_id(); // Save a new quiz - $sql = "INSERT INTO $tbl_quiz (c_id, title, type, random, active, results_disabled, max_attempt, start_time,end_time,feedback_type,expired_time, session_id, propagate_neg) - VALUES('$course_id', '".$title."', $type, $random, $active, $results_disabled, $max_attempt,'','', $feedback, $expired_time, $sessionId, $propagateNegative)"; + $sql = "INSERT INTO $tbl_quiz ( + c_id, + title, + type, + random, + active, + results_disabled, + max_attempt, + start_time, + end_time, + feedback_type, + expired_time, + session_id, + propagate_neg + ) + VALUES ( + '$course_id', + '$title', + $type, + $random, + $active, + $results_disabled, + $max_attempt, + '', + '', + $feedback, + $expired_time, + $sessionId, + $propagateNegative + )"; Database::query($sql); $quiz_id = Database::insert_id(); @@ -4101,7 +4386,10 @@ class Exercise } //3. We check if the time limits are on - $limit_time_exists = ((!empty($this->start_time) && $this->start_time != '0000-00-00 00:00:00') || (!empty($this->end_time) && $this->end_time != '0000-00-00 00:00:00')) ? true : false; + $limit_time_exists = ( + (!empty($this->start_time) && $this->start_time != '0000-00-00 00:00:00') || + (!empty($this->end_time) && $this->end_time != '0000-00-00 00:00:00') + ) ? true : false; if ($limit_time_exists) { $time_now = time(); @@ -4111,18 +4399,28 @@ class Exercise } if ($is_visible == false) { - $message = sprintf(get_lang('ExerciseAvailableFromX'), api_convert_and_format_date($this->start_time)); + $message = sprintf( + get_lang('ExerciseAvailableFromX'), + api_convert_and_format_date($this->start_time) + ); } if ($is_visible == true) { if ($this->end_time != '0000-00-00 00:00:00') { $is_visible = ((api_strtotime($this->end_time, 'UTC') > $time_now) > 0) ? true : false; if ($is_visible == false) { - $message = sprintf(get_lang('ExerciseAvailableUntilX'), api_convert_and_format_date($this->end_time)); + $message = sprintf( + get_lang('ExerciseAvailableUntilX'), + api_convert_and_format_date($this->end_time) + ); } } } - if ($is_visible == false && $this->start_time != '0000-00-00 00:00:00' && $this->end_time != '0000-00-00 00:00:00') { + if ( + $is_visible == false && + $this->start_time != '0000-00-00 00:00:00' && + $this->end_time != '0000-00-00 00:00:00' + ) { $message = sprintf( get_lang('ExerciseWillBeActivatedFromXToY'), api_convert_and_format_date($this->start_time), @@ -4168,9 +4466,9 @@ class Exercise public function added_in_lp() { - $TBL_LP_ITEM = Database::get_course_table(TABLE_LP_ITEM); + $TBL_LP_ITEM = Database::get_course_table(TABLE_LP_ITEM); $sql = "SELECT max_score FROM $TBL_LP_ITEM - WHERE c_id = ".$this->course_id." AND item_type = '".TOOL_QUIZ."' AND path = '".$this->id."'"; + WHERE c_id = {$this->course_id} AND item_type = '" . TOOL_QUIZ . "' AND path = '{$this->id}'"; $result = Database::query($sql); if (Database::num_rows($result) > 0) { return true; @@ -4254,7 +4552,13 @@ class Exercise if ($this->random == -1) { $number_of_random_question = count($this->questionList); } - $questionList = array_merge($questionList, TestCategory::getNElementsFromArray($tabquestion, $number_of_random_question)); + $questionList = array_merge( + $questionList, + TestCategory::getNElementsFromArray( + $tabquestion, + $number_of_random_question + ) + ); } // shuffle the question list if test is not grouped by categories if ($isRandomByCategory == 1) { @@ -4262,7 +4566,8 @@ class Exercise } $tabres = $questionList; } else { - // Problem, random by category has been selected and we have no $this->isRandom nnumber of question selected + // Problem, random by category has been selected and + // we have no $this->isRandom number of question selected // Should not happened } } @@ -4414,11 +4719,11 @@ class Exercise $value = null; //Cleaning student answer list $value = strip_tags($teacher_item); - $value = api_substr($value,1, api_strlen($value)-2); + $value = api_substr($value, 1, api_strlen($value) - 2); $value = explode('/', $value); if (!empty($value[0])) { $value = trim($value[0]); - $value = str_replace(' ', '', $value); + $value = str_replace(' ', '', $value); $result .= $value; } } @@ -4428,7 +4733,17 @@ class Exercise function return_time_left_div() { - $html = ''; + $html = ''; $html .= '
'; return $html; } @@ -4453,7 +4768,7 @@ class Exercise $result = Database::query($sql); $list = array(); if (Database::num_rows($result)) { - while($row = Database::fetch_array($result, 'ASSOC')) { + while ($row = Database::fetch_array($result, 'ASSOC')) { $list[$row['exercise_order']] = $row['exercise_id']; } } @@ -4463,20 +4778,21 @@ class Exercise /** * Calculate the max_score of the quiz, depending of question inside, and quiz advanced option */ - public function get_max_score() { + public function get_max_score() + { $out_max_score = 0; $tab_question_list = $this->selectQuestionList(true); // list of question's id !!! the array key start at 1 !!! // test is randomQuestions - see field random of test if ($this->random > 0 && $this->randomByCat == 0) { $nb_random_questions = $this->random; $tab_questions_score = array(); - for ($i=1; $i <= count($tab_question_list); $i++) { + for ($i = 1; $i <= count($tab_question_list); $i++) { $tmpobj_question = Question::read($tab_question_list[$i]); $tab_questions_score[] = $tmpobj_question->weighting; } rsort($tab_questions_score); // add the first $nb_random_questions value of score array to get max_score - for ($i=0; $i < min($nb_random_questions, count($tab_questions_score)); $i++) { + for ($i = 0; $i < min($nb_random_questions, count($tab_questions_score)); $i++) { $out_max_score += $tab_questions_score[$i]; } } @@ -4485,7 +4801,7 @@ class Exercise else if ($this->random > 0 && $this->randomByCat > 0) { $nb_random_questions = $this->random; $tab_categories_scores = array(); - for ($i=1; $i <= count($tab_question_list); $i++) { + for ($i = 1; $i <= count($tab_question_list); $i++) { $question_category_id = TestCategory::getCategoryForQuestion($tab_question_list[$i]); if (!is_array($tab_categories_scores[$question_category_id])) { $tab_categories_scores[$question_category_id] = array(); @@ -4496,14 +4812,14 @@ class Exercise // here we've got an array with first key, the category_id, second key, score of question for this cat while (list($key, $tab_scores) = each($tab_categories_scores)) { rsort($tab_scores); - for ($i=0; $i < min($nb_random_questions, count($tab_scores)); $i++) { + for ($i = 0; $i < min($nb_random_questions, count($tab_scores)); $i++) { $out_max_score += $tab_scores[$i]; } } } // standart test, just add each question score else { - for ($i=1; $i <= count($tab_question_list); $i++) { + for ($i = 1; $i <= count($tab_question_list); $i++) { $tmpobj_question = Question::read($tab_question_list[$i]); $out_max_score += $tmpobj_question->weighting; } diff --git a/main/exercice/exercise_submit.php b/main/exercice/exercise_submit.php index 3b1eabc577..3dd10fc16c 100755 --- a/main/exercice/exercise_submit.php +++ b/main/exercice/exercise_submit.php @@ -1128,6 +1128,7 @@ if (!empty($error)) { echo Display::div($exercise_actions, array('class'=>'exercise_actions')); } echo ''; + echo ''; } if ($origin != 'learnpath') { diff --git a/main/exercice/question.class.php b/main/exercice/question.class.php index 48e0613fe7..b21b55279c 100755 --- a/main/exercice/question.class.php +++ b/main/exercice/question.class.php @@ -32,21 +32,25 @@ abstract class Question public static $explanationLangVar = ''; public $question_table_class = 'table table-striped'; public static $questionTypes = array( - UNIQUE_ANSWER => array('unique_answer.class.php' , 'UniqueAnswer'), - MULTIPLE_ANSWER => array('multiple_answer.class.php' , 'MultipleAnswer'), - FILL_IN_BLANKS => array('fill_blanks.class.php' , 'FillBlanks'), - MATCHING => array('matching.class.php' , 'Matching'), - FREE_ANSWER => array('freeanswer.class.php' , 'FreeAnswer'), - ORAL_EXPRESSION => array('oral_expression.class.php' , 'OralExpression'), - HOT_SPOT => array('hotspot.class.php' , 'HotSpot'), - HOT_SPOT_DELINEATION => array('hotspot.class.php' , 'HotspotDelineation'), - MULTIPLE_ANSWER_COMBINATION => array('multiple_answer_combination.class.php', 'MultipleAnswerCombination'), - UNIQUE_ANSWER_NO_OPTION => array('unique_answer_no_option.class.php', 'UniqueAnswerNoOption'), - MULTIPLE_ANSWER_TRUE_FALSE => array('multiple_answer_true_false.class.php', 'MultipleAnswerTrueFalse'), - MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE => array('multiple_answer_combination_true_false.class.php', 'MultipleAnswerCombinationTrueFalse'), - GLOBAL_MULTIPLE_ANSWER => array('global_multiple_answer.class.php' , 'GlobalMultipleAnswer'), - CALCULATED_ANSWER => array('calculated_answer.class.php' , 'CalculatedAnswer') - //MEDIA_QUESTION => array('media_question.class.php' , 'MediaQuestion') + UNIQUE_ANSWER => array('unique_answer.class.php', 'UniqueAnswer'), + MULTIPLE_ANSWER => array('multiple_answer.class.php', 'MultipleAnswer'), + FILL_IN_BLANKS => array('fill_blanks.class.php', 'FillBlanks'), + MATCHING => array('matching.class.php', 'Matching'), + FREE_ANSWER => array('freeanswer.class.php', 'FreeAnswer'), + ORAL_EXPRESSION => array('oral_expression.class.php', 'OralExpression'), + HOT_SPOT => array('hotspot.class.php', 'HotSpot'), + HOT_SPOT_DELINEATION => array('hotspot.class.php', 'HotspotDelineation'), + MULTIPLE_ANSWER_COMBINATION => array('multiple_answer_combination.class.php', 'MultipleAnswerCombination'), + UNIQUE_ANSWER_NO_OPTION => array('unique_answer_no_option.class.php', 'UniqueAnswerNoOption'), + MULTIPLE_ANSWER_TRUE_FALSE => array('multiple_answer_true_false.class.php', 'MultipleAnswerTrueFalse'), + MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE => array( + 'multiple_answer_combination_true_false.class.php', + 'MultipleAnswerCombinationTrueFalse' + ), + GLOBAL_MULTIPLE_ANSWER => array('global_multiple_answer.class.php' , 'GlobalMultipleAnswer'), + CALCULATED_ANSWER => array('calculated_answer.class.php' , 'CalculatedAnswer'), + UNIQUE_ANSWER_IMAGE => ['UniqueAnswerImage.php', 'UniqueAnswerImage'] + //MEDIA_QUESTION => array('media_question.class.php' , 'MediaQuestion') ); /** @@ -114,7 +118,7 @@ abstract class Question $TBL_QUESTIONS = Database::get_course_table(TABLE_QUIZ_QUESTION); $TBL_EXERCICE_QUESTION = Database::get_course_table(TABLE_QUIZ_TEST_QUESTION); - $sql = "SELECT question,description,ponderation,position,type,picture,level,extra + $sql = "SELECT question, description, ponderation, position, type, picture, level, extra FROM $TBL_QUESTIONS WHERE c_id = $course_id AND id = $id "; @@ -126,17 +130,17 @@ abstract class Question $objQuestion = Question::getInstance($object->type); if (!empty($objQuestion)) { - $objQuestion->id = $id; - $objQuestion->question = $object->question; - $objQuestion->description = $object->description; - $objQuestion->weighting = $object->ponderation; - $objQuestion->position = $object->position; - $objQuestion->type = $object->type; - $objQuestion->picture = $object->picture; - $objQuestion->level = (int) $object->level; - $objQuestion->extra = $object->extra; - $objQuestion->course = $course_info; - $objQuestion->category = TestCategory::getCategoryForQuestion($id); + $objQuestion->id = $id; + $objQuestion->question = $object->question; + $objQuestion->description = $object->description; + $objQuestion->weighting = $object->ponderation; + $objQuestion->position = $object->position; + $objQuestion->type = $object->type; + $objQuestion->picture = $object->picture; + $objQuestion->level = (int) $object->level; + $objQuestion->extra = $object->extra; + $objQuestion->course = $course_info; + $objQuestion->category = TestCategory::getCategoryForQuestion($id); $sql = "SELECT exercice_id FROM $TBL_EXERCICE_QUESTION WHERE c_id = $course_id AND question_id = $id"; @@ -252,7 +256,7 @@ abstract class Question public function selectPicturePath() { if (!empty($this->picture)) { - return api_get_path(WEB_COURSE_PATH).$this->course['path'].'/document/images/'.$this->picture; + return api_get_path(WEB_COURSE_PATH) . $this->course['path'] . '/document/images/' . $this->picture; } return false; } @@ -305,7 +309,7 @@ abstract class Question */ public function updateDescription($description) { - $this->description=$description; + $this->description = $description; } /** @@ -316,7 +320,7 @@ abstract class Question */ public function updateWeighting($weighting) { - $this->weighting=$weighting; + $this->weighting = $weighting; } /** @@ -325,7 +329,7 @@ abstract class Question */ public function updateCategory($in_category) { - $this->category=$in_category; + $this->category = $in_category; } /** @@ -334,7 +338,7 @@ abstract class Question */ public function updateScoreAlwaysPositive($in_positive) { - $this->scoreAlwaysPositive=$in_positive; + $this->scoreAlwaysPositive = $in_positive; } /** @@ -343,7 +347,7 @@ abstract class Question */ public function updateUncheckedMayScore($in_positive) { - $this->uncheckedMayScore=$in_positive; + $this->uncheckedMayScore = $in_positive; } /** @@ -365,17 +369,22 @@ abstract class Question foreach ($category_list as $category_id) { $category_id = intval($category_id); $question_id = intval($this->id); - $sql = "SELECT count(*) AS nb FROM $TBL_QUESTION_REL_CATEGORY - WHERE category_id = $category_id AND question_id = $question_id AND c_id=".api_get_course_int_id(); + $sql = "SELECT count(*) AS nb + FROM $TBL_QUESTION_REL_CATEGORY + WHERE + category_id = $category_id + AND question_id = $question_id + AND c_id=".api_get_course_int_id(); $res = Database::query($sql); $row = Database::fetch_array($res); if ($row['nb'] > 0) { //DO nothing - //$sql = "UPDATE $TBL_QUESTION_REL_CATEGORY SET category_id = $category_id WHERE question_id=$question_id AND c_id=".api_get_course_int_id(); + //$sql = "UPDATE $TBL_QUESTION_REL_CATEGORY SET category_id = $category_id + //WHERE question_id=$question_id AND c_id=".api_get_course_int_id(); //$res = Database::query($sql); } else { $sql = "INSERT INTO $TBL_QUESTION_REL_CATEGORY (c_id, question_id, category_id) - VALUES (".api_get_course_int_id().", $question_id, $category_id)"; + VALUES (" . api_get_course_int_id() . ", $question_id, $category_id)"; Database::query($sql); } } @@ -399,14 +408,16 @@ abstract class Question $category_id = intval($in_category); $question_id = intval($this->id); $sql = "SELECT count(*) AS nb FROM $TBL_QUESTION_REL_CATEGORY - WHERE question_id=$question_id AND c_id=".api_get_course_int_id(); + WHERE question_id = $question_id AND c_id=" . api_get_course_int_id(); $res = Database::query($sql); $row = Database::fetch_array($res); if ($row['nb'] > 0){ - $sql = "UPDATE $TBL_QUESTION_REL_CATEGORY SET category_id=$category_id WHERE question_id=$question_id AND c_id=".api_get_course_int_id(); + $sql = "UPDATE $TBL_QUESTION_REL_CATEGORY SET category_id = $category_id + WHERE question_id = $question_id AND c_id = " . api_get_course_int_id(); Database::query($sql); } else { - $sql = "INSERT INTO $TBL_QUESTION_REL_CATEGORY VALUES (".api_get_course_int_id().", $question_id, $category_id)"; + $sql = "INSERT INTO $TBL_QUESTION_REL_CATEGORY + VALUES (" . api_get_course_int_id() . ", $question_id, $category_id)"; Database::query($sql); } } @@ -423,7 +434,7 @@ abstract class Question $TBL_QUESTION_REL_CATEGORY = Database::get_course_table(TABLE_QUIZ_QUESTION_REL_CATEGORY); $question_id = intval($this->id); $sql = "DELETE FROM $TBL_QUESTION_REL_CATEGORY - WHERE question_id=$question_id AND c_id=".api_get_course_int_id(); + WHERE question_id = $question_id AND c_id = " . api_get_course_int_id(); Database::query($sql); } @@ -435,7 +446,7 @@ abstract class Question */ public function updatePosition($position) { - $this->position=$position; + $this->position = $position; } /** @@ -446,7 +457,7 @@ abstract class Question */ public function updateLevel($level) { - $this->level=$level; + $this->level = $level; } /** @@ -459,7 +470,7 @@ abstract class Question public function updateType($type) { $TBL_REPONSES = Database::get_course_table(TABLE_QUIZ_ANSWER); - $course_id = $this->course['real_id']; + $course_id = $this->course['real_id']; if (empty($course_id)) { $course_id = api_get_course_int_id(); @@ -467,10 +478,13 @@ abstract class Question // if we really change the type if ($type != $this->type) { // if we don't change from "unique answer" to "multiple answers" (or conversely) - if (!in_array($this->type, array(UNIQUE_ANSWER,MULTIPLE_ANSWER)) || !in_array($type,array(UNIQUE_ANSWER,MULTIPLE_ANSWER))) { + if ( + !in_array($this->type, array(UNIQUE_ANSWER, MULTIPLE_ANSWER)) || + !in_array($type, array(UNIQUE_ANSWER, MULTIPLE_ANSWER)) + ) { // removes old answers $sql = "DELETE FROM $TBL_REPONSES - WHERE c_id = $course_id AND question_id = ".intval($this->id).""; + WHERE c_id = $course_id AND question_id = " . intval($this->id); Database::query($sql); } @@ -496,9 +510,9 @@ abstract class Question if (mkdir($picturePath, api_get_permissions_for_new_directories())) { // document path $documentPath = api_get_path(SYS_COURSE_PATH) . $this->course['path'] . "/document"; - $path = str_replace($documentPath,'',$picturePath); + $path = str_replace($documentPath, '', $picturePath); $title_path = basename($picturePath); - $doc_id = add_document($this->course, $path, 'folder', 0,$title_path); + $doc_id = add_document($this->course, $path, 'folder', 0, $title_path); api_item_property_update($this->course, TOOL_DOCUMENT, $doc_id, 'FolderCreated', api_get_user_id()); } } @@ -506,18 +520,24 @@ abstract class Question // if the question has got an ID if ($this->id) { $extension = pathinfo($PictureName, PATHINFO_EXTENSION); - $this->picture = 'quiz-'.$this->id.'.jpg'; + $this->picture = 'quiz-' . $this->id . '.jpg'; $o_img = new Image($Picture); - $o_img->send_image($picturePath.'/'.$this->picture, -1, 'jpg'); + $o_img->send_image($picturePath . '/' . $this->picture, -1, 'jpg'); $document_id = add_document( $this->course, - '/images/' . $this->picture, 'file', + '/images/' . $this->picture, + 'file', filesize($picturePath . '/' . $this->picture), $this->picture ); if ($document_id) { - return api_item_property_update($this->course, TOOL_DOCUMENT, - $document_id, 'DocumentAdded', api_get_user_id()); + return api_item_property_update( + $this->course, + TOOL_DOCUMENT, + $document_id, + 'DocumentAdded', + api_get_user_id() + ); } } @@ -525,8 +545,8 @@ abstract class Question } /** - * Resizes a picture || Warning!: can only be called after uploadPicture, or if picture is already available in object. - * + * Resizes a picture || Warning!: can only be called after uploadPicture, + * or if picture is already available in object. * @author Toon Keppens * @param string $Dimension - Resizing happens proportional according to given dimension: height|width|any * @param integer $Max - Maximum size @@ -539,15 +559,15 @@ abstract class Question // if the question has an ID if ($this->id) { // Get dimensions from current image. - $my_image = new Image($picturePath.'/'.$this->picture); + $my_image = new Image($picturePath . '/' . $this->picture); $current_image_size = $my_image->get_image_size(); - $current_width = $current_image_size['width']; - $current_height = $current_image_size['height']; + $current_width = $current_image_size['width']; + $current_height = $current_image_size['height']; - if($current_width < $Max && $current_height <$Max) + if ($current_width < $Max && $current_height < $Max) return true; - elseif($current_height == "") + elseif ($current_height == "") return false; // Resize according to height. @@ -581,7 +601,7 @@ abstract class Question } $my_image->resize($new_width, $new_height); - $result = $my_image->send_image($picturePath.'/'.$this->picture); + $result = $my_image->send_image($picturePath . '/' . $this->picture); if ($result) { return true; @@ -602,11 +622,11 @@ abstract class Question global $picturePath; // if the question has got an ID and if the picture exists - if($this->id) { - $picture=$this->picture; - $this->picture=''; + if ($this->id) { + $picture = $this->picture; + $this->picture = ''; - return @unlink($picturePath.'/'.$picture)?true:false; + return @unlink($picturePath . '/' . $picture) ? true : false; } return false; @@ -621,26 +641,38 @@ abstract class Question */ public function exportPicture($questionId, $course_info) { - $course_id = $course_info['real_id']; - $TBL_QUESTIONS = Database::get_course_table(TABLE_QUIZ_QUESTION); - $destination_path = api_get_path(SYS_COURSE_PATH).$course_info['path'].'/document/images'; - $source_path = api_get_path(SYS_COURSE_PATH).$this->course['path'].'/document/images'; + $course_id = $course_info['real_id']; + $TBL_QUESTIONS = Database::get_course_table(TABLE_QUIZ_QUESTION); + $destination_path = api_get_path(SYS_COURSE_PATH) . $course_info['path'] . '/document/images'; + $source_path = api_get_path(SYS_COURSE_PATH) . $this->course['path'] . '/document/images'; // if the question has got an ID and if the picture exists if ($this->id && !empty($this->picture)) { - $picture=explode('.',$this->picture); - $extension = $picture[sizeof($picture)-1]; - $picture = 'quiz-'.$questionId.'.'.$extension; - $result = @copy($source_path.'/'.$this->picture, $destination_path.'/'.$picture) ? true : false; + $picture = explode('.', $this->picture); + $extension = $picture[sizeof($picture) - 1]; + $picture = 'quiz-' . $questionId . '.' . $extension; + $result = @copy($source_path . '/' . $this->picture, $destination_path . '/' . $picture) ? true : false; //If copy was correct then add to the database if ($result) { - $sql = "UPDATE $TBL_QUESTIONS SET picture='".Database::escape_string($picture)."' - WHERE c_id = $course_id AND id='".intval($questionId)."'"; + $sql = "UPDATE $TBL_QUESTIONS SET picture='" . Database::escape_string($picture) . "' + WHERE c_id = $course_id AND id='" . intval($questionId) . "'"; Database::query($sql); - $document_id = add_document($course_info, '/images/'.$picture, 'file', filesize($destination_path.'/'.$picture), $picture); + $document_id = add_document( + $course_info, + '/images/' . $picture, + 'file', + filesize($destination_path . '/' . $picture), + $picture + ); if ($document_id) { - return api_item_property_update($course_info, TOOL_DOCUMENT, $document_id, 'DocumentAdded', api_get_user_id()); + return api_item_property_update( + $course_info, + TOOL_DOCUMENT, + $document_id, + 'DocumentAdded', + api_get_user_id() + ); } } @@ -658,14 +690,14 @@ abstract class Question * @param string $Picture - temporary path of the picture to move * @param string $PictureName - Name of the picture */ - public function setTmpPicture($Picture,$PictureName) + public function setTmpPicture($Picture, $PictureName) { global $picturePath; - $PictureName = explode('.',$PictureName); - $Extension = $PictureName[sizeof($PictureName)-1]; + $PictureName = explode('.', $PictureName); + $Extension = $PictureName[sizeof($PictureName) - 1]; // saves the picture into a temporary file - @move_uploaded_file($Picture,$picturePath.'/tmp.'.$Extension); + @move_uploaded_file($Picture, $picturePath . '/tmp.' . $Extension); } /** @@ -697,15 +729,15 @@ abstract class Question // if the question has got an ID and if the picture exists if ($this->id) { - if (file_exists($picturePath.'/tmp.jpg')) { - $Extension='jpg'; - } elseif(file_exists($picturePath.'/tmp.gif')) { - $Extension='gif'; - } elseif(file_exists($picturePath.'/tmp.png')) { - $Extension='png'; + if (file_exists($picturePath . '/tmp.jpg')) { + $Extension = 'jpg'; + } elseif (file_exists($picturePath . '/tmp.gif')) { + $Extension = 'gif'; + } elseif (file_exists($picturePath . '/tmp.png')) { + $Extension = 'png'; } - $this->picture='quiz-'.$this->id.'.'.$Extension; - return @rename($picturePath.'/tmp.'.$Extension,$picturePath.'/'.$this->picture)?true:false; + $this->picture = 'quiz-' . $this->id . '.' . $Extension; + return @rename($picturePath . '/tmp.' . $Extension, $picturePath . '/' . $this->picture) ? true : false; } return false; } @@ -736,16 +768,17 @@ abstract class Question // question already exists if(!empty($id)) { - $sql="UPDATE $TBL_QUESTIONS SET - question ='".Database::escape_string($question)."', - description ='".Database::escape_string($description)."', - ponderation ='".Database::escape_string($weighting)."', - position ='".Database::escape_string($position)."', - type ='".Database::escape_string($type)."', - picture ='".Database::escape_string($picture)."', - extra ='".Database::escape_string($extra)."', - level ='".Database::escape_string($level)."' - WHERE c_id = $c_id AND id = ".intval($id).""; + $sql = "UPDATE $TBL_QUESTIONS + SET + question = '" . Database::escape_string($question) . "', + description = '" . Database::escape_string($description) . "', + ponderation = '" . Database::escape_string($weighting) . "', + position = '" . Database::escape_string($position) . "', + type = '" . Database::escape_string($type) . "', + picture = '" . Database::escape_string($picture) . "', + extra = '" . Database::escape_string($extra) . "', + level = '" . Database::escape_string($level) . "' + WHERE c_id = $c_id AND id = " . intval($id); Database::query($sql); $this->saveCategory($category); @@ -758,7 +791,7 @@ abstract class Question api_get_user_id() ); } - if (api_get_setting('search_enabled')=='true') { + if (api_get_setting('search_enabled') == 'true') { if ($exerciseId != 0) { $this -> search_engine_edit($exerciseId); } else { @@ -772,27 +805,30 @@ abstract class Question // creates a new question $sql = "SELECT max(position) FROM $TBL_QUESTIONS as question, - $TBL_EXERCICE_QUESTION as test_question + $TBL_EXERCICE_QUESTION as test_question WHERE question.id = test_question.question_id AND - test_question.exercice_id = ".intval($exerciseId)." AND - question.c_id = $c_id AND - test_question.c_id = $c_id "; + test_question.exercice_id = " . intval($exerciseId) . " AND + question.c_id = $c_id AND + test_question.c_id = $c_id "; $result = Database::query($sql); $current_position = Database::result($result,0,0); $this->updatePosition($current_position+1); $position = $this->position; - $sql = "INSERT INTO $TBL_QUESTIONS (c_id, question, description, ponderation, position, type, picture, extra, level) VALUES ( - $c_id, - '".Database::escape_string($question)."', - '".Database::escape_string($description)."', - '".Database::escape_string($weighting)."', - '".Database::escape_string($position)."', - '".Database::escape_string($type)."', - '".Database::escape_string($picture)."', - '".Database::escape_string($extra)."', - '".Database::escape_string($level)."' - )"; + $sql = "INSERT INTO $TBL_QUESTIONS ( + c_id, question, description, ponderation, position, type, picture, extra, level + ) + VALUES ( + $c_id, + '" . Database::escape_string($question) . "', + '" . Database::escape_string($description) . "', + '" . Database::escape_string($weighting) . "', + '" . Database::escape_string($position) . "', + '" . Database::escape_string($type) . "', + '" . Database::escape_string($picture) . "', + '" . Database::escape_string($extra) . "', + '" . Database::escape_string($level) . "' + )"; Database::query($sql); $this->id = Database::insert_id(); @@ -814,8 +850,21 @@ abstract class Question $TBL_ANSWERS = Database::get_course_table( TABLE_QUIZ_ANSWER ); - $sql = "INSERT INTO $TBL_ANSWERS (c_id, question_id , answer, correct, comment, ponderation, position, hotspot_coordinates, hotspot_type) - VALUES (".$c_id.", ".intval($this->id).", '', NULL , '', '10' , '1', '0;0|0|0', 'square')"; + $sql = "INSERT INTO $TBL_ANSWERS ( + c_id, question_id , answer, correct, comment, ponderation, position, hotspot_coordinates, + hotspot_type + ) + VALUES ( + $c_id, + " . intval($this->id) . ", + '', + NULL, + '', + '10', + '1', + '0;0|0|0', + 'square' + )"; Database::query($sql); $id = Database::insert_id(); if ($id) { @@ -828,8 +877,13 @@ abstract class Question $TBL_ANSWERS = Database::get_course_table( TABLE_QUIZ_ANSWER ); - $sql = "INSERT INTO $TBL_ANSWERS (c_id, question_id , answer , correct , comment , ponderation , position , hotspot_coordinates , hotspot_type ) - VALUES (".$c_id.", ".intval($this->id).", '', NULL , '', '10' , '1', '0;0|0|0', 'delineation')"; + $sql = "INSERT INTO $TBL_ANSWERS ( + c_id, question_id, answer, correct, comment, ponderation, position, hotspot_coordinates, + hotspot_type + ) + VALUES ( + $c_id, " . intval($this->id) . ", '', NULL , '', '10' , '1', '0;0|0|0', 'delineation' + )"; Database::query($sql); $id = Database::insert_id(); @@ -875,10 +929,13 @@ abstract class Question $tbl_se_ref = Database::get_main_table(TABLE_MAIN_SEARCH_ENGINE_REF); if ($addQs || $rmQs) { //there's only one row per question on normal db and one document per question on search engine db - $sql = 'SELECT * FROM %s WHERE course_code=\'%s\' AND tool_id=\'%s\' AND ref_id_second_level=%s LIMIT 1'; + $sql = 'SELECT * FROM % + WHERE course_code=\'%s\' AND tool_id=\'%s\' AND ref_id_second_level=%s LIMIT 1'; $sql = sprintf($sql, $tbl_se_ref, $course_id, TOOL_QUIZ, $this->id); } else { - $sql = 'SELECT * FROM %s WHERE course_code=\'%s\' AND tool_id=\'%s\' AND ref_id_high_level=%s AND ref_id_second_level=%s LIMIT 1'; + $sql = 'SELECT * FROM %s + WHERE course_code=\'%s\' AND tool_id=\'%s\' + AND ref_id_high_level=%s AND ref_id_second_level=%s LIMIT 1'; $sql = sprintf($sql, $tbl_se_ref, $course_id, TOOL_QUIZ, $exerciseId, $this->id); } $res = Database::query($sql); @@ -889,21 +946,27 @@ abstract class Question $di = new ChamiloIndexer(); if ($addQs) { - $question_exercises = array((int)$exerciseId); + $question_exercises = array((int) $exerciseId); } else { $question_exercises = array(); } - isset($_POST['language'])? $lang=Database::escape_string($_POST['language']): $lang = 'english'; + isset($_POST['language']) ? $lang = Database::escape_string($_POST['language']) : $lang = 'english'; $di->connectDb(NULL, NULL, $lang); // retrieve others exercise ids $se_ref = Database::fetch_array($res); $se_doc = $di->get_document((int)$se_ref['search_did']); if ($se_doc !== FALSE) { - if ( ($se_doc_data=$di->get_document_data($se_doc)) !== FALSE ) { + if (($se_doc_data = $di->get_document_data($se_doc)) !== FALSE) { $se_doc_data = unserialize($se_doc_data); - if (isset($se_doc_data[SE_DATA]['type']) && $se_doc_data[SE_DATA]['type'] == SE_DOCTYPE_EXERCISE_QUESTION) { - if (isset($se_doc_data[SE_DATA]['exercise_ids']) && is_array($se_doc_data[SE_DATA]['exercise_ids'])) { + if ( + isset($se_doc_data[SE_DATA]['type']) && + $se_doc_data[SE_DATA]['type'] == SE_DOCTYPE_EXERCISE_QUESTION + ) { + if ( + isset($se_doc_data[SE_DATA]['exercise_ids']) && + is_array($se_doc_data[SE_DATA]['exercise_ids']) + ) { foreach ($se_doc_data[SE_DATA]['exercise_ids'] as $old_value) { if (!in_array($old_value, $question_exercises)) { $question_exercises[] = $old_value; @@ -914,7 +977,7 @@ abstract class Question } } if ($rmQs) { - while ( ($key=array_search($exerciseId, $question_exercises)) !== FALSE) { + while (($key = array_search($exerciseId, $question_exercises)) !== FALSE) { unset($question_exercises[$key]); } } @@ -927,7 +990,11 @@ abstract class Question $xapian_data = array( SE_COURSE_ID => $course_id, SE_TOOL_ID => TOOL_QUIZ, - SE_DATA => array('type' => SE_DOCTYPE_EXERCISE_QUESTION, 'exercise_ids' => $question_exercises, 'question_id' => (int)$this->id), + SE_DATA => array( + 'type' => SE_DOCTYPE_EXERCISE_QUESTION, + 'exercise_ids' => $question_exercises, + 'question_id' => (int)$this->id + ), SE_USER => (int)api_get_user_id(), ); $ic_slide->xapian_data = serialize($xapian_data); @@ -946,23 +1013,46 @@ abstract class Question if ($did || $rmQs) { // save it to db if ($addQs || $rmQs) { - $sql = 'DELETE FROM %s WHERE course_code=\'%s\' AND tool_id=\'%s\' AND ref_id_second_level=\'%s\''; + $sql = "DELETE FROM %s + WHERE course_code = '%s' AND tool_id = '%s' AND ref_id_second_level = '%s'"; $sql = sprintf($sql, $tbl_se_ref, $course_id, TOOL_QUIZ, $this->id); } else { - $sql = 'DELETE FROM %s WHERE course_code=\'%s\' AND tool_id=\'%s\' AND ref_id_high_level=\'%s\' AND ref_id_second_level=\'%s\''; + $sql = "DELETE FROM %S + WHERE + course_code = '%s' + AND tool_id = '%s' + AND tool_id = '%s' + AND ref_id_high_level = '%s' + AND ref_id_second_level = '%s'"; $sql = sprintf($sql, $tbl_se_ref, $course_id, TOOL_QUIZ, $exerciseId, $this->id); } Database::query($sql); if ($rmQs) { if (!empty($question_exercises)) { - $sql = 'INSERT INTO %s (id, course_code, tool_id, ref_id_high_level, ref_id_second_level, search_did) - VALUES (NULL , \'%s\', \'%s\', %s, %s, %s)'; - $sql = sprintf($sql, $tbl_se_ref, $course_id, TOOL_QUIZ, array_shift($question_exercises), $this->id, $did); + $sql = "INSERT INTO %s ( + id, course_code, tool_id, ref_id_high_level, ref_id_second_level, search_did + ) + VALUES ( + NULL, '%s', '%s', %s, %s, %s + )"; + $sql = sprintf( + $sql, + $tbl_se_ref, + $course_id, + TOOL_QUIZ, + array_shift($question_exercises), + $this->id, + $did + ); Database::query($sql); } } else { - $sql = 'INSERT INTO %s (id, course_code, tool_id, ref_id_high_level, ref_id_second_level, search_did) - VALUES (NULL , \'%s\', \'%s\', %s, %s, %s)'; + $sql = "INSERT INTO %s ( + id, course_code, tool_id, ref_id_high_level, ref_id_second_level, search_did + ) + VALUES ( + NULL , '%s', '%s', %s, %s, %s + )"; $sql = sprintf($sql, $tbl_se_ref, $course_id, TOOL_QUIZ, $exerciseId, $this->id, $did); Database::query($sql); } @@ -984,14 +1074,14 @@ abstract class Question $exerciseRelQuestionTable = Database::get_course_table(TABLE_QUIZ_TEST_QUESTION); $id = $this->id; // checks if the exercise ID is not in the list - if (!in_array($exerciseId,$this->exerciseList)) { - $this->exerciseList[]= $exerciseId; + if (!in_array($exerciseId, $this->exerciseList)) { + $this->exerciseList[] = $exerciseId; $new_exercise = new Exercise(); $new_exercise->read($exerciseId); $count = $new_exercise->selectNbrQuestions(); $count++; - $sql="INSERT INTO $exerciseRelQuestionTable (c_id, question_id, exercice_id, question_order) VALUES - ({$this->course['real_id']}, ".intval($id).", ".intval($exerciseId).", '$count' )"; + $sql="INSERT INTO $exerciseRelQuestionTable (c_id, question_id, exercice_id, question_order) + VALUES ({$this->course['real_id']}, " . intval($id) . ", " . intval($exerciseId) . ", '$count')"; Database::query($sql); // we do not want to reindex if we had just saved adnd indexed the question @@ -1015,7 +1105,7 @@ abstract class Question $id = $this->id; // searches the position of the exercise ID in the list - $pos=array_search($exerciseId,$this->exerciseList); + $pos = array_search($exerciseId, $this->exerciseList); $course_id = api_get_course_int_id(); @@ -1026,20 +1116,31 @@ abstract class Question // deletes the position in the array containing the wanted exercise ID unset($this->exerciseList[$pos]); //update order of other elements - $sql = "SELECT question_order FROM $TBL_EXERCICE_QUESTION - WHERE c_id = $course_id AND question_id = ".intval($id)." AND exercice_id = ".intval($exerciseId).""; + $sql = "SELECT question_order + FROM $TBL_EXERCICE_QUESTION + WHERE + c_id = $course_id + AND question_id = " . intval($id) . " + AND exercice_id = " . intval($exerciseId); $res = Database::query($sql); if (Database::num_rows($res)>0) { $row = Database::fetch_array($res); if (!empty($row['question_order'])) { - $sql = "UPDATE $TBL_EXERCICE_QUESTION SET question_order = question_order-1 - WHERE c_id = $course_id AND exercice_id = ".intval($exerciseId)." AND question_order > ".$row['question_order']; + $sql = "UPDATE $TBL_EXERCICE_QUESTION + SET question_order = question_order-1 + WHERE + c_id = $course_id + AND exercice_id = " . intval($exerciseId) . " + AND question_order > " . $row['question_order']; $res = Database::query($sql); } } $sql = "DELETE FROM $TBL_EXERCICE_QUESTION - WHERE c_id = $course_id AND question_id = ".intval($id)." AND exercice_id = ".intval($exerciseId).""; + WHERE + c_id = $course_id + AND question_id = " . intval($id) . " + AND exercice_id = " . intval($exerciseId); Database::query($sql); return true; @@ -1058,9 +1159,9 @@ abstract class Question { $course_id = api_get_course_int_id(); - $TBL_EXERCICE_QUESTION = Database::get_course_table(TABLE_QUIZ_TEST_QUESTION); - $TBL_QUESTIONS = Database::get_course_table(TABLE_QUIZ_QUESTION); - $TBL_REPONSES = Database::get_course_table(TABLE_QUIZ_ANSWER); + $TBL_EXERCICE_QUESTION = Database::get_course_table(TABLE_QUIZ_TEST_QUESTION); + $TBL_QUESTIONS = Database::get_course_table(TABLE_QUIZ_QUESTION); + $TBL_REPONSES = Database::get_course_table(TABLE_QUIZ_ANSWER); $TBL_QUIZ_QUESTION_REL_CATEGORY = Database::get_course_table(TABLE_QUIZ_QUESTION_REL_CATEGORY); $id = $this->id; @@ -1077,27 +1178,30 @@ abstract class Question if (!empty($row['question_order'])) { $sql = "UPDATE $TBL_EXERCICE_QUESTION SET question_order = question_order-1 - WHERE c_id = $course_id AND exercice_id = ".intval($row['exercice_id'])." AND question_order > ".$row['question_order']; + WHERE + c_id= $course_id + AND exercice_id = " . intval($row['exercice_id']) . " + AND question_order > " . $row['question_order']; Database::query($sql); } } } - $sql = "DELETE FROM $TBL_EXERCICE_QUESTION WHERE c_id = $course_id AND question_id = ".intval($id).""; + $sql = "DELETE FROM $TBL_EXERCICE_QUESTION WHERE c_id = $course_id AND question_id = " . intval($id) . ""; Database::query($sql); - $sql = "DELETE FROM $TBL_QUESTIONS WHERE c_id = $course_id AND id = ".intval($id).""; + $sql = "DELETE FROM $TBL_QUESTIONS WHERE c_id = $course_id AND id = " . intval($id) . ""; Database::query($sql); - $sql = "DELETE FROM $TBL_REPONSES WHERE c_id = $course_id AND question_id = ".intval($id).""; + $sql = "DELETE FROM $TBL_REPONSES WHERE c_id = $course_id AND question_id = " . intval($id) . ""; Database::query($sql); // remove the category of this question in the question_rel_category table $sql = "DELETE FROM $TBL_QUIZ_QUESTION_REL_CATEGORY - WHERE c_id = $course_id AND question_id = ".intval($id)." AND c_id=".api_get_course_int_id(); + WHERE c_id = $course_id AND question_id = " . intval($id) . " AND c_id=" . api_get_course_int_id(); Database::query($sql); - api_item_property_update($this->course, TOOL_QUIZ, $id,'QuizQuestionDeleted',api_get_user_id()); + api_item_property_update($this->course, TOOL_QUIZ, $id, 'QuizQuestionDeleted', api_get_user_id()); $this->removePicture(); // resets the object @@ -1105,11 +1209,11 @@ abstract class Question } else { // just removes the exercise from the list $this->removeFromList($deleteFromEx); - if (api_get_setting('search_enabled')=='true' && extension_loaded('xapian')) { + if (api_get_setting('search_enabled') == 'true' && extension_loaded('xapian')) { // disassociate question with this exercise - $this -> search_engine_edit($deleteFromEx, FALSE, TRUE); + $this->search_engine_edit($deleteFromEx, FALSE, TRUE); } - api_item_property_update($this->course, TOOL_QUIZ, $id,'QuizQuestionDeleted',api_get_user_id()); + api_item_property_update($this->course, TOOL_QUIZ, $id, 'QuizQuestionDeleted', api_get_user_id()); } } @@ -1159,8 +1263,19 @@ abstract class Question $options = self::readQuestionOption($this->id, $this->course['real_id']); //Inserting in the new course db / or the same course db - $sql = "INSERT INTO $TBL_QUESTIONS (c_id, question, description, ponderation, position, type, level, extra ) - VALUES('$course_id', '".Database::escape_string($question)."','".Database::escape_string($description)."','".Database::escape_string($weighting)."','".Database::escape_string($position)."','".Database::escape_string($type)."' ,'".Database::escape_string($level)."' ,'".Database::escape_string($extra)."' )"; + $sql = "INSERT INTO $TBL_QUESTIONS ( + c_id, question, description, ponderation, position, type, level, extra + ) + VALUES ( + '$course_id', + '" . Database::escape_string($question) . "', + '" . Database::escape_string($description) . "', + '" . Database::escape_string($weighting) . "', + '" . Database::escape_string($position) . "', + '" . Database::escape_string($type) . "', + '" . Database::escape_string($level) . "', + '" . Database::escape_string($extra) . "' + )"; Database::query($sql); $new_question_id = Database::insert_id(); @@ -1236,7 +1351,7 @@ abstract class Question if (class_exists($class_name)) { return new $class_name(); } else { - echo 'Can\'t instanciate class '.$class_name.' of type '.$type; + echo 'Can\'t instanciate class ' . $class_name . ' of type ' . $type; } } } @@ -1252,8 +1367,8 @@ abstract class Question public function createForm(&$form) { echo ''; + .media { display:none;} + '; echo ''; + '; // question name $form->addElement('text', 'questionName', get_lang('Question'), array('class' => 'span6')); @@ -1436,17 +1550,17 @@ abstract class Question require_once $a_type[0]; // get the picture of the type and the langvar which describes it $img = $explanation = ''; - eval('$img = '.$a_type[1].'::$typePicture;'); - eval('$explanation = get_lang('.$a_type[1].'::$explanationLangVar);'); + eval('$img = ' . $a_type[1] . '::$typePicture;'); + eval('$explanation = get_lang(' . $a_type[1] . '::$explanationLangVar);'); echo '
  • '; echo '
    '; if ($objExercise->exercise_was_added_in_lp == true) { $img = pathinfo($img); - $img = $img['filename'].'_na.'.$img['extension']; + $img = $img['filename'] . '_na.' . $img['extension']; echo Display::return_icon($img, $explanation, null, ICON_SIZE_BIG); } else { - echo ''. - Display::return_icon($img, $explanation, null, ICON_SIZE_BIG).''; + echo '' . + Display::return_icon($img, $explanation, null, ICON_SIZE_BIG) . ''; } echo '
    '; echo '
  • '; @@ -1457,10 +1571,10 @@ abstract class Question if ($objExercise->exercise_was_added_in_lp == true) { echo Display::return_icon('database_na.png', get_lang('GetExistingQuestion'), null, ICON_SIZE_BIG); } else { - if ($feedback_type==1) { - echo $url = ''; + if ($feedback_type == 1) { + echo $url = ""; } else { - echo $url = ''; + echo $url = ''; } echo Display::return_icon('database.png', get_lang('GetExistingQuestion'), null, ICON_SIZE_BIG); } @@ -1484,7 +1598,7 @@ abstract class Question $params['name'] = $name; $params['position'] = $position; $params['c_id'] = $course_id; - $result = self::readQuestionOption($question_id, $course_id); + $result = self::readQuestionOption($question_id, $course_id); $last_id = Database::insert($TBL_EXERCICE_QUESTION_OPTION, $params); if ($last_id) { $sql = "UPDATE $TBL_EXERCICE_QUESTION_OPTION SET id = iid WHERE iid = $last_id"; @@ -1597,9 +1711,12 @@ abstract class Question $header .= $this->show_media_content(); } - $header .= Display::page_subheader2($counter_label.". ".$question_title); - $header .= Display::div('

    '.$score_label.'

    '.$score['result'].'

    ', array('class'=>'ribbon')); - $header .= Display::div($this->description, array('id'=>'question_description')); + $header .= Display::page_subheader2($counter_label . ". " . $question_title); + $header .= Display::div( + "

    $score_label'

    {$score['result']}

    ", + array('class' => 'ribbon') + ); + $header .= Display::div($this->description, array('id' => 'question_description')); return $header; } @@ -1639,11 +1756,21 @@ abstract class Question r.c_id = $course_id"; $rs_max = Database::query($sql); $row_max = Database::fetch_object($rs_max); - $max_position = $row_max->max_position +1; + $max_position = $row_max->max_position + 1; // Insert the new question - $sql = "INSERT INTO $tbl_quiz_question (c_id, question, description, ponderation, position, type, level) - VALUES ($course_id, '".Database::escape_string($question_name)."', '".Database::escape_string($question_description)."', '$max_score', $max_position, $type, $level)"; + $sql = "INSERT INTO $tbl_quiz_question ( + c_id, question, description, ponderation, position, type, level + ) + VALUES ( + $course_id, + '" . Database::escape_string($question_name) . "', + '" . Database::escape_string($question_description) . "', + '$max_score', + $max_position, + $type, + $level + )"; Database::query($sql); // Get the question ID @@ -1674,12 +1801,12 @@ abstract class Question */ public function get_type_icon_html() { - $type = $this->selectType(); + $type = $this->selectType(); $tabQuestionList = Question::get_question_type_list(); // [0]=file to include [1]=type name require_once $tabQuestionList[$type][0]; - eval('$img = '.$tabQuestionList[$type][1].'::$typePicture;'); - eval('$explanation = get_lang('.$tabQuestionList[$type][1].'::$explanationLangVar);'); + eval('$img = ' . $tabQuestionList[$type][1] . '::$typePicture;'); + eval('$explanation = get_lang(' . $tabQuestionList[$type][1] . '::$explanationLangVar);'); return array($img, $explanation); } @@ -1687,15 +1814,25 @@ abstract class Question * Get course medias * @param int course id */ - static function get_course_medias($course_id, $start = 0, $limit = 100, $sidx = "question", $sord = "ASC", $where_condition = array()) + static function get_course_medias( + $course_id, + $start = 0, + $limit = 100, + $sidx = "question", + $sord = "ASC", + $where_condition = array() + ) { $table_question = Database::get_course_table(TABLE_QUIZ_QUESTION); $default_where = array('c_id = ? AND parent_id = 0 AND type = ?' => array($course_id, MEDIA_QUESTION)); - $result = Database::select('*', $table_question, + $result = Database::select( + '*', + $table_question, array( 'limit' => " $start, $limit", 'where' => $default_where, - 'order' => "$sidx $sord") + 'order' => "$sidx $sord" + ) ); return $result; } @@ -1710,9 +1847,9 @@ abstract class Question { $table_question = Database::get_course_table(TABLE_QUIZ_QUESTION); $result = Database::select( - 'count(*) as count', + 'count(*) as count', $table_question, - array('where'=>array('c_id = ? AND parent_id = 0 AND type = ?' => array($course_id, MEDIA_QUESTION))), + array('where' => array('c_id = ? AND parent_id = 0 AND type = ?' => array($course_id, MEDIA_QUESTION))), 'first' ); diff --git a/main/exercice/question_list_admin.inc.php b/main/exercice/question_list_admin.inc.php index 6fe0969183..43920dc2c3 100755 --- a/main/exercice/question_list_admin.inc.php +++ b/main/exercice/question_list_admin.inc.php @@ -100,7 +100,7 @@ $ajax_url = api_get_path(WEB_AJAX_PATH)."exercise.ajax.php?".api_get_cidreq()."& $( "#question_list" ).accordion({ icons: icons, - autoHeight: false, + heightStyle: "content", active: false, // all items closed by default collapsible: true, header: ".header_operations" diff --git a/main/inc/lib/api.lib.php b/main/inc/lib/api.lib.php index 6f4d27ca0f..315422e11a 100644 --- a/main/inc/lib/api.lib.php +++ b/main/inc/lib/api.lib.php @@ -472,6 +472,7 @@ define('ORAL_EXPRESSION', 13); define('GLOBAL_MULTIPLE_ANSWER', 14); define('MEDIA_QUESTION', 15); define('CALCULATED_ANSWER', 16); +define('UNIQUE_ANSWER_IMAGE', 17); //Some alias used in the QTI exports define('MCUA', 1); diff --git a/main/inc/lib/course.lib.php b/main/inc/lib/course.lib.php index a5a015ebbe..1c3177edc8 100755 --- a/main/inc/lib/course.lib.php +++ b/main/inc/lib/course.lib.php @@ -3259,7 +3259,7 @@ class CourseManager $tableSessionRelCourse = Database::get_main_table(TABLE_MAIN_SESSION_COURSE); $orderBy = ' ORDER BY position'; $extraInnerJoin = " INNER JOIN $tableSessionRelCourse src - ON (c.code = src.course_code AND session_id = $sessionId) "; + ON (c.id = src.c_id AND session_id = $sessionId) "; } } diff --git a/main/inc/lib/exercise.lib.php b/main/inc/lib/exercise.lib.php index 28302cbe50..db9fc1cac8 100644 --- a/main/inc/lib/exercise.lib.php +++ b/main/inc/lib/exercise.lib.php @@ -82,7 +82,8 @@ class ExerciseLib return ''; } - echo '
    '; + echo '
    '; + // construction of the Answer object (also gets all answers details) $objAnswerTmp = new Answer($questionId); @@ -104,7 +105,7 @@ class ExerciseLib $num_suggestions = 0; if ($answerType == MATCHING) { - $s .= ''; + $s .= '
    '; // Iterate through answers $x = 1; //mark letters for each answer @@ -213,7 +214,7 @@ class ExerciseLib if ($show_comment) { $header .= Display::tag('th', get_lang('Feedback')); } - $s .= '
    '; + $s .= '
    '; $s .= Display::tag( 'tr', $header, @@ -222,22 +223,24 @@ class ExerciseLib } if ($show_comment) { - if (in_array( - $answerType, - array( - MULTIPLE_ANSWER, - MULTIPLE_ANSWER_COMBINATION, - UNIQUE_ANSWER, - UNIQUE_ANSWER_NO_OPTION, - GLOBAL_MULTIPLE_ANSWER + if ( + in_array( + $answerType, + array( + MULTIPLE_ANSWER, + MULTIPLE_ANSWER_COMBINATION, + UNIQUE_ANSWER, + UNIQUE_ANSWER_IMAGE, + UNIQUE_ANSWER_NO_OPTION, + GLOBAL_MULTIPLE_ANSWER + ) ) - ) ) { $header = Display::tag('th', get_lang('Options')); if ($exercise_feedback == EXERCISE_FEEDBACK_TYPE_END) { $header .= Display::tag('th', get_lang('Feedback')); } - $s .= '
    '; + $s .= '
    '; $s .= Display::tag( 'tr', $header, @@ -263,7 +266,7 @@ class ExerciseLib $attributes = array(); // Unique answer - if ($answerType == UNIQUE_ANSWER || $answerType == UNIQUE_ANSWER_NO_OPTION) { + if (in_array($answerType, [UNIQUE_ANSWER, UNIQUE_ANSWER_NO_OPTION, UNIQUE_ANSWER_IMAGE])) { $input_id = 'choice-' . $questionId . '-' . $answerId; if (isset($user_choice[0]['answer']) && $user_choice[0]['answer'] == $numAnswer) { $attributes = array( @@ -282,6 +285,25 @@ class ExerciseLib } } + if ($show_comment) { + $s .= ''; $s .= '
    '; + } + + if ($answerType == UNIQUE_ANSWER_IMAGE) { + if ($show_comment) { + if (empty($comment)) { + $s .= '
    '; + } else { + $s .= '
    '; + } + } else { + $s .= '
    '; + } + } + $answer = Security::remove_XSS($answer, STUDENT); $s .= Display::input( 'hidden', @@ -289,7 +311,15 @@ class ExerciseLib '0' ); - $answer_input = '
    "; + } + if ($show_comment) { - $s .= '
    '; $s .= $answer_input; $s .= ''; @@ -311,7 +344,8 @@ class ExerciseLib $s .= $answer_input; } - } elseif ($answerType == MULTIPLE_ANSWER || + } elseif ( + $answerType == MULTIPLE_ANSWER || $answerType == MULTIPLE_ANSWER_TRUE_FALSE || $answerType == GLOBAL_MULTIPLE_ANSWER ) { diff --git a/main/inc/lib/tracking.lib.php b/main/inc/lib/tracking.lib.php index 2f97da27a6..b724f25d00 100755 --- a/main/inc/lib/tracking.lib.php +++ b/main/inc/lib/tracking.lib.php @@ -3078,7 +3078,7 @@ class Tracking $sql = "SELECT DISTINCT code, c_id FROM $tbl_session_course sc INNER JOIN $courseTable c - sc.c_id = c.id + ON sc.c_id = c.id WHERE session_id= $session_id"; $result = Database::query($sql); diff --git a/main/inc/local.inc.php b/main/inc/local.inc.php index 142d9c5003..ad9c8ea0e3 100755 --- a/main/inc/local.inc.php +++ b/main/inc/local.inc.php @@ -1089,7 +1089,7 @@ if ((isset($uidReset) && $uidReset) || (isset($cidReset) && $cidReset)) { $is_sessionAdmin = true; } else { // Am I a session coach for this session? - $sql = "SELECT id, id_coach FROM $tbl_session session + $sql = "SELECT session.id, session.id_coach FROM $tbl_session session INNER JOIN $tbl_session_course sc ON sc.session_id = session.id WHERE session.id = $session_id diff --git a/main/lang/english/trad4all.inc.php b/main/lang/english/trad4all.inc.php index a53bdde9c6..43b3811155 100644 --- a/main/lang/english/trad4all.inc.php +++ b/main/lang/english/trad4all.inc.php @@ -7084,4 +7084,5 @@ $BadgesManagement = "Badges management"; $CurrentBadges = "Current badges"; $SaveBadge = "Save badge"; $BadgeMeasuresXPixelsInPNG = "Badge measures 200x200 pixels in PNG"; +$UniqueAnswerImage = "Unique answer image"; ?> \ No newline at end of file diff --git a/main/lang/spanish/trad4all.inc.php b/main/lang/spanish/trad4all.inc.php index 8956f74ab1..0c80bd085e 100644 --- a/main/lang/spanish/trad4all.inc.php +++ b/main/lang/spanish/trad4all.inc.php @@ -6826,7 +6826,7 @@ $NumberOfPublishedExercises = "Nro de ejercicios publicados"; $NumberOfPublishedLps = "Nro de Lecciones publicadas"; $ChatConnected = "Chat (Conectado)"; $ChatDisconnected = "Chat (Desconectado)"; -$AddCourseDescription = "Agregar descripción del curso"; +$AddCourseDescription = "Describir el curso"; $ThingsToDo = "Primeras actividades sugeridas"; $RecordAnswer = "Grabar respuesta"; $UseTheMessageBelowToAddSomeComments = "Utilizar el siguiente campo de texto para escribir un comentario al profesor"; @@ -7100,6 +7100,9 @@ $WorkEmailAlertActivateOnlyForTeachers = "Activar sólo para profesores el aviso $WorkEmailAlertActivateOnlyForStudents = "Activar sólo para alumnos el aviso por correo electrónico del envío de una nueva tarea"; $Uncategorized = "Sin categoría"; $NaturalYear = "Año natural"; +$AutoWeight = "Auto-ponderación"; +$AutoWeightExplanation = "La ponderación automática permite ganar algo de tiempo. Esta funcionalidad distribuirá el peso total entre los elementos a bajo de manera equilibrada."; +$EditWeight = "Editar ponderación"; $TheSkillHasBeenCreated = "La competencia ha sido creada"; $CreateSkill = "Crear competencia"; $CannotCreateSkill = "No se puede crear la competencia"; @@ -7110,4 +7113,6 @@ $BadgesManagement = "Gestionar las insignias"; $CurrentBadges = "Insignias actuales"; $SaveBadge = "Guardar insignia"; $BadgeMeasuresXPixelsInPNG = "Medidas de la insignia 200x200 píxeles en formato PNG"; +$SetTutor = "Hacer tutor"; +$UniqueAnswerImage = "Respuesta de imagen única"; ?> \ No newline at end of file diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/AgendaStudent.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/AgendaStudent.php index ae15774c95..30e45c8e69 100644 --- a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/AgendaStudent.php +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/AgendaStudent.php @@ -14,6 +14,10 @@ class AgendaStudent extends Basic public $plugins = array( ); + /** + * Get the toolbar config + * @return array + */ public function getConfig() { if (api_get_setting('more_buttons_maximized_mode') != 'true') { @@ -27,6 +31,10 @@ class AgendaStudent extends Basic return $config; } + /** + * Get the toolbar configuration when CKEditor is maximized + * @return array + */ protected function getMaximizedToolbar() { return [ @@ -60,6 +68,10 @@ class AgendaStudent extends Basic ]; } + /** + * Get the default toolbar configuration when the setting more_buttons_maximized_mode is false + * @return array + */ protected function getNormalToolbar() { return [ @@ -88,6 +100,10 @@ class AgendaStudent extends Basic ]; } + /** + * Get the toolbar configuration when CKEditor is minimized + * @return array + */ protected function getMinimizedToolbar() { return [ diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Announcements.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Announcements.php index 525478fff0..b1e5f90f28 100644 --- a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Announcements.php +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Announcements.php @@ -12,7 +12,8 @@ class Announcements extends Basic { /** - * @return mixed + * Get the toolbar config + * @return array */ public function getConfig() { @@ -25,6 +26,10 @@ class Announcements extends Basic return $config; } + /** + * Get the default toolbar configuration when the setting more_buttons_maximized_mode is false + * @return array + */ protected function getNormalToolbar() { return [ @@ -54,6 +59,10 @@ class Announcements extends Basic ]; } + /** + * Get the toolbar configuration when CKEditor is minimized + * @return array + */ protected function getMinimizedToolbar() { return [ diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/AssessmentsIntroduction.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/AssessmentsIntroduction.php index 45ca1692ab..077f6dfa72 100644 --- a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/AssessmentsIntroduction.php +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/AssessmentsIntroduction.php @@ -11,7 +11,8 @@ namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar; class AssessmentsIntroduction extends Basic { /** - * @return mixed + * Get the toolbar config + * @return array */ public function getConfig() { @@ -24,6 +25,10 @@ class AssessmentsIntroduction extends Basic return $config; } + /** + * Get the default toolbar configuration when the setting more_buttons_maximized_mode is false + * @return array + */ protected function getNormalToolbar() { return [ @@ -40,6 +45,10 @@ class AssessmentsIntroduction extends Basic ]; } + /** + * Get the toolbar configuration when CKEditor is minimized + * @return array + */ protected function getMinimizedToolbar() { return [ diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Basic.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Basic.php index ee4f087e2c..637e76d964 100644 --- a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Basic.php +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Basic.php @@ -77,7 +77,7 @@ class Basic extends Toolbar // Adding plugins depending of platform conditions $plugins = array(); - if (api_get_setting('show_glossary_in_documents') != 'none') { + if (api_get_setting('show_glossary_in_documents') == 'ismanual') { $plugins[] = 'glossary'; } @@ -131,6 +131,7 @@ class Basic extends Toolbar } /** + * Get the toolbar config * @return array */ public function getConfig() @@ -191,7 +192,7 @@ class Basic extends Toolbar } /** - * Get the small toolbar configuration + * Get the toolbar configuration when CKEditor is minimized * @return array */ protected function getMinimizedToolbar() diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Careers.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Careers.php index b3cd3cb405..80fc41e918 100644 --- a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Careers.php +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Careers.php @@ -12,7 +12,8 @@ class Careers extends Basic { /** - * @return mixed + * Get the toolbar config + * @return array */ public function getConfig() { @@ -26,6 +27,10 @@ class Careers extends Basic return $config; } + /** + * Get the toolbar configuration when CKEditor is maximized + * @return array + */ protected function getMaximizedToolbar() { return [ @@ -57,6 +62,10 @@ class Careers extends Basic ]; } + /** + * Get the default toolbar configuration when the setting more_buttons_maximized_mode is false + * @return array + */ protected function getNormalToolbar() { return [ @@ -70,6 +79,10 @@ class Careers extends Basic ]; } + /** + * Get the toolbar configuration when CKEditor is minimized + * @return array + */ protected function getMinimizedToolbar() { return [ diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Documents.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Documents.php index 29cf910544..d50ac39d7d 100644 --- a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Documents.php +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Documents.php @@ -13,7 +13,8 @@ class Documents extends Basic public $plugins = array(); /** - * @return mixed + * Get the toolbar config + * @return array */ public function getConfig() { @@ -45,6 +46,10 @@ class Documents extends Basic return $plugins; } + /** + * Get the default toolbar configuration when the setting more_buttons_maximized_mode is false + * @return array + */ protected function getNormalToolbar() { return [ @@ -72,6 +77,10 @@ class Documents extends Basic ]; } + /** + * Get the toolbar configuration when CKEditor is minimized + * @return array + */ protected function getMinimizedToolbar() { return [ diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/DocumentsStudent.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/DocumentsStudent.php index 6926ee9bbe..1a9981b6b9 100644 --- a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/DocumentsStudent.php +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/DocumentsStudent.php @@ -12,7 +12,8 @@ class DocumentsStudent extends Basic { /** - * @return mixed + * Get the toolbar config + * @return array */ public function getConfig() { @@ -28,6 +29,10 @@ class DocumentsStudent extends Basic return $config; } + /** + * Get the toolbar configuration when CKEditor is maximized + * @return array + */ protected function getMaximizedToolbar() { return [ @@ -61,6 +66,10 @@ class DocumentsStudent extends Basic ]; } + /** + * Get the default toolbar configuration when the setting more_buttons_maximized_mode is false + * @return array + */ protected function getNormalToolbar() { return [ @@ -77,6 +86,10 @@ class DocumentsStudent extends Basic ]; } + /** + * Get the toolbar configuration when CKEditor is minimized + * @return array + */ protected function getMinimizedToolbar() { return [ diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/FAQ.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/FAQ.php index e4e5e0d4a9..465d6b0851 100644 --- a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/FAQ.php +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/FAQ.php @@ -12,7 +12,8 @@ class FAQ extends Basic { /** - * @return mixed + * Get the toolbar config + * @return array */ public function getConfig() { @@ -27,6 +28,10 @@ class FAQ extends Basic return $config; } + /** + * Get the toolbar configuration when CKEditor is maximized + * @return array + */ protected function getMaximizedToolbar() { return [ @@ -58,6 +63,10 @@ class FAQ extends Basic ]; } + /** + * Get the default toolbar configuration when the setting more_buttons_maximized_mode is false + * @return array + */ protected function getNormalToolbar() { return [ @@ -65,6 +74,10 @@ class FAQ extends Basic ]; } + /** + * Get the toolbar configuration when CKEditor is minimized + * @return array + */ protected function getMinimizedToolbar() { return [ diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Forum.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Forum.php index 02627e9532..2cefdfe731 100644 --- a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Forum.php +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Forum.php @@ -11,6 +11,10 @@ namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar; class Forum extends Basic { + /** + * Get the toolbar config + * @return array + */ public function getConfig() { if (api_get_setting('more_buttons_maximized_mode') != 'true') { @@ -22,6 +26,10 @@ class Forum extends Basic return $config; } + /** + * Get the default toolbar configuration when the setting more_buttons_maximized_mode is false + * @return array + */ protected function getNormalToolbar() { return [ @@ -51,6 +59,10 @@ class Forum extends Basic ]; } + /** + * Get the toolbar configuration when CKEditor is minimized + * @return array + */ protected function getMinimizedToolbar() { return [ diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/ForumStudent.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/ForumStudent.php index a5111dcea4..c40b11d834 100644 --- a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/ForumStudent.php +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/ForumStudent.php @@ -11,6 +11,10 @@ namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar; class ForumStudent extends Basic { + /** + * Get the toolbar config + * @return array + */ public function getConfig() { if (api_get_setting('more_buttons_maximized_mode') != 'true') { @@ -24,6 +28,10 @@ class ForumStudent extends Basic return $config; } + /** + * Get the toolbar configuration when CKEditor is maximized + * @return array + */ protected function getMaximizedToolbar() { return [ @@ -57,6 +65,10 @@ class ForumStudent extends Basic ]; } + /** + * Get the default toolbar configuration when the setting more_buttons_maximized_mode is false + * @return array + */ protected function getNormalToolbar() { return [ @@ -73,6 +85,10 @@ class ForumStudent extends Basic ]; } + /** + * Get the toolbar configuration when CKEditor is minimized + * @return array + */ protected function getMinimizedToolbar() { return [ diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Glossary.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Glossary.php index 122dbf80e9..ed5712b1d5 100644 --- a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Glossary.php +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Glossary.php @@ -12,7 +12,8 @@ class Glossary extends Basic { /** - * @return mixed + * Get the toolbar config + * @return array */ public function getConfig() { @@ -25,6 +26,10 @@ class Glossary extends Basic return $config; } + /** + * Get the default toolbar configuration when the setting more_buttons_maximized_mode is false + * @return array + */ protected function getNormalToolbar() { return [ @@ -40,6 +45,10 @@ class Glossary extends Basic ]; } + /** + * Get the toolbar configuration when CKEditor is minimized + * @return array + */ protected function getMinimizedToolbar() { return [ diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/LearningPathAuthor.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/LearningPathAuthor.php index 0cb11b94b9..aae311015d 100644 --- a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/LearningPathAuthor.php +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/LearningPathAuthor.php @@ -12,7 +12,8 @@ class LearningPathAuthor extends Basic { /** - * @return mixed + * Get the toolbar config + * @return array */ public function getConfig() { @@ -28,6 +29,10 @@ class LearningPathAuthor extends Basic return $config; } + /** + * Get the toolbar configuration when CKEditor is maximized + * @return array + */ protected function getMaximizedToolbar() { return [ @@ -36,6 +41,10 @@ class LearningPathAuthor extends Basic ]; } + /** + * Get the default toolbar configuration when the setting more_buttons_maximized_mode is false + * @return array + */ protected function getNormalToolbar() { return [ @@ -43,6 +52,10 @@ class LearningPathAuthor extends Basic ]; } + /** + * Get the toolbar configuration when CKEditor is minimized + * @return array + */ protected function getMinimizedToolbar() { return [ diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/LearningPathDocuments.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/LearningPathDocuments.php index b02f52d487..ee7be710d2 100644 --- a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/LearningPathDocuments.php +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/LearningPathDocuments.php @@ -12,7 +12,8 @@ class LearningPathDocuments extends Basic { /** - * @return mixed + * Get the toolbar config + * @return array */ public function getConfig() { @@ -28,6 +29,10 @@ class LearningPathDocuments extends Basic return $config; } + /** + * Get the toolbar configuration when CKEditor is maximized + * @return array + */ protected function getMaximizedToolbar() { return [ @@ -61,6 +66,10 @@ class LearningPathDocuments extends Basic ]; } + /** + * Get the default toolbar configuration when the setting more_buttons_maximized_mode is false + * @return array + */ protected function getNormalToolbar() { return [ @@ -96,6 +105,10 @@ class LearningPathDocuments extends Basic ]; } + /** + * Get the toolbar configuration when CKEditor is minimized + * @return array + */ protected function getMinimizedToolbar() { return [ diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Messages.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Messages.php index 6f5eb5992f..3b1163abbb 100644 --- a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Messages.php +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Messages.php @@ -10,8 +10,10 @@ namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar; */ class Messages extends Basic { + /** - * @return mixed + * Get the toolbar config + * @return array */ public function getConfig() { @@ -28,6 +30,10 @@ class Messages extends Basic return $config; } + /** + * Get the toolbar configuration when CKEditor is maximized + * @return array + */ protected function getMaximizedToolbar() { return [ @@ -62,6 +68,10 @@ class Messages extends Basic ]; } + /** + * Get the default toolbar configuration when the setting more_buttons_maximized_mode is false + * @return array + */ protected function getNormalToolbar() { return [ @@ -77,6 +87,10 @@ class Messages extends Basic ]; } + /** + * Get the toolbar configuration when CKEditor is minimized + * @return array + */ protected function getMinimizedToolbar() { return [ diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/NotebookStudent.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/NotebookStudent.php index 94b44529b9..aa241ea6db 100644 --- a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/NotebookStudent.php +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/NotebookStudent.php @@ -11,6 +11,10 @@ namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar; class NotebookStudent extends Basic { + /** + * Get the toolbar config + * @return array + */ public function getConfig() { if (api_get_setting('more_buttons_maximized_mode') != 'true') { @@ -23,6 +27,10 @@ class NotebookStudent extends Basic return $config; } + /** + * Get the toolbar configuration when CKEditor is maximized + * @return array + */ protected function getMaximizedToolbar() { return [ @@ -56,6 +64,10 @@ class NotebookStudent extends Basic ]; } + /** + * Get the default toolbar configuration when the setting more_buttons_maximized_mode is false + * @return array + */ protected function getNormalToolbar() { return [ @@ -72,6 +84,10 @@ class NotebookStudent extends Basic ]; } + /** + * Get the toolbar configuration when CKEditor is minimized + * @return array + */ protected function getMinimizedToolbar() { return [ diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/PortalNews.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/PortalNews.php index 328d5707ff..53cf3c7aa6 100644 --- a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/PortalNews.php +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/PortalNews.php @@ -11,6 +11,10 @@ namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar; class PortalNews extends Basic { + /** + * Get the toolbar config + * @return array + */ public function getConfig() { if (api_get_setting('more_buttons_maximized_mode') != 'true') { @@ -23,6 +27,10 @@ class PortalNews extends Basic return $config; } + /** + * Get the toolbar configuration when CKEditor is maximized + * @return array + */ protected function getMaximizedToolbar() { return [ @@ -57,6 +65,10 @@ class PortalNews extends Basic ]; } + /** + * Get the default toolbar configuration when the setting more_buttons_maximized_mode is false + * @return array + */ protected function getNormalToolbar() { return [ @@ -72,6 +84,10 @@ class PortalNews extends Basic ]; } + /** + * Get the toolbar configuration when CKEditor is minimized + * @return array + */ protected function getMinimizedToolbar() { return [ diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Profile.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Profile.php index 6a9d13161d..d778a8e865 100644 --- a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Profile.php +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Profile.php @@ -10,8 +10,10 @@ namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar; */ class Profile extends Basic { + /** - * @return mixed + * Get the toolbar config + * @return array */ public function getConfig() { @@ -25,6 +27,10 @@ class Profile extends Basic return $config; } + /** + * Get the toolbar configuration when CKEditor is maximized + * @return array + */ protected function getMaximizedToolbar() { return [ @@ -56,6 +62,10 @@ class Profile extends Basic ]; } + /** + * Get the default toolbar configuration when the setting more_buttons_maximized_mode is false + * @return array + */ protected function getNormalToolbar() { return [ @@ -71,6 +81,10 @@ class Profile extends Basic ]; } + /** + * Get the toolbar configuration when CKEditor is minimized + * @return array + */ protected function getMinimizedToolbar() { return [ diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Project.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Project.php index 73b0b68ade..46a9071536 100644 --- a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Project.php +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Project.php @@ -10,6 +10,11 @@ namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar; */ class Project extends Basic { + + /** + * Get the toolbar config + * @return array + */ public function getConfig() { if (api_get_setting('more_buttons_maximized_mode') != 'true') { @@ -22,6 +27,10 @@ class Project extends Basic return $config; } + /** + * Get the toolbar configuration when CKEditor is maximized + * @return array + */ protected function getMaximizedToolbar() { return [ @@ -54,6 +63,10 @@ class Project extends Basic ]; } + /** + * Get the default toolbar configuration when the setting more_buttons_maximized_mode is false + * @return array + */ protected function getNormalToolbar() { return [ @@ -68,6 +81,10 @@ class Project extends Basic ]; } + /** + * Get the toolbar configuration when CKEditor is minimized + * @return array + */ protected function getMinimizedToolbar() { return [ diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/ProjectComment.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/ProjectComment.php index cfd0eae894..da9c3f278a 100644 --- a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/ProjectComment.php +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/ProjectComment.php @@ -10,6 +10,11 @@ namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar; */ class ProjectComment extends Basic { + + /** + * Get the toolbar config + * @return array + */ public function getConfig() { if (api_get_setting('more_buttons_maximized_mode') != 'true') { @@ -22,6 +27,10 @@ class ProjectComment extends Basic return $config; } + /** + * Get the toolbar configuration when CKEditor is maximized + * @return array + */ protected function getMaximizedToolbar() { return [ @@ -54,6 +63,10 @@ class ProjectComment extends Basic ]; } + /** + * Get the default toolbar configuration when the setting more_buttons_maximized_mode is false + * @return array + */ protected function getNormalToolbar() { return [ @@ -67,6 +80,10 @@ class ProjectComment extends Basic ]; } + /** + * Get the toolbar configuration when CKEditor is minimized + * @return array + */ protected function getMinimizedToolbar() { return [ diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/ProjectCommentStudent.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/ProjectCommentStudent.php index 3d01ee8858..aa9e0f640b 100644 --- a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/ProjectCommentStudent.php +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/ProjectCommentStudent.php @@ -10,6 +10,11 @@ namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar; */ class ProjectCommentStudent extends Basic { + + /** + * Get the toolbar config + * @return array + */ public function getConfig() { if (api_get_setting('more_buttons_maximized_mode') != 'true') { @@ -22,6 +27,10 @@ class ProjectCommentStudent extends Basic return $config; } + /** + * Get the toolbar configuration when CKEditor is maximized + * @return array + */ protected function getMaximizedToolbar() { return [ @@ -54,6 +63,10 @@ class ProjectCommentStudent extends Basic ]; } + /** + * Get the default toolbar configuration when the setting more_buttons_maximized_mode is false + * @return array + */ protected function getNormalToolbar() { return [ @@ -67,6 +80,10 @@ class ProjectCommentStudent extends Basic ]; } + /** + * Get the toolbar configuration when CKEditor is minimized + * @return array + */ protected function getMinimizedToolbar() { return [ diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/ProjectStudent.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/ProjectStudent.php index a7233a93d5..9f22760a91 100644 --- a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/ProjectStudent.php +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/ProjectStudent.php @@ -10,6 +10,11 @@ namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar; */ class ProjectStudent extends Basic { + + /** + * Get the toolbar config + * @return array + */ public function getConfig() { if (api_get_setting('more_buttons_maximized_mode') != 'true') { @@ -22,6 +27,10 @@ class ProjectStudent extends Basic return $config; } + /** + * Get the toolbar configuration when CKEditor is maximized + * @return array + */ protected function getMaximizedToolbar() { return [ @@ -54,6 +63,10 @@ class ProjectStudent extends Basic ]; } + /** + * Get the default toolbar configuration when the setting more_buttons_maximized_mode is false + * @return array + */ protected function getNormalToolbar() { return [ @@ -68,6 +81,10 @@ class ProjectStudent extends Basic ]; } + /** + * Get the toolbar configuration when CKEditor is minimized + * @return array + */ protected function getMinimizedToolbar() { return [ diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Register.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Register.php index 42f0aa8178..6e769987a9 100644 --- a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Register.php +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Register.php @@ -14,6 +14,10 @@ class Register extends Basic public $plugins = array( ); + /** + * Get the toolbar config + * @return array + */ public function getConfig() { if (api_get_setting('more_buttons_maximized_mode') != 'true') { @@ -26,6 +30,10 @@ class Register extends Basic return $config; } + /** + * Get the default toolbar configuration when the setting more_buttons_maximized_mode is false + * @return array + */ protected function getNormalToolbar() { return [ @@ -36,6 +44,10 @@ class Register extends Basic ]; } + /** + * Get the toolbar configuration when CKEditor is minimized + * @return array + */ protected function getMinimizedToolbar() { return [ diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Survey.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Survey.php index 74dee538ab..71adf029d1 100644 --- a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Survey.php +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Survey.php @@ -11,6 +11,10 @@ namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar; class Survey extends Basic { + /** + * Get the toolbar config + * @return array + */ public function getConfig() { if (api_get_setting('more_buttons_maximized_mode') != 'true') { @@ -23,6 +27,10 @@ class Survey extends Basic return $config; } + /** + * Get the toolbar configuration when CKEditor is maximized + * @return array + */ protected function getMaximizedToolbar() { return [ @@ -56,6 +64,10 @@ class Survey extends Basic ]; } + /** + * Get the default toolbar configuration when the setting more_buttons_maximized_mode is false + * @return array + */ protected function getNormalToolbar() { return [ @@ -70,6 +82,10 @@ class Survey extends Basic ]; } + /** + * Get the toolbar configuration when CKEditor is minimized + * @return array + */ protected function getMinimizedToolbar() { return [ diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/TermsAndConditions.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/TermsAndConditions.php index 17255579c1..378a41ebfe 100644 --- a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/TermsAndConditions.php +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/TermsAndConditions.php @@ -11,6 +11,10 @@ namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar; class TermsAndConditions extends Basic { + /** + * Get the toolbar config + * @return array + */ public function getConfig() { if (api_get_setting('more_buttons_maximized_mode') != 'true') { @@ -23,6 +27,10 @@ class TermsAndConditions extends Basic return $config; } + /** + * Get the default toolbar configuration when the setting more_buttons_maximized_mode is false + * @return array + */ protected function getNormalToolbar() { return [ diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/TestAnswerFeedback.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/TestAnswerFeedback.php index 4993f9c809..878b6087d9 100644 --- a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/TestAnswerFeedback.php +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/TestAnswerFeedback.php @@ -11,7 +11,8 @@ namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar; class TestAnswerFeedback extends Basic { /** - * @return mixed + * Get the toolbar config + * @return array */ public function getConfig() { @@ -53,6 +54,10 @@ class TestAnswerFeedback extends Basic return $config; } + /** + * Get the toolbar configuration when CKEditor is maximized + * @return array + */ protected function getMaximizedToolbar() { return [ @@ -73,6 +78,10 @@ class TestAnswerFeedback extends Basic ]; } + /** + * Get the default toolbar configuration when the setting more_buttons_maximized_mode is false + * @return array + */ protected function getNormalToolbar() { return [ @@ -80,6 +89,10 @@ class TestAnswerFeedback extends Basic ]; } + /** + * Get the toolbar configuration when CKEditor is minimized + * @return array + */ protected function getMinimizedToolbar() { return [ diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/TestFreeAnswer.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/TestFreeAnswer.php index 429488f857..750bb95ae0 100644 --- a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/TestFreeAnswer.php +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/TestFreeAnswer.php @@ -11,7 +11,8 @@ namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar; class TestFreeAnswer extends Basic { /** - * @return mixed + * Get the toolbar config + * @return array */ public function getConfig() { @@ -42,6 +43,10 @@ class TestFreeAnswer extends Basic return $config; } + /** + * Get the toolbar configuration when CKEditor is maximized + * @return array + */ protected function getMaximizedToolbar() { return [ @@ -62,6 +67,10 @@ class TestFreeAnswer extends Basic ]; } + /** + * Get the default toolbar configuration when the setting more_buttons_maximized_mode is false + * @return array + */ protected function getNormalToolbar() { return [ @@ -80,6 +89,10 @@ class TestFreeAnswer extends Basic ]; } + /** + * Get the toolbar configuration when CKEditor is minimized + * @return array + */ protected function getMinimizedToolbar() { return [ diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/TestFreeAnswerStrict.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/TestFreeAnswerStrict.php index 2697bd3f76..605490b3f5 100644 --- a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/TestFreeAnswerStrict.php +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/TestFreeAnswerStrict.php @@ -11,7 +11,8 @@ namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar; class TestFreeAnswerStrict extends Basic { /** - * @return mixed + * Get the toolbar config + * @return array */ public function getConfig() { @@ -42,6 +43,10 @@ class TestFreeAnswerStrict extends Basic return $config; } + /** + * Get the default toolbar configuration when the setting more_buttons_maximized_mode is false + * @return array + */ protected function getNormalToolbar() { return []; diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/TestProposedAnswer.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/TestProposedAnswer.php index 0ceb3a811a..eeae353bc2 100644 --- a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/TestProposedAnswer.php +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/TestProposedAnswer.php @@ -11,7 +11,8 @@ namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar; class TestProposedAnswer extends Basic { /** - * @return mixed + * Get the toolbar config + * @return array */ public function getConfig() { @@ -66,6 +67,10 @@ class TestProposedAnswer extends Basic return $plugins; } + /** + * Get the toolbar configuration when CKEditor is maximized + * @return array + */ protected function getMaximizedToolbar() { return [ @@ -99,6 +104,10 @@ class TestProposedAnswer extends Basic ]; } + /** + * Get the default toolbar configuration when the setting more_buttons_maximized_mode is false + * @return array + */ protected function getNormalToolbar() { return [ @@ -117,6 +126,10 @@ class TestProposedAnswer extends Basic ]; } + /** + * Get the toolbar configuration when CKEditor is minimized + * @return array + */ protected function getMinimizedToolbar() { return [ diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/TestQuestionDescription.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/TestQuestionDescription.php index c5bd2c9e4f..76ac138fb5 100644 --- a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/TestQuestionDescription.php +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/TestQuestionDescription.php @@ -10,7 +10,8 @@ namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar; class TestQuestionDescription extends Basic { /** - * @return mixed + * Get the toolbar config + * @return array */ public function getConfig() { @@ -59,6 +60,10 @@ class TestQuestionDescription extends Basic return $plugins; } + /** + * Get the toolbar configuration when CKEditor is maximized + * @return array + */ protected function getMaximizedToolbar() { return [ @@ -92,6 +97,10 @@ class TestQuestionDescription extends Basic ]; } + /** + * Get the default toolbar configuration when the setting more_buttons_maximized_mode is false + * @return array + */ protected function getNormalToolbar() { return [ @@ -107,6 +116,10 @@ class TestQuestionDescription extends Basic ]; } + /** + * Get the toolbar configuration when CKEditor is minimized + * @return array + */ protected function getMinimizedToolbar() { return [ diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/UniqueAnswerImage.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/UniqueAnswerImage.php index 929c3c6987..1c7f03b6fb 100644 --- a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/UniqueAnswerImage.php +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/UniqueAnswerImage.php @@ -11,7 +11,8 @@ namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar; class UniqueAnswerImage extends Basic { /** - * @return mixed + * Get the toolbar config + * @return array */ public function getConfig() { diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Wiki.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Wiki.php index 7e81c0e9c5..45da525217 100644 --- a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Wiki.php +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Wiki.php @@ -11,6 +11,10 @@ namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar; class Wiki extends Basic { + /** + * Get the toolbar config + * @return array + */ public function getConfig() { if (api_get_setting('more_buttons_maximized_mode') != 'true') { @@ -28,6 +32,10 @@ class Wiki extends Basic return $config; } + /** + * Get the default toolbar configuration when the setting more_buttons_maximized_mode is false + * @return array + */ protected function getNormalToolbar() { return [ @@ -76,6 +84,10 @@ class Wiki extends Basic ]; } + /** + * Get the toolbar configuration when CKEditor is minimized + * @return array + */ protected function getMinimizedToolbar() { return [ diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/WikiStudent.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/WikiStudent.php index fe78492311..ae72d9b12e 100644 --- a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/WikiStudent.php +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/WikiStudent.php @@ -11,6 +11,10 @@ namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar; class WikiStudent extends Basic { + /** + * Get the toolbar config + * @return array + */ public function getConfig() { if (api_get_setting('more_buttons_maximized_mode') != 'true') { @@ -29,6 +33,10 @@ class WikiStudent extends Basic return $config; } + /** + * Get the toolbar configuration when CKEditor is maximized + * @return array + */ protected function getMaximizedToolbar() { return [ @@ -62,6 +70,10 @@ class WikiStudent extends Basic ]; } + /** + * Get the default toolbar configuration when the setting more_buttons_maximized_mode is false + * @return array + */ protected function getNormalToolbar() { return [ @@ -107,6 +119,10 @@ class WikiStudent extends Basic ]; } + /** + * Get the toolbar configuration when CKEditor is minimized + * @return array + */ protected function getMinimizedToolbar() { return [ diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/WikiTask.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/WikiTask.php index 18770e50ac..7ff8fc8cd2 100644 --- a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/WikiTask.php +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/WikiTask.php @@ -11,6 +11,10 @@ namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar; class WikiTask extends Basic { + /** + * Get the toolbar config + * @return array + */ public function getConfig() { if (api_get_setting('more_buttons_maximized_mode') != 'true') { @@ -23,6 +27,10 @@ class WikiTask extends Basic return $config; } + /** + * Get the toolbar configuration when CKEditor is maximized + * @return array + */ protected function getMaximizedToolbar() { return [ @@ -54,6 +62,10 @@ class WikiTask extends Basic ]; } + /** + * Get the default toolbar configuration when the setting more_buttons_maximized_mode is false + * @return array + */ protected function getNormalToolbar() { return [ @@ -67,6 +79,10 @@ class WikiTask extends Basic ]; } + /** + * Get the toolbar configuration when CKEditor is minimized + * @return array + */ protected function getMinimizedToolbar() { return [ diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Work.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Work.php index d4484463ac..8b234821ff 100644 --- a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Work.php +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Work.php @@ -15,7 +15,8 @@ class Work extends Basic ); /** - * @return mixed + * Get the toolbar config + * @return array */ public function getConfig() { @@ -30,6 +31,10 @@ class Work extends Basic return $config; } + /** + * Get the toolbar configuration when CKEditor is maximized + * @return array + */ protected function getMaximizedToolbar() { return [ @@ -62,6 +67,10 @@ class Work extends Basic ]; } + /** + * Get the default toolbar configuration when the setting more_buttons_maximized_mode is false + * @return array + */ protected function getNormalToolbar() { return [ @@ -77,6 +86,10 @@ class Work extends Basic ]; } + /** + * Get the toolbar configuration when CKEditor is minimized + * @return array + */ protected function getMinimizedToolbar() { return [ diff --git a/tests/datafiller/data_users.php b/tests/datafiller/data_users.php index cf9b60dddd..5f49a3d9d0 100755 --- a/tests/datafiller/data_users.php +++ b/tests/datafiller/data_users.php @@ -201,26 +201,26 @@ $users[] = array('username' => 'tsandyman', 'pass'=> 'tsandyman', 'firstname' => $users[] = array('username' => 'wgamwich', 'pass'=> 'wgamwich', 'firstname' => 'Wiseman', 'lastname' => 'Gamwich', 'status' => 5, 'auth_source' => 'platform', 'email' => 'wgamwich@example.com', 'creator_id' => 1, 'active' => 1); $users[] = array('username' => 'mhalles','pass' => 'mhalles','firstname' => 'Maria','lastname' => 'Halles','status' => 5,'auth_source' => 'platform','email' => 'mhalles@example.com','creator_id' => 1,'active' => 1); -$users[] = array('username' => 'adaniel','pass' => 'adaniel','firstname' => 'Annaa','lastname' => 'Daniel','status' => 5,'auth_source' => 'platform','email' => 'adaniel@example.com','creator_id' => 1,'active' => 1); -$users[] = array('username' => 'ppiedra','pass' => 'ppiedra','firstname' => 'Pirot','lastname' => 'Piedra','status' => 5,'auth_source' => 'platform','email' => 'ppiedra@example.com','creator_id' => 1,'active' => 1); +$users[] = array('username' => 'adaniel','pass' => 'adaniel','firstname' => 'Anna','lastname' => 'Daniel','status' => 5,'auth_source' => 'platform','email' => 'adaniel@example.com','creator_id' => 1,'active' => 1); +$users[] = array('username' => 'hstein','pass' => 'ppiedra','firstname' => 'Hansel','lastname' => 'Stein','status' => 5,'auth_source' => 'platform','email' => 'ppiedra@example.com','creator_id' => 1,'active' => 1); $users[] = array('username' => 'amartin','pass' => 'amartin','firstname' => 'Angel','lastname' => 'Martin','status' => 5,'auth_source' => 'platform','email' => 'amartin@example.com','creator_id' => 1,'active' => 1); -$users[] = array('username' => 'mhingis','pass' => 'mhingis','firstname' => 'Marsi','lastname' => 'Hingis','status' => 5,'auth_source' => 'platform','email' => 'mhingis@example.com','creator_id' => 1,'active' => 1); -$users[] = array('username' => 'jlennon','pass' => 'jlennon','firstname' => 'Johny','lastname' => 'Lennon','status' => 5,'auth_source' => 'platform','email' => 'jlennon@example.com','creator_id' => 1,'active' => 1); +$users[] = array('username' => 'mhiggins','pass' => 'mhingis','firstname' => 'Marc','lastname' => 'Higgins','status' => 5,'auth_source' => 'platform','email' => 'mhingis@example.com','creator_id' => 1,'active' => 1); +$users[] = array('username' => 'jlennon','pass' => 'jlennon','firstname' => 'Johnny','lastname' => 'Lennon','status' => 5,'auth_source' => 'platform','email' => 'jlennon@example.com','creator_id' => 1,'active' => 1); $users[] = array('username' => 'pchavez','pass' => 'pchavez','firstname' => 'Parol','lastname' => 'Chavez','status' => 5,'auth_source' => 'platform','email' => 'pchavez@example.com','creator_id' => 1,'active' => 1); $users[] = array('username' => 'cvallejo','pass' => 'cvallejo','firstname' => 'César','lastname' => 'Vallejo','status' => 5,'auth_source' => 'platform','email' => 'cvallejo@example.com','creator_id' => 1,'active' => 1); $users[] = array('username' => 'ftruffaut','pass'=> 'ftruffaut','firstname' => 'François','lastname' => 'Truffaut','status' => 5,'auth_source' => 'platform','email' => 'ftruffaut@example.com','creator_id' => 1,'active' => 1); -$users[] = array('username' => 'mjoy','pass'=> 'mjoy','firstname' => 'Marion','lastname' => 'Joy','status' => 5,'auth_source' => 'platform','email' => 'marion@example.com','creator_id' => 1,'active' => 1); +$users[] = array('username' => 'mjoy','pass'=> 'mjoy','firstname' => 'Mary','lastname' => 'Joy','status' => 5,'auth_source' => 'platform','email' => 'marion@example.com','creator_id' => 1,'active' => 1); $users[] = array('username' => 'dmassa','pass'=> 'dmassa','firstname' => 'Diego','lastname' => 'Massa','status' => 5,'auth_source' => 'platform','email' => 'dmassa@example.com','creator_id' => 1,'active' => 1); -$users[] = array('username' => 'mjagger','pass'=> 'mjagger','firstname' => 'Mick','lastname' => 'Jag','status' => 5,'auth_source' => 'platform','email' => 'mjagger@example.com','creator_id' => 1,'active' => 1); +$users[] = array('username' => 'mjagger','pass'=> 'mjagger','firstname' => 'Mick','lastname' => 'Jagger','status' => 5,'auth_source' => 'platform','email' => 'mjagger@example.com','creator_id' => 1,'active' => 1); $users[] = array('username' => 'mcotilla','pass'=> 'mcotilla','firstname' => 'Marion','lastname' => 'Cotillard','status' => 5,'auth_source' => 'platform','email' => 'mcotilla@example.com','creator_id' => 1,'active' => 1); $users[] = array('username' => 'pepelepew','pass'=> 'pepelepew','firstname' => 'Pepe','lastname' => 'Le Pew','status' => 5,'auth_source' => 'platform','email' => 'pepelepew@example.com','creator_id' => 1,'active' => 1); -$users[] = array('username' => 'nrubia','pass'=> 'nrubia','firstname' => 'Nathalie','lastname' => 'Rubia','status' => 5,'auth_source' => 'platform','email' => 'nrubia@example.com','creator_id' => 1,'active' => 1); +$users[] = array('username' => 'nrubio','pass'=> 'nrubia','firstname' => 'Nathalie','lastname' => 'Rubio','status' => 5,'auth_source' => 'platform','email' => 'nrubia@example.com','creator_id' => 1,'active' => 1); $users[] = array('username' => 'psanchez','pass'=> 'psanchez','firstname' => 'Peri','lastname' => 'Sanchez','status' => 5,'auth_source' => 'platform','email' => 'psanchez@example.com','creator_id' => 1,'active' => 1); -$users[] = array('username' => 'acostea','pass'=> 'acostea','firstname' => 'Andreea','lastname' => 'Costea','status' => 5,'auth_source' => 'platform','email' => 'acostea@example.com','creator_id' => 1,'active' => 1); +$users[] = array('username' => 'acostea','pass'=> 'acostea','firstname' => 'Andrea','lastname' => 'Costea','status' => 5,'auth_source' => 'platform','email' => 'acostea@example.com','creator_id' => 1,'active' => 1); $users[] = array('username' => 'telera','pass'=> 'telera','firstname' => 'Tania','lastname' => 'Helera','status' => 5,'auth_source' => 'platform','email' => 'telera@example.com','creator_id' => 1,'active' => 1); $users[] = array('username' => 'dstrauss','pass'=> 'dstrauss','firstname' => 'Domingo','lastname' => 'Strauss','status' => 5,'auth_source' => 'platform','email' => 'dstrauss@example.com','creator_id' => 1,'active' => 1); $users[] = array('username' => 'helena','pass'=> 'helena','firstname' => 'Helena','lastname' => 'Duarte','status' => 5,'auth_source' => 'platform','email' => 'helena@example.com','creator_id' => 1,'active' => 1); $users[] = array('username' => 'cgonzales','pass'=> 'cgonzales','firstname' => 'Cecilia','lastname' => 'Gonzales','status' => 5,'auth_source' => 'platform','email' => 'cgonzales@example.com','creator_id' => 1,'active' => 1); -$users[] = array('username' => 'amann','pass'=> 'amann','firstname' => 'Aimee','lastname' => 'Mann','status' => 5,'auth_source' => 'platform','email' => 'amann@example.com','creator_id' => 1,'active' => 1); -$users[] = array('username' => 'zazup','pass'=> 'zazup','firstname' => 'Zazup','lastname' => 'Zazupar','status' => 5,'auth_source' => 'platform','email' => 'zazup@example.com','creator_id' => 1,'active' => 1); +$users[] = array('username' => 'amann','pass'=> 'amann','firstname' => 'Aimée','lastname' => 'Mann','status' => 5,'auth_source' => 'platform','email' => 'amann@example.com','creator_id' => 1,'active' => 1); +$users[] = array('username' => 'zzaouidi','pass'=> 'zazup','firstname' => 'Zatar','lastname' => 'Zaouidi','status' => 5,'auth_source' => 'platform','email' => 'zazup@example.com','creator_id' => 1,'active' => 1);