9 public $params = array(
16 'changeMonth' =>
true,
29 'fieldType' => array(
'DATE',
'VARCHAR'),
30 'params' => $this->params,
31 'paramsLabels' => array(
45 if ($value ==
'0000-00-00') $value =
'';
56 return $model->getAttribute($field->varname);
67 if (!isset($htmlOptions[
'size'])) $htmlOptions[
'size'] = 60;
68 if (!isset($htmlOptions[
'maxlength'])) $htmlOptions[
'maxlength'] = (($field->field_size) ? $field->field_size : 10);
69 if (!isset($htmlOptions[
'id'])) $htmlOptions[
'id'] = get_class($model) .
'_' . $field->varname;
71 $id = $htmlOptions[
'id'];
72 $options = $this->params;
76 if (!empty($model->{$field->varname})) {
77 $timestamp = strtotime($model->{$field->varname});
78 if ($timestamp >= 0 && $timestamp !==
false) {
79 $options[
'date'] = $timestamp;
82 if ($widgetParams = CJSON::decode($field->widgetparams)) {
83 $options = array_merge($options, $widgetParams);
85 $options = CJavaScript::encode($options);
87 $cs = Yii::app()->getClientScript();
88 $baseUrl = $cs->getCoreScriptUrl();
89 $cs->registerCssFile($baseUrl .
'/jui/css/' . $this->params[
'ui-theme'] .
'/jquery-ui.css',
'', null,
false);
90 $cs->registerScriptFile($baseUrl .
'/jui/js/jquery-ui.min.js');
92 $cs->registerScriptFile(Yii::app()->getModule(
'user')->getAssetsUrl() .
'/js/jquery.datepickerL10.js');
95 if ($language !=
'en') {
96 $js =
"jQuery('#{$id}').datepickerL10(jQuery.extend({showMonthAfterYear:false}, jQuery.datepicker.regional['{$language}'], $options));";
97 $cs->registerScriptFile($baseUrl .
'/jui/js/jquery-ui-i18n.min.js');
98 }
else $js =
"jQuery('#{$id}').datepickerL10($options);";
100 $cs->registerScript(
'ProfileFieldController' .
'#' . $id, $js);
102 return CHtml::activeTextField($model, $field->varname, $htmlOptions);