Exemplo n.º 1
0
 /**
  * Constructor de la clase
  * @param string|array $caption Texto de la etiqueta
  * @param string $name Nombre del campo
  * @param int $size Longitud del campo
  * @param int $max Longitud m?xima de car?cteres del campo
  * @param string $value Valor por defecto
  * @param bol $password True muestra un campo password
  */
 function __construct($caption, $name = null, $size = 10, $maxlength = 64, $value = '', $password = false, $enabled = true)
 {
     if (is_array($caption)) {
         parent::__construct($caption);
     } else {
         parent::__construct([]);
         $this->setWithDefaults('caption', $caption, '');
         $this->setWithDefaults('name', $name, 'name_error');
         $this->setWithDefaults('size', $size, 10);
         $this->setWithDefaults('maxlength', $maxlength, 64);
         $this->set('value', $value);
     }
     $this->setIfNotSet('type', 'text');
     $this->setIfNotSet('value', '');
 }
Exemplo n.º 2
0
 /**
  * @param string $caption Texto del campo
  * @param string $name Nombre de este campo
  * @param string $width Ancho del campo. Puede ser el valor en formato pixels (300px) o en porcentaje (100%)
  * @param string $height Alto de campo. El valor debe ser pasado en formato pixels (300px).
  * @param string $default Texto incial al cargar el campo. POr defecto se muestra vaco.
  * @param string $type Tipo de Editor. Posibles valores: tiny, html, xoops, simple, markdown
  */
 function __construct($caption, $name = null, $width = '100%', $height = '300px', $default = '', $type = '', $change = 1, $ele = array('op'))
 {
     $rmc_config = RMSettings::cu_settings();
     $tcleaner = TextCleaner::getInstance();
     if (is_array($caption)) {
         parent::__construct($caption);
     } else {
         parent::__construct([]);
         $this->setWithDefaults('caption', $caption, '');
         $this->setWithDefaults('name', $name, '');
         $this->setWithDefaults('id', $tcleaner->sweetstring($name), '');
         $this->setWithDefaults('width', $width, '100%');
         $this->setWithDefaults('height', $height, '300px');
         $this->setWithDefaults('value', isset($_REQUEST[$name]) ? $tcleaner->stripslashes($_REQUEST[$name]) : $tcleaner->stripslashes($default), '');
         $this->setWithDefaults('type', $type, $rmc_config->editor_type);
         $this->setWithDefaults('change', $change, 1);
         $this->setWithDefaults('elements', $ele, array('op'));
     }
     $this->setIfNotSet('type', $type == '' ? $rmc_config->editor_type : $type);
     $this->setIfNotSet('value', '');
 }
Exemplo n.º 3
0
 /**
  * Agregamos nuevos elementos
  * Estos elementos son instanacias de algun elemento de formulario
  * @param RMFormElement $element
  * @param bool $required true = Elemento requerido
  * @param string $css_type Content Type: email,url, etc.
  */
 public function addElement(&$element, $required = false, $css_type = '')
 {
     $element->setForm($this->_name);
     $ret['field'] = $element;
     $ret['class'] = get_class($element);
     if (get_class($element) == 'RMFormEditor') {
         if ($element->getType() == 'tiny') {
             $this->editores[] = $element->getName();
         }
     }
     if ($required) {
         $element->addClass('required');
     }
     if ($css_type != '') {
         $element->addClass($css_type);
     }
     if ($element->getName() != '') {
         $this->_fields[$element->getName()] = $ret;
     } else {
         $this->_fields[] = $ret;
     }
     return $element;
 }