Merge branch '1.11.x' of github.com:chamilo/chamilo-lms into 1.11.x

pull/2858/head
Angel Fernando Quiroz Campos 7 years ago
commit a7d6271897
  1. 27
      app/Resources/public/css/base.css
  2. 69
      main/exercise/exercise.class.php
  3. 7
      main/exercise/exercise_show.php
  4. 6
      main/exercise/fill_blanks.class.php
  5. 30
      main/exercise/hotspot_answers.as.php
  6. 1
      main/exercise/matching.class.php
  7. 9
      main/exercise/overview.php
  8. 14
      main/exercise/question.class.php
  9. 60
      main/group/group_creation.php
  10. 2
      main/inc/lib/chat.lib.php
  11. 2
      main/inc/lib/display.lib.php
  12. 15
      main/inc/lib/exercise.lib.php
  13. 176
      main/inc/lib/exercise_show_functions.lib.php
  14. 3
      main/inc/lib/extra_field.lib.php
  15. 59
      main/inc/lib/groupmanager.lib.php
  16. 8
      main/inc/lib/javascript/hotspot/js/hotspot.js
  17. 14
      main/inc/lib/social.lib.php
  18. 11
      src/Chamilo/CoreBundle/Component/Editor/Driver/CourseDriver.php

@ -8450,10 +8450,13 @@ ul#toolnavbox-two li a.btn {
border-color: #dd853d; border-color: #dd853d;
color: #ffffff; color: #ffffff;
} }
.checkbox input[type=checkbox], .btn-post{
.checkbox-inline input[type=checkbox], margin-top: 10px;
.radio input[type=radio], }
.radio-inline input[type=radio]{ main[dir="rtl"] .checkbox input[type=checkbox],
main[dir="rtl"] .checkbox-inline input[type=checkbox],
main[dir="rtl"] .radio input[type=radio],
main[dir="rtl"] .radio-inline input[type=radio]{
position: relative; position: relative;
margin-left: 10px; margin-left: 10px;
} }
@ -9716,18 +9719,24 @@ ul.dropdown-menu.inner > li > a {
.btn-maps { .btn-maps {
border-radius: 5px; border-radius: 5px;
border-color: #6d9b00; border-color: #cccccc;
background-color: #f8ffdd; background-color: #ffffff;
color: #7a7a7a;
} }
.btn-maps:hover { .btn-maps:hover {
background-color: #d4e9ff !important; background-color: #f5f6f7 !important;
color: #0b3e6f; color: #7a7a7a;
border-color: #75a9e0; border-color: #bababa;
} }
.post-attachment { .post-attachment {
text-align: center; text-align: center;
margin-bottom: 10px;
}
.post-date{
display: inline-block;
width: 100%;
} }
.pager .current { .pager .current {

@ -3537,8 +3537,10 @@ class Exercise
if (!empty($studentChoice)) { if (!empty($studentChoice)) {
if ($studentChoice == $answerCorrect) { if ($studentChoice == $answerCorrect) {
// correct answer and student is Unsure or PrettySur // correct answer and student is Unsure or PrettySur
if ($quiz_question_options[$studentChoiceDegree]['position'] >= 3 if (isset($quiz_question_options[$studentChoiceDegree]) &&
&& $quiz_question_options[$studentChoiceDegree]['position'] < 9) { $quiz_question_options[$studentChoiceDegree]['position'] >= 3 &&
$quiz_question_options[$studentChoiceDegree]['position'] < 9
) {
$questionScore += $true_score; $questionScore += $true_score;
} else { } else {
// student ignore correct answer // student ignore correct answer
@ -3629,21 +3631,15 @@ class Exercise
} }
$studentChoice = isset($choice[$answerAutoId]) ? $choice[$answerAutoId] : ''; $studentChoice = isset($choice[$answerAutoId]) ? $choice[$answerAutoId] : '';
$real_answers[$answerId] = false;
if ($answerCorrect == $studentChoice) { if ($answerCorrect == $studentChoice) {
//$answerCorrect = 1;
$real_answers[$answerId] = true; $real_answers[$answerId] = true;
} else {
//$answerCorrect = 0;
$real_answers[$answerId] = false;
} }
} else { } else {
$studentChoice = isset($choice[$answerAutoId]) ? $choice[$answerAutoId] : ''; $studentChoice = isset($choice[$answerAutoId]) ? $choice[$answerAutoId] : '';
$real_answers[$answerId] = false;
if ($answerCorrect == $studentChoice) { if ($answerCorrect == $studentChoice) {
//$answerCorrect = 1;
$real_answers[$answerId] = true; $real_answers[$answerId] = true;
} else {
//$answerCorrect = 0;
$real_answers[$answerId] = false;
} }
} }
break; break;
@ -3659,31 +3655,27 @@ class Exercise
$studentChoice = isset($choice[$answerAutoId]) ? $choice[$answerAutoId] : null; $studentChoice = isset($choice[$answerAutoId]) ? $choice[$answerAutoId] : null;
if ($answerCorrect == 1) { if ($answerCorrect == 1) {
$real_answers[$answerId] = false;
if ($studentChoice) { if ($studentChoice) {
$real_answers[$answerId] = true; $real_answers[$answerId] = true;
} else {
$real_answers[$answerId] = false;
} }
} else { } else {
$real_answers[$answerId] = true;
if ($studentChoice) { if ($studentChoice) {
$real_answers[$answerId] = false; $real_answers[$answerId] = false;
} else {
$real_answers[$answerId] = true;
} }
} }
} else { } else {
$studentChoice = isset($choice[$answerAutoId]) ? $choice[$answerAutoId] : null; $studentChoice = isset($choice[$answerAutoId]) ? $choice[$answerAutoId] : null;
if ($answerCorrect == 1) { if ($answerCorrect == 1) {
$real_answers[$answerId] = false;
if ($studentChoice) { if ($studentChoice) {
$real_answers[$answerId] = true; $real_answers[$answerId] = true;
} else {
$real_answers[$answerId] = false;
} }
} else { } else {
$real_answers[$answerId] = true;
if ($studentChoice) { if ($studentChoice) {
$real_answers[$answerId] = false; $real_answers[$answerId] = false;
} else {
$real_answers[$answerId] = true;
} }
} }
} }
@ -4283,6 +4275,12 @@ class Exercise
} }
} }
if ($results_disabled == RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER) {
if ($s_user_answer != $i_answer_correct_answer) {
continue;
}
}
if ($show_result) { if ($show_result) {
if ($this->showExpectedChoice() == false && if ($this->showExpectedChoice() == false &&
$showTotalScoreAndUserChoicesInLastAttempt === false $showTotalScoreAndUserChoicesInLastAttempt === false
@ -4901,6 +4899,7 @@ class Exercise
if ($debug) { if ($debug) {
error_log('Showing questions $from '.$from); error_log('Showing questions $from '.$from);
} }
switch ($answerType) { switch ($answerType) {
case UNIQUE_ANSWER: case UNIQUE_ANSWER:
case UNIQUE_ANSWER_IMAGE: case UNIQUE_ANSWER_IMAGE:
@ -5097,26 +5096,6 @@ class Exercise
case HOT_SPOT_DELINEATION: case HOT_SPOT_DELINEATION:
$user_answer = $user_array; $user_answer = $user_array;
if ($next) { 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__);
*/
$user_answer = $user_array; $user_answer = $user_array;
// we compare only the delineation not the other points // we compare only the delineation not the other points
$answer_question = $_SESSION['hotspot_coord'][1]; $answer_question = $_SESSION['hotspot_coord'][1];
@ -5266,7 +5245,6 @@ class Exercise
) )
); );
echo '</tr>'; echo '</tr>';
break; break;
case ANNOTATION: case ANNOTATION:
ExerciseShowFunctions::displayAnnotationAnswer( ExerciseShowFunctions::displayAnnotationAnswer(
@ -5578,16 +5556,17 @@ class Exercise
) { ) {
if ($choice != 0) { if ($choice != 0) {
$reply = array_keys($choice); $reply = array_keys($choice);
for ($i = 0; $i < sizeof($reply); $i++) { $countReply = count($reply);
for ($i = 0; $i < $countReply; $i++) {
$chosenAnswer = $reply[$i]; $chosenAnswer = $reply[$i];
if ($answerType == MULTIPLE_ANSWER_TRUE_FALSE_DEGREE_CERTAINTY) { if ($answerType == MULTIPLE_ANSWER_TRUE_FALSE_DEGREE_CERTAINTY) {
if ($choiceDegreeCertainty != 0) { if ($choiceDegreeCertainty != 0) {
$replyDegreeCertainty = array_keys($choiceDegreeCertainty); $replyDegreeCertainty = array_keys($choiceDegreeCertainty);
$answerDegreeCertainty = $replyDegreeCertainty[$i]; $answerDegreeCertainty = isset($replyDegreeCertainty[$i]) ? $replyDegreeCertainty[$i] : '';
$answerValue = isset($choiceDegreeCertainty[$answerDegreeCertainty]) ? $choiceDegreeCertainty[$answerDegreeCertainty] : '';
Event::saveQuestionAttempt( Event::saveQuestionAttempt(
$questionScore, $questionScore,
$chosenAnswer.':'.$choice[$chosenAnswer].':'. $chosenAnswer.':'.$choice[$chosenAnswer].':'.$answerValue,
$choiceDegreeCertainty[$answerDegreeCertainty],
$quesId, $quesId,
$exeId, $exeId,
$i, $i,
@ -8403,14 +8382,14 @@ class Exercise
['id' => 'result_disabled_6'] ['id' => 'result_disabled_6']
); );
/*$resultDisabledGroup[] = $form->createElement( $resultDisabledGroup[] = $form->createElement(
'radio', 'radio',
'results_disabled', 'results_disabled',
null, null,
get_lang('ExerciseShowOnlyCorrectAnswer'), get_lang('ExerciseShowOnlyCorrectAnswer'),
'7', '7',
['id' => 'result_disabled_7'] ['id' => 'result_disabled_7']
);*/ );
$group = $form->addGroup( $group = $form->addGroup(
$resultDisabledGroup, $resultDisabledGroup,

@ -910,13 +910,18 @@ foreach ($questionList as $questionId) {
$score = []; $score = [];
if ($show_results) { if ($show_results) {
$scorePassed = $my_total_score >= $my_total_weight;
if (function_exists('bccomp')) {
$compareResult = bccomp($my_total_score, $my_total_weight, 3);
$scorePassed = $compareResult === 1 || $compareResult === 0;
}
$score['result'] = ExerciseLib::show_score( $score['result'] = ExerciseLib::show_score(
$my_total_score, $my_total_score,
$my_total_weight, $my_total_weight,
false, false,
false false
); );
$score['pass'] = $my_total_score >= $my_total_weight ? true : false; $score['pass'] = $scorePassed;
$score['type'] = $answerType; $score['type'] = $answerType;
$score['score'] = $my_total_score; $score['score'] = $my_total_score;
$score['weight'] = $my_total_weight; $score['weight'] = $my_total_weight;

@ -1231,6 +1231,12 @@ class FillBlanks extends Question
// rebuild the sentence with student answer inserted // rebuild the sentence with student answer inserted
for ($i = 0; $i < count($listStudentAnswerInfo['common_words']); $i++) { for ($i = 0; $i < count($listStudentAnswerInfo['common_words']); $i++) {
if ($resultsDisabled == RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER) {
if (isset($listStudentAnswerInfo['student_score'][$i]) &&
$listStudentAnswerInfo['student_score'][$i] != 1) {
continue;
}
}
$result .= isset($listStudentAnswerInfo['common_words'][$i]) ? $listStudentAnswerInfo['common_words'][$i] : ''; $result .= isset($listStudentAnswerInfo['common_words'][$i]) ? $listStudentAnswerInfo['common_words'][$i] : '';
$result .= isset($listStudentAnswerInfo['student_answer'][$i]) ? $listStudentAnswerInfo['student_answer'][$i] : ''; $result .= isset($listStudentAnswerInfo['student_answer'][$i]) ? $listStudentAnswerInfo['student_answer'][$i] : '';
} }

@ -163,8 +163,36 @@ if (!$hideExpectedAnswer) {
/** @var CQuizAnswer $hotSpotAnswer */ /** @var CQuizAnswer $hotSpotAnswer */
foreach ($result as $hotSpotAnswer) { foreach ($result as $hotSpotAnswer) {
$hotSpotAnswerId = $hotSpotAnswer->getIid();
// Show only correct hotspots
if ($objExercise->selectResultsDisabled() == RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER) {
$TBL_TRACK_HOTSPOT = Database::get_main_table(TABLE_STATISTIC_TRACK_E_HOTSPOT);
// Check auto id
$sql = "SELECT hotspot_correct
FROM $TBL_TRACK_HOTSPOT
WHERE
hotspot_exe_id = $exeId AND
hotspot_question_id= $questionId AND
hotspot_answer_id = ".$hotSpotAnswerId."
ORDER BY hotspot_id ASC";
$result = Database::query($sql);
$studentChoice = false;
if (Database::num_rows($result)) {
$studentChoice = Database::result(
$result,
0,
'hotspot_correct'
);
}
if (!$studentChoice) {
continue;
}
}
$hotSpot = []; $hotSpot = [];
$hotSpot['id'] = $hotSpotAnswer->getIid(); $hotSpot['id'] = $hotSpotAnswerId;
$hotSpot['answer'] = $hotSpotAnswer->getAnswer(); $hotSpot['answer'] = $hotSpotAnswer->getAnswer();
switch ($hotSpotAnswer->getHotspotType()) { switch ($hotSpotAnswer->getHotspotType()) {

@ -291,6 +291,7 @@ class Matching extends Question
$header .= '<th>'.get_lang('ExpectedChoice').'</th>'; $header .= '<th>'.get_lang('ExpectedChoice').'</th>';
$header .= '<th>'.get_lang('Status').'</th>'; $header .= '<th>'.get_lang('Status').'</th>';
} else { } else {
$header .= '<th>'.get_lang('YourChoice').'</th>';
$header .= '<th>'.get_lang('CorrespondsTo').'</th>'; $header .= '<th>'.get_lang('CorrespondsTo').'</th>';
} }
$header .= '</tr>'; $header .= '</tr>';

@ -52,7 +52,7 @@ $interbreadcrumb[] = [
'url' => 'exercise.php?'.api_get_cidreq(), 'url' => 'exercise.php?'.api_get_cidreq(),
'name' => get_lang('Exercises'), 'name' => get_lang('Exercises'),
]; ];
$interbreadcrumb[] = ["url" => "#", "name" => $objExercise->selectTitle(true)]; $interbreadcrumb[] = ['url' => '#', 'name' => $objExercise->selectTitle(true)];
$time_control = false; $time_control = false;
$clock_expired_time = ExerciseLib::get_session_time_control_key($objExercise->id, $learnpath_id, $learnpath_item_id); $clock_expired_time = ExerciseLib::get_session_time_control_key($objExercise->id, $learnpath_id, $learnpath_item_id);
@ -210,10 +210,7 @@ if (in_array(
if (!empty($attempts)) { if (!empty($attempts)) {
$i = $counter; $i = $counter;
foreach ($attempts as $attempt_result) { foreach ($attempts as $attempt_result) {
$score = ExerciseLib::show_score( $score = ExerciseLib::show_score($attempt_result['exe_result'], $attempt_result['exe_weighting']);
$attempt_result['exe_result'],
$attempt_result['exe_weighting']
);
$attempt_url = api_get_path(WEB_CODE_PATH).'exercise/result.php?'; $attempt_url = api_get_path(WEB_CODE_PATH).'exercise/result.php?';
$attempt_url .= api_get_cidreq().'&show_headers=1&'; $attempt_url .= api_get_cidreq().'&show_headers=1&';
$attempt_url .= http_build_query([ $attempt_url .= http_build_query([
@ -254,6 +251,7 @@ if (!empty($attempts)) {
RESULT_DISABLE_SHOW_SCORE_ATTEMPT_SHOW_ANSWERS_LAST_ATTEMPT, RESULT_DISABLE_SHOW_SCORE_ATTEMPT_SHOW_ANSWERS_LAST_ATTEMPT,
RESULT_DISABLE_DONT_SHOW_SCORE_ONLY_IF_USER_FINISHES_ATTEMPTS_SHOW_ALWAYS_FEEDBACK, RESULT_DISABLE_DONT_SHOW_SCORE_ONLY_IF_USER_FINISHES_ATTEMPTS_SHOW_ALWAYS_FEEDBACK,
RESULT_DISABLE_RANKING, RESULT_DISABLE_RANKING,
RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER
] ]
)) { )) {
$row['result'] = $score; $row['result'] = $score;
@ -267,6 +265,7 @@ if (!empty($attempts)) {
RESULT_DISABLE_SHOW_SCORE_ATTEMPT_SHOW_ANSWERS_LAST_ATTEMPT, RESULT_DISABLE_SHOW_SCORE_ATTEMPT_SHOW_ANSWERS_LAST_ATTEMPT,
RESULT_DISABLE_DONT_SHOW_SCORE_ONLY_IF_USER_FINISHES_ATTEMPTS_SHOW_ALWAYS_FEEDBACK, RESULT_DISABLE_DONT_SHOW_SCORE_ONLY_IF_USER_FINISHES_ATTEMPTS_SHOW_ALWAYS_FEEDBACK,
RESULT_DISABLE_RANKING, RESULT_DISABLE_RANKING,
RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER
] ]
) || ( ) || (
$objExercise->results_disabled == RESULT_DISABLE_SHOW_SCORE_ONLY && $objExercise->results_disabled == RESULT_DISABLE_SHOW_SCORE_ONLY &&

@ -1980,20 +1980,20 @@ abstract class Question
if (!empty($counter)) { if (!empty($counter)) {
$counterLabel = (int) $counter; $counterLabel = (int) $counter;
} }
$score_label = get_lang('Wrong'); $scoreLabel = get_lang('Wrong');
$class = 'error'; $class = 'error';
if (isset($score['pass']) && $score['pass'] == true) { if (isset($score['pass']) && $score['pass'] == true) {
$score_label = get_lang('Correct'); $scoreLabel = get_lang('Correct');
$class = 'success'; $class = 'success';
} }
if (in_array($this->type, [FREE_ANSWER, ORAL_EXPRESSION, ANNOTATION])) { if (in_array($this->type, [FREE_ANSWER, ORAL_EXPRESSION, ANNOTATION])) {
$score['revised'] = isset($score['revised']) ? $score['revised'] : false; $score['revised'] = isset($score['revised']) ? $score['revised'] : false;
if ($score['revised'] == true) { if ($score['revised'] == true) {
$score_label = get_lang('Revised'); $scoreLabel = get_lang('Revised');
$class = ''; $class = '';
} else { } else {
$score_label = get_lang('NotRevised'); $scoreLabel = get_lang('NotRevised');
$class = 'warning'; $class = 'warning';
if (isset($score['weight'])) { if (isset($score['weight'])) {
$weight = float_format($score['weight'], 1); $weight = float_format($score['weight'], 1);
@ -2029,7 +2029,10 @@ abstract class Question
// dont display score for certainty degree questions // dont display score for certainty degree questions
if ($this->type != MULTIPLE_ANSWER_TRUE_FALSE_DEGREE_CERTAINTY) { if ($this->type != MULTIPLE_ANSWER_TRUE_FALSE_DEGREE_CERTAINTY) {
if (isset($score['result'])) { if (isset($score['result'])) {
$header .= $exercise->getQuestionRibbon($class, $score_label, $score['result'], $scoreCurrent); if ($exercise->results_disabled == RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER) {
$score['result'] = null;
}
$header .= $exercise->getQuestionRibbon($class, $scoreLabel, $score['result'], $scoreCurrent);
} }
} }
@ -2070,6 +2073,7 @@ abstract class Question
} }
/** /**
* @deprecated
* Create a question from a set of parameters. * Create a question from a set of parameters.
* *
* @param int Quiz ID * @param int Quiz ID

@ -254,31 +254,43 @@ EOT;
/* /*
* Show form to generate subgroups * Show form to generate subgroups
*/ */
if (api_get_setting('allow_group_categories') === 'true' && count(GroupManager :: get_group_list()) > 0) { if (api_get_setting('allow_group_categories') === 'true') {
$base_group_options = []; $groups = GroupManager::get_group_list();
$groups = GroupManager :: get_group_list(); if (!empty($groups)) {
foreach ($groups as $index => $group) { $base_group_options = [];
$number_of_students = GroupManager :: number_of_students($group['id']); foreach ($groups as $index => $group) {
if ($number_of_students > 0) { $number_of_students = GroupManager::number_of_students($group['id']);
$base_group_options[$group['id']] = $group['name'].' ('.$number_of_students.' '.get_lang('Users').')'; if ($number_of_students > 0) {
$base_group_options[$group['id']] =
$group['name'].' ('.$number_of_students.' '.get_lang('Users').')';
}
}
if (count($base_group_options) > 0) {
$create_subgroups_form = new FormValidator(
'create_subgroups',
'post',
api_get_self().'?'.api_get_cidreq()
);
$create_subgroups_form->addElement('header', get_lang('CreateSubgroups'));
$create_subgroups_form->addElement('html', get_lang('CreateSubgroupsInfo'));
$create_subgroups_form->addElement('hidden', 'action');
$group_el = [];
$group_el[] = $create_subgroups_form->createElement(
'static',
null,
null,
get_lang('CreateNumberOfGroups')
);
$group_el[] = $create_subgroups_form->createElement('text', 'number_of_groups', null, ['size' => 3]);
$group_el[] = $create_subgroups_form->createElement('static', null, null, get_lang('WithUsersFrom'));
$group_el[] = $create_subgroups_form->createElement('select', 'base_group', null, $base_group_options);
$group_el[] = $create_subgroups_form->addButtonSave(get_lang('Ok'), 'submit', true);
$create_subgroups_form->addGroup($group_el, 'create_groups', null, null, false);
$defaults = [];
$defaults['action'] = 'create_subgroups';
$create_subgroups_form->setDefaults($defaults);
$create_subgroups_form->display();
} }
}
if (count($base_group_options) > 0) {
$create_subgroups_form = new FormValidator('create_subgroups', 'post', api_get_self().'?'.api_get_cidreq());
$create_subgroups_form->addElement('header', get_lang('CreateSubgroups'));
$create_subgroups_form->addElement('html', get_lang('CreateSubgroupsInfo'));
$create_subgroups_form->addElement('hidden', 'action');
$group_el = [];
$group_el[] = $create_subgroups_form->createElement('static', null, null, get_lang('CreateNumberOfGroups'));
$group_el[] = $create_subgroups_form->createElement('text', 'number_of_groups', null, ['size' => 3]);
$group_el[] = $create_subgroups_form->createElement('static', null, null, get_lang('WithUsersFrom'));
$group_el[] = $create_subgroups_form->createElement('select', 'base_group', null, $base_group_options);
$group_el[] = $create_subgroups_form->addButtonSave(get_lang('Ok'), 'submit', true);
$create_subgroups_form->addGroup($group_el, 'create_groups', null, null, false);
$defaults = [];
$defaults['action'] = 'create_subgroups';
$create_subgroups_form->setDefaults($defaults);
$create_subgroups_form->display();
} }
} }

@ -323,7 +323,7 @@ class Chat extends Model
$_SESSION['openChatBoxes'][$fromUserId] = api_strtotime($chat['sent'], 'UTC'); $_SESSION['openChatBoxes'][$fromUserId] = api_strtotime($chat['sent'], 'UTC');
} }
$chatHistory[$fromUserId] = [ $chatHistory[$fromUserId] = [
'window_user_info' => $userInfo, 'window_user_info' => $userInfo,
'total_messages' => $count, 'total_messages' => $count,
'items' => $chatItems, 'items' => $chatItems,

@ -2786,7 +2786,7 @@ HTML;
case 'jpeg': case 'jpeg':
case 'gif': case 'gif':
case 'png': case 'png':
$content = '<img width="400px" src="'.$fileUrl.'" />'; $content = '<img class="img-responsive" src="'.$fileUrl.'" />';
break; break;
default: default:
//$html = self::url($data['basename'], $fileUrl); //$html = self::url($data['basename'], $fileUrl);

@ -4429,6 +4429,10 @@ EOT;
$show_results = true; $show_results = true;
} }
if ($objExercise->results_disabled == RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER) {
$show_results = true;
}
if (in_array( if (in_array(
$objExercise->results_disabled, $objExercise->results_disabled,
[ [
@ -4654,14 +4658,18 @@ EOT;
$score = []; $score = [];
if ($show_results) { if ($show_results) {
$scorePassed = $my_total_score >= $my_total_weight;
if (function_exists('bccomp')) {
$compareResult = bccomp($my_total_score, $my_total_weight, 3);
$scorePassed = $compareResult === 1 || $compareResult === 0;
}
$score = [ $score = [
'result' => self::show_score( 'result' => self::show_score(
$my_total_score, $my_total_score,
$my_total_weight, $my_total_weight,
false, false
true
), ),
'pass' => $my_total_score >= $my_total_weight ? true : false, 'pass' => $scorePassed,
'score' => $my_total_score, 'score' => $my_total_score,
'weight' => $my_total_weight, 'weight' => $my_total_weight,
'comments' => $comnt, 'comments' => $comnt,
@ -4683,7 +4691,6 @@ EOT;
$question_content = ''; $question_content = '';
if ($show_results) { if ($show_results) {
$question_content = '<div class="question_row_answer">'; $question_content = '<div class="question_row_answer">';
if ($showQuestionScore == false) { if ($showQuestionScore == false) {
$score = []; $score = [];
} }

@ -57,11 +57,6 @@ class ExerciseShowFunctions
echo '<tr><td>'; echo '<tr><td>';
echo Security::remove_XSS($answerHTML, COURSEMANAGERLOWSECURITY); echo Security::remove_XSS($answerHTML, COURSEMANAGERLOWSECURITY);
echo '</td>'; echo '</td>';
if (!api_is_allowed_to_edit(null, true) && $feedbackType != EXERCISE_FEEDBACK_TYPE_EXAM) {
echo '<td>';
$comm = Event::get_comments($id, $questionId);
echo '</td>';
}
echo '</tr>'; echo '</tr>';
} }
} }
@ -103,11 +98,6 @@ class ExerciseShowFunctions
echo '</td><td>'; echo '</td><td>';
echo Security::remove_XSS($status); echo Security::remove_XSS($status);
echo '</td>'; echo '</td>';
if (!api_is_allowed_to_edit(null, true) && $feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) {
echo '<td>';
$comm = Event::get_comments($id, $questionId);
echo '</td>';
}
echo '</tr>'; echo '</tr>';
} }
} else { } else {
@ -116,11 +106,6 @@ class ExerciseShowFunctions
} else { } else {
echo '<tr><td>'; echo '<tr><td>';
echo Security::remove_XSS($answer); echo Security::remove_XSS($answer);
if (!api_is_allowed_to_edit(null, true) && $feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) {
echo '<td>';
$comm = Event::get_comments($id, $questionId);
echo '</td>';
}
echo '</tr>'; echo '</tr>';
} }
} }
@ -254,55 +239,62 @@ class ExerciseShowFunctions
} }
$hotspot_colors = [ $hotspot_colors = [
"", // $i starts from 1 on next loop (ugly fix) '', // $i starts from 1 on next loop (ugly fix)
"#4271B5", '#4271B5',
"#FE8E16", '#FE8E16',
"#45C7F0", '#45C7F0',
"#BCD631", '#BCD631',
"#D63173", '#D63173',
"#D7D7D7", '#D7D7D7',
"#90AFDD", '#90AFDD',
"#AF8640", '#AF8640',
"#4F9242", '#4F9242',
"#F4EB24", '#F4EB24',
"#ED2024", '#ED2024',
"#3B3B3B", '#3B3B3B',
"#F7BDE2", '#F7BDE2',
]; ];
echo '<table class="data_table"><tr>';
echo '<td class="text-center" width="5%">'; $content = '<table class="data_table"><tr>';
echo '<span class="fa fa-square fa-fw fa-2x" aria-hidden="true" style="color:'. $content .= '<td class="text-center" width="5%">';
$content .= '<span class="fa fa-square fa-fw fa-2x" aria-hidden="true" style="color:'.
$hotspot_colors[$orderColor].'"></span>'; $hotspot_colors[$orderColor].'"></span>';
echo '</td>'; $content .= '</td>';
echo '<td class="text-left" width="25%">'; $content .= '<td class="text-left" width="25%">';
echo "$answerId - $answer"; $content .= "$answerId - $answer";
echo '</td>'; $content .= '</td>';
echo '<td class="text-left" width="10%">'; $content .= '<td class="text-left" width="10%">';
if (!$hide_expected_answer) { if (!$hide_expected_answer) {
$status = Display::label(get_lang('Incorrect'), 'danger'); $status = Display::label(get_lang('Incorrect'), 'danger');
if ($studentChoice) { if ($studentChoice) {
$status = Display::label(get_lang('Correct'), 'success'); $status = Display::label(get_lang('Correct'), 'success');
} else {
if ($resultsDisabled == RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER) {
return '';
}
} }
echo $status; $content .= $status;
} }
echo '</td>'; $content .= '</td>';
if ($feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) { if ($feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) {
echo '<td class="text-left" width="60%">'; $content .= '<td class="text-left" width="60%">';
if ($studentChoice) { if ($studentChoice) {
echo '<span style="font-weight: bold; color: #008000;">'.nl2br($answerComment).'</span>'; $content .= '<span style="font-weight: bold; color: #008000;">'.nl2br($answerComment).'</span>';
} }
echo '</td>'; $content .= '</td>';
} else { } else {
echo '<td class="text-left" width="60%">&nbsp;</td>'; $content .= '<td class="text-left" width="60%">&nbsp;</td>';
} }
echo '</tr>'; $content .= '</tr>';
echo $content;
} }
/** /**
* Display the answers to a multiple choice question. * Display the answers to a multiple choice question.
* *
* @param Exercise $exercise * @param Exercise $exercise
* @param int $feedback_type Feedback type * @param int $feedbackType Feedback type
* @param int $answerType Answer type * @param int $answerType Answer type
* @param int $studentChoice Student choice * @param int $studentChoice Student choice
* @param string $answer Textual answer * @param string $answer Textual answer
@ -317,7 +309,7 @@ class ExerciseShowFunctions
*/ */
public static function display_unique_or_multiple_answer( public static function display_unique_or_multiple_answer(
$exercise, $exercise,
$feedback_type, $feedbackType,
$answerType, $answerType,
$studentChoice, $studentChoice,
$answer, $answer,
@ -342,15 +334,22 @@ class ExerciseShowFunctions
$answer = str_replace($tags, '', $answer); $answer = str_replace($tags, '', $answer);
} }
$studentChoiceInt = (int) $studentChoice;
$answerCorrectChoice = (int) $answerCorrect;
$hide_expected_answer = false; $hide_expected_answer = false;
switch ($resultsDisabled) { switch ($resultsDisabled) {
case RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER: case RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER:
if ($studentChoiceInt !== $answerCorrectChoice) {
return '';
}
if (!$answerCorrect) { if (!$answerCorrect) {
$hide_expected_answer = true; return '';
} }
break; break;
case RESULT_DISABLE_SHOW_SCORE_ONLY: case RESULT_DISABLE_SHOW_SCORE_ONLY:
if ($feedback_type == 0) { if ($feedbackType == 0) {
$hide_expected_answer = true; $hide_expected_answer = true;
} }
break; break;
@ -384,14 +383,8 @@ class ExerciseShowFunctions
echo '</td>'; echo '</td>';
if ($exercise->showExpectedChoice()) { if ($exercise->showExpectedChoice()) {
/*$status = Display::label(get_lang('Incorrect'), 'danger');
if ($studentChoice && $answerCorrect) {
$status = Display::label(get_lang('Correct'), 'success');
}*/
$studentChoiceChoice = (int) $studentChoice;
$answerCorrectChoice = (int) $answerCorrect;
$status = Display::label(get_lang('Incorrect'), 'danger'); $status = Display::label(get_lang('Incorrect'), 'danger');
if ($studentChoiceChoice === $answerCorrectChoice) { if ($studentChoiceInt === $answerCorrectChoice) {
$status = Display::label(get_lang('Correct'), 'success'); $status = Display::label(get_lang('Correct'), 'success');
} }
echo '<td width="20%">'; echo '<td width="20%">';
@ -399,7 +392,7 @@ class ExerciseShowFunctions
echo '</td>'; echo '</td>';
} }
if ($feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) { if ($feedbackType != EXERCISE_FEEDBACK_TYPE_EXAM) {
echo '<td width="20%">'; echo '<td width="20%">';
if ($studentChoice) { if ($studentChoice) {
$color = 'black'; $color = 'black';
@ -444,7 +437,7 @@ class ExerciseShowFunctions
*/ */
public static function display_multiple_answer_true_false( public static function display_multiple_answer_true_false(
$exercise, $exercise,
$feedback_type, $feedbackType,
$answerType, $answerType,
$studentChoice, $studentChoice,
$answer, $answer,
@ -459,7 +452,7 @@ class ExerciseShowFunctions
$hide_expected_answer = false; $hide_expected_answer = false;
switch ($resultsDisabled) { switch ($resultsDisabled) {
case RESULT_DISABLE_SHOW_SCORE_ONLY: case RESULT_DISABLE_SHOW_SCORE_ONLY:
if ($feedback_type == 0) { if ($feedbackType == 0) {
$hide_expected_answer = true; $hide_expected_answer = true;
} }
break; break;
@ -471,29 +464,30 @@ class ExerciseShowFunctions
} }
break; break;
} }
echo '<tr><td width="5%">';
$content = '<tr><td width="5%">';
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
$new_options = Question::readQuestionOption($questionId, $course_id); $new_options = Question::readQuestionOption($questionId, $course_id);
// Your choice // Your choice
if (isset($new_options[$studentChoice])) { if (isset($new_options[$studentChoice])) {
echo get_lang($new_options[$studentChoice]['name']); $content .= get_lang($new_options[$studentChoice]['name']);
} else { } else {
echo '-'; $content .= '-';
} }
echo '</td><td width="5%">'; echo '</td><td width="5%">';
// Expected choice // Expected choice
if (!$hide_expected_answer) { if (!$hide_expected_answer) {
if (isset($new_options[$answerCorrect])) { if (isset($new_options[$answerCorrect])) {
echo get_lang($new_options[$answerCorrect]['name']); $content .= get_lang($new_options[$answerCorrect]['name']);
} else { } else {
echo '-'; $content .= '-';
} }
} else { } else {
echo '-'; $content .= '-';
} }
echo '</td><td width="40%">'; $content .= '</td><td width="40%">';
echo $answer; $content .= $answer;
echo '</td>'; $content .= '</td>';
if ($exercise->showExpectedChoice()) { if ($exercise->showExpectedChoice()) {
$status = Display::label(get_lang('Incorrect'), 'danger'); $status = Display::label(get_lang('Incorrect'), 'danger');
if (isset($new_options[$studentChoice])) { if (isset($new_options[$studentChoice])) {
@ -501,31 +495,35 @@ class ExerciseShowFunctions
$status = Display::label(get_lang('Correct'), 'success'); $status = Display::label(get_lang('Correct'), 'success');
} }
} }
echo '<td width="20%">'; $content .= '<td width="20%">';
echo $status; $content .= $status;
echo '</td>'; $content .= '</td>';
} }
if ($feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) { if ($feedbackType != EXERCISE_FEEDBACK_TYPE_EXAM) {
echo '<td width="20%">'; if ($resultsDisabled == RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER) {
$color = "black"; if ($studentChoice != $answerCorrect) {
return '';
}
}
$content .= '<td width="20%">';
$color = 'black';
if (isset($new_options[$studentChoice])) { if (isset($new_options[$studentChoice])) {
if ($studentChoice == $answerCorrect) { if ($studentChoice == $answerCorrect) {
$color = "green"; $color = 'green';
} }
if ($hide_expected_answer) { if ($hide_expected_answer) {
$color = ''; $color = '';
} }
echo '<span style="font-weight: bold; color: '.$color.';">'.nl2br($answerComment).'</span>'; $content .= '<span style="font-weight: bold; color: '.$color.';">'.nl2br($answerComment).'</span>';
}
echo '</td>';
if ($ans == 1) {
$comm = Event::get_comments($id, $questionId);
} }
$content .= '</td>';
} else { } else {
echo '<td>&nbsp;</td>'; $content .= '<td>&nbsp;</td>';
} }
echo '</tr>'; $content .= '</tr>';
echo $content;
} }
/** /**
@ -582,7 +580,9 @@ class ExerciseShowFunctions
echo '</td><td width="20%">'; echo '</td><td width="20%">';
echo $answer; echo $answer;
echo '</td><td width="5%" style="text-align:center;">'; echo '</td><td width="5%" style="text-align:center;">';
echo $newOptions[$studentChoiceDegree]['name']; if (isset($newOptions[$studentChoiceDegree])) {
echo $newOptions[$studentChoiceDegree]['name'];
}
echo '</td>'; echo '</td>';
$degreeInfo = $question->getResponseDegreeInfo( $degreeInfo = $question->getResponseDegreeInfo(
@ -628,7 +628,7 @@ class ExerciseShowFunctions
*/ */
public static function display_multiple_answer_combination_true_false( public static function display_multiple_answer_combination_true_false(
$exercise, $exercise,
$feedback_type, $feedbackType,
$answerType, $answerType,
$studentChoice, $studentChoice,
$answer, $answer,
@ -643,7 +643,7 @@ class ExerciseShowFunctions
$hide_expected_answer = false; $hide_expected_answer = false;
switch ($resultsDisabled) { switch ($resultsDisabled) {
case RESULT_DISABLE_SHOW_SCORE_ONLY: case RESULT_DISABLE_SHOW_SCORE_ONLY:
if ($feedback_type == 0) { if ($feedbackType == 0) {
$hide_expected_answer = true; $hide_expected_answer = true;
} }
break; break;
@ -694,7 +694,7 @@ class ExerciseShowFunctions
echo '</td>'; echo '</td>';
} }
if ($feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) { if ($feedbackType != EXERCISE_FEEDBACK_TYPE_EXAM) {
echo '<td width="20%">'; echo '<td width="20%">';
//@todo replace this harcoded value //@todo replace this harcoded value
if ($studentChoice) { if ($studentChoice) {
@ -718,21 +718,21 @@ class ExerciseShowFunctions
} }
/** /**
* @param $feedback_type * @param $feedbackType
* @param $exe_id * @param $exe_id
* @param $questionId * @param $questionId
* @param null $questionScore * @param null $questionScore
* @param int $resultsDisabled * @param int $resultsDisabled
*/ */
public static function displayAnnotationAnswer( public static function displayAnnotationAnswer(
$feedback_type, $feedbackType,
$exe_id, $exe_id,
$questionId, $questionId,
$questionScore = null, $questionScore = null,
$resultsDisabled = 0 $resultsDisabled = 0
) { ) {
$comments = Event::get_comments($exe_id, $questionId); $comments = Event::get_comments($exe_id, $questionId);
if ($feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) { if ($feedbackType != EXERCISE_FEEDBACK_TYPE_EXAM) {
if ($questionScore <= 0 && empty($comments)) { if ($questionScore <= 0 && empty($comments)) {
echo '<br />'.ExerciseLib::getNotCorrectedYetText(); echo '<br />'.ExerciseLib::getNotCorrectedYetText();
} }

@ -1771,7 +1771,8 @@ class ExtraField extends Model
$form->addGeoLocationMapField( $form->addGeoLocationMapField(
'extra_'.$field_details['variable'], 'extra_'.$field_details['variable'],
$field_details['display_text'], $field_details['display_text'],
$dataValue $dataValue,
$hideGeoLocalizationDetails
); );
/*$form->addElement( /*$form->addElement(

@ -66,9 +66,11 @@ class GroupManager
} }
/** /**
* @param int $courseId
*
* @return array * @return array
*/ */
public static function get_groups($courseId = null) public static function get_groups($courseId = 0)
{ {
$table_group = Database::get_course_table(TABLE_GROUP); $table_group = Database::get_course_table(TABLE_GROUP);
$courseId = !empty($courseId) ? (int) $courseId : api_get_course_int_id(); $courseId = !empty($courseId) ? (int) $courseId : api_get_course_int_id();
@ -189,7 +191,7 @@ class GroupManager
$course_id = $_course['real_id']; $course_id = $_course['real_id'];
$currentCourseRepository = $_course['path']; $currentCourseRepository = $_course['path'];
$category = self::get_category($category_id); $category = self::get_category($category_id);
$places = intval($places); $places = (int) $places;
// Default values // Default values
$docState = self::TOOL_PRIVATE; $docState = self::TOOL_PRIVATE;
@ -247,7 +249,7 @@ class GroupManager
self_registration_allowed = '".$selfRegAllowed."', self_registration_allowed = '".$selfRegAllowed."',
self_unregistration_allowed = '".$selfUnregAllwoed."', self_unregistration_allowed = '".$selfUnregAllwoed."',
$documentCondition $documentCondition
session_id='".intval($session_id)."'"; session_id='".$session_id."'";
Database::query($sql); Database::query($sql);
$lastId = Database::insert_id(); $lastId = Database::insert_id();
@ -387,27 +389,31 @@ class GroupManager
/** /**
* Create a group for every class subscribed to the current course. * Create a group for every class subscribed to the current course.
* *
* @param int $category_id The category in which the groups should be created * @param int $categoryId The category in which the groups should be created
* *
* @return array * @return array
*/ */
public static function create_class_groups($category_id) public static function create_class_groups($categoryId)
{ {
$options['where'] = [" usergroup.course_id = ? " => api_get_course_int_id()]; $options['where'] = [' usergroup.course_id = ? ' => api_get_course_int_id()];
$obj = new UserGroup(); $obj = new UserGroup();
$classes = $obj->getUserGroupInCourse($options); $classes = $obj->getUserGroupInCourse($options);
$group_ids = []; $group_ids = [];
foreach ($classes as $class) { foreach ($classes as $class) {
$users_ids = $obj->get_users_by_usergroup($class['id']); $userList = $obj->get_users_by_usergroup($class['id']);
$group_id = self::create_group( $groupId = self::create_group(
$class['name'], $class['name'],
$category_id, $categoryId,
0, 0,
count($users_ids) null
); );
$groupInfo = self::get_group_properties($group_id);
self::subscribe_users($users_ids, $groupInfo); if ($groupId) {
$group_ids[] = $group_id; $groupInfo = self::get_group_properties($groupId);
self::subscribe_users($userList, $groupInfo);
$group_ids[] = $groupId;
}
} }
return $group_ids; return $group_ids;
@ -544,17 +550,19 @@ class GroupManager
public static function get_group_properties($group_id, $useIid = false) public static function get_group_properties($group_id, $useIid = false)
{ {
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
if (empty($group_id) || !is_int(intval($group_id))) { $group_id = (int) $group_id;
if (empty($group_id)) {
return null; return null;
} }
$table_group = Database::get_course_table(TABLE_GROUP); $table_group = Database::get_course_table(TABLE_GROUP);
$sql = "SELECT * FROM $table_group $sql = "SELECT * FROM $table_group
WHERE c_id = $course_id AND id = ".intval($group_id); WHERE c_id = $course_id AND id = ".$group_id;
if ($useIid) { if ($useIid) {
$sql = "SELECT * FROM $table_group $sql = "SELECT * FROM $table_group
WHERE c_id = $course_id AND iid = ".intval($group_id); WHERE c_id = $course_id AND iid = ".$group_id;
} }
$db_result = Database::query($sql); $db_result = Database::query($sql);
$db_object = Database::fetch_object($db_result); $db_object = Database::fetch_object($db_result);
@ -642,7 +650,7 @@ class GroupManager
return []; return [];
} }
$name = Database::escape_string($name); $name = Database::escape_string($name);
$courseId = intval($courseId); $courseId = (int) $courseId;
$table_group = Database::get_course_table(TABLE_GROUP); $table_group = Database::get_course_table(TABLE_GROUP);
$sql = "SELECT * FROM $table_group $sql = "SELECT * FROM $table_group
WHERE c_id = $courseId AND name LIKE '%$name%'"; WHERE c_id = $courseId AND name LIKE '%$name%'";
@ -698,8 +706,8 @@ class GroupManager
) { ) {
$table_group = Database::get_course_table(TABLE_GROUP); $table_group = Database::get_course_table(TABLE_GROUP);
$table_forum = Database::get_course_table(TABLE_FORUM); $table_forum = Database::get_course_table(TABLE_FORUM);
$categoryId = intval($categoryId); $categoryId = (int) $categoryId;
$group_id = intval($group_id); $group_id = (int) $group_id;
$courseId = api_get_course_int_id(); $courseId = api_get_course_int_id();
$allowDocumentAccess = api_get_configuration_value('group_document_access'); $allowDocumentAccess = api_get_configuration_value('group_document_access');
@ -723,7 +731,7 @@ class GroupManager
self_registration_allowed = '".Database::escape_string($selfRegistrationAllowed)."', self_registration_allowed = '".Database::escape_string($selfRegistrationAllowed)."',
self_unregistration_allowed = '".Database::escape_string($selfUnRegistrationAllowed)."', self_unregistration_allowed = '".Database::escape_string($selfUnRegistrationAllowed)."',
$documentCondition $documentCondition
category_id = ".intval($categoryId)." category_id = ".$categoryId."
WHERE c_id = $courseId AND id=".$group_id; WHERE c_id = $courseId AND id=".$group_id;
$result = Database::query($sql); $result = Database::query($sql);
@ -1051,7 +1059,7 @@ class GroupManager
$documentAccess $documentAccess
) { ) {
$table = Database::get_course_table(TABLE_GROUP_CATEGORY); $table = Database::get_course_table(TABLE_GROUP_CATEGORY);
$id = intval($id); $id = (int) $id;
$courseId = api_get_course_int_id(); $courseId = api_get_course_int_id();
@ -1544,9 +1552,10 @@ class GroupManager
public static function is_self_registration_allowed($user_id, $groupInfo) public static function is_self_registration_allowed($user_id, $groupInfo)
{ {
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
if (!$user_id > 0) { if (empty($user_id)) {
return false; return false;
} }
$groupIid = $groupInfo['iid']; $groupIid = $groupInfo['iid'];
$table = Database::get_course_table(TABLE_GROUP); $table = Database::get_course_table(TABLE_GROUP);
if (isset($groupIid)) { if (isset($groupIid)) {
@ -1576,7 +1585,7 @@ class GroupManager
*/ */
public static function is_self_unregistration_allowed($user_id, $groupInfo) public static function is_self_unregistration_allowed($user_id, $groupInfo)
{ {
if (!$user_id > 0 || empty($groupInfo)) { if (empty($user_id) || empty($groupInfo)) {
return false; return false;
} }
$groupIid = $groupInfo['iid']; $groupIid = $groupInfo['iid'];
@ -1917,7 +1926,7 @@ class GroupManager
return false; return false;
} }
if (!empty($groupId) > 0) { if (!empty($groupId)) {
$table_group_tutor = Database::get_course_table(TABLE_GROUP_TUTOR); $table_group_tutor = Database::get_course_table(TABLE_GROUP_TUTOR);
$sql = "DELETE FROM $table_group_tutor $sql = "DELETE FROM $table_group_tutor
WHERE group_id = $groupId AND c_id = $courseId"; WHERE group_id = $groupId AND c_id = $courseId";
@ -3129,7 +3138,7 @@ class GroupManager
case self::DOCUMENT_MODE_SHARE: case self::DOCUMENT_MODE_SHARE:
// Default chamilo behaviour // Default chamilo behaviour
// Student can upload his own content, cannot modify another content. // Student can upload his own content, cannot modify another content.
$isMember = GroupManager::is_subscribed($userId, $groupInfo); $isMember = self::is_subscribed($userId, $groupInfo);
if ($isMember) { if ($isMember) {
// No document to check, allow access to document feature. // No document to check, allow access to document feature.
if (empty($documentInfoToBeCheck)) { if (empty($documentInfoToBeCheck)) {

@ -764,11 +764,9 @@ window.HotspotQuestion = (function () {
default: default:
hotspot = SquareModel.decode(hotspotInfo); hotspot = SquareModel.decode(hotspotInfo);
break; break;
case 'circle': case 'circle':
hotspot = EllipseModel.decode(hotspotInfo); hotspot = EllipseModel.decode(hotspotInfo);
break; break;
case 'poly': case 'poly':
hotspot = PolygonModel.decode(hotspotInfo); hotspot = PolygonModel.decode(hotspotInfo);
break; break;
@ -891,9 +889,7 @@ window.HotspotQuestion = (function () {
}) })
.on('mousedown', 'circle, text', function (e) { .on('mousedown', 'circle, text', function (e) {
e.preventDefault(); e.preventDefault();
isMoving = true; isMoving = true;
if (e.target.tagName === 'circle') { if (e.target.tagName === 'circle') {
//Hack to move correctly the hot spots if there are more than one HS question in same page //Hack to move correctly the hot spots if there are more than one HS question in same page
answerIndex = $(e.target).next().html(); answerIndex = $(e.target).next().html();
@ -1141,16 +1137,14 @@ window.HotspotQuestion = (function () {
modifyAnswers: parseInt(config.questionId) modifyAnswers: parseInt(config.questionId)
}); });
break; break;
case 'user': case 'user':
xhrQuestion = $.getJSON(config.relPath + 'exercise/hotspot_actionscript.as.php?' + _p.web_cid_query, { xhrQuestion = $.getJSON(config.relPath + 'exercise/hotspot_actionscript.as.php?' + _p.web_cid_query, {
modifyAnswers: parseInt(config.questionId), modifyAnswers: parseInt(config.questionId),
exe_id: parseInt(config.exerciseId) exe_id: parseInt(config.exerciseId)
}); });
break; break;
case 'solution': case 'solution':
//no break //no break
case 'preview': case 'preview':
xhrQuestion = $.getJSON(config.relPath + 'exercise/hotspot_answers.as.php?' + _p.web_cid_query, { xhrQuestion = $.getJSON(config.relPath + 'exercise/hotspot_answers.as.php?' + _p.web_cid_query, {
modifyAnswers: parseInt(config.questionId), modifyAnswers: parseInt(config.questionId),

@ -1826,13 +1826,17 @@ class SocialManager extends UserManager
$formattedList .= '</div>'; $formattedList .= '</div>';
$formattedList .= '<div class="mediapost-form">'; $formattedList .= '<div class="mediapost-form">';
$formattedList .= '<form id = "form_comment_'.$messageId.'" name="post_comment" method="POST"> $formattedList .= '<form class="form-horizontal" id="form_comment_'.$messageId.'" name="post_comment" method="POST">
<div class="col-sm-9">
<label for="comment" class="hide">'.get_lang('SocialWriteNewComment').'</label> <label for="comment" class="hide">'.get_lang('SocialWriteNewComment').'</label>
<input type="hidden" name = "messageId" value="'.$messageId.'" /> <input type="hidden" name = "messageId" value="'.$messageId.'" />
<textarea placeholder="'.get_lang('SocialWriteNewComment').'" name="comment" rows="1" style="width:80%;" ></textarea> <textarea rows="3" class="form-control" placeholder="'.get_lang('SocialWriteNewComment').'" name="comment" rows="1" ></textarea>
<a onclick="submitComment('.$messageId.');" href="javascript:void(0);" name="social_wall_new_msg_submit" class="pull-right btn btn-default"> </div>
<div class="col-sm-3">
<a onclick="submitComment('.$messageId.');" href="javascript:void(0);" name="social_wall_new_msg_submit" class="btn btn-default btn-post">
<em class="fa fa-pencil"></em> '.get_lang('Post').' <em class="fa fa-pencil"></em> '.get_lang('Post').'
</a> </a>
</div>
</form>'; </form>';
$formattedList .= '</div>'; $formattedList .= '</div>';
@ -3169,10 +3173,10 @@ class SocialManager extends UserManager
$html .= '<div class="user-data">'; $html .= '<div class="user-data">';
$html .= $iconStatus; $html .= $iconStatus;
$html .= '<div class="username"><a href="'.$urlAuthor.'">'.$nameCompleteAuthor.'</a>'.$htmlReceiver.'</div>'; $html .= '<div class="username"><a href="'.$urlAuthor.'">'.$nameCompleteAuthor.'</a>'.$htmlReceiver.'</div>';
$html .= '<div>'.$date.'</div>'; $html .= '<div class="post-date">'.$date.'</div>';
$html .= '</div>'; $html .= '</div>';
$html .= '<div class="msg-content">'; $html .= '<div class="msg-content">';
$html .= '<div class="post-attachment" >'; $html .= '<div class="post-attachment thumbnail">';
$html .= $postAttachment; $html .= $postAttachment;
$html .= '</div>'; $html .= '</div>';
$html .= '<div>'.Security::remove_XSS($message['content']).'</div>'; $html .= '<div>'.Security::remove_XSS($message['content']).'</div>';

@ -127,6 +127,17 @@ class CourseDriver extends Driver implements DriverInterface
unset($defaultDisabled['mkdir']); unset($defaultDisabled['mkdir']);
$defaultDisabled = array_flip($defaultDisabled); $defaultDisabled = array_flip($defaultDisabled);
$config['disabled'] = $defaultDisabled; $config['disabled'] = $defaultDisabled;
} else {
$protectedFolders = \DocumentManager::getProtectedFolderFromStudent();
foreach ($protectedFolders as $folder) {
$config['attributes'][] = [
'pattern' => $folder.'/',
'read' => false,
'write' => false,
'hidden' => true,
'locked' => false,
];
}
} }
$foldersToHide = \DocumentManager::get_all_document_folders( $foldersToHide = \DocumentManager::get_all_document_folders(

Loading…
Cancel
Save