Exemple #1
0
 public static function textarea($name, $value = '', array $attributes = array(), $textMode = 'textarea')
 {
     $control = new TextBox($name, $value, $attributes, $textMode);
     $control->setEscaper(self::$escaper);
     echo $control->render();
 }
Exemple #2
0
 /**
  * Method render
  * @access public
  * @param boolean $ajax_render [default value: false]
  * @return string html code of object Calendar
  * @since 1.0.93
  */
 public function render($ajax_render = false)
 {
     if ($this->live_validation != null) {
         parent::onChangeJs(parent::getOnChangeJs() . "LV_" . $this->getId() . ".validate();");
     }
     $html = parent::render($ajax_render);
     $html .= $this->getJavascriptTagOpen();
     $html .= "\$.datepicker.setDefaults(\$.datepicker.regional[\"" . $_SESSION['lang'] . "\"]);\n";
     $html .= "\$(\"#" . $this->getId() . "\").datepicker({ ";
     if ($this->maxDate != "") {
         $html .= "maxDate: '" . $this->maxDate . "', ";
     }
     if ($this->dateFormat != "") {
         $html .= "dateFormat: '" . $this->dateFormat . "', ";
     }
     if ($this->showButtonPanel) {
         $html .= "showButtonPanel: true, ";
     }
     if ($this->changeMonth) {
         $html .= "changeMonth: true, ";
     }
     if ($this->changeYear) {
         $html .= "changeYear: true, ";
     }
     if ($this->showOtherMonths) {
         $html .= "showOtherMonths: true, ";
     }
     if ($this->selectOtherMonths) {
         $html .= "selectOtherMonths: true, ";
     }
     if ($this->showWeek) {
         $html .= "showWeek: true, ";
     }
     if ($this->firstDay != "") {
         $html .= "firstDay: " . $this->firstDay . ", ";
     } else {
         $html .= "firstDay: 1, ";
     }
     if ($this->numberOfMonths != "") {
         $html .= "numberOfMonths: " . $this->numberOfMonths . ", ";
     }
     if ($this->minDate != -999999999) {
         $html .= "minDate: '";
         if (get_class($this->minDate) == "DateTime") {
             if ($this->dateFormat == "") {
                 $html .= $this->minDate->format("m-d-Y");
             } else {
                 if (array_key_exists($this->dateFormat, $this->dateFormatConvertPhpFormat)) {
                     $html .= $this->minDate->format($this->dateFormatConvertPhpFormat[$this->dateFormat]);
                 } else {
                     $html .= $this->minDate->format($this->dateFormat);
                 }
             }
         } else {
             $html .= $this->minDate;
         }
         $html .= "', ";
     }
     $html .= "showAnim: '" . $this->showAnim . "'";
     if ($this->getPage()->getLanguage() != "en") {
         $html .= ",monthNames: [";
         if (sizeof($this->monthNames) > 0) {
             for ($i = 0; $i < sizeof($this->monthNames); $i++) {
                 if ($i > 0) {
                     $html .= ",";
                 }
                 $html .= "'" . addslashes($this->monthNames[$i]) . "'";
             }
         } else {
             $html .= "'" . addslashes(utf8encode(__(__JANUARY__))) . "', '" . addslashes(utf8encode(__(__FEBRUARY__))) . "', '" . addslashes(utf8encode(__(__MARCH__))) . "', '" . addslashes(utf8encode(__(__APRIL__))) . "', '" . addslashes(utf8encode(__(__MAY__))) . "', '" . addslashes(utf8encode(__(__JUNE__))) . "', '" . addslashes(utf8encode(__(__JULY__))) . "', '" . addslashes(utf8encode(__(__AUGUST__))) . "', '" . addslashes(utf8encode(__(__SEPTEMBER__))) . "', '" . addslashes(utf8encode(__(__OCTOBER__))) . "', '" . addslashes(utf8encode(__(__NOVEMBER__))) . "', '" . addslashes(utf8encode(__(__DECEMBER__))) . "']";
         }
         $html .= ",dayNames: [";
         if (sizeof($this->dayNames) > 0) {
             for ($i = 0; $i < sizeof($this->dayNames); $i++) {
                 if ($i > 0) {
                     $html .= ",";
                 }
                 $html .= "'" . addslashes($this->dayNames[$i]) . "'";
             }
         } else {
             $html .= "'" . addslashes(utf8encode(__(__SUNDAY__))) . "', '" . addslashes(utf8encode(__(__MONDAY__))) . "', '" . addslashes(utf8encode(__(__TUESDAY__))) . "', '" . addslashes(utf8encode(__(__WEDNESDAY__))) . "', '" . addslashes(utf8encode(__(__THURSDAY__))) . "', '" . addslashes(utf8encode(__(__FRIDAY__))) . "', '" . addslashes(utf8encode(__(__SATURDAY__))) . "']";
         }
         $html .= ",monthNamesShort: [";
         if (sizeof($this->monthNamesShort) > 0) {
             for ($i = 0; $i < sizeof($this->monthNamesShort); $i++) {
                 if ($i > 0) {
                     $html .= ",";
                 }
                 $html .= "'" . addslashes($this->monthNamesShort[$i]) . "'";
             }
         } else {
             $html .= "'" . addslashes(utf8encode(substr(__(__JANUARY__), 0, 3))) . "', '" . addslashes(utf8encode(substr(__(__FEBRUARY__), 0, 3))) . "', '" . addslashes(utf8encode(substr(__(__MARCH__), 0, 3))) . "', '" . addslashes(utf8encode(substr(__(__APRIL__), 0, 3))) . "', '" . addslashes(utf8encode(substr(__(__MAY__), 0, 3))) . "', '" . addslashes(utf8encode(substr(__(__JUNE__), 0, 3))) . "', '" . addslashes(utf8encode(substr(__(__JULY__), 0, 3))) . "', '" . addslashes(utf8encode(substr(__(__AUGUST__), 0, 3))) . "', '" . addslashes(utf8encode(substr(__(__SEPTEMBER__), 0, 3))) . "', '" . addslashes(utf8encode(substr(__(__OCTOBER__), 0, 3))) . "', '" . addslashes(utf8encode(substr(__(__NOVEMBER__), 0, 3))) . "', '" . addslashes(utf8encode(substr(__(__DECEMBER__), 0, 3))) . "']";
         }
         $html .= ",dayNamesShort: [";
         if (sizeof($this->dayNamesShort) > 0) {
             for ($i = 0; $i < sizeof($this->dayNamesShort); $i++) {
                 if ($i > 0) {
                     $html .= ",";
                 }
                 $html .= "'" . addslashes($this->dayNamesShort[$i]) . "'";
             }
         } else {
             $html .= "'" . addslashes(utf8encode(substr(__(__SUNDAY__), 0, 3))) . "', '" . addslashes(utf8encode(substr(__(__MONDAY__), 0, 3))) . "', '" . addslashes(utf8encode(substr(__(__TUESDAY__), 0, 3))) . "', '" . addslashes(utf8encode(substr(__(__WEDNESDAY__), 0, 3))) . "', '" . addslashes(utf8encode(substr(__(__THURSDAY__), 0, 3))) . "', '" . addslashes(utf8encode(substr(__(__FRIDAY__), 0, 3))) . "', '" . addslashes(utf8encode(substr(__(__SATURDAY__), 0, 3))) . "']";
         }
         $html .= ",dayNamesMin: [";
         if (sizeof($this->dayNamesMin) > 0) {
             for ($i = 0; $i < sizeof($this->dayNamesMin); $i++) {
                 if ($i > 0) {
                     $html .= ",";
                 }
                 $html .= "'" . addslashes($this->dayNamesMin[$i]) . "'";
             }
         } else {
             $html .= "'" . addslashes(utf8encode(substr(__(__SUNDAY__), 0, 2))) . "', '" . addslashes(utf8encode(substr(__(__MONDAY__), 0, 2))) . "', '" . addslashes(utf8encode(substr(__(__TUESDAY__), 0, 2))) . "', '" . addslashes(utf8encode(substr(__(__WEDNESDAY__), 0, 2))) . "', '" . addslashes(utf8encode(substr(__(__THURSDAY__), 0, 2))) . "', '" . addslashes(utf8encode(substr(__(__FRIDAY__), 0, 2))) . "', '" . addslashes(utf8encode(substr(__(__SATURDAY__), 0, 2))) . "']";
         }
     }
     $html .= "});\n";
     $html .= $this->getJavascriptTagClose();
     return $html;
 }
