create_document.php 22 KB

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