Пример #1
0
 /**
  *### .init()
  *
  * Initializes the widget.
  */
 public function init()
 {
     parent::init();
     $classes = array('table');
     if (isset($this->type)) {
         if (is_string($this->type)) {
             $this->type = explode(' ', $this->type);
         }
         if (!empty($this->type)) {
             $validTypes = array(self::TYPE_STRIPED, self::TYPE_BORDERED, self::TYPE_CONDENSED, self::TYPE_HOVER);
             foreach ($this->type as $type) {
                 if (in_array($type, $validTypes)) {
                     $classes[] = 'table-' . $type;
                 }
             }
         }
     }
     if (!empty($classes)) {
         $classes = implode(' ', $classes);
         if (isset($this->itemsCssClass)) {
             $this->itemsCssClass .= ' ' . $classes;
         } else {
             $this->itemsCssClass = $classes;
         }
     }
     $booster = Bootstrap::getBooster();
     $popover = $booster->popoverSelector;
     $tooltip = $booster->tooltipSelector;
     $afterAjaxUpdate = "js:function() {\n\t\t\tjQuery('.popover').remove();\n\t\t\tjQuery('{$popover}').popover();\n\t\t\tjQuery('.tooltip').remove();\n\t\t\tjQuery('{$tooltip}').tooltip();\n\t\t}";
     if (!isset($this->afterAjaxUpdate)) {
         $this->afterAjaxUpdate = $afterAjaxUpdate;
     }
 }
Пример #2
0
 /**
  *### .renderHeaderCellContent()
  *
  * Renders the header cell content.
  * This method will render a link that can trigger the sorting if the column is sortable.
  */
 protected function renderHeaderCellContent()
 {
     if ($this->grid->enableSorting && $this->sortable && $this->name !== null) {
         $sort = $this->grid->dataProvider->getSort();
         $label = isset($this->header) ? $this->header : $sort->resolveLabel($this->name);
         $booster = Bootstrap::getBooster();
         if ($sort->resolveAttribute($this->name) !== false) {
             if ($sort->getDirection($this->name) === CSort::SORT_ASC) {
                 $label .= ' <span class="' . ($booster->fontAwesomeCss ? 'fa fa-sort-asc' : 'icon-chevron-down') . '"></span>';
             } elseif ($sort->getDirection($this->name) === CSort::SORT_DESC) {
                 $label .= ' <span class="' . ($booster->fontAwesomeCss ? 'fa fa-sort-desc' : 'icon-chevron-up') . '"></span>';
             } else {
                 $label .= ' ';
             }
         }
         echo $sort->link($this->name, $label, array('class' => 'sort-link'));
     } else {
         if ($this->name !== null && $this->header === null) {
             if ($this->grid->dataProvider instanceof CActiveDataProvider) {
                 echo CHtml::encode($this->grid->dataProvider->model->getAttributeLabel($this->name));
             } else {
                 echo CHtml::encode($this->name);
             }
         } else {
             parent::renderHeaderCellContent();
         }
     }
 }
Пример #3
0
 /**
  * Register required script files
  *
  * @param integer $id
  */
 public function registerClientScript($id)
 {
     $booster = Bootstrap::getBooster();
     $booster->registerAssetCss('markdown.editor.css');
     $booster->registerAssetJs('markdown.converter.js', CClientScript::POS_HEAD);
     $booster->registerAssetJs('markdown.sanitizer.js', CClientScript::POS_HEAD);
     $booster->registerAssetJs('markdown.editor.js', CClientScript::POS_HEAD);
     Yii::app()->clientScript->registerScript($id, "var converter = Markdown.getSanitizingConverter();\n\t\t\tvar editor = new Markdown.Editor(converter, '" . $id . "');\n\t\t\teditor.run();", CClientScript::POS_END);
 }
Пример #4
0
 /**
  *
  */
 public function init()
 {
     Bootstrap::getBooster()->registerPackage('ui-layout');
     if (!is_array($this->options)) {
         $this->options = array();
     }
     if (!is_array($this->htmlOptions)) {
         $this->htmlOptions = array();
     }
 }
