Ejemplo n.º 1
0
 public function run()
 {
     AdminlteAsset::register($this->getView());
     Html::addCssClass($this->options, ['widget' => 'progress']);
     if ($this->vertical) {
         Html::addCssClass($this->options, 'vertical');
     }
     if (!empty($this->size)) {
         Html::addCssClass($this->options, $this->size);
     }
     $barOptions = ['class' => 'progress-bar'];
     if (!empty($this->type)) {
         Html::addCssClass($barOptions, 'progress-bar-' . $this->type);
     }
     if ($this->striped) {
         Html::addCssClass($barOptions, 'progress-bar-striped');
     }
     $barOptions['style']['width'] = $this->value . '%';
     if (empty($this->text)) {
         $text = '';
     } else {
         $text = Html::tag('span', $text, ['class' => 'sr-only']);
     }
     return Html::tag('div', Html::tag('div', $text, $barOptions), $this->options);
 }
Ejemplo n.º 2
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     Html::addCssClass($this->options, ['widget' => 'info-box']);
     $iconOptions = ['class' => 'info-box-icon'];
     if ($this->type === self::COLORED_ICON) {
         Html::addCssClass($iconOptions, 'bg-' . $this->color);
     } else {
         Html::addCssClass($this->options, 'bg-' . $this->color);
     }
     echo Html::beginTag('div', $this->options);
     echo Html::tag('span', FA::icon($this->icon), $iconOptions);
     echo '<div class="info-box-content">';
     if (!empty($this->contents)) {
         foreach ($this->contents as $content) {
             if (is_array($content)) {
                 $type = ArrayHelper::getValue($content, 'type', 'text');
                 $text = ArrayHelper::getValue($content, 'text', '');
                 if (in_array($type, ['text', 'number'])) {
                     echo Html::tag('span', $text, ['class' => 'info-box-' . $type]);
                 } elseif ($type == 'progress') {
                     $value = ArrayHelper::getValue($content, 'value', $text);
                     echo '<div class="progress">';
                     echo Html::tag('div', '', ['class' => 'progress-bar', 'style' => ['width' => $value . '%']]);
                     echo '</div>';
                 } else {
                     echo Html::tag('span', $text, ['class' => $type]);
                 }
             } else {
                 echo $content;
             }
         }
     }
 }
Ejemplo n.º 3
0
 public function run()
 {
     if (!isset($this->parentType)) {
         throw new InvalidConfigException("Tag parent type is required.");
     }
     $tagsHtml = $this->renderWidget();
     return Html::tag('div', $tagsHtml, $this->options);
 }
Ejemplo n.º 4
0
function message($mesasge, $error = false)
{
    if ($error) {
        echo Html::tag('div', $mesasge, array('class' => 'alert alert-danger'));
    } else {
        echo Html::tag('div', $mesasge, array('class' => 'alert alert-success'));
    }
}
Ejemplo n.º 5
0
 /**
  * Generate the tool tip template to use in form.
  *
  * @param string $field The table field name.
  * @return string Return the tool tip template.
  */
 public function getToolTipTemplate($field)
 {
     if (array_key_exists($field, $this->toolTips())) {
         $toolTip = Html::tag('span', "{label}", ['data-content' => $this->toolTips()[$field], 'data-toggle' => 'popover', 'data-trigger' => 'hover', 'style' => 'cursor:help; border-bottom: 1px dashed #888']);
         return "{$toolTip} \n{input}\n{hint}\n{error}";
     }
     return "{label}\n{input}\n{hint}\n{error}";
 }
Ejemplo n.º 6
0
 /**
  * Fetch the icon for a icon identifier
  *
  * @param string $id suffix the icon suffix name
  * @param array  $options the icon HTML attributes
  * @param string $prefix the icon css prefix name
  *
  * @return string the parsed icon
  */
 public function icon($id, $options = ['style' => 'margin-right:5px'], $prefix = null)
 {
     if ($prefix === null) {
         $prefix = $this->prefix;
     }
     Html::addCssClass($options, explode(' ', $prefix . $id));
     return Html::tag('i', '', $options);
 }
Ejemplo n.º 7
0
 /**
  * Renders the widget.
  */
 public function run()
 {
     $this->registerPlugin('button');
     $this->label = $this->getLabel();
     if ($this->enableIcon) {
         $this->label .= Icon::widget(['label' => $this->icon, 'options' => $this->iconOptions]);
     }
     return Html::tag($this->tagName, $this->label, $this->options);
 }
