create_document.php 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * This file allows creating new html documents with an online WYSIWYG html editor.
  5. *
  6. * @package chamilo.document
  7. */
  8. require_once '../inc/global.inc.php';
  9. $_SESSION['whereami'] = 'document/create';
  10. $this_section = SECTION_COURSES;
  11. $htmlHeadXtra[] = '
  12. <script>
  13. var hide_bar = function() {
  14. $("#template_col").hide();
  15. $("#doc_form").removeClass("col-md-9");
  16. $("#doc_form").addClass("col-md-11");
  17. $("#hide_bar_template").css({"background-image" : \'url("'.Display::returnIconPath('hide2.png').'")\'})
  18. }
  19. $(document).ready(function() {
  20. $(".scrollbar-light").scrollbar();
  21. if ($(window).width() <= 785 ) {
  22. hide_bar();
  23. }
  24. $("#hide_bar_template").click(function() {
  25. $("#template_col").toggleClass("hide");
  26. if ($("#doc_form").is(".col-md-8")) {
  27. $("#doc_form").removeClass("col-md-8");
  28. $("#doc_form").addClass("col-md-11");
  29. } else {
  30. $("#doc_form").removeClass("col-md-11");
  31. $("#doc_form").addClass("col-md-8");
  32. }
  33. $("#hide_bar_template").toggleClass("hide_bar_template_not_hide");
  34. });
  35. CKEDITOR.on("instanceReady", function (e) {
  36. showTemplates();
  37. });
  38. });
  39. $(document).on("change", ".selectpicker", function () {
  40. var dirValue = $(this).val();
  41. $.ajax({
  42. contentType: "application/x-www-form-urlencoded",
  43. data: "dirValue="+dirValue,
  44. url: "' . api_get_path(WEB_AJAX_PATH) . 'document.ajax.php?a=document_destination",
  45. type: "POST",
  46. success: function(response) {
  47. $("[name=\'dirValue\']").val(response)
  48. }
  49. });
  50. });
  51. function setFocus() {
  52. $("#document_title").focus();
  53. }
  54. $(window).load(function () {
  55. setFocus();
  56. });
  57. </script>';
  58. //I'm in the certification module?
  59. $is_certificate_mode = false;
  60. if (isset($_REQUEST['certificate']) && $_REQUEST['certificate'] == 'true') {
  61. $is_certificate_mode = true;
  62. }
  63. if ($is_certificate_mode) {
  64. $nameTools = get_lang('CreateCertificate');
  65. } else {
  66. $nameTools = get_lang('CreateDocument');
  67. }
  68. /* Constants and variables */
  69. $doc_table = Database::get_course_table(TABLE_DOCUMENT);
  70. $course_id = api_get_course_int_id();
  71. $courseCode = api_get_course_id();
  72. $sessionId = api_get_session_id();
  73. $userId = api_get_user_id();
  74. $_course = api_get_course_info();
  75. $groupId = api_get_group_id();
  76. $document_data = array();
  77. if (isset($_REQUEST['id'])) {
  78. $document_data = DocumentManager::get_document_data_by_id(
  79. $_REQUEST['id'],
  80. $courseCode,
  81. true,
  82. 0
  83. );
  84. }
  85. if (!empty($sessionId) && empty($document_data)) {
  86. $document_data = DocumentManager::get_document_data_by_id(
  87. $_REQUEST['id'],
  88. $courseCode,
  89. true,
  90. $sessionId
  91. );
  92. }
  93. if (empty($document_data)) {
  94. if (api_is_in_group()) {
  95. $group_properties = GroupManager::get_group_properties($groupId);
  96. $document_id = DocumentManager::get_document_id($_course, $group_properties['directory']);
  97. $document_data = DocumentManager::get_document_data_by_id($document_id, api_get_course_id());
  98. $dir = $document_data['path'];
  99. $folder_id = $document_data['id'];
  100. } else {
  101. $dir = '/';
  102. $folder_id = 0;
  103. }
  104. } else {
  105. $folder_id = $document_data['id'];
  106. $dir = $document_data['path'];
  107. }
  108. /* MAIN CODE */
  109. // Please, do not modify this dirname formatting
  110. if (strstr($dir, '..')) {
  111. $dir = '/';
  112. }
  113. if ($dir[0] == '.') {
  114. $dir = substr($dir, 1);
  115. }
  116. if ($dir[0] != '/') {
  117. $dir = '/'.$dir;
  118. }
  119. if ($dir[strlen($dir) - 1] != '/') {
  120. $dir .= '/';
  121. }
  122. if ($is_certificate_mode) {
  123. $document_id = DocumentManager::get_document_id(api_get_course_info(), '/certificates');
  124. $document_data = DocumentManager::get_document_data_by_id($document_id, api_get_course_id(), true);
  125. $folder_id = $document_data['id'];
  126. $dir = '/certificates/';
  127. }
  128. $doc_tree = explode('/', $dir);
  129. $count_dir = count($doc_tree) -2; // "2" because at the begin and end there are 2 "/"
  130. if (api_is_in_group()) {
  131. $group_properties = GroupManager::get_group_properties(api_get_group_id());
  132. // Level correction for group documents.
  133. if (!empty($group_properties['directory'])) {
  134. $count_dir = $count_dir > 0 ? $count_dir - 1 : 0;
  135. }
  136. }
  137. $relative_url = '';
  138. for ($i = 0; $i < ($count_dir); $i++) {
  139. $relative_url .= '../';
  140. }
  141. if ($relative_url== '') {
  142. $relative_url = '/';
  143. }
  144. $is_allowed_to_edit = api_is_allowed_to_edit(null, true);
  145. $editorConfig = array(
  146. 'ToolbarSet' => ($is_allowed_to_edit ? 'Documents' : 'DocumentsStudent'),
  147. 'Width' => '100%',
  148. 'Height' => '400',
  149. 'cols-size' => [2, 10, 0],
  150. 'FullPage' => true,
  151. 'InDocument' => true,
  152. 'CreateDocumentDir' => $relative_url,
  153. 'CreateDocumentWebDir' => (empty($group_properties['directory']))
  154. ? api_get_path(WEB_COURSE_PATH).$_course['path'].'/document/'
  155. : api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document'.$group_properties['directory'].'/',
  156. 'BaseHref' => api_get_path(WEB_COURSE_PATH).$_course['path'].'/document'.$dir
  157. );
  158. if ($is_certificate_mode) {
  159. $editorConfig['CreateDocumentDir'] = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document/';
  160. $editorConfig['CreateDocumentWebDir'] = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document/';
  161. $editorConfig['BaseHref'] = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document'.$dir;
  162. }
  163. $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
  164. if (!is_dir($filepath)) {
  165. $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
  166. $dir = '/';
  167. }
  168. $to_group_id = 0;
  169. if (!$is_certificate_mode) {
  170. if (api_is_in_group()) {
  171. $interbreadcrumb[] = array ("url" => "../group/group_space.php?".api_get_cidreq(), "name" => get_lang('GroupSpace'));
  172. $noPHP_SELF = true;
  173. $to_group_id = api_get_group_id();
  174. $path = explode('/', $dir);
  175. if ('/'.$path[1] != $group_properties['directory']) {
  176. api_not_allowed(true);
  177. }
  178. }
  179. $interbreadcrumb[] = array("url" => "./document.php?curdirpath=".urlencode($dir)."&".api_get_cidreq(), "name" => get_lang('Documents'));
  180. } else {
  181. $interbreadcrumb[]= array('url' => '../gradebook/'.$_SESSION['gradebook_dest'], 'name' => get_lang('Gradebook'));
  182. }
  183. if (!$is_allowed_in_course) {
  184. api_not_allowed(true);
  185. }
  186. if (!($is_allowed_to_edit ||
  187. $_SESSION['group_member_with_upload_rights'] ||
  188. DocumentManager::is_my_shared_folder($userId, $dir, api_get_session_id()))
  189. ) {
  190. api_not_allowed(true);
  191. }
  192. /* Header */
  193. Event::event_access_tool(TOOL_DOCUMENT);
  194. $display_dir = $dir;
  195. if (isset($group_properties)) {
  196. $display_dir = explode('/', $dir);
  197. unset($display_dir[0]);
  198. unset($display_dir[1]);
  199. $display_dir = implode('/', $display_dir);
  200. }
  201. $select_cat = isset($_GET['selectcat']) ? intval($_GET['selectcat']) : null;
  202. $curDirPath = isset($_GET['curdirpath']) ? Security::remove_XSS($_GET['curdirpath']) : null;
  203. // Create a new form
  204. $form = new FormValidator(
  205. 'create_document',
  206. 'post',
  207. api_get_self().'?'.api_get_cidreq().'&dir='.Security::remove_XSS(urlencode($dir)).'&selectcat='.$select_cat,
  208. null
  209. );
  210. // form title
  211. $form->addElement('header', $nameTools);
  212. if ($is_certificate_mode) {//added condition for certicate in gradebook
  213. $form->addElement('hidden','certificate','true',array('id'=>'certificate'));
  214. if (isset($_GET['selectcat'])) {
  215. $form->addElement('hidden','selectcat', $select_cat);
  216. }
  217. }
  218. // Hidden element with current directory
  219. $form->addElement('hidden', 'id');
  220. $defaults = array();
  221. $defaults['id'] = $folder_id;
  222. // Filename
  223. $form->addElement('hidden', 'title_edited', 'false', 'id="title_edited"');
  224. /**
  225. * Check if a document width the chosen filename already exists
  226. */
  227. function document_exists($filename)
  228. {
  229. global $dir;
  230. $cleanName = api_replace_dangerous_char($filename);
  231. // No "dangerous" files
  232. $cleanName = disable_dangerous_file($cleanName);
  233. return !DocumentManager::documentExists(
  234. $dir.$cleanName.'.html',
  235. api_get_course_info(),
  236. api_get_session_id(),
  237. api_get_group_id()
  238. );
  239. }
  240. // Add group to the form
  241. if ($is_certificate_mode) {
  242. $form->addText('title', get_lang('CertificateName'), true, array('cols-size' => [2, 10, 0], 'autofocus'));
  243. } else {
  244. $form->addText('title', get_lang('Title'), true, array('cols-size' => [2, 10, 0], 'autofocus'));
  245. }
  246. // Show read-only box only in groups
  247. if (!empty($groupId)) {
  248. $group[]= $form->createElement('checkbox', 'readonly', '', get_lang('ReadOnly'));
  249. }
  250. $form->addRule('title', get_lang('ThisFieldIsRequired'), 'required');
  251. $form->addRule('title', get_lang('FileExists'), 'callback', 'document_exists');
  252. $current_session_id = api_get_session_id();
  253. $form->addHtmlEditor('content','', true, true, $editorConfig, true);
  254. // Comment-field
  255. $folders = DocumentManager::get_all_document_folders($_course, $to_group_id, $is_allowed_to_edit);
  256. // If we are not in the certificates creation, display a folder chooser for the
  257. // new document created
  258. if (!$is_certificate_mode &&
  259. !DocumentManager::is_my_shared_folder($userId, $dir, $current_session_id)
  260. ) {
  261. $folders = DocumentManager::get_all_document_folders($_course, $to_group_id, $is_allowed_to_edit);
  262. //$parent_select = $form->addElement('select', 'curdirpath', array(null, get_lang('DestinationDirectory')));
  263. $parent_select = $form->addSelect('curdirpath', get_lang('DestinationDirectory'),null, array('cols-size' => [2, 10, 0]) );
  264. // Following two conditions copied from document.inc.php::build_directory_selector()
  265. $folder_titles = array();
  266. if (is_array($folders)) {
  267. $escaped_folders = array();
  268. foreach ($folders as $key => & $val) {
  269. // Hide some folders
  270. if ($val=='/HotPotatoes_files' || $val=='/certificates' || basename($val)=='css'){
  271. continue;
  272. }
  273. // Admin setting for Hide/Show the folders of all users
  274. if (api_get_setting('show_users_folders') == 'false' && (strstr($val, '/shared_folder') || strstr($val, 'shared_folder_session_'))){
  275. continue;
  276. }
  277. // Admin setting for Hide/Show Default folders to all users
  278. if (api_get_setting('show_default_folders') == 'false' && ($val=='/images' || $val=='/flash' || $val=='/audio' || $val=='/video' || strstr($val, '/images/gallery') || $val=='/video/flv')){
  279. continue;
  280. }
  281. // Admin setting for Hide/Show chat history folder
  282. if (api_get_setting('show_chat_folder') == 'false' && $val=='/chat_files'){
  283. continue;
  284. }
  285. $escaped_folders[$key] = Database::escape_string($val);
  286. }
  287. $folder_sql = implode("','", $escaped_folders);
  288. $sql = "SELECT * FROM $doc_table
  289. WHERE
  290. c_id = $course_id AND
  291. filetype='folder' AND
  292. path IN ('".$folder_sql."')";
  293. $res = Database::query($sql);
  294. $folder_titles = array();
  295. while ($obj = Database::fetch_object($res)) {
  296. $folder_titles[$obj->path] = $obj->title;
  297. }
  298. }
  299. if (empty($group_dir)) {
  300. $parent_select -> addOption(get_lang('HomeDirectory'), '/');
  301. if (is_array($folders)) {
  302. foreach ($folders as & $folder) {
  303. //Hide some folders
  304. if ($folder=='/HotPotatoes_files' || $folder=='/certificates' || basename($folder)=='css') {
  305. continue;
  306. }
  307. //Admin setting for Hide/Show the folders of all users
  308. if (api_get_setting('show_users_folders') == 'false' &&
  309. (strstr($folder, '/shared_folder') || strstr($folder, 'shared_folder_session_'))
  310. ){
  311. continue;
  312. }
  313. //Admin setting for Hide/Show Default folders to all users
  314. if (api_get_setting('show_default_folders') == 'false' &&
  315. (
  316. $folder == '/images' ||
  317. $folder == '/flash' ||
  318. $folder == '/audio' ||
  319. $folder == '/video' ||
  320. strstr($folder, '/images/gallery') ||
  321. $folder == '/video/flv'
  322. )
  323. ){
  324. continue;
  325. }
  326. //Admin setting for Hide/Show chat history folder
  327. if (api_get_setting('show_chat_folder') == 'false' &&
  328. $folder=='/chat_files'
  329. ){
  330. continue;
  331. }
  332. $selected = (substr($dir,0,-1) == $folder) ? ' selected="selected"' : '';
  333. $path_parts = explode('/', $folder);
  334. $folder_titles[$folder] = cut($folder_titles[$folder], 80);
  335. $space_counter =count($path_parts) - 2;
  336. if ($space_counter > 0) {
  337. $label = str_repeat('&nbsp;&nbsp;&nbsp;', $space_counter).' &mdash; '.$folder_titles[$folder];
  338. } else {
  339. $label = ' &mdash; '.$folder_titles[$folder];
  340. }
  341. $parent_select -> addOption($label, $folder);
  342. if ($selected != '') {
  343. $parent_select->setSelected($folder);
  344. }
  345. }
  346. }
  347. } else {
  348. foreach ($folders as & $folder) {
  349. $selected = (substr($dir,0,-1)==$folder) ? ' selected="selected"' : '';
  350. $label = $folder_titles[$folder];
  351. if ($folder == $group_dir) {
  352. $label = '/ ('.get_lang('HomeDirectory').')';
  353. } else {
  354. $path_parts = explode('/', str_replace($group_dir, '', $folder));
  355. $label = cut($label, 80);
  356. $label = str_repeat('&nbsp;&nbsp;&nbsp;', count($path_parts) - 2).' &mdash; '.$label;
  357. }
  358. $parent_select -> addOption($label, $folder);
  359. if ($selected != '') {
  360. $parent_select->setSelected($folder);
  361. }
  362. }
  363. }
  364. }
  365. $form->addHidden('dirValue', '');
  366. if ($is_certificate_mode) {
  367. $form->addButtonCreate(get_lang('CreateCertificate'));
  368. } else {
  369. $form->addButtonCreate(get_lang('CreateDoc'));
  370. }
  371. $form->setDefaults($defaults);
  372. // If form validates -> save the new document
  373. if ($form->validate()) {
  374. $values = $form->exportValues();
  375. $readonly = isset($values['readonly']) ? 1 : 0;
  376. $values['title'] = trim($values['title']);
  377. if (!empty($values['dirValue'])) {
  378. $dir = $values['dirValue'];
  379. }
  380. if ($dir[strlen($dir) - 1] != '/') {
  381. $dir .= '/';
  382. }
  383. $filepath = $filepath.$dir;
  384. // Setting the filename
  385. $filename = $values['title'];
  386. $filename = addslashes(trim($filename));
  387. $filename = Security::remove_XSS($filename);
  388. $filename = api_replace_dangerous_char($filename);
  389. $filename = disable_dangerous_file($filename);
  390. $filename .= DocumentManager::getDocumentSuffix(
  391. $_course,
  392. api_get_session_id(),
  393. api_get_group_id()
  394. );
  395. // Setting the title
  396. $title = $values['title'];
  397. // Setting the extension
  398. $extension = 'html';
  399. $content = Security::remove_XSS($values['content'], COURSEMANAGERLOWSECURITY);
  400. /*if (strpos($content, '/css/frames.css') == false) {
  401. $content = str_replace('</head>', '<link rel="stylesheet" href="./css/frames.css" type="text/css" /><style> body{margin:50px;}</style></head>', $content);
  402. }*/
  403. // Don't create file with the same name.
  404. if (file_exists($filepath.$filename.'.'.$extension)) {
  405. Display:: display_header($nameTools, 'Doc');
  406. Display:: display_error_message(get_lang('FileExists').' '.$title, false);
  407. Display:: display_footer();
  408. exit;
  409. }
  410. if ($fp = @fopen($filepath.$filename.'.'.$extension, 'w')) {
  411. $content = str_replace(api_get_path(WEB_COURSE_PATH), $_configuration['url_append'].'/courses/', $content);
  412. fputs($fp, $content);
  413. fclose($fp);
  414. chmod($filepath.$filename.'.'.$extension, api_get_permissions_for_new_files());
  415. /*
  416. if (!is_dir($filepath.'css')) {
  417. mkdir($filepath.'css', api_get_permissions_for_new_directories());
  418. $doc_id = add_document($_course, $dir.'css', 'folder', 0, 'css');
  419. api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'FolderCreated', $userId, null, null, null, null, $current_session_id);
  420. api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'invisible', $userId, null, null, null, null, $current_session_id);
  421. }
  422. if (!is_file($filepath.'css/frames.css')) {
  423. // Make a copy of the current css for the new document
  424. copy(api_get_path(SYS_CODE_PATH).'css/'.api_get_setting('stylesheets').'/frames.css', $filepath.'css/frames.css');
  425. $doc_id = add_document($_course, $dir.'css/frames.css', 'file', filesize($filepath.'css/frames.css'), 'frames.css');
  426. api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'DocumentAdded', $userId, null, null, null, null, $current_session_id);
  427. api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'invisible', $userId, null, null, null, null, $current_session_id);
  428. }*/
  429. $file_size = filesize($filepath.$filename.'.'.$extension);
  430. $save_file_path = $dir.$filename.'.'.$extension;
  431. $document_id = add_document(
  432. $_course,
  433. $save_file_path,
  434. 'file',
  435. $file_size,
  436. $title,
  437. null,
  438. $readonly
  439. );
  440. if ($document_id) {
  441. api_item_property_update(
  442. $_course,
  443. TOOL_DOCUMENT,
  444. $document_id,
  445. 'DocumentAdded',
  446. $userId,
  447. $to_group_id,
  448. null,
  449. null,
  450. null,
  451. $current_session_id
  452. );
  453. // Update parent folders
  454. item_property_update_on_folder($_course, $dir, $userId);
  455. $new_comment = isset($_POST['comment']) ? trim($_POST['comment']) : '';
  456. $new_title = isset($_POST['title']) ? trim($_POST['title']) : '';
  457. $new_title = htmlspecialchars($new_title);
  458. if ($new_comment || $new_title) {
  459. $ct = '';
  460. $params = [];
  461. if ($new_comment) {
  462. $params['comment'] = $new_comment;
  463. }
  464. if ($new_title) {
  465. $params['title'] = $new_title;
  466. }
  467. if (!empty($params)) {
  468. Database::update(
  469. $doc_table,
  470. $params,
  471. ['c_id = ? AND id = ?' => [$course_id, $document_id]]
  472. );
  473. }
  474. }
  475. $dir= substr($dir,0,-1);
  476. $selectcat = '';
  477. if (isset($_REQUEST['selectcat']))
  478. $selectcat = "&selectcat=".Security::remove_XSS($_REQUEST['selectcat']);
  479. $certificate_condition = '';
  480. if ($is_certificate_mode) {
  481. $df = DocumentManager::get_default_certificate_id($_course['code']);
  482. if (!isset($df)) {
  483. DocumentManager::attach_gradebook_certificate ($_course['code'],$document_id);
  484. }
  485. $certificate_condition = '&certificate=true&curdirpath=/certificates';
  486. }
  487. header('Location: document.php?'.api_get_cidreq().'&id='.$folder_id.$selectcat.$certificate_condition);
  488. exit();
  489. } else {
  490. Display :: display_header($nameTools, 'Doc');
  491. Display :: display_error_message(get_lang('Impossible'));
  492. Display :: display_footer();
  493. }
  494. } else {
  495. Display :: display_header($nameTools, 'Doc');
  496. Display :: display_error_message(get_lang('Impossible'));
  497. Display :: display_footer();
  498. }
  499. } else {
  500. // Copied from document.php
  501. $dir_array = explode('/', $dir);
  502. $array_len = count($dir_array);
  503. // Breadcrumb for the current directory root path
  504. if (!empty($document_data)) {
  505. if (empty($document_data['parents'])) {
  506. $interbreadcrumb[] = array(
  507. 'url' => '#',
  508. 'name' => $document_data['title']
  509. );
  510. } else {
  511. foreach ($document_data['parents'] as $document_sub_data) {
  512. $interbreadcrumb[] = array(
  513. 'url' => $document_sub_data['document_url'],
  514. 'name' => $document_sub_data['title']
  515. );
  516. }
  517. }
  518. }
  519. Display :: display_header($nameTools, "Doc");
  520. // actions
  521. // link back to the documents overview
  522. if ($is_certificate_mode) {
  523. $actionsLeft = '<a href="document.php?certificate=true&id='.$folder_id.'&selectcat=' . Security::remove_XSS($_GET['selectcat']).'">'.
  524. Display::return_icon('back.png',get_lang('Back').' '.get_lang('To').' '.get_lang('CertificateOverview'),'',ICON_SIZE_MEDIUM).'</a>';
  525. } else {
  526. $actionsLeft = '<a href="document.php?curdirpath='.Security::remove_XSS($dir).'">'.
  527. Display::return_icon('back.png',get_lang('Back').' '.get_lang('To').' '.get_lang('DocumentsOverview'),'',ICON_SIZE_MEDIUM).'</a>';
  528. }
  529. echo $toolbar = Display::toolbarAction('actions-documents', array(0 => $actionsLeft, 1 => ''));
  530. if ($is_certificate_mode) {
  531. $all_information_by_create_certificate = DocumentManager::get_all_info_to_certificate(api_get_user_id(), api_get_course_id());
  532. $str_info = '';
  533. foreach ($all_information_by_create_certificate[0] as $info_value) {
  534. $str_info.=$info_value.'<br/>';
  535. }
  536. $create_certificate = get_lang('CreateCertificateWithTags');
  537. Display::display_normal_message($create_certificate.': <br /><br/>'.$str_info,false);
  538. }
  539. // HTML-editor
  540. echo '<div class="row" style="overflow:hidden">
  541. <div id="template_col" class="col-md-2">
  542. <div class="panel panel-default">
  543. <div class="panel-body">
  544. <div id="frmModel" class="items-templates scrollbar-light"></div>
  545. </div>
  546. </div>
  547. </div>
  548. <div class="col-md-1">
  549. <div id="hide_bar_template"></div>
  550. </div>
  551. <div id="doc_form" class="col-md-9">
  552. '.$form->returnForm().'
  553. </div>
  554. </div>';
  555. Display :: display_footer();
  556. }