edit_document.php 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. use Chamilo\CoreBundle\Framework\Container;
  4. use Chamilo\CourseBundle\Entity\CDocument;
  5. use ChamiloSession as Session;
  6. /**
  7. * This file allows editing documents.
  8. *
  9. * Based on create_document, this file allows
  10. * - edit name
  11. * - edit comments
  12. * - edit metadata (requires a document table entry)
  13. * - edit html content (only for htm/html files)
  14. *
  15. * For all files
  16. * - show editable name field
  17. * - show editable comments field
  18. * Additionally, for html and text files
  19. * - show RTE
  20. *
  21. * Remember, all files and folders must always have an entry in the
  22. * database, regardless of wether they are visible/invisible, have
  23. * comments or not.
  24. *
  25. * @package chamilo.document
  26. *
  27. * @todo improve script structure (FormValidator is used to display form, but
  28. * not for validation at the moment)
  29. */
  30. require_once __DIR__.'/../inc/global.inc.php';
  31. $groupRights = Session::read('group_member_with_upload_rights');
  32. // Template's javascript
  33. $htmlHeadXtra[] = '
  34. <script>
  35. $(function() {
  36. $(".scrollbar-light").scrollbar();
  37. expandColumnToogle("#hide_bar_template", {
  38. selector: "#template_col",
  39. width: 3
  40. }, {
  41. selector: "#doc_form",
  42. width: 9
  43. });
  44. CKEDITOR.on("instanceReady", function (e) {
  45. showTemplates();
  46. });
  47. });
  48. </script>';
  49. $this_section = SECTION_COURSES;
  50. $lib_path = api_get_path(LIBRARY_PATH);
  51. $course_info = api_get_course_info();
  52. $group_id = api_get_group_id();
  53. $sessionId = api_get_session_id();
  54. $dir = '/';
  55. $currentDirPath = isset($_GET['curdirpath']) ? Security::remove_XSS($_GET['curdirpath']) : null;
  56. $readonly = false;
  57. if (isset($_GET['id'])) {
  58. $document_data = DocumentManager::get_document_data_by_id(
  59. $_GET['id'],
  60. api_get_course_id(),
  61. true,
  62. 0
  63. );
  64. if (!empty($sessionId) && empty($document_data)) {
  65. $document_data = DocumentManager::get_document_data_by_id(
  66. $_REQUEST['id'],
  67. api_get_course_id(),
  68. true,
  69. $sessionId
  70. );
  71. }
  72. $document_id = $document_data['id'];
  73. $file = $document_data['path'];
  74. $parent_id = DocumentManager::get_document_id($course_info, dirname($file));
  75. $dir = dirname($document_data['path']);
  76. $dir_original = $dir;
  77. $doc = basename($file);
  78. $readonly = $document_data['readonly'];
  79. $file_type = $document_data['filetype'];
  80. }
  81. if (empty($document_data)) {
  82. api_not_allowed(true);
  83. }
  84. if (api_is_in_group()) {
  85. $group_properties = GroupManager::get_group_properties($group_id);
  86. }
  87. $is_certificate_mode = DocumentManager::is_certificate_mode($dir);
  88. $em = Database::getManager();
  89. $documentRepository = Container::getDocumentRepository();
  90. /** @var CDocument $document */
  91. $document = $documentRepository->find($document_data['iid']);
  92. //Call from
  93. $call_from_tool = api_get_origin();
  94. $slide_id = isset($_GET['origin_opt']) ? Security::remove_XSS($_GET['origin_opt']) : null;
  95. $file_name = $doc;
  96. $group_document = false;
  97. $_course = api_get_course_info();
  98. $sessionId = api_get_session_id();
  99. $user_id = api_get_user_id();
  100. $doc_tree = explode('/', $file);
  101. $count_dir = count($doc_tree) - 2; // "2" because at the begin and end there are 2 "/"
  102. // Level correction for group documents.
  103. if (!empty($group_properties['directory'])) {
  104. $count_dir = $count_dir > 0 ? $count_dir - 1 : 0;
  105. }
  106. $relative_url = '';
  107. for ($i = 0; $i < ($count_dir); $i++) {
  108. $relative_url .= '../';
  109. }
  110. $editorConfig = [
  111. 'ToolbarSet' => (api_is_allowed_to_edit(null, true) ? 'Documents' : 'DocumentsStudent'),
  112. 'Width' => '100%',
  113. 'Height' => '400',
  114. 'cols-size' => [2, 10, 0],
  115. 'FullPage' => true,
  116. 'InDocument' => true,
  117. 'CreateDocumentDir' => $relative_url,
  118. 'CreateDocumentWebDir' => (empty($group_properties['directory']))
  119. ? api_get_path(WEB_COURSE_PATH).$_course['path'].'/document/'
  120. : api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document'.$group_properties['directory'].'/',
  121. 'BaseHref' => api_get_path(WEB_COURSE_PATH).$_course['path'].'/document'.$dir,
  122. ];
  123. if ($is_certificate_mode) {
  124. $editorConfig['CreateDocumentDir'] = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document/';
  125. $editorConfig['CreateDocumentWebDir'] = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document/';
  126. $editorConfig['BaseHref'] = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document'.$dir;
  127. }
  128. $is_allowed_to_edit = api_is_allowed_to_edit(null, true) || $groupRights ||
  129. DocumentManager::is_my_shared_folder(api_get_user_id(), $dir, $sessionId);
  130. $dbTable = Database::get_course_table(TABLE_DOCUMENT);
  131. $course_id = api_get_course_int_id();
  132. if (!empty($group_id)) {
  133. $interbreadcrumb[] = [
  134. 'url' => api_get_path(WEB_CODE_PATH).'group/group_space.php?'.api_get_cidreq(),
  135. 'name' => get_lang('Group area'),
  136. ];
  137. $group_document = true;
  138. }
  139. if (!$is_certificate_mode) {
  140. $interbreadcrumb[] = [
  141. "url" => api_get_path(WEB_CODE_PATH)."document/document.php?curdirpath=".urlencode($currentDirPath).'&'.api_get_cidreq(),
  142. "name" => get_lang('Documents'),
  143. ];
  144. } else {
  145. $interbreadcrumb[] = [
  146. 'url' => Category::getUrl(),
  147. 'name' => get_lang('Assessments'),
  148. ];
  149. }
  150. if (empty($document_data['parents'])) {
  151. $interbreadcrumb[] = ['url' => '#', 'name' => $document_data['title']];
  152. } else {
  153. foreach ($document_data['parents'] as $document_sub_data) {
  154. if ($document_data['title'] == $document_sub_data['title']) {
  155. continue;
  156. }
  157. $interbreadcrumb[] = ['url' => $document_sub_data['document_url'], 'name' => $document_sub_data['title']];
  158. }
  159. }
  160. if (!($is_allowed_to_edit ||
  161. $groupRights ||
  162. DocumentManager::is_my_shared_folder($user_id, $dir, api_get_session_id()))
  163. ) {
  164. api_not_allowed(true);
  165. }
  166. Event::event_access_tool(TOOL_DOCUMENT);
  167. //TODO:check the below code and his funcionality
  168. if (!api_is_allowed_to_edit()) {
  169. if (DocumentManager::check_readonly($course_info, $user_id, $file)) {
  170. api_not_allowed();
  171. }
  172. }
  173. /*$document_info = api_get_item_property_info(
  174. api_get_course_int_id(),
  175. 'document',
  176. $document_id,
  177. 0
  178. );
  179. // Try to find this document in the session
  180. if (!empty($sessionId)) {
  181. $document_info = api_get_item_property_info(
  182. api_get_course_int_id(),
  183. 'document',
  184. $document_id,
  185. $sessionId
  186. );
  187. }
  188. if (api_is_in_group()) {
  189. $group_properties = GroupManager::get_group_properties($group_id);
  190. GroupManager::allowUploadEdit(
  191. api_get_user_id(),
  192. api_get_course_int_id(),
  193. $group_properties,
  194. $document_info,
  195. true
  196. );
  197. }*/
  198. /* MAIN TOOL CODE */
  199. /* Code to change the comment */
  200. if (isset($_POST['comment'])) {
  201. // Fixing the path if it is wrong
  202. $comment = trim($_POST['comment']);
  203. $title = trim($_POST['title']);
  204. // Just in case see BT#3525
  205. if (empty($title)) {
  206. $title = $document_data['title'];
  207. }
  208. if (empty($title)) {
  209. $title = get_document_title($_POST['filename']);
  210. }
  211. if (!empty($document_id)) {
  212. $linkExists = false;
  213. if ($file_type == 'link') {
  214. $linkExists = DocumentManager::cloudLinkExists($course_info, $file, $_POST['comment']);
  215. }
  216. if (!$linkExists || $linkExists == $document_id) {
  217. $document
  218. ->setTitle($title)
  219. ->setComment($comment)
  220. ;
  221. $em->persist($document);
  222. $em->flush();
  223. if ($file_type != 'link') {
  224. Display::addFlash(Display::return_message(get_lang('Update successful')));
  225. } else {
  226. Display::addFlash(Display::return_message(get_lang('Cloud file link updated.')));
  227. }
  228. } else {
  229. Display::addFlash(Display::return_message(get_lang('This URL already exists'), 'warning'));
  230. }
  231. }
  232. }
  233. if ($is_allowed_to_edit) {
  234. if (isset($_POST['formSent']) && $_POST['formSent'] == 1 && !empty($document_id)) {
  235. $content = isset($_POST['content']) ? trim(str_replace(["\r", "\n"], '', stripslashes($_POST['content']))) : null;
  236. $content = Security::remove_XSS($content, COURSEMANAGERLOWSECURITY);
  237. if ($dir == '/') {
  238. $dir = '';
  239. }
  240. $read_only_flag = isset($_POST['readonly']) ? $_POST['readonly'] : null;
  241. $read_only_flag = empty($read_only_flag) ? 0 : 1;
  242. if ($read_only_flag == 0 && !empty($content)) {
  243. $documentRepository->updateDocumentContent($document, $content);
  244. }
  245. header('Location: document.php?id='.$document_data['parent_id'].'&'.api_get_cidreq().($is_certificate_mode ? '&curdirpath=/certificates&selectcat=1' : ''));
  246. exit;
  247. }
  248. }
  249. // Replace relative paths by absolute web paths (e.g. './' => 'http://www.chamilo.org/courses/ABC/document/')
  250. $content = null;
  251. $extension = null;
  252. $filename = null;
  253. $path_info = pathinfo($document_data['path']);
  254. $filename = $path_info['filename'];
  255. $extension = $path_info['extension'] ?? '';
  256. $em = Database::getManager();
  257. /** @var \Chamilo\CoreBundle\Entity\Resource\ResourceNode $node */
  258. //$node = $em->getRepository('ChamiloCoreBundle:Resource\ResourceNode')->find($document_data['resource_node_id']);
  259. $node = $document->getResourceNode();
  260. if (in_array($extension, ['html', 'htm'])) {
  261. $file = $document->getResourceNode()->getResourceFile();
  262. if ($file) {
  263. $content = $documentRepository->getDocumentContent($document_data['id']);
  264. }
  265. }
  266. // Display the header
  267. $nameTools = get_lang('Edit').': '.Security::remove_XSS($document_data['title']);
  268. Display::display_header($nameTools, 'Doc');
  269. $owner_id = $node->getCreator()->getId();
  270. $last_edit_date = $node->getUpdatedAt();
  271. $createdDate = $node->getCreatedAt();
  272. $groupInfo = GroupManager::get_group_properties(api_get_group_id());
  273. if ($owner_id == api_get_user_id() ||
  274. api_is_platform_admin() ||
  275. $is_allowed_to_edit || GroupManager:: is_user_in_group(
  276. api_get_user_id(),
  277. $groupInfo
  278. )
  279. ) {
  280. $action = api_get_self().'?id='.$document_data['id'].'&'.api_get_cidreq();
  281. if ($is_certificate_mode) {
  282. $action .= '&curdirpath=/certificates&selectcat=1';
  283. }
  284. $form = new FormValidator(
  285. 'formEdit',
  286. 'post',
  287. $action,
  288. null,
  289. ['class' => 'form-vertical']
  290. );
  291. // Form title
  292. $form->addHeader($nameTools);
  293. $key_label_title = $file_type != 'link' ? 'Title' : 'LinkName';
  294. $form->addText(
  295. 'title',
  296. get_lang($key_label_title),
  297. true,
  298. ['cols-size' => [2, 10, 0], 'autofocus']
  299. );
  300. $defaults['title'] = $document_data['title'];
  301. $read_only_flag = isset($_POST['readonly']) ? $_POST['readonly'] : null;
  302. // Desactivation of IE proprietary commenting tags inside the text before loading it on the online editor.
  303. // This fix has been proposed by Hubert Borderiou, see Bug #573, http://support.chamilo.org/issues/573
  304. $defaults['content'] = str_replace('<!--[', '<!-- [', $content);
  305. // HotPotatoes tests are html files, but they should not be edited in order their functionality to be preserved.
  306. $showSystemFolders = api_get_course_setting('show_system_folders');
  307. $condition = stripos($dir, '/HotPotatoes_files') === false;
  308. if ($showSystemFolders == 1) {
  309. $condition = true;
  310. }
  311. if (($extension == 'htm' || $extension == 'html') && $condition) {
  312. if (empty($readonly) && $readonly == 0) {
  313. $form->addHtmlEditor('content', get_lang('Content'), true, true, $editorConfig);
  314. }
  315. }
  316. if (!empty($createdDate)) {
  317. $form->addLabel(get_lang('Created on'), Display::dateToStringAgoAndLongDate($createdDate));
  318. }
  319. if ($file_type != 'link') {
  320. if (!$group_document && !DocumentManager::is_my_shared_folder(api_get_user_id(), $currentDirPath, $sessionId)) {
  321. $form->addLabel(get_lang('Update successfulOn'), Display::dateToStringAgoAndLongDate($last_edit_date));
  322. }
  323. if (!empty($document_info['insert_user_id'])) {
  324. $insertByUserInfo = api_get_user_info($document_info['insert_user_id']);
  325. if (!empty($insertByUserInfo)) {
  326. $form->addLabel(get_lang('Author'), $insertByUserInfo['complete_name_with_message_link']);
  327. }
  328. }
  329. }
  330. if ($file_type == 'link') {
  331. // URLs in whitelist
  332. $urlWL = DocumentManager::getFileHostingWhiteList();
  333. sort($urlWL);
  334. //Matches any of the whitelisted urls preceded by // or .
  335. $urlWLRegEx = '/(\/\/|\.)('.implode('|', $urlWL).')/i';
  336. $urlWLText = "\n\t* ".implode("\n\t* ", $urlWL);
  337. $urlWLHTML = "<ul><li>".implode("</li><li>", $urlWL)."</li></ul>";
  338. $form->addText('comment', get_lang('URL'));
  339. $form->addElement(
  340. 'static',
  341. 'info',
  342. '',
  343. '<span class="text-primary" data-toggle="tooltip" title="'.$urlWLHTML.'">'.get_lang(
  344. 'ValidDomainList'
  345. ).' <span class="glyphicon glyphicon-question-sign"></span></span>'
  346. );
  347. } else {
  348. $form->addElement('textarea', 'comment', get_lang('Comment'), ['cols-size' => [2, 10, 0]]);
  349. }
  350. if ($file_type != 'link') {
  351. if ($owner_id == api_get_user_id() || api_is_platform_admin()) {
  352. $checked = &$form->addElement('checkbox', 'readonly', null, get_lang('Read only'));
  353. if ($readonly == 1) {
  354. $checked->setChecked(true);
  355. }
  356. }
  357. }
  358. if ($file_type == 'link') {
  359. $form->addRule('title', get_lang('Please enter a name for this Cloud link'), 'required');
  360. $form->addRule('comment', get_lang('Please enter the URL'), 'required');
  361. // Well formed url pattern (must have the protocol)
  362. $urlRegEx = DocumentManager::getWellFormedUrlRegex();
  363. $form->addRule('comment', get_lang('URL field format invalid. Example of expected format: http://dropbox.com/sh/loremipsum/loremipsum?dl=0'), 'regex', $urlRegEx, 'client');
  364. $form->addRule('comment', get_lang('URL field format invalid. Example of expected format: http://dropbox.com/sh/loremipsum/loremipsum?dl=0'), 'regex', $urlRegEx, 'server');
  365. $form->addRule('comment', get_lang('The domain is not valid. It must be one of the following:').$urlWLText, 'regex', $urlWLRegEx, 'client');
  366. $form->addRule('comment', get_lang('The domain is not valid. It must be one of the following:').$urlWLHTML, 'regex', $urlWLRegEx, 'server');
  367. }
  368. if ($is_certificate_mode) {
  369. $form->addButtonUpdate(get_lang('Save certificate'));
  370. } elseif ($file_type == 'link') {
  371. $form->addButtonUpdate(get_lang('Save link'));
  372. } else {
  373. $form->addButtonUpdate(get_lang('Save document'));
  374. }
  375. $form->addHidden('formSent', 1);
  376. $form->addHidden('filename', $filename);
  377. $defaults['extension'] = $extension;
  378. $defaults['file_path'] = isset($_GET['file']) ? Security::remove_XSS($_GET['file']) : null;
  379. $defaults['commentPath'] = $file;
  380. $defaults['renameTo'] = $file_name;
  381. $defaults['comment'] = $document_data['comment'];
  382. $defaults['origin'] = api_get_origin();
  383. $defaults['origin_opt'] = isset($_GET['origin_opt']) ? Security::remove_XSS($_GET['origin_opt']) : null;
  384. $form->setDefaults($defaults);
  385. show_return(
  386. $parent_id,
  387. $dir_original,
  388. $call_from_tool,
  389. $slide_id,
  390. $is_certificate_mode
  391. );
  392. if ($is_certificate_mode) {
  393. $all_information_by_create_certificate = DocumentManager::get_all_info_to_certificate(
  394. api_get_user_id(),
  395. api_get_course_id()
  396. );
  397. $str_info = '';
  398. foreach ($all_information_by_create_certificate[0] as $info_value) {
  399. $str_info .= $info_value.'<br/>';
  400. }
  401. $create_certificate = get_lang('Create your certificate copy-pasting the following tags. They will be replaced in the document by their student-specific value:');
  402. echo Display::return_message(
  403. $create_certificate.': <br /><br />'.$str_info,
  404. 'normal',
  405. false
  406. );
  407. }
  408. if ($extension == 'svg' && !api_browser_support('svg') &&
  409. api_get_setting('enabled_support_svg') == 'true'
  410. ) {
  411. echo Display::return_message(get_lang('Your browser does not support SVG files. To use the drawing tool you must have an advanced browser such as Firefox or Chrome'), 'warning');
  412. }
  413. if ($file_type != 'link') {
  414. // HTML-editor
  415. echo '<div class="page-create">
  416. <div class="row" style="overflow:hidden">
  417. <div id="template_col" class="col-md-3">
  418. <div class="panel panel-default">
  419. <div class="panel-body">
  420. <div id="frmModel" class="items-templates scrollbar-light"></div>
  421. </div>
  422. </div>
  423. </div>
  424. <div id="doc_form" class="col-md-9">
  425. '.$form->returnForm().'
  426. </div>
  427. </div></div>';
  428. } else {
  429. // Add tooltip and correctly parse its inner HTML
  430. echo '<script>
  431. $(function() {
  432. $("[data-toggle=\'tooltip\']").tooltip(
  433. {
  434. content:
  435. function() {
  436. return $(this).attr("title");
  437. }
  438. }
  439. );
  440. });
  441. </script>';
  442. echo $form->returnForm();
  443. }
  444. }
  445. Display::display_footer();
  446. // return button back to
  447. function show_return($document_id, $path, $call_from_tool = '', $slide_id = 0, $is_certificate_mode = false)
  448. {
  449. $actionsLeft = null;
  450. global $parent_id;
  451. $url = api_get_path(WEB_CODE_PATH).'document/document.php?'.api_get_cidreq().'&id='.$parent_id;
  452. if ($is_certificate_mode) {
  453. $selectedCategory = (isset($_GET['curdirpath']) ? Security::remove_XSS($_GET['curdirpath']) : '');
  454. $actionsLeft .= '<a href="document.php?curdirpath='.$selectedCategory.'&selectcat='.$selectedCategory.'">'.
  455. Display::return_icon('back.png', get_lang('Back').' '.get_lang('To').' '.get_lang('Certificate overview'), '', ICON_SIZE_MEDIUM).'</a>';
  456. $actionsLeft .= '<a id="hide_bar_template" href="#" role="button">'.Display::return_icon('expand.png', get_lang('Expand'), ['id' => 'expand'], ICON_SIZE_MEDIUM).Display::return_icon('contract.png', get_lang('Collapse'), ['id' => 'contract', 'class' => 'hide'], ICON_SIZE_MEDIUM).'</a>';
  457. } elseif ($call_from_tool == 'slideshow') {
  458. /*$actionsLeft .= '<a href="'.api_get_path(WEB_PATH).'main/document/slideshow.php?slide_id='.$slide_id.'&curdirpath='.Security::remove_XSS(urlencode($_GET['curdirpath'])).'">'.
  459. Display::return_icon('slideshow.png', get_lang('Back to').' '.get_lang('View Slideshow'), '', ICON_SIZE_MEDIUM).'</a>';
  460. */
  461. } elseif ($call_from_tool == 'editdraw') {
  462. $actionsLeft .= '<a href="'.$url.'">'.
  463. Display::return_icon('back.png', get_lang('Back to').' '.get_lang('Documents overview'), '', ICON_SIZE_MEDIUM).'</a>';
  464. $actionsLeft .= '<a href="javascript:history.back(1)">'.Display::return_icon('draw.png', get_lang('Back to').' '.get_lang('Draw'), [], 32).'</a>';
  465. } elseif ($call_from_tool == 'editodf') {
  466. $actionsLeft .= '<a href="'.$url.'">'.
  467. Display::return_icon('back.png', get_lang('Back to').' '.get_lang('Documents overview'), '', ICON_SIZE_MEDIUM).'</a>';
  468. $actionsLeft .= '<a href="javascript:history.back(1)">'.Display::return_icon('draw.png', get_lang('Back to').' '.get_lang('Write'), [], 32).'</a>';
  469. $actionsLeft .= '<a id="hide_bar_template" href="#" role="button">'.Display::return_icon('expand.png', get_lang('Expand'), ['id' => 'expand'], ICON_SIZE_MEDIUM).Display::return_icon('contract.png', get_lang('Collapse'), ['id' => 'contract', 'class' => 'hide'], ICON_SIZE_MEDIUM).'</a>';
  470. } elseif ($call_from_tool == 'editpaint' && api_get_setting('enabled_support_pixlr') === 'true') {
  471. $actionsLeft .= '<a href="'.$url.'">'.
  472. Display::return_icon('back.png', get_lang('Back to').' '.get_lang('Documents overview'), [], ICON_SIZE_MEDIUM).'</a>';
  473. $actionsLeft .= '<a href="javascript:history.back(1)">'.Display::return_icon('paint.png', get_lang('Back to').' '.get_lang('Paint'), [], 32).'</a>';
  474. } else {
  475. $actionsLeft .= '<a href="'.$url.'">'.
  476. Display::return_icon('back.png', get_lang('Back to').' '.get_lang('Documents overview'), '', ICON_SIZE_MEDIUM).'</a>';
  477. $actionsLeft .= '<a id="hide_bar_template" href="#" role="button">'.Display::return_icon('expand.png', get_lang('Expand'), ['id' => 'expand'], ICON_SIZE_MEDIUM).Display::return_icon('contract.png', get_lang('Collapse'), ['id' => 'contract', 'class' => 'hide'], ICON_SIZE_MEDIUM).'</a>';
  478. }
  479. echo $toolbar = Display::toolbarAction('actions-documents', [$actionsLeft]);
  480. }