|
|
|
@ -69,7 +69,6 @@ if ($is_certificate_mode) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* Constants and variables */ |
|
|
|
|
|
|
|
|
|
$doc_table = Database::get_course_table(TABLE_DOCUMENT); |
|
|
|
|
$course_id = api_get_course_int_id(); |
|
|
|
|
$courseCode = api_get_course_id(); |
|
|
|
@ -138,8 +137,15 @@ if ($dir[strlen($dir) - 1] != '/') { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ($is_certificate_mode) { |
|
|
|
|
$document_id = DocumentManager::get_document_id(api_get_course_info(), '/certificates'); |
|
|
|
|
$document_data = DocumentManager::get_document_data_by_id($document_id, api_get_course_id(), true); |
|
|
|
|
$document_id = DocumentManager::get_document_id( |
|
|
|
|
api_get_course_info(), |
|
|
|
|
'/certificates' |
|
|
|
|
); |
|
|
|
|
$document_data = DocumentManager::get_document_data_by_id( |
|
|
|
|
$document_id, |
|
|
|
|
api_get_course_id(), |
|
|
|
|
true |
|
|
|
|
); |
|
|
|
|
$folder_id = $document_data['id']; |
|
|
|
|
$dir = '/certificates/'; |
|
|
|
|
} |
|
|
|
@ -165,7 +171,6 @@ if ($relative_url == '') { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$is_allowed_to_edit = api_is_allowed_to_edit(null, true); |
|
|
|
|
|
|
|
|
|
$editorConfig = array( |
|
|
|
|
'ToolbarSet' => ($is_allowed_to_edit ? 'Documents' : 'DocumentsStudent'), |
|
|
|
|
'Width' => '100%', |
|
|
|
@ -240,6 +245,7 @@ if (isset($group_properties)) { |
|
|
|
|
|
|
|
|
|
$select_cat = isset($_GET['selectcat']) ? intval($_GET['selectcat']) : null; |
|
|
|
|
$curDirPath = isset($_GET['curdirpath']) ? Security::remove_XSS($_GET['curdirpath']) : null; |
|
|
|
|
|
|
|
|
|
// Create a new form |
|
|
|
|
$form = new FormValidator( |
|
|
|
|
'create_document', |
|
|
|
@ -292,14 +298,29 @@ function document_exists($filename) |
|
|
|
|
|
|
|
|
|
// Add group to the form |
|
|
|
|
if ($is_certificate_mode) { |
|
|
|
|
$form->addText('title', get_lang('CertificateName'), true, array('cols-size' => [2, 10, 0], 'autofocus')); |
|
|
|
|
$form->addText( |
|
|
|
|
'title', |
|
|
|
|
get_lang('CertificateName'), |
|
|
|
|
true, |
|
|
|
|
array('cols-size' => [2, 10, 0], 'autofocus') |
|
|
|
|
); |
|
|
|
|
} else { |
|
|
|
|
$form->addText('title', get_lang('Title'), true, array('cols-size' => [2, 10, 0], 'autofocus')); |
|
|
|
|
$form->addText( |
|
|
|
|
'title', |
|
|
|
|
get_lang('Title'), |
|
|
|
|
true, |
|
|
|
|
array('cols-size' => [2, 10, 0], 'autofocus') |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Show read-only box only in groups |
|
|
|
|
if (!empty($groupId)) { |
|
|
|
|
$group[] = $form->createElement('checkbox', 'readonly', '', get_lang('ReadOnly')); |
|
|
|
|
$group[] = $form->createElement( |
|
|
|
|
'checkbox', |
|
|
|
|
'readonly', |
|
|
|
|
'', |
|
|
|
|
get_lang('ReadOnly') |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
$form->addRule('title', get_lang('ThisFieldIsRequired'), 'required'); |
|
|
|
|
$form->addRule('title', get_lang('FileExists'), 'callback', 'document_exists'); |
|
|
|
@ -349,7 +370,9 @@ if (!$is_certificate_mode && |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
// Admin setting for Hide/Show the folders of all users |
|
|
|
|
if (api_get_setting('show_users_folders') == 'false' && (strstr($val, '/shared_folder') || strstr($val, 'shared_folder_session_'))) { |
|
|
|
|
if (api_get_setting('show_users_folders') == 'false' && |
|
|
|
|
(strstr($val, '/shared_folder') || strstr($val, 'shared_folder_session_')) |
|
|
|
|
) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
// Admin setting for Hide/Show Default folders to all users |
|
|
|
@ -506,7 +529,6 @@ if ($form->validate()) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ($fp = @fopen($filepath.$filename.'.'.$extension, 'w')) { |
|
|
|
|
|
|
|
|
|
$content = str_replace( |
|
|
|
|
api_get_path(WEB_COURSE_PATH), |
|
|
|
|
api_get_configuration_value('url_append').api_get_path(REL_COURSE_PATH), |
|
|
|
|