Merge branch '1.11.x' into grill

pull/2487/head
Alex Aragon 8 years ago
commit 18dc8af9b3
  1. 36
      main/admin/career_dashboard.php
  2. 4
      main/admin/teachers_time_by_session_report.php
  3. 2
      main/auth/layout.php
  4. 18
      main/exercise/exercise.class.php
  5. 2
      main/exercise/hotspot_answers.as.php
  6. 67
      main/exercise/question.class.php
  7. 54
      main/inc/lib/exercise.lib.php
  8. 2
      main/inc/lib/javascript/ckeditor/plugins/image2_chamilo/lang/fr.js
  9. 36
      main/inc/lib/javascript/hotspot/css/hotspot.css
  10. 4
      main/mySpace/works_in_session_report.php

@ -81,7 +81,7 @@ if (!empty($careers)) {
// Getting all promotions
$promotions = $promotion->get_all_promotions_by_career_id(
$career_item['id'],
'name DESC'
'name ASC'
);
$career_content = '';
$promotion_array = array();
@ -118,7 +118,7 @@ if (!empty($careers)) {
}
}
echo '<table class="data_table" border="1">';
echo '<table class="data_table">';
if (!empty($career_array)) {
foreach ($career_array as $career_id => $data) {
@ -132,33 +132,38 @@ if (!empty($career_array)) {
$promotion_name = $promotion['name'];
$promotion_url = Display::url($promotion_name, 'promotions.php?action=edit&id=' . $promotion_id);
$sessions = $promotion['sessions'];
echo '<tr>';
$count = count($sessions);
$count = count($promotion['sessions']);
$rowspan = '';
if (!empty($count)) {
$count++;
$rowspan = 'rowspan="' . $count . '"';
}
echo '<td ' . $rowspan . '>';
echo Display::tag('h5', $promotion_url);
echo '</td>';
echo '</tr>';
echo '<tr style="border-bottom:1px solid #ccc;">'.
'<td ' . $rowspan . ' style="border-right:1px solid #aaa;">'.
Display::tag('h5', $promotion_url).
'</td>';
$first = true;
if (!empty($sessions)) {
foreach ($sessions as $session) {
$course_list = $session['courses'];
$url = Display::url(
$session['data']['name'],
'../session/resume_session.php?id_session='.$session['data']['id']
);
echo '<tr>';
// Tricky TR because of "rowspan" in previous TD - only
// use TR if not on the first line
if (!$first) {
echo '<tr style="border-bottom:1px solid #ccc;">';
} else {
$first = false;
}
// Session name
echo Display::tag('td', $url);
echo Display::tag('td', $url, array('style' => 'border-right:1px solid #aaa;'));
echo '<td>';
// Courses
echo '<ul>';
if (!empty($course_list)) {
foreach ($course_list as $course) {
if (!empty($session['courses'])) {
foreach ($session['courses'] as $course) {
echo '<li>';
$url = Display::url(
$course['title'],
@ -169,8 +174,11 @@ if (!empty($career_array)) {
}
}
echo '</ul>';
echo '</td>';
echo '</tr>';
}
}
echo '</tr>';
}
}
}

@ -22,7 +22,9 @@ if (!api_is_platform_admin(true) && !api_is_teacher()) {
$toolName = get_lang('TeacherTimeReportBySession');
$em = Database::getManager();
$sessionsInfo = Tracking::get_sessions_coached_by_user(api_get_user_id());
$sessionsInfo = api_is_platform_admin()
? SessionManager::get_sessions_list()
: Tracking::get_sessions_coached_by_user(api_get_user_id());
$session = null;
$form = new FormValidator('teacher_time_report_by_session', 'GET');

@ -8,7 +8,7 @@
*/
// Access rights: anonymous users can't do anything useful here.
api_block_anonymous_users();
//api_block_anonymous_users();
// Header
Display::display_header('');

@ -2,6 +2,7 @@
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
use Chamilo\CoreBundle\Entity\TrackEHotspot;
/**
* Class Exercise
@ -3213,7 +3214,7 @@ class Exercise
'cId' => $course_id,
'hotspotExeId' => $exeId
],
['hotspotId' => 'ASC']
['hotspotAnswerId' => 'ASC']
);
}
@ -3985,7 +3986,8 @@ class Exercise
WHERE
hotspot_exe_id = $exeId AND
hotspot_question_id= $questionId AND
hotspot_answer_id = ".intval($answerAutoId);
hotspot_answer_id = ".intval($answerAutoId)."
ORDER BY hotspot_id ASC";
$result = Database::query($sql);
if (Database::num_rows($result)) {
$studentChoice = Database::result(
@ -4005,7 +4007,8 @@ class Exercise
WHERE
hotspot_exe_id = $exeId AND
hotspot_question_id= $questionId AND
hotspot_answer_id = ".intval($answerId);
hotspot_answer_id = ".intval($answerId)."
ORDER BY hotspot_id ASC";
$result = Database::query($sql);
if (Database::num_rows($result)) {
@ -4027,7 +4030,8 @@ class Exercise
WHERE
hotspot_exe_id = $exeId AND
hotspot_question_id= $questionId AND
hotspot_answer_id = ".intval($answerIid);
hotspot_answer_id = ".intval($answerIid)."
ORDER BY hotspot_id ASC";
$result = Database::query($sql);
$studentChoice = Database::result(
@ -4267,6 +4271,10 @@ class Exercise
$results_disabled
);
} elseif ($answerType == HOT_SPOT) {
/**
* @var int $correctAnswerId
* @var TrackEHotspot $hotspot
*/
foreach ($orderedHotspots as $correctAnswerId => $hotspot) {
if ($hotspot->getHotspotAnswerId() == $answerAutoId) {
break;
@ -4280,7 +4288,7 @@ class Exercise
$studentChoice,
$answerComment,
$results_disabled,
$answerId,
$correctAnswerId,
$showTotalScoreAndUserChoicesInLastAttempt
);
} elseif ($answerType == HOT_SPOT_ORDER) {

@ -153,7 +153,7 @@ $rs = $em
'cId' => $course_id,
'hotspotExeId' => $exe_id
],
['hotspotId' => 'ASC']
['hotspotAnswerId' => 'ASC']
);
/** @var TrackEHotspot $row */

@ -774,39 +774,52 @@ abstract class Question
$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)) {
if (!$this->id || empty($this->picture)) {
return false;
}
if (file_exists($source_path.'/'.$this->picture)) {
// for backward compatibility
$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)."'";
Database::query($sql);
$result = @copy($source_path.'/'.$this->picture, $destination_path.'/'.$picture);
} else {
$imageInfo = DocumentManager::get_document_data_by_id($this->picture, $course_info['code']);
$picture = $this->generatePictureName();
$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()
);
}
}
$result = @copy($imageInfo['absolute_path'], $destination_path.'/'.$picture);
}
return $result;
// If copy was correct then add to the database
if (!$result) {
return false;
}
return false;
$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
);
if (!$document_id) {
return false;
}
return api_item_property_update(
$course_info,
TOOL_DOCUMENT,
$document_id,
'DocumentAdded',
api_get_user_id()
);
}
/**

@ -1148,24 +1148,6 @@ HTML;
}
$questionName = $objQuestionTmp->selectTitle();
$questionDescription = $objQuestionTmp->selectDescription();
if ($freeze) {
$relPath = api_get_path(WEB_CODE_PATH);
echo "
<script>
// $(document).on('ready', function () {
new " . ($answerType == HOT_SPOT ? "HotspotQuestion" : "DelineationQuestion") . "({
questionId: $questionId,
exerciseId: $exerciseId,
selector: '#hotspot-preview-$questionId',
for: 'preview',
relPath: '$relPath'
});
// });
</script>
<div id=\"hotspot-preview-$questionId\"></div>
";
return;
}
// Get the answers, make a list
$objAnswerTmp = new Answer($questionId);
@ -1188,20 +1170,19 @@ HTML;
$answerList = '
<div class="well well-sm">
<h5 class="page-header">' . get_lang('HotspotZones') . '</h5>
<ul>
<ol>
';
if (!empty($answers_hotspot)) {
Session::write("hotspot_ordered$questionId", array_keys($answers_hotspot));
$countAnswers = 1;
foreach ($answers_hotspot as $value) {
$answerList .= "<p>";
$answerList .= "<li>";
if ($freeze) {
$answerList .= "&nbsp<span class='hotspot-color hotspot-color-$hotspotColor'>&nbsp;&nbsp;&nbsp;&nbsp;</span>";
$answerList .= '<span class="hotspot-color-'.$hotspotColor
.' fa fa-square" aria-hidden="true"></span>'.PHP_EOL;
}
$answerList .= "&nbsp{$countAnswers}.&nbsp;";
$answerList .= $value;
$answerList .= "</p>";
$answerList .= "</li>";
$hotspotColor++;
}
}
@ -1210,6 +1191,31 @@ HTML;
</ul>
</div>
';
if ($freeze) {
$relPath = api_get_path(WEB_CODE_PATH);
echo "
<div class=\"row\">
<div class=\"col-sm-9\">
<div id=\"hotspot-preview-$questionId\"></div>
</div>
<div class=\"col-sm-3\">
$answerList
</div>
</div>
<script>
new " . ($answerType == HOT_SPOT ? "HotspotQuestion" : "DelineationQuestion") . "({
questionId: $questionId,
exerciseId: $exerciseId,
selector: '#hotspot-preview-$questionId',
for: 'preview',
relPath: '$relPath'
});
</script>
";
return;
}
}
if (!$only_questions) {

@ -2,7 +2,7 @@
Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'image2-chamilo', 'fr', {
CKEDITOR.plugins.setLang( 'image2_chamilo', 'fr', {
alt: 'Texte alternatif',
btnUpload: 'Envoyer sur le serveur',
captioned: 'Image légendée',

@ -8,40 +8,52 @@
position: absolute;
}
.input-group.hotspot-0 .fa-square {
.input-group.hotspot-0 .fa-square,
.hotspot-color-0.fa.fa-square {
color: rgb(66, 113, 181);
}
.input-group.hotspot-1 .fa-square {
.input-group.hotspot-1 .fa-square,
.hotspot-color-1.fa.fa-square {
color: rgb(254, 142, 22);
}
.input-group.hotspot-2 .fa-square {
.input-group.hotspot-2 .fa-square,
.hotspot-color-2.fa.fa-square {
color: rgb(69, 199, 240);
}
.input-group.hotspot-3 .fa-square {
.input-group.hotspot-3 .fa-square,
.hotspot-color-3.fa.fa-square {
color: rgb(188, 214, 49);
}
.input-group.hotspot-4 .fa-square {
.input-group.hotspot-4 .fa-square,
.hotspot-color-4.fa.fa-square {
color: rgb(214, 49, 115);
}
.input-group.hotspot-5 .fa-square {
.input-group.hotspot-5 .fa-square,
.hotspot-color-5.fa.fa-square {
color: rgb(215, 215, 215);
}
.input-group.hotspot-6 .fa-square {
.input-group.hotspot-6 .fa-square,
.hotspot-color-6.fa.fa-square {
color: rgb(144, 175, 221);
}
.input-group.hotspot-7 .fa-square {
.input-group.hotspot-7 .fa-square,
.hotspot-color-7.fa.fa-square {
color: rgb(175, 134, 64);
}
.input-group.hotspot-8 .fa-square {
.input-group.hotspot-8 .fa-square,
.hotspot-color-8.fa.fa-square {
color: rgb(79, 146, 66);
}
.input-group.hotspot-9 .fa-square {
.input-group.hotspot-9 .fa-square,
.hotspot-color-9.fa.fa-square {
color: rgb(244, 235, 36);
}
.input-group.hotspot-10 .fa-square {
.input-group.hotspot-10 .fa-square,
.hotspot-color-10.fa.fa-square {
color: rgb(237, 32, 36);
}
.input-group.hotspot-11 .fa-square {
.input-group.hotspot-11 .fa-square,
.hotspot-color-11.fa.fa-square {
color: rgb(59, 59, 59);
}

@ -20,7 +20,9 @@ $toolName = get_lang('WorksInSessionReport');
$em = Database::getManager();
$session = null;
$sessionsInfo = SessionManager::getSessionsFollowedByUser(api_get_user_id(), COURSEMANAGER);
$sessionsInfo = api_is_platform_admin()
? SessionManager::get_sessions_list()
: Tracking::get_sessions_coached_by_user(api_get_user_id());
$form = new FormValidator('work_report', 'GET');
$selectSession = $form->addSelect('session', get_lang('Session'), [0 => get_lang('None')]);

Loading…
Cancel
Save