Minor - update from 1.11.x

pull/3016/head
Julio Montoya 6 years ago
parent 6f8cb04b71
commit 5e4dd33398
  1. 19
      main/admin/career_diagram.php
  2. 14
      main/admin/careers.php
  3. 2
      main/admin/configure_plugin.php
  4. 15
      main/admin/special_exports.php
  5. 33
      main/admin/user_information.php
  6. 24
      main/admin/user_update_import.php
  7. 1
      main/admin/usergroup_users.php
  8. 9
      main/announcements/announcements.php
  9. 9
      main/auth/courses.php
  10. 47
      main/auth/courses_controller.php
  11. 1
      main/auth/inscription.php
  12. 39
      main/auth/my_progress.php
  13. 1
      main/badge/assign.php
  14. 1
      main/badge/issued_all.php
  15. 2
      main/course_description/course_description_controller.php
  16. 124
      main/cron/import_csv.php
  17. 2
      main/document/document.php
  18. 44
      main/exercise/exercise_report.php
  19. 14
      main/glossary/glossary_ajax_request.php
  20. 31
      main/gradebook/lib/GradebookUtils.php
  21. 8
      main/gradebook/lib/fe/catform.class.php
  22. 4
      main/gradebook/lib/fe/gradebooktable.class.php
  23. 46
      main/inc/ajax/model.ajax.php
  24. 37
      main/inc/ajax/survey.ajax.php
  25. 74
      main/inc/lib/CoursesAndSessionsCatalog.class.php
  26. 28
      main/inc/lib/api.lib.php
  27. 151
      main/inc/lib/career.lib.php
  28. 30
      main/inc/lib/course.lib.php
  29. 5
      main/inc/lib/course_home.lib.php
  30. 2
      main/inc/lib/database.constants.inc.php
  31. 2
      main/inc/lib/events.lib.php
  32. 7
      main/inc/lib/exercise_show_functions.lib.php
  33. 6
      main/inc/lib/extra_field.lib.php
  34. 6
      main/inc/lib/extra_field_value.lib.php
  35. 8
      main/inc/lib/glossary.lib.php
  36. 27
      main/inc/lib/javascript/ckeditor/plugins/oembed/plugin.js
  37. 112
      main/inc/lib/javascript/ckeditor/plugins/video/dialogs/video.js
  38. 24
      main/inc/lib/javascript/ckeditor/plugins/video/plugin.js
  39. 83
      main/inc/lib/sessionmanager.lib.php
  40. 4
      main/inc/lib/skill.lib.php
  41. 67
      main/inc/lib/statistics.lib.php
  42. 163
      main/inc/lib/tracking.lib.php
  43. 143
      main/inc/lib/usermanager.lib.php
  44. 4
      main/inc/lib/userportal.lib.php
  45. 29
      main/lp/learnpath.class.php
  46. 5
      main/lp/lp_add_audio.php
  47. 11
      main/lp/lp_add_item.php
  48. 20
      main/lp/lp_subscribe_users.php
  49. 8
      main/lp/lp_view.php
  50. 3
      main/mySpace/myStudents.php
  51. 9
      main/survey/ch_multiplechoice.php
  52. 2
      main/survey/ch_personality.php
  53. 2
      main/survey/ch_score.php
  54. 6
      main/survey/create_new_survey.php
  55. 14
      main/survey/edit_meeting.php
  56. 31
      main/survey/fillsurvey.php
  57. 2
      main/survey/generate_link.php
  58. 4
      main/survey/meeting.php
  59. 9
      main/survey/preview.php
  60. 14
      main/survey/question.php
  61. 2
      main/survey/reporting.php
  62. 4
      main/survey/survey.lib.php
  63. 15
      main/survey/survey.php
  64. 21
      main/survey/surveyUtil.class.php
  65. 7
      main/survey/survey_invitation.php
  66. 12
      main/survey/survey_invite.php
  67. 8
      main/survey/survey_list.php
  68. 83
      main/survey/survey_question.php
  69. 1
      main/tracking/courseLog.php
  70. 4
      main/user/class.php
  71. 56
      src/CoreBundle/Component/Editor/CkEditor/CkEditor.php
  72. 2
      src/CourseBundle/Component/CourseCopy/CourseBuilder.php
  73. 30
      src/CourseBundle/Component/CourseCopy/CourseRestorer.php
  74. 1
      src/SkillBundle/Entity/Level.php
  75. 2
      src/SkillBundle/Entity/SkillRelCourse.php
  76. 2
      src/SkillBundle/Entity/SkillRelItem.php

