Minor - Merge with 1.11.x

pull/3016/head
Julio Montoya 6 years ago
parent 57664dde31
commit 7250f6f1d3
  1. 4
      main/admin/careers.php
  2. 8
      main/admin/index.php
  3. 37
      main/admin/settings.lib.php
  4. 6
      main/admin/special_exports.php
  5. 4
      main/gradebook/gradebook_edit_cat.php
  6. 3
      main/inc/ajax/survey.ajax.php
  7. 12
      main/inc/introductionSection.inc.php
  8. 81
      main/inc/lib/api.lib.php
  9. 1
      main/inc/lib/course.lib.php
  10. 2
      main/inc/lib/display.lib.php
  11. 5
      main/inc/lib/document.lib.php
  12. 2
      main/inc/lib/extra_field_value.lib.php
  13. 2
      main/inc/lib/login.lib.php
  14. 2
      main/inc/lib/message.lib.php
  15. 24
      main/inc/lib/template.lib.php
  16. 3
      main/inc/lib/userportal.lib.php
  17. 10
      main/lp/lp_subscribe_users.php
  18. 14
      main/work/add_user.php
  19. 4
      main/work/work_list_all.php

@ -73,7 +73,7 @@ $column_model = [
'sortable' => 'false',
],
];
//Autowidth
$extra_params['autowidth'] = 'true';
$extra_params['height'] = 'auto';
@ -233,7 +233,7 @@ switch ($action) {
$content = $career->display();
break;
}
// The header.
Display::display_header($tool_name);
?>

