create_document.php 21 KB

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