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

pull/3291/head
Angel Fernando Quiroz Campos 5 years ago
commit 1c9fcde8ae
  1. 115
      main/admin/user_update_import.php
  2. 4
      main/coursecopy/create_backup.php
  3. 16
      main/document/create_document.php
  4. 1
      main/exercise/matching.class.php
  5. 13
      main/exercise/unique_answer.class.php
  6. 15
      main/gradebook/gradebook_display_certificate.php
  7. 3
      main/gradebook/lib/be/category.class.php
  8. 1
      main/lang/english/trad4all.inc.php
  9. 1
      main/lang/french/trad4all.inc.php
  10. 1
      main/lang/spanish/trad4all.inc.php
  11. 22
      main/lp/learnpath.class.php
  12. 3
      main/lp/lp_edit_item_prereq.php
  13. 80
      main/lp/lp_report.php
  14. 1
      main/lp/lp_subscribe_users.php
  15. 19
      main/mySpace/student.php
  16. 1
      main/survey/survey.lib.php
  17. 25
      main/survey/surveyUtil.class.php
  18. 2
      main/survey/survey_invite.php
  19. 4
      main/user/user.php
  20. 50
      main/work/work.lib.php
  21. 2
      src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Basic.php
  22. 27
      src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/TestMatching.php
  23. 13
      src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/TestProposedAnswer.php
  24. 19
      src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/TestQuestionDescription.php
  25. 34
      src/Chamilo/CourseBundle/Component/CourseCopy/CourseBuilder.php

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
/**
@ -8,13 +9,10 @@
use Ddeboer\DataImport\Reader\CsvReader;
use Symfony\Component\DomCrawler\Crawler;
/**
* Validate the imported data.
*/
$cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';
// Set this option to true to enforce strict purification for usenames.
// Set this option to true to enforce strict purification for usernames.
$purification_option_for_usernames = false;
/**
@ -27,7 +25,6 @@ function validate_data($users)
global $defined_auth_sources;
$errors = [];
$usernames = [];
$classExistList = [];
$usergroup = new UserGroup();
@ -108,7 +105,6 @@ function updateUsers($users, $resetPassword = false)
}
$user_id = $userInfo['user_id'];
$firstName = isset($user['FirstName']) ? $user['FirstName'] : $userInfo['firstname'];
$lastName = isset($user['LastName']) ? $user['LastName'] : $userInfo['lastname'];
$userName = isset($user['NewUserName']) ? $user['NewUserName'] : $userInfo['username'];
@ -141,6 +137,7 @@ function updateUsers($users, $resetPassword = false)
$hrDeptId = $userInfo['hr_dept_id'];
$language = isset($user['Language']) ? $user['Language'] : $userInfo['language'];
$sendEmail = isset($user['SendEmail']) ? $user['SendEmail'] : $userInfo['language'];
$userUpdated = UserManager::update_user(
$user_id,
$firstName,
@ -260,7 +257,6 @@ $this_section = SECTION_PLATFORM_ADMIN;
api_protect_admin_script(true, null);
$defined_auth_sources[] = PLATFORM_AUTH_SOURCE;
if (isset($extAuthSource) && is_array($extAuthSource)) {
$defined_auth_sources = array_merge($defined_auth_sources, array_keys($extAuthSource));
}
@ -276,76 +272,77 @@ $form->addElement('header', $tool_name);
$form->addFile('import_file', get_lang('ImportFileLocation'), ['accept' => 'text/csv', 'id' => 'import_file']);
$form->addCheckBox('reset_password', '', get_lang('AutoGeneratePassword'));
if ($form->validate() && Security::check_token('post')) {
Security::clear_token();
$formValues = $form->exportValues();
if ($form->validate()) {
if (Security::check_token('post')) {
Security::clear_token();
$formValues = $form->exportValues();
if (empty($_FILES['import_file']) || empty($_FILES['import_file']['size'])) {
header('Location: '.api_get_self());
exit;
}
if (empty($_FILES['import_file']) || empty($_FILES['import_file']['size'])) {
header('Location: '.api_get_self());
exit;
}
$uploadInfo = pathinfo($_FILES['import_file']['name']);
$uploadInfo = pathinfo($_FILES['import_file']['name']);
if ($uploadInfo['extension'] !== 'csv') {
Display::addFlash(
Display::return_message(get_lang('YouMustImportAFileAccordingToSelectedOption'), 'error')
);
if ($uploadInfo['extension'] !== 'csv') {
Display::addFlash(
Display::return_message(get_lang('YouMustImportAFileAccordingToSelectedOption'), 'error')
);
header('Location: '.api_get_self());
exit;
}
header('Location: '.api_get_self());
exit;
}
try {
$users = parse_csv_data($_FILES['import_file']['tmp_name']);
} catch (Exception $exception) {
Display::addFlash(
Display::return_message($exception->getMessage(), 'error')
);
try {
$users = parse_csv_data($_FILES['import_file']['tmp_name']);
} catch (Exception $exception) {
Display::addFlash(
Display::return_message($exception->getMessage(), 'error')
);
header('Location: '.api_get_self());
exit;
}
header('Location: '.api_get_self());
exit;
}
$errors = validate_data($users);
$errorUsers = array_keys($errors);
$usersToUpdate = [];
$errors = validate_data($users);
$errorUsers = array_keys($errors);
$usersToUpdate = [];
foreach ($users as $user) {
if (!in_array($user['UserName'], $errorUsers)) {
$usersToUpdate[] = $user;
foreach ($users as $user) {
if (!in_array($user['UserName'], $errorUsers)) {
$usersToUpdate[] = $user;
}
}
}
updateUsers($usersToUpdate, isset($formValues['reset_password']));
updateUsers($usersToUpdate, isset($formValues['reset_password']));
if (empty($errors)) {
Display::addFlash(
Display::return_message(get_lang('FileImported'), 'success')
);
} else {
$warningMessage = '';
if (empty($errors)) {
Display::addFlash(
Display::return_message(get_lang('FileImported'), 'success')
);
} else {
$warningMessage = '';
foreach ($errors as $errorUsername => $errorUserMessages) {
$warningMessage .= "<strong>$errorUsername</strong>";
$warningMessage .= '<ul><li>'.implode('</li><li>', $errorUserMessages).'</li></ul>';
}
foreach ($errors as $errorUsername => $errorUserMessages) {
$warningMessage .= "<strong>$errorUsername</strong>";
$warningMessage .= '<ul><li>'.implode('</li><li>', $errorUserMessages).'</li></ul>';
Display::addFlash(
Display::return_message(get_lang('FileImportedJustUsersThatAreNotRegistered'), 'warning')
);
Display::addFlash(Display::return_message($warningMessage, 'warning', false));
}
Display::addFlash(
Display::return_message(get_lang('FileImportedJustUsersThatAreNotRegistered'), 'warning')
);
Display::addFlash(
Display::return_message($warningMessage, 'warning', false)
);
header('Location: '.api_get_self());
exit;
} else {
Display::addFlash(Display::return_message(get_lang('LinkExpired'), 'warning', false));
header('Location: '.api_get_self());
exit;
}
header('Location: '.api_get_self());
exit;
}
Display::display_header($tool_name);
$token = Security::get_token();
$form->addHidden('sec_token', $token);

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
use Chamilo\CourseBundle\Component\CourseCopy\CourseArchiver;
@ -9,8 +10,6 @@ use Chamilo\CourseBundle\Component\CourseCopy\CourseSelectForm;
* Create a backup.
*
* @author Bart Mollet <bart.mollet@hogent.be>
*
* @package chamilo.backup
*/
require_once __DIR__.'/../inc/global.inc.php';
$current_course_tool = TOOL_COURSE_MAINTENANCE;
@ -48,7 +47,6 @@ if (Security::check_token('post') &&
) {
// Clear token
Security::clear_token();
if ($action === 'course_select_form') {
$cb = new CourseBuilder('partial');
$course = $cb->build(0, null, false, array_keys($_POST['resource']), $_POST['resource']);

@ -1,12 +1,11 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
/**
* This file allows creating new html documents with an online WYSIWYG html editor.
*
* @package chamilo.document
*/
require_once __DIR__.'/../inc/global.inc.php';
@ -199,8 +198,12 @@ if (!is_dir($filepath)) {
if (!$is_certificate_mode) {
if (api_is_in_group()) {
$interbreadcrumb[] = [
"url" => "../group/group_space.php?".api_get_cidreq(),
"name" => get_lang('GroupSpace'),
'url' => api_get_path(WEB_CODE_PATH).'group/group.php?'.api_get_cidreq(),
'name' => get_lang('Groups'),
];
$interbreadcrumb[] = [
'url' => api_get_path(WEB_CODE_PATH).'group/group_space.php?'.api_get_cidreq(),
'name' => get_lang('GroupSpace').' '.$group_properties['name'],
];
$path = explode('/', $dir);
if ('/'.$path[1] != $group_properties['directory']) {
@ -631,15 +634,14 @@ if ($form->validate()) {
}
Display :: display_header($nameTools, "Doc");
// actions
// link back to the documents overview
if ($is_certificate_mode) {
$actionsLeft = '<a href="document.php?certificate=true&id='.$folder_id.'&selectcat='.Security::remove_XSS($_GET['selectcat']).'">'.
$actionsLeft = '<a href="document.php?'.api_get_cidreq().'&certificate=true&id='.$folder_id.'&selectcat='.Security::remove_XSS($_GET['selectcat']).'">'.
Display::return_icon('back.png', get_lang('Back').' '.get_lang('To').' '.get_lang('CertificateOverview'), '', ICON_SIZE_MEDIUM).'</a>';
$actionsLeft .= '<a id="hide_bar_template" href="#" role="button">'.
Display::return_icon('expand.png', get_lang('Back'), ['id' => 'expand'], ICON_SIZE_MEDIUM).Display::return_icon('contract.png', get_lang('Back'), ['id' => 'contract', 'class' => 'hide'], ICON_SIZE_MEDIUM).'</a>';
} else {
$actionsLeft = '<a href="document.php?curdirpath='.Security::remove_XSS($dir).'">'.
$actionsLeft = '<a href="document.php?'.api_get_cidreq().'&curdirpath='.Security::remove_XSS($dir).'">'.
Display::return_icon('back.png', get_lang('Back').' '.get_lang('To').' '.get_lang('DocumentsOverview'), '', ICON_SIZE_MEDIUM).'</a>';
$actionsLeft .= '<a id="hide_bar_template" href="#" role="button">'.
Display::return_icon('expand.png', get_lang('Expand'), ['id' => 'expand'], ICON_SIZE_MEDIUM).

@ -148,7 +148,6 @@ class Matching extends Question
$form->addHtml('<tr>');
$form->addHtml("<td>$i</td>");
//$form->addText("answer[$i]", null);
$form->addHtmlEditor(
"answer[$i]",
null,

@ -82,6 +82,7 @@ class UniqueAnswer extends Question
$form->addHtml($html);
$defaults = [];
$correct = 0;
if (!empty($this->id)) {
$answer = new Answer($this->id);
@ -164,7 +165,6 @@ class UniqueAnswer extends Question
$defaults['weighting[1]'] = 10;
$defaults['answer[2]'] = get_lang('DefaultUniqueAnswer2');
$defaults['weighting[2]'] = 0;
$temp_scenario['destination'.$i] = ['0'];
$temp_scenario['lp'.$i] = ['0'];
}
@ -260,6 +260,10 @@ class UniqueAnswer extends Question
$correct = 1;
}
if (isset($_POST) && isset($_POST['correct'])) {
$correct = (int) $_POST['correct'];
}
$defaults['correct'] = $correct;
if (!empty($this->id)) {
@ -269,7 +273,12 @@ class UniqueAnswer extends Question
// Default sample content.
$form->setDefaults($defaults);
} else {
$form->setDefaults(['correct' => 1]);
$correct = 1;
if (isset($_POST) && isset($_POST['correct'])) {
$correct = (int) $_POST['correct'];
}
$form->setDefaults(['correct' => $correct]);
}
}
$form->setConstants(['nb_answers' => $nb_answers]);

@ -1,11 +1,7 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Script.
*
* @package chamilo.gradebook
*/
require_once __DIR__.'/../inc/global.inc.php';
$current_course_tool = TOOL_GRADEBOOK;
@ -58,7 +54,7 @@ if ($filter === 'true') {
if ($form->validate()) {
$officialCode = $form->getSubmitValue('filter');
if ($officialCode == 'all') {
if ($officialCode === 'all') {
$certificate_list = GradebookUtils::get_list_users_certificates($categoryId);
} else {
$userList = UserManager::getUsersByOfficialCode($officialCode);
@ -77,10 +73,8 @@ if ($filter === 'true') {
}
$content = '';
$courseCode = api_get_course_id();
$allowExportToZip = api_get_plugin_setting('customcertificate', 'enable_plugin_customcertificate') == 'true' &&
$allowExportToZip = api_get_plugin_setting('customcertificate', 'enable_plugin_customcertificate') === 'true' &&
api_get_course_setting('customcertificate_course_enable', $courseInfo) == 1;
$tags = Certificate::notificationTags();
@ -189,7 +183,7 @@ $interbreadcrumb[] = ['url' => '#', 'name' => get_lang('GradebookListOfStudentsC
$this_section = SECTION_COURSES;
Display::display_header('');
if (isset($_GET['action']) && $_GET['action'] == 'delete') {
if ($action === 'delete') {
$check = Security::check_token('get');
if ($check) {
$certificate = new Certificate($_GET['certificate_id']);
@ -293,7 +287,6 @@ if (count($certificate_list) > 0 && $hideCertificateExport !== 'true') {
}
echo Display::toolbarAction('actions', [$actions]);
echo $filterForm;
if (count($certificate_list) == 0) {

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Entity\GradebookCategory;
@ -2275,7 +2276,7 @@ class Category implements GradebookItem
$params['right'] = 0;
$params['top'] = 0;
$params['bottom'] = 0;
$page_format = $params['orientation'] == 'landscape' ? 'A4-L' : 'A4';
$page_format = $params['orientation'] === 'landscape' ? 'A4-L' : 'A4';
$pdf = new PDF($page_format, $params['orientation'], $params);
$certificate_list = GradebookUtils::get_list_users_certificates($catId, $userList);

@ -8532,4 +8532,5 @@ $SurveyQuestionMultipleChoiceWithOtherComment = "Offer some pre-defined options,
$Multiplechoiceother = "Multiple choice with 'other' option";
$SurveyOtherAnswerSpecify = "Other...";
$SurveyOtherAnswer = "Please specify:";
$UserXPostedADocumentInCourseX = "User %s has posted a document in the Assignments tool in the course %s";
?>

@ -8464,4 +8464,5 @@ $SurveyQuestionMultipleChoiceWithOtherComment = "Offrez des options pré-défini
$Multiplechoiceother = "Question à réponse unique avec option 'Autre'";
$SurveyOtherAnswerSpecify = "Autre...";
$SurveyOtherAnswer = "Merci de spécifier :";
$UserXPostedADocumentInCourseX = "%s a publié un document dans l'outil travaux dans le cours %s";
?>

@ -8560,4 +8560,5 @@ $SurveyQuestionMultipleChoiceWithOtherComment = "Ofrezca unas opciones pre-defin
$Multiplechoiceother = "Elección múltiple con opción 'Otro'";
$SurveyOtherAnswerSpecify = "Otro/a...";
$SurveyOtherAnswer = "Por favor especifique:";
$UserXPostedADocumentInCourseX = "El usuario %s ha enviado un documento en la herramienta Tareas en el curso %s";
?>

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Entity\Repository\CourseRepository;
@ -1549,14 +1550,13 @@ class learnpath
$maxScore = 100;
}
$tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM);
$sql = " UPDATE $tbl_lp_item
$table = Database::get_course_table(TABLE_LP_ITEM);
$sql = " UPDATE $table
SET
prerequisite = $prerequisite_id ,
prerequisite_min_score = $minScore ,
prerequisite_max_score = $maxScore
WHERE iid = $id";
Database::query($sql);
return true;
@ -9865,6 +9865,10 @@ class learnpath
$course_id = api_get_course_int_id();
$item_id = (int) $item_id;
if (empty($item_id)) {
return '';
}
$tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM);
/* Current prerequisite */
@ -9873,6 +9877,7 @@ class learnpath
$result = Database::query($sql);
$row = Database::fetch_array($result);
$prerequisiteId = $row['prerequisite'];
$return = '<legend>';
$return .= get_lang('AddEditPrerequisites');
$return .= '</legend>';
@ -9932,10 +9937,17 @@ class learnpath
$return .= '<td '.(($item['item_type'] != TOOL_QUIZ && $item['item_type'] != TOOL_HOTPOTATOES) ? ' colspan="3"' : '').'>';
$return .= '<div style="margin-left:'.($item['depth'] * 20).'px;" class="radio learnpath">';
$return .= '<label for="id'.$item['id'].'">';
$return .= '<input'.(in_array($prerequisiteId, [$item['id'], $item['ref']]) ? ' checked="checked" ' : '').($item['item_type'] == 'dir' ? ' disabled="disabled" ' : ' ').'id="id'.$item['id'].'" name="prerequisites" type="radio" value="'.$item['id'].'" />';
$icon_name = str_replace(' ', '', $item['item_type']);
$checked = '';
if (null !== $prerequisiteId) {
$checked = in_array($prerequisiteId, [$item['id'], $item['ref']]) ? ' checked="checked" ' : '';
}
$disabled = $item['item_type'] === 'dir' ? ' disabled="disabled" ' : '';
$return .= '<input '.$checked.' '.$disabled.' id="id'.$item['id'].'" name="prerequisites" type="radio" value="'.$item['id'].'" />';
$icon_name = str_replace(' ', '', $item['item_type']);
if (file_exists('../img/lp_'.$icon_name.'.png')) {
$return .= Display::return_icon('lp_'.$icon_name.'.png');
} else {

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
@ -10,8 +11,6 @@ use ChamiloSession as Session;
* @author Denes Nagy
* @author Roan Embrechts, refactoring and code cleaning
* @author Yannick Warnier <ywarnier@beeznest.org> - cleaning and update for new SCORM tool
*
* @package chamilo.learnpath
*/
$this_section = SECTION_COURSES;

@ -2,11 +2,16 @@
/* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Entity\Repository\ItemPropertyRepository;
use Chamilo\CourseBundle\Entity\CLpCategory;
/**
* Report from students for learning path.
*/
require_once __DIR__.'/../inc/global.inc.php';
api_protect_course_script(true);
$isAllowedToEdit = api_is_allowed_to_edit(null, true);
if (!$isAllowedToEdit) {
@ -15,34 +20,65 @@ if (!$isAllowedToEdit) {
$lpTable = Database::get_course_table(TABLE_LP_MAIN);
$lpId = isset($_GET['lp_id']) ? (int) $_GET['lp_id'] : false;
$export = isset($_GET['export']) ? true : false;
$lpId = isset($_GET['lp_id']) ? (int) $_GET['lp_id'] : 0;
$export = isset($_GET['export']);
if (empty($lpId)) {
$lp = new learnpath(api_get_course_id(), $lpId, api_get_user_id());
if (empty($lp)) {
api_not_allowed(true);
}
$em = Database::getManager();
$sessionId = api_get_session_id();
$courseId = api_get_course_int_id();
$courseCode = api_get_course_id();
if (empty($sessionId)) {
$status = STUDENT;
$users = CourseManager::get_user_list_from_course_code(
$courseCode,
0,
null,
null,
$status
// Check LP subscribers
if ('1' === $lp->getSubscribeUsers()) {
/** @var ItemPropertyRepository $itemRepo */
$itemRepo = $em->getRepository('ChamiloCourseBundle:CItemProperty');
$subscribedUsersInLp = $itemRepo->getUsersSubscribedToItem(
'learnpath',
$lpId,
api_get_course_entity($courseId),
api_get_session_entity($sessionId)
);
$users = [];
if (!empty($subscribedUsersInLp)) {
foreach ($subscribedUsersInLp as $itemProperty) {
$users[]['user_id'] = $itemProperty->getToUser()->getId();
}
}
} else {
$status = 0; // student
$users = CourseManager::get_user_list_from_course_code(
$courseCode,
$sessionId,
null,
null,
$status
);
$categoryId = $lp->getCategoryId();
if (!empty($categoryId)) {
/** @var CLpCategory $category */
$category = $em->getRepository('ChamiloCourseBundle:CLpCategory')->find($categoryId);
$subscribedUsersInCategory = $category->getUsers();
$users = [];
if (!empty($subscribedUsersInCategory)) {
foreach ($subscribedUsersInCategory as $item) {
$users[]['user_id'] = $item->getUser()->getId();
}
}
} else {
if (empty($sessionId)) {
$users = CourseManager::get_user_list_from_course_code(
$courseCode,
0,
null,
null,
STUDENT
);
} else {
$users = CourseManager::get_user_list_from_course_code(
$courseCode,
$sessionId,
null,
null,
0
);
}
}
}
$lpInfo = Database::select(
@ -100,7 +136,7 @@ if (!empty($users)) {
'id' => $user['user_id'],
'first_name' => $userInfo['firstname'],
'last_name' => $userInfo['lastname'],
'email' => $showEmail === 'true' ? $userInfo['email'] : '',
'email' => 'true' === $showEmail ? $userInfo['email'] : '',
'lp_time' => api_time_to_hms($lpTime),
'lp_score' => is_numeric($lpScore) ? "$lpScore%" : $lpScore,
'lp_progress' => "$lpProgress%",
@ -144,7 +180,7 @@ $template->assign('user_list', $userList);
$template->assign('session_id', api_get_session_id());
$template->assign('course_code', api_get_course_id());
$template->assign('lp_id', $lpId);
$template->assign('show_email', $showEmail === 'true');
$template->assign('show_email', 'true' === $showEmail);
$template->assign('export', (int) $export);
$layout = $template->get_template('learnpath/report.tpl');

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Entity\Repository\CourseRepository;

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
/**
@ -20,7 +21,7 @@ if (!$allowToTrack) {
$nameTools = get_lang('Students');
$export_csv = isset($_GET['export']) && $_GET['export'] == 'csv' ? true : false;
$export_csv = isset($_GET['export']) && 'csv' === $_GET['export'] ? true : false;
$keyword = isset($_GET['keyword']) ? Security::remove_XSS($_GET['keyword']) : null;
$active = isset($_GET['active']) ? (int) $_GET['active'] : 1;
$sleepingDays = isset($_GET['sleeping_days']) ? (int) $_GET['sleeping_days'] : null;
@ -29,19 +30,19 @@ $this_section = SECTION_TRACKING;
$webCodePath = api_get_path(WEB_CODE_PATH);
$interbreadcrumb[] = [
"url" => api_is_student_boss() ? "#" : "index.php",
"name" => get_lang('MySpace'),
'url' => api_is_student_boss() ? '#' : 'index.php',
'name' => get_lang('MySpace'),
];
if (isset($_GET["user_id"]) && $_GET["user_id"] != "" && !isset($_GET["type"])) {
if (isset($_GET['user_id']) && '' != $_GET['user_id'] && !isset($_GET['type'])) {
$interbreadcrumb[] = [
"url" => "teachers.php",
"name" => get_lang('Teachers'),
'url' => 'teachers.php',
'name' => get_lang('Teachers'),
];
}
if (isset($_GET["user_id"]) && $_GET["user_id"] != "" && isset($_GET["type"]) && $_GET["type"] == "coach") {
$interbreadcrumb[] = ["url" => "coaches.php", "name" => get_lang('Tutors')];
if (isset($_GET['user_id']) && '' != $_GET['user_id'] && isset($_GET['type']) && 'coach' === $_GET['type']) {
$interbreadcrumb[] = ['url' => 'coaches.php', 'name' => get_lang('Tutors')];
}
function get_count_users()
@ -168,7 +169,7 @@ function get_users($from, $limit, $column, $direction)
}
$urlDetails = $url."?student=$student_id";
if (isset($_GET['id_coach']) && intval($_GET['id_coach']) != 0) {
if (isset($_GET['id_coach']) && 0 != intval($_GET['id_coach'])) {
$urlDetails = $url."?student=$student_id&id_coach=$coach_id&id_session=$sessionId";
}

@ -2794,6 +2794,7 @@ class SurveyManager
);
SurveyUtil::saveInvitations(
$surveyId,
['users' => $tutor['user_id']],
$subject,
$content,

@ -2377,15 +2377,16 @@ class SurveyUtil
* and additional users in the database
* and sends the invitations by email.
*
* @param $users_array Users $array array can be both a list of course uids AND a list of additional emailaddresses
* @param $invitation_title Title $string of the invitation, used as the title of the mail
* @param $invitation_text Text $string of the invitation, used as the text of the mail.
* The text has to contain a **link** string or this will automatically be added to the end
* @param int $reminder
* @param bool $sendmail
* @param int $remindUnAnswered
* @param bool $isAdditionalEmail
* @param bool $hideLink
* @param int $surveyId
* @param array $users_array Users array can be both a list of course uids AND a list of additional email addresses
* @param string $invitation_title title of the mail
* @param string $invitation_text text of the mail has to contain a **link** string or
* this will automatically be added to the end
* @param int $reminder
* @param bool $sendmail
* @param int $remindUnAnswered
* @param bool $isAdditionalEmail
* @param bool $hideLink
*
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
* @author Julio Montoya - Adding auto-generated link support
@ -2393,6 +2394,7 @@ class SurveyUtil
* @version January 2007
*/
public static function saveInvitations(
$surveyId,
$users_array,
$invitation_title,
$invitation_text,
@ -2402,12 +2404,13 @@ class SurveyUtil
$isAdditionalEmail = false,
$hideLink = false
) {
$surveyId = (int) $surveyId;
if (!is_array($users_array)) {
return 0;
}
// Getting the survey information
$survey_data = SurveyManager::get_survey($_GET['survey_id']);
$survey_data = SurveyManager::get_survey($surveyId);
$survey_invitations = self::get_invitations($survey_data['survey_code']);
$already_invited = self::get_invited_users($survey_data['code']);
@ -2416,7 +2419,7 @@ class SurveyUtil
if (1 == $remindUnAnswered) {
// Remind only unanswered users
$reminder = 1;
$exclude_users = SurveyManager::get_people_who_filled_survey($_GET['survey_id']);
$exclude_users = SurveyManager::get_people_who_filled_survey($surveyId);
}
$counter = 0; // Nr of invitations "sent" (if sendmail option)

@ -208,6 +208,7 @@ if ($form->validate()) {
// Saving the invitations for the course users
$count_course_users = SurveyUtil::saveInvitations(
$survey_data['survey_id'],
$users,
$values['mail_title'],
$values['mail_text'],
@ -227,6 +228,7 @@ if ($form->validate()) {
}
$counter_additional_users = SurveyUtil::saveInvitations(
$survey_data['survey_id'],
$additional_users,
$values['mail_title'],
$values['mail_text'],

@ -914,9 +914,9 @@ function get_user_data($from, $number_of_items, $column, $direction)
);
if (!empty($optionList)) {
$options = implode(', ', array_column($optionList, 'display_text'));
$temp[] = $options;
$temp[] = Security::remove_XSS($options);
} else {
$temp[] = $data['value'];
$temp[] = Security::remove_XSS($data['value']);
}
} else {
$temp[] = '';

@ -3766,17 +3766,23 @@ function uploadWork($my_folder_data, $_course, $isCorrection = false, $workInfo
}
/**
* Send an e-mail to users related to this work (course teachers, usually, but
* might include other group members).
* Send an e-mail to users related to this work.
*
* @param array $workInfo
* @param int $workId
* @param array $courseInfo
* @param int $sessionId
*/
function sendAlertToUsers($workId, $courseInfo, $sessionId)
function sendAlertToUsers($workInfo, $workId, $courseInfo, $sessionId = 0)
{
$sessionId = (int) $sessionId;
if (empty($workInfo) || empty($courseInfo) || empty($workId)) {
return false;
}
$courseCode = $courseInfo['code'];
$workData = get_work_data_by_id($workId, $courseInfo['real_id'], $sessionId);
// last value is to check this is not "just" an edit
// YW Tis part serve to send a e-mail to the tutors when a new file is sent
@ -3788,7 +3794,7 @@ function sendAlertToUsers($workId, $courseInfo, $sessionId)
if (empty($sessionId)) {
// Teachers
$userList = CourseManager::get_user_list_from_course_code(
api_get_course_id(),
$courseCode,
null,
null,
null,
@ -3797,7 +3803,7 @@ function sendAlertToUsers($workId, $courseInfo, $sessionId)
} else {
// Coaches
$userList = CourseManager::get_user_list_from_course_code(
api_get_course_id(),
$courseCode,
$sessionId,
null,
null,
@ -3815,17 +3821,29 @@ function sendAlertToUsers($workId, $courseInfo, $sessionId)
}
if ($send) {
$subject = "[".api_get_setting('siteName')."] ".get_lang('SendMailBody')."\n ".get_lang('CourseName').": ".$courseInfo['name']." ";
foreach ($userList as $user_data) {
$to_user_id = $user_data['user_id'];
$user_info = api_get_user_info($to_user_id);
$message = get_lang('SendMailBody')."\n".get_lang('CourseName')." : ".$courseInfo['name']."\n";
$message .= get_lang('UserName')." : ".$user_info['complete_name']."\n";
$message .= get_lang('DateSent')." : ".api_format_date(api_get_local_time())."\n";
$url = api_get_path(WEB_CODE_PATH)."work/work.php?cidReq=".$courseInfo['code']."&id_session=".$sessionId."&id=".$workData['id'];
$message .= get_lang('WorkName')." : ".$workData['title']."\n\n".'<a href="'.$url.'">'.get_lang('DownloadLink')."</a>\n";
foreach ($userList as $userData) {
$userId = $userData['user_id'];
$userInfo = api_get_user_info($userId);
if (empty($userInfo)) {
continue;
}
$userPostedADocument = sprintf(
get_lang('UserXPostedADocumentInCourseX'),
$userInfo['complete_name'],
$courseInfo['name']
);
$subject = "[".api_get_setting('siteName')."] ".$userPostedADocument;
$message = $userPostedADocument."<br />";
$message .= get_lang('DateSent')." : ".api_format_date(api_get_local_time())."<br />";
$message .= get_lang('AssignmentName')." : ".$workInfo['title']."<br />";
$message .= get_lang('Filename')." : ".$workData['title']."<br />";
$url = api_get_path(WEB_CODE_PATH)."work/view.php?cidReq=".$courseInfo['code']."&id_session=".$sessionId."&id=".$workData['id'];
$message .= '<a href="'.$url.'">'.get_lang('DownloadLink')."</a><br />";
MessageManager::send_message_simple(
$to_user_id,
$userId,
$subject,
$message,
0,
@ -4011,7 +4029,7 @@ function processWorkForm(
$userId,
$groupInfo
);
sendAlertToUsers($workId, $courseInfo, $sessionId);
sendAlertToUsers($workInfo, $workId, $courseInfo, $sessionId);
Event::event_upload($workId);
// The following feature requires the creation of a work-type

@ -224,7 +224,7 @@ class Basic extends Toolbar
*/
public function getNewPageBlock()
{
return ['NewPage', 'Templates', '-', 'PasteFromWord', 'inserthtml'];
return ['NewPage', 'Templates', '-', 'PasteFromWord', 'inserthtml'];
}
/**

@ -1,12 +1,11 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar;
/**
* TestFreeAnswer toolbar configuration.
*
* @package Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar
*/
class TestMatching extends Basic
{
@ -17,7 +16,7 @@ class TestMatching extends Basic
*/
public function getConfig()
{
if (api_get_setting('more_buttons_maximized_mode') != 'true') {
if (api_get_setting('more_buttons_maximized_mode') !== 'true') {
$config['toolbar'] = $this->getNormalToolbar();
} else {
$config['toolbar_minToolbar'] = $this->getMinimizedToolbar();
@ -25,7 +24,7 @@ class TestMatching extends Basic
}
$config['fullPage'] = false;
$config['extraPlugins'] = 'wordcount';
$config['extraPlugins'] = $this->getPluginsToString();
$config['wordcount'] = [
// Whether or not you want to show the Word Count
'showWordCount' => true,
@ -37,8 +36,6 @@ class TestMatching extends Basic
'wordLimit' => 'unlimited',
];
//$config['height'] = '200';
return $config;
}
@ -73,7 +70,7 @@ class TestMatching extends Basic
['BulletedList', 'NumberedList', 'HorizontalRule', '-', 'Outdent', 'Indent', 'Blockquote'],
['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
['Bold', 'Italic', 'Underline', 'Strike', '-', 'Subscript', 'Superscript', '-', 'TextColor', 'BGColor'],
[api_get_setting('allow_spellcheck') == 'true' ? 'Scayt' : ''],
[api_get_setting('allow_spellcheck') === 'true' ? 'Scayt' : ''],
['Styles', 'Format', 'Font', 'FontSize'],
['PageBreak', 'ShowBlocks'],
['Toolbarswitch'],
@ -92,6 +89,7 @@ class TestMatching extends Basic
'Maximize',
'Bold',
'Image',
'Video',
'Link',
'PasteFromWord',
'Audio',
@ -111,9 +109,20 @@ class TestMatching extends Basic
protected function getMinimizedToolbar()
{
return [
$this->getNewPageBlock(),
['PasteFromWord'],
['Undo', 'Redo'],
['Link', 'Image', 'Video', 'Flash', 'Audio', 'Table', 'Asciimath'],
[
'Link',
'Image',
'Video',
'Flash',
'Oembed',
'Youtube',
'VimeoEmbed',
'Audio',
'Table',
'Asciimath',
],
['BulletedList', 'NumberedList', 'HorizontalRule'],
['JustifyLeft', 'JustifyCenter', 'JustifyRight'],
['Format', 'Font', 'FontSize', 'Bold', 'Italic', 'Underline', 'TextColor', 'BGColor'],

@ -1,12 +1,11 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar;
/**
* TestProposedAnswer toolbar configuration.
*
* @package Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar
*/
class TestProposedAnswer extends Basic
{
@ -19,11 +18,10 @@ class TestProposedAnswer extends Basic
{
$config['toolbarCanCollapse'] = true;
$config['toolbarStartupExpanded'] = false;
if (api_get_setting('more_buttons_maximized_mode') != 'true') {
if (api_get_setting('more_buttons_maximized_mode') !== 'true') {
$config['toolbar'] = $this->getNormalToolbar();
} else {
$config['toolbar_minToolbar'] = $this->getMinimizedToolbar();
$config['toolbar_maxToolbar'] = $this->getMaximizedToolbar();
}
@ -50,8 +48,13 @@ class TestProposedAnswer extends Basic
return [
['Bold', 'Subscript', 'Superscript'],
[
'Image',
'Link',
'Image',
'Video',
//'Flash',
'Oembed',
//'Youtube',
'VimeoEmbed',
'Audio',
'Table',
'PasteFromWord',

@ -1,12 +1,11 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar;
/**
* TestQuestionDescription toolbar configuration.
*
* @package Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar
*/
class TestQuestionDescription extends Basic
{
@ -21,7 +20,6 @@ class TestQuestionDescription extends Basic
['name' => 'document', 'groups' => ['document', 'doctools']],
['name' => 'clipboard', 'groups' => ['clipboard', 'undo']],
['name' => 'editing', 'groups' => ['clipboard', 'undo']],
//array('name' => 'forms', 'groups' =>array('clipboard', 'undo', )),
'/',
['name' => 'basicstyles', 'groups' => ['basicstyles', 'cleanup']],
['name' => 'paragraph', 'groups' => ['list', 'indent', 'blocks', 'align']],
@ -152,7 +150,20 @@ class TestQuestionDescription extends Basic
return [
$this->getNewPageBlock(),
['Undo', 'Redo'],
['Link', 'Unlink', 'Image', 'Video', 'Flash', 'Audio', 'Table', 'Asciimath', 'Asciisvg'],
[
'Link',
'Unlink',
'Image',
'Video',
'Flash',
'Oembed',
'Youtube',
'VimeoEmbed',
'Audio',
'Table',
'Asciimath',
'Asciisvg',
],
['BulletedList', 'NumberedList', 'HorizontalRule'],
['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
[

@ -335,10 +335,12 @@ class CourseBuilder
$table_doc = Database::get_course_table(TABLE_DOCUMENT);
$table_prop = Database::get_course_table(TABLE_ITEM_PROPERTY);
// Remove chat_files and shared_folder files
$avoid_paths = " path NOT LIKE '/shared_folder%' AND
path NOT LIKE '/chat_files%' ";
// Remove chat_files, shared_folder, exercises files
$avoid_paths = "
path NOT LIKE '/shared_folder%' AND
path NOT LIKE '/chat_files%' AND
path NOT LIKE '/../exercises/%'
";
$documentCondition = '';
if (!empty($idList)) {
$idList = array_unique($idList);
@ -366,7 +368,7 @@ class CourseBuilder
if (!empty($this->course->type) && $this->course->type == 'partial') {
$sql = "SELECT d.iid, d.path, d.comment, d.title, d.filetype, d.size
FROM $table_doc d
FROM $table_doc d
INNER JOIN $table_prop p
ON (p.ref = d.id AND d.c_id = p.c_id)
WHERE
@ -381,7 +383,7 @@ class CourseBuilder
ORDER BY path";
} else {
$sql = "SELECT d.iid, d.path, d.comment, d.title, d.filetype, d.size
FROM $table_doc d
FROM $table_doc d
INNER JOIN $table_prop p
ON (p.ref = d.id AND d.c_id = p.c_id)
WHERE
@ -409,7 +411,7 @@ class CourseBuilder
} else {
if (!empty($this->course->type) && $this->course->type == 'partial') {
$sql = "SELECT d.iid, d.path, d.comment, d.title, d.filetype, d.size
FROM $table_doc d
FROM $table_doc d
INNER JOIN $table_prop p
ON (p.ref = d.id AND d.c_id = p.c_id)
WHERE
@ -424,7 +426,7 @@ class CourseBuilder
ORDER BY path";
} else {
$sql = "SELECT d.iid, d.path, d.comment, d.title, d.filetype, d.size
FROM $table_doc d
FROM $table_doc d
INNER JOIN $table_prop p
ON (p.ref = d.id AND d.c_id = p.c_id)
WHERE
@ -769,18 +771,18 @@ class CourseBuilder
// Select only quizzes with active = 0 or 1 (not -1 which is for deleted quizzes)
$sql = "SELECT * FROM $table_qui
WHERE
c_id = $courseId AND
WHERE
c_id = $courseId AND
$idCondition
active >=0
active >=0
$sessionCondition ";
} else {
// Select only quizzes with active = 0 or 1 (not -1 which is for deleted quizzes)
$sql = "SELECT * FROM $table_qui
WHERE
c_id = $courseId AND
WHERE
c_id = $courseId AND
$idCondition
active >=0 AND
active >=0 AND
(session_id = 0 OR session_id IS NULL)";
}
@ -1849,8 +1851,8 @@ class CourseBuilder
$sql = "SELECT * FROM $table_work
WHERE
c_id = $courseId
$sessionCondition AND
c_id = $courseId
$sessionCondition AND
filetype = 'folder' AND
parent_id = 0 AND
active = 1

Loading…
Cancel
Save