*/ require_once __DIR__.'/../inc/global.inc.php'; $form_style = ''; $htmlHeadXtra[] = ''; $htmlHeadXtra[] = ''; $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('OogieUnknownError'); } } } else { $errorMessage = get_lang('WoogieBadExtension'); } } } 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("Doc")]; $nameTools = get_lang("WoogieConversionPowerPoint"); Display :: display_header($nameTools); echo ''.get_lang("WelcomeWoogieSubtitle").'
'; $message = get_lang("WelcomeWoogieConverter"); echo '
'; $s_style = "border-width: 1px; border-style: solid; margin-left: 0; margin-top: 10px; margin-bottom: 0px; min-height: 30px; padding: 5px; position: relative; width: 500px; background-color: #E5EDF9; border-color: #4171B5; color: #000;"; $s_style_error = "border-width: 1px; border-style: solid; margin-left: 0; margin-top: 10px; margin-bottom: 10px; min-height: 30px; padding: 5px; position: relative; width: 500px; background-color: #FFD1D1; border-color: #FF0000; color: #000;"; echo '
'.$alt_text.'
'.$message.'
'; if (!empty($errorMessage)) { echo '
'.$alt_text.'
'.$errorMessage.'
'; } $form = new FormValidator('update_course', 'POST', '', '', 'style="margin: 0;"'); // build the form $form -> addElement('html', '
'); $div_upload_limit = '  '.get_lang('UploadMaxSize').' : '.ini_get('post_max_size'); $renderer = $form->defaultRenderer(); // set template for user_file element $user_file_template = << * {label}{element}$div_upload_limit
{error} EOT; $renderer->setElementTemplate($user_file_template, 'user_file'); // set template for other elements $user_file_template = << * {label}{element}
{error} EOT; $renderer->setCustomElementTemplate($user_file_template); $form->addElement('file', 'user_file', Display::return_icon('word_big.gif')); if (api_get_setting('search_enabled') === 'true') { $form->addElement('checkbox', 'index_document', '', get_lang('SearchFeatureDoIndexDocument')); $form->addElement('html', '
'); $form->addElement( 'html', get_lang( 'SearchFeatureDocumentLanguage' ).':          '.api_get_languages_combo() ); $form->addElement('html', '
'); foreach ($specific_fields as $specific_field) { $form->addElement('text', $specific_field['code'], $specific_field['name'].' : '); } $form->addElement('html', '
'); } /* * commented because SplitStepsPerChapter is not stable at all * $form -> addElement ('radio', 'split_steps',null, get_lang('SplitStepsPerPage'),'per_page'); * $form -> addElement ('radio', 'split_steps',null, get_lang('SplitStepsPerChapter'),'per_chapter'); */ $form->addElement('hidden', 'split_steps', 'per_page'); $form->addElement('submit', 'convert', get_lang('ConvertToLP'), 'class="convert_button"'); $form->addElement('hidden', 'woogie', 'true'); $form->addProgress(); $defaults = ['split_steps'=>'per_page', 'index_document'=>'checked="checked"']; $form -> setDefaults($defaults); // display the form $form -> display(); Display::display_footer();