Exemple #3
0
 /**
  * Method render
  * @access public
  * @param boolean $ajax_render [default value: false]
  * @return string html code of object Editor
  * @since 1.0.36
  */
 public function render($ajax_render = false)
 {
     $html = "";
     if ($this->class_name != "") {
         if (!$ajax_render) {
             $html .= "<div id=\"wsp_editor_" . $this->name . "\">\n";
         }
         $html .= "<textarea name=\"" . $this->getEventObjectName() . "\" id=\"" . $this->name . "\"";
         $html .= " style=\"height:";
         if ($this->height != "") {
             $html .= $this->height;
         } else {
             $html .= "100";
         }
         $html .= "px;width:";
         if ($this->width != "") {
             $html .= $this->width . "px";
         } else {
             $html .= "98%";
         }
         $html .= ";\">";
         if ($this->form_object != null) {
             $hidden_text = new TextBox($this->form_object, "hidden_" . $this->name);
         } else {
             $hidden_text = new TextBox($this->page_object, "hidden_" . $this->name);
         }
         $html .= $this->getValue() . "</textarea>\n";
         $hidden_text->setStyle("display:none;")->forceEmpty();
         $html .= $hidden_text->render() . "\n";
         if (!$ajax_render) {
             $html .= "</div>\n";
             $html .= $this->getJavascriptTagOpen();
             $html .= $this->getCreateEditorJs();
             $html .= $this->getJavascriptTagClose();
             if ($this->live_validation != null) {
                 $html .= $this->live_validation->render();
             }
         } else {
             // For Ajax render: Extract JavaScript from HTML
             $array_ajax_render = extract_javascript($this->live_validation->render());
             for ($i = 1; $i < sizeof($array_ajax_render); $i++) {
                 new JavaScript($array_ajax_render[$i], true);
             }
         }
     }
     $this->object_change = false;
     return $html;
 }