Adding show_system_folders option in course see BT#4705

1.9.x
Julio Montoya 11 years ago
parent 8c31b07e62
commit ef5f4e4d4d
  1. 14
      main/course_info/infocours.php
  2. 3
      main/inc/lib/course.lib.php
  3. 33
      main/inc/lib/document.lib.php

@ -331,6 +331,20 @@ $form->addGroup($group, '', array(get_lang("InfoAboutAdvanceInsideHomeCourse")),
$form->addElement('style_submit_button', null, get_lang('SaveSettings'), 'class="save"');
$form->addElement('html', '</div></div>');
// Document settings
$form->addElement('html', '<div><h3>'.Display::return_icon('folder.png', Security::remove_XSS(get_lang('Documents')),'',ICON_SIZE_SMALL).' '.Security::remove_XSS(get_lang('Documents')).'</h3><div>');
$group = array(
$form->createElement('radio', 'show_system_folders', null, get_lang('Yes'), 1),
$form->createElement('radio', 'show_system_folders', null, get_lang('No'), 2),
);
$form->addGroup($group, '', array(get_lang("ShowSystemFolders")), '');
$form->addElement('style_submit_button', null, get_lang('SaveSettings'), 'class="save"');
$form->addElement('html', '</div></div>');
// Certificate settings
if (api_get_setting('allow_public_certificates')=='true') {
$form->addElement('html', '<div><h3>'.Display::return_icon('certificate.png', Security::remove_XSS(get_lang('Certificates')),'',ICON_SIZE_SMALL).' '.Security::remove_XSS(get_lang('Certificates')).'</h3><div>');

@ -4337,7 +4337,8 @@ class CourseManager
// Get send_mail_setting (auth)from table
'email_alert_to_teacher_on_new_user_in_course',
'enable_lp_auto_launch',
'pdf_export_watermark_text'
'pdf_export_watermark_text',
'show_system_folders'
);
}

@ -578,7 +578,7 @@ class DocumentManager
$ids_to_remove = array();
$my_repeat_ids = $temp = array();
// Selecting repetead ids
// Selecting repeated ids
foreach ($doc_list as $row) {
if (in_array($row['id'], array_keys($temp))) {
$my_repeat_ids[] = $row['id'];
@ -3434,17 +3434,17 @@ class DocumentManager
*/
public static function is_folder_to_avoid($path, $is_certificate_mode = false)
{
$folders_to_avoid = array(
$foldersToAvoid = array(
'/HotPotatoes_files',
'/certificates',
);
$systemFolder = api_get_course_setting('show_system_folders');
if (basename($path) == 'css') {
return true;
if ($systemFolder == 1) {
$foldersToAvoid = array();
}
//Skip hotpotatoes results
if (strstr($path, 'HotPotatoes_files')) {
if (basename($path) == 'css') {
return true;
}
@ -3455,28 +3455,28 @@ class DocumentManager
}
}
//Admin setting for Hide/Show the folders of all users
// Admin setting for Hide/Show the folders of all users
if (api_get_setting('show_users_folders') == 'false') {
$folders_to_avoid[] = '/shared_folder';
$foldersToAvoid[] = '/shared_folder';
if (strstr($path, 'shared_folder_session_')) {
return true;
}
}
//Admin setting for Hide/Show Default folders to all users
// Admin setting for Hide/Show Default folders to all users
if (api_get_setting('show_default_folders') == 'false') {
$folders_to_avoid[] = '/images';
$folders_to_avoid[] = '/flash';
$folders_to_avoid[] = '/audio';
$folders_to_avoid[] = '/video';
$foldersToAvoid[] = '/images';
$foldersToAvoid[] = '/flash';
$foldersToAvoid[] = '/audio';
$foldersToAvoid[] = '/video';
}
//Admin setting for Hide/Show chat history folder
// Admin setting for Hide/Show chat history folder
if (api_get_setting('show_chat_folder') == 'false') {
$folders_to_avoid[] = '/chat_files';
$foldersToAvoid[] = '/chat_files';
}
return in_array($path, $folders_to_avoid);
return in_array($path, $foldersToAvoid);
}
/**
@ -3486,6 +3486,7 @@ class DocumentManager
{
$system_folders = array(
'/certificates',
'/HotPotatoes_files',
'/chat_files',
'/images',
'/flash',

Loading…
Cancel
Save