Exemplo n.º 1
0
 public function build()
 {
     $output = "";
     if (parent::build() === false) {
         return;
     }
     switch ($this->status) {
         case "disabled":
         case "show":
             if ($this->type == 'hidden' || $this->value == "") {
                 $output = "";
             } elseif (!isset($this->value)) {
                 $output = $this->layout['null_label'];
             } else {
                 $output = nl2br(htmlspecialchars($this->value));
             }
             $output = "<div class='help-block'>" . $output . "&nbsp;</div>";
             break;
         case "create":
         case "modify":
             $output = Form::textarea($this->name, $this->value, $this->attributes);
             break;
         case "hidden":
             $output = Form::hidden($this->name, $this->value);
             break;
         default:
     }
     $this->output = "\n" . $output . "\n" . $this->extra_output . "\n";
 }
Exemplo n.º 2
0
 public function build()
 {
     $output = "";
     if (parent::build() === false) {
         return;
     }
     switch ($this->status) {
         case "disabled":
         case "show":
             if ($this->type == 'hidden' || $this->value == "") {
                 $output = "";
             } elseif (!isset($this->value)) {
                 $output = $this->layout['null_label'];
             } else {
                 $output = nl2br(htmlspecialchars($this->value));
             }
             $output = "<div class='help-block'>" . $output . "&nbsp;</div>";
             break;
         case "create":
         case "modify":
             Rapyd::js('redactor/jquery.browser.min.js');
             Rapyd::js('redactor/redactor.min.js');
             Rapyd::css('redactor/css/redactor.css');
             $output = Form::textarea($this->name, $this->value, $this->attributes);
             Rapyd::script("\$('#" . $this->name . "').redactor();");
             break;
         case "hidden":
             $output = Form::hidden($this->name, $this->value);
             break;
         default:
     }
     $this->output = "\n" . $output . "\n" . $this->extra_output . "\n";
 }
Exemplo n.º 3
0
 /**
  * Render html of field.
  *
  * @return string
  */
 public function render()
 {
     $attrs = array();
     $id = $this->getHtmlId();
     $name = $this->getHtmlName();
     $value = $this->getValue();
     $label = $this->getLabel();
     $cssClass = 'ckeditor dynamic-editor';
     $errorMessage = '';
     $attrs['id'] = $id;
     if (!$this->isValid) {
         $errorMessage = sprintf("<span class='error'>%s</span>", $this->getErrorMessage());
         $cssClass .= ' error';
     }
     $defaultValue = $this->getOption('default_value');
     if (!strlen($value)) {
         $value = $defaultValue;
     }
     if ($this->getOption('required') == 'true') {
         $cssClass .= ' required';
     }
     $attrs['rows'] = 4;
     if ($this->getOption('rows')) {
         $attrs['rows'] = $this->getOption('rows');
     }
     $attrs['class'] = $cssClass;
     $html = '';
     if (!empty($label)) {
         $html .= FormFacade::label($label);
     }
     $html .= FormFacade::textarea($name, $value, $attrs) . $errorMessage;
     $html = sprintf($this->htmlItemTemplate, $html);
     return $html;
 }
Exemplo n.º 4
0
 public function build()
 {
     $output = "";
     if (parent::build() === false) {
         return;
     }
     switch ($this->status) {
         case "disabled":
         case "show":
             if ($this->type == 'hidden' || $this->value == "") {
                 $output = "";
             } elseif (!isset($this->value)) {
                 $output = $this->layout['null_label'];
             } else {
                 $output = nl2br(htmlspecialchars($this->value));
             }
             $output = "<div class='help-block'>" . $output . "&nbsp;</div>";
             break;
         case "create":
         case "modify":
             Rapyd::js('tinymce/tinymce.min.js');
             Rapyd::js('tinymce/tinymce_editor.js');
             $output = Form::textarea($this->name, $this->value, $this->attributes);
             Rapyd::script("function elFinderBrowser (field_name, url, type, win) {" . "tinymce.activeEditor.windowManager.open({" . "file: '" . route('elfinder.tinymce4') . "'," . "title: 'elFinder 2.0'," . "width: 900," . "height: 450," . "resizable: 'yes'" . "}, {" . "setUrl: function (url) {" . "win.document.getElementById(field_name).value = url;" . "}" . "});" . "return false;" . "}");
             Rapyd::script("tinymce.init({selector: '#" . $this->name . "', file_browser_callback : elFinderBrowser, plugins: 'image', convert_urls: false});");
             break;
         case "hidden":
             $output = Form::hidden($this->name, $this->value);
             break;
         default:
     }
     $this->output = "\n" . $output . "\n" . $this->extra_output . "\n";
 }
Exemplo n.º 5
0
 protected function renderEditable() : string
 {
     return FormFacade::textarea($this->elementName(), $this->getCurrentValue(), ['id' => $this->elementId(), 'class' => 'form-control']);
 }