12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- <?php
- require_once '../inc/global.inc.php';
- $document_id = $_GET['id'];
- $courseCode = api_get_course_id();
- if ($document_id) {
- $document_data = DocumentManager::get_document_data_by_id($document_id, $courseCode);
- if (empty($document_data)) {
- api_not_allowed();
- }
- } else {
- api_not_allowed();
- }
- $is_visible = DocumentManager::check_visibility_tree($document_id, api_get_course_id(), api_get_session_id(), api_get_user_id(), api_get_group_id());
- if (!api_is_allowed_to_edit() && !$is_visible) {
- api_not_allowed(true);
- }
- $header_file = $document_data['path'];
- $pathinfo = pathinfo($header_file);
- $show_web_odf = false;
- $web_odf_supported_files = DocumentManager::get_web_odf_extension_list();
- if (in_array(strtolower($pathinfo['extension']), $web_odf_supported_files)) {
- $show_web_odf = true;
- }
- $file_url_web = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document'.$header_file;
- if ($show_web_odf) {
-
- $htmlHeadXtra[] = api_get_js('wodotexteditor/wodotexteditor.js');
- $htmlHeadXtra[] = api_get_js('wodotexteditor/localfileeditor.js');
- $htmlHeadXtra[] = api_get_js('wodotexteditor/FileSaver.js');
-
-
- $htmlHeadXtra[] = '
- <script type="text/javascript" charset="utf-8">
- $(document).ready(function() {
- createEditor("'.$file_url_web.'");
- });
- </script>';
- }
- echo Display::display_header('');
- echo '<div class="actions">';
- echo '<a href="document.php?id='.$parent_id.'">'.Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('DocumentsOverview'),'',ICON_SIZE_MEDIUM).'</a>';
- echo '<a href="edit_document.php?'.api_get_cidreq().'&id='.$document_id.$req_gid.'&origin=editodf">'.Display::return_icon('edit.png',get_lang('Rename').'/'.get_lang('Comments'),'',ICON_SIZE_MEDIUM).'</a>';
- echo '</div>';
- echo '<div id="editorContainer" style="width:100%; height:600px; margin:0px; padding:0px"></div>';
- Display::display_footer();
|