Пример #5
0
 /**
  *### .init()
  *
  * Initializes the widget.
  */
 public function init()
 {
     parent::init();
     $booster = Bootstrap::getBooster();
     $popover = $booster->popoverSelector;
     $tooltip = $booster->tooltipSelector;
     $afterAjaxUpdate = "js:function() {\n\t\t\tjQuery('.popover').remove();\n\t\t\tjQuery('{$popover}').popover();\n\t\t\tjQuery('.tooltip').remove();\n\t\t\tjQuery('{$tooltip}').tooltip();\n\t\t}";
     if (!isset($this->afterAjaxUpdate)) {
         $this->afterAjaxUpdate = $afterAjaxUpdate;
     }
 }
Пример #6
0
 /**
  *### .registerClientScript()
  *
  * Registers required
  *
  * @param string $id
  */
 public function registerClientScript($id)
 {
     Bootstrap::getBooster()->registerAssetJs('bootstrap.colorpicker.js', CClientScript::POS_HEAD);
     Bootstrap::getBooster()->registerAssetCss('bootstrap-colorpicker.css');
     $options = !empty($this->format) ? CJavaScript::encode(array('format' => $this->format)) : '';
     ob_start();
     echo "jQuery('#{$id}').colorpicker({$options})";
     foreach ($this->events as $event => $handler) {
         echo ".on('{$event}', " . CJavaScript::encode($handler) . ")";
     }
     Yii::app()->getClientScript()->registerScript(__CLASS__ . '#' . $this->getId(), ob_get_clean() . ';');
 }
