Minor - update from 1.11.x

pull/2487/head
jmontoyaa 8 years ago
parent bdb7fb3880
commit d3d1479599
  1. 7
      main/admin/course_list.php
  2. 18
      main/auth/inscription.php
  3. 2
      main/auth/profile.php
  4. 1
      main/chat/chat.php
  5. 10
      main/course_info/infocours.php
  6. 2
      main/create_course/add_course.php
  7. 108
      main/document/document.php
  8. 5
      main/document/download_scorm.php
  9. 156
      main/document/edit_document.php
  10. 15
      main/document/upload.php
  11. 10
      main/exercise/exercise.class.php
  12. 50
      main/exercise/question_pool.php
  13. 25
      main/forum/viewforumcategory.php
  14. 27
      main/inc/lib/CourseChatUtils.php
  15. 9
      main/inc/lib/add_course.lib.inc.php
  16. 6
      main/inc/lib/api.lib.php
  17. 2
      main/inc/lib/certificate.lib.php
  18. 34
      main/inc/lib/course_home.lib.php
  19. 17
      main/inc/lib/document.lib.php
  20. 7
      main/inc/lib/exercise.lib.php
  21. 22
      main/inc/lib/formvalidator/Element/DateTimePicker.php
  22. 4
      main/inc/lib/formvalidator/Element/SelectAjax.php
  23. 19
      main/inc/lib/pdf.lib.php
  24. 109
      main/inc/lib/template.lib.php
  25. 270
      main/lp/learnpath.class.php
  26. 35
      main/lp/lp_edit.php
  27. 2
      main/lp/lp_list.php
  28. 41
      main/lp/lp_view_item.php
  29. 9
      main/session/session_list.php
  30. 76
      main/survey/fillsurvey.php
  31. 79
      main/survey/surveyUtil.class.php
  32. 9
      main/survey/survey_invite.php
  33. 441
      main/template/default/chat/chat.tpl
  34. 9
      main/template/default/learnpath/view.tpl
  35. 2
      main/template/default/session/about.tpl
  36. 17
      main/ticket/tickets.php
  37. 20
      main/user/session_list.php
  38. 72
      main/webservices/registration.soap.php

