9 Yii::import(
'booster.widgets.TbBaseInputWidget');
44 $this->htmlOptions[
'type'] =
'text';
45 $this->htmlOptions[
'autocomplete'] =
'off';
47 if (!isset($this->options[
'language'])) {
48 $this->options[
'language'] = substr(Yii::app()->getLanguage(), 0, 2);
58 public function run() {
60 list($name, $id) = $this->resolveNameID();
62 if ($this->hasModel()) {
64 echo $this->form->textField($this->model, $this->attribute, $this->htmlOptions);
66 echo CHtml::activeTextField($this->model, $this->attribute, $this->htmlOptions);
70 echo CHtml::textField($name, $this->
value, $this->htmlOptions);
75 $options = !empty($this->options) ? CJavaScript::encode($this->options) :
'';
78 echo
"jQuery('#{$id}').datetimepicker({$options})";
79 foreach ($this->events as $event => $handler) {
80 echo
".on('{$event}', " . CJavaScript::encode($handler) .
")";
83 Yii::app()->getClientScript()->registerScript(__CLASS__ .
'#' . $this->getId(), ob_get_clean() .
';');
100 if (isset($this->options[
'language']) && $this->options[
'language'] !=
'en') {
101 $file =
'locales/bootstrap-datetimepicker.' . $this->options[
'language'] .
'.js';
103 if (@file_exists(Yii::getPathOfAlias(
'booster.assets.bootstrap-datetimepicker') .
'/js/' . $file)) {
104 if ($booster->enableCdn) {
106 $booster->registerAssetJs(
'../bootstrap-datetimepicker/' .
'/js/' . $file);
108 $booster->registerAssetJs(
'../bootstrap-datetimepicker/' .
'/js/' . $file);