Пример #7
0
 public function registerLanguageScript()
 {
     if (isset($this->options['language']) && $this->options['language'] != 'en') {
         $file = 'locales/bootstrap-datetimepicker.' . $this->options['language'] . '.js';
         $booster = Bootstrap::getBooster();
         if (@file_exists(Yii::getPathOfAlias('bootstrap.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);
             }
         }
     }
 }
Пример #8
0
 /**
  * Publishes and registers the necessary script files.
  */
 protected function registerClientScript()
 {
     $assets = Bootstrap::getBooster()->assetsRegistry;
     $assets->registerPackage('highcharts');
     $baseUrl = $assets->packages['highcharts']['baseUrl'];
     $this->options = CMap::mergeArray(array('exporting' => array('enabled' => true)), $this->options);
     if (isset($this->options['exporting']) && @$this->options['exporting']['enabled']) {
         $assets->registerScriptFile($baseUrl . '/modules/exporting.js');
     }
     if (isset($this->options['theme'])) {
         $assets->registerScriptFile($baseUrl . '/themes/' . $this->options['theme'] . '.js');
     }
     $options = CJavaScript::encode($this->options);
     $assets->registerScript(__CLASS__ . '#' . $this->getId(), "var highchart{$this->getId()} = new Highcharts.Chart({$options});");
 }
Пример #9
0
 /**
  * Registers required css and js files
  *
  * @param integer $id the id of the toggle button
  */
 protected function registerClientScript($id)
 {
     $booster = Bootstrap::getBooster();
     $booster->registerPackage('switch');
     $config = CJavaScript::encode($this->options);
     ob_start();
     echo "\$('#{$id}').bootstrapSwitch({$config})";
     foreach ($this->events as $event => $handler) {
         $event = $event . '.bootstrapSwitch';
         if (!$handler instanceof CJavaScriptExpression && strpos($handler, 'js:') === 0) {
             $handler = new CJavaScriptExpression($handler);
         }
         echo ".on('{$event}', " . $handler . ")";
     }
     Yii::app()->clientScript->registerScript(__CLASS__ . '#' . $this->getId(), ob_get_clean() . ';');
 }
Пример #10
0
 public function init()
 {
     $booster = Bootstrap::getBooster();
     $booster->registerAssetCss('bootstrap-image-gallery' . (!YII_DEBUG ? '.min' : '') . '.css');
     $booster->registerAssetJs('fileupload/load-image.min.js');
     $booster->registerAssetJs('bootstrap-image-gallery' . (!YII_DEBUG ? '.min' : '') . '.js');
     if ($this->fullScreen) {
         Yii::app()->clientScript->registerScript($this->id, 'jQuery("#' . $this->id . '").addClass("modal-fullscreen");', CClientScript::POS_READY);
     }
     if (!$this->eventListener) {
         Yii::app()->clientScript->registerScript($this->id, '$(document.body).off(".modal-gallery.data-api");');
     }
     if (!isset($this->htmlOptions['id'])) {
         $this->htmlOptions['id'] = $this->id;
     }
     echo CHtml::openTag('div', CMap::mergeArray(self::$defaultHtmlOptions, $this->htmlOptions));
 }
Пример #11
0
 /**
  * Registers required
  *
  * @param integer $id
  */
 public function registerClientScript($id)
 {
     $booster = Bootstrap::getBooster();
     $booster->registerAssetJs('bootstrap-modalmanager.js', CClientScript::POS_HEAD);
     $booster->registerAssetCss('bootstrap-modalmanager.css');
     $options = !empty($this->format) ? CJavaScript::encode(array('format' => $this->format)) : '';
     ob_start();
     echo "jQuery('#{$id}').modalmanager({$options})";
     foreach ($this->events as $event => $handler) {
         echo ".on('{$event}', " . CJavaScript::encode($handler) . ")";
     }
     Yii::app()->getClientScript()->registerScript(__CLASS__ . '#' . $this->getId(), ob_get_clean() . ';');
     foreach ($this->events as $name => $handler) {
         $handler = CJavaScript::encode($handler);
         Yii::app()->getClientScript()->registerScript(__CLASS__ . '#' . $id . '_' . $name, "jQuery('#{$id}').on('{$name}', {$handler});");
     }
 }
Пример #12
0
 /**
  * Publishes and registers the necessary script files.
  */
 protected function registerClientScript()
 {
     $assets = Bootstrap::getBooster()->assetsRegistry;
     $assets->registerPackage('highcharts');
     $baseUrl = $assets->packages['highcharts']['baseUrl'];
     $this->options = CMap::mergeArray(array('exporting' => array('enabled' => true)), $this->options);
     if (isset($this->options['exporting']) && @$this->options['exporting']['enabled']) {
         $assets->registerScriptFile($baseUrl . '/modules/exporting.js');
     }
     if (isset($this->options['theme'])) {
         $assets->registerScriptFile($baseUrl . '/themes/' . $this->options['theme'] . '.js');
     }
     $options = CJavaScript::encode($this->options);
     $assets->registerScript(__CLASS__ . '#' . $this->getId(), "var highchart{$this->getId()} = new Highcharts.Chart({$options});");
     if ($this->showDisableLegendsButton && !empty($this->disableLegendsButtonSelector)) {
         $assets->registerScript(__CLASS__ . '#' . $this->getId() . '_disableLegendsButton', "\$('{$this->disableLegendsButtonSelector}').on('click', function() {\n                    var series = highchart{$this->getId()}.series;\n                    for(var i = 0; i < series.length; i++) {\n                        \$(series[i].legendItem.element).trigger('click');\n                    }\n                });");
     }
 }
Пример #13
0
 /**
  * Register required script files
  */
 public function registerClientScript()
 {
     $assets = Bootstrap::getBooster()->assetsRegistry;
     $assets->registerPackage('redactor');
     $baseUrl = $assets->packages['redactor']['baseUrl'];
     // Prepend language file to scripts package.
     if ($this->editorOptions['lang'] != 'en') {
         $assets->registerScriptFile($baseUrl . '/lang/' . $this->editorOptions['lang'] . '.js');
     }
     if (isset($this->editorOptions['plugins'])) {
         foreach ($this->editorOptions['plugins'] as $name) {
             $filepath = Yii::getPathOfAlias('bootstrap.assets.redactor.plugins') . '/' . $name . '/' . $name;
             $url = $baseUrl . '/plugins/' . $name . '/' . $name;
             if (file_exists($filepath . '.css')) {
                 $assets->registerCssFile($url . '.css');
             }
             if (file_exists($filepath . '.js')) {
                 $assets->registerScriptFile($url . '.js');
             }
         }
     }
     $options = $this->editorOptions ? CJavaScript::encode($this->editorOptions) : '';
     $assets->registerScript(uniqid(__CLASS__ . '#', true), "jQuery('{$this->selector}').redactor({$options});");
 }
Пример #14
0
 /**
  * Registers required css and js files
  *
  * @param integer $id the id of the toggle button
  */
 protected function registerClientScript($id)
 {
     $cs = Yii::app()->clientScript;
     $cs->registerCoreScript('jquery');
     $booster = Bootstrap::getBooster();
     $booster->registerAssetCss('bootstrap-toggle-buttons.css');
     $booster->registerAssetJs('jquery.toggle.buttons.js');
     $config = CJavaScript::encode($this->getConfiguration());
     $cs->registerScript(__CLASS__ . '#' . $this->getId(), "\$('#wrapper-{$id}').toggleButtons({$config});");
 }
Пример #15
0
 /**
  *### .registerClientScript()
  *
  * Registers required script files (CSS in this case)
  */
 public function registerClientScript()
 {
     Bootstrap::getBooster()->registerAssetCss('bootstrap-box.css');
 }
Пример #16
0
 /**
  *### .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()
 {
     Bootstrap::getBooster()->registerPackage('passfield');
 }
Пример #17
0
 /**
  *### .registerClientScript()
  *
  * Registers required client script for bootstrap select2.
  * It is not used through bootstrap->registerPlugin
  * in order to attach events if any
  *
  * @param string $id
  */
 public function registerClientScript($id)
 {
     $booster = Bootstrap::getBooster();
     $booster->registerAssetCss('bootstrap-tags.css');
     $booster->registerAssetJs('bootstrap.tags.js');
     $options = !empty($this->options) ? CJavaScript::encode($this->options) : '';
     Yii::app()->getClientScript()->registerScript(__CLASS__ . '#' . $this->getId(), "jQuery('#tags_{$id}').tags({$options});");
 }
Пример #18
0
 /**
  *### .registerClientScript()
  *
  * Registers required client script for bootstrap select2. It is not used through bootstrap->registerPlugin
  * in order to attach events if any
  */
 public function registerClientScript($id)
 {
     Bootstrap::getBooster()->registerPackage('select2');
     $options = !empty($this->options) ? CJavaScript::encode($this->options) : '';
     if (!empty($this->val)) {
         if (is_array($this->val)) {
             $data = CJSON::encode($this->val);
         } else {
             $data = $this->val;
         }
         $defValue = ".select2('val', {$data})";
     } else {
         $defValue = '';
     }
     if ($this->readonly) {
         $defValue .= ".select2('readonly', true)";
     } elseif ($this->disabled) {
         $defValue .= ".select2('enable', false)";
     }
     ob_start();
     echo "jQuery('#{$id}').select2({$options}){$defValue}";
     foreach ($this->events as $event => $handler) {
         echo ".on('{$event}', " . CJavaScript::encode($handler) . ")";
     }
     Yii::app()->getClientScript()->registerScript(__CLASS__ . '#' . $this->getId(), ob_get_clean() . ';');
 }
Пример #19
0
 public function registerXEditable()
 {
     Bootstrap::getBooster()->registerPackage('x-editable');
 }
Пример #20
0
    /**
     * Register script that will handle its behavior
     */
    public function registerClientScript()
    {
        Bootstrap::getBooster()->registerAssetCss('bootstrap-relational.css');
        /** @var $cs CClientScript */
        $cs = Yii::app()->getClientScript();
        if ($this->afterAjaxUpdate !== null) {
            if (!$this->afterAjaxUpdate instanceof CJavaScriptExpression && strpos($this->afterAjaxUpdate, 'js:') !== 0) {
                $this->afterAjaxUpdate = new CJavaScriptExpression($this->afterAjaxUpdate);
            }
        } else {
            $this->afterAjaxUpdate = 'js:$.noop';
        }
        $this->ajaxErrorMessage = CHtml::encode($this->ajaxErrorMessage);
        $afterAjaxUpdate = CJavaScript::encode($this->afterAjaxUpdate);
        $span = count($this->grid->columns);
        $loadingPic = CHtml::image(Bootstrap::getBooster()->getAssetsUrl() . '/img/loading.gif');
        $cache = $this->cacheData ? 'true' : 'false';
        $data = !empty($this->submitData) && is_array($this->submitData) ? $this->submitData : 'js:{}';
        $data = CJavascript::encode($data);
        list($parentId) = explode('_', $this->id);
        $js = <<<EOD
\$(document).on('click','#{$parentId} .{$this->cssClass}', function(){
\tvar span = {$span};
\tvar that = \$(this);
\tvar status = that.data('status');
\tvar rowid = that.data('rowid');
\tvar tr = \$('#relatedinfo'+rowid);
\tvar parent = that.parents('tr').eq(0);
\tvar afterAjaxUpdate = {$afterAjaxUpdate};

\tif (status && status=='on'){return}
\tthat.data('status','on');

\tif (tr.length && !tr.is(':visible') && {$cache})
\t{
\t\ttr.slideDown();
\t\tthat.data('status','off');
\t\treturn;
\t}else if (tr.length && tr.is(':visible'))
\t{
\t\ttr.slideUp();
\t\tthat.data('status','off');
\t\treturn;
\t}
\tif (tr.length)
\t{
\t\ttr.find('td').html('{$loadingPic}');
\t\tif (!tr.is(':visible')){
\t\t\ttr.slideDown();
\t\t}
\t}
\telse
\t{
\t\tvar td = \$('<td/>').html('{$loadingPic}').attr({'colspan':{$span}});
\t\ttr = \$('<tr/>').prop({'id':'relatedinfo'+rowid}).append(td);
\t\t/* we need to maintain zebra styles :) */
\t\tvar fake = \$('<tr class="hide"/>').append(\$('<td/>').attr({'colspan':{$span}}));
\t\tparent.after(tr);
\t\ttr.after(fake);
\t}
\tvar data = \$.extend({$data}, {id:rowid});
\t\$.ajax({
\t\turl: '{$this->url}',
\t\tdata: data,
\t\tsuccess: function(data){
\t\t\ttr.find('td').html(data);
\t\t\tthat.data('status','off');
\t\t\tif (\$.isFunction(afterAjaxUpdate))
\t\t\t{
\t\t\t\tafterAjaxUpdate(tr,rowid,data);
\t\t\t}
\t\t},
\t\terror: function()
\t\t{
\t\t\ttr.find('td').html('{$this->ajaxErrorMessage}');
\t\t\tthat.data('status','off');
\t\t}
\t});
});
EOD;
        $cs->registerScript(__CLASS__ . '#' . $this->id, $js);
    }
Пример #21
0
 /**
  *### .init()
  *
  * initialization of widget
  *
  */
 public function init()
 {
     parent::init();
     $this->packageRegistry = Bootstrap::getBooster();
     if (!$this->model) {
         throw new CException('Parameter "model" should be provided for EditableField');
     }
     if (!$this->attribute) {
         throw new CException('Parameter "attribute" should be provided for EditableField');
     }
     $originalText = strlen($this->text) ? $this->text : CHtml::value($this->model, $this->attribute);
     //if apply set manually to false --> just render text, no js plugin applied
     if ($this->apply === false) {
         $this->text = $originalText;
         return;
     } else {
         $this->apply = true;
     }
     //resolve model and attribute for related model
     $resolved = self::resolveModel($this->model, $this->attribute);
     if ($resolved === false) {
         //cannot resolve related model (maybe no related models for this record)
         $this->apply = false;
         $this->text = $originalText;
         return;
     } else {
         list($this->model, $this->attribute) = $resolved;
     }
     //for security reason only safe attributes can be editable (e.g. defined in rules of model)
     //just print text (see 'run' method)
     if (!$this->model->isAttributeSafe($this->attribute)) {
         $this->apply = false;
         $this->text = $originalText;
         return;
     }
     /*
      try to detect type from metadata if not set
     */
     if ($this->type === null) {
         $this->type = 'text';
         if (array_key_exists($this->attribute, $this->model->tableSchema->columns)) {
             $dbType = $this->model->tableSchema->columns[$this->attribute]->dbType;
             if ($dbType == 'date' || $dbType == 'datetime') {
                 $this->type = 'date';
             }
             if (stripos($dbType, 'text') !== false) {
                 $this->type = 'textarea';
             }
         }
     }
     /*
     If set this flag to true --> element content will stay empty and value will be rendered to data-value attribute to apply autotext.
     */
     $this->_prepareToAutotext = (!isset($this->options['autotext']) || $this->options['autotext'] !== 'never') && in_array($this->type, array('select', 'checklist', 'date', 'dateui', 'combodate', 'select2'));
     /*
      If text not defined, generate it from model attribute for types except lists ('select', 'checklist' etc)
      For lists keep it empty to apply autotext
     */
     if (!strlen($this->text) && !$this->_prepareToAutotext) {
         $this->text = $originalText;
     }
     $this->buildHtmlOptions();
     $this->buildJsOptions();
     $this->registerAssets();
 }
Пример #22
0
 /**
  * Registers and publishes required scripts
  *
  * @param string $id
  */
 public function registerClientScript($id)
 {
     $booster = Bootstrap::getBooster();
     $booster->registerAssetCss('fileupload/jquery.fileupload-ui.css');
     // Upgrade widget factory
     // @todo remove when jquery.ui 1.9+ is fully integrated into stable Yii versions
     $booster->registerAssetJs('fileupload/vendor/jquery.ui.widget.js');
     //The Templates plugin is included to render the upload/download listings
     $booster->registerAssetJs("fileupload/tmpl.min.js", CClientScript::POS_END);
     if ($this->previewImages || $this->imageProcessing) {
         $booster->registerAssetJs("fileupload/load-image.min.js", CClientScript::POS_END);
         $booster->registerAssetJs("fileupload/canvas-to-blob.min.js", CClientScript::POS_END);
         // gallery :) and one smile from me ;)
         $booster->registerAssetCss("bootstrap-image-gallery.min.css");
         $booster->registerAssetJs("bootstrap-image-gallery.min.js", CClientScript::POS_END);
     }
     //The Iframe Transport is required for browsers without support for XHR file uploads
     $booster->registerAssetJs('fileupload/jquery.iframe-transport.js');
     $booster->registerAssetJs('fileupload/jquery.fileupload.js');
     // The File Upload image processing plugin
     if ($this->imageProcessing) {
         $booster->registerAssetJs('fileupload/jquery.fileupload-ip.js');
     }
     // The File Upload file processing plugin
     if ($this->previewImages) {
         $booster->registerAssetJs('fileupload/jquery.fileupload-fp.js');
     }
     // locale
     $booster->registerAssetJs('fileupload/jquery.fileupload-locale.js');
     //The File Upload user interface plugin
     $booster->registerAssetJs('fileupload/jquery.fileupload-ui.js');
     $options = CJavaScript::encode($this->options);
     Yii::app()->clientScript->registerScript(__CLASS__ . '#' . $id, "jQuery('#{$id}').fileupload({$options});");
 }
Пример #23
0
    /**
     * Register required scripts
     */
    protected function registerClientScripts()
    {
        $booster = Bootstrap::getBooster();
        $booster->registerAssetCss('easy-pie-chart.css');
        $booster->registerAssetJs('jquery.easy.pie.chart.js');
        $options = CJavaScript::encode($this->chartOptions);
        Yii::app()->getClientScript()->registerScript(__CLASS__ . '#percent-of-type-operation-simple-pie', '
					   $("#' . $this->column->grid->id . ' .' . $this->column->grid->extendedSummaryCssClass . ' .' . $this->chartCssClass . '")
				.easyPieChart(' . $options . ');
		');
        $this->column->grid->componentsReadyScripts[__CLASS__] = $this->column->grid->componentsAfterAjaxUpdate[__CLASS__] = '$("#' . $this->column->grid->id . ' .' . $this->column->grid->extendedSummaryCssClass . ' .' . $this->chartCssClass . '")
				.easyPieChart(' . $options . ');';
    }
Пример #24
0
 private function insertDefaultStylesheetIfColorsEnabled()
 {
     if (empty($this->editorOptions['color'])) {
         return;
     }
     $defaultStyleSheetUrl = Bootstrap::getBooster()->getAssetsUrl() . '/css/wysiwyg-color.css';
     array_unshift($this->editorOptions['stylesheets'], $defaultStyleSheetUrl);
     // we want default css to be first
 }
Пример #25
0
 /**
  * Registers required javascript files
  *
  * @param string $id
  */
 public function registerClientScript($id)
 {
     Bootstrap::getBooster()->assetsRegistry->registerPackage('timepicker');
     $options = !empty($this->options) ? CJavaScript::encode($this->options) : '';
     ob_start();
     echo "jQuery('#{$id}').timepicker({$options})";
     foreach ($this->events as $event => $handler) {
         echo ".on('{$event}', " . CJavaScript::encode($handler) . ")";
     }
     Yii::app()->getClientScript()->registerScript(__CLASS__ . '#' . $id, ob_get_clean() . ';');
 }
Пример #26
0
 /**
  * FIXME: this method delves too deeply into the internals of Bootstrap component
  */
 public function registerLanguageScript()
 {
     $booster = Bootstrap::getBooster();
     if (isset($this->options['language']) && $this->options['language'] != 'en') {
         $filename = '/bootstrap-datepicker/js/locales/bootstrap-datepicker.' . $this->options['language'] . '.js';
         if (file_exists(Yii::getPathOfAlias('bootstrap.assets') . $filename)) {
             if ($booster->enableCdn) {
                 Yii::app()->clientScript->registerScriptFile('//cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.2.0/js/locales/bootstrap-datepicker.' . $this->options['language'] . '.js', CClientScript::POS_HEAD);
             } else {
                 $booster->assetsRegistry->registerScriptFile($booster->getAssetsUrl() . $filename, CClientScript::POS_HEAD);
             }
         }
     }
 }
Пример #27
0
 /**
  *
  */
 public function registerAssets()
 {
     $booster = Bootstrap::getBooster();
     $booster->registerPackage('x-editable');
     if ($this->type == 'date' || $this->type == 'combodate') {
         /** @var $widget TbDatePicker */
         $widget = Yii::app()->widgetFactory->createWidget($this->getOwner(), 'bootstrap.widgets.TbDatePicker', array('options' => $this->options['datepicker']));
         $widget->registerLanguageScript();
     } elseif ($this->type == 'datetime') {
         $booster->registerPackage('datetimepicker');
         /** @var $widget TbDateTimePicker */
         $widget = Yii::app()->widgetFactory->createWidget($this->getOwner(), 'bootstrap.widgets.TbDateTimePicker', array('options' => $this->options['datetimepicker']));
         $widget->registerLanguageScript();
     }
     //include moment.js if needed
     if ($this->type == 'combodate') {
         $booster->registerPackage('moment');
     } elseif ($this->type == 'select2') {
         $booster->registerPackage('select2');
     }
 }
Пример #28
0
 /**
  *### .registerClientScript()
  *
  * Registers required css js files
  */
 public function registerClientScript()
 {
     $booster = Bootstrap::getBooster();
     $booster->registerAssetCss('bootstrap-daterangepicker.css');
     $booster->registerAssetJs('bootstrap.daterangepicker.js');
     $booster->registerPackage('moment');
 }
Пример #29
0
        if ($user->save()) {
            MailHelper::sendUserCredentials($model->username, $model->email, $model->password);
            completeInstallation('success', 'Admin user successfully created');
        }
    }
}
?>

<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>Installation</title>

    <link rel="stylesheet" type="text/css" href="<?php 
echo Bootstrap::getBooster()->getAssetsUrl();
?>
/bootstrap/css/bootstrap.min.css" />
</head>
<body>
    <div class="span6 offset3">
        <h1 class="offset1">Installation</h1>
        <h2 class="offset1"><small>Enter admin credentials</small></h2>
        <?php 
if ($model->hasErrors()) {
    ?>
            <?php 
    echo TbHtml::errorSummary($model);
    ?>
        <?php 
}
Пример #30
0
 /**
  *### .registerClientScript()
  *
  * Registers required javascript
  *
  * @param string $id
  */
 public function registerClientScript($id)
 {
     Bootstrap::getBooster()->assetsRegistry->registerPackage('ckeditor');
     $options = !empty($this->editorOptions) ? CJavaScript::encode($this->editorOptions) : '{}';
     Yii::app()->clientScript->registerScript(__CLASS__ . '#' . $this->getId(), "CKEDITOR.replace( '{$id}', {$options});");
 }