@ -1,8 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
use Fhaculty\Graph\Graph;
/**
* @package chamilo.admin
*/
@ -57,8 +55,6 @@ $interbreadcrumb[] = [
];
$action = isset($_GET['action']) ? $_GET['action'] : '';
$check = Security::check_token('request');
$token = Security::get_token();
if ($action == 'add') {
$interbreadcrumb[] = ['url' => 'careers.php', 'name' => get_lang('Careers')];
@ -72,13 +68,6 @@ if ($action == 'add') {
}
$extraFieldValue = new ExtraFieldValue('career');
$item = $extraFieldValue->get_values_by_handler_and_field_variable(
$careerId,
'career_diagram',
false,
false,
false
);
// Check urls
$itemUrls = $extraFieldValue->get_values_by_handler_and_field_variable(
@ -107,10 +96,10 @@ if (!empty($itemUrls) && !empty($itemUrls['value'])) {
$tpl = new Template(get_lang('Diagram'));
$html = Display::page_subheader2($careerInfo['name'].$urlToString);
if (!empty($item) && isset($item['value']) && !empty($item['value'])) {
/** @var Graph $graph */
$graph = UnserializeApi::unserialize('career', $item['value']);
$html .= Career::renderDiagramByColumn($graph, $tpl);
$diagram = Career::renderDiagramByColumn($careerInfo, $tpl);
if (!empty($diagram)) {
$html .= $diagram;
} else {
Display::addFlash(
Display::return_message(

@ -75,7 +75,6 @@ $column_model = [
];
//Autowidth
$extra_params['autowidth'] = 'true';
//height auto
$extra_params['height'] = 'auto';
$diagramLink = '';
@ -144,8 +143,13 @@ switch ($action) {
break;
case 'edit':
api_protect_admin_script();
$id = isset($_GET['id']) ? (int) $_GET['id'] : null;
$careerInfo = $career->get($id);
if (empty($careerInfo)) {
api_not_allowed(true);
}
// Action handling: Editing
$url = api_get_self().'?action='.Security::remove_XSS($_GET['action']).'&id='.intval($_GET['id']);
$url = api_get_self().'?action=edit&id='.$id;
$form = $career->return_form($url, 'edit');
// The validation or display
@ -155,6 +159,11 @@ switch ($action) {
$career->update_all_promotion_status_by_career_id($values['id'], $values['status']);
$old_status = $career->get_status($values['id']);
$res = $career->update($values);
$values['item_id'] = $values['id'];
$sessionFieldValue = new ExtraFieldValue('career');
$sessionFieldValue->saveFieldValues($values);
if ($res) {
Display::addFlash(
Display::return_message(get_lang('CareerUpdated'), 'confirmation')
@ -224,7 +233,6 @@ switch ($action) {
$content = $career->display();
break;
}
// The header.
Display::display_header($tool_name);

@ -15,7 +15,7 @@ api_protect_admin_script();
$pluginName = $_GET['name'];
$appPlugin = new AppPlugin();
$installedPlugins = $appPlugin->get_installed_plugins();
$installedPlugins = $appPlugin->getInstalledPlugins();
$pluginInfo = $appPlugin->getPluginInfo($pluginName, true);
if (!in_array($pluginName, $installedPlugins) || empty($pluginInfo)) {

@ -9,27 +9,21 @@ use Chamilo\CourseBundle\Component\CourseCopy\CourseSelectForm;
*
* @author Jhon Hinojosa
* @author Julio Montoya Fixing pclzip folder + some clean <gugli100@gmail.com>
*
* @package chamilo.include.export
*/
// including the global file
$cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';
api_protect_admin_script(true);
api_set_more_memory_and_time_limits();
$this_section = SECTION_PLATFORM_ADMIN;
$interbreadcrumb[] = ["url" => 'index.php', "name" => get_lang('PlatformAdmin')];
$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
// Access restrictions
api_protect_admin_script(true);
$nameTools = get_lang('SpecialExports');
$export = '';
$querypath = '';
api_set_more_memory_and_time_limits();
// Displaying the header
Display::display_header($nameTools);
// Display the tool title
echo Display::page_header($nameTools);
@ -146,7 +140,6 @@ if ($export && $name) {
}
}
/* FOOTER */
Display::display_footer();
function form_special_export()

@ -251,26 +251,26 @@ foreach ($data as $label => $item) {
* Show social activity.
*/
if (api_get_setting('allow_social_tool') === 'true') {
$userObject = api_get_user_entity($user['user_id']);
$userObject = api_get_user_entity($userId);
$data = [];
// Calculate values
if (api_get_setting('allow_message_tool') === 'true') {
$messagesSent = SocialManager::getCountMessagesSent($user['user_id']);
$messagesSent = SocialManager::getCountMessagesSent($userId);
$data[] = [get_lang('MessagesSent'), $messagesSent];
$messagesReceived = SocialManager::getCountMessagesReceived($user['user_id']);
$messagesReceived = SocialManager::getCountMessagesReceived($userId);
$data[] = [get_lang('MessagesReceived'), $messagesReceived];
}
$wallMessagesPosted = SocialManager::getCountWallPostedMessages($user['user_id']);
$wallMessagesPosted = SocialManager::getCountWallPostedMessages($userId);
$data[] = [get_lang('WallMessagesPosted'), $wallMessagesPosted];
$friends = SocialManager::getCountFriends($user['user_id']);
$friends = SocialManager::getCountFriends($userId);
$data[] = [get_lang('Friends'), $friends];
$countSent = SocialManager::getCountInvitationSent($user['user_id']);
$countSent = SocialManager::getCountInvitationSent($userId);
$data[] = [get_lang('InvitationSent'), $countSent];
$countReceived = SocialManager::get_message_number_invitation_by_user_id($user['user_id']);
$countReceived = SocialManager::get_message_number_invitation_by_user_id($userId);
$data[] = [get_lang('InvitationReceived'), $countReceived];
$userInfo['social'] = [
@ -600,7 +600,7 @@ if (isset($_GET['action'])) {
case 'export':
Export::arrayToCsv(
$csvContent,
'user_information_'.$user['user_id']
'user_information_'.$userId
);
exit;
break;
@ -700,9 +700,24 @@ echo $courseInformation;
echo $urlInformation;
echo Tracking::displayUserSkills(
$user['user_id'],
$userId,
0,
0
);
if (api_get_configuration_value('allow_career_users')) {
$careers = UserManager::getUserCareers($userId);
if (!empty($careers)) {
echo Display::page_subheader(get_lang('Careers'), null, 'h3', ['class' => 'section-title']);
$table = new HTML_Table(['class' => 'data_table']);
$table->setHeaderContents(0, 0, get_lang('Career'));
$row = 1;
foreach ($careers as $carerData) {
$table->setCellContents($row, 0, $carerData['name']);
$row++;
}
echo $table->toHtml();
}
}
Display::display_footer();

@ -144,7 +144,7 @@ function updateUsers($users)
$inserted_in_course = [];
}
$usergroup = new UserGroup();
$send_mail = $_POST['sendMail'] ? true : false;
$send_mail = !empty($_POST['sendMail']) ? true : false;
if (is_array($users)) {
foreach ($users as $user) {
$user = complete_missing_data($user);
@ -158,8 +158,15 @@ function updateUsers($users)
$firstName = isset($user['FirstName']) ? $user['FirstName'] : $userInfo['firstname'];
$lastName = isset($user['LastName']) ? $user['LastName'] : $userInfo['lastname'];
$userName = isset($user['NewUserName']) ? $user['NewUserName'] : $userInfo['username'];
$password = isset($user['Password']) ? $user['Password'] : $userInfo['password'];
$authSource = isset($user['AuthSource']) ? $user['AuthSource'] : $userInfo['auth_source'];
$changePassMethod = 0;
$password = isset($user['Password']) ? $user['Password'] : '';
if (!empty($password)) {
$changePassMethod = 2;
}
$authSource = isset($user['AuthSource']) ? $user['AuthSource'] : '';
if ($changePassMethod === 2 && !empty($authSource) && $authSource != $userInfo['auth_source']) {
$changePassMethod = 3;
}
$email = isset($user['Email']) ? $user['Email'] : $userInfo['email'];
$status = isset($user['Status']) ? $user['Status'] : $userInfo['status'];
$officialCode = isset($user['OfficialCode']) ? $user['OfficialCode'] : $userInfo['official_code'];
@ -191,12 +198,12 @@ function updateUsers($users)
$language,
'',
'',
''
$changePassMethod
);
if (!is_array($user['Courses']) && !empty($user['Courses'])) {
if (!empty($user['Courses']) && !is_array($user['Courses'])) {
$user['Courses'] = [$user['Courses']];
}
if (is_array($user['Courses'])) {
if (!empty($user['Courses']) && is_array($user['Courses'])) {
foreach ($user['Courses'] as $course) {
if (CourseManager::course_exists($course)) {
CourseManager::subscribeUser($user_id, $course, $user['Status']);
@ -347,6 +354,7 @@ if (isset($_POST['formSent']) && $_POST['formSent'] && $_FILES['import_file']['s
$see_message_import = get_lang('FileImported');
}
$warning_message = '';
if (count($errors) != 0) {
$warning_message = '<ul>';
foreach ($errors as $index => $error_user) {
@ -360,7 +368,9 @@ if (isset($_POST['formSent']) && $_POST['formSent'] && $_FILES['import_file']['s
}
// if the warning message is too long then we display the warning message trough a session
Display::addFlash(Display::return_message($warning_message, 'warning', false));
if (!empty($warning_message)) {
Display::addFlash(Display::return_message($warning_message, 'warning', false));
}
if ($error_kind_file) {
Display::addFlash(Display::return_message(get_lang('YouMustImportAFileAccordingToSelectedOption'), 'error', false));

@ -4,7 +4,6 @@
/**
* @package chamilo.admin
*/
require_once __DIR__.'/../inc/global.inc.php';
$this_section = SECTION_PLATFORM_ADMIN;

@ -431,7 +431,14 @@ switch ($action) {
} elseif (isset($_GET['remindallinactives']) && $_GET['remindallinactives'] === 'true') {
// we want to remind inactive users. The $_GET['since'] parameter
// determines which users have to be warned (i.e the users who have been inactive for x days or more
$since = isset($_GET['since']) ? (int) $_GET['since'] : 6;
$since = 6;
if (isset($_GET['since'])) {
if ($_GET['since'] === 'never') {
$since = 'never';
} else {
$since = (int) $_GET['since'];
}
}
// Getting the users who have to be reminded
$to = Tracking::getInactiveStudentsInCourse(

@ -49,7 +49,6 @@ $actions = [
'display_sessions',
'subscribe_to_session',
'search_tag',
'search_session',
'subscribe_course_validation',
'subscribe_course',
];
@ -274,7 +273,6 @@ switch ($action) {
header('Location: '.$url);
exit;
}
//else show error message?
break;
case 'search_tag':
if (!$user_can_view_page) {
@ -283,11 +281,4 @@ switch ($action) {
$courseController->sessionsListByCoursesTag($limit);
break;
case 'search_session':
if (!$user_can_view_page) {
api_not_allowed(true);
}
$courseController->sessionListBySearch($limit);
break;
}

@ -357,12 +357,13 @@ class CoursesController
$date = isset($_POST['date']) ? $_POST['date'] : date('Y-m-d');
$hiddenLinks = isset($_GET['hidden_links']) ? $_GET['hidden_links'] == 1 : false;
$limit = isset($limit) ? $limit : self::getLimitArray();
$countSessions = SessionManager::countSessionsByEndDate($date);
$countSessions = CoursesAndSessionsCatalog::browseSessions($date, [], false, true);
$sessions = CoursesAndSessionsCatalog::browseSessions($date, $limit);
$pageTotal = ceil($countSessions / $limit['length']);
// Do NOT show pagination if only one page or less
$cataloguePagination = $pageTotal > 1 ? CourseCategory::getCatalogPagination($limit['current'], $limit['length'], $pageTotal) : '';
$pagination = $pageTotal > 1 ? CourseCategory::getCatalogPagination($limit['current'], $limit['length'], $pageTotal) : '';
$sessionsBlocks = $this->getFormattedSessionsBlock($sessions);
// Get session search catalogue URL
@ -379,7 +380,7 @@ class CoursesController
$tpl->assign('show_sessions', CoursesAndSessionsCatalog::showSessions());
$tpl->assign('show_tutor', api_get_setting('show_session_coach') === 'true');
$tpl->assign('course_url', $courseUrl);
$tpl->assign('catalog_pagination', $cataloguePagination);
$tpl->assign('catalog_pagination', $pagination);
$tpl->assign('hidden_links', $hiddenLinks);
$tpl->assign('search_token', Security::get_token());
$tpl->assign('search_date', $date);
@ -414,44 +415,6 @@ class CoursesController
$sessions = CoursesAndSessionsCatalog::browseSessionsByTags($searchTag, $limit);
$sessionsBlocks = $this->getFormattedSessionsBlock($sessions);
$tpl = new Template();
$tpl->assign('show_courses', CoursesAndSessionsCatalog::showCourses());
$tpl->assign('show_sessions', CoursesAndSessionsCatalog::showSessions());
$tpl->assign('show_tutor', (api_get_setting('show_session_coach') === 'true' ? true : false));
$tpl->assign('course_url', $courseUrl);
$tpl->assign('already_subscribed_label', $this->getAlreadyRegisteredInSessionLabel());
$tpl->assign('hidden_links', $hiddenLinks);
$tpl->assign('search_token', Security::get_token());
$tpl->assign('search_date', Security::remove_XSS($searchDate));
$tpl->assign('search_tag', Security::remove_XSS($searchTag));
$tpl->assign('sessions', $sessionsBlocks);
$contentTemplate = $tpl->get_template('auth/session_catalog.tpl');
$tpl->display($contentTemplate);
}
/**
* Show the Session Catalogue with filtered session by a query term.
*
* @param array $limit
*/
public function sessionListBySearch(array $limit)
{
$q = isset($_REQUEST['q']) ? Security::remove_XSS($_REQUEST['q']) : null;
$hiddenLinks = isset($_GET['hidden_links']) ? (int) $_GET['hidden_links'] == 1 : false;
$courseUrl = CourseCategory::getCourseCategoryUrl(
1,
$limit['length'],
null,
0,
'subscribe'
);
$searchDate = isset($_POST['date']) ? $_POST['date'] : date('Y-m-d');
$sessions = CoursesAndSessionsCatalog::browseSessionsBySearch($q, $limit);
$sessionsBlocks = $this->getFormattedSessionsBlock($sessions);
$tpl = new Template();
$tpl->assign('show_courses', CoursesAndSessionsCatalog::showCourses());
$tpl->assign('show_sessions', CoursesAndSessionsCatalog::showSessions());
@ -461,7 +424,7 @@ class CoursesController
$tpl->assign('hidden_links', $hiddenLinks);
$tpl->assign('search_token', Security::get_token());
$tpl->assign('search_date', Security::remove_XSS($searchDate));
$tpl->assign('search_tag', Security::remove_XSS($q));
$tpl->assign('search_tag', Security::remove_XSS($searchTag));
$tpl->assign('sessions', $sessionsBlocks);
$contentTemplate = $tpl->get_template('auth/session_catalog.tpl');

@ -1136,7 +1136,6 @@ if ($form->validate()) {
$tpl->assign('inscription_content', $content);
$tpl->assign('form', $form->returnForm());
$tpl->assign('hide_header', $hideHeaders);
$page = Container::getPage('inscription');
$tpl->assign('page', $page);

@ -9,11 +9,15 @@
$cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';
api_block_anonymous_users();
if (api_get_configuration_value('block_my_progress_page')) {
api_not_allowed(true);
}
$this_section = SECTION_TRACKING;
$nameTools = get_lang('MyProgress');
api_block_anonymous_users();
$htmlHeadXtra[] = api_get_js('jquery.timelinr-0.9.54.js');
$htmlHeadXtra[] = "<script>
$(function() {
@ -31,10 +35,6 @@ if ($pluginCalendar) {
$plugin->setJavaScript($htmlHeadXtra);
}
if (api_get_configuration_value('block_my_progress_page')) {
api_not_allowed(true);
}
$user_id = api_get_user_id();
$courseUserList = CourseManager::get_courses_list_by_user_id($user_id);
$dates = $issues = '';
@ -79,8 +79,8 @@ if (!empty($courseUserList)) {
}
}
$content = Tracking::show_user_progress(api_get_user_id(), $sessionId);
$content .= Tracking::show_course_detail(api_get_user_id(), $courseCode, $sessionId);
$content = Tracking::show_user_progress($user_id, $sessionId);
$content .= Tracking::show_course_detail($user_id, $courseCode, $sessionId);
if (!empty($dates)) {
if (!empty($content)) {
@ -113,6 +113,29 @@ if (empty($content)) {
$message = Display::return_message(get_lang('NoDataAvailable'), 'warning');
}
$show = api_get_configuration_value('allow_career_users');
if ($show) {
$careers = UserManager::getUserCareers($user_id);
if (!empty($careers)) {
$title = Display::page_subheader(get_lang('Careers'), null, 'h3', ['class' => 'section-title']);
$table = new HTML_Table(['class' => 'data_table']);
$table->setHeaderContents(0, 0, get_lang('Career'));
$table->setHeaderContents(0, 1, get_lang('Diagram'));
$row = 1;
foreach ($careers as $careerData) {
$table->setCellContents($row, 0, $careerData['name']);
$url = api_get_path(WEB_CODE_PATH).'user/career_diagram.php?career_id='.$careerData['id'];
$diagram = Display::url(get_lang('Diagram'), $url);
$table->setCellContents($row, 1, $diagram);
$row++;
}
$content = $title.$table->toHtml().$content;
}
}
$tpl = new Template($nameTools);
$tpl->assign('message', $message);
$tpl->assign('content', $content);

@ -2,7 +2,6 @@
/* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Entity\Skill;
use Chamilo\UserBundle\Entity\User;
use Skill as SkillManager;
/**

@ -3,7 +3,6 @@
use Chamilo\CoreBundle\Entity\SkillRelUser;
use Chamilo\CoreBundle\Entity\SkillRelUserComment;
use Chamilo\UserBundle\Entity\User;
use SkillRelUser as SkillRelUserManager;
/**

@ -73,7 +73,7 @@ class CourseDescriptionController
}
// Add an escape version for the JS code of delete confirmation
if ($description) {
$data['descriptions'][$id]['title_js'] = addslashes($description['title']);
$data['descriptions'][$id]['title_js'] = addslashes(strip_tags($description['title']));
}
}
$actions = null;

@ -156,6 +156,10 @@ class ImportCsv
$method = 'importCareersDiagram';
}
if ($method == 'importCareersresults') {
$method = 'importCareersResults';
}
if ($method == 'importOpensessions') {
$method = 'importOpenSessions';
}
@ -209,6 +213,7 @@ class ImportCsv
'care',
'careers',
'careersdiagram',
'careersresults',
];
foreach ($sections as $section) {
@ -1437,7 +1442,6 @@ class ImportCsv
'careerid'
);
$externalCareerIdList = $externalCareerIdList['value'];
$externalCareerIds = [];
if (substr($externalCareerIdList, 0, 1) === '[') {
$externalCareerIdList = substr($externalCareerIdList, 1, -1);
$externalCareerIds = preg_split('/,/', $externalCareerIdList);
@ -2560,17 +2564,17 @@ class ImportCsv
$data = Import::csv_reader($file);
if (!empty($data)) {
$this->logger->addInfo(count($data)." records found.");
$this->logger->addInfo(count($data).' records found.');
$extraFieldValue = new ExtraFieldValue('career');
$extraFieldName = $this->extraFieldIdNameList['career'];
$externalEventId = null;
$extraField = new ExtraField('career');
$extraFieldInfo = $extraField->get_handler_field_info_by_field_variable(
$extraFieldName
);
$extraFieldInfo = $extraField->get_handler_field_info_by_field_variable($extraFieldName);
if (empty($extraFieldInfo)) {
$this->logger->addInfo("Extra field doesn't exists: $extraFieldName");
return false;
}
@ -2644,6 +2648,105 @@ class ImportCsv
}
}
/**
* @param $file
* @param bool $moveFile
* @param array $teacherBackup
* @param array $groupBackup
*/
private function importCareersResults(
$file,
$moveFile = false,
&$teacherBackup = [],
&$groupBackup = []
) {
$data = Import::csv_reader($file);
if (!empty($data)) {
$this->logger->addInfo(count($data).' records found.');
$extraFieldValue = new ExtraFieldValue('career');
$extraFieldName = $this->extraFieldIdNameList['career'];
foreach ($data as $row) {
if (empty($row)) {
continue;
}
foreach ($row as $key => $value) {
$key = (string) trim($key);
// Remove utf8 bom
$key = preg_replace('/[\x00-\x1F\x80-\xFF]/', '', $key);
$row[$key] = $value;
}
$studentId = $row['StudentId'];
$studentId = UserManager::get_user_id_from_original_id(
$studentId,
$this->extraFieldIdNameList['user']
);
$studentInfo = api_get_user_info($studentId);
if (empty($studentInfo)) {
$this->logger->addInfo("Student id not found: $studentId");
continue;
}
$careerId = $row['CareerId'];
$item = $extraFieldValue->get_item_id_from_field_variable_and_field_value(
$extraFieldName,
$careerId
);
$careerChamiloId = null;
if (empty($item)) {
$this->logger->addInfo("Career not found: $careerId");
continue;
} else {
if (isset($item['item_id'])) {
$careerChamiloId = $item['item_id'];
} else {
continue;
}
}
if (UserManager::userHasCareer($studentId, $careerChamiloId) === false) {
$this->logger->addInfo(
"User $studentId (".$row['StudentId'].") has no career #$careerChamiloId (ext #$careerId)"
);
continue;
}
$userCareerData = UserManager::getUserCareer($studentId, $careerChamiloId);
$extraData = isset($userCareerData['extra_data']) && !empty($userCareerData['extra_data']) ? unserialize($userCareerData['extra_data']) : [];
$teacherInfo = api_get_user_info_from_username($row['TeacherUsername']);
$teacherName = $row['TeacherUsername'];
if ($teacherInfo) {
$teacherName = $teacherInfo['complete_name'];
}
$extraData[$row['CourseId']][$row['ResultId']] = [
'Description' => $row['Description'],
'Period' => $row['Period'],
'TeacherText' => $row['TeacherText'],
'TeacherUsername' => $teacherName,
'ScoreText' => $row['ScoreText'],
'ScoreValue' => $row['ScoreValue'],
'Info' => $row['Info'],
'BgColor' => $row['BgColor'],
'Color' => $row['Color'],
'BorderColor' => $row['BorderColor'],
'Icon' => $row['Icon'],
'IconColor' => $row['IconColor'],
];
$serializedValue = serialize($extraData);
UserManager::updateUserCareer($userCareerData['id'], $serializedValue);
}
}
}
/**
* @param $file
* @param bool $moveFile
@ -2663,9 +2766,7 @@ class ImportCsv
$externalEventId = null;
$extraField = new ExtraField('career');
$extraFieldInfo = $extraField->get_handler_field_info_by_field_variable(
$extraFieldName
);
$extraFieldInfo = $extraField->get_handler_field_info_by_field_variable($extraFieldName);
$careerDiagramExtraFieldName = $this->extraFieldIdNameList['career_diagram'];
$extraFieldDiagramInfo = $extraField->get_handler_field_info_by_field_variable(
@ -2677,7 +2778,7 @@ class ImportCsv
}
if (!empty($data)) {
$this->logger->addInfo(count($data)." records found.");
$this->logger->addInfo(count($data).' records found.');
$values = [];
foreach ($data as $row) {
if (empty($row)) {
@ -2708,7 +2809,6 @@ class ImportCsv
false
);
$chamiloCareerName = '';
if (empty($item)) {
$this->logger->addInfo("Career not found: $careerId");
continue;
@ -2738,7 +2838,7 @@ class ImportCsv
$careerList[$careerId] = $graph;
}
$currentCourseId = (int) $row['CourseId'];
$currentCourseId = $row['CourseId'];
$name = $row['CourseName'];
$notes = $row['Notes'];
$groupValue = $row['Group'];
@ -2782,7 +2882,7 @@ class ImportCsv
continue;
}
$currentCourseId = (int) $row['CourseId'];
$currentCourseId = $row['CourseId'];
if ($graph->hasVertex($currentCourseId)) {
$current = $graph->getVertex($currentCourseId);
} else {

@ -97,7 +97,7 @@ Session::erase('paint_dir');
Session::erase('temp_audio_nanogong');
$plugin = new AppPlugin();
$pluginList = $plugin->get_installed_plugins();
$pluginList = $plugin->getInstalledPlugins();
$capturePluginInstalled = in_array('jcapture', $pluginList);
if ($capturePluginInstalled) {

@ -42,7 +42,7 @@ require_once 'hotpotatoes.lib.php';
$_course = api_get_course_info();
// document path
$documentPath = api_get_path(SYS_COURSE_PATH).$_course['path']."/document";
$documentPath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
$origin = api_get_origin();
$is_allowedToEdit = api_is_allowed_to_edit(null, true) ||
api_is_drh() ||
@ -607,25 +607,45 @@ if ($is_allowedToEdit || $is_tutor) {
'search' => 'true',
'hidden' => api_get_configuration_value('exercise_attempts_report_show_username') ? 'false' : 'true',
],
['name' => 'group_name', 'index' => 'group_id', 'width' => '40', 'align' => 'left', 'search' => 'true', 'stype' => 'select',
[
'name' => 'group_name',
'index' => 'group_id',
'width' => '40',
'align' => 'left',
'search' => 'true',
'stype' => 'select',
//for the bottom bar
'searchoptions' => [
'defaultValue' => 'group_all',
'value' => $group_parameters, ],
'value' => $group_parameters,
],
//for the top bar
'editoptions' => ['value' => $group_parameters], ],
'editoptions' => ['value' => $group_parameters],
],
['name' => 'duration', 'index' => 'exe_duration', 'width' => '30', 'align' => 'left', 'search' => 'true'],
['name' => 'start_date', 'index' => 'start_date', 'width' => '60', 'align' => 'left', 'search' => 'true'],
['name' => 'exe_date', 'index' => 'exe_date', 'width' => '60', 'align' => 'left', 'search' => 'true'],
['name' => 'score', 'index' => 'score', 'width' => '50', 'align' => 'center', 'search' => 'true'],
['name' => 'ip', 'index' => 'user_ip', 'width' => '40', 'align' => 'center', 'search' => 'true'],
['name' => 'status', 'index' => 'revised', 'width' => '40', 'align' => 'left', 'search' => 'true', 'stype' => 'select',
[
'name' => 'status',
'index' => 'revised',
'width' => '40',
'align' => 'left',
'search' => 'true',
'stype' => 'select',
//for the bottom bar
'searchoptions' => [
'defaultValue' => '',
'value' => ':'.get_lang('All').';1:'.get_lang('Validated').';0:'.get_lang('NotValidated'), ],
'value' => ':'.get_lang('All').';1:'.get_lang('Validated').';0:'.get_lang('NotValidated'),
],
//for the top bar
'editoptions' => ['value' => ':'.get_lang('All').';1:'.get_lang('Validated').';0:'.get_lang('NotValidated')], ],
'editoptions' => [
'value' => ':'.get_lang('All').';1:'.get_lang('Validated').';0:'.get_lang(
'NotValidated'
),
],
],
['name' => 'lp', 'index' => 'orig_lp_id', 'width' => '60', 'align' => 'left', 'search' => 'false'],
['name' => 'actions', 'index' => 'actions', 'width' => '60', 'align' => 'left', 'search' => 'false', 'sortable' => 'false'],
];
@ -646,13 +666,9 @@ if ($is_allowedToEdit || $is_tutor) {
return "<span title=\""+tabLoginx[0]+rowObject[2]+tabLoginx[1]+"\">"+cellvalue+"</span>";
}';
}
// Autowidth
$extra_params['autowidth'] = 'true';
// Height auto
$extra_params['height'] = 'auto';
$extra_params['gridComplete'] = "
defaultGroupId = Cookies.get('default_group_".$exercise_id."');
if (typeof defaultGroupId !== 'undefined') {
@ -675,11 +691,11 @@ if (typeof defaultGroupId !== 'undefined') {
if (typeof defaultGroupId !== 'undefined') {
var posted_data = $(\"#results\").jqGrid('getGridParam', 'postData');
var extraFilter = ',{\"field\":\"group_id\",\"op\":\"eq\",\"data\":\"'+ defaultGroupId +'\"}]}';
// var defFilter = '{\"groupOp\":\"AND\",\"rules\": [{\"field\":\"group_id\",\"op\":\"eq\",\"data\":\"'+ defaultGroupId +'\"}] }';
// posted_data.filters = defFilter;
var filters = posted_data.filters;
var stringObj = new String(filters);
stringObj.replace(']}', extraFilter);
posted_data['group_id_in_toolbar'] = defaultGroupId;
$(this).jqGrid('setGridParam', 'postData', posted_data);
}
";
@ -757,11 +773,9 @@ $gridJs = Display::grid_js(
'searchOnEnter': false,
afterSearch: function () {
$('#gs_group_name').on('change', function() {
//console.log('changed');
var defaultGroupId = $('#gs_group_name').val();
// Save default group id
Cookies.set('default_group_<?php echo $exercise_id; ?>', defaultGroupId);
//console.log('cookie SET defaultGroupId ' + defaultGroupId );
});
}
}

@ -36,12 +36,17 @@ if (!empty($glossaryId)) {
$description = implode('[|.|_|.|-|.|]', $glossary_all_data);
}
} elseif (isset($_POST['glossary_name'])) {
$my_glossary_name = Security::remove_XSS($_POST['glossary_name']);
$my_glossary_name = api_convert_encoding($my_glossary_name, $charset, 'UTF-8');
$my_glossary_name = trim($my_glossary_name);
$glossaryName = Security::remove_XSS($_POST['glossary_name']);
$glossaryName = api_convert_encoding($glossaryName, $charset, 'UTF-8');
$glossaryName = trim($glossaryName);
$glossaryInfo = GlossaryManager::get_glossary_term_by_glossary_name($my_glossary_name);
if (api_get_configuration_value('save_titles_as_html')) {
$glossaryName = "%$glossaryName%";
}
$glossaryInfo = GlossaryManager::get_glossary_term_by_glossary_name($glossaryName);
if (!empty($glossaryInfo)) {
$description = str_replace(
$path_image_search,
$path_image,
@ -52,6 +57,7 @@ if (!empty($glossaryId)) {
$description = get_lang('NoResults');
} else {
$description = str_replace('class="glossary"', '', $description);
}
}
}

@ -448,6 +448,7 @@ class GradebookUtils
$is_locked = $link->is_locked();
$modify_icons = null;
if (!api_is_allowed_to_edit(null, true)) {
return null;
}
@ -765,6 +766,34 @@ class GradebookUtils
return $list_users;
}
public static function getTotalCertificates($urlId)
{
$urlId = (int) $urlId;
$table_certificate = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CERTIFICATE);
$table_user = Database::get_main_table(TABLE_MAIN_USER);
$sql = 'SELECT DISTINCT u.user_id, u.lastname, u.firstname, u.username
FROM '.$table_user.' u
INNER JOIN '.$table_certificate.' gc
ON u.user_id=gc.user_id ';
if (!is_null($cat_id) && $cat_id > 0) {
$sql .= ' WHERE cat_id='.intval($cat_id);
}
if (!empty($userList)) {
$userList = array_map('intval', $userList);
$userListCondition = implode("','", $userList);
$sql .= " AND u.user_id IN ('$userListCondition')";
}
$sql .= ' ORDER BY '.(api_sort_by_first_name() ? 'u.firstname' : 'u.lastname');
$rs = Database::query($sql);
$list_users = [];
while ($row = Database::fetch_array($rs)) {
$list_users[] = $row;
}
return $list_users;
}
/**
* Gets the certificate list by user id.
*
@ -1455,6 +1484,7 @@ class GradebookUtils
'score' => $certificateInfo['score_certificate'],
'date' => api_format_date($certificateInfo['created_at'], DATE_FORMAT_SHORT),
'link' => api_get_path(WEB_PATH)."certificates/index.php?id={$certificateInfo['id']}",
'pdf' => api_get_path(WEB_PATH)."certificates/index.php?id={$certificateInfo['id']}&user_id={$userId}&action=export",
];
}
@ -1640,6 +1670,7 @@ class GradebookUtils
$graph.
'<br />'.get_lang('Feedback').'<br />
<textarea class="form-control" rows="5" cols="100">&nbsp;</textarea>';
$result = $pdf->html_to_pdf_with_template(
$content,
$saveToFile,

@ -246,7 +246,13 @@ class CatForm extends FormValidator
);
$skillsDefaults = [];
if (api_is_platform_admin() || api_is_drh()) {
$allowSkillEdit = api_is_platform_admin() || api_is_drh();
if (api_get_configuration_value('skills_teachers_can_assign_skills')) {
$allowSkillEdit = $allowSkillEdit || api_is_allowed_to_edit();
}
if ($allowSkillEdit) {
if (Skill::isToolAvailable()) {
$skillSelect = $this->addElement(
'select_ajax',

@ -801,6 +801,10 @@ class GradebookTable extends SortableTable
if (isset($defaultData[$categoryId]) && isset($defaultData[$categoryId]['ranking'])) {
$totalRanking = $defaultData[$categoryId]['ranking'];
$invalidateRanking = $defaultData[$categoryId]['ranking_invalidate'];
$average = 0;
foreach ($totalRanking as $ranking) {
$average += $ranking;
}
} else {
$totalRanking = [];
$invalidateRanking = true;

@ -602,6 +602,17 @@ switch ($action) {
}
}
if (isset($_GET['group_id_in_toolbar']) && !empty($_GET['group_id_in_toolbar'])) {
$groupIdFromToolbar = (int) $_GET['group_id_in_toolbar'];
if (!empty($groupIdFromToolbar)) {
if (empty($whereCondition)) {
$whereCondition .= " te.group_id = '$groupIdFromToolbar'";
} else {
$whereCondition .= " AND group_id = '$groupIdFromToolbar'";
}
}
}
if (!empty($whereCondition)) {
$whereCondition = " AND $whereCondition";
}
@ -2200,25 +2211,18 @@ switch ($action) {
$new_result = [];
$currentUserId = api_get_user_id();
$isAllow = api_is_allowed_to_edit();
if (!empty($result)) {
$urlUserGroup = api_get_path(WEB_CODE_PATH).'admin/usergroup_users.php?'.api_get_cidreq();
foreach ($result as $group) {
$countUsers = count($obj->get_users_by_usergroup($group['id']));
$group['users'] = $countUsers;
if (!empty($countUsers)) {
if ($obj->allowTeachers()) {
if (isset($group['author_id']) && $group['author_id'] == $currentUserId) {
$group['users'] = Display::url(
$countUsers,
$urlUserGroup.'&id='.$group['id']
);
}
} else {
$group['users'] = Display::url(
$countUsers,
$urlUserGroup.'&id='.$group['id']
);
}
$group['users'] = Display::url(
$countUsers,
$urlUserGroup.'&id='.$group['id']
);
}
if ($obj->usergroup_was_added_in_course($group['id'], $course_id)) {
@ -2241,14 +2245,16 @@ switch ($action) {
$role = $obj->getUserRoleToString(api_get_user_id(), $group['id']);
$group['status'] = $role;
$group['actions'] = '';
if ($obj->allowTeachers() && $group['author_id'] == $currentUserId) {
$group['actions'] .= Display::url(
Display::return_icon('statistics.png', get_lang('Stats')),
$urlUserGroup.'&id='.$group['id']
).'&nbsp;';
}
$group['actions'] .= Display::url($icon, $url);
if ($isAllow) {
if ($obj->allowTeachers() && $group['author_id'] == $currentUserId) {
$group['actions'] .= Display::url(
Display::return_icon('statistics.png', get_lang('Stats')),
$urlUserGroup.'&id='.$group['id']
).'&nbsp;';
}
$group['actions'] .= Display::url($icon, $url);
}
$new_result[] = $group;
}
$result = $new_result;

@ -8,14 +8,43 @@ $action = isset($_GET['a']) ? $_GET['a'] : null;
$current_user_id = api_get_user_id();
$courseId = api_get_course_int_id();
$surveyId = isset($_REQUEST['survey_id']) ? $_REQUEST['survey_id'] : null;
$questionId = isset($_REQUEST['question_id']) ? $_REQUEST['question_id'] : null;
switch ($action) {
case 'load_question_options':
if (!api_is_allowed_to_edit()) {
exit;
}
$question = SurveyManager::get_question($questionId);
if (!empty($question)) {
foreach ($question['answers'] as $index => $answer) {
echo Display::input(
'radio',
'option['.$questionId.']',
$question['answersid'][$index],
['class' => 'question_option']
);
echo $answer;
echo '<br />';
}
}
echo '
<script>
$(function() {
$(".question_option").on("click", function() {
$("#question_form_option_id").attr("value", $(this).val());
});
});
</script>
';
break;
case 'save_question':
if (api_is_anonymous()) {
echo '';
break;
exit;
}
$surveyId = isset($_GET['survey_id']) ? $_GET['survey_id'] : null;
$questionId = isset($_GET['question_id']) ? $_GET['question_id'] : null;
$status = isset($_GET['status']) ? (int) $_GET['status'] : null;
$userId = api_get_user_id();

@ -559,18 +559,23 @@ class CoursesAndSessionsCatalog
/**
* List the sessions.
*
* @param string $date (optional) The date of sessions
* @param string $date
* @param array $limit
* @param bool $returnQueryBuilder
* @param bool $getCount
*
* @throws Exception
*
* @return array The session list
* @return array|\Doctrine\ORM\Query The session list
*/
public static function browseSessions($date = null, $limit = [], $returnQueryBuilder = false)
public static function browseSessions($date = null, $limit = [], $returnQueryBuilder = false, $getCount = false)
{
$urlId = api_get_current_access_url_id();
$dql = "SELECT s
$select = 's';
if ($getCount) {
$select = 'count(s) ';
}
$dql = "SELECT $select
FROM ChamiloCoreBundle:Session s
WHERE EXISTS
(
@ -579,8 +584,6 @@ class CoursesAndSessionsCatalog
) AND
s.nbrCourses > 0
";
//('$date' BETWEEN s.accessStartDate AND s.accessEndDate)
if (!is_null($date)) {
$date = Database::escape_string($date);
$dql .= "
@ -614,41 +617,11 @@ class CoursesAndSessionsCatalog
return $qb;
}
return $qb->getResult();
if ($getCount) {
return $qb->getSingleScalarResult();
}
/**
* Search sessions by searched term by session name.
*
* @param string $queryTerm Term for search
* @param array $limit Limit info
*
* @return array The sessions
*/
public static function browseSessionsBySearch($queryTerm, array $limit)
{
$sessionsToBrowse = [];
$criteria = Criteria::create()
->where(
Criteria::expr()->contains('name', $queryTerm)
)
->setFirstResult($limit['start'])
->setMaxResults($limit['length']);
$sessions = Database::getManager()
->getRepository('ChamiloCoreBundle:Session')
->matching($criteria);
foreach ($sessions as $session) {
if ($session->getNbrCourses() === 0) {
continue;
}
$sessionsToBrowse[] = $session;
}
return $sessionsToBrowse;
return $qb->getResult();
}
/**
@ -664,8 +637,10 @@ class CoursesAndSessionsCatalog
$em = Database::getManager();
$qb = $em->createQueryBuilder();
$urlId = api_get_current_access_url_id();
$sessions = $qb->select('s')
->distinct(true)
->distinct()
->from('ChamiloCoreBundle:Session', 's')
->innerJoin(
'ChamiloCoreBundle:SessionRelCourse',
@ -673,6 +648,12 @@ class CoursesAndSessionsCatalog
Join::WITH,
's.id = src.session'
)
->innerJoin(
'ChamiloCoreBundle:AccessUrlRelSession',
'url',
Join::WITH,
'url.sessionId = s.id'
)
->innerJoin(
'ChamiloCoreBundle:ExtraFieldRelTag',
'frt',
@ -696,6 +677,8 @@ class CoursesAndSessionsCatalog
)
->andWhere(
$qb->expr()->eq('f.extraFieldType', ExtraField::COURSE_FIELD_TYPE)
)->andWhere(
$qb->expr()->eq('url.accessUrlId', $urlId)
)
->setFirstResult($limit['start'])
->setMaxResults($limit['length'])
@ -717,8 +700,9 @@ class CoursesAndSessionsCatalog
/**
* Build a recursive tree of course categories.
*
* @param $categories
* @param $parentId
* @param array $categories
* @param int $parentId
* @param int $level
*
* @return array
*/
@ -754,7 +738,7 @@ class CoursesAndSessionsCatalog
/**
* List Code Search Category.
*
* @param $code
* @param string $code
*
* @return array
*/

@ -7782,8 +7782,8 @@ function api_set_default_visibility(
}
// Read the portal and course default visibility
if ($tool_id == 'documents') {
$visibility = DocumentManager::getDocumentDefaultVisibility($courseCode);
if ($tool_id === 'documents') {
$visibility = DocumentManager::getDocumentDefaultVisibility($courseInfo);
}
api_item_property_update(
@ -8995,7 +8995,28 @@ function api_protect_course_group($tool, $showHeader = true)
{
$groupId = api_get_group_id();
if (!empty($groupId)) {
if (api_is_platform_admin()) {
return true;
}
if (api_is_allowed_to_edit(false, true, true)) {
return true;
}
$userId = api_get_user_id();
$sessionId = api_get_session_id();
if (!empty($sessionId)) {
if (api_is_coach($sessionId, api_get_course_int_id())) {
return true;
}
if (api_is_drh()) {
if (SessionManager::isUserSubscribedAsHRM($sessionId, $userId)) {
return true;
}
}
}
$groupInfo = GroupManager::get_group_properties($groupId);
// Group doesn't exists
@ -9456,10 +9477,9 @@ function api_set_noreply_and_from_address_to_mailer(PHPMailer $mailer, array $se
if (!$avoidReplyToAddress) {
if (
!empty($replyToAddress) &&
isset($platformEmail['SMTP_UNIQUE_REPLY_TO']) && $platformEmail['SMTP_UNIQUE_REPLY_TO'] &&
PHPMailer::ValidateAddress($replyToAddress['mail'])
) {
$mailer->AddReplyTo($replyToAddress['email'], $replyToAddress['name']);
$mailer->AddReplyTo($replyToAddress['mail'], $replyToAddress['name']);
$mailer->Sender = $replyToAddress['mail'];
}
}

@ -128,7 +128,7 @@ class Career extends Model
$header = get_lang('Modify');
}
$id = isset($_GET['id']) ? intval($_GET['id']) : '';
$id = isset($_GET['id']) ? (int) $_GET['id'] : '';
$form->addHeader($header);
$form->addHidden('id', $id);
$form->addElement('text', 'name', get_lang('Name'), ['size' => '70']);
@ -145,14 +145,16 @@ class Career extends Model
);
$status_list = $this->get_status_list();
$form->addElement('select', 'status', get_lang('Status'), $status_list);
if ($action == 'edit') {
$extraField = new ExtraField('career');
$extraField->addElements($form, $id);
$form->addElement('text', 'created_at', get_lang('CreatedAt'));
$form->freeze('created_at');
}
if ($action == 'edit') {
$form->addButtonSave(get_lang('Modify'), 'submit');
$form->addButtonSave(get_lang('Modify'));
} else {
$form->addButtonCreate(get_lang('Add'), 'submit');
$form->addButtonCreate(get_lang('Add'));
}
// Setting the defaults
@ -455,13 +457,34 @@ class Career extends Model
}
/**
* @param Graph $graph
* @param array $careerInfo
* @param Template $tpl
* @param int $loadUserIdData
*
* @return string
*/
public static function renderDiagramByColumn($graph, $tpl)
public static function renderDiagramByColumn($careerInfo, $tpl, $loadUserIdData = 0)
{
$careerId = isset($careerInfo['id']) ? $careerInfo['id'] : 0;
if (empty($careerId)) {
return '';
}
$extraFieldValue = new ExtraFieldValue('career');
$item = $extraFieldValue->get_values_by_handler_and_field_variable(
$careerId,
'career_diagram',
false,
false,
false
);
$graph = null;
if (!empty($item) && isset($item['value']) && !empty($item['value'])) {
/** @var Graph $graph */
$graph = UnserializeApi::unserialize('career', $item['value']);
}
if (!($graph instanceof Graph)) {
return '';
}
@ -475,6 +498,14 @@ class Career extends Model
}
}
$userResult = [];
if (!empty($loadUserIdData)) {
$careerData = UserManager::getUserCareer($loadUserIdData, $careerId);
if (isset($careerData['extra_data']) && !empty($careerData['extra_data'])) {
$userResult = unserialize($careerData['extra_data']);
}
}
$list = [];
$subGroups = [];
/** @var Vertex $vertex */
@ -494,7 +525,6 @@ class Career extends Model
$subGroupLabel = isset($subGroupData[1]) ? $subGroupData[1] : '';
if (!empty($subGroupId) && !in_array($subGroupId, $subGroups)) {
//$subGroups[$subGroupId][] = $vertex->getId();
$subGroups[$subGroupId]['items'][] = $vertex->getId();
$subGroups[$subGroupId]['label'] = $subGroupLabel;
}
@ -509,8 +539,6 @@ class Career extends Model
$list[$column]['column'] = $column;
}
$connections = '';
$groupDrawLine = [];
$groupCourseList = [];
$simpleConnectionList = [];
@ -520,7 +548,6 @@ class Career extends Model
/** @var Vertex $vertex */
foreach ($subGroupList['items'] as $vertex) {
if ($vertex instanceof Vertex) {
$rowId = $vertex->getId();
$groupCourseList[$vertex->getAttribute('Column')][] = $vertex->getId();
$connectionList = $vertex->getAttribute('Connections');
if (empty($connectionList)) {
@ -540,12 +567,11 @@ class Career extends Model
'',
$explode[0]
);
$groupDrawLine[$groupValueId] = true;
$simpleFirstConnection = 'g'.(int) $groupValueId;
} else {
// Course block (row_123 id)
if (!empty($explode[0])) {
$simpleFirstConnection = 'v'.(int) $explode[0];
$simpleFirstConnection = 'v'.$explode[0];
}
}
} else {
@ -569,7 +595,6 @@ class Career extends Model
$value
);
$simpleSecondConnection = 'g'.(int) $groupValueId;
$groupDrawLine[$groupValueId] = true;
} else {
// Course block (row_123 id)
if (!empty($explode[0]) && isset($explode[1])) {
@ -605,21 +630,29 @@ class Career extends Model
// Creates graph
$graph = new stdClass();
$graph->blockWidth = 240;
$graph->blockHeight = 120;
$graph->blockWidth = 280;
$graph->blockHeight = 150;
$graph->xGap = 70;
$graph->yGap = 40;
$graph->yGap = 55;
$graph->xDiff = 70;
$graph->yDiff = 40;
$graph->groupXGap = 50;
$graph->yDiff = 55;
if (!empty($userResult)) {
$graph->blockHeight = 180;
$graph->yGap = 60;
$graph->yDiff = 60;
}
foreach ($groupsBetweenColumns as $group => $items) {
self::parseColumnList($groupCourseList, $items, '', $graph, $simpleConnectionList);
self::parseColumnList($groupCourseList, $items, $graph, $simpleConnectionList, $userResult);
}
$graphHtml .= '<style>
.panel-title {
font-size: 11px;
height: 40px;
}
</style>';
@ -627,7 +660,7 @@ class Career extends Model
if (!empty($graph->groupList)) {
$groupList = [];
$groupDiffX = 20;
$groupDiffY = 10;
$groupDiffY = 50;
$style = 'whiteSpace=wrap;rounded;html=1;strokeColor=red;fillColor=none;strokeWidth=2;align=left;verticalAlign=top;';
foreach ($graph->groupList as $id => $data) {
if (empty($id)) {
@ -685,9 +718,16 @@ class Career extends Model
foreach ($subGroupListData as $subGroupId => $data) {
$x = $data['min_x'] - $subGroupDiffX;
$y = $data['min_y'] - $subGroupDiffX;
$spaceForSubGroupTitle = 0;
if (!empty($data['label'])) {
$spaceForSubGroupTitle = 40;
}
$width = $data['max_width'] + $subGroupDiffX * 2;
$height = $data['max_height'] + $subGroupDiffX * 2;
$label = '<h4>'.$data['label'].'</h4>';
$height = $data['max_height'] + $subGroupDiffX * 2 + $spaceForSubGroupTitle;
$label = '<h4 style="background: white">'.$data['label'].'</h4>';
$vertexData = "var sg$subGroupId = graph.insertVertex(parent, null, '$label', $x, $y, $width, $height, '$style');";
$subGroupList[] = $vertexData;
}
@ -715,7 +755,16 @@ class Career extends Model
return $graphHtml;
}
public static function parseColumnList($groupCourseList, $columnList, $width, &$graph, &$connections)
/**
* @param $groupCourseList
* @param $columnList
* @param $graph
* @param $connections
* @param $userResult
*
* @return string
*/
public static function parseColumnList($groupCourseList, $columnList, &$graph, &$connections, $userResult)
{
$graphHtml = '';
$oldGroup = null;
@ -792,7 +841,8 @@ class Career extends Model
$addRow,
$graph,
$newGroup,
$connections
$connections,
$userResult
);
}
@ -811,10 +861,11 @@ class Career extends Model
* @param stdClass $graph
* @param int $group
* @param array $connections
* @param array $userResult
*
* @return string
*/
public static function parseVertexList($groupCourseList, $vertexList, $addRow = 0, &$graph, $group, &$connections)
public static function parseVertexList($groupCourseList, $vertexList, $addRow = 0, &$graph, $group, &$connections, $userResult)
{
if (empty($vertexList)) {
return '';
@ -845,6 +896,54 @@ class Career extends Model
$content = '<div class="pull-left">'.$vertex->getAttribute('Notes').'</div>';
$content .= '<div class="pull-right">['.$id.']</div>';
if (!empty($userResult) && isset($userResult[$id])) {
$results = '';
$size = 2;
foreach ($userResult[$id] as $resultId => $iconData) {
$icon = '';
switch ($iconData['Icon']) {
case 0:
$icon = Display::returnFontAwesomeIcon('times-circle', $size);
break;
case 1:
$icon = Display::returnFontAwesomeIcon('check-circle', $size);
break;
case 2:
$icon = Display::returnFontAwesomeIcon('info-circle', $size);
break;
}
if (substr($resultId, 0, 1) == 2) {
$iconData['Description'] = 'Result Id = '.$resultId;
}
if (!empty($icon)) {
$params = [
'id' => 'course_'.$id.'_'.$resultId,
'data-toggle' => 'popover',
'title' => 'Popover title',
'class' => 'popup',
'data-description' => $iconData['Description'],
'data-period' => $iconData['Period'],
'data-teacher-text' => $iconData['TeacherText'],
'data-teacher' => $iconData['TeacherUsername'],
'data-score' => $iconData['ScoreText'],
'data-score-value' => $iconData['ScoreValue'],
'data-info' => $iconData['Info'],
'data-background-color' => $iconData['BgColor'],
'data-color' => $iconData['Color'],
'data-border-color' => $iconData['BorderColor'],
'style' => 'color:'.$iconData['IconColor'],
];
$results .= Display::url($icon, 'javascript:void(0);', $params);
}
}
if (!empty($results)) {
$content .= '<div class="row"></div><div class="pull-right">'.$results.'</div>';
}
}
$title = $vertex->getAttribute('graphviz.label');
if (!empty($vertex->getAttribute('LinkedElement'))) {
$title = Display::url($title, $vertex->getAttribute('LinkedElement'));

@ -4957,6 +4957,31 @@ class CourseManager
return $hotCourses;
}
public function totalSubscribedUsersInCourses($urlId)
{
$table_course = Database::get_main_table(TABLE_MAIN_COURSE);
$table_course_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
$courseUsers = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$urlId = (int) $urlId;
$sql = "SELECT count(cu.user_id) count
FROM $courseUsers cu
INNER JOIN $table_course_rel_access_url u
ON cu.c_id = u.c_id
WHERE
relation_type <> ".COURSE_RELATION_TYPE_RRHH." AND
u.access_url_id = $urlId AND
visibility <> ".COURSE_VISIBILITY_CLOSED." AND
visibility <> ".COURSE_VISIBILITY_HIDDEN."
";
$res = Database::query($sql);
$row = Database::fetch_array($res);
return $row['count'];
}
/**
* Get courses count.
*
@ -5002,8 +5027,9 @@ class CourseManager
{
$table_course = Database::get_main_table(TABLE_MAIN_COURSE);
$table_course_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
$sql = "SELECT count(id) FROM $table_course c";
if (!empty($urlId) && $urlId == intval($urlId)) {
$sql = "SELECT count(c.id) FROM $table_course c";
if (!empty($urlId)) {
$urlId = (int) $urlId;
$sql .= ", $table_course_rel_access_url u
WHERE
c.id = u.c_id AND

@ -812,11 +812,10 @@ class CourseHome
* Displays the tools of a certain category.
*
* @param array $all_tools_list List of tools as returned by get_tools_category()
* @param bool $rows
*
* @return array
*/
public static function show_tools_category($all_tools_list, $rows = false)
public static function show_tools_category($all_tools_list)
{
$_user = api_get_user_info();
$theme = api_get_setting('homepage_view');
@ -1343,7 +1342,7 @@ class CourseHome
*
* @return string
*/
public static function getCourseToolBar($orientation = SHORTCUTS_HORIZONTAL): string
public static function show_navigation_tool_shortcuts($orientation = SHORTCUTS_HORIZONTAL)
{
$origin = api_get_origin();
$courseInfo = api_get_course_info();

@ -340,3 +340,5 @@ define('TABLE_STATISTIC_TRACK_E_EXERCICES_TEMP', 'track_e_exercices_temp');
define('TABLE_USER_INFO_DEF', 'userinfo_def');
define('TABLE_USER_INFO_CONTENT', 'userinfo_content');
define('TABLE_MAIN_USER_CAREER', 'user_career');

@ -1518,6 +1518,8 @@ class Event
}
/**
* Get the last best result from all attempts in exercises per user (out of learning paths).
*
* @param int $user_id
* @param int $exercise_id
* @param int $courseId

@ -390,7 +390,6 @@ class ExerciseShowFunctions
echo '<td width="5%">';
echo Display::return_icon($icon, null, null, ICON_SIZE_TINY);
echo '</td>';
if ($exercise->showExpectedChoiceColumn()) {
if ($hide_expected_answer === false) {
echo '<td width="5%">';
@ -413,7 +412,11 @@ class ExerciseShowFunctions
$status = Display::label(get_lang('Correct'), 'success');
}
echo '<td width="20%">';
echo $status;
// Show only status for the selected student answer BT#16256
if ($studentChoice) {
echo $status;
}
echo '</td>';
}

@ -2451,7 +2451,11 @@ JAVASCRIPT;
return " $col {$this->ops[$oper]} $val ";
} else {
$val = '%'.$val.'%';
if (is_string($val)) {
$val = '%'.$val.'%';
} else {
$val = '';
}
}
}
$val = \Database::escape_string($val);

@ -282,8 +282,10 @@ class ExtraFieldValue extends Model
if (!empty($value['tmp_name']) && isset($value['error']) && $value['error'] == 0) {
//Crop the image to adjust 16:9 ratio
$crop = new Image($value['tmp_name']);
$crop->crop($params['extra_'.$field_variable.'_crop_result']);
if (isset($params['extra_'.$field_variable.'_crop_result'])) {
$crop = new Image($value['tmp_name']);
$crop->crop($params['extra_'.$field_variable.'_crop_result']);
}
$imageExtraField = new Image($value['tmp_name']);
$imageExtraField->resize(400);

@ -359,7 +359,11 @@ class GlossaryManager
if ($showMessage) {
Display::addFlash(
Display::return_message(get_lang('TermDeleted').': '.$glossaryInfo['name'])
Display::return_message(
get_lang('TermDeleted').': '.Security::remove_XSS($glossaryInfo['name']),
'normal',
false
)
);
}
@ -655,7 +659,7 @@ class GlossaryManager
$return = '<a href="'.api_get_self().'?action=edit_glossary&glossary_id='.$glossary_id.'&'.api_get_cidreq().'&msg=edit">'.
Display::return_icon('edit.png', get_lang('Edit'), '', 22).'</a>';
$glossary_data = self::get_glossary_information($glossary_id);
$glossary_term = $glossary_data['name'];
$glossary_term = Security::remove_XSS(strip_tags($glossary_data['name']));
if (api_is_allowed_to_edit(null, true)) {
if ($glossary_data['session_id'] == api_get_session_id()) {
$return .= '<a href="'.api_get_self().'?action=delete_glossary&glossary_id='.$glossary_id.'&'.api_get_cidreq().'" onclick="return confirmation(\''.$glossary_term.'\');">'.

@ -148,6 +148,12 @@
}
function embedCode(url, instance, closeDialog, maxWidth, maxHeight, responsiveResize, widget) {
var extraProviderParams = {};
if (responsiveResize) {
extraProviderParams.responsive = true;
}
jQuery('body').oembed(url, {
onEmbed: function(e) {
var codeElement,
@ -197,7 +203,7 @@
}
if (elementAdded) {
if (closeDialog) {
if (closeDialog && CKEDITOR.dialog.getCurrent()) {
CKEDITOR.dialog.getCurrent().hide();
}
}
@ -213,7 +219,8 @@
maxHeight: maxHeight,
maxWidth: maxWidth,
useResponsiveResize: responsiveResize,
embedMethod: 'editor'
embedMethod: 'editor',
'vimeo': extraProviderParams
});
}
@ -223,9 +230,9 @@
minWidth: CKEDITOR.env.ie && CKEDITOR.env.quirks ? 568 : 550,
minHeight: 155,
onShow: function() {
var resizetype = this.getContentElement('general', 'resizeType').getValue(),
maxSizeBox = this.getContentElement('general', 'maxSizeBox').getElement(),
sizeBox = this.getContentElement('general', 'sizeBox').getElement();
var resizetype = CKEDITOR.dialog.getCurrent().getContentElement('general', 'resizeType').getValue(),
maxSizeBox = CKEDITOR.dialog.getCurrent().getContentElement('general', 'maxSizeBox').getElement(),
sizeBox = CKEDITOR.dialog.getCurrent().getContentElement('general', 'sizeBox').getElement();
if (resizetype == 'noresize') {
maxSizeBox.hide();
@ -284,19 +291,19 @@
responsiveResize = false;
} else {
if (resizetype == "responsive") {
maxWidth = this.getContentElement('general', 'maxWidth').
maxWidth = CKEDITOR.dialog.getCurrent().getContentElement('general', 'maxWidth').
getInputElement().
getValue();
maxHeight = this.getContentElement('general', 'maxHeight').
maxHeight = CKEDITOR.dialog.getCurrent().getContentElement('general', 'maxHeight').
getInputElement().
getValue();
responsiveResize = true;
} else if (resizetype == "custom") {
maxWidth = this.getContentElement('general', 'width').
maxWidth = CKEDITOR.dialog.getCurrent().getContentElement('general', 'width').
getInputElement().
getValue();
maxHeight = this.getContentElement('general', 'height').
maxHeight = CKEDITOR.dialog.getCurrent().getContentElement('general', 'height').
getInputElement().
getValue();
@ -393,4 +400,4 @@
});
}
)();
)();

@ -38,14 +38,17 @@ CKEDITOR.dialog.add( 'video', function ( editor )
return;
switch( this.id )
{
case 'responsive':
videoNode.addClass('embed-responsive-item');
break;
case 'poster':
extraStyles.backgroundImage = 'url(' + value + ')';
break;
case 'width':
extraStyles.width = value + 'px';
extraStyles.width = value.indexOf('%') > 0 ? value : (parseInt(value) + 'px');
break;
case 'height':
extraStyles.height = value + 'px';
extraStyles.height = value.indexOf('%') > 0 ? value : (parseInt(value) + 'px');
break;
}
}
@ -176,6 +179,15 @@ CKEDITOR.dialog.add( 'video', function ( editor )
}
var extraStyles = {}, videos = [];
var responsive = this.getValueOf('info', 'responsive');
videoNode.removeClass('embed-responsive-item');
if (responsive) {
this.setValueOf('info', 'width', '100%');
this.setValueOf('info', 'height', '100%');
}
this.commitContent( videoNode, extraStyles, videos );
var innerHtml = '', links = '',
@ -191,6 +203,7 @@ CKEDITOR.dialog.add( 'video', function ( editor )
}
videoNode.setHtml( innerHtml + fallbackTemplate.replace( '%links%', links ) );
var responsiveParent = null;
// Refresh the fake image.
var newFakeImage = editor.createFakeElement( videoNode, 'cke_video', 'video', false );
newFakeImage.setStyles( extraStyles );
@ -198,6 +211,13 @@ CKEDITOR.dialog.add( 'video', function ( editor )
{
newFakeImage.replace( this.fakeImage );
editor.getSelection().selectElement( newFakeImage );
if (responsive) {
responsiveParent = newFakeImage.getParent();
responsiveParent.removeClass('embed-responsive');
responsiveParent.removeClass('embed-responsive-16by9');
responsiveParent.removeClass('embed-responsive-4by3');
}
}
else
{
@ -205,6 +225,22 @@ CKEDITOR.dialog.add( 'video', function ( editor )
var div = new CKEDITOR.dom.element( 'DIV', editor.document );
editor.insertElement( div );
div.append( newFakeImage );
responsiveParent = div;
}
if (responsive) {
newFakeImage.addClass('embed-responsive-item');
responsiveParent.addClass('embed-responsive');
switch (responsive) {
case '16by9':
responsiveParent.addClass('embed-responsive-16by9');
break;
case '4by3':
responsiveParent.addClass('embed-responsive-4by3');
break;
}
}
},
onHide : function()
@ -226,37 +262,6 @@ CKEDITOR.dialog.add( 'video', function ( editor )
label: lang.infoLabel,
elements :
[
{
type : 'hbox',
widths: [ '33%', '33%', '33%'],
children : [
{
type : 'text',
id : 'width',
label : editor.lang.common.width,
'default' : 400,
validate : CKEDITOR.dialog.validate.notEmpty( lang.widthRequired ),
commit : commitValue,
setup : loadValue
},
{
type : 'text',
id : 'height',
label : editor.lang.common.height,
'default' : 300,
//validate : CKEDITOR.dialog.validate.notEmpty(lang.heightRequired ),
commit : commitValue,
setup : loadValue
},
{
type : 'text',
id : 'id',
label : 'Id',
commit : commitValue,
setup : loadValue
}
]
},
{
type : 'hbox',
widths: [ '', '100px', '75px'],
@ -375,6 +380,45 @@ CKEDITOR.dialog.add( 'video', function ( editor )
},
label : editor.lang.common.browseServer
}]
},
{
type : 'hbox',
widths: [ '33%', '33%', '33%'],
children : [
{
type : 'text',
id : 'width',
label : editor.lang.common.width,
'default' : 400,
validate : CKEDITOR.dialog.validate.notEmpty( lang.widthRequired ),
commit : commitValue,
setup : loadValue
},
{
type : 'text',
id : 'height',
label : editor.lang.common.height,
'default' : 300,
//validate : CKEDITOR.dialog.validate.notEmpty(lang.heightRequired ),
commit : commitValue,
setup : loadValue
},
{
type : 'text',
id : 'id',
label : 'Id',
commit : commitValue,
setup : loadValue
}
]
},
{
type: 'radio',
id: 'responsive',
label: lang.responsive,
items: [ [ lang.ratio16by9, '16by9' ], [ lang.ratio4by3, '4by3' ] ],
commit : commitValue,
setup : loadValue
}
]
},
@ -406,4 +450,4 @@ CKEDITOR.dialog.add( 'video', function ( editor )
]
};
} );
} );

@ -144,7 +144,8 @@ CKEDITOR.plugins.add( 'video',
var width = realElement.attributes.width,
height = realElement.attributes.height,
poster = realElement.attributes.poster;
poster = realElement.attributes.poster,
responsive = realElement.attributes.responsive;
if ( typeof width != 'undefined' )
fakeStyle = fakeElement.attributes.style = fakeStyle + 'width:' + CKEDITOR.tools.cssLength( width ) + ';';
@ -155,6 +156,10 @@ CKEDITOR.plugins.add( 'video',
if ( poster )
fakeStyle = fakeElement.attributes.style = fakeStyle + 'background-image:url(' + poster + ');';
if (typeof responsive != 'undefined' && responsive && responsive !== 'null') {
fakeElement.addClass('embed-responsive-item');
}
return fakeElement;
}
}
@ -183,7 +188,10 @@ var en = {
infoLabel: 'Information',
html360: 'This feature (only MP4 videos) is currently still in BETA mode.<br />It only works on dynamic pages, not inside documents created<br />in the documents tool or seen through learning paths.<br />Please do not add more than one 360° video on a single page<br /> as more than one on the same page might generate conflicts.',
video360: 'Enable 360° video player',
video360stereo: 'Stereo video (1:1 aspect ratio)'
video360stereo: 'Stereo video (1:1 aspect ratio)',
responsive: 'Resposive size (mobile-optimized)',
ratio16by9: '16:9 aspect ratio',
ratio4by3: '4:3 aspect ratio'
};
var es = {
@ -201,7 +209,10 @@ var es = {
infoLabel: 'Información',
html360: 'Esta funcionalidad (sólo MP4) todavía se encuentra en modo BETA.<br />Sólo funciona en páginas dinámicas, mas no dentro de documentos<br />creados en la herramienta de documentos o visualizados a través<br />de las lecciones.<br />Por favor no colocar más de un vídeo 360° en una misma página<br />ya que puede provocar conflictos y bloquearlos todos.',
video360: 'Habilitar reproductor de vídeo 360°',
video360stereo: 'Vídeo estéreo (relación de aspecto 1:1)'
video360stereo: 'Vídeo estéreo (relación de aspecto 1:1)',
responsive: 'Tamaño adaptable (tamaño optimizado para móviles)',
ratio16by9: 'Relación de aspecto 16:9',
ratio4by3: 'Relación de aspecto 4:3'
};
var fr = {
@ -219,7 +230,10 @@ var fr = {
infoLabel: 'Information',
html360: 'Cette fonctionnalité (MP4 uniquement) est actuellement en mode BETA.<br />Elle ne fonctionne que sur les pages dynamiques, et pas<br />dans les documents créés à partir de l\'outil document ou visualisés<br />au travers de l\'outil parcours.<br />Merci de ne pas placer plus d\'une vidéo 360° par page. Cela<br />peut causer des conflits et toutes les rendre inactives.',
video360: 'Activer la visualisation 360°',
video360stereo: 'Vidéo stéréo (proportions 1:1 / apparence de 2 vidéos superposées)'
video360stereo: 'Vidéo stéréo (proportions 1:1 / apparence de 2 vidéos superposées)',
responsive: 'Resposive',
ratio16by9: '16:9 aspect ratio',
ratio4by3: '4:3 aspect ratio'
};
// v3
@ -235,4 +249,4 @@ CKEDITOR.plugins.setLang( 'video', 'en', en );
CKEDITOR.plugins.setLang( 'video', 'es', es );
CKEDITOR.plugins.setLang( 'video', 'fr', fr );
})();
})();

@ -176,7 +176,8 @@ class SessionManager
? (empty($accessUrlId) ? api_get_current_access_url_id() : (int) $accessUrlId)
: 1;
if (is_array($_configuration[$accessUrlId]) &&
if (isset($_configuration[$accessUrlId]) &&
is_array($_configuration[$accessUrlId]) &&
isset($_configuration[$accessUrlId]['hosting_limit_sessions']) &&
$_configuration[$accessUrlId]['hosting_limit_sessions'] > 0
) {
@ -4470,6 +4471,13 @@ class SessionManager
}
}
if (isset($extraFieldsValuesToCopy['extra_image']) && isset($extraFieldsValuesToCopy['extra_image']['extra_image'])) {
$extraFieldsValuesToCopy['extra_image'] = [
'tmp_name' => api_get_path(SYS_UPLOAD_PATH).$extraFieldsValuesToCopy['extra_image']['extra_image'],
'error' => 0,
];
}
// Now try to create the session
$sid = self::create_session(
$s['name'].' '.get_lang('CopyLabelSuffix'),
@ -4562,10 +4570,10 @@ class SessionManager
self::add_courses_to_session($sid, $short_courses, true);
if ($create_new_courses === false && $copyTeachersAndDrh) {
foreach ($short_courses as $course) {
$coachList = self::getCoachesByCourseSession($id, $course['id']);
foreach ($short_courses as $courseItemId) {
$coachList = self::getCoachesByCourseSession($id, $courseItemId);
foreach ($coachList as $userId) {
self::set_coach_to_course_session($userId, $sid, $course['id']);
self::set_coach_to_course_session($userId, $sid, $courseItemId);
}
}
}
@ -4634,16 +4642,17 @@ class SessionManager
/**
* Get the number of sessions.
*
* @param int ID of the URL we want to filter on (optional)
* @param int $access_url_id ID of the URL we want to filter on (optional)
*
* @return int Number of sessions
*/
public static function count_sessions($access_url_id = null)
public static function count_sessions($access_url_id = 0)
{
$session_table = Database::get_main_table(TABLE_MAIN_SESSION);
$access_url_rel_session_table = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
$access_url_id = (int) $access_url_id;
$sql = "SELECT count(s.id) FROM $session_table s";
if (!empty($access_url_id) && $access_url_id == intval($access_url_id)) {
if (!empty($access_url_id)) {
$sql .= ", $access_url_rel_session_table u ".
" WHERE s.id = u.session_id AND u.access_url_id = $access_url_id";
}
@ -4653,45 +4662,6 @@ class SessionManager
return $row[0];
}
/**
* Return a COUNT from Session table.
*
* @param string $date in Y-m-d format
*
* @return int
*/
public static function countSessionsByEndDate($date = null)
{
$sessionTable = Database::get_main_table(TABLE_MAIN_SESSION);
$url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
$date = Database::escape_string($date);
$urlId = api_get_current_access_url_id();
$dateFilter = '';
if (!empty($date)) {
$dateFilter = <<<SQL
AND ('$date' BETWEEN s.access_start_date AND s.access_end_date)
OR (s.access_end_date IS NULL)
OR (
s.access_start_date IS NULL AND
s.access_end_date IS NOT NULL AND s.access_end_date > '$date'
)
SQL;
}
$sql = "SELECT COUNT(*)
FROM $sessionTable s
INNER JOIN $url u
ON (s.id = u.session_id)
WHERE u.access_url_id = $urlId $dateFilter";
$res = Database::query($sql);
$count = 0;
if ($res !== false && Database::num_rows($res) > 0) {
$count = (int) current(Database::fetch_row($res));
}
return $count;
}
/**
* @param int $id
* @param bool $checkSession
@ -5344,9 +5314,30 @@ SQL;
// Adding the relationship "Session - User" for students
$userList = [];
if (is_array($users)) {
$extraFieldValueCareer = new ExtraFieldValue('career');
$careerList = isset($enreg['extra_careerid']) && !empty($enreg['extra_careerid']) ? $enreg['extra_careerid'] : [];
$careerList = str_replace(['[', ']'], '', $careerList);
$careerList = explode(',', $careerList);
$finalCareerIdList = [];
foreach ($careerList as $careerId) {
$realCareerIdList = $extraFieldValueCareer->get_item_id_from_field_variable_and_field_value(
'external_career_id',
$careerId
);
if (isset($realCareerIdList['item_id'])) {
$finalCareerIdList[] = $realCareerIdList['item_id'];
}
}
foreach ($users as $user) {
$user_id = UserManager::get_user_id_from_username($user);
if ($user_id !== false) {
if (!empty($finalCareerIdList)) {
foreach ($finalCareerIdList as $careerId) {
UserManager::addUserCareer($user_id, $careerId);
}
}
$userList[] = $user_id;
// Insert new users.
$sql = "INSERT IGNORE INTO $tbl_session_user SET

@ -3002,7 +3002,7 @@ class Skill extends Model
$entityManager = Database::getManager();
$skillUserRepo = $entityManager->getRepository('ChamiloSkillBundle:SkillRelUser');
$skillUserRepo = $entityManager->getRepository('ChamiloCoreBundle:SkillRelUser');
$criteria = ['user' => $user, 'skill' => $skill];
$result = $skillUserRepo->findOneBy($criteria);
@ -3012,7 +3012,7 @@ class Skill extends Model
}
$skillLevelRepo = $entityManager->getRepository('ChamiloSkillBundle:Level');
$skillUser = new \Chamilo\CoreBundle\Entity\SkillRelUser();
$skillUser = new SkillRelUserEntity();
$skillUser->setUser($user);
$skillUser->setSkill($skill);

@ -164,6 +164,38 @@ class Statistics
return $obj->number;
}
/**
* @param string $startDate
* @param string $endDate
*
* @return array
*/
public static function getCoursesWithActivity($startDate, $endDate)
{
$access_url_rel_course_table = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
$table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LASTACCESS);
$startDate = Database::escape_string($startDate);
$endDate = Database::escape_string($endDate);
$urlId = api_get_current_access_url_id();
if (api_is_multiple_url_enabled()) {
$sql = "SELECT DISTINCT(t.c_id) FROM $table t , $access_url_rel_course_table a
WHERE
t.c_id = a.c_id AND
access_url_id='".$urlId."' AND
access_date BETWEEN '$startDate' AND '$endDate'
";
} else {
$sql = "SELECT DISTINCT(t.c_id) FROM $table t
access_date BETWEEN '$startDate' AND '$endDate' ";
}
$result = Database::query($sql);
return Database::store_result($result);
}
/**
* Count activities from track_e_default_table.
*
@ -626,6 +658,41 @@ class Statistics
}
}
public static function getLoginCount($startDate, $endDate)
{
$table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
$access_url_rel_user_table = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$urlId = api_get_current_access_url_id();
$table_url = '';
$where_url = '';
if (api_is_multiple_url_enabled()) {
$table_url = ", $access_url_rel_user_table";
$where_url = " AND login_user_id=user_id AND access_url_id='".$urlId."'";
}
$startDate = Database::escape_string($startDate);
$endDate = Database::escape_string($endDate);
$sql = "
SELECT count(logins) count FROM (
SELECT count(login_user_id) AS logins
FROM $table $table_url
WHERE
login_date BETWEEN '$startDate' AND '$endDate'
$where_url
GROUP BY login_user_id
) as t
";
$res = Database::query($sql);
$totalLogin = 0;
$row = Database::fetch_array($res, 'ASSOC');
if ($row) {
$totalLogin = $row['count'];
}
return $totalLogin;
}
/**
* get the number of recent logins.
*

@ -1671,6 +1671,47 @@ class Tracking
return -1;
}
/**
* @param string $startDate
* @param string $endDate
*
* @return int
*/
public static function getTotalTimeSpentOnThePlatform(
$startDate = '',
$endDate = ''
) {
$tbl_track_login = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
$tbl_url_rel_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$url_table = null;
$url_condition = null;
if (api_is_multiple_url_enabled()) {
$access_url_id = api_get_current_access_url_id();
$url_table = ", ".$tbl_url_rel_user." as url_users";
$url_condition = " AND u.login_user_id = url_users.user_id AND access_url_id='$access_url_id'";
}
if (!empty($startDate) && !empty($endDate)) {
$startDate = Database::escape_string($startDate);
$endDate = Database::escape_string($endDate);
$condition_time = ' (login_date >= "'.$startDate.'" AND logout_date <= "'.$endDate.'" ) ';
}
$sql = "SELECT SUM(TIMESTAMPDIFF(SECOND, login_date, logout_date)) diff
FROM $tbl_track_login u $url_table
WHERE $condition_time $url_condition";
$rs = Database::query($sql);
$row = Database::fetch_array($rs, 'ASSOC');
$diff = $row['diff'];
if ($diff >= 0) {
return $diff;
}
return -1;
}
/**
* Checks if the "lp_minimum_time" feature is available for the course.
*
@ -1908,6 +1949,11 @@ class Tracking
// protect data
$student_id = (int) $student_id;
$session_id = (int) $session_id;
if (empty($courseInfo) || empty($student_id)) {
return false;
}
$courseId = $courseInfo['real_id'];
$table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
@ -2601,61 +2647,68 @@ class Tracking
$tbl_stats_exercices = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES);
$tbl_stats_attempts = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
$course = api_get_course_info($course_code);
if (!empty($course)) {
// Get course tables names
$tbl_quiz_questions = Database::get_course_table(TABLE_QUIZ_QUESTION);
$lp_table = Database::get_course_table(TABLE_LP_MAIN);
$lp_item_table = Database::get_course_table(TABLE_LP_ITEM);
$lp_view_table = Database::get_course_table(TABLE_LP_VIEW);
$lp_item_view_table = Database::get_course_table(TABLE_LP_ITEM_VIEW);
$course_id = $course['real_id'];
// Compose a filter based on optional learning paths list given
$condition_lp = '';
if (count($lp_ids) > 0) {
$condition_lp = " AND id IN(".implode(',', $lp_ids).") ";
}
if (empty($course)) {
return null;
}
// Compose a filter based on optional session id
$session_id = intval($session_id);
if (count($lp_ids) > 0) {
$condition_session = " AND session_id = $session_id ";
} else {
$condition_session = " WHERE session_id = $session_id ";
}
// Get course tables names
$tbl_quiz_questions = Database::get_course_table(TABLE_QUIZ_QUESTION);
$lp_table = Database::get_course_table(TABLE_LP_MAIN);
$lp_item_table = Database::get_course_table(TABLE_LP_ITEM);
$lp_view_table = Database::get_course_table(TABLE_LP_VIEW);
$lp_item_view_table = Database::get_course_table(TABLE_LP_ITEM_VIEW);
$course_id = $course['real_id'];
// Check the real number of LPs corresponding to the filter in the
// database (and if no list was given, get them all)
if (empty($session_id)) {
$sql = "SELECT DISTINCT(id), use_max_score
FROM $lp_table
WHERE
c_id = $course_id AND
(session_id = 0 OR session_id IS NULL) $condition_lp ";
} else {
$sql = "SELECT DISTINCT(id), use_max_score
FROM $lp_table
WHERE c_id = $course_id $condition_lp ";
}
// Compose a filter based on optional learning paths list given
$condition_lp = '';
if (count($lp_ids) > 0) {
$condition_lp = " AND id IN(".implode(',', $lp_ids).") ";
}
$res_row_lp = Database::query($sql);
$count_row_lp = Database::num_rows($res_row_lp);
// Compose a filter based on optional session id
$session_id = intval($session_id);
if (count($lp_ids) > 0) {
$condition_session = " AND session_id = $session_id ";
} else {
$condition_session = " WHERE session_id = $session_id ";
}
$lp_list = $use_max_score = [];
while ($row_lp = Database::fetch_array($res_row_lp)) {
$lp_list[] = $row_lp['id'];
$use_max_score[$row_lp['id']] = $row_lp['use_max_score'];
}
// Check the real number of LPs corresponding to the filter in the
// database (and if no list was given, get them all)
if (empty($session_id)) {
$sql = "SELECT DISTINCT(id), use_max_score
FROM $lp_table
WHERE
c_id = $course_id AND
(session_id = 0 OR session_id IS NULL) $condition_lp ";
} else {
$sql = "SELECT DISTINCT(id), use_max_score
FROM $lp_table
WHERE c_id = $course_id $condition_lp ";
}
// prepare filter on users
if (is_array($student_id)) {
array_walk($student_id, 'intval');
$condition_user1 = " AND user_id IN (".implode(',', $student_id).") ";
} else {
$condition_user1 = " AND user_id = $student_id ";
}
$res_row_lp = Database::query($sql);
$count_row_lp = Database::num_rows($res_row_lp);
$lp_list = $use_max_score = [];
while ($row_lp = Database::fetch_array($res_row_lp)) {
$lp_list[] = $row_lp['id'];
$use_max_score[$row_lp['id']] = $row_lp['use_max_score'];
}
// prepare filter on users
if (is_array($student_id)) {
array_walk($student_id, 'intval');
$condition_user1 = " AND user_id IN (".implode(',', $student_id).") ";
} else {
$condition_user1 = " AND user_id = $student_id ";
}
if (empty($count_row_lp) || empty($student_id)) {
return null;
}
if ($count_row_lp > 0 && !empty($student_id)) {
// Getting latest LP result for a student
//@todo problem when a course have more than 1500 users
$sql = "SELECT MAX(view_count) as vc, id, progress, lp_id, user_id
@ -2941,20 +2994,16 @@ class Tracking
}
return $score_of_scorm_calculate;
} else {
}
if ($debug) {
var_dump($global_result, $lp_with_quiz);
}
return [$global_result, $lp_with_quiz];
}
} else {
return '-';
}
}
}
return null;
return '-';
}
/**
@ -5257,8 +5306,8 @@ class Tracking
{
$html = '';
if (isset($course_code)) {
$user_id = intval($user_id);
$session_id = intval($session_id);
$user_id = (int) $user_id;
$session_id = (int) $session_id;
$course = Database::escape_string($course_code);
$course_info = api_get_course_info($course);
if (empty($course_info)) {

@ -3818,12 +3818,13 @@ class UserManager
/**
* Get the total count of users.
*
* @param int Status of users to be counted
* @param int Access URL ID (optional)
* @param int $status Status of users to be counted
* @param int $access_url_id Access URL ID (optional)
* @param int $active
*
* @return mixed Number of users or false on error
*/
public static function get_number_of_users($status = 0, $access_url_id = 1)
public static function get_number_of_users($status = 0, $access_url_id = 1, $active = null)
{
$t_u = Database::get_main_table(TABLE_MAIN_USER);
$t_a = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
@ -3840,9 +3841,17 @@ class UserManager
FROM $t_u u
WHERE 1 = 1 ";
}
if (is_int($status) && $status > 0) {
$status = (int) $status;
$sql .= " AND u.status = $status ";
}
if ($active !== null) {
$active = (int) $active;
$sql .= " AND u.active = $active ";
}
$res = Database::query($sql);
if (Database::num_rows($res) === 1) {
return (int) Database::result($res, 0, 0);
@ -6476,6 +6485,134 @@ SQL;
return $fullName;
}
/**
* @param int $userId
*
* @return array
*/
public static function getUserCareers($userId)
{
$table = Database::get_main_table(TABLE_MAIN_USER_CAREER);
$tableCareer = Database::get_main_table(TABLE_CAREER);
$userId = (int) $userId;
$sql = "SELECT c.id, c.name
FROM $table uc
INNER JOIN $tableCareer c
ON uc.career_id = c.id
WHERE user_id = $userId
ORDER BY uc.created_at
";
$result = Database::query($sql);
return Database::store_result($result, 'ASSOC');
}
/**
* @param int $userId
* @param int $careerId
*/
public static function addUserCareer($userId, $careerId)
{
if (!api_get_configuration_value('allow_career_users')) {
return false;
}
if (self::userHasCareer($userId, $careerId) === false) {
$params = ['user_id' => $userId, 'career_id' => $careerId, 'created_at' => api_get_utc_datetime(), 'updated_at' => api_get_utc_datetime()];
$table = Database::get_main_table(TABLE_MAIN_USER_CAREER);
Database::insert($table, $params);
}
return true;
}
/**
* @param int $userCareerId
* @param array $data
*
* @return bool
*/
public static function updateUserCareer($userCareerId, $data)
{
if (!api_get_configuration_value('allow_career_users')) {
return false;
}
$params = ['extra_data' => $data, 'updated_at' => api_get_utc_datetime()];
$table = Database::get_main_table(TABLE_MAIN_USER_CAREER);
Database::update(
$table,
$params,
['id = ?' => (int) $userCareerId]
);
return true;
}
/**
* @param int $userId
* @param int $careerId
*
* @return array
*/
public static function getUserCareer($userId, $careerId)
{
$userId = (int) $userId;
$careerId = (int) $careerId;
$table = Database::get_main_table(TABLE_MAIN_USER_CAREER);
$sql = "SELECT * FROM $table WHERE user_id = $userId AND career_id = $careerId";
$result = Database::query($sql);
return Database::fetch_array($result, 'ASSOC');
}
/**
* @param int $userId
* @param int $careerId
*
* @return bool
*/
public static function userHasCareer($userId, $careerId)
{
$userId = (int) $userId;
$careerId = (int) $careerId;
$table = Database::get_main_table(TABLE_MAIN_USER_CAREER);
$sql = "SELECT id FROM $table WHERE user_id = $userId AND career_id = $careerId";
$result = Database::query($sql);
return Database::num_rows($result) > 0;
}
/**
* @return EncoderFactory
*/
private static function getEncoderFactory()
{
$encryption = self::getPasswordEncryption();
$encoders = [
'Chamilo\\UserBundle\\Entity\\User' => new \Chamilo\UserBundle\Security\Encoder($encryption),
];
$encoderFactory = new EncoderFactory($encoders);
return $encoderFactory;
}
/**
* @param User $user
*
* @return \Symfony\Component\Security\Core\Encoder\PasswordEncoderInterface
*/
private static function getEncoder(User $user)
{
$encoderFactory = self::getEncoderFactory();
return $encoderFactory->getEncoder($user);
}
/**
* Disables or enables a user.
*

@ -419,10 +419,12 @@ class IndexManager
$resCats = Database::query($sqlGetSubCatList);
$thereIsSubCat = false;
$htmlTitre = '';
$htmlListCat = '';
if (Database::num_rows($resCats) > 0) {
$htmlListCat = Display::page_header(get_lang('CatList'));
$htmlListCat .= '<ul>';
$htmlTitre = '';
while ($catLine = Database::fetch_array($resCats)) {
$category_has_open_courses = self::category_has_open_courses($catLine['code']);
if ($category_has_open_courses) {

@ -6427,9 +6427,8 @@ class learnpath
$isConfigPage = false,
$allowExpand = true
) {
$actionsLeft = '';
$actionsRight = '';
$actionsLeft .= Display::url(
$actionsLeft = Display::url(
Display::return_icon(
'back.png',
get_lang('ReturnToLearningPaths'),
@ -6466,7 +6465,10 @@ class learnpath
])
);
if (!$isConfigPage) {
$subscriptionSettings = self::getSubscriptionSettings();
$request = api_request_uri();
if (strpos($request, 'edit') === false) {
$actionsLeft .= Display::url(
Display::return_icon(
'settings.png',
@ -6479,7 +6481,9 @@ class learnpath
'lp_id' => $this->lp_id,
])
);
} else {
}
if (strpos($request, 'build') === false && strpos($request, 'add_item') === false) {
$actionsLeft .= Display::url(
Display::return_icon(
'edit.png',
@ -6494,6 +6498,21 @@ class learnpath
);
}
if (strpos(api_get_self(), 'lp_subscribe_users.php') === false) {
if ($this->subscribeUsers == 1 &&
$subscriptionSettings['allow_add_users_to_lp']) {
$actionsLeft .= Display::url(
Display::return_icon(
'user.png',
get_lang('SubscribeUsersToLp'),
'',
ICON_SIZE_MEDIUM
),
api_get_path(WEB_CODE_PATH)."lp/lp_subscribe_users.php?lp_id=".$this->lp_id."&".api_get_cidreq()
);
}
}
if ($allowExpand) {
$actionsLeft .= Display::url(
Display::return_icon(
@ -13409,7 +13428,7 @@ EOD;
get_lang('Title'),
true,
false,
['ToolbarSet' => 'TitleAsHtml']
['ToolbarSet' => 'TitleAsHtml', 'id' => uniqid('editor')]
);
} else {
$form->addText('title', get_lang('Title'), true, ['id' => 'idTitle', 'class' => 'learnpath_item_form']);

@ -156,14 +156,15 @@ $form->addElement('header', get_lang('Or'));
$courseInfo = api_get_course_info();
$documentTree = DocumentManager::get_document_preview(
$courseInfo,
false,
$lp->get_id(),
null,
api_get_session_id(),
false,
'',
api_get_path(WEB_CODE_PATH).'lp/lp_controller.php?action=add_audio&lp_id='.$lp->get_id().'&id='.$lp_item_id,
false,
true
true,
$audioFolderId
);
$tpl->assign('pre_page', $page);

@ -132,16 +132,7 @@ $lp_theme_css = $learnPath->get_theme();
Display::display_header(null, 'Path');
$suredel = trim(get_lang('AreYouSureToDeleteJS'));
//@todo move this somewhere else css/fix.css
?>
<style>
#feedback { font-size: 1.4em; }
#resExercise .ui-selecting { background: #FECA40; }
#resExercise .ui-selected { background: #F39814; color: white; }
#resExercise { list-style-type: none; margin: 0; padding: 0; width: 60%; }
#resExercise li { margin: 3px; padding: 0.4em; font-size: 1.4em; height: 18px; }
</style>
<script>
function stripslashes(str) {
str=str.replace(/\\'/g,'\'');
@ -202,7 +193,7 @@ $(document).on('shown.bs.tab', 'a[data-toggle="tab"]', function (e) {
})
</script>
<?php
/* DISPLAY SECTION */
echo $learnPath->build_action_menu();
echo '<div class="row">';
echo '<div id="lp_sidebar" class="col-md-4">';

@ -18,7 +18,7 @@ if (!$is_allowed_to_edit) {
api_not_allowed(true);
}
$lpId = isset($_GET['lp_id']) ? intval($_GET['lp_id']) : 0;
$lpId = isset($_GET['lp_id']) ? (int) $_GET['lp_id'] : 0;
if (empty($lpId)) {
api_not_allowed(true);
@ -149,7 +149,6 @@ $groupMultiSelect = $form->addElement(
get_lang('Groups'),
$groupChoices
);
// submit button
$form->addButtonSave(get_lang('Save'));
@ -198,14 +197,17 @@ if ($form->validate()) {
header("Location: $url");
exit;
} else {
Display::addFlash(Display::return_message(get_lang('UserLpSubscriptionDescription')));
}
$message = Display::return_message(get_lang('UserLpSubscriptionDescription'));
$headers = [
get_lang('SubscribeUsersToLp'),
get_lang('SubscribeGroupsToLp'),
];
$tpl = new Template();
$tabs = Display::tabs($headers, [$formUsers->toHtml(), $form->toHtml()]);
$tpl->assign('content', $tabs);
$tpl->display_one_col_template();
}
$menu = $oLP->build_action_menu(true, false, true, false);
$tpl = new Template();
$tabs = Display::tabs($headers, [$formUsers->toHtml(), $form->toHtml()]);
$tpl->assign('content', $menu.$message.$tabs);
$tpl->display_one_col_template();

@ -515,7 +515,7 @@ $template = new Template('', false, false, true, true, false);
$fixLinkSetting = api_get_configuration_value('lp_fix_embed_content');
$fixLink = '';
if ($fixLinkSetting) {
$fixLink = '{type:"script", id:"_fr10", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/fixlinks.js"}';
$fixLink = '{type:"script", id:"_fr10", src:"'.api_get_path(WEB_LIBRARY_PATH).'fixlinks.js"}';
}
$template->assign('fix_link', $fixLink);
@ -614,6 +614,12 @@ if (api_get_configuration_value('lp_view_accordion') === true && $lpType == 1) {
}
$template->assign('lp_id', $lp->lp_id);
$template->assign('lp_current_item_id', $lp->get_current_item_id());
$menuLocation = 'left';
if (!empty(api_get_configuration_value('lp_menu_location'))) {
$menuLocation = api_get_configuration_value('lp_menu_location');
}
$template->assign('menu_location', $menuLocation);
$template->assign('disable_js_in_lp_view', (int) api_get_configuration_value('disable_js_in_lp_view'));
$template->assign(
'lp_preview_image',

@ -16,6 +16,7 @@ if (!isset($_GET['course'])) {
require_once __DIR__.'/../inc/global.inc.php';
api_block_anonymous_users();
$htmlHeadXtra[] = '<script type="text/javascript" src="'.api_get_path(WEB_PUBLIC_PATH).'assets/jquery.easy-pie-chart/dist/jquery.easypiechart.js"></script>';
$export = isset($_GET['export']) ? $_GET['export'] : false;
@ -545,7 +546,7 @@ $courses_in_session = [];
// See #4676
$drh_can_access_all_courses = false;
if (api_is_drh() || api_is_platform_admin() || api_is_student_boss()) {
if (api_is_drh() || api_is_platform_admin() || api_is_student_boss() || api_is_session_admin()) {
$drh_can_access_all_courses = true;
}

@ -30,15 +30,6 @@ class ch_multiplechoice extends survey_question
if (is_array($formData['answers'])) {
foreach ($formData['answers'] as $key => $value) {
$this->getForm()->addHtmlEditor('answers['.$key.']', null, false, false, $config);
if ($key < $total - 1) {
//$this->getForm()->addButton("move_down[$key]", get_lang('Down'));
}
if ($key > 0) {
//$this->getForm()->addButton("move_up[$key]", get_lang('Up'));
}
if ($total > 2) {
$this->getForm()->addButton("delete_answer[$key]", get_lang('Delete'), 'trash', 'danger');
}

@ -82,8 +82,6 @@ class ch_personality extends survey_question
$count++;
}
}
// The buttons for adding or removing
//$this->html .= parent :: add_remove_buttons($form_content);
}
/**

@ -8,7 +8,7 @@ class ch_score extends survey_question
{
/**
* @param array $survey_data
* @param $form_content
* @param array $formData
*/
public function createForm($survey_data, $formData)
{

@ -21,11 +21,6 @@ $_course = api_get_course_info();
$this_section = SECTION_COURSES;
$allowSurveyAvailabilityDatetime = api_get_configuration_value('allow_survey_availability_datetime');
// Database table definitions
$table_survey = Database::get_course_table(TABLE_SURVEY);
$table_user = Database::get_main_table(TABLE_MAIN_USER);
$table_course = Database::get_main_table(TABLE_MAIN_COURSE);
$table_gradebook_link = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
/** @todo this has to be moved to a more appropriate place (after the display_header of the code) */
@ -240,7 +235,6 @@ if (Gradebook::is_active()) {
// Loading Gradebook select
GradebookUtils::load_gradebook_select_in_tool($form);
if ($action == 'edit') {
$element = $form->getElement('category_id');
$element->freeze();

@ -61,13 +61,13 @@ $text = $form->addText(
$allowSurveyAvailabilityDatetime = api_get_configuration_value('allow_survey_availability_datetime');
if ($allowSurveyAvailabilityDatetime) {
$startDateElement = $form->addDateTimePicker('start_date', get_lang('StartDate'));
$endDateElement = $form->addDateTimePicker('end_date', get_lang('EndDate'));
$form->addDateTimePicker('start_date', get_lang('StartDate'));
$form->addDateTimePicker('end_date', get_lang('EndDate'));
$form->addRule('start_date', get_lang('InvalidDate'), 'datetime');
$form->addRule('end_date', get_lang('InvalidDate'), 'datetime');
} else {
$startDateElement = $form->addElement('date_picker', 'start_date', get_lang('StartDate'));
$endDateElement = $form->addElement('date_picker', 'end_date', get_lang('EndDate'));
$form->addElement('date_picker', 'start_date', get_lang('StartDate'));
$form->addElement('date_picker', 'end_date', get_lang('EndDate'));
$form->addRule('start_date', get_lang('InvalidDate'), 'date');
$form->addRule('end_date', get_lang('InvalidDate'), 'date');
}
@ -203,14 +203,8 @@ if ($form->validate()) {
$questionTable = Database::get_course_table(TABLE_SURVEY_QUESTION);
$counter = 1;
if (!empty($surveyData['iid'])) {
$questions = SurveyManager::get_questions($surveyData['iid']);
if (!empty($questions)) {
$questions = array_column($questions, 'question');
}
foreach ($dates as $date) {
$formattedDate = $date['start'].'@@'.$date['end'];
if (!empty($date['id'])) {
$questionId = $date['id'];
$sql = "UPDATE $questionTable SET survey_question = '$formattedDate'

@ -881,33 +881,6 @@ if ((isset($_GET['show']) && $_GET['show'] != '') ||
$count_result++;
}
/*
//i.e 70% - 70% -70% 70% $equal_count =3
while (1) {
if ($result[$i]['value'] == $result[$i+1]['value']) {
$equal_count++;
} else {
break;
}
$i++;
}
echo 'eq'. $equal_count;
echo '<br />';
if ($equal_count == 0) {
//i.e 70% 70% -60% 60% $equal_count = 1 only we get the first 2 options
if (($result[0]['value'] == $result[1]['value']) && ($result[2]['value'] == $result[3]['value'])) {
$group_cant = 1;
} else {
// By default we chose the highest 3
$group_cant=2;
}
} elseif ($equal_count == 2) {
$group_cant = 2;
} else {
$group_cant = -1;
}
*/
// i.e 70% - 70% -70% 70% $equal_count =3
$i = 0;
$group_cant = 0;
@ -1263,7 +1236,7 @@ if (isset($questions) && is_array($questions)) {
foreach ($questions as $key => &$question) {
$ch_type = 'ch_'.$question['type'];
$questionNumber = $questionCounter;
$display = new $ch_type();
$display = survey_question::createQuestion($question['type']);
// @todo move this in a function.
$form->addHtml('<div class="survey_question '.$ch_type.'">');
$form->addHtml('<div style="float:left; font-weight: bold; margin-right: 5px;"> '.$questionNumber.'. </div>');
@ -1279,13 +1252,11 @@ if (isset($questions) && is_array($questions)) {
$finalAnswer = [];
foreach ($userAnswer as $userChoice) {
list($choiceId, $choiceValue) = explode('*', $userChoice);
$finalAnswer[$choiceId] = $choiceValue;
}
break;
case 'percentage':
list($choiceId, $choiceValue) = explode('*', current($userAnswer));
$finalAnswer = $choiceId;
break;
default:

@ -7,7 +7,7 @@ if (!api_is_allowed_to_edit(false, true)) {
api_not_allowed(true);
}
$survey_id = isset($_REQUEST['survey_id']) ? intval($_REQUEST['survey_id']) : null;
$survey_id = isset($_REQUEST['survey_id']) ? (int) $_REQUEST['survey_id'] : null;
if (empty($survey_id)) {
api_not_allowed(true);

@ -250,10 +250,6 @@ foreach ($students as $studentId) {
}
$column = 0;
$table->setCellContents($row, $column, $name);
$class = 'class="row_odd"';
if ($row % 2) {
$class = 'class="row_even"';
}
$row++;
}
if ($action === 'edit') {

@ -79,7 +79,6 @@ if (isset($_GET['show'])) {
// Getting all the questions for this page and add them to a
// multidimensional array where the first index is the page.
// as long as there is no pagebreak fount we keep adding questions to the page
$questions_displayed = [];
$paged_questions = [];
$counter = 0;
$sql = "SELECT * FROM $table_survey_question
@ -153,11 +152,6 @@ if (isset($_GET['show'])) {
}
}
$before = 0;
if (isset($_GET['show']) && isset($paged_questions[$_GET['show'] - 1])) {
$before = count($paged_questions[$_GET['show'] - 1]);
}
$numberOfPages = SurveyManager::getCountPages($survey_data);
// Displaying the form with the questions
@ -189,8 +183,7 @@ if (is_array($questions) && count($questions) > 0) {
}
foreach ($questions as $key => &$question) {
$ch_type = 'ch_'.$question['type'];
/** @var survey_question $display */
$display = new $ch_type();
$display = survey_question::createQuestion($question['type']);
$form->addHtml('<div class="survey_question '.$ch_type.'">');
$form->addHtml('<div style="float:left; font-weight: bold; margin-right: 5px;"> '.$counter.'. </div>');
$form->addHtml('<div>'.Security::remove_XSS($question['survey_question']).'</div> ');

@ -28,15 +28,6 @@ if (empty($surveyData)) {
api_not_allowed(true);
}
// Is valid request
$is_valid_request = isset($_REQUEST['is_executable']) ? $_REQUEST['is_executable'] : null;
// Database table definitions
$table_survey = Database::get_course_table(TABLE_SURVEY);
$table_survey_question = Database::get_course_table(TABLE_SURVEY_QUESTION);
$table_survey_question_option = Database::get_course_table(TABLE_SURVEY_QUESTION_OPTION);
$table_course = Database::get_main_table(TABLE_MAIN_COURSE);
$table_user = Database::get_main_table(TABLE_MAIN_USER);
$course_id = api_get_course_int_id();
$urlname = api_substr(api_html_entity_decode($surveyData['title'], ENT_QUOTES), 0, 40);
if (api_strlen(strip_tags($surveyData['title'])) > 40) {
@ -104,10 +95,7 @@ if (!in_array($_GET['type'], $possible_types)) {
}
// Displaying the form for adding or editing the question
$ch_type = 'ch_'.$_GET['type'];
/** @var survey_question $surveyQuestion */
$surveyQuestion = new $ch_type();
//$surveyQuestion = survey_question::createQuestion($_GET['type'])
$surveyQuestion = survey_question::createQuestion($_GET['type']);
// The defaults values for the form
$formData = [];

@ -62,7 +62,7 @@ if (!empty($exportReport) && !empty($format)) {
switch ($format) {
case 'xls':
$filename = 'survey_results_'.$survey_id.'.xlsx';
$data = SurveyUtil::export_complete_report_xls($survey_data, $filename, $userId);
SurveyUtil::export_complete_report_xls($survey_data, $filename, $userId);
exit;
break;
case 'csv':

@ -965,9 +965,9 @@ class SurveyManager
if (in_array($type, $possible_types)) {
return $icon_question[$type];
} else {
return false;
}
return false;
}
/**

@ -37,12 +37,9 @@ if (!api_is_allowed_to_edit(false, true) ||
}
// Database table definitions
$table_survey = Database::get_course_table(TABLE_SURVEY);
$table_survey_question = Database::get_course_table(TABLE_SURVEY_QUESTION);
$table_survey_question_option = Database::get_course_table(TABLE_SURVEY_QUESTION_OPTION);
$table_survey_question_group = Database::get_course_table(TABLE_SURVEY_QUESTION_GROUP);
$table_course = Database::get_main_table(TABLE_MAIN_COURSE);
$table_user = Database::get_main_table(TABLE_MAIN_USER);
$survey_id = (int) $_GET['survey_id'];
$course_id = api_get_course_int_id();
@ -81,7 +78,7 @@ if ($is_survey_type_1 && ($action == 'addgroup' || $action == 'deletegroup')) {
WHERE c_id = '.$course_id.' AND id = \''.Database::escape_string($_POST['group_id']).'\'');
$sendmsg = 'GroupUpdatedSuccessfully';
} elseif (!empty($_POST['name'])) {
Database::query('INSERT INTO '.$table_survey_question_group.' (c_id, name,description,survey_id) values ('.$course_id.', \''.Database::escape_string($_POST['name']).'\',\''.Database::escape_string($_POST['description']).'\',\''.Database::escape_string($survey_id).'\') ');
Database::query('INSERT INTO '.$table_survey_question_group.' (c_id, name,description,survey_id) values ('.$course_id.', \''.Database::escape_string($_POST['name']).'\',\''.Database::escape_string($_POST['description']).'\',\''.$survey_id.'\') ');
$sendmsg = 'GroupCreatedSuccessfully';
} else {
$sendmsg = 'GroupNeedName';
@ -90,7 +87,7 @@ if ($is_survey_type_1 && ($action == 'addgroup' || $action == 'deletegroup')) {
if ($action == 'deletegroup') {
$sql = 'DELETE FROM '.$table_survey_question_group.'
WHERE c_id = '.$course_id.' AND id = '.intval($_GET['gid']).' AND survey_id = '.intval($survey_id);
WHERE c_id = '.$course_id.' AND id = '.intval($_GET['gid']).' AND survey_id = '.$survey_id;
Database::query($sql);
$sendmsg = 'GroupDeletedSuccessfully';
}
@ -105,7 +102,6 @@ Display::display_header($tool_name, 'Survey');
$my_action_survey = Security::remove_XSS($action);
$my_question_id_survey = isset($_GET['question_id']) ? Security::remove_XSS($_GET['question_id']) : null;
$my_survey_id_survey = Security::remove_XSS($_GET['survey_id']);
$message_information = isset($_GET['message']) ? Security::remove_XSS($_GET['message']) : null;
if (isset($action)) {
if (($action == 'moveup' || $action == 'movedown') && isset($_GET['question_id'])) {
@ -248,9 +244,9 @@ $sql = "SELECT survey_question.*, count(survey_question_option.question_option_i
LEFT JOIN $table_survey_question_option survey_question_option
ON
survey_question.question_id = survey_question_option.question_id AND
survey_question_option.c_id = $course_id
survey_question_option.c_id = survey_question.c_id
WHERE
survey_question.survey_id = ".intval($survey_id)." AND
survey_question.survey_id = $survey_id AND
survey_question.c_id = $course_id
GROUP BY survey_question.question_id
ORDER BY survey_question.sort ASC";
@ -317,7 +313,6 @@ while ($row = Database::fetch_array($result, 'ASSOC')) {
}
echo '</tr>';
}
echo '</table>';
if ($is_survey_type_1) {
@ -345,7 +340,7 @@ if ($is_survey_type_1) {
echo '<form action="'.api_get_path(WEB_CODE_PATH).'survey/survey.php?action=addgroup&survey_id='.$survey_id.'" method="post">';
if ($_GET['action'] == 'editgroup') {
$sql = 'SELECT name,description FROM '.$table_survey_question_group.'
WHERE id = '.intval($_GET['gid']).' AND survey_id = '.intval($survey_id).' limit 1';
WHERE id = '.intval($_GET['gid']).' AND survey_id = '.$survey_id.' limit 1';
$rs = Database::query($sql);
$editedrow = Database::fetch_array($rs, 'ASSOC');
echo '<input type="text" maxlength="20" name="name" value="'.$editedrow['name'].'" size="10" disabled>';

@ -465,19 +465,14 @@ class SurveyUtil
break;
}
$ch_type = 'ch_'.$question['type'];
if (class_exists($ch_type)) {
/** @var survey_question $display */
$display = new $ch_type();
$url = api_get_self();
$form = new FormValidator('question', 'post', $url);
$form->addHtml('<div class="survey_question_wrapper"><div class="survey_question">');
$form->addHtml($question['survey_question']);
$display->render($form, $question, $finalAnswer);
$form->addHtml('</div></div>');
$content .= $form->returnForm();
}
$display = survey_question::createQuestion($question['type']);
$url = api_get_self();
$form = new FormValidator('question', 'post', $url);
$form->addHtml('<div class="survey_question_wrapper"><div class="survey_question">');
$form->addHtml($question['survey_question']);
$display->render($form, $question, $finalAnswer);
$form->addHtml('</div></div>');
$content .= $form->returnForm();
}
}

@ -17,13 +17,6 @@ if (!api_is_allowed_to_edit(false, true)) {
api_not_allowed(true);
}
// Database table definitions
$table_survey = Database::get_course_table(TABLE_SURVEY);
$table_survey_question = Database::get_course_table(TABLE_SURVEY_QUESTION);
$table_survey_question_option = Database::get_course_table(TABLE_SURVEY_QUESTION_OPTION);
$table_course = Database::get_main_table(TABLE_MAIN_COURSE);
$table_user = Database::get_main_table(TABLE_MAIN_USER);
$table_survey_invitation = Database::get_course_table(TABLE_SURVEY_INVITATION);
$tool_name = get_lang('SurveyInvitations');
$courseInfo = api_get_course_info();

@ -34,10 +34,6 @@ if (empty($survey_data)) {
// Database table definitions
$table_survey = Database::get_course_table(TABLE_SURVEY);
$table_survey_question = Database::get_course_table(TABLE_SURVEY_QUESTION);
$table_survey_question_option = Database::get_course_table(TABLE_SURVEY_QUESTION_OPTION);
$table_course = Database::get_main_table(TABLE_MAIN_COURSE);
$table_user = Database::get_main_table(TABLE_MAIN_USER);
$urlname = strip_tags(api_substr(api_html_entity_decode($survey_data['title'], ENT_QUOTES), 0, 40));
if (api_strlen(strip_tags($survey_data['title'])) > 40) {
@ -161,14 +157,6 @@ $form->addElement('checkbox', 'hide_link', '', get_lang('HideSurveyInvitationLin
// Submit button
$form->addButtonSave(get_lang('PublishSurvey'));
$portal_url = api_get_path(WEB_PATH);
if (api_is_multiple_url_enabled()) {
$access_url_id = api_get_current_access_url_id();
if ($access_url_id != -1) {
$url = api_get_access_url($access_url_id);
$portal_url = $url['url'];
}
}
// Show the URL that can be used by users to fill a survey without invitation
$auto_survey_link = SurveyUtil::generateFillSurveyLink(

@ -68,12 +68,6 @@ if (!api_is_allowed_to_edit(false, true)) {
$extend_rights_for_coachs = api_get_setting('extend_rights_for_coach_on_survey');
// Database table definitions
$table_survey = Database::get_course_table(TABLE_SURVEY);
$table_survey_question = Database::get_course_table(TABLE_SURVEY_QUESTION);
$table_course = Database::get_main_table(TABLE_MAIN_COURSE);
$table_user = Database::get_main_table(TABLE_MAIN_USER);
// Language variables
if (isset($_GET['search']) && $_GET['search'] == 'advanced') {
$interbreadcrumb[] = [
'url' => api_get_path(WEB_CODE_PATH).'survey/survey_list.php',
@ -165,7 +159,6 @@ switch ($action) {
break;
}
// Header
Display::display_header($tool_name, 'Survey');
// Tool introduction
Display::display_introduction_section('survey', 'left');
@ -205,6 +198,7 @@ if (!api_is_session_general_coach() || $extend_rights_for_coachs == 'true') {
echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;search=advanced">'.
Display::return_icon('search.png', get_lang('Search'), '', ICON_SIZE_MEDIUM).'</a>';
echo '</div>';
// Load main content
if (api_is_session_general_coach() && $extend_rights_for_coachs == 'false') {
SurveyUtil::display_survey_list_for_coach();

@ -12,6 +12,89 @@ class survey_question
/** @var FormValidator */
private $form;
/**
* @param FormValidator $form
* @param array $surveyData
*/
public function addParentMenu(FormValidator $form, $surveyData)
{
$surveyId = $surveyData['survey_id'];
$questions = SurveyManager::get_questions($surveyId);
$options = [];
foreach ($questions as $question) {
$options[$question['question_id']] = strip_tags($question['question']);
}
$form->addSelect(
'parent_id',
get_lang('Parent'),
$options,
['id' => 'parent_id', 'placeholder' => get_lang('SelectAnOption')]
);
$url = api_get_path(WEB_AJAX_PATH).'survey.ajax.php?'.api_get_cidreq();
$form->addHtml('
<script>
$(function() {
$("#parent_id").on("change", function() {
var questionId = $(this).val()
var params = {
"a": "load_question_options",
"survey_id": "'.$surveyId.'",
"question_id": questionId,
};
$.ajax({
type: "GET",
url: "'.$url.'",
data: params,
async: false,
success: function(data) {
$("#parent_options").html(data);
}
});
console.log();
});
});
</script>
');
$form->addHtml('<div id="parent_options"></div>');
$form->addHidden('option_id', 0);
}
/**
* @param string $type
*
* @return survey_question
*/
public static function createQuestion($type)
{
switch ($type) {
case 'comment':
return new ch_comment();
case 'dropdown':
return new ch_dropdown();
case 'multiplechoice':
return new ch_multiplechoice();
case 'multipleresponse':
return new ch_multipleresponse();
case 'open':
return new ch_open();
case 'pagebreak':
return new ch_pagebreak();
case 'percentage':
return new ch_percentage();
case 'personality':
return new ch_personality();
case 'score':
return new ch_score();
case 'yesno':
return new ch_yesno();
default:
api_not_allowed(true);
break;
}
}
/**
* Generic part of any survey question: the question field.
*

@ -653,7 +653,6 @@ if ($export_csv) {
array_unshift($csvContentInSession, $csv_headers);
if ($sessionId) {
$sessionData = [];
$sessionInfo = api_get_session_info($sessionId);
$sessionDates = SessionManager::parseSessionDates($sessionInfo);

@ -7,7 +7,7 @@
require_once __DIR__.'/../inc/global.inc.php';
$this_section = SECTION_COURSES;
api_protect_course_script(true);
api_protect_course_script(true, false, 'user');
if (api_get_setting('allow_user_course_subscription_by_course_admin') == 'false') {
if (!api_is_platform_admin()) {
@ -41,6 +41,8 @@ $(function() {
$actionsLeft = '';
$actionsRight = '';
$usergroup = new UserGroup();
$actions = '';
if (api_is_allowed_to_edit()) {
if ($type === 'registered') {
$actionsLeft .= '<a href="class.php?'.api_get_cidreq().'&type=not_registered">'.

@ -22,7 +22,7 @@ class CkEditor extends Editor
*/
public function createHtml($value)
{
$html = '<textarea id="'.$this->getName().'" name="'.$this->getName().'" class="ckeditor">
$html = '<textarea id="'.$this->getTextareaId().'" name="'.$this->getName().'" class="ckeditor">
'.$value.'
</textarea>';
$html .= $this->editorReplace();
@ -40,6 +40,7 @@ class CkEditor extends Editor
public function createHtmlStyle($value): string
{
$style = '';
$value = trim($value);
if ($value === '' || $value === '<html><head><title></title></head><body></body></html>') {
@ -47,7 +48,7 @@ class CkEditor extends Editor
$style .= api_get_css(ChamiloApi::getEditorDocStylePath());
}
$html = '<textarea id="'.$this->getName().'" name="'.$this->getName().'" class="ckeditor">
$html = '<textarea id="'.$this->getTextareaId().'" name="'.$this->getName().'" class="ckeditor">
'.$style.$value.'
</textarea>';
$html .= $this->editorReplace();
@ -72,7 +73,7 @@ class CkEditor extends Editor
$javascript = $this->toJavascript($config);
$html = "<script>
CKEDITOR.replace('".$this->getName()."',
CKEDITOR.replace('".$this->getTextareaId()."',
$javascript
);
</script>";
@ -81,11 +82,56 @@ class CkEditor extends Editor
}
/**
* Get the templates in JSON format.
* @param array $templates
*
* @return string
*/
public function simpleFormatTemplates(): string
public function formatTemplates($templates)
{
if (empty($templates)) {
return null;
}
/** @var \Chamilo\CoreBundle\Entity\SystemTemplate $template */
$templateList = [];
$cssTheme = api_get_path(WEB_CSS_PATH).'themes/'.api_get_visual_theme().'/';
$search = ['{CSS_THEME}', '{IMG_DIR}', '{REL_PATH}', '{COURSE_DIR}', '{CSS}'];
$replace = [
$cssTheme,
api_get_path(REL_CODE_PATH).'img/',
api_get_path(REL_PATH),
api_get_path(REL_DEFAULT_COURSE_DOCUMENT_PATH),
'',
];
foreach ($templates as $template) {
$image = $template->getImage();
$image = !empty($image) ? $image : 'empty.gif';
/*$image = $this->urlGenerator->generate(
'get_document_template_action',
array('file' => $image),
UrlGenerator::ABSOLUTE_URL
);*/
$content = str_replace($search, $replace, $template->getContent());
$templateList[] = [
'title' => $this->translator->trans($template->getTitle()),
'description' => $this->translator->trans($template->getComment()),
'image' => $image,
'html' => $content,
];
}
return json_encode($templateList);
}
/**
* Get the templates in JSON format.
*
* @return string|
*/
public function simpleFormatTemplates()
{
$templates = $this->getEmptyTemplate();

@ -1429,7 +1429,7 @@ class CourseBuilder
$courseId = (int) $courseId;
if (!empty($session_id) && !empty($courseId)) {
$session_id = intval($session_id);
$session_id = (int) $session_id;
if ($withBaseContent) {
$sessionCondition = api_get_session_condition(
$session_id,

@ -1952,7 +1952,13 @@ class CourseRestorer
$imageNewId = $documentsToRestore->destination_id;
}
}
$question->question = DocumentManager::replaceUrlWithNewCourseCode(
$question->question,
$this->course->code,
$this->course->destination_path,
$this->course->backup_path,
$this->course->info['path']
);
$params = [
'c_id' => $this->destination_course_id,
'question' => self::DBUTF8($question->question),
@ -1979,7 +1985,17 @@ class CourseRestorer
$onlyAnswers = [];
if (in_array($question->quiz_type, [DRAGGABLE, MATCHING, MATCHING_DRAGGABLE])) {
$allAnswers = array_column($question->answers, 'answer', 'id');
$tempAnswerList = $question->answers;
foreach ($tempAnswerList as &$value) {
$value['answer'] = DocumentManager::replaceUrlWithNewCourseCode(
$value['answer'],
$this->course->code,
$this->course->destination_path,
$this->course->backup_path,
$this->course->info['path']
);
}
$allAnswers = array_column($tempAnswerList, 'answer', 'id');
}
if (in_array($question->quiz_type, [MATCHING, MATCHING_DRAGGABLE])) {
@ -2660,6 +2676,7 @@ class CourseRestorer
strlen($lp->preview_image) - 7,
strlen($lp->preview_image)
);
if (file_exists($origin_path.$lp->preview_image) &&
!is_dir($origin_path.$lp->preview_image)
) {
@ -2669,6 +2686,15 @@ class CourseRestorer
);
if ($copy_result) {
$lp->preview_image = $new_filename;
// Create 64 version from original
$temp = new \Image($destination_path.$new_filename);
$temp->resize(64);
$pathInfo = pathinfo($new_filename);
if ($pathInfo) {
$filename = $pathInfo['filename'];
$extension = $pathInfo['extension'];
$temp->send_image($destination_path.'/'.$filename.'.64.'.$extension);
}
} else {
$lp->preview_image = '';
}

@ -32,7 +32,6 @@ class Level
/**
* @Gedmo\SortablePosition
*
* @ORM\Column(name="position", type="integer")
*/
protected $position;

@ -13,7 +13,7 @@ use Gedmo\Mapping\Annotation as Gedmo;
* SkillRelCourse.
*
* @ORM\Table(name="skill_rel_course")
* @ORM\Entity // uncomment if api_get_configuration_value('allow_skill_rel_items')
* @ORM\Entity
*/
class SkillRelCourse
{

@ -11,7 +11,7 @@ use Gedmo\Mapping\Annotation as Gedmo;
* SkillRelItem.
*
* @ORM\Table(name="skill_rel_item")
* @ORM\Entity // uncomment if api_get_configuration_value('allow_skill_rel_items')
* @ORM\Entity
*/
class SkillRelItem
{

Loading…
Cancel
Save