Fix ckeditor see BT#12999

ofaj
jmontoyaa 9 years ago
parent fe191e225d
commit 45b53b2407
  1. 49
      main/lp/learnpath.class.php
  2. 11
      src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/LearningPathDocuments.php

@ -1,8 +1,8 @@
<?php
/* For licensing terms, see /license.txt */
use Chamilo\CourseBundle\Entity\CLpCategory;
use ChamiloSession as Session;
use Chamilo\CourseBundle\Entity\CLpCategory;
use Chamilo\CourseBundle\Component\CourseCopy\CourseBuilder;
use Chamilo\CourseBundle\Component\CourseCopy\CourseRestorer;
@ -5614,7 +5614,7 @@ class learnpath
// Detect if type is FINAL_ITEM to set path_id to SESSION
if ($arrLP[$i]['item_type'] == TOOL_LP_FINAL_ITEM) {
$_SESSION['pathItem'] = $arrLP[$i]['path'];
Session::write('pathItem', $arrLP[$i]['path']);
}
if (($i % 2) == 0) {
@ -7876,13 +7876,13 @@ class learnpath
}
$editor_config = array(
'ToolbarSet'=> 'LearningPathDocuments',
'Width' => '100%',
'Height' => '500',
'FullPage' => true,
'CreateDocumentDir' => $relative_prefix,
'CreateDocumentWebDir' => api_get_path(WEB_COURSE_PATH) . api_get_course_path().'/document/',
'BaseHref' => api_get_path(WEB_COURSE_PATH) . api_get_course_path().'/document/'.$relative_path
'ToolbarSet' => 'LearningPathDocuments',
'Width' => '100%',
'Height' => '500',
'FullPage' => true,
'CreateDocumentDir' => $relative_prefix,
'CreateDocumentWebDir' => api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/',
'BaseHref' => api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/'.$relative_path
);
if ($_GET['action'] == 'add_item') {
@ -8809,7 +8809,7 @@ class learnpath
$headers = array(
get_lang('Files'),
get_lang('NewDocument'),
get_lang('Upload'),
get_lang('Upload')
);
$form = new FormValidator(
@ -11038,13 +11038,12 @@ EOD;
/**
* Get the LP Final Item form
*
* @return html
* @return string
*/
public function getFinalItemForm()
{
$finalItem = $this->getFinalItem();
$title = '';
$content = '';
if ($finalItem) {
$title = $finalItem->title;
@ -11078,23 +11077,33 @@ EOD;
$form = new FormValidator('final_item', 'POST', $url);
$form->addText('title', get_lang('Title'));
$form->addButtonSave($buttonText);
$form->addHtml('<div class="alert alert-info">Variables :</br></br> <b>((certificate))</b> </br> <b>((skill))</b></div>');
$form->addHtml(
Display::return_message(
'Variables :</br></br> <b>((certificate))</b> </br> <b>((skill))</b>',
'normal',
false
)
);
$renderer = $form->defaultRenderer();
$renderer->setElementTemplate('<div class="editor-lp">&nbsp;{label}{element}</div>', 'content_lp');
$form->addHtmlEditor('content_lp', null, null, true, $editorConfig, true);
$renderer->setElementTemplate('&nbsp;{label}{element}', 'content_lp_certificate');
$form->addHtmlEditor('content_lp_certificate', null, true, false, $editorConfig, true);
$form->addHidden('action', 'add_final_item');
$form->addHidden('path', isset($_SESSION['pathItem']) ? $_SESSION['pathItem'] : '');
$form->addHidden('path', Session::read('pathItem'));
$form->addHidden('previous', $this->get_last());
$form->setDefaults(['title' => $title, 'content_lp' => $content]);
$form->setDefaults(['title' => $title, 'content_lp_certificate' => $content]);
if ($form->validate()) {
$values = $form->exportValues();
$lastItemId = $this->get_last();
if (!$finalItem) {
$documentId = $this->create_document($this->course_info, $values['content_lp'], $values['title']);
$documentId = $this->create_document(
$this->course_info,
$values['content_lp_certificate'],
$values['title']
);
$this->add_item(
0,
$lastItemId,

@ -5,19 +5,18 @@ namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar;
/**
* LearningPathDocuments toolbar configuration
*
*
* @package Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar
*/
class LearningPathDocuments extends Basic
{
/**
* Get the toolbar config
* @return array
*/
public function getConfig()
{
if (api_get_setting('more_buttons_maximized_mode') != 'true') {
if (api_get_setting('more_buttons_maximized_mode') !== 'true') {
$config['toolbar'] = $this->getNormalToolbar();
} else {
$config['toolbar_minToolbar'] = $this->getMinimizedToolbar();
@ -59,7 +58,7 @@ class LearningPathDocuments extends Basic
['BulletedList', 'NumberedList', 'HorizontalRule', '-', 'Outdent', 'Indent', 'Blockquote'],
['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
['Bold', 'Italic', 'Underline', 'Strike', '-', 'Subscript', 'Superscript', '-', 'TextColor', 'BGColor'],
[api_get_setting('allow_spellcheck') == 'true' ? 'Scayt' : ''],
[api_get_setting('allow_spellcheck') === 'true' ? 'Scayt' : ''],
['Styles', 'Format', 'Font', 'FontSize'],
['PageBreak', 'ShowBlocks', 'Source'],
['Toolbarswitch']
@ -118,9 +117,7 @@ class LearningPathDocuments extends Basic
['BulletedList', 'NumberedList', 'HorizontalRule'],
['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
['Toolbarswitch'],
['Styles', 'Format', 'Font', 'FontSize', 'Bold', 'Italic', 'Underline', 'TextColor', 'BGColor', 'Source'],
['Styles', 'Format', 'Font', 'FontSize', 'Bold', 'Italic', 'Underline', 'TextColor', 'BGColor', 'Source']
];
}
}

Loading…
Cancel
Save