/**
  * Renders the widget.
  */
 public function run()
 {
     BootstrapAsset::register($this->getView());
     $options = $this->options;
     $_id = $this->getId();
     Html::addCssClass($options, $_id);
     return $this->renderTreeView($this->items, $options);
 }
 /**
  * Registers the js code if necessary
  */
 protected function registerJs()
 {
     if (static::$JS_REGISTERED) {
         return;
     }
     JqueryAsset::register($this->getView());
     BootstrapAsset::register($this->getView());
     $js = new JsExpression("\n\t\t\tvar widgetClass = 'widget-memory-tabs';\n\t\t\tvar storageName = 'widget-memory-tabs';\n\n\t\t\tvar hasStorage = function() {\n\t\t\t\tvar test = 'test';\n\t\t\t\ttry {\n\t\t\t\t\tsessionStorage.setItem(test, test);\n\t\t\t\t\tsessionStorage.removeItem(test);\n\t\t\t\t\treturn true;\n\t\t\t\t} catch(e) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tif (hasStorage) {\n\n\t\t\t\tvar loadData = function() {\n\t\t\t\t\tvar dataStr = sessionStorage.getItem(storageName);\n\t\t\t\t\tif (dataStr == null) return {};\n\t\t\t\t\treturn JSON.parse(dataStr);\n\t\t\t\t};\n\n\t\t\t\tvar saveData = function(dataObj) {\n\t\t\t\t\tdataStr = JSON.stringify(dataObj);\n\t\t\t\t\tsessionStorage.setItem(storageName, dataStr);\n\t\t\t\t};\n\n\t\t\t\tvar activateIndex = function(tabId, index) {\n\t\t\t\t\tvar tab = \$('#' + tabId);\n\t\t\t\t\tvar items = tab.children('li');\n\t\t\t\t\tif (items.length <= index) return;\n\n\t\t\t\t\t\$('#' + tabId + ' li:eq(' + index + ') a').tab('show');\n\t\t\t\t};\n\n\t\t\t\tvar initIndexes = function() {\n\t\t\t\t\tvar data = loadData();\n\t\t\t\t\tvar curUrl = window.location.href;\n\t\t\t\t\tif (data[curUrl] == null) return;\n\n\t\t\t\t\tvar tabs = \$('.' + widgetClass);\n\t\t\t\t\ttabs.each(function(i, el) {\n\t\t\t\t\t\tvar tabId = \$(this).attr('id');\n\t\t\t\t\t\tif (tabId != null) {\n\t\t\t\t\t\t\tvar index = data[curUrl][tabId];\n\t\t\t\t\t\t\tactivateIndex(tabId, index);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t};\n\n\t\t\t\tvar setIndex = function(tabId, index) {\n\t\t\t\t\tvar curUrl = window.location.href;\n\t\t\t\t\tvar data = loadData();\n\t\t\t\t\tif (data[curUrl] == null) data[curUrl] = {};\n\t\t\t\t\tdata[curUrl][tabId] = index;\n\n\t\t\t\t\tsaveData(data);\n\t\t\t\t};\n\n\t\t\t\t\$('.widget-memory-tabs > li > a').mouseup(function(event) {\n\t\t\t\t\tvar tabs = \$(this).closest('.' + widgetClass);\n\t\t\t\t\tvar selectedIndex = \$(this).parent().prevAll().length;\n\n\t\t\t\t\tsetIndex(tabs.attr('id'), selectedIndex);\n\t\t\t\t});\n\n\t\t\t\tinitIndexes();\n\t\t\t}\n\t\t");
     $this->view->registerJs($js);
     static::$JS_REGISTERED = true;
 }
