XOOPS 2.5.6  Final
 All Classes Namespaces Files Functions Variables Pages
formeditor.php
Go to the documentation of this file.
1 <?php
20 defined('XOOPS_ROOT_PATH') or die('Restricted access');
21 
23 
28 class XoopsFormEditor extends XoopsFormTextArea
29 {
30  var $editor;
31 
42  function XoopsFormEditor($caption, $name, $configs = null, $nohtml = false, $OnFailure = '')
43  {
44  // Backward compatibility: $name -> editor name; $configs['name'] -> textarea field name
45  if (! isset($configs['editor'])) {
46  $configs['editor'] = $name;
47  $name = $configs['name'];
48  // New: $name -> textarea field name; $configs['editor'] -> editor name; $configs['name'] -> textarea field name
49  } else {
50  $configs['name'] = $name;
51  }
52  $this->XoopsFormTextArea($caption, $name);
53  xoops_load('XoopsEditorHandler');
54  $editor_handler = XoopsEditorHandler::getInstance();
55  $this->editor = $editor_handler->get($configs['editor'], $configs, $nohtml, $OnFailure);
56  }
57 
63  function renderValidationJS()
64  {
65  if (is_object($this->editor) && $this->isRequired()) {
66  if (method_exists($this->editor, 'renderValidationJS')) {
67  $this->editor->setName($this->getName());
68  $this->editor->setCaption($this->getCaption());
69  $this->editor->_required = $this->isRequired();
70  $ret = $this->editor->renderValidationJS();
71  return $ret;
72  } else {
73  parent::renderValidationJS();
74  }
75  }
76  return false;
77  }
78 
84  function render()
85  {
86  if (is_object($this->editor)) {
87  return $this->editor->render();
88  }
89  }
90 }
91 
92 ?>