*/
require_once __DIR__.'/../inc/global.inc.php';
$form_style = '';
$htmlHeadXtra[] = $form_style;
if (api_get_setting('search_enabled') == 'true') {
$specific_fields = get_specific_field_list();
}
if (isset($_POST['convert'])) {
$cwdir = getcwd();
if (isset($_FILES['user_file'])) {
$allowed_extensions = ['doc', 'docx', 'odt', 'txt', 'sxw', 'rtf'];
if (in_array(strtolower(pathinfo($_FILES['user_file']['name'], PATHINFO_EXTENSION)), $allowed_extensions)) {
require '../lp/lp_upload.php';
if (isset($o_doc) && $first_item_id != 0) {
// Search-related section
if (api_get_setting('search_enabled') == 'true') {
require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php';
$specific_fields = get_specific_field_list();
foreach ($specific_fields as $specific_field) {
$values = explode(',', trim($_POST[$specific_field['code']]));
if (!empty($values)) {
foreach ($values as $value) {
$value = trim($value);
if (!empty($value)) {
add_specific_field_value(
$specific_field['id'],
api_get_course_id(),
TOOL_LEARNPATH,
$o_doc->lp_id,
$value
);
}
}
}
}
} //end of search-related section
header('Location: ../lp/lp_controller.php?'.api_get_cidreq().'&lp_id='.$o_doc->lp_id.'&action=view_item&id='.$first_item_id);
} else {
if (!empty($o_doc->error)) {
$errorMessage = $o_doc->error;
} else {
$errorMessage = get_lang('The conversion failed for an unknown reason.
Please contact your administrator to get more information.');
}
}
} else {
$errorMessage = get_lang('Please upload text documents only. Filename extension should be .doc, .docx or .odt');
}
}
}
Event::event_access_tool(TOOL_UPLOAD);
// check access permissions (edit permission is needed to add a document or a LP)
$is_allowed_to_edit = api_is_allowed_to_edit();
if (!$is_allowed_to_edit) {
api_not_allowed(true);
}
$interbreadcrumb[] = ["url" => "../lp/lp_controller.php?action=list", "name" => get_lang("Document")];
$nameTools = get_lang("Woogie : Word conversion");
Display :: display_header($nameTools);
echo ''.
get_lang("MS Word to course converter").'
';
$message = get_lang('Welcome to Woogie Rapid Learning