Exemplo n.º 3
0
 public function getCKEditorStylesheets()
 {
     // No cached version found
     if (!$this->_ckEditorStylesheets) {
         // Get the bootstrap asset url
         $bootstrapAsset = BootstrapAsset::register(Yii::$app->view);
         // Add default css
         $css = [$bootstrapAsset->baseUrl . '/css/bootstrap.min.css', Yii::getAlias('@frontendUrl') . '/css/main.css', Yii::getAlias('@frontendUrl') . '/css/editor.css'];
         // Add font assets if they exist
         if (class_exists('\\frontend\\assets\\FontAsset')) {
             // Get the font asset
             $fontAsset = new FontAsset();
             // Add google fonts
             foreach ($fontAsset->css as $font) {
                 $css[] = $fontAsset->basePath . '/' . $font;
             }
         }
         $this->_ckEditorStylesheets = $css;
     }
     return $this->_ckEditorStylesheets;
 }
Exemplo n.º 4
0
 /**
  * Renders the widget.
  */
 public function run()
 {
     BootstrapAsset::register($this->getView());
     return $this->renderItems();
 }
Exemplo n.º 5
0
 /**
  * Renders the widget.
  */
 public function run()
 {
     BootstrapAsset::register($this->getView());
     return Html::tag('div', $this->renderButtons(), $this->options);
 }
Exemplo n.º 6
0
<?php

use yii\web\View;
/* @var $this \yii\web\View */
/* @var $content string */
\yii\bootstrap\BootstrapAsset::register($this);
?>



<?php 
$this->beginContent('@app/modules/admin/views/layouts/bootstrap.php');
?>

<?php 
echo $content;
?>


<?php 
$script = <<<JS
    \$(window)
        .on('beforeunload', function(){
            window.top.postMessage('iframeBeforeUnload', '*');
        })
        .on('unload', function() {
            window.top.postMessage('iframeUnload', '*');
        });
JS;
$this->registerJs($script, View::POS_READY);
?>
Exemplo n.º 7
0
<?php

use yii\helpers\Html;
use yii\bootstrap\BootstrapAsset;
BootstrapAsset::register($this);
$this->beginPage();
?>
<!DOCTYPE html>
<html lang="<?php 
echo Yii::$app->language;
?>
">
<head>
    <meta charset="<?php 
echo Yii::$app->charset;
?>
"/>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <?php 
echo Html::csrfMetaTags();
?>
    <title><?php 
echo Html::encode($this->title);
?>
 <?php 
echo YII_DEBUG ? 'Development' : '';
?>
</title>
    <?php 
$this->head();
?>
Exemplo n.º 8
0
 /**
  * Renders the widget.
  */
 public function run()
 {
     BootstrapAsset::register($this->getView());
     return implode("\n", [Html::beginTag('div', $this->options), $this->renderProgress(), Html::endTag('div')]) . "\n";
 }
Exemplo n.º 9
0
 /**
  * Renders the widget.
  */
 public function run()
 {
     echo Html::beginTag('div', $this->options) . "\n";
     echo $this->renderProgress() . "\n";
     echo Html::endTag('div') . "\n";
     BootstrapAsset::register($this->getView());
 }
Exemplo n.º 10
0
 /**
  * Renders the widget.
  */
 public function run()
 {
     echo $this->renderItems();
     echo Html::endTag('div');
     BootstrapAsset::register($this->getView());
 }
Exemplo n.º 11
0
 public function init()
 {
     parent::init();
     $bundle = \yii\bootstrap\BootstrapAsset::register(\Yii::$app->view);
     $this->editorOptions = \mihaildev\elfinder\ElFinder::ckeditorOptions('/admin/file-manager-elfinder', ['preset' => 'full', 'extraPlugins' => 'codemirror', 'entities' => false, 'allowedContent' => true, 'baseHref' => \Yii::$app->homeUrl, 'contentsCss' => [$bundle->baseUrl . '/css/bootstrap.css', '/main.css']]);
 }
Exemplo n.º 12
0
 /**
  * Renders the widget.
  */
 public function run()
 {
     echo $this->renderContent();
     BootstrapAsset::register($this->getView());
 }