Ejemplo n.º 1
0
 /**
  * FormHandler::editor()
  *
  * Create a editor on the form
  *
  * @param string $title: The title of the field
  * @param string $name: The name of the field
  * @param string $validator: The validator which should be used to validate the value of the field
  * @param string $path: Path on the server where we have to upload the files
  * @param string $toolbar: The toolbar we have to use
  * @param string $skin: The skin to use
  * @param int $width: The width of the field
  * @param int $height: The height of the field
  * @param boolean $useArrayKeyAsValue: If the array key's are the values for the options in the field
  * @param string $extra: CSS, Javascript or other which are inserted into the HTML tag
  * @return void
  * @access public
  * @author Teye Heimans
  */
 function editor($title, $name, $validator = null, $path = null, $toolbar = null, $skin = null, $width = null, $height = null, $config = null)
 {
     require_once FH_INCLUDE_DIR . 'fields/class.TextArea.php';
     require_once FH_INCLUDE_DIR . 'fields/class.Editor.php';
     // create a new editor
     $fld = new Editor($this, $name);
     if (!empty($validator)) {
         $fld->setValidator($validator);
     }
     if (!is_null($path)) {
         $fld->setServerPath($path);
     }
     if (!empty($toolbar)) {
         $fld->setToolbar($toolbar);
     }
     if (!empty($skin)) {
         $fld->setSkin($skin);
     }
     if (!empty($width)) {
         $fld->setWidth($width);
     }
     if (!empty($height)) {
         $fld->setHeight($height);
     }
     if (is_array($config)) {
         $fld->setConfig($config);
     }
     // register the field
     $this->_registerField($name, $fld, $title);
 }
Ejemplo n.º 2
0
 /**
  * A convenience wrapper to create an Editor configuration
  * bean.  Allows for three sizes of editor, SMALL, MEDIUM, and LARGE.
  * If no size is given, it will default to MEDIUM.  Also accepts
  * optional name and content.
  */
 protected function getEditorConfig($size = null, $name = null, $content = null)
 {
     $size_opts = array(EDITOR::SMALL => "150", EDITOR::MEDIUM => "300", EDITOR::LARGE => "400");
     $editor = new Editor();
     $height = $size ? $size_opts[$size] : $size_opts[Editor::MEDIUM];
     $editor->setHeight($height);
     if ($name != null) {
         $editor->setName($name);
     }
     if ($content != null) {
         $editor->setContent($content);
     }
     return $editor;
 }