@ -17,6 +17,8 @@ $sessionId = isset($_GET['session_id']) ? $_GET['session_id'] : null;
/**
* Get the number of courses which will be displayed
* @return int The number of matching courses
* @throws Exception
*/
function get_number_of_courses()
{
@ -80,6 +82,7 @@ function get_number_of_courses()
* @param string $direction
*
* @return array
* @throws Exception
*/
function get_course_data($from, $number_of_items, $column, $direction)
{
@ -205,6 +208,7 @@ function get_course_data($from, $number_of_items, $column, $direction)
* @param int $column
* @param string $direction
* @return array
* @throws Exception
*/
function get_course_data_by_session($from, $number_of_items, $column, $direction)
{
@ -433,7 +437,7 @@ if (isset($_GET['search']) && $_GET['search'] === 'advanced') {
'session_name',
get_lang('SearchCourseBySession'),
null,
['url' => $url]
['id' => 'session_name', 'url' => $url]
);
if (!empty($sessionId)) {
@ -476,7 +480,6 @@ if (isset($_GET['search']) && $_GET['search'] === 'advanced') {
$(function() {
$("#session_name").on("change", function() {
var sessionId = $(this).val();
if (!sessionId) {
return;
}

@ -405,6 +405,8 @@ $defaults['extra_mail_notify_group_message'] = 1;
$form->setDefaults($defaults);
$content = null;
$tool_name = get_lang('Registration');
if (!CustomPages::enabled()) {
// Load terms & conditions from the current lang
if (api_get_setting('allow_terms_conditions') === 'true') {
@ -434,8 +436,6 @@ if (!CustomPages::enabled()) {
}
}
$tool_name = get_lang('Registration');
if (api_get_setting('allow_terms_conditions') === 'true' && $user_already_registered_show_terms) {
$tool_name = get_lang('TermsAndConditions');
}
@ -460,7 +460,7 @@ if (file_exists($home.'register_top_'.$user_selected_language.'.html')) {
$open = str_replace('{rel_path}', api_get_path(REL_PATH), $home_top_temp);
$open = api_to_system_encoding($open, api_detect_encoding(strip_tags($open)));
if (!empty($open)) {
$content = '<div class="well_border">'.$open.'</div>';
$content = '<div class="well well-lg">'.$open.'</div>';
}
}
@ -797,9 +797,15 @@ if ($form->validate()) {
// 3. exit the page
unset($user_id);
Display::display_header(get_lang('ConfirmationForNewAccount'));
echo Display::page_header(get_lang('YouNeedConfirmYourAccountViaEmailToAccessThePlatform'));
echo $content;
Display::addFlash(
Display::return_message(
get_lang('YouNeedConfirmYourAccountViaEmailToAccessThePlatform'),
'warning'
)
);
Display::display_header($tool_name);
//echo $content;
Display::display_footer();
exit;
}

@ -685,7 +685,7 @@ if ($form->validate()) {
$sql .= ", official_code = '".Database::escape_string($user_data['official_code'])."'";
}
$sql .= " WHERE user_id = '".api_get_user_id()."'";
$sql .= " WHERE id = '".api_get_user_id()."'";
Database::query($sql);
if ($passwordWasChecked == false) {

@ -50,6 +50,7 @@ $view = new Template(get_lang('Chat'), false, false, false, true, false);
$view->assign('icons', $iconList);
$view->assign('emoji_strategy', CourseChatUtils::getEmojiStrategy());
$view->assign('emoji_smile', \Emojione\Emojione::toImage(':smile:'));
$view->assign('restrict_to_coach', api_get_configuration_value('course_chat_restrict_to_coach'));
$template = $view->get_template('chat/chat.tpl');
$content = $view->fetch($template);

@ -17,20 +17,17 @@
require_once __DIR__.'/../inc/global.inc.php';
$current_course_tool = TOOL_COURSE_SETTING;
$this_section = SECTION_COURSES;
$nameTools = get_lang('ModifInfo');
api_protect_course_script(true);
api_block_anonymous_users();
$_course = api_get_course_info();
/* Constants and variables */
/* Constants and variables */
define('MODULE_HELP_NAME', 'Settings');
define('COURSE_CHANGE_PROPERTIES', 'COURSE_CHANGE_PROPERTIES');
$currentCourseRepository = $_course['path'];
$is_allowedToEdit = $is_courseAdmin || $is_platformAdmin;
$course_code = api_get_course_id();
$courseId = api_get_course_int_id();
@ -768,8 +765,8 @@ if ($form->validate() && is_settings_editable()) {
'activate_legal' => $activeLegal,
'registration_code' => $updateValues['course_registration_password'],
];
Database::update($table_course, $params, ['id = ?' => $courseId]);
// Insert/Updates course_settings table
foreach ($courseSettings as $setting) {
$value = isset($updateValues[$setting]) ? $updateValues[$setting] : null;
@ -782,11 +779,12 @@ if ($form->validate() && is_settings_editable()) {
}
$appPlugin->saveCourseSettingsHook($updateValues);
$courseParams = api_get_cidreq();
$cidReset = true;
$cidReq = $course_code;
Display::addFlash(Display::return_message(get_lang('Updated')));
require '../inc/local.inc.php';
$url = api_get_path(WEB_CODE_PATH).'course_info/infocours.php?'.api_get_cidreq();
$url = api_get_path(WEB_CODE_PATH).'course_info/infocours.php?'.$courseParams;
header("Location: $url");
exit;
}

@ -313,7 +313,7 @@ if ($form->validate()) {
$params['course_category'] = $category_code;
$params['course_language'] = $course_language;
$params['gradebook_model_id'] = isset($course_values['gradebook_model_id']) ? $course_values['gradebook_model_id'] : null;
$params['course_template'] = $course_values['course_template'];
$params['course_template'] = isset($course_values['course_template']) ? $course_values['course_template'] : '';
include_once api_get_path(SYS_CODE_PATH).'lang/english/trad4all.inc.php';
$file_to_include = api_get_path(SYS_CODE_PATH).'lang/'.$course_language.'/trad4all.inc.php';

@ -38,7 +38,7 @@ $to_user_id = null;
$parent_id = null;
$lib_path = api_get_path(LIBRARY_PATH);
$actionsRight = '';
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : null;
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : '';
$allowUseTool = false;
if ($allowDownloadDocumentsByApiKey) {
@ -49,9 +49,7 @@ if ($allowDownloadDocumentsByApiKey) {
$username = isset($_GET['username']) ? Security::remove_XSS($_GET['username']) : null;
$apiKey = isset($_GET['api_key']) ? Security::remove_XSS($_GET['api_key']) : null;
$restApi = Rest::validate($username, $apiKey);
$allowUseTool = $restApi ? true : false;
} catch (Exception $e) {
$allowUseTool = false;
@ -74,12 +72,7 @@ $_user = api_get_user_info();
$courseInfo = api_get_course_info();
$courseId = $courseInfo['real_id'];
$course_dir = $courseInfo['directory'].'/document';
$sys_course_path = api_get_path(SYS_COURSE_PATH);
$base_work_dir = $sys_course_path.$course_dir;
$http_www = api_get_path(WEB_COURSE_PATH).$courseInfo['directory'].'/document';
$document_path = $base_work_dir;
$usePpt2lp = api_get_setting('service_ppt2lp', 'active') == 'true';
$course_dir = $courseInfo['directory'].'/document';
$sys_course_path = api_get_path(SYS_COURSE_PATH);
$base_work_dir = $sys_course_path.$course_dir;
$http_www = api_get_path(WEB_COURSE_PATH).$courseInfo['directory'].'/document';
@ -95,6 +88,11 @@ if (isset($_REQUEST['certificate']) && $_REQUEST['certificate'] == 'true') {
$is_certificate_mode = true;
}
$certificateLink = '';
if ($is_certificate_mode) {
$certificateLink = '&certificate=true';
}
// Removing sessions
Session::erase('draw_dir');
Session::erase('paint_dir');
@ -130,7 +128,7 @@ $selectcat = isset($_GET['selectcat']) ? Security::remove_XSS($_GET['selectcat']
$moveTo = isset($_POST['move_to']) ? Security::remove_XSS($_POST['move_to']) : null;
$moveFile = isset($_POST['move_file']) && is_int($_POST['move_file']) ? $_POST['move_file'] : null;
/* Constants and variables */
/* Constants and variables */
$userId = api_get_user_id();
$userInfo = api_get_user_info();
$sessionId = api_get_session_id();
@ -164,7 +162,6 @@ if (!empty($groupId)) {
// Let's assume the user cannot upload files for the group
$group_member_with_upload_rights = false;
if ($group_properties['doc_state'] == 2) {
// Documents are private
if ($isAllowedToEdit || GroupManager::is_user_in_group($userId, $group_properties)) {
@ -202,7 +199,6 @@ if (!empty($groupId)) {
$group_member_with_upload_rights = true;
}
}
Session::write('group_member_with_upload_rights', $group_member_with_upload_rights);
} else {
Session::write('group_member_with_upload_rights', false);
@ -211,11 +207,6 @@ if (!empty($groupId)) {
// Actions.
$document_id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : null;
$currentUrl = api_get_self().'?'.api_get_cidreq().'&id='.$document_id;
/*if (Portfolio::controller()->accept()) {
Portfolio::controller()->run();
}*/
$curdirpath = isset($_GET['curdirpath']) ? Security::remove_XSS($_GET['curdirpath']) : null;
switch ($action) {
@ -748,17 +739,6 @@ if (isset($_GET['curdirpath']) && $_GET['curdirpath'] == '/certificates' &&
}
}
// Is the document tool visible?
// Check whether the tool is actually visible
/*$table_course_tool = Database::get_course_table(TABLE_TOOL_LIST);
$course_id = api_get_course_int_id();
$tool_sql = 'SELECT visibility FROM '.$table_course_tool.'
WHERE c_id = '.$course_id.' AND name = "'.TOOL_DOCUMENT.'"
LIMIT 1';
$tool_result = Database::query($tool_sql);
$tool_row = Database::fetch_array($tool_result);
$tool_visibility = $tool_row['visibility'];*/
$htmlHeadXtra[] = '<script>
function confirmation (name) {
if (confirm(" '.addslashes(get_lang('AreYouSureToDeleteJS')).' "+ name + " ?")) {
@ -811,11 +791,8 @@ if (!$isAllowedToEdit && api_is_coach()) {
}
}
/* Create shared folders */
/* Create shared folders */
DocumentManager::createUserSharedFolder(api_get_user_id(), $courseInfo, $sessionId);
/* MAIN SECTION */
Session::write('image_files_only', '');
$image_files_only = '';
if ($is_certificate_mode) {
@ -956,14 +933,12 @@ $htmlHeadXtra[] = '
// Lib for event log, stats & tracking & record of the access
Event::event_access_tool(TOOL_DOCUMENT);
/* DISPLAY */
/* DISPLAY */
if ($groupId != 0) { // Add group name after for group documents
$add_group_to_title = ' ('.$group_properties['name'].')';
}
$moveForm = '';
/* MOVE FILE OR DIRECTORY */
/* MOVE FILE OR DIRECTORY */
//Only teacher and all users into their group and each user into his/her shared folder
if ($isAllowedToEdit || $group_member_with_upload_rights ||
DocumentManager::is_my_shared_folder(api_get_user_id(), $curdirpath, $sessionId) ||
@ -1066,8 +1041,19 @@ if ($isAllowedToEdit || $group_member_with_upload_rights ||
$doc_id = $moveFile;
DocumentManager::updateDBInfoCloudLink($document_to_move['path'], $moveTo.'/', $doc_id);
//update database item property
api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'FileMoved', api_get_user_id(), $to_group_id, null, null, null, $session_id);
// Update database item property
api_item_property_update(
$_course,
TOOL_DOCUMENT,
$doc_id,
'FileMoved',
api_get_user_id(),
$to_group_id,
null,
null,
null,
$session_id
);
Display::addFlash(
Display::return_message(
get_lang('CloudLinkMoved'),
@ -1157,7 +1143,7 @@ if ($isAllowedToEdit || $group_member_with_upload_rights ||
}
}
/* DELETE FILE OR DIRECTORY */
/* DELETE FILE OR DIRECTORY */
//Only teacher and all users into their group
if ($isAllowedToEdit ||
$group_member_with_upload_rights ||
@ -1294,8 +1280,7 @@ if ($isAllowedToEdit ||
}
$dirForm = '';
/* CREATE DIRECTORY */
/* CREATE DIRECTORY */
//Only teacher and all users into their group and any user into his/her shared folder
if ($isAllowedToEdit ||
$group_member_with_upload_rights ||
@ -1305,7 +1290,6 @@ if ($isAllowedToEdit ||
if (isset($_POST['create_dir']) && $_POST['dirname'] != '') {
// Needed for directory creation
$post_dir_name = $_POST['dirname'];
if ($post_dir_name == '../' || $post_dir_name == '.' || $post_dir_name == '..') {
$message = Display::return_message(get_lang('CannotCreateDir'), 'error');
} else {
@ -1331,7 +1315,7 @@ if ($isAllowedToEdit ||
}
$curdirpath = $document_data['path'];
}
$added_slash = ($curdirpath == '/') ? '' : '/';
$added_slash = $curdirpath == '/' ? '' : '/';
$dir_name = $curdirpath.$added_slash.api_replace_dangerous_char($post_dir_name);
$dir_name = disable_dangerous_file($dir_name);
$dir_check = $base_work_dir.$dir_name;
@ -1370,7 +1354,7 @@ if ($isAllowedToEdit ||
}
}
/* VISIBILITY COMMANDS */
/* VISIBILITY COMMANDS */
if ($isAllowedToEdit) {
if ((isset($_GET['set_invisible']) && !empty($_GET['set_invisible'])) ||
(isset($_GET['set_visible']) && !empty($_GET['set_visible']))
@ -1424,7 +1408,7 @@ if ($isAllowedToEdit) {
}
$templateForm = '';
/* TEMPLATE ACTION */
/* TEMPLATE ACTION */
//Only teacher and all users into their group
if ($isAllowedToEdit ||
$group_member_with_upload_rights ||
@ -1547,7 +1531,7 @@ if (isset($_GET['curdirpath']) &&
}
}
/* GET ALL DOCUMENT DATA FOR CURDIRPATH */
/* GET ALL DOCUMENT DATA FOR CURDIRPATH */
if (isset($_GET['keyword']) && !empty($_GET['keyword'])) {
$documentAndFolders = DocumentManager::get_all_document_data(
$courseInfo,
@ -1597,15 +1581,13 @@ if (!isset($folders) || $folders === false) {
$folders = [];
}
$btngroup = ['class' => 'btn btn-default'];
/* GO TO PARENT DIRECTORY */
$actionsLeft = '';
if ($curdirpath != '/' &&
$curdirpath != $group_properties['directory'] &&
!$is_certificate_mode
) {
$actionsLeft = '<a href="'.api_get_self().'?'.api_get_cidreq().'&id='.$parent_id.'">';
$actionsLeft = '<a href="'.api_get_self().'?'.api_get_cidreq().'&id='.$parent_id.$certificateLink.'">';
$actionsLeft .= Display::return_icon('folder_up.png', get_lang('Up'), '', ICON_SIZE_MEDIUM);
$actionsLeft .= '</a>';
}
@ -1613,7 +1595,7 @@ if ($curdirpath != '/' &&
if ($is_certificate_mode && $curdirpath != '/certificates') {
$actionsLeft .= Display::url(
Display::return_icon('folder_up.png', get_lang('Up'), '', ICON_SIZE_MEDIUM),
api_get_self().'?'.api_get_cidreq().'&curdirpath='.$curdirpath
api_get_self().'?'.api_get_cidreq().'&id='.$parent_id.$certificateLink
);
}
@ -1722,10 +1704,7 @@ if ($isAllowedToEdit ||
);
}
/*echo '<a href="#" id="jcapture">';
echo Display::display_icon('capture.png', get_lang('CatchScreenCasts'), '', ICON_SIZE_MEDIUM).'</a>';*/
if ($capturePluginInstalled) {
if ($capturePluginInstalled && !$is_certificate_mode) {
$actionsLeft .= '<span id="appletplace"></span>';
$actionsLeft .= Display::url(
Display::return_icon('capture.png', get_lang('CatchScreenCasts'), '', ICON_SIZE_MEDIUM),
@ -1744,7 +1723,7 @@ if ($isAllowedToEdit ||
// "Add cloud link" icon
$fileLinkEnabled = api_get_configuration_value('enable_add_file_link');
if ($fileLinkEnabled) {
if ($fileLinkEnabled && !$is_certificate_mode) {
$actionsLeft .= Display::url(
Display::return_icon('clouddoc_new.png', get_lang('AddCloudLink'), '', ICON_SIZE_MEDIUM),
api_get_path(WEB_CODE_PATH).'document/add_link.php?'.api_get_cidreq().'&id='.$document_id
@ -1752,14 +1731,14 @@ if ($isAllowedToEdit ||
}
}
require 'document_slideshow.inc.php';
if (!isset($_GET['keyword'])) {
if (!isset($_GET['keyword']) && !$is_certificate_mode) {
$actionsLeft .= Display::url(
Display::return_icon('slideshow.png', get_lang('ViewSlideshow'), '', ICON_SIZE_MEDIUM),
api_get_path(WEB_CODE_PATH).'document/slideshow.php?'.api_get_cidreq().'&curdirpath='.$curdirpathurl
);
}
if ($isAllowedToEdit) {
if ($isAllowedToEdit && !$is_certificate_mode) {
$actionsLeft .= Display::url(
Display::return_icon('percentage.png', get_lang('DocumentQuota'), '', ICON_SIZE_MEDIUM),
api_get_path(WEB_CODE_PATH).'document/document_quota.php?'.api_get_cidreq()
@ -1777,9 +1756,9 @@ if (!$is_certificate_mode) {
FormValidator::LAYOUT_INLINE
);
$form->addText('keyword', '', false, ['class' => 'col-md-2']);
$form->addElement('hidden', 'cidReq', api_get_course_id());
$form->addElement('hidden', 'id_session', api_get_session_id());
$form->addElement('hidden', 'gidReq', $groupId);
$form->addHidden('cidReq', api_get_course_id());
$form->addHidden('id_session', api_get_session_id());
$form->addHidden('gidReq', $groupId);
$form->addButtonSearch(get_lang('Search'));
$actionsRight = $form->returnForm();
}
@ -1794,7 +1773,6 @@ $userIsSubscribed = CourseManager::is_user_subscribed_in_course(
);
$getSizeURL = api_get_path(WEB_AJAX_PATH).'document.ajax.php?a=get_dir_size&'.api_get_cidreq();
if (isset($documentAndFolders) && is_array($documentAndFolders)) {
if ($groupId == 0 || $userAccess) {
$count = 1;
@ -1813,19 +1791,15 @@ if (isset($documentAndFolders) && is_array($documentAndFolders)) {
false,
$userIsSubscribed
);
$invisibility_span_open = ($is_visible == 0) ? '<span class="muted">' : '';
$invisibility_span_close = ($is_visible == 0) ? '</span>' : '';
$size = 1;
// Get the title or the basename depending on what we're using
if ($document_data['title'] != '') {
$document_name = $document_data['title'];
} else {
$document_name = basename($document_data['path']);
}
$row['name'] = $document_name;
// Data for checkbox
if (($isAllowedToEdit || $group_member_with_upload_rights) && count($documentAndFolders) > 1) {
@ -1867,7 +1841,8 @@ if (isset($documentAndFolders) && is_array($documentAndFolders)) {
$count,
$is_visible,
$size,
$isAllowedToEdit
$isAllowedToEdit,
$is_certificate_mode
);
$path_info = pathinfo($document_data['path']);
@ -1887,7 +1862,8 @@ if (isset($documentAndFolders) && is_array($documentAndFolders)) {
null,
$is_visible,
$size,
$isAllowedToEdit
$isAllowedToEdit,
$is_certificate_mode
);
// Document title with link

@ -58,7 +58,8 @@ if (Security::check_abs_path($sys_course_path.$doc_url, $sys_course_path.'/')) {
$fixLinks = api_get_configuration_value('lp_replace_http_to_https');
$result = DocumentManager::file_send_for_download($full_file_name, false, '', $fixLinks);
if ($result === false) {
api_not_allowed(true);
api_not_allowed(true, get_lang('FileNotFound'), 404);
}
} else {
api_not_allowed(true, get_lang('FileNotFound'), 404);
}
exit;

@ -64,7 +64,6 @@ if (api_is_in_group()) {
}
$dir = '/';
$currentDirPath = isset($_GET['curdirpath']) ? Security::remove_XSS($_GET['curdirpath']) : null;
$readonly = false;
if (isset($_GET['id'])) {
@ -194,7 +193,7 @@ if (!api_is_allowed_to_edit()) {
}
/* MAIN TOOL CODE */
/* Code to change the comment */
/* Code to change the comment */
if (isset($_POST['comment'])) {
// Fixing the path if it is wrong
$comment = trim($_POST['comment']);
@ -237,87 +236,72 @@ if (isset($_POST['comment'])) {
}
}
/* WYSIWYG HTML EDITOR - Program Logic */
/* WYSIWYG HTML EDITOR - Program Logic */
if ($is_allowed_to_edit) {
if (isset($_POST['formSent']) && $_POST['formSent'] == 1) {
$filename = stripslashes($_POST['filename']);
$extension = $_POST['extension'];
if (isset($_POST['formSent']) && $_POST['formSent'] == 1 && !empty($document_id)) {
$content = isset($_POST['content']) ? trim(str_replace(["\r", "\n"], '', stripslashes($_POST['content']))) : null;
$content = Security::remove_XSS($content, COURSEMANAGERLOWSECURITY);
if ($dir == '/') {
$dir = '';
}
$file = $dir.'/'.$filename.'.'.$extension;
$read_only_flag = isset($_POST['readonly']) ? $_POST['readonly'] : null;
$read_only_flag = empty($read_only_flag) ? 0 : 1;
if (empty($filename)) {
Display::addFlash(Display::return_message(get_lang('NoFileName'), 'warning'));
} else {
if ($file_type != 'link') {
$file_size = filesize($document_data['absolute_path']);
}
if ($file_type != 'link') {
$file_size = filesize($document_data['absolute_path']);
}
if ($read_only_flag == 0) {
if (!empty($content)) {
if ($fp = @fopen($document_data['absolute_path'], 'w')) {
// For flv player, change absolute path temporarily to prevent from erasing it in the following lines
$content = str_replace(['flv=h', 'flv=/'], ['flv=h|', 'flv=/|'], $content);
fputs($fp, $content);
fclose($fp);
$filepath = $document_data['absolute_parent_path'];
// "WHAT'S NEW" notification: update table item_property
$document_id = DocumentManager::get_document_id($_course, $file);
if ($document_id) {
update_existing_document(
$_course,
$document_id,
$file_size,
$read_only_flag
);
api_item_property_update(
$_course,
TOOL_DOCUMENT,
$document_id,
'DocumentUpdated',
api_get_user_id(),
null,
null,
null,
null,
$sessionId
);
// Update parent folders
item_property_update_on_folder(
$_course,
$dir,
api_get_user_id()
);
} else {
Display::addFlash(Display::return_message(get_lang('Impossible'), 'warning'));
}
} else {
Display::addFlash(Display::return_message(get_lang('Impossible'), 'warning'));
}
if ($read_only_flag == 0) {
if (!empty($content)) {
if ($fp = @fopen($document_data['absolute_path'], 'w')) {
// For flv player, change absolute path temporarily to prevent
// from erasing it in the following lines
$content = str_replace(['flv=h', 'flv=/'], ['flv=h|', 'flv=/|'], $content);
fputs($fp, $content);
fclose($fp);
$filepath = $document_data['absolute_parent_path'];
update_existing_document(
$_course,
$document_id,
$file_size,
$read_only_flag
);
api_item_property_update(
$_course,
TOOL_DOCUMENT,
$document_id,
'DocumentUpdated',
api_get_user_id(),
null,
null,
null,
null,
$sessionId
);
// Update parent folders
item_property_update_on_folder(
$_course,
$dir,
api_get_user_id()
);
} else {
if ($document_id) {
update_existing_document($_course, $document_id, $file_size, $read_only_flag);
}
Display::addFlash(Display::return_message(get_lang('Impossible'), 'warning'));
}
} else {
if ($document_id) {
update_existing_document($_course, $document_id, $file_size, $read_only_flag);
}
}
header('Location: document.php?id='.$document_data['parent_id'].'&'.api_get_cidreq().($is_certificate_mode ? '&curdirpath=/certificates&selectcat=1' : ''));
exit;
} else {
if ($document_id) {
update_existing_document($_course, $document_id, $file_size, $read_only_flag);
}
}
header('Location: document.php?id='.$document_data['parent_id'].'&'.api_get_cidreq().($is_certificate_mode ? '&curdirpath=/certificates&selectcat=1' : ''));
exit;
}
}
@ -395,15 +379,12 @@ if ($owner_id == api_get_user_id() ||
);
$defaults['title'] = $document_data['title'];
$defaults['formSent'] = 1;
$read_only_flag = isset($_POST['readonly']) ? $_POST['readonly'] : null;
// Desactivation of IE proprietary commenting tags inside the text before loading it on the online editor.
// This fix has been proposed by Hubert Borderiou, see Bug #573, http://support.chamilo.org/issues/573
$defaults['content'] = str_replace('<!--[', '<!-- [', $content);
// HotPotatoes tests are html files, but they should not be edited in order their functionality to be preserved.
$showSystemFolders = api_get_course_setting('show_system_folders');
$condition = stripos($dir, '/HotPotatoes_files') === false;
if ($showSystemFolders == 1) {
@ -481,8 +462,9 @@ if ($owner_id == api_get_user_id() ||
} else {
$form->addButtonUpdate(get_lang('SaveDocument'));
}
$form->addHidden('formSent', 1);
$form->addHidden('filename', $filename);
$defaults['filename'] = $filename;
$defaults['extension'] = $extension;
$defaults['file_path'] = isset($_GET['file']) ? Security::remove_XSS($_GET['file']) : null;
$defaults['commentPath'] = $file;
@ -518,7 +500,9 @@ if ($owner_id == api_get_user_id() ||
);
}
if ($extension == 'svg' && !api_browser_support('svg') && api_get_setting('enabled_support_svg') == 'true') {
if ($extension == 'svg' && !api_browser_support('svg') &&
api_get_setting('enabled_support_svg') == 'true'
) {
echo Display::return_message(get_lang('BrowserDontSupportsSVG'), 'warning');
}
if ($file_type != 'link') {
@ -551,43 +535,13 @@ if ($owner_id == api_get_user_id() ||
});
</script>';
echo $form->return_form();
echo $form->returnForm();
}
}
Display::display_footer();
/**
This function changes the name of a certain file.
It needs no global variables, it takes all info from parameters.
It returns nothing.
@todo check if this function is used
*/
function change_name($base_work_dir, $source_file, $rename_to, $dir, $doc)
{
$file_name_for_change = $base_work_dir.$dir.$source_file;
$rename_to = disable_dangerous_file($rename_to); // Avoid renaming to .htaccess file
$rename_to = my_rename($file_name_for_change, stripslashes($rename_to)); // fileManage API
if ($rename_to) {
if (isset($dir) && $dir != '') {
$source_file = $dir.$source_file;
$new_full_file_name = dirname($source_file).'/'.$rename_to;
} else {
$source_file = '/'.$source_file;
$new_full_file_name = '/'.$rename_to;
}
update_db_info('update', $source_file, $new_full_file_name); // fileManage API
Display::addFlash(Display::return_message(get_lang('fileModified')));
return true;
} else {
Display::addFlash(Display::return_message(get_lang('FileExists')));
}
}
//return button back to
// return button back to
function show_return($document_id, $path, $call_from_tool = '', $slide_id = 0, $is_certificate_mode = false)
{
$actionsLeft = null;

@ -153,15 +153,20 @@ if (isset($_REQUEST['certificate'])) {
$nameTools = get_lang('UplUploadDocument').$add_group_to_title;
}
$certificateLink = '';
if ($is_certificate_mode) {
$certificateLink = '&certificate=true';
}
// Breadcrumbs
if ($is_certificate_mode) {
$interbreadcrumb[] = [
'url' => '../gradebook/index.php?'.api_get_cidreq(),
'url' => '../gradebook/index.php?'.api_get_cidreq().$certificateLink,
'name' => get_lang('Gradebook'),
];
} else {
$interbreadcrumb[] = [
'url' => './document.php?id='.$document_id.'&'.api_get_cidreq(),
'url' => './document.php?id='.$document_id.'&'.api_get_cidreq().$certificateLink,
'name' => get_lang('Documents'),
];
}
@ -173,7 +178,7 @@ if ($document_data) {
} else {
foreach ($document_data['parents'] as $document_sub_data) {
$interbreadcrumb[] = [
'url' => $document_sub_data['document_url'],
'url' => $document_sub_data['document_url'].$certificateLink,
'name' => $document_sub_data['title']
];
}
@ -199,7 +204,7 @@ if (!empty($_FILES)) {
true
);
$redirectUrl = api_get_self().'?'.api_get_cidreq();
$redirectUrl = api_get_self().'?'.api_get_cidreq().$certificateLink;
if ($document_data) {
$redirectUrl .= '&'.http_build_query(
@ -244,7 +249,7 @@ if (!$is_certificate_mode) {
);
}
$action = api_get_self().'?'.api_get_cidreq().'&id='.$document_id;
$action = api_get_self().'?'.api_get_cidreq().'&id='.$document_id.$certificateLink;
$form = new FormValidator(
'upload',

@ -17,6 +17,7 @@ use Chamilo\CourseBundle\Entity\CQuizCategory;
*/
class Exercise
{
public $iId;
public $id;
public $name;
public $title;
@ -87,6 +88,7 @@ class Exercise
*/
public function __construct($courseId = 0)
{
$this->iId = 0;
$this->id = 0;
$this->exercise = '';
$this->description = '';
@ -153,6 +155,7 @@ class Exercise
// if the exercise has been found
if ($object = Database::fetch_object($result)) {
$this->iId = $object->iid;
$this->id = $id;
$this->exercise = $object->title;
$this->name = $object->title;
@ -1718,7 +1721,7 @@ class Exercise
}
}
$this->id = Database::insert($TBL_EXERCISES, $params);
$this->id = $this->iId = Database::insert($TBL_EXERCISES, $params);
if ($this->id) {
$sql = "UPDATE $TBL_EXERCISES SET id = iid WHERE iid = {$this->id} ";
@ -1757,6 +1760,8 @@ class Exercise
// Updates the question position
$this->update_question_positions();
return $this->iId;
}
/**
@ -1930,6 +1935,8 @@ class Exercise
$editor_config
);
$skillList = [];
if ($type == 'full') {
//Can't modify a DirectFeedback question
if ($this->selectFeedbackType() != EXERCISE_FEEDBACK_TYPE_DIRECT) {
@ -2613,6 +2620,7 @@ class Exercise
* function which process the creation of exercises
* @param FormValidator $form
* @param string
* @return int c_quiz.iid
*/
public function processCreation($form, $type = '')
{

@ -62,15 +62,13 @@ $displayMessage = '';
if ($is_allowedToEdit) {
// Duplicating a Question
if (!isset($_POST['recup']) && $question_copy != 0 && isset($fromExercise)) {
$origin_course_id = intval($_GET['course_id']);
$origin_course_id = (int) $_GET['course_id'];
$origin_course_info = api_get_course_info_by_id($origin_course_id);
$current_course = api_get_course_info();
$old_question_id = $question_copy;
$current_course = api_get_course_info();
$old_question_id = $question_copy;
// Reading the source question
$old_question_obj = Question::read($old_question_id, $origin_course_id);
$courseId = $current_course['real_id'];
if ($old_question_obj) {
$old_question_obj->updateTitle(
$old_question_obj->selectTitle().' - '.get_lang('Copy')
@ -128,12 +126,10 @@ if ($is_allowedToEdit) {
Session::write('objExercise', $objExercise);
} elseif (isset($_POST['recup']) && is_array($_POST['recup']) && $fromExercise) {
$list_recup = $_POST['recup'];
foreach ($list_recup as $course_id => $question_data) {
$origin_course_id = intval($course_id);
$origin_course_id = (int) $course_id;
$origin_course_info = api_get_course_info_by_id($origin_course_id);
$current_course = api_get_course_info();
$current_course = api_get_course_info();
foreach ($question_data as $old_question_id) {
//Reading the source question
$old_question_obj = Question::read($old_question_id, $origin_course_id);
@ -142,10 +138,10 @@ if ($is_allowedToEdit) {
$old_question_obj->selectTitle().' - '.get_lang('Copy')
);
//Duplicating the source question, in the current course
// Duplicating the source question, in the current course
$new_id = $old_question_obj->duplicate($current_course);
//Reading new question
// Reading new question
$new_question_obj = Question::read($new_id);
$new_question_obj->addToList($fromExercise);
@ -184,7 +180,6 @@ if (!$is_allowedToEdit) {
}
$confirmYourChoice = addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES, $charset));
$htmlHeadXtra[] = "
<script>
function submit_form(obj) {
@ -241,7 +236,6 @@ echo '<input type="hidden" name="fromExercise" value="'.$fromExercise.'">';
// Session list, if sessions are used.
$sessionList = SessionManager::get_sessions_by_user(api_get_user_id(), api_is_platform_admin());
$tabAttrParam = ['onchange' => 'submit_form(this)'];
$labelFormRow = get_lang('Session');
$session_select_list = [];
@ -282,7 +276,7 @@ $course_select_list = [];
foreach ($course_list as $item) {
$courseItemId = $item['real_id'];
$courseInfo = api_get_course_info_by_id($courseItemId);
$course_select_list[$courseItemId] = "";
$course_select_list[$courseItemId] = '';
if ($courseItemId == api_get_course_int_id()) {
$course_select_list[$courseItemId] = ">&nbsp;&nbsp;&nbsp;&nbsp;";
}
@ -305,6 +299,7 @@ if (empty($selected_course) || $selected_course == '-1') {
} else {
$course_info = api_get_course_info_by_id($selected_course);
}
// If course has changed, reset the menu default
if ($course_id_changed) {
reset_menu_exo_lvl_type();
@ -330,10 +325,9 @@ $selectCourseCategory = Display::select(
['onchange' => 'submit_form(this);'],
false
);
echo Display::form_row(get_lang("QuestionCategory"), $selectCourseCategory);
echo Display::form_row(get_lang('QuestionCategory'), $selectCourseCategory);
// Get exercise list for this course
$exercise_list = ExerciseLib::get_all_exercises_for_course_id(
$course_info,
$session_id,
@ -346,7 +340,7 @@ $my_exercise_list['0'] = get_lang('AllExercises');
$my_exercise_list['-1'] = get_lang('OrphanQuestions');
if (is_array($exercise_list)) {
foreach ($exercise_list as $row) {
$my_exercise_list[$row['id']] = "";
$my_exercise_list[$row['id']] = '';
if ($row['id'] == $fromExercise && $selected_course == api_get_course_int_id()) {
$my_exercise_list[$row['id']] = ">&nbsp;&nbsp;&nbsp;&nbsp;";
}
@ -431,7 +425,6 @@ echo '<input type="hidden" name="course_id" value="'.$selected_course.'">';
$mainQuestionList = [];
// if we have selected an exercise in the list-box 'Filter'
if ($exerciseId > 0) {
$where = '';
$from = '';
@ -618,10 +611,12 @@ if ($exerciseId > 0) {
}
}
} else {
if ($session_id == -1 or empty($session_id)) {
if ($session_id == -1 || empty($session_id)) {
$session_id = 0;
}
$sessionCondition = api_get_session_condition($session_id, true, 'q.session_id');
// All tests for the course selected, not in session
$sql = "SELECT DISTINCT qu.id, question, qu.type, level, q.session_id
FROM
@ -633,8 +628,8 @@ if ($exerciseId > 0) {
qu.c_id = $selected_course AND
qt.c_id = $selected_course AND
q.c_id = $selected_course AND
qu.id = qt.question_id AND
q.session_id = $session_id AND
qu.id = qt.question_id
$sessionCondition AND
q.id = qt.exercice_id $filter
ORDER BY session_id ASC";
$result = Database::query($sql);
@ -800,7 +795,7 @@ if (is_array($mainQuestionList)) {
}
}
Display :: display_sortable_table(
Display::display_sortable_table(
$header,
$data,
'',
@ -900,12 +895,12 @@ function get_action_icon_for_question(
$res = "";
$getParams = "&selected_course=$in_selected_course&courseCategoryId=$in_courseCategoryId&exerciseId=$in_exercise_id&exerciseLevel=$in_exerciseLevel&answerType=$in_answerType&session_id=$in_session_id";
switch ($in_action) {
case "delete":
case 'delete':
$res = "<a href='".api_get_self()."?".api_get_cidreq().$getParams."&delete=$in_questionid' onclick='return confirm_your_choice()'>";
$res .= Display::return_icon("delete.png", get_lang('Delete'));
$res .= "</a>";
break;
case "edit":
case 'edit':
$res = get_a_tag_for_question(
1,
$from_exercise,
@ -915,20 +910,19 @@ function get_action_icon_for_question(
$in_session_id
);
break;
case "add":
case 'add':
// add if question is not already in test
$myObjEx = new Exercise();
$myObjEx->read($from_exercise);
$res = "-";
if (!$myObjEx->isInList($in_questionid)) {
$res = "<a href='".api_get_self()."?".api_get_cidreq().$getParams."&recup=$in_questionid&fromExercise=$from_exercise'>";
$res .= Display::return_icon("view_more_stats.gif", get_lang('InsertALinkToThisQuestionInTheExercise'));
$res .= "</a>";
} else {
$res = "-";
}
unset($myObjEx);
break;
case "clone":
case 'clone':
$url = api_get_self()."?".api_get_cidreq().$getParams."&question_copy=$in_questionid&course_id=$in_selected_course&fromExercise=$from_exercise";
$res = Display::url(
Display::return_icon('cd.png', get_lang('ReUseACopyInCurrentTest')),

@ -2,6 +2,7 @@
/* For licensing terms, see /license.txt */
use Chamilo\CourseBundle\Entity\CForumPost;
use ChamiloSession as Session;
/**
* These files are a complete rework of the forum. The database structure is
@ -26,6 +27,8 @@ use Chamilo\CourseBundle\Entity\CForumPost;
require_once __DIR__.'/../inc/global.inc.php';
Session::erase('_gid');
$htmlHeadXtra[] = '<script>
$(document).ready(function(){
$(\'.hide-me\').slideUp()
@ -273,15 +276,20 @@ if ($action != 'add') {
$show_forum = true;
} else {
// it is a group forum
//echo '-groepsforum';
// it is a group forum but it is public => show
if ($forum['forum_group_public_private'] == 'public') {
$show_forum = true;
//echo '-publiek';
} else {
// it is a group forum and it is private
//echo '-prive';
// it is a group forum and it is private but the user is member of the group
if (in_array($forum['forum_of_group'], $groups_of_user)) {
//echo '-is lid';
$show_forum = true;
} else {
//echo '-is GEEN lid';
$show_forum = false;
}
}
@ -348,14 +356,12 @@ if ($action != 'add') {
null,
ICON_SIZE_MEDIUM
);
$linkForum = '';
$linkForum .= Display::tag(
$linkForum = Display::tag(
'a',
$forum['forum_title'].$session_displayed,
[
'href' => 'viewforum.php?'.api_get_cidreq()
. "&gidReq={$forum['forum_of_group']}&forum={$forum['forum_id']}&search="
. Security::remove_XSS(urlencode(isset($_GET['search']) ? $_GET['search'] : '')),
'href' => 'viewforum.php?'.api_get_cidreq(true, false)."&gidReq={$forum['forum_of_group']}&forum={$forum['forum_id']}&search=".Security::remove_XSS(urlencode(isset($_GET['search']) ? $_GET['search'] : '')),
'class' => empty($forum['visibility']) ? 'text-muted' : null
]
);
@ -390,22 +396,17 @@ if ($action != 'add') {
$html .= '</div>';
$html .= '</div>';
$html .= '<div class="col-md-6">';
$iconEmpty = '';
// The number of topics and posts.
if ($forum['forum_of_group'] !== '0') {
$newPost = '';
$newPost = $iconEmpty;
if (is_array($my_whatsnew_post_info) && !empty($my_whatsnew_post_info)) {
$newPost = ' '.Display::return_icon('alert.png', get_lang('Forum'), null, ICON_SIZE_SMALL);
} else {
$newPost = $iconEmpty;
}
} else {
$newPost = $iconEmpty;
if (is_array($my_whatsnew_post_info) && !empty($my_whatsnew_post_info)) {
$newPost = ' '.Display::return_icon('alert.png', get_lang('Forum'), null, ICON_SIZE_SMALL);
} else {
$newPost = $iconEmpty;
}
}

@ -4,6 +4,8 @@
use Michelf\MarkdownExtra;
use Doctrine\Common\Collections\Criteria;
use Chamilo\CourseBundle\Entity\CChatConnected;
use Chamilo\CoreBundle\Entity\Course;
use Chamilo\CoreBundle\Entity\Session;
/**
* Class CourseChat
@ -41,20 +43,35 @@ class CourseChatUtils
private function getUsersSubscriptions()
{
$em = Database::getManager();
/** @var Course $course */
$course = $em->find('ChamiloCoreBundle:Course', $this->courseId);
if ($this->sessionId) {
/** @var Session $session */
$session = $em->find('ChamiloCoreBundle:Session', $this->sessionId);
$criteria = Criteria::create()->where(Criteria::expr()->eq('course', $course));
$userIsCoach = api_is_course_session_coach($this->userId, $course->getId(), $session->getId());
return $em
->find('ChamiloCoreBundle:Session', $this->sessionId)
if (api_get_configuration_value('course_chat_restrict_to_coach')) {
if ($userIsCoach) {
$criteria->andWhere(
Criteria::expr()->eq('status', Session::STUDENT)
);
} else {
$criteria->andWhere(
Criteria::expr()->eq('status', Session::COACH)
);
}
}
$criteria->orderBy(['status' => Criteria::DESC]);
return $session
->getUserCourseSubscriptions()
->matching($criteria);
}
return $em
->find('ChamiloCoreBundle:Course', $course)
->getUsers();
return $course->getUsers();
}
/**

@ -548,11 +548,14 @@ class AddCourse
"INSERT INTO $tbl_course_homepage (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
VALUES ($course_id, 19, '".TOOL_ATTENDANCE."','attendance/index.php','attendance.gif','".$setting."','0','squaregrey.gif',0,'_self','authoring','0')"
);
$setting = intval(self::string2binary(
api_get_setting('course_create_active_tools', 'course_progress')
));
Database::query(
"INSERT INTO $tbl_course_homepage (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
VALUES ($course_id, 20, '".TOOL_COURSE_PROGRESS."','course_progress/index.php','course_progress.gif','".self::string2binary(
intval(api_get_setting('course_create_active_tools', 'course_progress'))
)."','0','squaregrey.gif',0,'_self','authoring','0')"
VALUES ($course_id, 20, '".TOOL_COURSE_PROGRESS."','course_progress/index.php','course_progress.gif','".$setting."','0','squaregrey.gif',0,'_self','authoring','0')"
);
if (api_get_setting('search_enabled') === 'true') {

@ -3370,10 +3370,12 @@ function api_is_anonymous($user_id = null, $db_check = false)
* Displays message "You are not allowed here..." and exits the entire script.
* @param bool $print_headers Whether or not to print headers (default = false -> does not print them)
* @param string $message
* @param int $responseCode
*/
function api_not_allowed(
$print_headers = false,
$message = null
$message = null,
$responseCode = 0
) {
if (api_get_setting('sso_authentication') === 'true') {
global $osso;
@ -3419,7 +3421,7 @@ function api_not_allowed(
$show_headers = 1;
}
$tpl = new Template(null, $show_headers, $show_headers, false, true, false);
$tpl = new Template(null, $show_headers, $show_headers, false, true, false, true, $responseCode);
$tpl->assign('hide_login_link', 1);
$tpl->assign('content', $msg);

@ -332,7 +332,7 @@ class Certificate extends Model
$my_new_content_html = str_replace(
'((certificate_barcode))',
Display::img(
+$this->certification_web_user_path.$file_info['filename'].'_qr.png',
$this->certification_web_user_path.$file_info['filename'].'_qr.png',
'QR'
),
$content

@ -85,7 +85,7 @@ class CourseHome
tl.c_id = $course_id AND
tip.c_id = $course_id AND
tl.on_homepage='1' AND
tip.visibility != 2";
tip.visibility != 2";
} else {
$sql_links = "SELECT tl.*, tip.visibility
FROM $tbl_link tl
@ -567,8 +567,6 @@ class CourseHome
$allowEditionInSession = api_get_configuration_value('allow_edit_tool_visibility_in_session');
$toolWithSessionValue = [];
foreach ($tools as $row) {
if (!empty($row['session_id'])) {
@ -1296,7 +1294,6 @@ class CourseHome
if (!empty($course_id)) {
$course_tools_table = Database::get_course_table(TABLE_TOOL_LIST);
/* Link to the Course homepage */
$navigation_items['home']['image'] = 'home.gif';
$navigation_items['home']['link'] = $courseInfo['course_public_url'];
@ -1305,8 +1302,25 @@ class CourseHome
$sql = "SELECT * FROM $course_tools_table
WHERE c_id = $course_id AND visibility='1' and admin='0'
ORDER BY id ASC";
$sql_result = Database::query($sql);
while ($row = Database::fetch_array($sql_result)) {
$result = Database::query($sql);
$hideTools = [];
$hideToolsKeys = [];
if (!api_is_platform_admin()) {
$hideTools = api_get_setting('course_hide_tools');
$hideToolsKeys = array_keys($hideTools);
}
while ($row = Database::fetch_array($result)) {
if (!empty($hideTools)) {
if (in_array($row['name'], $hideToolsKeys)) {
// Tool is hidden
if ($hideTools[$row['name']] == 'true') {
continue;
}
}
}
$navigation_items[$row['id']] = $row;
if (stripos($row['link'], 'http://') === false && stripos($row['link'], 'https://') === false) {
$navigation_items[$row['id']]['link'] = api_get_path(WEB_CODE_PATH);
@ -1324,9 +1338,9 @@ class CourseHome
}
}
/* Admin (edit rights) only links
- Course settings (course admin only)
- Course rights (roles & rights overview) */
/* Admin (edit rights) only links
- Course settings (course admin only)
- Course rights (roles & rights overview) */
if ($include_admin_tools) {
$sql = "SELECT name, image FROM $course_tools_table
WHERE c_id = $course_id AND link='course_info/infocours.php'";
@ -1487,13 +1501,11 @@ class CourseHome
if (isset($plugin_info) && isset($plugin_info['title'])) {
$tool_name = $plugin_info['title'];
}*/
if (!file_exists(api_get_path(SYS_CODE_PATH).'img/'.$navigation_item['image']) &&
!file_exists(api_get_path(SYS_CODE_PATH).'img/icons/'.ICON_SIZE_MEDIUM.'/'.$navigation_item['image'])
) {
$navigation_item['image'] = 'plugins.png';
}
//$tool_link_params['href'] = api_get_path(WEB_PLUGIN_PATH).$navigation_item['link'].'?'.api_get_cidreq();
}
$html .= Display::return_icon(

@ -298,7 +298,6 @@ class DocumentManager
$len = filesize($full_file_name);
// Fixing error when file name contains a ","
$filename = str_replace(',', '', $filename);
$sendFileHeaders = api_get_configuration_value('enable_x_sendfile_headers');
if ($forced) {
@ -334,7 +333,6 @@ class DocumentManager
return true;
} else {
//no forced download, just let the browser decide what to do according to the mimetype
$content_type = self::file_get_mime_type($filename);
$lpFixedEncoding = api_get_configuration_value('lp_fixed_encoding');
@ -5100,6 +5098,7 @@ class DocumentManager
* @param int $counter
* @param int $size
* @param bool $isAllowedToEdit
* @param bool $isCertificateMode
*
* @return string url
*/
@ -5110,7 +5109,8 @@ class DocumentManager
$counter = null,
$visibility,
$size = 0,
$isAllowedToEdit = false
$isAllowedToEdit = false,
$isCertificateMode = false
) {
global $dbl_click_id;
@ -5156,7 +5156,6 @@ class DocumentManager
// HTML-files an some other types are shown in a frameset by default.
$is_browser_viewable_file = self::isBrowserViewable($ext);
if ($is_browser_viewable_file) {
if ($ext == 'pdf' || in_array($ext, $webODFList)) {
$url = api_get_self().'?'.$courseParams.'&amp;action=download&amp;id='.$document_data['id'];
@ -5172,9 +5171,12 @@ class DocumentManager
$url = api_get_self().'?'.$courseParams.'&id='.$document_data['id'];
}
if ($isCertificateMode) {
$url .= '&certificate=true';
}
// The little download icon
$tooltip_title = $title;
$tooltip_title_alt = $tooltip_title;
if ($filetype == 'link') {
@ -5251,10 +5253,6 @@ class DocumentManager
$copyToMyFiles = '';
}
}
if ($filetype == 'file') {
//$send_to = Portfolio::share('document', $document_data['id'], array('style' => 'float:right;'));
}
}
$pdf_icon = '';
@ -5283,7 +5281,6 @@ class DocumentManager
$title.
'</span>'.$force_download_html.$send_to.$copyToMyFiles.$open_in_new_window_link.$pdf_icon;
} elseif (
// Show preview
preg_match('/swf$/i', urldecode($checkExtension)) ||
preg_match('/png$/i', urldecode($checkExtension)) ||

@ -4160,7 +4160,6 @@ EOT;
$comnt = null;
if ($show_results) {
$comnt = Event::get_comments($exeId, $questionId);
$teacherAudio = ExerciseLib::getOralFeedbackAudio(
$exeId,
$questionId,
@ -4197,7 +4196,11 @@ EOT;
}
if (in_array($objQuestionTmp->type, [FREE_ANSWER, ORAL_EXPRESSION, ANNOTATION])) {
$check = $objQuestionTmp->isQuestionWaitingReview($score);
$reviewScore = [
'score' => $my_total_score,
'comments' => Event::get_comments($exeId, $questionId)
];
$check = $objQuestionTmp->isQuestionWaitingReview($reviewScore);
if ($check === false) {
$countPendingQuestions++;
}

@ -36,21 +36,29 @@ class DateTimePicker extends HTML_QuickForm_text
$value = api_format_date($value, DATE_TIME_FORMAT_LONG_24H);
}
$label = $this->getLabel();
if (is_array($label) && isset($label[0])) {
$label = $label[0];
}
$resetFieldX = sprintf(get_lang('ResetFieldX'), $label);
return '
<div class="input-group">
<span class="input-group-addon cursor-pointer">
<input ' . $this->_getAttrString($this->_attributes).'>
<input '.$this->_getAttrString($this->_attributes).'>
</span>
<p class="form-control disabled" id="' . $id.'_alt_text">'.$value.'</p>
<input class="form-control" type="hidden" id="' . $id.'_alt" value="'.$value.'">
<p class="form-control disabled" id="'.$id.'_alt_text">'.$value.'</p>
<input class="form-control" type="hidden" id="'.$id.'_alt" value="'.$value.'">
<span class="input-group-btn">
<button class="btn btn-default" type="button">
<span class="fa fa-times text-danger" aria-hidden="true"></span>
<span class="sr-only">' . get_lang('Reset').'</span>
<button class="btn btn-default" type="button"
title="'.$resetFieldX.'">
<span class="fa fa-trash text-danger" aria-hidden="true"></span>
<span class="sr-only">'.$resetFieldX.'</span>
</button>
</span>
</div>
' . $this->getElementJS();
'.$this->getElementJS();
}
/**

@ -21,10 +21,8 @@ class SelectAjax extends HTML_QuickForm_select
public function toHtml()
{
$iso = api_get_language_isocode(api_get_interface_language());
$formatResult = $this->getAttribute('formatResult');
$formatCondition = null;
$formatCondition = '';
if (!empty($formatResult)) {
$formatCondition = ',

@ -316,6 +316,7 @@ class PDF
if (!empty($elements)) {
foreach ($elements as $item) {
$old_src = $item->getAttribute('src');
$old_src = trim($old_src);
if (strpos($old_src, $protocol) === false) {
if (strpos($old_src, '/main/default_course_document') === false) {
@ -352,9 +353,20 @@ class PDF
$new_path = $document_path.$old_src_fixed;
} else {
$new_path = $old_src;
$new_path = str_replace(
'/main/img/',
api_get_path(SYS_CODE_PATH).'img/',
$old_src
);
}
$document_html = str_replace($old_src, $new_path, $document_html);
$item->setAttribute('src', $new_path);
} else {
$new_path = str_replace(
'/main/default_course_document',
api_get_path(SYS_CODE_PATH).'default_course_document',
$old_src
);
$item->setAttribute('src', $new_path);
}
} else {
//Check if this is a complete URL
@ -370,6 +382,8 @@ class PDF
}
}
$document_html = $doc->saveHTML();
api_set_encoding_html($document_html, 'UTF-8'); // The library mPDF expects UTF-8 encoded input data.
// TODO: Maybe it is better idea the title to be passed through
$title = api_get_title_html($document_html, 'UTF-8', 'UTF-8');
@ -493,6 +507,7 @@ class PDF
api_get_path(SYS_CODE_PATH).'img/',
$document_html
);
$document_html = str_replace(api_get_path(WEB_ARCHIVE_PATH), api_get_path(SYS_ARCHIVE_PATH), $document_html);
//replace relative path by absolute path for resources
//$document_html= str_replace('src="/chamilo/main/default_course_document/', 'temp_template_path', $document_html);// before save src templates not apply

@ -1,6 +1,9 @@
<?php
/* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Entity\SessionRelCourseRelUser;
use Chamilo\UserBundle\Entity\User;
/**
* Class Template
*
@ -43,6 +46,7 @@ class Template
public $load_plugins = false;
public $params = [];
public $force_plugin_load = false;
public $responseCode = 0;
/**
* @param string $title
@ -51,6 +55,7 @@ class Template
* @param bool $show_learnpath
* @param bool $hide_global_chat
* @param bool $load_plugins
* @param int $responseCode
* @param bool $sendHeaders send http headers or not
*/
public function __construct(
@ -60,12 +65,13 @@ class Template
$show_learnpath = false,
$hide_global_chat = false,
$load_plugins = true,
$sendHeaders = true
$sendHeaders = true,
$responseCode = 0
) {
// Page title
$this->title = $title;
$this->show_learnpath = $show_learnpath;
$this->setResponseCode($responseCode);
if (empty($this->show_learnpath)) {
$origin = api_get_origin();
@ -173,6 +179,15 @@ class Template
}
}
$functions = [
['name' => 'get_tutors_names', 'callable' => 'Template::returnTutorsNames'],
['name' => 'get_teachers_names', 'callable' => 'Template::returnTeachersNames']
];
foreach ($functions as $function) {
$this->twig->addFunction(new Twig_SimpleFunction($function['name'], $function['callable']));
}
// Setting system variables
$this->set_system_parameters();
@ -1466,7 +1481,8 @@ class Template
$message = get_lang('AccountNotConfirmed').PHP_EOL;
$message .= Display::url(
get_lang('ReSendConfirmationMail'),
api_get_path(WEB_PATH).'main/auth/resend_confirmation_mail.php'
api_get_path(WEB_PATH).'main/auth/resend_confirmation_mail.php',
['class' => 'alert-link']
);
}
break;
@ -1501,7 +1517,7 @@ class Template
$form = new FormValidator(
'formLogin',
'POST',
null,
api_get_path(WEB_PUBLIC_PATH).'login_check',
null,
null,
FormValidator::LAYOUT_BOX_NO_LABEL
@ -1520,7 +1536,7 @@ class Template
$params['autocapitalize'] = 'none';
}
$form->addText(
'login',
'_username',
get_lang('UserName'),
true,
$params
@ -1535,10 +1551,14 @@ class Template
}
$form->addElement(
'password',
'password',
'_password',
get_lang('Pass'),
$params
);
$token = Chamilo\CoreBundle\Framework\Container::$container->get('security.csrf.token_manager')->getToken('authenticate');
$form->addHidden('_csrf_token', $token->getValue());
// Captcha
$captcha = api_get_setting('allow_captcha');
$allowCaptcha = $captcha === 'true';
@ -1673,4 +1693,81 @@ class Template
}
// end of HTTP headers security block
}
/**
* Returns the tutors names for the current course in session
* Function to use in Twig templates
* @return string
*/
public static function returnTutorsNames()
{
$em = Database::getManager();
$tutors = $em
->createQuery('
SELECT u FROM ChamiloUserBundle:User u
INNER JOIN ChamiloCoreBundle:SessionRelCourseRelUser scu WITH u.id = scu.user
WHERE scu.status = :teacher_status AND scu.session = :session AND scu.course = :course
')
->setParameters([
'teacher_status' => SessionRelCourseRelUser::STATUS_COURSE_COACH,
'session' => api_get_session_id(),
'course' => api_get_course_int_id()
])
->getResult();
$names = [];
/** @var User $tutor */
foreach ($tutors as $tutor) {
$names[] = $tutor->getCompleteName();
}
return implode(CourseManager::USER_SEPARATOR, $names);
}
/**s
* Returns the teachers name for the current course
* Function to use in Twig templates
* @return string
*/
public static function returnTeachersNames()
{
$em = Database::getManager();
$teachers = $em
->createQuery('
SELECT u FROM ChamiloUserBundle:User u
INNER JOIN ChamiloCoreBundle:CourseRelUser cu WITH u.id = cu.user
WHERE cu.status = :teacher_status AND cu.course = :course
')
->setParameters([
'teacher_status' => User::COURSE_MANAGER,
'course' => api_get_course_int_id()
])
->getResult();
$names = [];
/** @var User $teacher */
foreach ($teachers as $teacher) {
$names[] = $teacher->getCompleteName();
}
return implode(CourseManager::USER_SEPARATOR, $names);
}
/**
* @param int $code
*/
public function setResponseCode($code)
{
$this->responseCode = $code;
}
/**
* @param string $code
*/
public function getResponseCode()
{
return $this->responseCode;
}
}

@ -10326,161 +10326,161 @@ class learnpath
$my_dep->setAttribute('xml:base', '');
} elseif ($doc_info[1] === 'local') {
switch ($doc_info[2]) {
case 'url': // Local URL - save path as url for now, don't zip file.
$abs_path = api_get_path(SYS_PATH).str_replace(api_get_path(WEB_PATH), '', $doc_info[0]);
$current_dir = dirname($abs_path);
$current_dir = str_replace('\\', '/', $current_dir);
$file_path = realpath($abs_path);
$file_path = str_replace('\\', '/', $file_path);
$my_dep_file->setAttribute('href', $file_path);
$my_dep->setAttribute('xml:base', '');
if (strstr($file_path, $main_path) !== false) {
// The calculated real path is really inside Chamilo's root path.
// Reduce file path to what's under the DocumentRoot.
$file_path = substr($file_path, strlen($root_path) - 1);
//echo $file_path;echo '<br /><br />';
//error_log(__LINE__.'Reduced url path: '.$file_path, 0);
$zip_files_abs[] = $file_path;
$link_updates[$my_file_path][] = ['orig' => $doc_info[0], 'dest' => $file_path];
case 'url': // Local URL - save path as url for now, don't zip file.
$abs_path = api_get_path(SYS_PATH).str_replace(api_get_path(WEB_PATH), '', $doc_info[0]);
$current_dir = dirname($abs_path);
$current_dir = str_replace('\\', '/', $current_dir);
$file_path = realpath($abs_path);
$file_path = str_replace('\\', '/', $file_path);
$my_dep_file->setAttribute('href', $file_path);
$my_dep->setAttribute('xml:base', '');
} elseif (empty($file_path)) {
/*$document_root = substr(api_get_path(SYS_PATH), 0, strpos(api_get_path(SYS_PATH), api_get_path(REL_PATH)));
if (strpos($document_root, -1) == '/') {
$document_root = substr(0, -1, $document_root);
}*/
$file_path = $_SERVER['DOCUMENT_ROOT'].$abs_path;
$file_path = str_replace('//', '/', $file_path);
if (file_exists($file_path)) {
$file_path = substr($file_path, strlen($current_dir)); // We get the relative path.
$zip_files[] = $my_sub_dir.'/'.$file_path;
if (strstr($file_path, $main_path) !== false) {
// The calculated real path is really inside Chamilo's root path.
// Reduce file path to what's under the DocumentRoot.
$file_path = substr($file_path, strlen($root_path) - 1);
//echo $file_path;echo '<br /><br />';
//error_log(__LINE__.'Reduced url path: '.$file_path, 0);
$zip_files_abs[] = $file_path;
$link_updates[$my_file_path][] = ['orig' => $doc_info[0], 'dest' => $file_path];
$my_dep_file->setAttribute('href', $file_path);
$my_dep->setAttribute('xml:base', '');
}
}
break;
case 'abs': // Absolute path from DocumentRoot. Save file and leave path as is in the zip.
$my_dep_file->setAttribute('href', $doc_info[0]);
$my_dep->setAttribute('xml:base', '');
// The next lines fix a bug when using the "subdir" mode of Chamilo, whereas
// an image path would be constructed as /var/www/subdir/subdir/img/foo.bar
$abs_img_path_without_subdir = $doc_info[0];
$relp = api_get_path(REL_PATH); // The url-append config param.
$pos = strpos($abs_img_path_without_subdir, $relp);
if ($pos === 0) {
$abs_img_path_without_subdir = '/'.substr($abs_img_path_without_subdir, strlen($relp));
}
//$file_path = realpath(api_get_path(SYS_PATH).$abs_img_path_without_subdir);
$file_path = realpath(api_get_path(SYS_APP_PATH).$abs_img_path_without_subdir);
$file_path = str_replace('\\', '/', $file_path);
$file_path = str_replace('//', '/', $file_path);
// Prepare the current directory path (until just under 'document') with a trailing slash.
$cur_path = substr($current_course_path, -1) == '/' ? $current_course_path : $current_course_path.'/';
// Check if the current document is in that path.
if (strstr($file_path, $cur_path) !== false) {
// The document is in that path, now get the relative path
// to the containing document.
$orig_file_path = dirname($cur_path.$my_file_path).'/';
$orig_file_path = str_replace('\\', '/', $orig_file_path);
$relative_path = '';
if (strstr($file_path, $cur_path) !== false) {
//$relative_path = substr($file_path, strlen($orig_file_path));
$relative_path = str_replace($cur_path, '', $file_path);
$file_path = substr($file_path, strlen($cur_path));
} else {
// This case is still a problem as it's difficult to calculate a relative path easily
// might still generate wrong links.
//$file_path = substr($file_path,strlen($cur_path));
// Calculate the directory path to the current file (without trailing slash).
$my_relative_path = dirname($file_path);
$my_relative_path = str_replace('\\', '/', $my_relative_path);
$my_relative_file = basename($file_path);
// Calculate the directory path to the containing file (without trailing slash).
$my_orig_file_path = substr($orig_file_path, 0, -1);
$dotdot = '';
$subdir = '';
while (strstr($my_relative_path, $my_orig_file_path) === false && (strlen($my_orig_file_path) > 1) && (strlen($my_relative_path) > 1)) {
$my_relative_path2 = dirname($my_relative_path);
$my_relative_path2 = str_replace('\\', '/', $my_relative_path2);
$my_orig_file_path = dirname($my_orig_file_path);
$my_orig_file_path = str_replace('\\', '/', $my_orig_file_path);
$subdir = substr($my_relative_path, strlen($my_relative_path2) + 1).'/'.$subdir;
$dotdot += '../';
$my_relative_path = $my_relative_path2;
} elseif (empty($file_path)) {
/*$document_root = substr(api_get_path(SYS_PATH), 0, strpos(api_get_path(SYS_PATH), api_get_path(REL_PATH)));
if (strpos($document_root, -1) == '/') {
$document_root = substr(0, -1, $document_root);
}*/
$file_path = $_SERVER['DOCUMENT_ROOT'].$abs_path;
$file_path = str_replace('//', '/', $file_path);
if (file_exists($file_path)) {
$file_path = substr($file_path, strlen($current_dir)); // We get the relative path.
$zip_files[] = $my_sub_dir.'/'.$file_path;
$link_updates[$my_file_path][] = ['orig' => $doc_info[0], 'dest' => $file_path];
$my_dep_file->setAttribute('href', $file_path);
$my_dep->setAttribute('xml:base', '');
}
$relative_path = $dotdot.$subdir.$my_relative_file;
}
// Put the current document in the zip (this array is the array
// that will manage documents already in the course folder - relative).
$zip_files[] = $file_path;
// Update the links to the current document in the containing document (make them relative).
$link_updates[$my_file_path][] = ['orig' => $doc_info[0], 'dest' => $relative_path];
$my_dep_file->setAttribute('href', $file_path);
$my_dep->setAttribute('xml:base', '');
} elseif (strstr($file_path, $main_path) !== false) {
// The calculated real path is really inside Chamilo's root path.
// Reduce file path to what's under the DocumentRoot.
$file_path = substr($file_path, strlen($root_path));
//echo $file_path;echo '<br /><br />';
//error_log('Reduced path: '.$file_path, 0);
$zip_files_abs[] = $file_path;
$link_updates[$my_file_path][] = ['orig' => $doc_info[0], 'dest' => $file_path];
$my_dep_file->setAttribute('href', 'document/'.$file_path);
break;
case 'abs': // Absolute path from DocumentRoot. Save file and leave path as is in the zip.
$my_dep_file->setAttribute('href', $doc_info[0]);
$my_dep->setAttribute('xml:base', '');
} elseif (empty($file_path)) {
/*$document_root = substr(api_get_path(SYS_PATH), 0, strpos(api_get_path(SYS_PATH), api_get_path(REL_PATH)));
if(strpos($document_root,-1) == '/') {
$document_root = substr(0, -1, $document_root);
}*/
$file_path = $_SERVER['DOCUMENT_ROOT'].$doc_info[0];
$file_path = str_replace('//', '/', $file_path);
$abs_path = api_get_path(SYS_PATH).str_replace(api_get_path(WEB_PATH), '', $doc_info[0]);
$current_dir = dirname($abs_path);
$current_dir = str_replace('\\', '/', $current_dir);
if (file_exists($file_path)) {
$file_path = substr($file_path, strlen($current_dir)); // We get the relative path.
$zip_files[] = $my_sub_dir.'/'.$file_path;
$link_updates[$my_file_path][] = ['orig' => $doc_info[0], 'dest' => $file_path];
$my_dep_file->setAttribute('href', 'document/'.$file_path);
$my_dep->setAttribute('xml:base', '');
// The next lines fix a bug when using the "subdir" mode of Chamilo, whereas
// an image path would be constructed as /var/www/subdir/subdir/img/foo.bar
$abs_img_path_without_subdir = $doc_info[0];
$relp = api_get_path(REL_PATH); // The url-append config param.
$pos = strpos($abs_img_path_without_subdir, $relp);
if ($pos === 0) {
$abs_img_path_without_subdir = '/'.substr($abs_img_path_without_subdir, strlen($relp));
}
}
break;
case 'rel':
// Path relative to the current document.
// Save xml:base as current document's directory and save file in zip as subdir.file_path
if (substr($doc_info[0], 0, 2) == '..') {
// Relative path going up.
$current_dir = dirname($current_course_path.'/'.$item->get_file_path()).'/';
$current_dir = str_replace('\\', '/', $current_dir);
$file_path = realpath($current_dir.$doc_info[0]);
//$file_path = realpath(api_get_path(SYS_PATH).$abs_img_path_without_subdir);
$file_path = realpath(api_get_path(SYS_APP_PATH).$abs_img_path_without_subdir);
$file_path = str_replace('\\', '/', $file_path);
if (strstr($file_path, $main_path) !== false) {
$file_path = str_replace('//', '/', $file_path);
// Prepare the current directory path (until just under 'document') with a trailing slash.
$cur_path = substr($current_course_path, -1) == '/' ? $current_course_path : $current_course_path.'/';
// Check if the current document is in that path.
if (strstr($file_path, $cur_path) !== false) {
// The document is in that path, now get the relative path
// to the containing document.
$orig_file_path = dirname($cur_path.$my_file_path).'/';
$orig_file_path = str_replace('\\', '/', $orig_file_path);
$relative_path = '';
if (strstr($file_path, $cur_path) !== false) {
//$relative_path = substr($file_path, strlen($orig_file_path));
$relative_path = str_replace($cur_path, '', $file_path);
$file_path = substr($file_path, strlen($cur_path));
} else {
// This case is still a problem as it's difficult to calculate a relative path easily
// might still generate wrong links.
//$file_path = substr($file_path,strlen($cur_path));
// Calculate the directory path to the current file (without trailing slash).
$my_relative_path = dirname($file_path);
$my_relative_path = str_replace('\\', '/', $my_relative_path);
$my_relative_file = basename($file_path);
// Calculate the directory path to the containing file (without trailing slash).
$my_orig_file_path = substr($orig_file_path, 0, -1);
$dotdot = '';
$subdir = '';
while (strstr($my_relative_path, $my_orig_file_path) === false && (strlen($my_orig_file_path) > 1) && (strlen($my_relative_path) > 1)) {
$my_relative_path2 = dirname($my_relative_path);
$my_relative_path2 = str_replace('\\', '/', $my_relative_path2);
$my_orig_file_path = dirname($my_orig_file_path);
$my_orig_file_path = str_replace('\\', '/', $my_orig_file_path);
$subdir = substr($my_relative_path, strlen($my_relative_path2) + 1).'/'.$subdir;
$dotdot += '../';
$my_relative_path = $my_relative_path2;
}
$relative_path = $dotdot.$subdir.$my_relative_file;
}
// Put the current document in the zip (this array is the array
// that will manage documents already in the course folder - relative).
$zip_files[] = $file_path;
// Update the links to the current document in the containing document (make them relative).
$link_updates[$my_file_path][] = ['orig' => $doc_info[0], 'dest' => $relative_path];
$my_dep_file->setAttribute('href', $file_path);
$my_dep->setAttribute('xml:base', '');
} elseif (strstr($file_path, $main_path) !== false) {
// The calculated real path is really inside Chamilo's root path.
// Reduce file path to what's under the DocumentRoot.
$file_path = substr($file_path, strlen($root_path));
//echo $file_path;echo '<br /><br />';
//error_log('Reduced path: '.$file_path, 0);
$zip_files_abs[] = $file_path;
$link_updates[$my_file_path][] = ['orig' => $doc_info[0], 'dest' => $file_path];
$my_dep_file->setAttribute('href', 'document/'.$file_path);
$my_dep->setAttribute('xml:base', '');
} elseif (empty($file_path)) {
/*$document_root = substr(api_get_path(SYS_PATH), 0, strpos(api_get_path(SYS_PATH), api_get_path(REL_PATH)));
if(strpos($document_root,-1) == '/') {
$document_root = substr(0, -1, $document_root);
}*/
$file_path = $_SERVER['DOCUMENT_ROOT'].$doc_info[0];
$file_path = str_replace('//', '/', $file_path);
$abs_path = api_get_path(SYS_PATH).str_replace(api_get_path(WEB_PATH), '', $doc_info[0]);
$current_dir = dirname($abs_path);
$current_dir = str_replace('\\', '/', $current_dir);
if (file_exists($file_path)) {
$file_path = substr($file_path, strlen($current_dir)); // We get the relative path.
$zip_files[] = $my_sub_dir.'/'.$file_path;
$link_updates[$my_file_path][] = ['orig' => $doc_info[0], 'dest' => $file_path];
$my_dep_file->setAttribute('href', 'document/'.$file_path);
$my_dep->setAttribute('xml:base', '');
}
}
} else {
$zip_files[] = $my_sub_dir.'/'.$doc_info[0];
break;
case 'rel':
// Path relative to the current document.
// Save xml:base as current document's directory and save file in zip as subdir.file_path
if (substr($doc_info[0], 0, 2) == '..') {
// Relative path going up.
$current_dir = dirname($current_course_path.'/'.$item->get_file_path()).'/';
$current_dir = str_replace('\\', '/', $current_dir);
$file_path = realpath($current_dir.$doc_info[0]);
$file_path = str_replace('\\', '/', $file_path);
if (strstr($file_path, $main_path) !== false) {
// The calculated real path is really inside Chamilo's root path.
// Reduce file path to what's under the DocumentRoot.
$file_path = substr($file_path, strlen($root_path));
$zip_files_abs[] = $file_path;
$link_updates[$my_file_path][] = ['orig' => $doc_info[0], 'dest' => $file_path];
$my_dep_file->setAttribute('href', 'document/'.$file_path);
$my_dep->setAttribute('xml:base', '');
}
} else {
$zip_files[] = $my_sub_dir.'/'.$doc_info[0];
$my_dep_file->setAttribute('href', $doc_info[0]);
$my_dep->setAttribute('xml:base', $my_xml_sub_dir);
}
break;
default:
$my_dep_file->setAttribute('href', $doc_info[0]);
$my_dep->setAttribute('xml:base', $my_xml_sub_dir);
}
break;
default:
$my_dep_file->setAttribute('href', $doc_info[0]);
$my_dep->setAttribute('xml:base', '');
break;
}
$my_dep->setAttribute('xml:base', '');
break;
}
}
$my_dep->appendChild($my_dep_file);
$resources->appendChild($my_dep);

@ -72,8 +72,7 @@ $hide_toc_frame = $form->addElement(
'checkbox',
'hide_toc_frame',
null,
get_lang('HideTocFrame'),
['onclick' => '$("#lp_layout_column").toggle()']
get_lang('HideTocFrame')
);
if (api_get_setting('allow_course_theme') === 'true') {
$mycourselptheme = api_get_course_setting('allow_learning_path_theme');
@ -130,10 +129,12 @@ if (api_get_setting('search_enabled') === 'true') {
}
}
$hideTableOfContents = $_SESSION['oLP']->getHideTableOfContents();
$defaults['lp_encoding'] = Security::remove_XSS($_SESSION['oLP']->encoding);
$defaults['lp_name'] = Security::remove_XSS($_SESSION['oLP']->get_name());
$defaults['lp_author'] = Security::remove_XSS($_SESSION['oLP']->get_author());
$defaults['hide_toc_frame'] = $_SESSION['oLP']->getHideTableOfContents();
$defaults['hide_toc_frame'] = $hideTableOfContents;
$defaults['category_id'] = intval($_SESSION['oLP']->getCategoryId());
$defaults['accumulate_scorm_time'] = $_SESSION['oLP']->getAccumulateScormTime();
@ -240,17 +241,21 @@ Display::display_header(get_lang('CourseSettings'), 'Path');
echo $_SESSION['oLP']->build_action_menu(false, false, true, false);
echo '<div class="row">';
if ($_SESSION['oLP']->getHideTableOfContents() == 1) {
echo '<div class="col-md-12">';
$form->display();
echo '</div>';
} else {
echo '<div class="col-md-8">';
$form->display();
echo '</div>';
echo '<div class="col-md-4" align="center">';
echo Display::return_icon('course_setting_layout.png');
echo '</div>';
}
echo '<div class="'.($hideTableOfContents ? 'col-md-12' : 'col-md-8').'" id="pnl-frm">';
$form->display();
echo '</div>';
echo '<div class="'.($hideTableOfContents ? 'hide' : 'col-md-4').' text-right" id="pnl-toc">';
echo Display::return_icon('course_setting_layout.png');
echo '</div>';
echo '</div>';
echo "
<script>
$(document).on('ready', function () {
$('[name=\'hide_toc_frame\']').on('change', function() {
$('#pnl-frm').toggleClass('col-md-8').toggleClass('col-sm-12');
$('#pnl-toc').toggleClass('col-md-4').toggleClass('hide');
});
});
</script>
";
Display::display_footer();

@ -368,7 +368,7 @@ foreach ($categories as $item) {
}
if ($is_allowed_to_edit) {
$dsp_progress = '<center>'.$progress.'</center>';
$dsp_progress = '<center>'.$progress.'%</center>';
} else {
$dsp_progress = '';
if (!api_is_invitee()) {

@ -1,6 +1,8 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
/**
* This is a learning path creation and player tool in Chamilo - previously learnpath_handler.php
*
@ -12,19 +14,18 @@
*/
// Prevents FF 3.6 + Adobe Reader 9 bug see BT#794 when calling a pdf file in a LP
require_once __DIR__.'/../inc/global.inc.php';
api_protect_course_script();
/** @var learnpath $lp */
$lp = Session::read('oLP');
if (isset($_GET['lp_item_id'])) {
// Get parameter only came from lp_view.php.
$lp_item_id = intval($_GET['lp_item_id']);
if (isset($_SESSION['lpobject'])) {
$oLP = unserialize($_SESSION['lpobject']);
}
if (is_object($oLP)) {
$src = $oLP->get_link('http', $lp_item_id);
if (is_object($lp)) {
$src = $lp->get_link('http', $lp_item_id);
}
$url_info = parse_url($src);
@ -41,15 +42,18 @@ if (isset($_GET['lp_item_id'])) {
}
}
if (empty($lp)) {
api_not_allowed();
}
$mode = isset($_REQUEST['mode']) ? $_REQUEST['mode'] : 'fullpage';
if (isset($_SESSION['oLP']) && isset($_GET['id'])) {
$_SESSION['oLP'] -> current = intval($_GET['id']);
$_SESSION['oLP']->current = intval($_GET['id']);
}
$this_section = SECTION_COURSES;
/* Header and action code */
/* Constants and variables */
$is_allowed_to_edit = api_is_allowed_to_edit(null, true);
$isStudentView = (empty($_REQUEST['isStudentView']) ? 0 : (int) $_REQUEST['isStudentView']);
$learnpath_id = (int) $_REQUEST['lp_id'];
@ -59,12 +63,7 @@ if ((!$is_allowed_to_edit) || $isStudentView) {
exit;
}
// From here on, we are admin because of the previous condition, so don't check anymore.
$course_id = api_get_course_int_id();
$sql = "SELECT * FROM $tbl_lp WHERE iid = $learnpath_id";
$result = Database::query($sql);
$therow = Database::fetch_array($result);
/* SHOWING THE ADMIN TOOLS */
if (api_is_in_gradebook()) {
$interbreadcrumb[] = [
@ -79,7 +78,7 @@ $interbreadcrumb[] = [
];
$interbreadcrumb[] = [
'url' => api_get_self()."?action=build&lp_id=$learnpath_id&".api_get_cidreq(),
'name' => $therow['name']
'name' => $lp->get_name()
];
$interbreadcrumb[] = [
'url' => api_get_self()."?action=add_item&type=step&lp_id=$learnpath_id&".api_get_cidreq(),
@ -88,9 +87,7 @@ $interbreadcrumb[] = [
// Theme calls
$show_learn_path = true;
if (isset($_SESSION['oLP']) && is_object($_SESSION['oLP'])) {
$lp_theme_css = $_SESSION['oLP']->get_theme();
}
$lp_theme_css = $lp->get_theme();
if ($mode == 'fullpage') {
Display::display_header(get_lang('Item'), 'Path');
@ -118,22 +115,22 @@ function confirmation(name) {
<?php
$id = isset($new_item_id) ? $new_item_id : $_GET['id'];
if (is_object($_SESSION['oLP'])) {
if (is_object($lp)) {
switch ($mode) {
case 'fullpage':
echo $_SESSION['oLP']->build_action_menu();
echo $lp->build_action_menu();
echo '<div class="row">';
echo '<div class="col-md-3">';
echo $_SESSION['oLP']->return_new_tree();
echo $lp->return_new_tree();
echo '</div>';
echo '<div class="col-md-9">';
echo $_SESSION['oLP']->display_item($id);
echo $lp->display_item($id);
echo '</div>';
echo '</div>';
Display::display_footer();
break;
case 'preview_document':
echo $_SESSION['oLP']->display_item($id, null, false);
echo $lp->display_item($id, null, false);
break;
}
}

@ -12,7 +12,7 @@ $this_section = SECTION_PLATFORM_ADMIN;
SessionManager::protectSession(null, false);
//Add the JS needed to use the jqgrid
// Add the JS needed to use the jqgrid
$htmlHeadXtra[] = api_get_jqgrid_js();
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : null;
@ -41,7 +41,7 @@ if ($action == 'delete') {
$tool_name = get_lang('SessionList');
Display::display_header($tool_name);
$courseId = isset($_GET['course_id']) ? $_GET['course_id'] : null;
$courseId = isset($_GET['course_id']) ? $_GET['course_id'] : 0;
$sessionFilter = new FormValidator(
'course_filter',
@ -56,7 +56,10 @@ $courseSelect = $sessionFilter->addElement(
'course_name',
get_lang('SearchCourse'),
null,
['url' => api_get_path(WEB_AJAX_PATH).'course.ajax.php?a=search_course']
[
'id' => 'course_name',
'url' => api_get_path(WEB_AJAX_PATH).'course.ajax.php?a=search_course'
]
);
if (!empty($courseId)) {

@ -19,7 +19,6 @@ if (!isset($_GET['cidReq'])) {
$_cid = $_GET['cidReq'];
}
// Including the global initialization file
require_once __DIR__.'/../inc/global.inc.php';
// Database table definitions
@ -33,32 +32,34 @@ $table_user = Database::get_main_table(TABLE_MAIN_USER);
$allowRequiredSurveyQuestions = api_get_configuration_value('allow_required_survey_questions');
// Check if user is anonymous or not
$isAnonymous = false;
if (api_is_anonymous(api_get_user_id(), true)) {
$isAnonymous = true;
} else {
$isAnonymous = false;
}
// getting all the course information
if (isset($_GET['course'])) {
$course_info = api_get_course_info($_GET['course']);
$courseInfo = api_get_course_info($_GET['course']);
} else {
$course_info = api_get_course_info();
$courseInfo = api_get_course_info();
}
if (empty($course_info)) {
api_not_allowed();
if (empty($courseInfo)) {
api_not_allowed(true);
}
$userInfo = api_get_user_info();
$sessionId = isset($_GET['id_session']) ? (int) $_GET['id_session'] : api_get_session_id();
// Breadcrumbs
if (!empty($_user)) {
if (!empty($userInfo)) {
$interbreadcrumb[] = [
'url' => api_get_path(WEB_CODE_PATH).'survey/survey_list.php?cidReq='.$course_info['code'],
'url' => api_get_path(WEB_CODE_PATH).'survey/survey_list.php?cidReq='.$courseInfo['code'].'&id_session='.$sessionId,
'name' => get_lang('SurveyList')
];
}
$course_id = $course_info['real_id'];
$course_id = $courseInfo['real_id'];
$surveyCode = isset($_GET['scode']) ? Database::escape_string($_GET['scode']) : '';
if ($surveyCode != '') {
@ -159,7 +160,7 @@ $sql = "SELECT * FROM $table_survey
WHERE
c_id = $course_id AND
code = '".Database::escape_string($survey_invitation['survey_code'])."'";
$sql .= api_get_session_condition(api_get_session_id());
$sql .= api_get_session_condition($sessionId);
$result = Database::query($sql);
if (Database::num_rows($result) > 1) {
@ -192,6 +193,9 @@ if (Database::num_rows($result) > 1) {
// Getting the survey information
$survey_data = SurveyManager::get_survey($survey_invitation['survey_id']);
if (empty($survey_data)) {
api_not_allowed(true);
}
$survey_data['survey_id'] = $survey_invitation['survey_id'];
// Storing the answers
@ -353,7 +357,7 @@ if (count($_POST) > 0) {
}
} else {
// In case it's another type than 0 or 1
die(get_lang('ErrorSurveyTypeUnknown'));
api_not_allowed(true, get_lang('ErrorSurveyTypeUnknown'));
}
}
@ -365,7 +369,8 @@ if ($user_id == 0) {
$user_data = api_get_user_info($user_id);
if ($survey_data['form_fields'] != '' &&
$survey_data['anonymous'] == 0 && is_array($user_data)
$survey_data['anonymous'] == 0 &&
is_array($user_data)
) {
$form_fields = explode('@', $survey_data['form_fields']);
$list = [];
@ -379,14 +384,16 @@ if ($survey_data['form_fields'] != '' &&
}
}
// We use the same form as in auth/profile.php
$form = new FormValidator(
'profile',
'post',
api_get_self()."?".api_get_cidreq().'&'
.str_replace('&show_form=1', '&show_form=1', Security::remove_XSS($_SERVER['QUERY_STRING']))
);
$url = api_get_self().
'?cidReq='.$courseInfo['code'].
'&id_session='.$sessionId;
$listQueryParams = preg_split('/&/', $_SERVER['QUERY_STRING']);
foreach ($listQueryParams as $param) {
$url .= '&'.Security::remove_XSS($param);
}
// We use the same form as in auth/profile.php
$form = new FormValidator('profile', 'post', $url);
if (api_is_western_name_order()) {
if (isset($list['firstname']) && $list['firstname'] == 1) {
//FIRST NAME
@ -523,7 +530,6 @@ if (!isset($_GET['show'])) {
Session::erase('paged_questions');
Session::erase('page_questions_sec');
$paged_questions_sec = [];
if (!empty($survey_data['survey_introduction'])) {
echo '<div class="survey_content">'.$survey_data['survey_introduction'].'</div>';
}
@ -560,6 +566,7 @@ if ($survey_data['form_fields'] &&
}
// Remove trailing , from the query we have so far
$sql = rtrim($sql, ',');
$sql .= " WHERE id = $user_id";
if ($update) {
Database::query($sql);
@ -604,10 +611,10 @@ if (isset($_POST['finish_survey'])) {
$survey_invitation['c_id']
);
if ($course_info) {
if ($courseInfo) {
echo Display::toolbarButton(
get_lang('ReturnToCourseHomepage'),
api_get_course_url($course_info['code']),
api_get_course_url($courseInfo['code']),
'home'
);
}
@ -806,10 +813,7 @@ if (isset($_GET['show']) || isset($_POST['personality'])) {
$list['group'] = $row['survey_group_pri'];
$totals[] = $list;
}
//echo '<pre>'; print_r($totals);
$final_results = [];
// Get a percentage score for each group
for ($i = 0; $i < count($totals); $i++) {
for ($j = 0; $j < count($results); $j++) {
@ -973,7 +977,6 @@ if (isset($_GET['show']) || isset($_POST['personality'])) {
$paged_questions_sec = Session::read('page_questions_sec');
}
$paged_questions = Session::read('paged_questions'); // For the sake of pages counting
//$paged_questions = $paged_questions_sec; // For the sake of pages counting coming up at display time...
if ($shuffle == '') {
$shuffle = ' BY survey_question.sort, survey_question_option.sort ASC ';
}
@ -1152,7 +1155,6 @@ if (isset($_GET['show']) || isset($_POST['personality'])) {
}
$counter++;
}
var_Dump($questions);
}
}
} else { // In case it's another type than 0 or 1
@ -1189,9 +1191,14 @@ $g_ic = isset($_GET['invitationcode']) ? Security::remove_XSS($_GET['invitationc
$g_cr = isset($_GET['cidReq']) ? Security::remove_XSS($_GET['cidReq']) : '';
$p_l = isset($_POST['language']) ? Security::remove_XSS($_POST['language']) : '';
$add_parameters = isset($_GET['user_id']) ? 'user_id='.intval($_GET['user_id']).'&amp;' : '';
$add_parameters = isset($_GET['user_id']) ? '&user_id='.intval($_GET['user_id']) : '';
$url = api_get_self().'?'.api_get_cidreq().'&'.$add_parameters.'course='.$g_c.'&invitationcode='.$g_ic.'&show='.$show;
$url = api_get_self().'?cidReq='.$courseInfo['code'].
'&id_session='.$sessionId.
$add_parameters.
'&course='.$g_c.
'&invitationcode='.$g_ic.
'&show='.$show;
$form = new FormValidator(
'question',
'post',
@ -1208,7 +1215,6 @@ if (isset($questions) && is_array($questions)) {
$display = new $ch_type;
// @todo move this in a function.
$form->addHtml('<div class="survey_question '.$ch_type.'">');
//$form->addHtml('<div class="survey_question_wrapper"><div class="survey_question">');
$form->addHtml('<h5 class="title">'.$question['sort'].'. '.strip_tags($question['survey_question']).'</h5>');
$userAnswerData = SurveyUtil::get_answers_of_question_by_user($question['survey_id'], $question['question_id']);
$finalAnswer = null;
@ -1218,7 +1224,6 @@ if (isset($questions) && is_array($questions)) {
switch ($question['type']) {
case 'score':
$finalAnswer = [];
foreach ($userAnswer as $userChoice) {
list($choiceId, $choiceValue) = explode('*', $userChoice);
@ -1235,7 +1240,6 @@ if (isset($questions) && is_array($questions)) {
break;
}
}
$display->render($form, $question, $finalAnswer);
$form->addHtml('</div>');
}
@ -1302,7 +1306,8 @@ if ($survey_data['survey_type'] === '0') {
}
}
}
} elseif ($survey_data['survey_type'] === '1') { //conditional/personality-test type survey
} elseif ($survey_data['survey_type'] === '1') {
//conditional/personality-test type survey
if (isset($_GET['show']) || isset($_POST['personality'])) {
$numberofpages = count($paged_questions);
if (!empty($paged_questions_sec) && count($paged_questions_sec) > 0) {
@ -1358,8 +1363,6 @@ if ($survey_data['survey_type'] === '0') {
}
$form->addHtml('</div>');
$form->display();
// Footer
Display::display_footer();
/**
@ -1373,7 +1376,6 @@ function check_time_availability($surveyData)
$endDate = new DateTime($surveyData['end_date'], $utcZone);
$currentDate = new DateTime('now', $utcZone);
$currentDate->modify('today');
if ($currentDate < $startDate) {
api_not_allowed(
true,

@ -2173,11 +2173,8 @@ class SurveyUtil
* @param int $reminder
* @param bool $sendmail
* @param int $remindUnAnswered
* @return int
* @internal param
* @internal param
* @internal param
* The text has to contain a **link** string or this will automatically be added to the end
* @return bool $isAdditionalEmail
*
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
* @author Julio Montoya - Adding auto-generated link support
* @version January 2007
@ -2188,7 +2185,8 @@ class SurveyUtil
$invitation_text,
$reminder = 0,
$sendmail = false,
$remindUnAnswered = 0
$remindUnAnswered = 0,
$isAdditionalEmail = false
) {
if (!is_array($users_array)) {
// Should not happen
@ -2211,36 +2209,37 @@ class SurveyUtil
$counter = 0; // Nr of invitations "sent" (if sendmail option)
$course_id = api_get_course_int_id();
$session_id = api_get_session_id();
$result = CourseManager::separateUsersGroups($users_array);
$groupList = $result['groups'];
$users_array = $result['users'];
foreach ($groupList as $groupId) {
$userGroupList = GroupManager::getStudents($groupId);
$userGroupIdList = array_column($userGroupList, 'user_id');
$users_array = array_merge($users_array, $userGroupIdList);
$params = [
'c_id' => $course_id,
'session_id' => $session_id,
'group_id' => $groupId,
'survey_code' => $survey_data['code']
];
$invitationExists = self::invitationExists(
$course_id,
$session_id,
$groupId,
$survey_data['code']
);
if (empty($invitationExists)) {
self::save_invitation($params);
if ($isAdditionalEmail == false) {
$result = CourseManager::separateUsersGroups($users_array);
$groupList = $result['groups'];
$users_array = $result['users'];
foreach ($groupList as $groupId) {
$userGroupList = GroupManager::getStudents($groupId);
$userGroupIdList = array_column($userGroupList, 'user_id');
$users_array = array_merge($users_array, $userGroupIdList);
$params = [
'c_id' => $course_id,
'session_id' => $session_id,
'group_id' => $groupId,
'survey_code' => $survey_data['code']
];
$invitationExists = self::invitationExists(
$course_id,
$session_id,
$groupId,
$survey_data['code']
);
if (empty($invitationExists)) {
self::save_invitation($params);
}
}
}
$users_array = array_unique($users_array);
foreach ($users_array as $key => $value) {
if (!isset($value) || $value == '') {
continue;
@ -2369,12 +2368,14 @@ class SurveyUtil
) {
$_user = api_get_user_info();
$_course = api_get_course_info();
$sessionId = api_get_session_id();
// Replacing the **link** part with a valid link for the user
$survey_link = api_get_path(WEB_CODE_PATH).'survey/fillsurvey.php?course='.$_course['code'].'&invitationcode='
.$invitation_code;
$text_link = '<a href="'.$survey_link.'">'.get_lang('ClickHereToAnswerTheSurvey')."</a><br />\r\n<br />\r\n"
.get_lang('OrCopyPasteTheFollowingUrl')." <br />\r\n ".$survey_link;
$link = api_get_path(WEB_CODE_PATH).'survey/fillsurvey.php?';
$link .= 'id_session='.$sessionId.'&course='.$_course['code'].'&invitationcode='.$invitation_code;
$text_link = '<a href="'.$link.'">'.get_lang('ClickHereToAnswerTheSurvey')."</a><br />\r\n<br />\r\n"
.get_lang('OrCopyPasteTheFollowingUrl')." <br />\r\n ".$link;
$replace_count = 0;
$full_invitation_text = api_str_ireplace('**link**', $text_link, $invitation_text, $replace_count);
@ -2799,7 +2800,7 @@ class SurveyUtil
$hideReportingButton = api_get_configuration_value('hide_survey_reporting_button');
$reportingLink = Display::url(
Display::return_icon('stats.png', get_lang('Reporting'), [], ICON_SIZE_SMALL),
Display::return_icon('statistics.png', get_lang('Reporting'), [], ICON_SIZE_SMALL),
api_get_path(WEB_CODE_PATH).'survey/reporting.php?'.api_get_cidreq().'&survey_id='.$survey_id
);
@ -3249,7 +3250,8 @@ class SurveyUtil
ICON_SIZE_TINY
);
echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/fillsurvey.php?course='.$_course['sysCode']
.'&invitationcode='.$row['invitation_code'].'&cidReq='.$_course['sysCode'].'">'.$row['title']
.'&invitationcode='.$row['invitation_code'].'&cidReq='.$_course['sysCode'].'&id_session='.$row['session_id'].'">
'.$row['title']
.'</a></td>';
} else {
$isDrhOfCourse = CourseManager::isUserSubscribedInCourseAsDrh(
@ -3287,7 +3289,6 @@ class SurveyUtil
);
echo '<td class="text-center">'.($efvMandatory['value'] ? get_lang('Yes') : get_lang('No')).'</td>';
}
echo '</tr>';
}
echo '</tbody>';

@ -163,7 +163,7 @@ if (api_is_multiple_url_enabled()) {
}
// Show the URL that can be used by users to fill a survey without invitation
$auto_survey_link = $portal_url.'main/survey/fillsurvey.php?course='.$_course['sysCode'].'&invitationcode=auto&scode='.$survey_data['survey_code'];
$auto_survey_link = $portal_url.'main/survey/fillsurvey.php?course='.$_course['sysCode'].'&invitationcode=auto&scode='.$survey_data['survey_code'].'&id_session='.$survey_data['session_id'];
$form->addElement('label', null, get_lang('AutoInviteLink'));
$form->addElement('label', null, $auto_survey_link);
@ -174,6 +174,7 @@ if ($form->validate()) {
$resendAll = isset($values['resend_to_all']) ? $values['resend_to_all'] : '';
$sendMail = isset($values['send_mail']) ? $values['send_mail'] : '';
$remindUnAnswered = isset($values['remindUnAnswered']) ? $values['remindUnAnswered'] : '';
$users = isset($values['users']) ? $values['users'] : [];
if ($sendMail) {
if (empty($values['mail_title']) || empty($values['mail_text'])) {
@ -194,6 +195,7 @@ if ($form->validate()) {
return;
}
}
// Save the invitation mail
SurveyUtil::save_invite_mail(
$values['mail_text'],
@ -203,7 +205,7 @@ if ($form->validate()) {
// Saving the invitations for the course users
$count_course_users = SurveyUtil::saveInvitations(
$values['users'],
$users,
$values['mail_title'],
$values['mail_text'],
$resendAll,
@ -225,7 +227,8 @@ if ($form->validate()) {
$values['mail_text'],
$resendAll,
$sendMail,
$remindUnAnswered
$remindUnAnswered,
true
);
// Updating the invited field in the survey table

@ -6,13 +6,15 @@
<div class="col-sm-8 col-md-7 col-lg-8">
<div id="chat-tabs">
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="active">
<a href="#all" aria-controls="all" role="tab" data-toggle="tab">{{ 'All'|get_lang }}</a>
</li>
{% if not restrict_to_coach %}
<li role="presentation" class="active">
<a href="#all" aria-controls="all" role="tab" data-toggle="tab">{{ 'All'|get_lang }}</a>
</li>
{% endif %}
</ul>
<div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="all">
<div class="course-chat chat-history" id="chat-history"></div>
<div role="tabpanel" class="tab-pane active" id="{{ restrict_to_coach ? '' : 'all' }}">
<div class="course-chat chat-history" id="{{ restrict_to_coach ? '' : 'chat-history' }}"></div>
</div>
</div>
</div>
@ -41,7 +43,8 @@
<textarea id="chat-writer" name="message"></textarea>
</div>
<div class="col-sm-3">
<button id="chat-send-message" type="button" class="btn btn-primary">{{ 'Send'|get_lang }}</button>
<button id="chat-send-message" type="button" disabled
class="btn btn-primary">{{ 'Send'|get_lang }}</button>
</div>
</div>
</div>
@ -62,256 +65,262 @@
<source src="{{ _p.web_main }}chat/sound/notification.mp3" type="audio/mpeg"></source>
</audio>
<script>
$(document).on('ready', function () {
var ChChat = {
_ajaxUrl: '{{ _p.web_ajax }}course_chat.ajax.php?{{ _p.web_cid_query }}',
_historySize: -1,
usersOnline: 0,
currentFriend: 0,
call: false,
track: function () {
return $.get(ChChat._ajaxUrl, {
action: 'track',
size: ChChat._historySize,
users_online: ChChat.usersOnline,
friend: ChChat.currentFriend
})
.done(function (response) {
if (response.data.history) {
ChChat._historySize = response.data.oldFileSize;
ChChat.setHistory(response.data.history);
}
if (response.data.userList) {
ChChat.usersOnline = response.data.usersOnline;
ChChat.setConnectedUsers(response.data.userList);
}
});
},
setHistory: function (messageList) {
var chatHistoryContainer = ChChat.currentFriend ? ('#chat-history-' + ChChat.currentFriend) : '#chat-history';
$(chatHistoryContainer)
.html(messageList)
.prop('scrollTop', function () {
return this.scrollHeight;
});
$('#chat-alert').get(0).play();
},
setConnectedUsers: function (userList) {
var html = '';
userList.forEach(function (user) {
var buttonStatus = user.isConnected ? 'success' : 'muted',
buttonTitle = user.isConnected ? '{{ 'StartAChat'|get_lang }}' : '{{ 'LeaveAMessage'|get_lang }}';
html += '<li class="col-xs-12 chat-user">' +
$(document).on('ready', function () {
var ChChat = {
_ajaxUrl: '{{ _p.web_ajax }}course_chat.ajax.php?{{ _p.web_cid_query }}',
_historySize: -1,
usersOnline: 0,
currentFriend: 0,
call: false,
track: function () {
return $
.get(ChChat._ajaxUrl, {
action: 'track',
size: ChChat._historySize,
users_online: ChChat.usersOnline,
friend: ChChat.currentFriend
})
.done(function (response) {
if (response.data.history) {
ChChat._historySize = response.data.oldFileSize;
ChChat.setHistory(response.data.history);
}
if (response.data.userList) {
ChChat.usersOnline = response.data.usersOnline;
ChChat.setConnectedUsers(response.data.userList);
}
});
},
setHistory: function (messageList) {
var chatHistoryContainer = ChChat.currentFriend ? ('#chat-history-' + ChChat.currentFriend) : '#chat-history';
$(chatHistoryContainer)
.html(messageList)
.prop('scrollTop', function () {
return this.scrollHeight;
});
$('#chat-alert').get(0).play();
},
setConnectedUsers: function (userList) {
var html = '';
userList.forEach(function (user) {
var buttonStatus = user.isConnected ? 'success' : 'muted',
buttonTitle = user.isConnected ? '{{ 'StartAChat'|get_lang }}' : '{{ 'LeaveAMessage'|get_lang }}';
html += '<li class="col-xs-12 chat-user">' +
' <div>' +
' <img src="'+ user.image_url + '" alt="' + user.complete_name + '" class="img-circle user-image-chat"/>' +
' <img src="' + user.image_url + '" alt="' + user.complete_name + '" class="img-circle user-image-chat"/>' +
' <ul class="list-unstyled">' +
' <li>' + user.complete_name;
if (user.id != {{ _u.user_id }}) {
html += ' <button type="button" class="btn btn-link btn-xs" title="' + buttonTitle + '" data-name="' + user.complete_name + '" data-user="' + user.id + '">' +
if (user.id != {{ _u.user_id }}) {
html += ' <button type="button" class="btn btn-link btn-xs" title="' + buttonTitle + '" data-name="' + user.complete_name + '" data-user="' + user.id + '">' +
' <i class="fa fa-comments text-' + buttonStatus + '"></i><span class="sr-only">' + buttonTitle + '</span>' +
' </button>';
}
html += ' </li>' +
}
html += ' </li>' +
' <li><small>' + user.username + '</small></li>' +
' </ul>' +
' </div>' +
'</li>';
});
});
$('#chat-users').html(html);
},
onPreviewListener: function () {
$
.post(ChChat._ajaxUrl, {
action: 'preview',
'message': $('textarea#chat-writer').val()
})
.done(function (response) {
if (!response.status) {
return;
}
$('#html-preview').html(response.data.message);
});
},
onSendMessageListener: function (e) {
e.preventDefault();
$('#chat-users').html(html);
},
onPreviewListener: function () {
$.post(ChChat._ajaxUrl, {
action: 'preview',
'message': $('textarea#chat-writer').val()
})
.done(function (response) {
if (!response.status) {
if (!$('textarea#chat-writer').val().trim().length) {
return;
}
$('#html-preview').html(response.data.message);
});
},
onSendMessageListener: function (e) {
e.preventDefault();
if (!$('textarea#chat-writer').val().trim().length) {
return;
var self = this;
self.disabled = true;
$
.post(ChChat._ajaxUrl, {
action: 'write',
message: $('textarea#chat-writer').val(),
friend: ChChat.currentFriend
})
.done(function (response) {
self.disabled = false;
if (!response.status) {
return;
}
$('textarea#chat-writer').val('');
$(".emoji-wysiwyg-editor").html('');
});
},
onResetListener: function (e) {
if (!confirm("{{ 'ConfirmReset'|get_lang }}")) {
e.preventDefault();
return;
}
$
.get(ChChat._ajaxUrl, {
action: 'reset',
friend: ChChat.currentFriend
})
.done(function (response) {
if (!response.status) {
return;
}
ChChat.setHistory(response.data);
});
},
init: function () {
ChChat.track().done(function () {
ChChat.init();
});
}
};
var self = this;
self.disabled = true;
hljs.initHighlightingOnLoad();
$.post(ChChat._ajaxUrl, {
action: 'write',
message: $('textarea#chat-writer').val(),
friend: ChChat.currentFriend
})
.done(function (response) {
self.disabled = false;
emojione.ascii = true;
emojione.imagePathPNG = '{{ _p.web_lib }}javascript/emojione/png/';
emojione.imagePathSVG = '{{ _p.web_lib }}javascript/emojione/svg/';
emojione.imagePathSVGSprites = '{{ _p.web_lib }}javascript/emojione/sprites/';
if (!response.status) {
return;
}
var emojiStrategy = {{ emoji_strategy|json_encode }};
$('textarea#chat-writer').val('');
$(".emoji-wysiwyg-editor").html('');
});
},
onResetListener: function (e) {
if (!confirm("{{ 'ConfirmReset'|get_lang }}")) {
e.preventDefault();
return;
}
$.get(ChChat._ajaxUrl, {
action: 'reset',
friend: ChChat.currentFriend
})
.done(function (response) {
if (!response.status) {
return;
}
$.emojiarea.path = '{{ _p.web_lib }}javascript/emojione/png/';
$.emojiarea.icons = {{ icons|json_encode }};
ChChat.setHistory(response.data);
});
},
init: function () {
ChChat.track().done(function () {
ChChat.init();
});
}
};
$('body').on('click', '#chat-reset', ChChat.onResetListener);
$('#preview').on('click', ChChat.onPreviewListener);
$('#emojis').on('click', function () {
$('[data-toggle="tab"][href="#tab1"]').show().tab('show');
});
hljs.initHighlightingOnLoad();
$('textarea#chat-writer').emojiarea({
button: '#emojis'
});
emojione.ascii = true;
emojione.imagePathPNG = '{{ _p.web_lib }}javascript/emojione/png/';
emojione.imagePathSVG = '{{ _p.web_lib }}javascript/emojione/svg/';
emojione.imagePathSVGSprites = '{{ _p.web_lib }}javascript/emojione/sprites/';
$('body').delay(1500).find('.emoji-wysiwyg-editor').textcomplete([{
match: /\B:([\-+\w]*)$/,
search: function (term, callback) {
var results = [];
var results2 = [];
var results3 = [];
$.each(emojiStrategy, function (shortname, data) {
if (shortname.indexOf(term) > -1) {
results.push(shortname);
} else {
if ((data.aliases !== null) && (data.aliases.indexOf(term) > -1)) {
results2.push(shortname);
} else if ((data.keywords !== null) && (data.keywords.indexOf(term) > -1)) {
results3.push(shortname);
}
}
});
var emojiStrategy = {{ emoji_strategy|json_encode }};
if (term.length >= 3) {
results.sort(function (a, b) {
return (a.length > b.length);
});
results2.sort(function (a, b) {
return (a.length > b.length);
});
results3.sort();
}
$.emojiarea.path = '{{ _p.web_lib }}javascript/emojione/png/';
$.emojiarea.icons = {{ icons|json_encode }};
var newResults = results.concat(results2).concat(results3);
callback(newResults);
},
template: function (shortname) {
return '<img class="emojione" src="{{ _p.web_lib }}javascript/emojione/png/'
+ emojiStrategy[shortname].unicode
+ '.png"> :' + shortname + ':';
},
replace: function (shortname) {
return ':' + shortname + ': ';
},
index: 1,
maxCount: 10
}], {});
$('button#chat-send-message').on('click', ChChat.onSendMessageListener);
$('#chat-users').on('click', 'button.btn', function (e) {
e.preventDefault();
var jSelf = $(this),
userId = parseInt(jSelf.data('user')) || 0;
$('body').on('click', '#chat-reset', ChChat.onResetListener);
$('#preview').on('click', ChChat.onPreviewListener);
$('#emojis').on('click', function () {
$('[data-toggle="tab"][href="#tab1"]').show().tab('show');
});
if (!userId) {
return;
}
$('textarea#chat-writer').emojiarea({
button: '#emojis'
});
var exists = false;
$('body').delay(1500).find('.emoji-wysiwyg-editor').textcomplete([{
match: /\B:([\-+\w]*)$/,
search: function (term, callback) {
var results = [];
var results2 = [];
var results3 = [];
$.each(emojiStrategy, function (shortname, data) {
if (shortname.indexOf(term) > -1) {
results.push(shortname);
} else {
if ((data.aliases !== null) && (data.aliases.indexOf(term) > -1)) {
results2.push(shortname);
} else if ((data.keywords !== null) && (data.keywords.indexOf(term) > -1)) {
results3.push(shortname);
}
$('#chat-tabs ul.nav li').each(function (i, el) {
if ($(el).data('user') == userId) {
exists = true;
}
});
if (term.length >= 3) {
results.sort(function (a, b) {
return (a.length > b.length);
});
results2.sort(function (a, b) {
return (a.length > b.length);
});
results3.sort();
}
$('button#chat-send-message').prop('disabled', false);
var newResults = results.concat(results2).concat(results3);
callback(newResults);
},
template: function (shortname) {
return '<img class="emojione" src="{{ _p.web_lib }}javascript/emojione/png/'
+ emojiStrategy[shortname].unicode
+ '.png"> :' + shortname + ':';
},
replace: function (shortname) {
return ':' + shortname + ': ';
},
index: 1,
maxCount: 10
}], {});
$('button#chat-send-message').on('click', ChChat.onSendMessageListener);
$('#chat-users').on('click', 'button.btn', function (e) {
e.preventDefault();
var jSelf = $(this),
userId = parseInt(jSelf.data('user')) || 0;
if (!userId) {
return;
}
var exists = false;
$('#chat-tabs ul.nav li').each(function (i, el) {
if ($(el).data('user') == userId) {
exists = true;
}
});
if (exists) {
$('#chat-tab-' + userId).tab('show');
if (exists) {
$('#chat-tab-' + userId).tab('show');
return;
}
return;
}
$('#chat-tabs ul.nav-tabs').append('\
<li role="presentation" data-user="' + userId + '">\
<a id="chat-tab-' + userId + '" href="#chat-' + userId + '" aria-controls="chat-' + userId + '" role="tab" data-toggle="tab">' + jSelf.data('name') + '</a>\
</li>\
');
$('#chat-tabs ul.nav-tabs').append('\
<li role="presentation" data-user="' + userId + '">\
<a id="chat-tab-' + userId + '" href="#chat-' + userId + '" aria-controls="chat-' + userId + '" role="tab" data-toggle="tab">' + jSelf.data('name') + '</a>\
</li>\
');
$('#chat-tabs .tab-content').append('\
<div role="tabpanel" class="tab-pane" id="chat-' + userId + '">\
<div class="course-chat chat-history" id="chat-history-' + userId + '"></div>\
</div>\
');
$('#chat-tabs .tab-content').append('\
<div role="tabpanel" class="tab-pane" id="chat-' + userId + '">\
<div class="course-chat chat-history" id="chat-history-' + userId + '"></div>\
</div>\
');
$('#chat-tab-' + userId).tab('show');
});
$('#chat-tab-' + userId).tab('show');
});
$('#chat-tabs ul.nav-tabs').on('shown.bs.tab', 'li a', function (e) {
var jSelf = $(this);
var userId = parseInt(jSelf.parent().data('user')) || 0;
if (!userId) {
ChChat.currentFriend = 0;
$('#chat-tabs ul.nav-tabs').on('shown.bs.tab', 'li a', function (e) {
var jSelf = $(this);
var userId = parseInt(jSelf.parent().data('user')) || 0;
if (!userId) {
ChChat.currentFriend = 0;
return;
}
return;
}
ChChat.currentFriend = userId;
ChChat.currentFriend = userId;
$(this).tab('show');
});
$(this).tab('show');
});
$('.emoji-wysiwyg-editor').on('keyup', function (e) {
if (e.ctrlKey && e.keyCode === 13) {
$('button#chat-send-message').trigger('click');
}
});
$('.emoji-wysiwyg-editor').on('keyup', function (e) {
if (e.ctrlKey && e.keyCode === 13) {
$('button#chat-send-message').trigger('click');
}
ChChat.init();
});
ChChat.init();
});
</script>

@ -94,12 +94,7 @@
</div>
{# right zone #}
{% if show_left_column == 1 %}
<div id="learning_path_right_zone" class="content-scorm">
{% else %}
<div id="" class="content-scorm">
{% endif %}
<div id="learning_path_right_zone" class="{{ show_left_column == 1 ? 'content-scorm' : 'no-right-col' }}">
<div class="lp-view-zone-container">
<div class="lp-view-tabs">
<div id="navTabsbar" class="nav-tabs-bar">
@ -120,7 +115,7 @@
</div>
<div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="lp-view-content">
<div id="wrapper-iframe" style="width:100%; height:100%">
<div id="wrapper-iframe">
{% if lp_mode == 'fullscreen' %}
<iframe id="content_id_blank" name="content_name_blank" src="blank.php" style="width:100%; height:100%" border="0" frameborder="0" allowfullscreen="true" webkitallowfullscreen="true" mozallowfullscreen="true"></iframe>
{% else %}

@ -239,7 +239,7 @@
{% if _u.logged and not is_subscribed %}
{{ subscribe_button }}
{% elseif not _u.logged %}
{% if 'allow_registration'|api_get_setting == 'true' %}
{% if 'allow_registration'|api_get_setting != 'false' %}
<a href="{{ _p.web_main ~ 'auth/inscription.php' ~ redirect_to_session }}" class="btn btn-info btn-lg">
<i class="fa fa-pencil" aria-hidden="true"></i> {{ 'SignUp'|get_lang }}
</a>

@ -283,15 +283,26 @@ if (!empty($projectId)) {
}
$options = '';
$iconProject = Display::return_icon(
'project.png',
get_lang('Projects'),
null,
ICON_SIZE_MEDIUM
) ;
if ($isAdmin) {
$options .= Display::url(
get_lang('Projects'),
$iconProject,
api_get_path(WEB_CODE_PATH).'ticket/projects.php'
);
}
$options .= Display::url(
$iconTicket = Display::return_icon(
'tickets.png',
$ticketLabel,
null,
ICON_SIZE_MEDIUM
) ;
$options .= Display::url(
$iconTicket,
$url
);

@ -135,15 +135,17 @@ $(function() {
sgrid.triggerToolbar();
});
</script>
<?php if (api_is_platform_admin()) {
?>
<div class="actions">
<?php
echo '<a href="'.api_get_path(WEB_CODE_PATH).'session/session_add.php">'.Display::return_icon('new_session.png', get_lang('AddSession'), '', ICON_SIZE_MEDIUM).'</a>';
echo '<a href="'.api_get_path(WEB_CODE_PATH).'session/add_many_session_to_category.php">'.Display::return_icon('session_to_category.png', get_lang('AddSessionsInCategories'), '', ICON_SIZE_MEDIUM).'</a>';
echo '<a href="'.api_get_path(WEB_CODE_PATH).'session/session_category_list.php">'.Display::return_icon('folder.png', get_lang('ListSessionCategory'), '', ICON_SIZE_MEDIUM).'</a>';
echo '</div>';
}
<?php
if (api_is_platform_admin()) {
echo '<div class="actions">';
echo '<a href="'.api_get_path(WEB_CODE_PATH).'session/session_add.php">'.
Display::return_icon('new_session.png', get_lang('AddSession'), '', ICON_SIZE_MEDIUM).'</a>';
echo '<a href="'.api_get_path(WEB_CODE_PATH).'session/add_many_session_to_category.php">'.
Display::return_icon('session_to_category.png', get_lang('AddSessionsInCategories'), '', ICON_SIZE_MEDIUM).'</a>';
echo '<a href="'.api_get_path(WEB_CODE_PATH).'session/session_category_list.php">'.
Display::return_icon('folder.png', get_lang('ListSessionCategory'), '', ICON_SIZE_MEDIUM).'</a>';
echo '</div>';
}
echo Display::grid_html('sessions');
Display::display_footer();

@ -329,10 +329,12 @@ function WSCreateUsers($params)
$userManager->updateUser($user, true);
$results[] = $user_id;
continue;
//return $r_check_user[0];
} else {
// user id already exits.
$results[] = 0;
continue;
//return 0;
// user id already exits.
}
}
@ -1229,21 +1231,21 @@ $server->wsdl->addComplexType(
'all',
'',
[
'firstname' => ['name' => 'firstname', 'type' => 'xsd:string'],
'lastname' => ['name' => 'lastname', 'type' => 'xsd:string'],
'status' => ['name' => 'status', 'type' => 'xsd:string'],
'email' => ['name' => 'email', 'type' => 'xsd:string'],
'loginname' => ['name' => 'loginname', 'type' => 'xsd:string'],
'password' => ['name' => 'password', 'type' => 'xsd:string'], //encripted password using the encrypt_method
'encrypt_method' => ['name' => 'encrypt_method', 'type' => 'xsd:string'],
'language' => ['name' => 'language', 'type' => 'xsd:string'],
'phone' => ['name' => 'phone', 'type' => 'xsd:string'],
'expiration_date' => ['name' => 'expiration_date', 'type' => 'xsd:string'],
'official_code' => ['name' => 'official_code', 'type' => 'xsd:string'],
'original_user_id_name' => ['name' => 'original_user_id_name', 'type' => 'xsd:string'],
'original_user_id_value' => ['name' => 'original_user_id_value', 'type' => 'xsd:string'],
'extra' => ['name' => 'extra', 'type' => 'tns:extrasList'],
'secret_key' => ['name' => 'secret_key', 'type' => 'xsd:string']
'firstname' => ['name' => 'firstname', 'type' => 'xsd:string'],
'lastname' => ['name' => 'lastname', 'type' => 'xsd:string'],
'status' => ['name' => 'status', 'type' => 'xsd:string'],
'email' => ['name' => 'email', 'type' => 'xsd:string'],
'loginname' => ['name' => 'loginname', 'type' => 'xsd:string'],
'password' => ['name' => 'password', 'type' => 'xsd:string'], //encripted password using the encrypt_method
'encrypt_method' => ['name' => 'encrypt_method', 'type' => 'xsd:string'],
'language' => ['name' => 'language', 'type' => 'xsd:string'],
'phone' => ['name' => 'phone', 'type' => 'xsd:string'],
'expiration_date' => ['name' => 'expiration_date', 'type' => 'xsd:string'],
'official_code' => ['name' => 'official_code', 'type' => 'xsd:string'],
'original_user_id_name' => ['name' => 'original_user_id_name', 'type' => 'xsd:string'],
'original_user_id_value' => ['name' => 'original_user_id_value', 'type' => 'xsd:string'],
'extra' => ['name' => 'extra', 'type' => 'tns:extrasList'],
'secret_key' => ['name' => 'secret_key', 'type' => 'xsd:string'],
]
);
@ -1266,11 +1268,8 @@ function WSCreateUserPasswordCrypted($params)
$debug = 1;
if ($debug) {
error_log('WSCreateUserPasswordCrypted');
}
if ($debug) {
error_log(print_r($params, 1));
}
if (!WSHelperVerifyKey($params)) {
return returnError(WS_ERROR_SECRET_KEY);
}
@ -1405,7 +1404,9 @@ function WSCreateUserPasswordCrypted($params)
}
} else {
if ($debug) {
error_log("User not found with original_id = $original_user_id_value and original_name = $original_user_id_name");
error_log(
"User not found with original_id = $original_user_id_value and original_name = $original_user_id_name"
);
}
}
@ -1452,6 +1453,9 @@ function WSCreateUserPasswordCrypted($params)
Database::query($sql);
$return = Database::insert_id();
if ($return) {
if ($debug) {
error_log("New user created. user_id = $return");
}
$sql = "UPDATE $table_user SET user_id = id WHERE id = $return";
Database::query($sql);
@ -1478,8 +1482,8 @@ function WSCreateUserPasswordCrypted($params)
// Create extra fields
if (is_array($extra_list) && count($extra_list) > 0) {
foreach ($extra_list as $extra) {
$extra_field_name = $extra['field_name'];
$extra_field_value = $extra['field_value'];
$extra_field_name = $extra['field_name'];
$extra_field_value = $extra['field_value'];
// save new fieldlabel into user_field table
UserManager::create_extra_field(
$extra_field_name,
@ -1502,7 +1506,9 @@ function WSCreateUserPasswordCrypted($params)
return 0;
}
if ($debug) {
error_log("Return value: $return");
}
return $return;
}
@ -2709,6 +2715,12 @@ $server->wsdl->addComplexType(
function WSHelperActionOnUsers($params, $type)
{
$debug = 1;
if ($debug) {
error_log("WSHelperActionOnUsers");
error_log(print_r($params, 1));
}
if (!WSHelperVerifyKey($params)) {
return returnError(WS_ERROR_SECRET_KEY);
}
@ -2724,18 +2736,24 @@ function WSHelperActionOnUsers($params, $type)
$original_user_id['original_user_id_name']
);
if ($user_id > 0) {
if ($type == "delete") {
if ($debug) {
error_log("User found: $user_id");
}
if ($type == 'delete') {
$result = UserManager::delete_user($user_id);
} elseif ($type == "disable") {
$result = UserManager::disable($user_id);
} elseif ($type == "enable") {
$result = UserManager::enable($user_id);
}
} else {
if ($debug) {
error_log("User id not found: $user_id");
}
}
$results[] = $result ? 1 : 0;
}
$count_results = count($results);
$output = [];
for ($i = 0; $i < $count_results; $i++) {
@ -2761,7 +2779,7 @@ $server->register(
function WSDeleteUsers($params)
{
return WSHelperActionOnUsers($params, "delete");
return WSHelperActionOnUsers($params, 'delete');
}
/** WSDisableUsers **/
@ -4609,7 +4627,7 @@ function WSSubscribeUserToCourse($params)
$original_course_id['original_course_id_name']
);
$courseCode = $courseInfo['code'];
$courseCode = isset($courseInfo['code']) ? $courseInfo['code'] : '';
if (empty($courseCode)) {
// Course was not found

Loading…
Cancel
Save