Ejemplo n.º 8
0
 public function run()
 {
     if (empty($this->items)) {
         return '';
     }
     $options = $this->options;
     $content = $this->renderItems();
     return Html::tag('div', $content, $options);
 }
 /**
  * test method
  */
 public function testPrintsWithTheMethodWithWrapper()
 {
     $helper = ConcreteHelper::getInstance();
     ob_start();
     $helper->the('hey', Html::tag('span'));
     $content = ob_get_contents();
     ob_end_clean();
     $this->assertEquals('<span>hey</span>', $content);
 }
Ejemplo n.º 10
0
 protected function renderMenuItem($item)
 {
     if (isset($item['url'])) {
         $icon = isset($item['icon']) ? '<i class="fa ' . $item['icon'] . '"></i>' : '';
         $count = isset($item['count']) ? '<span class="' . (isset($item['countClass']) ? $item['countClass'] : 'dataNumGreen') . '">' . $item['count'] . '</span>' : '';
         $label = $this->linkLabelWrapper === null ? $item['label'] : Html::tag($this->linkLabelWrapper, $this->linkLabelWrapperHtmlOptions, $item['label']);
         return Html::link($icon . $label . $count, $item['url'], isset($item['linkOptions']) ? $item['linkOptions'] : array());
     } else {
         return Html::tag('span', isset($item['linkOptions']) ? $item['linkOptions'] : array(), $item['label']);
     }
 }
Ejemplo n.º 11
0
 public function run()
 {
     $container = 'div';
     if (isset($this->containerOptions['tag'])) {
         $container = $this->containerOptions['tag'];
         unset($this->containerOptions['tag']);
     }
     echo Html::tag($container, Html::tag('iframe', '', $this->frameOptions), $this->containerOptions);
     if (!empty($this->callbackFunction)) {
         AssetsCallBack::register($this->getView());
         $this->getView()->registerJs("mihaildev.elFinder.register(" . Json::encode($this->id) . "," . Json::encode($this->callbackFunction) . ");");
     }
 }
Ejemplo n.º 12
0
 public function datagrid($mcs, $limit = 10)
 {
     // $this->debug=true;
     $datas = array_map(function ($x) {
         return $x->toArray();
     }, $this->model($mcs, null, $limit));
     // mdd($datas);
     $arrTables = array();
     foreach ($datas as $data) {
         $arrTables[] = app()->make('\\Mkny\\Cinimod\\Logic\\TableLogic')->setRows($data)->getTable();
     }
     return \Html::tag('div', $arrTables);
 }
Ejemplo n.º 13
0
 public function init()
 {
     echo '<div class="box box-primary">' . '  <div class="box-header with-border">';
     echo Html::tag('h3', $this->options['boxTitle'], ['class' => 'box-title']);
     echo '<div class="box-tools pull-right">';
     echo Html::button('<i class="fa fa-save"></i>', ['type' => 'submit', 'class' => 'btn btn-sm btn-primary', 'title' => \Yii::t('theme/widgets/box', 'Save')]);
     echo ' ';
     if (isset($this->options['buttonUndo'])) {
         echo Html::a('<i class="fa fa-undo"></i>', $this->options['buttonUndo'], ['class' => 'btn btn-sm btn-default', 'title' => \Yii::t('theme/widgets/box', 'Undo')]);
     }
     echo '</div>';
     echo '</div>';
     echo '<div class="box-body form-horizontal">';
 }
Ejemplo n.º 14
0
 public function redirect($url, $force = false, $statusCode = 302)
 {
     $params = Yii::$app->request->queryParams;
     // Meta redirect
     if (headers_sent() || ob_get_contents()) {
         $url = !empty($params['_return_url']) ? $params['_return_url'] : $url;
         $url = Url::to($url);
         $this->ech(Html::tag('meta', '', ['http-equiv' => 'Refresh', 'content' => '1;URL=' . $url . '']));
         $this->ech(Html::a(__('Continue'), $url));
     }
     if (!empty($params['_return_url']) && !$force) {
         return Yii::$app->getResponse()->redirect($params['_return_url'], $statusCode);
     }
     return parent::redirect($url, $statusCode);
 }
 /**
  * Returns the fields for edit screen
  * 
  * @return string
  */
 public function renderForEdit()
 {
     global $tag;
     $data = array();
     foreach ($this->dataHandler->getFillable() as $field) {
         $data[$field->getBaseName()] = apply_filters('wd-fieldcreator-get-field-' . $this->prefix . $field->getBaseName(), wd_get_term_meta($tag->term_id, $this->prefix . $field->getBaseName()));
     }
     $this->dataHandler->populate($data)->execute();
     foreach ($this->dataHandler->getContent() as $content) {
         if (is_a($content, 'FG_HTML_Form_Input_Fillable')) {
             $html[] = Html::tag('tr', array(Html::tag('th', $content->getLabel()), Html::tag('td', $content->getField())))->setClass('form-field wd-taxonomy-fieldcreator');
         } else {
             $html[] = $content;
         }
     }
     return join('', $html);
 }