@ -361,6 +361,10 @@ if (api_is_platform_admin()) {
'url' => api_get_path(WEB_CODE_PATH).'mySpace/company_reports.php',
'label' => get_lang('Reports'),
];
$items[] = [
'url' => api_get_path(WEB_CODE_PATH).'admin/teacher_time_report.php',
'label' => get_lang('TeacherTimeReport'),
];
if (api_get_configuration_value('chamilo_cms')) {
$items[] = [
@ -417,6 +421,10 @@ if (api_is_platform_admin()) {
'url' => 'special_exports.php',
'label' => get_lang('SpecialExports'),
];
/*$items[] = [
'url' => 'periodic_export.php',
'label' => get_lang('PeriodicExport'),
];*/
$items[] = [
'url' => 'system_status.php',
'label' => get_lang('SystemStatus'),

@ -41,7 +41,7 @@ function handleRegions()
}
$plugin_obj = new AppPlugin();
$installed_plugins = $plugin_obj->get_installed_plugins();
$installed_plugins = $plugin_obj->getInstalledPlugins();
echo '<form name="plugins" method="post" action="'.api_get_self().'?category='.Security::remove_XSS($_GET['category']).'">';
echo '<table class="data_table">';
@ -146,7 +146,7 @@ function handlePlugins()
}
$all_plugins = $plugin_obj->read_plugins_from_path();
$installed_plugins = $plugin_obj->get_installed_plugins();
$installed_plugins = $plugin_obj->getInstalledPlugins();
// Plugins NOT installed
echo Display::page_subheader(get_lang('Plugins'));
@ -646,7 +646,7 @@ function storeRegions()
$plugin_obj = new AppPlugin();
// Get a list of all current 'Plugins' settings
$installed_plugins = $plugin_obj->get_installed_plugins();
$installed_plugins = $plugin_obj->getInstalledPlugins();
$shortlist_installed = [];
if (!empty($installed_plugins)) {
foreach ($installed_plugins as $plugin) {
@ -1117,6 +1117,7 @@ function addEditTemplate()
// Setting the form elements: the title of the template.
$form->addText('title', get_lang('Title'), false);
$form->addText('comment', get_lang('Description'), false);
// Setting the form elements: the content of the template (wysiwyg editor).
$form->addHtmlEditor(
@ -1128,7 +1129,9 @@ function addEditTemplate()
);
// Setting the form elements: the form to upload an image to be used with the template.
$form->addElement('file', 'template_image', get_lang('Image'), '');
if (empty($template->getImage())) {
$form->addElement('file', 'template_image', get_lang('Image'), '');
}
// Setting the form elements: a little bit information about the template image.
$form->addElement('static', 'file_comment', '', get_lang('TemplateImageComment100x70'));
@ -1138,12 +1141,14 @@ function addEditTemplate()
$defaults['template_id'] = $id;
$defaults['template_text'] = $template->getContent();
// Forcing get_lang().
$defaults['title'] = get_lang($template->getTitle());
$defaults['title'] = $template->getTitle();
$defaults['comment'] = $template->getComment();
// Adding an extra field: a hidden field with the id of the template we are editing.
$form->addElement('hidden', 'template_id');
// Adding an extra field: a preview of the image that is currently used.
if (!empty($template->getImage())) {
$form->addElement(
'static',
@ -1153,6 +1158,7 @@ function addEditTemplate()
.'" alt="'.get_lang('TemplatePreview')
.'"/>'
);
$form->addCheckBox('delete_image', null, get_lang('DeletePicture'));
} else {
$form->addElement(
'static',
@ -1169,20 +1175,28 @@ function addEditTemplate()
$form->addButtonSave(get_lang('Ok'), 'submit');
// Setting the rules: the required fields.
$form->addRule(
'template_image',
get_lang('ThisFieldIsRequired'),
'required'
);
$form->addRule('title', get_lang('ThisFieldIsRequired'), 'required');
if (empty($template->getImage())) {
$form->addRule(
'template_image',
get_lang('ThisFieldIsRequired'),
'required'
);
$form->addRule('title', get_lang('ThisFieldIsRequired'), 'required');
}
// if the form validates (complies to all rules) we save the information,
// else we display the form again (with error message if needed)
if ($form->validate()) {
$check = Security::check_token('post');
if ($check) {
// Exporting the values.
$values = $form->exportValues();
$isDelete = null;
if (isset($values['delete_image'])) {
$isDelete = $values['delete_image'];
}
// Upload the file.
if (!empty($_FILES['template_image']['name'])) {
$upload_ok = process_uploaded_file($_FILES['template_image']);
@ -1222,6 +1236,7 @@ function addEditTemplate()
.$values['template_text'];
$template
->setTitle($values['title'])
->setComment(Security::remove_XSS($values['comment']))
->setContent(Security::remove_XSS($templateContent, COURSEMANAGERLOWSECURITY))
->setImage($new_file_name);
$em->persist($template);

@ -18,13 +18,13 @@ api_set_more_memory_and_time_limits();
$this_section = SECTION_PLATFORM_ADMIN;
$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
// Access restrictions
$nameTools = get_lang('SpecialExports');
$export = '';
$querypath = '';
// Displaying the header
Display::display_header($nameTools);
// Display the tool title
echo Display::page_header($nameTools);
if (count($_POST) == 0) {

@ -102,6 +102,6 @@ $interbreadcrumb[] = [
'name' => get_lang('Gradebook'),
];
$this_section = SECTION_COURSES;
Display :: display_header(get_lang('EditCategory'));
Display::display_header(get_lang('EditCategory'));
$form->display();
Display :: display_footer();
Display::display_footer();

@ -43,7 +43,8 @@ switch ($action) {
break;
case 'save_question':
if (api_is_anonymous()) {
exit;
echo '';
break;
}
$status = isset($_GET['status']) ? (int) $_GET['status'] : null;
$userId = api_get_user_id();

@ -182,14 +182,12 @@ if ($tool == TOOL_COURSE_HOMEPAGE && !isset($_GET['intro_cmdEdit'])) {
$class1 = '';
if ($displayMode == '1') {
// Show only the current course progress step
// $information_title = get_lang('InfoAboutLastDoneAdvance');
$last_done_advance = $thematic->get_last_done_thematic_advance();
$thematic_advance_info = $thematic->get_thematic_advance_list($last_done_advance);
$subTitle1 = get_lang('CurrentTopic');
$class1 = ' current';
} elseif ($displayMode == '2') {
// Show only the two next course progress steps
// $information_title = get_lang('InfoAboutNextAdvanceNotDone');
$last_done_advance = $thematic->get_next_thematic_advance_not_done();
$next_advance_not_done = $thematic->get_next_thematic_advance_not_done(2);
$thematic_advance_info = $thematic->get_thematic_advance_list($last_done_advance);
@ -197,7 +195,6 @@ if ($tool == TOOL_COURSE_HOMEPAGE && !isset($_GET['intro_cmdEdit'])) {
$subTitle1 = $subTitle2 = get_lang('NextTopic');
} elseif ($displayMode == '3') {
// Show the current and next course progress steps
// $information_title = get_lang('InfoAboutLastDoneAdvanceAndNextAdvanceNotDone');
$last_done_advance = $thematic->get_last_done_thematic_advance();
$next_advance_not_done = $thematic->get_next_thematic_advance_not_done();
$thematic_advance_info = $thematic->get_thematic_advance_list($last_done_advance);
@ -211,9 +208,7 @@ if ($tool == TOOL_COURSE_HOMEPAGE && !isset($_GET['intro_cmdEdit'])) {
$thematic_advance = get_lang('CourseThematicAdvance');
$thematicScore = $thematic->get_total_average_of_thematic_advances().'%';
$thematicUrl = api_get_path(WEB_CODE_PATH).'course_progress/index.php?action=thematic_details&'.api_get_cidreq();
$thematic_info = $thematic->get_thematic_list(
$thematic_advance_info['thematic_id']
);
$thematic_info = $thematic->get_thematic_list($thematic_advance_info['thematic_id']);
$thematic_advance_info['start_date'] = api_get_local_time(
$thematic_advance_info['start_date']
@ -226,7 +221,7 @@ if ($tool == TOOL_COURSE_HOMEPAGE && !isset($_GET['intro_cmdEdit'])) {
$courseInfo = api_get_course_info();
$titleThematic = $thematic_advance.' : '.$courseInfo['name'].' <b>( '.$thematicScore.' )</b>';
$infoUser = '<div class="thematic-avatar"><img src="'.$userInfo['avatar'].'" class="img-circle img-fluid"></div>';
$infoUser = '<div class="thematic-avatar"><img src="'.$userInfo['avatar'].'" class="img-circle img-responsive"></div>';
$infoUser .= '<div class="progress">
<div class="progress-bar progress-bar-primary" role="progressbar" style="width: '.$thematicScore.';">
'.$thematicScore.'
@ -247,8 +242,7 @@ if ($tool == TOOL_COURSE_HOMEPAGE && !isset($_GET['intro_cmdEdit'])) {
if (!empty($thematic_advance_info2)) {
$thematic_info2 = $thematic->get_thematic_list($thematic_advance_info2['thematic_id']);
$thematic_advance_info2['start_date'] = api_get_local_time($thematic_advance_info2['start_date']);
$thematic_advance_info2['start_date'] = api_format_date($thematic_advance_info2['start_date'],
DATE_TIME_FORMAT_LONG);
$thematic_advance_info2['start_date'] = api_format_date($thematic_advance_info2['start_date'], DATE_TIME_FORMAT_LONG);
$thematicItemTwo = '
<div class="col-md-6 items-progress">

@ -960,37 +960,6 @@ function api_get_path($path = '', $configuration = [])
return $path;
}
/**
* Gets a modified version of the path for the CDN, if defined in
* configuration.php.
*
* @param string $web_path The path of the resource without CDN
*
* @return string The path of the resource converted to CDN
*
* @author Yannick Warnier <ywarnier@beeznst.org>
*/
function api_get_cdn_path($web_path)
{
global $_configuration;
$web_root = api_get_path(WEB_PATH);
$ext = substr($web_path, strrpos($web_path, '.'));
if (isset($ext[2])) { // faster version of strlen to check if len>2
// Check for CDN definitions
if (!empty($_configuration['cdn_enable']) && !empty($ext)) {
foreach ($_configuration['cdn'] as $host => $exts) {
if (in_array($ext, $exts)) {
//Use host as defined in $_configuration['cdn'], without
// trailing slash
return str_replace($web_root, $host.'/', $web_path);
}
}
}
}
return $web_path;
}
/**
* Adds to a given path a trailing slash if it is necessary (adds "/" character at the end of the string).
*
@ -2084,11 +2053,10 @@ function api_remove_in_gradebook()
* particular course, if none given it gets the course info from the session.
*
* @param string $course_code
* @param bool $strict
*
* @return array
*/
function api_get_course_info($course_code = null, $strict = false)
function api_get_course_info($course_code = null)
{
if (!empty($course_code)) {
$course_code = Database::escape_string($course_code);
@ -5156,11 +5124,14 @@ function api_max_sort_value($user_course_category, $user_id)
*
* @author Julian Prud'homme
*
* @param int the number of seconds
* @param int $seconds number of seconds
* @param string $space
* @param bool $showSeconds
* @param bool $roundMinutes
*
* @return string the formated time
* @return string the formatted time
*/
function api_time_to_hms($seconds, $space = ':')
function api_time_to_hms($seconds, $space = ':', $showSeconds = true, $roundMinutes = false)
{
// $seconds = -1 means that we have wrong data in the db.
if ($seconds == -1) {
@ -5179,6 +5150,24 @@ function api_time_to_hms($seconds, $space = ':')
// How many minutes ?
$min = floor(($seconds - ($hours * 3600)) / 60);
if ($roundMinutes) {
if ($min >= 45) {
$min = 45;
}
if ($min >= 30 && $min <= 44) {
$min = 30;
}
if ($min >= 15 && $min <= 29) {
$min = 15;
}
if ($min >= 0 && $min <= 14) {
$min = 0;
}
}
// How many seconds
$sec = floor($seconds - ($hours * 3600) - ($min * 60));
@ -5194,7 +5183,12 @@ function api_time_to_hms($seconds, $space = ':')
$min = "0$min";
}
return $hours.$space.$min.$space.$sec;
$seconds = '';
if ($showSeconds) {
$seconds = $space.$sec;
}
return $hours.$space.$min.$seconds;
}
/* FILE SYSTEM RELATED FUNCTIONS */
@ -6407,19 +6401,26 @@ function api_request_uri()
*/
function api_get_current_access_url_id()
{
static $id;
if (!empty($id)) {
return $id;
}
$table = Database::get_main_table(TABLE_MAIN_ACCESS_URL);
$path = Database::escape_string(api_get_path(WEB_PATH));
$sql = "SELECT id FROM $table WHERE url = '".$path."'";
$result = Database::query($sql);
if (Database::num_rows($result) > 0) {
$access_url_id = Database::result($result, 0, 0);
if ($access_url_id === false) {
$id = Database::result($result, 0, 0);
if ($id === false) {
return -1;
}
return (int) $access_url_id;
return (int) $id;
}
$id = 1;
//if the url in WEB_PATH was not found, it can only mean that there is
// either a configuration problem or the first URL has not been defined yet
// (by default it is http://localhost/). Thus the more sensible thing we can

@ -2436,6 +2436,7 @@ class CourseManager
$app_plugin = new AppPlugin();
$app_plugin->performActionsWhenDeletingItem('course', $courseId);
// Delete the course from the database
Database::getManager()->remove($courseEntity);
Database::getManager()->flush();

@ -821,8 +821,6 @@ class Display
}
}
$icon = api_get_cdn_path($icon);
if ($return_only_path) {
return $icon;
}

@ -4762,6 +4762,7 @@ class DocumentManager
$sessionId = api_get_session_id();
$courseParams = api_get_cidreq();
$courseCode = api_get_course_id();
$webODFList = self::get_web_odf_extension_list();
// Get the title or the basename depending on what we're using
@ -4950,6 +4951,10 @@ class DocumentManager
$class = $classAddToEditor;
$url = $documentWebPath.str_replace('%2F', '/', $url_path).'?'.$courseParams;
}
$url = $documentWebPath.str_replace('%2F', '/', $url_path).'?'.$courseParams;
$url_path = str_replace('%2F', '/', $url_path);
$url = api_get_path(WEB_PUBLIC_PATH)."courses/$courseCode/document$url_path?type=show";
if ($visibility == false) {
$class = ' ajax text-muted ';
if ($addToEditor) {

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

@ -7,6 +7,8 @@ use ChamiloSession as Session;
/**
* Class Login.
*
* @deprecated
*
* @author Olivier Cauberghe <olivier.cauberghe@UGent.be>, Ghent University
* @author Julio Montoya <gugli100@gmail.com>
*

@ -1645,7 +1645,7 @@ class MessageManager
*
* @return string
*/
public static function display_message_for_group($groupId, $topic_id, $is_member, $messageId)
public static function display_message_for_group($groupId, $topic_id)
{
global $my_group_role;
$main_message = self::get_message_by_id($topic_id);

@ -567,21 +567,6 @@ class Template
$this->assign('video_features', $defaultFeatures);
}
/**
* Sets the "styles" menu in ckEditor.
*
* Reads css/themes/xxx/editor.css if exists and shows it in the menu, otherwise it
* will take the default web/editor.css file
*/
public function setStyleMenuInCkEditor()
{
$cssEditor = api_get_cdn_path(api_get_path(WEB_CSS_PATH).'editor.css');
if (is_file(api_get_path(SYS_CSS_PATH).$this->themeDir.'editor.css')) {
$cssEditor = api_get_path(WEB_CSS_PATH).$this->themeDir.'editor.css';
}
$this->assign('css_editor', $cssEditor);
}
/**
* Prepare custom CSS to be added at the very end of the <head> section.
*
@ -590,20 +575,13 @@ class Template
public function setCssCustomFiles()
{
global $disable_js_and_css_files;
// chamilo CSS
//$css[] = api_get_cdn_path(api_get_path(WEB_CSS_PATH).'../chamilo.css');
// Base CSS
//$css[] = api_get_cdn_path(api_get_path(WEB_CSS_PATH).'base.css');
$css = [];
if ($this->show_learnpath) {
$css[] = api_get_cdn_path(api_get_path(WEB_CSS_PATH).'scorm.css');
if (is_file(api_get_path(SYS_CSS_PATH).$this->themeDir.'learnpath.css')) {
$css[] = api_get_path(WEB_CSS_PATH).$this->themeDir.'learnpath.css';
}
}
//$css[] = api_get_cdn_path(api_get_path(WEB_CSS_PATH).$this->themeDir.'default.css');
$css_file_to_string = '';
foreach ($css as $file) {
$css_file_to_string .= api_get_css($file);
@ -635,7 +613,7 @@ class Template
$style_print = '';
if (is_readable(api_get_path(SYS_CSS_PATH).$this->theme.'/print.css')) {
$style_print = api_get_css(
api_get_cdn_path(api_get_path(WEB_CSS_PATH).$this->theme.'/print.css'),
api_get_path(WEB_CSS_PATH).$this->theme.'/print.css',
'print'
);
}

@ -2043,8 +2043,7 @@ class IndexManager
return [
'courses' => $courseList,
'html_courses' => $template->fetch($layout),
'html_sessions' => null,
'html' => $template->fetch($layout),
'course_count' => count($courseList),
'session_count' => $sessionCount,
];

@ -149,7 +149,7 @@ $groupMultiSelect = $form->addElement(
get_lang('Groups'),
$groupChoices
);
// submit button
$form->addButtonSave(get_lang('Save'));
$defaults = [];
@ -200,10 +200,10 @@ if ($form->validate()) {
}
$message = Display::return_message(get_lang('UserLpSubscriptionDescription'));
$headers = [
get_lang('SubscribeUsersToLp'),
get_lang('SubscribeGroupsToLp'),
];
$headers = [
get_lang('SubscribeUsersToLp'),
get_lang('SubscribeGroupsToLp'),
];
$menu = $oLP->build_action_menu(true, false, true, false);

@ -8,8 +8,8 @@ require_once 'work.lib.php';
$current_course_tool = TOOL_STUDENTPUBLICATION;
$workId = isset($_GET['id']) ? intval($_GET['id']) : null;
$userId = isset($_GET['user_id']) ? intval($_GET['user_id']) : null;
$workId = isset($_GET['id']) ? (int) $_GET['id'] : null;
$userId = isset($_GET['user_id']) ? (int) $_GET['user_id'] : null;
$action = isset($_GET['action']) ? $_GET['action'] : null;
$sessionId = api_get_session_id();
@ -22,8 +22,6 @@ if (empty($my_folder_data)) {
api_not_allowed(true);
}
$work_data = get_work_assignment_by_id($workId);
if (!api_is_allowed_to_edit()) {
api_not_allowed(true);
}
@ -47,12 +45,15 @@ switch ($action) {
addUserToWork($userId, $workId, api_get_course_int_id());
}
$url = api_get_path(WEB_CODE_PATH).'work/add_user.php?id='.$workId.'&'.api_get_cidreq();
Display::addFlash(Display::return_message(get_lang('Added')));
header('Location: '.$url);
exit;
break;
case 'delete':
if (!empty($workId) && !empty($userId)) {
deleteUserToWork($userId, $workId, api_get_course_int_id());
Display::addFlash(Display::return_message(get_lang('Deleted')));
$url = api_get_path(WEB_CODE_PATH).'work/add_user.php?id='.$workId.'&'.api_get_cidreq();
header('Location: '.$url);
exit;
@ -60,7 +61,7 @@ switch ($action) {
break;
}
Display :: display_header(null);
Display::display_header(null);
$items = getAllUserToWork($workId, api_get_course_int_id());
$usersAdded = [];
@ -83,10 +84,9 @@ if (!empty($items)) {
echo '</ul>';
}
$status = 0;
if (empty($sessionId)) {
$status = STUDENT;
} else {
$status = 0;
}
$userList = CourseManager::get_user_list_from_course_code(

@ -33,18 +33,14 @@ if (!($is_allowed_to_edit || $isDrhOfCourse)) {
api_not_allowed(true);
}
$tool_name = get_lang('StudentPublications');
$group_id = api_get_group_id();
$courseInfo = api_get_course_info();
$courseCode = $courseInfo['code'];
$sessionId = api_get_session_id();
$htmlHeadXtra[] = api_get_jqgrid_js();
$user_id = api_get_user_id();
if (!empty($group_id)) {
$group_properties = GroupManager::get_group_properties($group_id);
$show_work = false;
if (api_is_allowed_to_edit(false, true)) {
$show_work = true;
} else {

Loading…
Cancel
Save