コード例 #1
0
 protected function _get_input_html(array $params = array())
 {
     if (isset($params['value'])) {
         unset($params['value']);
     }
     $title = $this->_get_title();
     if ((!array_key_exists('placeholder', $params) || !$params['placeholder']) && $this->get_use_title_label() && $title) {
         $params['placeholder'] = $title;
     }
     if ($this->_date_value) {
         $params['value'] = $this->_date_value->format($this->_date_format);
     }
     $style = '';
     if (isset($params['style'])) {
         $params['style'] = String::put_sufix($params['style'], ';') . $style;
     } else {
         $params['style'] = $style;
     }
     $params['style'] = "letter-spacing: 3px; {$params['style']}";
     $attrs_html = self::_get_attr_html($params);
     $datepicker_options = array_merge(array(), self::$_DEFAULT_DATEPICKER_OPTIONS);
     $datepicker_options['format'] = self::_datepicker_format($this->_date_format);
     $datepicker_options['clearBtn'] = $this->_clear_button;
     if ($this->_before_show_day) {
         $datepicker_options[JSHelper::get_avoid_cast_key('beforeShowDay')] = $this->_before_show_day;
     }
     if ($this->_before_show_month) {
         $datepicker_options[JSHelper::get_avoid_cast_key('beforeShowMonth')] = $this->_before_show_month;
     }
     if ($this->_start_date) {
         $datepicker_options['startDate'] = $this->_start_date->format(self::$_START_DATE_FORMAT);
     }
     if ($this->_end_date) {
         $datepicker_options['endDate'] = $this->_end_date->format(self::$_END_DATE_FORMAT);
     }
     $datepicker_options['language'] = 'es';
     $html = "<{$this->_tagname}{$attrs_html} />";
     $html .= new HTMLScriptTag("\$(" . JSHelper::cast_str('#' . $this->_get_id()) . ").datepicker(" . JSHelper::cast_obj($datepicker_options) . ");");
     $html .= new HTMLScriptTag("\$(" . JSHelper::cast_str('#' . $this->_get_id()) . ").mask(" . JSHelper::cast_str($this->_date_mask) . ");");
     return $html;
 }