Ejemplo n.º 16
0
 /**
  * @inheritdoc
  */
 protected function renderItem($item)
 {
     $item['badgeOptions'] = isset($item['badgeOptions']) ? $item['badgeOptions'] : [];
     if (!ArrayHelper::getValue($item, 'badgeOptions.class')) {
         $bg = isset($item['badgeBgClass']) ? $item['badgeBgClass'] : $this->badgeBgClass;
         $item['badgeOptions']['class'] = $this->badgeClass . ' ' . $bg;
     }
     if (isset($item['items']) && !isset($item['right-icon'])) {
         $item['right-icon'] = $this->parentRightIcon;
     }
     if (isset($item['url'])) {
         $template = ArrayHelper::getValue($item, 'template', $this->linkTemplate);
         return strtr($template, ['{badge}' => isset($item['badge']) ? Html::tag('small', $item['badge'], $item['badgeOptions']) : '', '{icon}' => isset($item['icon']) ? $item['icon'] : '', '{right-icon}' => isset($item['right-icon']) ? $item['right-icon'] : '', '{url}' => Url::to($item['url']), '{label}' => $item['label']]);
     } else {
         $template = ArrayHelper::getValue($item, 'template', $this->labelTemplate);
         return strtr($template, ['{badge}' => isset($item['badge']) ? Html::tag('small', $item['badge'], $item['badgeOptions']) : '', '{icon}' => isset($item['icon']) ? $item['icon'] : '', '{right-icon}' => isset($item['right-icon']) ? $item['right-icon'] : '', '{label}' => $item['label']]);
     }
 }
Ejemplo n.º 17
0
    public function run()
    {
        $options = $this->options;
        $maskId = $this->maskId;
        $actionsheetId = $this->actionsheetId;
        $menus = $this->renderMenus();
        $actions = $this->renderActions();
        $content = <<<EOF
<div class="weui_mask_transition" id="{$maskId}"></div>
<div class="weui_actionsheet" id="{$actionsheetId}">
    <div class="weui_actionsheet_menu">
        {$menus}
    </div>
    <div class="weui_actionsheet_action">
        {$actions}
    </div>
</div>
EOF;
        return Html::tag('div', $content, $options);
    }
Ejemplo n.º 18
0
 public function renderTableRow($model, $key, $index)
 {
     $cells = [];
     /* @var $column Column */
     foreach ($this->columns as $column) {
         $cells[] = $column->renderDataCell($model, $key, $index);
     }
     if ($this->rowOptions instanceof Closure) {
         $options = call_user_func($this->rowOptions, $model, $key, $index, $this);
     } else {
         $options = $this->rowOptions;
     }
     $options['data-key'] = is_array($key) ? json_encode($key) : (string) $key;
     if (array_key_exists('collapse', $options)) {
         if ($options['collapse'] == 'parrent') {
             $this->par++;
             $options[] = ['data-toggle' => 'collapse', 'data-target' => '.rows' . $this->par];
         }
     }
     return Html::tag('tr', implode('', $cells), $options);
 }
