PATH:
home
/
letacommog
/
letaweb
/
protected
/
extensions
/
yiibooster
/
widgets
<?php /** *## TbDateTimePicker widget class * * @author: Hrumpa * @copyright * @license [New BSD License](http://www.opensource.org/licenses/bsd-license.php) */ Yii::import('booster.widgets.TbBaseInputWidget'); /** * Bootstrap DateTimePicker widget * @see http://www.malot.fr/bootstrap-datetimepicker/ * * @package booster.widgets.forms.inputs */ class TbDateTimePicker extends TbBaseInputWidget { /** * @var TbActiveForm when created via TbActiveForm. * This attribute is set to the form that renders the widget * @see TbActionForm->inputRow */ public $form; /** * @var array the options for the Bootstrap JavaScript plugin. */ public $options = array(); /** * @var string[] the JavaScript event handlers. */ public $events = array(); /** *### .init() * * Initializes the widget. */ public function init() { parent::init(); $this->htmlOptions['type'] = 'text'; $this->htmlOptions['autocomplete'] = 'off'; if (!isset($this->options['language'])) { $this->options['language'] = substr(Yii::app()->getLanguage(), 0, 2); } } /** *### .run() * * Runs the widget. */ public function run() { list($name, $id) = $this->resolveNameID(); if ($this->hasModel()) { if ($this->form) { echo $this->form->textField($this->model, $this->attribute, $this->htmlOptions); } else { echo CHtml::activeTextField($this->model, $this->attribute, $this->htmlOptions); } } else { echo CHtml::textField($name, $this->value, $this->htmlOptions); } $this->registerClientScript(); $this->registerLanguageScript(); $options = !empty($this->options) ? CJavaScript::encode($this->options) : ''; ob_start(); echo "jQuery('#{$id}').datetimepicker({$options})"; foreach ($this->events as $event => $handler) { echo ".on('{$event}', " . CJavaScript::encode($handler) . ")"; } Yii::app()->getClientScript()->registerScript(__CLASS__ . '#' . $this->getId(), ob_get_clean() . ';'); } /** *### .registerClientScript() * * Registers required client script for bootstrap datepicker. It is not used through bootstrap->registerPlugin * in order to attach events if any */ public function registerClientScript() { Booster::getBooster()->registerPackage('datetimepicker'); } public function registerLanguageScript() { if (isset($this->options['language']) && $this->options['language'] != 'en') { $file = 'locales/bootstrap-datetimepicker.' . $this->options['language'] . '.js'; $booster = Booster::getBooster(); if (@file_exists(Yii::getPathOfAlias('booster.assets.bootstrap-datetimepicker') . '/js/' . $file)) { if ($booster->enableCdn) { // Not in CDN yet $booster->registerAssetJs('../bootstrap-datetimepicker/' . '/js/' . $file); } else { $booster->registerAssetJs('../bootstrap-datetimepicker/' . '/js/' . $file); } } } } }
[+]
..
[-] TbTabView.php
[edit]
[-] TbNavbar.php
[edit]
[-] TbHighCharts.php
[edit]
[-] TbPager.php
[edit]
[-] TbLabel.php
[edit]
[-] TbActiveForm.php
[edit]
[-] TbPanel.php
[edit]
[-] TbJsonButtonColumn.php
[edit]
[-] TbModalManager.php
[edit]
[-] TbToggleColumn.php
[edit]
[-] TbUiLayout.php
[edit]
[-] TbBaseMenu.php
[edit]
[-] widgets.md
[edit]
[-] TbEditableDetailView.php
[edit]
[-] TbButtonGroup.php
[edit]
[-] TbEditable.php
[edit]
[-] TbFileUpload.php
[edit]
[-] TbEditableField.php
[edit]
[-] TbTags.php
[edit]
[-] TbFormButtonElement.php
[edit]
[-] TbFormInputElement.php
[edit]
[-] TbJsonPager.php
[edit]
[-] TbCollapse.php
[edit]
[-] TbBulkActions.php
[edit]
[-] TbRelationalColumn.php
[edit]
[-] TbTabs.php
[edit]
[-] TbModal.php
[edit]
[-] TbExtendedGridView.php
[edit]
[-] TbJumbotron.php
[edit]
[-] TbImageGallery.php
[edit]
[-] TbWidget.php
[edit]
[-] TbMenu.php
[edit]
[-] TbProgress.php
[edit]
[-] TbButtonColumn.php
[edit]
[-] TbJsonToggleColumn.php
[edit]
[-] TbJsonPickerColumn.php
[edit]
[-] TbColorPicker.php
[edit]
[-] TbButtonGroupColumn.php
[edit]
[-] TbSwitch.php
[edit]
[-] TbHeroUnit.php
[edit]
[-] TbDatePicker.php
[edit]
[-] TbJsonCheckBoxColumn.php
[edit]
[-] TbButton.php
[edit]
[-] TbTypeahead.php
[edit]
[-] TbForm.php
[edit]
[-] TbPassfield.php
[edit]
[-] TbEditableColumn.php
[edit]
[-] TbMarkdownEditorJs.php
[edit]
[-] TbPopoverColumn.php
[edit]
[-] TbMarkdownEditor.php
[edit]
[-] TbAlert.php
[edit]
[-] TbGroupGridView.php
[edit]
[-] TbBaseInputWidget.php
[edit]
[-] TbWizard.php
[edit]
[-] TbGroupButtonColumn.php
[edit]
[-] TbExtendedFilter.php
[edit]
[-] TbGoogleVisualizationChart.php
[edit]
[-] TbHtml5Editor.php
[edit]
[-] TbGridView.php
[edit]
[-] TbListView.php
[edit]
[-] TbTimePicker.php
[edit]
[-] TbJsonGridView.php
[edit]
[-] TbCKEditor.php
[edit]
[-] TbTotalSumColumn.php
[edit]
[-] TbDateRangePicker.php
[edit]
[-] TbBadge.php
[edit]
[-] TbDropdown.php
[edit]
[-] TbBreadcrumbs.php
[edit]
[-] TbJsonGridColumn.php
[edit]
[-] TbDateTimePicker.php
[edit]
[-] TbDataColumn.php
[edit]
[-] TbCarousel.php
[edit]
[-] TbJsonDataColumn.php
[edit]
[-] TbRedactorJs.php
[edit]
[-] TbThumbnails.php
[edit]
[-] TbScrollSpy.php
[edit]
[-] TbDetailView.php
[edit]
[+]
input
[-] TbSelect2.php
[edit]
[-] TbImageColumn.php
[edit]