Exemplo n.º 1
0
 /**
  * @inheritdoc
  */
 public function run()
 {
     $this->_setBeginning(true);
     $body = ob_get_clean();
     if (!isset($this->options['id'])) {
         $this->options['id'] = $this->getId();
     }
     Html::addCssClass($this->options, 'jarviswidget');
     $this->_setColor();
     $this->_setDataWidgetBool();
     $this->_setLoad();
     $this->_setRefresh();
     echo Html::beginTag('div', $this->options);
     // main div
     echo Html::beginTag('header', $this->headerOptions);
     $this->_getIcon();
     if ($this->header !== null) {
         echo Html::tag('h2', $this->header, $this->headerH2Options);
     }
     $this->_getToolbar();
     $this->_getAddOn();
     echo Html::endTag('header');
     echo Html::beginTag('div');
     $this->_getEditbox();
     // widget body
     Html::addCssClass($this->bodyOptions, 'widget-body');
     $this->_setNoPadding();
     echo Html::beginTag('div', $this->bodyOptions);
     $this->_getBodyToolbar();
     echo $this->body !== null ? $this->body : $body;
     $this->_getFooter();
     echo Html::endTag('div');
     echo Html::endTag('div');
     echo Html::endTag('div');
 }
Exemplo n.º 2
0
 /**
  * @inheritdoc
  */
 public function fileInput($options = [])
 {
     $options = array_merge($this->inputOptions, $options);
     $options['wrapperOptions']['tag'] = isset($options['wrapperOptions']) && isset($options['wrapperOptions']['tag']) ? $options['wrapperOptions']['tag'] : 'div';
     $this->_setWrapperOptions($options, 'input input-file');
     // Set template
     $this->template = $this->fileInputTemplate;
     // Button
     $btnOptions = ArrayHelper::remove($options, 'buttonOptions', []);
     $btnTag = ArrayHelper::remove($btnOptions, 'tag', 'span');
     $btnContent = ArrayHelper::remove($btnOptions, 'content', 'Browse');
     Html::addCssClass($btnOptions, 'button');
     $this->parts['{beginButton}'] = Html::beginTag($btnTag, $btnOptions);
     $this->parts['{contentButton}'] = $btnContent;
     $this->parts['{endButton}'] = Html::endTag($btnTag);
     // Placeholder input
     $phrOptions = ArrayHelper::remove($options, 'placeholderOptions', []);
     $phrOptions['readonly'] = 'readonly';
     $placeholder = ArrayHelper::remove($options, 'placeholder');
     if ($placeholder !== null) {
         $phrOptions['placeholder'] = $placeholder;
     }
     $this->parts['{placeholder}'] = Html::input('text', null, null, $phrOptions);
     // Onchange
     $onchange = 'this.parentNode.nextSibling.value = this.value';
     $options['onchange'] = isset($options['onchange']) ? $options['onchange'] : $onchange;
     return parent::fileInput($options);
 }