Ejemplo n.º 19
0
 /**
  * Renders the content of the portlet.
  */
 public function run()
 {
     if (empty($this->links)) {
         return;
     }
     echo Html::openTag($this->tagName, $this->htmlOptions) . "\n";
     $content = '';
     if ($this->homeLink === null) {
         $content .= Html::tag('li', array(), Html::link(Yii::t('zii', 'Home'), Yii::app()->homeUrl), true);
     } elseif ($this->homeLink !== false) {
         $content .= Html::tag('li', array(), $this->homeLink, true);
     }
     foreach ($this->links as $label => $url) {
         if (is_string($label) || is_array($url)) {
             $content .= strtr($this->activeLinkTemplate, array('{url}' => Html::normalizeUrl($url), '{label}' => $this->encodeLabel ? Html::encode($label) : $label));
         } else {
             $content .= str_replace('{label}', $this->encodeLabel ? Html::encode($url) : $url, $this->inactiveLinkTemplate);
         }
     }
     echo $content;
     echo Html::closeTag($this->tagName);
 }
 public function toHTML()
 {
     $content = "";
     foreach ($this->data[self::ARRAY_IMAGES] as $image) {
         $imageExt = new ImageExtImage($this->imageExt, $image);
         $imageExt->generate();
         $imageExt->optimizeOutput();
         $content .= $imageExt->toHTML();
     }
     if ($this->data[self::ARRAY_ATTR][self::PARA_SNIPPET_GALLERY] !== false && file_exists(kirby()->roots->snippets() . '/' . $this->data[self::ARRAY_ATTR][self::PARA_SNIPPET_GALLERY] . '.php')) {
         $attr = array();
         if (!empty($this->data[self::ARRAY_ATTR][self::PARA_GALLERY_CLASS])) {
             $attr['class'] = $this->data[self::ARRAY_ATTR][self::PARA_GALLERY_CLASS];
         }
         $attr['images'] = $content;
         return (string) snippet($this->data[self::ARRAY_ATTR][self::PARA_SNIPPET_GALLERY], array('data' => $attr), true);
     } else {
         $attr = array();
         if (!empty($this->data[self::ARRAY_ATTR][self::PARA_GALLERY_CLASS])) {
             $attr['class'] = $this->data[self::ARRAY_ATTR][self::PARA_GALLERY_CLASS];
         }
         return \Html::tag("div", $content, $attr);
     }
 }
 public static function blockFigure($content, $caption = false, $caption_top = false, $caption_class = false)
 {
     if ($caption === false) {
         return $content;
     }
     if (is_string($caption)) {
         $caption = kirbytext($caption);
         $figcaption = \Html::tag("figcaption", $caption);
     } else {
         $figcaption = "";
     }
     if ($caption_top !== false) {
         $content = $figcaption . $content;
     } else {
         $content = $content . $figcaption;
     }
     $attr = array();
     if ($caption_class !== false && !empty($caption_class)) {
         $attr['class'] = $caption_class . ($caption_top !== false ? " figcaption-top" : " figcaption-bottom");
     } else {
         $attr['class'] = $caption_top !== false ? "figcaption-top" : "figcaption-bottom";
     }
     return \Html::tag("figure", $content, $attr);
 }
 /**
  * @inheritdoc
  */
 public static function checkbox($name, $checked = false, $options = [])
 {
     $options['checked'] = (bool) $checked;
     $value = array_key_exists('value', $options) ? $options['value'] : '1';
     if (isset($options['uncheck'])) {
         // add a hidden field so that if the checkbox is not selected, it still submits a value
         $hidden = static::hiddenInput($name, $options['uncheck']);
         unset($options['uncheck']);
     } else {
         $hidden = '';
     }
     if (isset($options['label'])) {
         $label = $options['label'];
         $labelOptions = isset($options['labelOptions']) ? $options['labelOptions'] : [];
         $divOptions = isset($options['divOptions']) ? $options['divOptions'] : [];
         Html::addCssClass($divOptions, 'checkbox');
         unset($options['label'], $options['labelOptions'], $options['divOptions']);
         $options['id'] = str_replace(['[]', '][', '[', ']', ' '], ['', '-', '-', '', '-'], $name) . '-' . $value;
         $content = Html::tag('div', static::input('checkbox', $name, $value, $options) . static::label($label, $options['id'], $labelOptions), $divOptions);
         return $hidden . $content;
     } else {
         return $hidden . static::input('checkbox', $name, $value, $options);
     }
 }
Ejemplo n.º 23
0
 /**
  * Renders collapsible toggle button.
  * @return string the rendering toggle button.
  */
 protected function renderToggleButton()
 {
     $bar = Html::tag('span', '', ['class' => 'icon-bar']);
     $screenReader = "<span class=\"sr-only\">{$this->screenReaderToggleText}</span>";
     return Html::button("{$screenReader}\n{$bar}\n{$bar}\n{$bar}", ['class' => 'navbar-toggle', 'data-toggle' => 'collapse', 'data-target' => "#{$this->containerOptions['id']}"]);
 }
Ejemplo n.º 24
0
<?php

ob_start();
?>





