예제 #1
0
 public function init()
 {
     $this->fieldConfig = ['template' => "<div class=\"row\">\n                <div class=\"col-xs-6\">{label}</div>\n                <div class=\"col-xs-6\"> <span class=\"tooltip-field pull-right\"> {hint} </span> <span class=\"tooltip-error-field pull-right\"> {error} </span> </div>\n            \n<div class=\"col-xs-12\">{input}</div>\n            </div>"];
     $this->fieldClass = ActiveField::className();
     echo Html::tag('span', AmosIcons::show('alert'), ['id' => 'errore-alert-common', 'class' => 'errore-alert bk-noDisplay', 'title' => \Yii::t('app', 'La tab contiene degli errori')]);
     parent::init();
 }
예제 #2
0
 public function initDefaultButtons()
 {
     if (!isset($this->buttons['view'])) {
         $this->buttons['view'] = function ($url, $model) {
             if (!$this->can($model, 'read')) {
                 return '';
             }
             $options = $this->viewOptions;
             $title = Yii::t('app', 'Leggi');
             $icon = AmosIcons::show('file');
             $label = ArrayHelper::remove($options, 'label', $this->_isDropdown ? $icon . ' ' . $title : $icon);
             $options = ArrayHelper::merge(['title' => $title, 'data-pjax' => '0'], $options);
             if ($this->_isDropdown) {
                 $options['tabindex'] = '-1';
                 return '<li>' . Html::a($label, $url, $options) . '</li>' . PHP_EOL;
             } else {
                 return Html::a($label, $url, $options);
             }
         };
     }
     if (!isset($this->buttons['update'])) {
         $this->buttons['update'] = function ($url, $model) {
             if (!$this->can($model, 'update')) {
                 return '';
             }
             $options = $this->updateOptions;
             $title = Yii::t('app', 'Modifica');
             $icon = AmosIcons::show('pencil');
             $label = ArrayHelper::remove($options, 'label', $this->_isDropdown ? $icon . ' ' . $title : $icon);
             $options = ArrayHelper::merge(['title' => $title, 'data-pjax' => '0'], $options);
             if ($this->_isDropdown) {
                 $options['tabindex'] = '-1';
                 return '<li>' . Html::a($label, $url, $options) . '</li>' . PHP_EOL;
             } else {
                 return Html::a($label, $url, $options);
             }
         };
     }
     if (!isset($this->buttons['delete'])) {
         $this->buttons['delete'] = function ($url, $model) {
             if (!$this->can($model, 'delete')) {
                 return '';
             }
             $options = $this->deleteOptions;
             $title = Yii::t('app', 'Cancella');
             $icon = AmosIcons::show('trash');
             $label = ArrayHelper::remove($options, 'label', $this->_isDropdown ? $icon . ' ' . $title : $icon);
             $options = ArrayHelper::merge(['title' => $title, 'data-confirm' => Yii::t('app', 'Sei sicuro di voler cancellare questo elemento?'), 'data-method' => 'post', 'data-pjax' => '0'], $options);
             if ($this->_isDropdown) {
                 $options['tabindex'] = '-1';
                 return '<li>' . Html::a($label, $url, $options) . '</li>' . PHP_EOL;
             } else {
                 return Html::a($label, $url, $options);
             }
         };
     }
 }
예제 #3
0
 public function init()
 {
     parent::init();
     $this->errorOptions = ArrayHelper::merge($this->errorOptions, ['tag' => 'span']);
     $this->hintOptions = ArrayHelper::merge($this->hintOptions, ['tag' => 'span']);
     $hint = $this->model->getAttributeHint($this->attribute);
     if ($hint) {
         $this->parts['{hint}'] = Html::tag('span', AmosIcons::show('help-alt'), ['data-toggle' => "tooltip", 'data-placement' => "top", 'title' => html_entity_decode($hint)]);
     }
     $error = $this->model->getErrors($this->attribute);
     if (count($error)) {
         $this->parts['{error}'] = Html::tag('span', AmosIcons::show('alert'), ['data-toggle' => "tooltip", 'data-placement' => "top", 'title' => html_entity_decode(implode("\n", $error))]);
     }
 }
예제 #4
0
 public function initAvailableViews()
 {
     if (!$this->getAvailableViews()) {
         $this->setAvailableViews(['grid' => ['name' => 'grid', 'label' => T::tApp('{iconaTabella} Tabella', ['iconaTabella' => AmosIcons::show('view-list-alt')]), 'url' => '?currentView=grid']]);
     }
 }
예제 #5
0
 public function getHtml()
 {
     $classSpanStr = implode(' ', $this->classSpan);
     $classSpanLi = implode(' ', $this->classLi);
     $classSpanA = implode(' ', $this->classA);
     $icon = AmosIcons::show("{$this->icon}", ['class' => 'bk-pluginIcon'], $this->getIconFramework());
     return "<li class=\"col-xs-6 col-sm-3 col-md-2 col-lg-1\" data-code=\"{$this->code}\" data-module-name=\"{$this->moduleName}\">\n                    <a href=\"{$this->url}\" target=\"{$this->targetUrl}\" title=\"{$this->description}\" role=\"menuitem\" id=\"sortableOpt1\">\n                    <span class=\"{$classSpanStr}\">{$icon}\n                        <span class=\"icon-dashboard-name pluginName\">{$this->label}</span>\n                    </span>\n                 </a>\n            </li>";
 }