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

pull/3619/head
Alex Aragon 5 years ago
commit 8e00f1e810
  1. 12
      main/course_info/delete_course.php
  2. 26
      main/document/download.php
  3. 28
      main/document/record_audio.php
  4. 1
      main/exercise/MatchingDraggable.php
  5. 54
      main/exercise/exercise.class.php
  6. 12
      main/exercise/exercise_global_report.php
  7. 2
      main/exercise/exercise_result.php
  8. 2
      main/exercise/exercise_show.php
  9. 1
      main/exercise/question.class.php
  10. 5
      main/gradebook/lib/be/evaluation.class.php
  11. 19
      main/inc/lib/course_home.lib.php
  12. 4
      main/inc/lib/display.lib.php
  13. 100
      main/inc/lib/groupmanager.lib.php
  14. 1
      main/inc/lib/tracking.lib.php
  15. 3
      main/install/configuration.dist.php
  16. 4
      main/lp/lp_add_audio.php
  17. 16
      main/mySpace/myStudents.php
  18. 17
      main/survey/fillsurvey.php
  19. 20
      main/survey/survey.download.inc.php
  20. 59
      main/template/default/learnpath/record_voice.tpl
  21. 1
      main/tracking/courseLog.php
  22. 12
      main/user/user.php
  23. 8
      plugin/whispeakauth/WhispeakMyStudentsLpTrackingHook.php
  24. 7
      plugin/whispeakauth/WhispeakMyStudentsQuizTrackingHook.php
  25. 11
      src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/TestMatching.php

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
@ -7,8 +8,6 @@ use ChamiloSession as Session;
* This script is about deleting a course.
* It displays a message box ('are you sure you wish to delete this course')
* and deletes the course if the user answers affirmatively.
*
* @package chamilo.course_info
*/
require_once __DIR__.'/../inc/global.inc.php';
$this_section = SECTION_COURSES;
@ -32,12 +31,14 @@ if (isset($_GET['delete']) && $_GET['delete'] === 'yes' && $_GET['course_code']
// DELETE CONFIRMATION MESSAGE
Session::erase('_cid');
Session::erase('_real_cid');
$message = '<h2>'.get_lang('Course').' : '.$current_course_name.' ('.$current_course_code.') </h2>';
$message = '<h3>'.get_lang('CourseTitle').' : '.$current_course_name.'</h3>';
$message .= '<h3>'.get_lang('CourseCode').' : '.$current_course_code.'</h3>';
$message .= get_lang('HasDel');
$message .= '<br /><br /><a href="../../index.php">'.get_lang('BackHome').'</a>';
} else {
/* message if code course is incorrect */
$message = '<h2>'.get_lang('Course').' : '.$current_course_name.' ('.$current_course_code.') </h2>';
$message = '<h3>'.get_lang('CourseTitle').' : '.$current_course_name.'</h3>';
$message .= '<h3>'.get_lang('CourseCode').' : '.$current_course_code.'</h3>';
$message .= '<p>'.get_lang('CourseRegistrationCodeIncorrect').'</p>';
$message .= '<p><a class="btn btn-primary" href="'
.api_get_path(WEB_CODE_PATH)
@ -48,7 +49,8 @@ if (isset($_GET['delete']) && $_GET['delete'] === 'yes' && $_GET['course_code']
$type_info_message = 'error';
}
} else {
$message = '<h3>'.get_lang('Course').' : '.$current_course_name.' ('.$current_course_code.') </h3>';
$message = '<h3>'.get_lang('CourseTitle').' : '.$current_course_name.'</h3>';
$message .= '<h3>'.get_lang('CourseCode').' : '.$current_course_code.'</h3>';
$message .= '<p>'.get_lang('ByDel').'</p>';
$message .= '<p><span class="form_required">*</span>'
.get_lang('CourseCodeConfirmation')

@ -1,19 +1,17 @@
<?php
/* For licensing terms, see /license.txt */
/**
* This file is responsible for passing requested documents to the browser.
* Many functions updated and moved to lib/document.lib.php.
*
* @package chamilo.document
*/
session_cache_limiter('none');
require_once __DIR__.'/../inc/global-min.inc.php';
$this_section = SECTION_COURSES;
// Protection
api_protect_course_script();
$_course = api_get_course_info();
if (!isset($_course)) {
@ -25,7 +23,6 @@ $doc_url = str_replace('///', '&', $_GET['doc_url']);
// Still a space present? it must be a '+' (that got replaced by mod_rewrite)
$docUrlNoPlus = $doc_url;
$doc_url = str_replace(' ', '+', $doc_url);
$docUrlParts = preg_split('/\/|\\\/', $doc_url);
$doc_url = '';
@ -36,24 +33,21 @@ foreach ($docUrlParts as $docUrlPart) {
$doc_url .= '/'.$docUrlPart;
}
if (empty($doc_url)) {
api_not_allowed(
!empty($_GET['origin']) && $_GET['origin'] === 'learnpath'
);
api_not_allowed(!empty($_GET['origin']) && $_GET['origin'] === 'learnpath');
}
// Dealing with image included into survey: when users receive a link towards a
// survey while not being authenticated on the platform.
// The administrator should probably be able to disable this code through admin
// interface.
$refer_script = isset($_SERVER["HTTP_REFERER"]) ? strrchr($_SERVER["HTTP_REFERER"], '/') : null;
$refer_script = isset($_SERVER['HTTP_REFERER']) ? strrchr($_SERVER['HTTP_REFERER'], '/') : null;
$sys_course_path = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
if (substr($refer_script, 0, 15) == '/fillsurvey.php') {
parse_str($refer_script, $parts);
$course = isset($parts['course']) ? $parts['course'] : '';
$invitation = isset($parts['invitationcode']) ? $parts['invitationcode'] : '';
if (substr($refer_script, 0, 15) === '/fillsurvey.php') {
$parts = parse_url($refer_script);
parse_str($parts['query'], $queryParts);
$course = isset($queryParts['course']) ? $queryParts['course'] : '';
$invitation = isset($queryParts['invitationcode']) ? $queryParts['invitationcode'] : '';
include '../survey/survey.download.inc.php';
$_course = check_download_survey($course, $invitation, $doc_url);
$_course['path'] = $_course['directory'];
@ -80,7 +74,7 @@ if (substr($refer_script, 0, 15) == '/fillsurvey.php') {
$path_info = pathinfo($doc_url);
$fix_file_name = false;
if (isset($path_info['extension']) && $path_info['extension'] == 'swf') {
if (isset($path_info['extension']) && $path_info['extension'] === 'swf') {
$fixed_url = str_replace('-', '_', $doc_url);
$doc_id = DocumentManager::get_document_id(api_get_course_info(), $doc_url);
if (!$doc_id) {

@ -16,7 +16,7 @@ $nameTools = get_lang('VoiceRecord');
api_protect_course_script();
api_block_anonymous_users();
api_protect_course_group(GroupManager::GROUP_TOOL_DOCUMENTS);
$_course = api_get_course_info();
$document_data = DocumentManager::get_document_data_by_id(
$_GET['id'],
api_get_course_id(),
@ -28,20 +28,13 @@ $document_id = 0;
if (empty($document_data)) {
if (api_is_in_group()) {
$group_properties = GroupManager::get_group_properties(api_get_group_id());
$document_id = DocumentManager::get_document_id(
api_get_course_info(),
$group_properties['directory']
);
$document_data = DocumentManager::get_document_data_by_id(
$document_id,
api_get_course_id()
);
$document_id = DocumentManager::get_document_id($_course, $group_properties['directory']);
$document_data = DocumentManager::get_document_data_by_id($document_id, api_get_course_id());
}
} else {
$document_id = $document_data['id'];
$dir = $document_data['path'];
}
//make some vars
$wamidir = $dir;
if ($wamidir === "/") {
@ -69,7 +62,6 @@ if ($dir[strlen($dir) - 1] != '/') {
}
$filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'.$dir;
if (!is_dir($filepath)) {
$filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
$dir = '/';
@ -77,7 +69,7 @@ if (!is_dir($filepath)) {
//groups //TODO: clean
if (!empty($groupId)) {
$group = GroupManager :: get_group_properties($groupId);
$group = GroupManager::get_group_properties($groupId);
$interbreadcrumb[] = [
'url' => api_get_path(WEB_CODE_PATH).'group/group.php?'.api_get_cidreq(),
'name' => get_lang('Groups'),
@ -86,11 +78,6 @@ if (!empty($groupId)) {
"url" => api_get_path(WEB_CODE_PATH)."group/group_space.php?".api_get_cidreq(),
"name" => get_lang('GroupSpace'),
];
$path = explode('/', $dir);
if ('/'.$path[1] != $group['directory']) {
api_not_allowed(true);
}
}
$interbreadcrumb[] = ["url" => "./document.php?id=".$document_id.'&'.api_get_cidreq(), "name" => get_lang('Documents')];
@ -98,7 +85,6 @@ $interbreadcrumb[] = ["url" => "./document.php?id=".$document_id.'&'.api_get_cid
if (!api_is_allowed_in_course()) {
api_not_allowed(true);
}
if (!($is_allowed_to_edit || $groupRights ||
DocumentManager::is_my_shared_folder(
api_get_user_id(),
@ -109,7 +95,6 @@ if (!($is_allowed_to_edit || $groupRights ||
api_not_allowed(true);
}
/* Header */
Event::event_access_tool(TOOL_DOCUMENT);
$display_dir = $dir;
@ -139,9 +124,7 @@ if (isset($document_data['parents'])) {
}
}
//make some vars
$wamiuserid = api_get_user_id();
$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_JS_PATH).'rtc/RecordRTC.js"></script>';
$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'wami-recorder/recorder.js"></script>';
$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'wami-recorder/gui.js"></script>';
@ -157,15 +140,12 @@ $actions = Display::toolbarButton(
[],
false
);
$template = new Template($nameTools);
$template->assign('directory', $wamidir);
$template->assign('user_id', api_get_user_id());
$template->assign('reload_page', 1);
$layout = $template->get_template('document/record_audio.tpl');
$content = $template->fetch($layout);
$template->assign(
'actions',
Display::toolbarAction('toolbar', [$actions])

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
/**

@ -1215,6 +1215,26 @@ class Exercise
return Database::num_rows($result) > 0;
}
public function hasQuestionWithType($type)
{
$type = (int) $type;
$table = Database::get_course_table(TABLE_QUIZ_TEST_QUESTION);
$tableQuestion = Database::get_course_table(TABLE_QUIZ_QUESTION);
$sql = "SELECT q.id
FROM $table e
INNER JOIN $tableQuestion q
ON (e.question_id = q.id AND e.c_id = q.c_id)
WHERE
q.type = $type AND
e.c_id = {$this->course_id} AND
e.exercice_id = ".$this->id;
$result = Database::query($sql);
return Database::num_rows($result) > 0;
}
public function hasQuestionWithTypeNotInList(array $questionTypeList)
{
if (empty($questionTypeList)) {
@ -2588,7 +2608,7 @@ class Exercise
{
// Feedback type.
$feedback = [];
$feedback[] = $form->createElement(
$endTest = $form->createElement(
'radio',
'exerciseFeedbackType',
null,
@ -2611,20 +2631,18 @@ class Exercise
]
);
$feedback[] = $endTest;
$feedback[] = $noFeedBack;
$scenarioEnabled = 'true' === api_get_setting('enable_quiz_scenario');
$freeze = true;
if ('true' === api_get_setting('enable_quiz_scenario')) {
if ($scenarioEnabled) {
if ($this->getQuestionCount() > 0) {
//if (in_array($feedbackType, [EXERCISE_FEEDBACK_TYPE_DIRECT, EXERCISE_FEEDBACK_TYPE_POPUP])) {
$hasDifferentQuestion = $this->hasQuestionWithTypeNotInList([UNIQUE_ANSWER, HOT_SPOT_DELINEATION]);
if (false === $hasDifferentQuestion) {
$freeze = false;
}
/*} else {
$freeze = false;
}*/
} else {
$freeze = false;
}
} else {
$freeze = false;
}
@ -2651,14 +2669,22 @@ class Exercise
);
if ($freeze) {
//$noFeedBack->freeze();
$direct->freeze();
$directPopUp->freeze();
}
$feedback[] = $noFeedBack;
// If has delineation freeze all.
$hasDelineation = $this->hasQuestionWithType(HOT_SPOT_DELINEATION);
if ($hasDelineation) {
$endTest->freeze();
$noFeedBack->freeze();
$direct->freeze();
$directPopUp->freeze();
}
$feedback[] = $direct;
$feedback[] = $directPopUp;
}
$form->addGroup(
$feedback,
@ -2668,10 +2694,6 @@ class Exercise
get_lang('FeedbackDisplayOptions'),
]
);
if ($freeze) {
//$group->freeze();
}
}
/**
@ -9929,7 +9951,7 @@ class Exercise
Session::erase('categoryList');
Session::erase('exerciseResult');
Session::erase('firstTime');
Session::erase('time_per_question');
Session::erase('exerciseResultCoordinates');
Session::erase('hotspot_coord');
Session::erase('hotspot_dest');

@ -28,7 +28,7 @@ $header[] = get_lang('FirstName');
$header[] = get_lang('LastName');
$header[] = get_lang('Email');
$header[] = get_lang('OfficialCode');
//$header[] = 'NIF';
/** @var TestCategory $categoryInfo */
foreach ($categories as $categoryInfo) {
$header[] = 'Aciertos: '.$categoryInfo->name;
@ -107,11 +107,6 @@ foreach ($students as $studentInfo) {
$categoryData[$categoryInfo->id]['score'] += $categoryItem['score'];
}
}
/*foreach ($stats['attempts_result_list'] as $attempt) {
// Only first item
$userExerciseData[$exerciseId] = $attempt['score'];
break;
}*/
$userExerciseData[$exerciseId] = $stats['total_score'];
}
foreach ($categories as $categoryInfo) {
@ -139,9 +134,6 @@ foreach ($students as $studentInfo) {
$list[] = $data;
}
//var_dump($list);exit;
$filePath = Export::arrayToCsv($list, get_lang('Report'), true);
$filePath = Export::arrayToCsv($list, get_lang('Report'), true);
DocumentManager::file_send_for_download($filePath, true, get_lang('Report').'.csv');

@ -99,7 +99,7 @@ if (api_is_course_admin() && !in_array($origin, ['learnpath', 'embeddable'])) {
'admin.php?'.api_get_cidreq().'&exerciseId='.$objExercise->id
)
.Display::url(
Display::return_icon('edit.png', get_lang('ModifyExercise'), [], 32),
Display::return_icon('settings.png', get_lang('ModifyExercise'), [], 32),
'exercise_admin.php?'.api_get_cidreq().'&modifyExercise=yes&exerciseId='.$objExercise->id
),
]

@ -972,7 +972,7 @@ if ($isFeedbackAllowed) {
}
}
if ($isFeedbackAllowed && $origin != 'learnpath' && $origin != 'student_progress') {
if ($isFeedbackAllowed && $origin !== 'learnpath' && $origin !== 'student_progress') {
if (in_array($origin, ['tracking_course', 'user_course', 'correct_exercise_in_lp'])) {
$formUrl = api_get_path(WEB_CODE_PATH).'exercise/exercise_report.php?'.api_get_cidreq().'&';
$formUrl .= http_build_query([

@ -169,6 +169,7 @@ abstract class Question
$objQuestion->feedback = isset($object->feedback) ? $object->feedback : '';
$objQuestion->code = isset($object->code) ? $object->code : '';
$categoryInfo = TestCategory::getCategoryInfoForQuestion($id, $course_id);
if (!empty($categoryInfo)) {
if (isset($categoryInfo['category_id'])) {
$objQuestion->category = (int) $categoryInfo['category_id'];

@ -117,6 +117,11 @@ class Evaluation implements GradebookItem
$this->sessionId = (int) $sessionId;
}
public function set_session_id($sessionId)
{
$this->setSessionId($sessionId);
}
public function get_date()
{
return $this->created_at;

@ -610,6 +610,7 @@ class CourseHome
// if the course homepage is loaded many times, so the list of hidden
// tools might benefit from a shared memory storage later on
$list = api_get_settings('Tools', 'list', api_get_current_access_url_id());
$hide_list = [];
$check = false;
foreach ($list as $line) {
@ -834,7 +835,6 @@ class CourseHome
$courseId = api_get_course_int_id();
$is_platform_admin = api_is_platform_admin();
$courseInfo = api_get_course_info();
$allowEditionInSession = api_get_configuration_value('allow_edit_tool_visibility_in_session');
if ($session_id == 0) {
@ -847,12 +847,21 @@ class CourseHome
}
}
$disableUsers = 3 === (int) $courseInfo['visibility'] &&
api_get_configuration_value('disable_change_user_visibility_for_public_courses');
$items = [];
$app_plugin = new AppPlugin();
if (isset($all_tools_list)) {
$lnk = '';
foreach ($all_tools_list as &$tool) {
$allowChangeVisibility = true;
$showIcon = true;
if ('user/user.php' === $tool['link'] && $disableUsers) {
$allowChangeVisibility = false;
$tool['visibility'] = 0;
$showIcon = $is_allowed_to_edit;
}
$item = [];
$studentview = false;
$tool['original_link'] = $tool['link'];
@ -878,6 +887,10 @@ class CourseHome
continue;
}
if (false === $showIcon) {
continue;
}
// This part displays the links to hide or remove a tool.
// These links are only visible by the course manager.
unset($lnk);
@ -885,7 +898,7 @@ class CourseHome
$item['extra'] = null;
$toolAdmin = isset($tool['admin']) ? $tool['admin'] : '';
if ($is_allowed_to_edit) {
if ($is_allowed_to_edit && $allowChangeVisibility) {
if (empty($session_id)) {
if (isset($tool['id'])) {
if ($tool['visibility'] == '1' && $toolAdmin != '1') {

@ -2194,7 +2194,7 @@ class Display
switch ($fileInfo['extension']) {
case 'mp3':
case 'webm':
$html = '<audio id="'.$id.'" '.$class.' controls '.$autoplay.' '.$width.' src="'.$params['url'].'" >';
$html = '<audio id="'.$id.'" '.$class.' controls '.$autoplay.' '.$width.' src="'.$params['url'].'">';
$html .= '<object width="'.$width.'" height="50" type="application/x-shockwave-flash" data="'.api_get_path(WEB_LIBRARY_PATH).'javascript/mediaelement/flashmediaelement.swf">
<param name="movie" value="'.api_get_path(WEB_LIBRARY_PATH).'javascript/mediaelement/flashmediaelement.swf" />
<param name="flashvars" value="controls=true&file='.$params['url'].'" />
@ -2205,7 +2205,7 @@ class Display
break;
case 'wav':
case 'ogg':
$html = '<audio width="300px" controls id="'.$id.'" '.$autoplay.' src="'.$params['url'].'" >';
$html = '<audio width="300px" controls id="'.$id.'" '.$autoplay.' src="'.$params['url'].'"></audio>';
return $html;
break;

@ -88,6 +88,7 @@ class GroupManager
* @param int $status group status
* @param int $sessionId
* @param bool $getCount
* @param bool $notInGroup Get groups not in a category
*
* @return array an array with all information about the groups
*/
@ -96,7 +97,8 @@ class GroupManager
$course_info = [],
$status = null,
$sessionId = 0,
$getCount = false
$getCount = false,
$notInGroup = false
) {
$course_info = empty($course_info) ? api_get_course_info() : $course_info;
if (empty($course_info)) {
@ -142,6 +144,10 @@ class GroupManager
$sql .= " AND g.c_id = $course_id ";
if ($notInGroup) {
$sql .= " AND (g.category_id IS NULL OR g.category_id = 0) ";
}
if (!empty($session_condition)) {
$sql .= $session_condition;
}
@ -643,16 +649,15 @@ class GroupManager
*/
public static function getGroupListFilterByName($name, $categoryId, $courseId)
{
$name = trim($name);
$name = Database::escape_string($name);
$name = Database::escape_string(trim($name));
$categoryId = (int) $categoryId;
$courseId = (int) $courseId;
if (empty($name)) {
return [];
}
$table_group = Database::get_course_table(TABLE_GROUP);
$sql = "SELECT * FROM $table_group
$table = Database::get_course_table(TABLE_GROUP);
$sql = "SELECT * FROM $table
WHERE c_id = $courseId AND name LIKE '%$name%'";
if (!empty($categoryId)) {
@ -2907,42 +2912,10 @@ class GroupManager
</ul>';
}
/**
* @param int $courseId
* @param string $keyword
*
* @return string
*/
public static function getOverview($courseId, $keyword = '')
public static function groupOverview($group, $url)
{
$content = null;
$categories = self::get_categories();
if (!empty($categories)) {
foreach ($categories as $category) {
if ('true' === api_get_setting('allow_group_categories')) {
$content .= '<h2>'.$category['title'].'</h2>';
}
if (!empty($keyword)) {
$groups = self::getGroupListFilterByName(
$keyword,
$category['id'],
$courseId
);
} else {
$groups = self::get_group_list($category['id']);
}
if (empty($groups)) {
$groups = self::get_group_list();
}
$content .= '<ul>';
if (!empty($groups)) {
$url = api_get_path(WEB_CODE_PATH).'group/group_space.php?'.api_get_cidreq(true, false);
foreach ($groups as $group) {
$groupId = $group['id'];
$content .= '<li>';
$content = '<li>';
$content .= Display::tag(
'h3',
Display::url(
@ -2978,12 +2951,61 @@ class GroupManager
$content .= '</ul>';
}
$content .= '</li>';
return $content;
}
/**
* @param int $courseId
* @param string $keyword
*
* @return string
*/
public static function getOverview($courseId, $keyword = '')
{
$content = null;
$categories = self::get_categories();
$url = api_get_path(WEB_CODE_PATH).'group/group_space.php?'.api_get_cidreq(true, false);
if (!empty($categories)) {
foreach ($categories as $category) {
if ('true' === api_get_setting('allow_group_categories')) {
$content .= '<h2>'.$category['title'].'</h2>';
}
if (!empty($keyword)) {
$groups = self::getGroupListFilterByName(
$keyword,
$category['id'],
$courseId
);
} else {
$groups = self::get_group_list($category['id']);
}
$content .= '<ul>';
if (!empty($groups)) {
foreach ($groups as $group) {
$content .= self::groupOverview($group, $url);
}
}
$content .= '</ul>';
}
}
// Check groups with no categories.
$groups = self::get_group_list(null, api_get_course_info(), null, api_get_session_id(), false, true);
if (!empty($groups)) {
$content .= '<h2>'.get_lang('NoCategorySelected').'</h2>';
$content .= '<ul>';
foreach ($groups as $group) {
if (!empty($group['category_id'])) {
continue;
}
$content .= self::groupOverview($group, $url);
}
$content .= '</ul>';
}
return $content;
}

@ -2494,6 +2494,7 @@ class Tracking
ex.c_id = $courseId AND
ex.session_id = $session_id AND
ex.exe_user_id = $user_id AND
ex.status = '' AND
ex.exe_exo_id IN ('$exercise_list_imploded') ";
$rs = Database::query($sql);

@ -1730,6 +1730,9 @@ $_configuration['auth_password_links'] = [
// Allow time per question. Requires a question text extra field called "time", value in seconds.
//$_configuration['allow_time_per_question'] = true;
// Disable change user visibility tool icon.
//$_configuration['disable_change_user_visibility_for_public_courses'] = true;
// KEEP THIS AT THE END
// -------- Custom DB changes
// Add user activation by confirmation email

@ -196,7 +196,8 @@ $documentTree = DocumentManager::get_document_preview(
$page .= $recordVoiceForm;
$page .= '<br>';
$page .= $form->returnForm();
$page .= '<h3 class="page-header"><small>'.get_lang('Or').'</small> '.get_lang('SelectAnAudioFileFromDocuments').'</h3>';
$page .= '<h3 class="page-header">
<small>'.get_lang('Or').'</small> '.get_lang('SelectAnAudioFileFromDocuments').'</h3>';
$folders = DocumentManager::get_all_document_folders(
$courseInfo,
@ -224,7 +225,6 @@ $selector = DocumentManager::build_directory_selector(
);
$page .= $selector;
$page .= '<ul class="lp_resource">';
$page .= '<li class="doc_folder" style="margin-left: 36px;">'.get_lang('Audio').'</li>';
$page .= '<li class="doc_folder">';

@ -1343,13 +1343,13 @@ if (empty($details)) {
$hookLpTracking = HookMyStudentsLpTracking::create();
if ($hookLpTracking) {
$hookHeaders = $hookLpTracking->notifyTrackingHeader();
foreach ($hookHeaders as $hookHeader) {
if (isset($hookHeader['value'])) {
$columnHeadersToExport[] = $hookHeader['value'];
$headers .= Display::tag('th', $hookHeader['value'], $hookHeader['attrs']);
}
}
}
$csv_content[] = $columnHeadersToExport;
$columnHeadersKeys = array_keys($columnHeaders);
@ -1550,10 +1550,12 @@ if (empty($details)) {
$hookContents = $hookLpTracking->notifyTrackingContent($lp_id, $student_id);
foreach ($hookContents as $hookContent) {
if (isset($hookContent['value'])) {
$contentToExport[] = strip_tags($hookContent['value']);
echo Display::tag('td', $hookContent['value'], $hookContent['attrs']);
}
}
}
$csv_content[] = $contentToExport;
@ -1611,10 +1613,12 @@ if (empty($details)) {
echo '<th>'.get_lang('AllAttempts').'</th>';
$hookQuizTracking = HookMyStudentsQuizTracking::create();
if ($hookQuizTracking) {
if ($hookQuizTracking && !empty($header)) {
$hookHeaders = array_map(
function ($hookHeader) {
if (isset($hookHeader['value'])) {
return Display::tag('th', $hookHeader['value'], $hookHeader['attrs']);
}
},
$hookQuizTracking->notifyTrackingHeader()
);
@ -1635,7 +1639,9 @@ if (empty($details)) {
if ($hookQuizTracking) {
$hookHeaders = array_map(
function ($hookHeader) {
if (isset($hookHeader['value'])) {
return strip_tags($hookHeader['value']);
}
},
$hookQuizTracking->notifyTrackingHeader()
);
@ -1775,9 +1781,11 @@ if (empty($details)) {
if (!empty($hookContents)) {
foreach ($hookContents as $hookContent) {
if (isset($hookContent['value'])) {
echo Display::tag('td', $hookContent['value'], $hookContent['attrs']);
}
}
}
echo '</tr>';
$data_exercices[$i][] = $exercices['title'];
@ -1795,9 +1803,11 @@ if (empty($details)) {
$csvContentIndex = count($csv_content) - 1;
foreach ($hookContents as $hookContent) {
if (isset($hookContent['value'])) {
$csv_content[$csvContentIndex][] = strip_tags($hookContent['value']);
}
}
}
$i++;
}
} else {

@ -91,7 +91,7 @@ if ((!isset($_GET['course']) || !isset($_GET['invitationcode'])) && !isset($_GET
$invitationcode = $_GET['invitationcode'];
// Start auto-invitation feature FS#3403 (all-users-can-do-the-survey-URL handling)
if ('auto' == $invitationcode && isset($_GET['scode'])) {
if ('auto' === $invitationcode && isset($_GET['scode'])) {
$userid = api_get_user_id();
// Survey_code of the survey
$surveyCode = $_GET['scode'];
@ -225,7 +225,7 @@ if (empty($survey_data)) {
SurveyManager::checkTimeAvailability($survey_data);
$survey_data['survey_id'] = $survey_invitation['survey_id'];
if ($survey_data['survey_type'] == '3') {
if ($survey_data['survey_type'] === '3') {
header('Location: '.
api_get_path(WEB_CODE_PATH).
'survey/meeting.php?cidReq='.$courseInfo['code'].'&id_session='.$sessionId.'&invitationcode='.Security::remove_XSS($invitationcode)
@ -316,7 +316,7 @@ if (count($_POST) > 0) {
} else {
$option_value = 0;
if (isset($types[$survey_question_id]) &&
'open' == $types[$survey_question_id]
'open' === $types[$survey_question_id]
) {
$option_value = $value;
}
@ -557,14 +557,12 @@ $htmlHeadXtra[] = ch_selectivedisplay::getJs();
$htmlHeadXtra[] = survey_question::getJs();
Display::display_header(get_lang('ToolSurvey'));
// Displaying the survey title and subtitle (appears on every page)
echo '<div class="survey-block">';
echo '<div class="page-header">';
echo '<h2>';
echo strip_tags($survey_data['survey_title'], '<span>').'</h2></div>';
echo Security::remove_XSS($survey_data['survey_title']).'</h2></div>';
if (!empty($survey_data['survey_subtitle'])) {
echo '<div class="survey_subtitle"><p>'.strip_tags($survey_data['survey_subtitle']).'</p></div>';
echo '<div class="survey_subtitle"><p>'.Security::remove_XSS($survey_data['survey_subtitle']).'</p></div>';
}
// Displaying the survey introduction
@ -576,7 +574,7 @@ if (
Session::erase('page_questions_sec');
$paged_questions_sec = [];
if (!empty($survey_data['survey_introduction'])) {
echo '<div class="survey_content">'.$survey_data['survey_introduction'].'</div>';
echo '<div class="survey_content">'.Security::remove_XSS($survey_data['survey_introduction']).'</div>';
}
$limit = 0;
}
@ -643,7 +641,7 @@ if ($survey_data['form_fields'] &&
// Displaying the survey thanks message
if (isset($_POST['finish_survey'])) {
echo Display::return_message(get_lang('SurveyFinished'), 'confirm');
echo $survey_data['survey_thanks'];
echo Security::remove_XSS($survey_data['survey_thanks']);
SurveyManager::update_survey_answered(
$survey_data,
@ -657,6 +655,7 @@ if (isset($_POST['finish_survey'])) {
);
if ($courseInfo && !api_is_anonymous()) {
echo '<br /><br />';
echo Display::toolbarButton(
get_lang('ReturnToCourseHomepage'),
api_get_course_url($courseInfo['code']),

@ -28,17 +28,15 @@ function check_download_survey($course, $invitation, $doc_url)
$result = Database::query($sql);
if (Database::num_rows($result) < 1) {
echo Display::return_message(get_lang('WrongInvitationCode'), 'error', false);
Display::display_footer();
exit;
}
$survey_invitation = Database::fetch_assoc($result);
// Now we check if the user already filled the survey
if ($survey_invitation['answered'] == 1) {
/*if ($survey_invitation['answered'] == 1) {
echo Display::return_message(get_lang('YouAlreadyFilledThisSurvey'), 'error', false);
Display::display_footer();
exit;
}
}*/
// Very basic security check: check if a text field from
// a survey/answer/option contains the name of the document requested
@ -53,7 +51,11 @@ function check_download_survey($course, $invitation, $doc_url)
if ($_POST['language']) {
$survey_invitation['survey_id'] = $_POST['language'];
} else {
echo '<form id="language" name="language" method="POST" action="'.api_get_self().'?course='.Security::remove_XSS($_GET['course']).'&invitationcode='.Security::remove_XSS($_GET['invitationcode']).'">';
echo '<form
id="language"
name="language"
method="POST"
action="'.api_get_self().'?course='.Security::remove_XSS($_GET['course']).'&invitationcode='.Security::remove_XSS($_GET['invitationcode']).'">';
echo ' <select name="language">';
while ($row = Database::fetch_assoc($result)) {
echo '<option value="'.$row['survey_id'].'">'.$row['lang'].'</option>';
@ -69,6 +71,9 @@ function check_download_survey($course, $invitation, $doc_url)
$survey_invitation['survey_id'] = $row['survey_id'];
}
$doc_url = Database::escape_string($doc_url);
$survey_invitation['survey_id'] = Database::escape_string($survey_invitation['survey_id']);
$sql = "SELECT count(*)
FROM $table_survey
WHERE
@ -85,8 +90,8 @@ function check_download_survey($course, $invitation, $doc_url)
WHERE
c_id = $course_id AND
survey_id = ".$survey_invitation['survey_id']." AND (
survey_question LIKE '%$doc_url%'
or survey_question_comment LIKE '%$doc_url%'
survey_question LIKE '%$doc_url%' OR
survey_question_comment LIKE '%$doc_url%'
)
UNION
SELECT count(*)
@ -99,7 +104,6 @@ function check_download_survey($course, $invitation, $doc_url)
$result = Database::query($sql);
if (Database::num_rows($result) == 0) {
echo Display::return_message(get_lang('WrongInvitationCode'), 'error', false);
Display::display_footer();
exit;
}

@ -2,7 +2,18 @@
<p>
<span class="fa fa-microphone fa-5x fa-fw" aria-hidden="true"></span>
<span class="sr-only">{{ 'RecordAudio'|get_lang }}</span>
<div id="timer" style="display: none">
<h2>
<div class="label label-danger">
<span id="hour">00</span>
<span class="divider">:</span>
<span id="minute">00</span>
<span class="divider">:</span>
<span id="second">00</span>
</div>
</h2>
<br />
</div>
<div class="form-group">
<input type="text" name="audio_title" id="audio-title-rtc" class="form-control" placeholder="{{ 'InputNameHere'|get_lang }}" />
</div>
@ -20,11 +31,50 @@
<script>
$(function() {
function startTimer() {
$("#timer").show();
var timerData = {
hour: parseInt($("#hour").text()),
minute: parseInt($("#minute").text()),
second: parseInt($("#second").text())
};
clearInterval(window.timerInterval);
window.timerInterval = setInterval(function(){
// Seconds
timerData.second++;
if (timerData.second >= 60) {
timerData.second = 0;
timerData.minute++;
}
// Minutes
if (timerData.minute >= 60) {
timerData.minute = 0;
timerData.hour++;
}
$("#hour").text(timerData.hour < 10 ? '0' + timerData.hour : timerData.hour);
$("#minute").text(timerData.minute < 10 ? '0' + timerData.minute : timerData.minute);
$("#second").text(timerData.second < 10 ? '0' + timerData.second : timerData.second);
}, 1000);
}
function stopTimer() {
$("#hour").text('00');
$("#minute").text('00');
$("#second").text('00');
$("#timer").hide();
}
function pauseTimer() {
clearInterval(window.timerInterval);
}
function useRecordRTC(){
$('#record-audio-recordrtc').show();
var audioTitle = $('#audio-title-rtc');
var mediaConstraints = {audio: true},
recordRTC = null,
btnStart = $('#btn-start-record'),
@ -49,6 +99,8 @@
}
function successCallback(stream) {
stopTimer();
startTimer();
recordRTC = RecordRTC(stream, {
numberOfAudioChannels: 1,
type: 'audio'
@ -60,6 +112,7 @@
}
function errorCallback(error) {
stopTimer();
alert(error.message);
}
});
@ -69,6 +122,7 @@
return;
}
stopTimer();
recordRTC.stopRecording(function (audioURL) {
var recordedBlob = recordRTC.getBlob(),
fileName = Math.round(Math.random() * 99999999) + 99999999,
@ -132,7 +186,6 @@
}
$('#record-audio-recordrtc, #record-audio-wami').hide();
var webRTCIsEnabled = navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.getUserMedia ||
navigator.mediaDevices.getUserMedia;

@ -356,7 +356,6 @@ if ($nbStudents > 0) {
$groupIdList = [];
foreach ($groupList as $group) {
$groupIdList[] = ['text' => $group['name'], 'value' => 'group_'.$group['id']];
//$groupIdList['group_'.$group['id']] = $group['name'];
}
$select->addOptGroup($groupIdList, get_lang('Group'));
$formClass->addButtonSearch(get_lang('Search'));

@ -37,12 +37,21 @@ $courseCode = $course_info['code'];
$courseId = $course_info['real_id'];
$type = isset($_REQUEST['type']) ? (int) $_REQUEST['type'] : STUDENT;
$canEditUsers = api_get_setting('allow_user_course_subscription_by_course_admin') === 'true' || api_is_platform_admin();
$canEdit = api_is_allowed_to_edit(null, true);
$canRead = api_is_allowed_to_edit(null, true) || api_is_coach();
// Can't auto unregister from a session
if (!empty($sessionId)) {
$course_info['unsubscribe'] = 0;
}
$disableUsers = 3 === (int) $course_info['visibility'] &&
api_get_configuration_value('disable_change_user_visibility_for_public_courses');
if (false === $canEdit && $disableUsers) {
api_not_allowed(true);
}
/* Un registering a user section */
if (api_is_allowed_to_edit(null, true)) {
if (isset($_POST['action'])) {
@ -67,9 +76,6 @@ $extraField = new ExtraField('user');
$extraFields = $extraField->get_all(['filter = ?' => 1]);
$user_image_pdf_size = 80;
$canEdit = api_is_allowed_to_edit(null, true);
$canRead = api_is_allowed_to_edit(null, true) || api_is_coach();
if (isset($_GET['action'])) {
switch ($_GET['action']) {
case 'set_tutor':

@ -22,6 +22,10 @@ class WhispeakMyStudentsLpTrackingHook extends HookObserver implements HookMyStu
*/
public function trackingHeader(HookMyStudentsLpTrackingEventInterface $hook)
{
if (false === WhispeakAuthPlugin::create()->isEnabled()) {
return [];
}
return [
'value' => WhispeakAuthPlugin::create()->get_lang('plugin_title'),
'attrs' => ['class' => 'text-center'],
@ -35,6 +39,10 @@ class WhispeakMyStudentsLpTrackingHook extends HookObserver implements HookMyStu
*/
public function trackingContent(HookMyStudentsLpTrackingEventInterface $hook)
{
if (false === WhispeakAuthPlugin::create()->isEnabled()) {
return [];
}
$data = $hook->getEventData();
$totalCount = WhispeakAuthPlugin::countAllAttemptsInLearningPath($data['lp_id'], $data['student_id']);

@ -30,6 +30,10 @@ class WhispeakMyStudentsQuizTrackingHook extends HookObserver implements HookMyS
*/
public function trackingHeader(HookMyStudentsQuizTrackingEventInterface $hook)
{
if (false === WhispeakAuthPlugin::create()->isEnabled()) {
return [];
}
return [
'value' => WhispeakAuthPlugin::create()->get_lang('plugin_title'),
'attrs' => [
@ -53,6 +57,9 @@ class WhispeakMyStudentsQuizTrackingHook extends HookObserver implements HookMyS
*/
public function trackingContent(HookMyStudentsQuizTrackingEventInterface $hook)
{
if (false === WhispeakAuthPlugin::create()->isEnabled()) {
return [];
}
$data = $hook->getEventData();
$totalCount = WhispeakAuthPlugin::countAllAttemptsInQuiz($data['quiz_id'], $data['student_id']);

@ -48,7 +48,7 @@ class TestMatching extends Basic
{
return [
['NewPage', 'Templates', '-', 'Preview', 'Print'],
['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord'],
['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', 'inserthtml'],
['Undo', 'Redo', '-', 'SelectAll', 'Find', '-', 'RemoveFormat'],
['Link', 'Unlink', 'Anchor', 'Glossary'],
[
@ -90,9 +90,14 @@ class TestMatching extends Basic
'Bold',
'Image',
'Video',
'Flash',
'Oembed',
'Youtube',
'VimeoEmbed',
'Audio',
'Link',
'PasteFromWord',
'Audio',
'inserthtml',
'Table',
'Subscript',
'Superscript',
@ -109,7 +114,7 @@ class TestMatching extends Basic
protected function getMinimizedToolbar()
{
return [
['PasteFromWord'],
['PasteFromWord', 'inserthtml'],
['Undo', 'Redo'],
[
'Link',

Loading…
Cancel
Save