<h1>Customers</h1>

<?php 
foreach ($customers as $cust) {
    $link = Html::link(Html::encode($cust['CompanyName']), array('/customers/' . $cust['CustomerID']));
    echo Html::tag('h2', array('style' => 'margin-bottom: 0;'), $link);
    echo $cust['ContactName'];
}
?>



<?php 
app()->load_template(app()->config['default_template'], array('content' => ob_get_clean()));
Ejemplo n.º 25
0
 /**
  * Normalizes dropdown item options by removing tab specific keys `content` and `contentOptions`, and also
  * configure `panes` accordingly.
  * @param string $itemNumber number of the item
  * @param array $items the dropdown items configuration.
  * @param array $panes the panes reference array.
  * @return boolean whether any of the dropdown items is `active` or not.
  * @throws InvalidConfigException
  */
 protected function renderDropdown($itemNumber, &$items, &$panes)
 {
     $itemActive = false;
     foreach ($items as $n => &$item) {
         if (is_string($item)) {
             continue;
         }
         if (isset($item['visible']) && !$item['visible']) {
             continue;
         }
         if (!array_key_exists('content', $item)) {
             throw new InvalidConfigException("The 'content' option is required.");
         }
         $content = ArrayHelper::remove($item, 'content');
         $options = ArrayHelper::remove($item, 'contentOptions', []);
         Html::addCssClass($options, ['widget' => 'tab-pane']);
         if (ArrayHelper::remove($item, 'active')) {
             Html::addCssClass($options, 'active');
             Html::addCssClass($item['options'], 'active');
             $itemActive = true;
         }
         $options['id'] = ArrayHelper::getValue($options, 'id', $this->options['id'] . '-dd' . $itemNumber . '-tab' . $n);
         $item['url'] = '#' . $options['id'];
         if (!isset($item['linkOptions']['data-toggle'])) {
             $item['linkOptions']['data-toggle'] = 'tab';
         }
         $panes[] = Html::tag('div', $content, $options);
         unset($item);
     }
     return $itemActive;
 }
Ejemplo n.º 26
0
 public function run()
 {
     $label = $this->encodeLabel ? Html::encode($this->label) : $this->label;
     return Html::tag($this->tagName, $label, $this->options);
 }
Ejemplo n.º 27
0
 /**
  * Renders the close button.
  * @return string the rendering result
  */
 protected function renderCloseButton()
 {
     if (($closeButton = $this->closeButton) !== false) {
         $tag = ArrayHelper::remove($closeButton, 'tag', 'button');
         $label = ArrayHelper::remove($closeButton, 'label', '&times;');
         if ($tag === 'button' && !isset($closeButton['type'])) {
             $closeButton['type'] = 'button';
         }
         return Html::tag($tag, $label, $closeButton);
     } else {
         return null;
     }
 }
Ejemplo n.º 28
0
 public static function pageHeader($string)
 {
     return Html::tag('h2', $string, ['class' => 'page-header']);
 }
Ejemplo n.º 29
0
 /**
  * Отображаем елемент карты.
  * @param string $mapid
  * @param array $option
  */
 protected function renderMap($mapid, array $option)
 {
     echo Html::tag('div', array('id' => $mapid, 'class' => 'ymap', 'style' => 'width:' . $option['width'] . ';height:' . $option['height'] . ''), '', true);
 }
Ejemplo n.º 30
0
<div class="col-md-4 col-sm-6">
    <div class="product">
        <?php 
$this->widget('ext.admin.frontControl.FrontControlWidget', array('data' => $data, 'widget' => $widget));
?>
        <?php 
if ($data->productLabel) {
    if ($data->productLabel['class'] == 'new') {
        $color = 'green';
    } elseif ($data->productLabel['class'] == 'hit') {
        $color = 'purple';
    } else {
        $color = 'blue';
    }
    echo Html::tag('div', array('class' => 'corner-right-' . $color . ' ' . $data->productLabel['class']), '', true);
}
?>

        <?php 
if ($data->mainImage) {
    $imgSource = $data->mainImage->getUrl('270x347');
} else {
    $imgSource = 'http://placehold.it/270x347';
}
echo Html::link(Html::image($imgSource, $data->mainImageTitle, array()), $data->getRelativeUrl(), array('class' => 'product-image'));
?>
        <div class="text-center product-title">
            <?php 
echo Html::link(Html::encode($data->name), $data->getRelativeUrl());
?>
        </div>