Minor - format code

1.10.x
Julio Montoya 10 years ago
parent bcfcfa30a9
commit 229a838feb
  1. 23
      main/inc/lib/formvalidator/Element/HtmlEditor.php
  2. 14
      main/inc/lib/formvalidator/FormValidator.class.php
  3. 9
      src/Chamilo/CoreBundle/Component/Editor/CkEditor/CkEditor.php

@ -18,11 +18,11 @@ class HtmlEditor extends HTML_QuickForm_textarea
/**
* Class Constructor
* @param string $name
* @param string $elementLabel HTML editor label
* @param string $name
* @param string $elementLabel HTML editor label
* @param array $attributes Attributes for the textarea
* @param array $config Optional configuration settings for the online editor.
* @return bool
* @param array $config Optional configuration settings for the online editor.
*
*/
public function __construct(
$name = null,
@ -57,9 +57,10 @@ class HtmlEditor extends HTML_QuickForm_textarea
if ($this->editor) {
if ($this->editor->getConfigAttribute('fullPage')) {
if (strlen(trim($value)) == 0) {
// TODO: To be considered whether here to be added DOCTYPE, language and character set declarations.
// TODO: To be considered whether here to be added DOCTYPE,
// language and character set declarations.
$value = '<html><head><title></title></head><body></body></html>';
$this->setValue($value);
}
@ -71,12 +72,13 @@ class HtmlEditor extends HTML_QuickForm_textarea
return $this->getFrozenHtml();
} else {
$styleCss = $this->editor->getConfigAttribute('style');
if ($styleCss) {
$style = true;
} else {
$style = false;
}
return $this->buildEditor($style);
}
}
@ -91,6 +93,8 @@ class HtmlEditor extends HTML_QuickForm_textarea
}
/**
* @param bool $style
*
* @return string
*/
public function buildEditor($style = false)
@ -99,12 +103,13 @@ class HtmlEditor extends HTML_QuickForm_textarea
if ($this->editor) {
$this->editor->value = $this->getValue();
$this->editor->setName($this->getName());
if ($style == true) {
$result = $this->editor->createHtmlStyle();
} else {
} else {
$result = $this->editor->createHtml();
}
}
return $result;

@ -213,6 +213,7 @@ EOT;
* @param string $name
* @param string $label
* @param array $attributes
*
* @return mixed
*/
public function addDatePicker($name, $label, $attributes = [])
@ -224,6 +225,7 @@ EOT;
* @param string $name
* @param string $label
* @param array $attributes
*
* @return mixed
*/
public function addDateTimePicker($name, $label, $attributes = [])
@ -348,6 +350,7 @@ EOT;
* @param string $name Element name (for form treatment purposes)
* @param bool $createElement Whether to use the create or add method
* @param array $attributes Additional attributes
*
* @return HTML_QuickForm_button
*/
public function addButtonCreate($label, $name = 'submit', $createElement = false, $attributes = array())
@ -390,6 +393,7 @@ EOT;
* @param string $label Text appearing on the button
* @param string $name Element name (for form treatment purposes)
* @param bool $createElement Whether to use the create or add method
*
* @return HTML_QuickForm_button
*/
public function addButtonDelete($label, $name = 'submit', $createElement = false)
@ -411,6 +415,7 @@ EOT;
* @param string $label Text appearing on the button
* @param string $name Element name (for form treatment purposes)
* @param bool $createElement Whether to use the create or add method
*
* @return HTML_QuickForm_button
*/
public function addButtonSend($label, $name = 'submit', $createElement = false)
@ -562,6 +567,7 @@ EOT;
* @param string $label Text appearing on the button
* @param string $name Element name (for form treatment purposes)
* @param bool $createElement Whether to use the create or add method
*
* @return HTML_QuickForm_button
*/
public function addButtonUpload($label, $name = 'submit', $createElement = false)
@ -583,6 +589,7 @@ EOT;
* @param string $label Text appearing on the button
* @param string $name Element name (for form treatment purposes)
* @param bool $createElement Whether to use the create or add method
*
* @return HTML_QuickForm_button
*/
public function addButtonDownload($label, $name = 'submit', $createElement = false)
@ -604,6 +611,7 @@ EOT;
* @param string $label Text appearing on the button
* @param string $name Element name (for form treatment purposes)
* @param bool $createElement Whether to use the create or add method
*
* @return HTML_QuickForm_button
*/
public function addButtonPreview($label, $name = 'submit', $createElement = false)
@ -625,6 +633,7 @@ EOT;
* @param string $label Text appearing on the button
* @param string $name Element name (for form treatment purposes)
* @param bool $createElement Whether to use the create or add method
*
* @return HTML_QuickForm_button
*/
public function addButtonCopy($label, $name = 'submit', $createElement = false)
@ -745,9 +754,10 @@ EOT;
* Adds a HTML-editor to the form
* @param string $name
* @param string $label The label for the form-element
* @param bool $required (optional) Is the form-element required (default=true)
* @param bool $required (optional) Is the form-element required (default=true)
* @param bool $fullPage (optional) When it is true, the editor loads completed html code for a full page.
* @param array $config (optional) Configuration settings for the online editor.
* @param bool $style
*/
public function addHtmlEditor($name, $label, $required = true, $fullPage = false, $config = array(), $style = false)
{
@ -767,7 +777,7 @@ EOT;
if ($fullPage) {
$config['fullPage'] = true;
}
if ($element->editor) {
$element->editor->processConfig($config);
}

@ -30,19 +30,20 @@ class CkEditor extends Editor
//$jsFolder = api_get_path(WEB_LIBRARY_JS_PATH);
//$this->template->addResource($jsFolder.'ckeditor/ckeditor.js', 'js');
}
/**
* Return the HTML code required to run editor.
*
* @return string
*/
public function createHtml()
{
$html = '<textarea id="'.$this->getName().'" name="'.$this->getName().'" class="ckeditor">
'.$this->value.'
</textarea>';
$html .= $this->editorReplace();
return $html;
}
@ -116,11 +117,11 @@ class CkEditor extends Editor
$image = $template->getImage();
$image = !empty($image) ? $image : 'empty.gif';
$image = $this->urlGenerator->generate(
/*$image = $this->urlGenerator->generate(
'get_document_template_action',
array('file' => $image),
UrlGenerator::ABSOLUTE_URL
);
);*/
$content = str_replace($search, $replace, $template->getContent());

Loading…
Cancel
Save