Exemplo n.º 1
0
 public function run()
 {
     $elements = $this->cart->elements;
     if (empty($elements)) {
         $cart = Html::tag('div', yii::t('cart', 'Your cart empty'), ['class' => 'pistol88-cart pistol88-empty-cart']);
     } else {
         $cart = Html::ul($elements, ['item' => function ($item, $index) {
             return $this->_row($item);
         }, 'class' => 'pistol88-cart-list']);
     }
     if (!empty($elements)) {
         $bottomPanel = '';
         if ($this->showTotal) {
             $bottomPanel .= Html::tag('div', Yii::t('cart', 'Total') . ': ' . yii::$app->cart->cost . ' ' . yii::$app->cart->currency, ['class' => 'pistol88-cart-total-row']);
         }
         if ($this->offerUrl && $this->showOffer) {
             $bottomPanel .= Html::a(yii::t('cart', 'Offer'), $this->offerUrl, ['class' => 'pistol88-cart-offer-button btn btn-success']);
         }
         if ($this->showTruncate) {
             $bottomPanel .= TruncateButton::widget();
         }
         $cart .= Html::tag('div', $bottomPanel, ['class' => 'pistol88-cart-bottom-panel']);
     }
     $cart = Html::tag('div', $cart, ['class' => 'pistol88-cart']);
     if ($this->type == self::TYPE_DROPDOWN) {
         $button = Html::button($this->textButton . Html::tag('span', '', ["class" => "caret"]), ['class' => 'btn dropdown-toggle', 'id' => 'pistol88-cart-drop', 'type' => "button", 'data-toggle' => "dropdown", 'aria-haspopup' => 'true', 'aria-expanded' => "false"]);
         $list = Html::tag('div', $cart, ['class' => 'dropdown-menu', 'aria-labelledby' => 'pistol88-cart-drop']);
         $cart = Html::tag('div', $button . $list, ['class' => 'pistol88-cart-dropdown dropdown']);
     }
     return Html::tag('div', $cart, ['class' => 'pistol88-cart-block']);
 }
Exemplo n.º 2
0
 public function run()
 {
     return Html::ul($this->flatPageList, ['class' => $this->htmlClass, 'item' => function ($flatPage, $index) {
         $class = $flatPage->matchRequestedRoute() ? $this->activeLiClass : null;
         return Html::tag('li', Html::a($flatPage->anchor, $flatPage->getRoute()), ['class' => $class]);
     }]);
 }
Exemplo n.º 3
0
 /**
  * @param RabotaFizLica $rabota
  * @return string
  */
 private function renderDolzhnosti($rabota)
 {
     foreach ($rabota->getDolzhnosti_fiz_lica_na_rabote_rel()->each() as $dolzhnost) {
         $dolzhnosti[] = ArrayHelper::getValue($dolzhnost, 'dolzhnost_rel.nazvanie');
     }
     return isset($dolzhnosti) ? Html::ul($dolzhnosti, ['class' => 'dolzhnosti', 'encode' => false]) : '';
 }
Exemplo n.º 4
0
 public function renderItem($header, $item, $index)
 {
     if (array_key_exists('content', $item)) {
         $id = $this->options['id'] . '-collapse' . $index;
         $options = ArrayHelper::getValue($item, 'contentOptions', []);
         $options['id'] = $id;
         $expanded = false;
         if (array_key_exists('expanded', $item)) {
             $expanded = $item['expanded'];
         }
         Html::addCssClass($options, 'panel-collapse collapse' . ($expanded ? ' in' : ''));
         $encodeLabel = isset($item['encode']) ? $item['encode'] : $this->encodeLabels;
         if ($encodeLabel) {
             $header = Html::encode($header);
         }
         $headerToggle = Html::a($header, '#' . $id, ['class' => 'collapse-toggle', 'data-toggle' => 'collapse', 'data-parent' => '#' . $this->options['id']]) . "\n";
         $header = Html::tag('h4', $headerToggle, ['class' => 'panel-title']);
         if (is_string($item['content'])) {
             $content = Html::tag('div', $item['content'], ['class' => 'panel-body']) . "\n";
         } elseif (is_array($item['content'])) {
             $content = Html::ul($item['content'], ['class' => 'list-group', 'itemOptions' => ['class' => 'list-group-item'], 'encode' => false]) . "\n";
             if (isset($item['footer'])) {
                 $content .= Html::tag('div', $item['footer'], ['class' => 'panel-footer']) . "\n";
             }
         } else {
             throw new InvalidConfigException('The "content" option should be a string or array.');
         }
     } else {
         throw new InvalidConfigException('The "content" option is required.');
     }
     $group = [];
     $group[] = Html::tag('div', $header, ['class' => 'panel-heading']);
     $group[] = Html::tag('div', $content, $options);
     return implode("\n", $group);
 }
Exemplo n.º 5
0
 /**
  * @return string
  */
 protected function renderItems()
 {
     return Html::ul($this->items, ['encode' => false, 'item' => function ($item, $index) {
         if (!isset($item['fontSize'])) {
             $item['fontSize'] = self::DEFAULT_FONT_SIZE;
         }
         $html = '';
         $html .= Html::beginTag('li', ['data-transition' => 'fade', 'data-slotamount' => '1', 'data-masterspeed' => '1000', 'data-style' => 'dark']);
         $html .= Html::img($item['imageUrl'], ['data-bgposition' => 'center center', 'data-bgfit' => 'cover', 'data-bgrepeat' => 'no-repeat']);
         // MAIN TITLE
         $html .= Html::beginTag('div', ['class' => 'caption customin customout', 'data-x' => 'center', 'data-y' => 'center', 'data-hoffset' => '', 'data-voffset' => '-30', 'data-speed' => '500', 'data-start' => '1000', 'data-customin' => 'x:0;y:0;z:0;rotationX:0.5;rotationY:0;rotationZ:0;scaleX:0.75;scaleY:0.75;skewX:0;skewY:0;opacity:0;transformPerspective:600;transformOrigin:50% 50%;', 'data-customout' => 'x:0;y:0;z:0;rotationX:0;rotationY:0;rotationZ:0;scaleX:0.75;scaleY:0.75;skewX:0;skewY:0;opacity:0;transformPerspective:600;transformOrigin:50% 50%;', 'data-easing' => 'Back.easeOut', 'data-splitin' => 'none', 'data-splitout' => 'none', 'data-elementdelay' => '0.1', 'data-endelementdelay' => '0.1', 'data-endspeed' => '600']);
         $html .= Html::tag('h3', $item['title'], ['class' => "c-main-title c-font-{$item['fontSize']} c-font-bold c-font-center c-font-uppercase c-font-white c-block"]);
         $html .= Html::endTag('div');
         // SUB TITLE
         if (isset($item['subTitle'])) {
             $html .= Html::beginTag('div', ['class' => 'caption customin customout', 'data-x' => 'left', 'data-y' => 'bottom', 'data-hoffset' => '', 'data-voffset' => '', 'data-speed' => '500', 'data-start' => '1800', 'data-customin' => 'x:0;y:0;z:0;rotationX:0.5;rotationY:0;rotationZ:0;scaleX:0.75;scaleY:0.75;skewX:0;skewY:0;opacity:0;transformPerspective:600;transformOrigin:50% 50%;', 'data-customout' => 'x:0;y:0;z:0;rotationX:0;rotationY:0;rotationZ:0;scaleX:0.75;scaleY:0.75;skewX:0;skewY:0;opacity:0;transformPerspective:600;transformOrigin:50% 50%;', 'data-easing' => 'Back.easeOut', 'data-splitin' => 'none', 'data-splitout' => 'none', 'data-elementdelay' => '0.1', 'data-endelementdelay' => '0.1', 'data-endspeed' => '600', 'style' => 'width: 100%;']);
             $html .= Html::beginTag('div', ['class' => 'c-action-bar']);
             $html .= Html::beginTag('div', ['class' => 'container']);
             $html .= Html::beginTag('div', ['class' => 'c-content']);
             $html .= Html::tag('h3', $item['subTitle'], ['class' => 'c-font-30 c-font-sbold c-font-white']);
             $html .= Html::endTag('div');
             $html .= Html::endTag('div');
             $html .= Html::endTag('div');
             $html .= Html::endTag('div');
         }
         $html .= Html::endTag('li');
         return $html;
     }]);
 }
Exemplo n.º 6
0
 public function run()
 {
     return Html::ul($this->flatPageList, ['class' => $this->htmlClass, 'item' => function ($flatPage, $index) {
         $class = $flatPage->url == Yii::$app->controller->action->id ? $this->activeLiClass : null;
         return Html::tag('li', Html::a($flatPage->anchor, [$flatPage->url]), ['class' => $class]);
     }]);
 }
Exemplo n.º 7
0
 public static function ulWithLink($items, $className = '', $isInline = false)
 {
     $finalClass = $isInline ? "{$className} list-inline" : $className;
     return Html::ul($items, ['item' => function ($item, $index) {
         $link = Html::a($item, $item->siteUrl);
         return "<li>{$link}</li>";
     }, 'class' => $finalClass]);
 }
Exemplo n.º 8
0
 public function actionAjaxElementsList()
 {
     $model = yii::$app->order->get(yii::$app->request->post('orderId'));
     $elements = Html::ul($model->elements, ['item' => function ($item, $index) {
         return Html::tag('li', "{$item->getModel()->getCartName()} - {$item->base_price} {$this->module->currency}x{$item->count}", ['class' => 'post']);
     }]);
     die(json_encode(['elementsHtml' => $elements]));
 }
Exemplo n.º 9
0
 /**
  * Renders the sort links.
  * @return string the rendering result
  */
 protected function renderSortLinks()
 {
     $attributes = empty($this->attributes) ? array_keys($this->sort->attributes) : $this->attributes;
     $links = [];
     foreach ($attributes as $name) {
         $links[] = $this->sort->link($name);
     }
     return Html::ul($links, array_merge($this->options, ['encode' => false]));
 }
 /**
  * @param Kurs[] $kursy
  * @return string
  */
 private function renderKursy($kursy)
 {
     return Html::ul(array_map(function (Kurs $item) {
         /* @var $formatter Formatter */
         $formatter = Yii::$app->formatter;
         $rukovoditel = Html::encode($formatter->asFizLico($item->rukovoditel_rel));
         return Html::encode($item->nazvanie) . ' ' . Html::tag('span', "(руководитель: {$rukovoditel})", ['class' => 'rukovoditel']);
     }, $kursy), ['encode' => false]);
 }
Exemplo n.º 11
0
 public function run()
 {
     $variantsList = $this->field->variants;
     $this->options['class'] .= ' field-variants';
     $this->options['item'] = function ($item, $index) {
         return $this->variant($item, $this->model->getFieldVariantIds($this->field->slug));
     };
     $variants = Html::ul($variantsList, $this->options);
     return $variants;
 }
Exemplo n.º 12
0
 /**
  * @param FizLico $model
  * @param mixed $key
  * @param int $index
  * @return string
  */
 public function renderDataCellContent($model, $key, $index)
 {
     /* @var $formatter Formatter */
     $formatter = Yii::$app->formatter;
     if ($model->telefon) {
         $contacts[] = $formatter->asHtmlTelefon($model->telefon);
     }
     if ($model->email) {
         $contacts[] = $formatter->asEmail($model->email);
     }
     return isset($contacts) ? Html::ul($contacts, ['encode' => false]) : $this->grid->emptyCell;
 }
Exemplo n.º 13
0
 public function run()
 {
     return \yii\helpers\Html::ul(array_merge($this->effects, ['iron' => $this->resources->iron, 'steel' => $this->resources->steel, 'chemicals' => $this->resources->chemicals, 'vv4a' => $this->resources->vv4a, 'population' => $this->resources->population, 'ice' => $this->resources->ice, 'water' => $this->resources->water, 'energy' => $this->resources->energy, 'credits' => $this->resources->credits]), ['class' => 'balance', 'item' => function ($item, $index) {
         $item = intval($item);
         if ($item === 0) {
             return '';
         } elseif ($item > 0) {
             return "<li>+{$item} {$index}</li>";
         } else {
             return "<li>{$item} {$index}</li>";
         }
     }]);
 }
Exemplo n.º 14
0
 public function run()
 {
     $variantsList = $this->filter->variants;
     $this->options['class'] .= ' filter-variants';
     $this->options['item'] = function ($item, $index) {
         return $this->variant($item);
     };
     $variants = Html::ul($variantsList, $this->options);
     $new = [];
     $new[] = Html::input('text', 'variant_value', '', ['placeholder' => 'Новый вариант', 'data-filter-id' => $this->filter->id, 'data-create-action' => Url::toRoute(['/filter/filter-variant/create']), 'class' => ' form-control']);
     $new[] = Html::button(Html::tag('i', '', ['class' => 'glyphicon glyphicon-plus']), ['class' => 'btn btn-success']);
     $variants .= Html::tag('div', implode('', $new), ['class' => 'new-variant']);
     return $variants;
 }
Exemplo n.º 15
0
 public function actionGetSessions()
 {
     $date = date('Y-m-d', strtotime(yii::$app->request->post('date')));
     $session = yii::$app->worksess->getSessions(null, $date);
     $json = [];
     if (empty($session)) {
         $json['HtmlList'] = '<ul><li>Сессии не были открыты.</li></ul>';
     } else {
         $json['HtmlList'] = Html::ul($session, ['item' => function ($item, $index) {
             return html::tag('li', Html::a(date('d.m.Y H:i:s', $item->start_timestamp) . ' ' . $item->shiftName, ['/service/report/index', 'sessionId' => $item->id]));
         }]);
     }
     die(json_encode($json));
 }
Exemplo n.º 16
0
 public function run()
 {
     $lis = [];
     if ($fields = $this->model->fields) {
         foreach ($fields as $field) {
             $value = $this->model->getField($field->slug);
             if (is_array($value)) {
                 $value = implode(', ', $value);
             }
             $lis[] = $field->name . ': ' . $value;
         }
     }
     return Html::ul($lis);
 }
Exemplo n.º 17
0
 /**
  * {@inheritdoc}
  */
 public function run()
 {
     $this->registerClientScript();
     $html = Html::activePasswordInput($this->model, $this->attribute, $this->inputOptions);
     $html .= '<div class="input-group-btn">';
     $html .= Html::button(Html::tag('span', '', ['class' => 'glyphicon glyphicon-eye-open']), ['class' => 'btn btn-default show-password' . ($this->inputOptions['disabled'] ? ' disabled' : ''), 'tabindex' => '-1']);
     if ($this->randomGenerator) {
         $html .= Html::button(Yii::t('hipanel', 'Random') . '&nbsp;<span class="caret"></span>', ['class' => 'btn btn-default dropdown-toggle' . ($this->inputOptions['disabled'] ? ' disabled' : ''), 'data-toggle' => 'dropdown', 'aria-expanded' => 'false', 'tabindex' => '-1']);
         $html .= Html::ul($this->randomOptions, ['class' => 'dropdown-menu', 'role' => 'menu', 'item' => function ($item) {
             return Html::tag('li', Html::a($item['label'], '#', ['data' => ['length' => $item['length'], 'specialchars' => $item['specialchars']], 'class' => 'random-passgen']));
         }]);
     }
     $html .= '</div>';
     echo Html::tag('div', $html, ['class' => 'input-group', 'id' => $this->id]);
 }
Exemplo n.º 18
0
 public function actionRescan()
 {
     // ------------------------- RESCAN MESSAGES ---------------------------
     $result = SourceMessageSearch::getInstance()->extract();
     // ----------------------- SHOW RESCAN RESULT --------------------------
     $message = Yii::t('app', 'Rescan successfully completed.') . '<br />';
     $message .= Html::ul([Yii::t('app', 'New messages:') . ' ' . (isset($result['new']) ? $result['new'] : 0), Yii::t('app', 'Obsolete messages:') . ' ' . (isset($result['obsolete']) ? $result['obsolete'] : 0)]);
     AppHelper::showSuccessMessage($message);
     // ---------------------------- REDIRECT -------------------------------
     if ($referrer = Yii::$app->getRequest()->referrer) {
         return $this->redirect($referrer);
     } else {
         return $this->redirect(['/translate-panel']);
     }
 }
Exemplo n.º 19
0
 public function run()
 {
     $session = \Yii::$app->getSession();
     $flashes = $session->getAllFlashes();
     $result = '';
     foreach ($flashes as $type => $data) {
         // only handle known flash types
         if (false === array_search($type, self::$types, true)) {
             continue;
         }
         $data = (array) $data;
         $messageList = \yii\helpers\Html::ul($data);
         $result .= str_replace(['{title}', '{messages}'], [$type, $messageList], $this->template);
         $session->removeFlash($type);
     }
     echo $result;
 }
Exemplo n.º 20
0
 protected function renderItems()
 {
     return Html::ul($this->items, array_merge(['item' => function ($item) {
         $_content = [];
         $_options = [];
         if (isset($item['thumbnail_id']) && $item['thumbnail_id']) {
             $_content[] = Html::tag('b', Html::img($this->createImageRoute($item['thumbnail_id'])));
         } else {
             if (isset($item['picture_id']) && $item['picture_id']) {
                 $_content[] = Html::tag('b', Html::img($this->createImageRoute($item['picture_id'])));
             } else {
                 if ($this->aliasToIcon && isset($item['alias']) && $item['alias']) {
                     $_content[] = Html::tag('b', Html::tag('i', null, ['class' => 'fa fa-' . $item['alias']]));
                 } else {
                     if ($this->keywordsToIcon && isset($item['keywords']) && $item['keywords']) {
                         $_content[] = Html::tag('b', Html::tag('i', null, ['class' => 'fa fa-' . $item['keywords']]));
                     }
                 }
             }
         }
         if (isset($item['name']) && $item['name']) {
             $_content[] = Html::tag('div', $item['name'], ['class' => 'name']);
         } else {
             if (isset($item['title']) && $item['title']) {
                 $_content[] = Html::tag('div', $item['title'], ['class' => 'title']);
             }
         }
         if (isset($item['alias']) && $item['alias']) {
             $_content[] = Html::tag('div', $item['alias'], ['class' => 'alias']);
         }
         if (isset($item['description']) && $item['description']) {
             $_content[] = Html::tag('div', $item['description'], ['class' => 'description']);
         }
         if ($this->targetBlank) {
             $_options['target'] = '_blank';
         }
         $content = Html::a(implode('', $_content), $this->createLink($item), $_options);
         $itemOptions = $this->itemOptions;
         if (isset($item['options'])) {
             $itemOptions = array_merge($item['options'], $itemOptions);
         }
         return Html::tag('li', $content, $itemOptions);
     }], $this->listOptions));
 }
Exemplo n.º 21
0
 public function run()
 {
     $model = $this->model;
     $params = [];
     $img = '';
     if ($model->getGalleryMode() == 'single') {
         if ($model->hasImage()) {
             $image = $this->model->getImage();
             $img = $this->getImagePreview($image);
             $params = $this->getParams($image->id);
         }
         return Html::tag('div', $img, $params) . '<br style="clear: both;" />' . $this->getFileInput();
     }
     $elements = $this->model->getImages();
     $cart = Html::ul($elements, ['item' => function ($item) {
         return $this->row($item);
     }, 'class' => 'pistol88-gallery']);
     return Html::tag('div', $cart . '<br style="clear: both;" />' . $this->getFileInput());
 }
Exemplo n.º 22
0
    /**
     * @return string
     */
    protected function renderNav()
    {
        $html = '';
        $html .= Html::beginTag('nav', ['class' => 'c-mega-menu c-mega-menu-onepage c-pull-right c-mega-menu-dark c-mega-menu-dark-mobile c-fonts-uppercase c-fonts-bold', 'data-onepage-animation-speed' => '700']);
        $html .= Html::ul($this->items, ['class' => 'nav navbar-nav c-theme-nav', 'encode' => false, 'item' => function ($item, $index) {
            $html = Html::beginTag('li');
            $html .= Html::a(Html::tag('i', '', ['class' => $item['icon']]) . $item['label'], $item['url'], ['class' => 'c-btn-border-opacity-04 c-btn btn-no-focus c-btn-header btn btn-sm c-btn-border-1x c-btn-white c-btn-circle c-btn-uppercase c-btn-sbold']);
            $html .= Html::endTag('li');
            return $html;
        }]);
        $html .= Html::endTag('nav');
        return $html;
        return '
        <nav class="c-mega-menu c-mega-menu-onepage c-pull-right c-mega-menu-dark c-mega-menu-dark-mobile c-fonts-uppercase c-fonts-bold" data-onepage-animation-speed="700">
			<ul class="nav navbar-nav c-theme-nav">
				<li>' . Html::a('<i class="icon-user"></i> Sign In', ['/user/dashboard'], ['class' => 'c-btn-border-opacity-04 c-btn btn-no-focus c-btn-header btn btn-sm c-btn-border-1x c-btn-white c-btn-circle c-btn-uppercase c-btn-sbold']) . '</li>
			</ul>
			</nav>
        ';
    }
Exemplo n.º 23
0
 protected function renderItems()
 {
     return Html::ul($this->items, array_merge(['item' => function ($item) {
         $itemOptions = $this->itemOptions;
         if (isset($item['options'])) {
             $itemOptions = array_merge($item['options'], $itemOptions);
         }
         $_options = [];
         if ($this->targetBlank) {
             $_options['target'] = '_blank';
         }
         if ($this->isCurrent($item)) {
             $itemOptions['class'] = (isset($itemOptions['class']) ? $itemOptions['class'] : '') . ' current';
         }
         $content = Html::a($item['title'] == '委托登录' ? Html::tag('strong', $item['title']) : $item['title'], [$this->moduleRoute . 'link/jump', 'id' => $item['id']], $_options);
         if ($this->recursive) {
             $content .= $this->children($item);
         }
         return Html::tag('li', $content, $itemOptions);
     }], $this->listOptions));
 }
Exemplo n.º 24
0
    } else {
        return $data['timestamp'];
    }
}, 'headerOptions' => ['class' => 'sort-numerical text-align-center'], 'footerOptions' => ['class' => 'sort-numerical text-align-center font-weight-bold th'], 'contentOptions' => ['class' => 'nowrap font-size-10px text-align-center']], ['attribute' => 'level', 'value' => function ($data) {
    switch ($data['level']) {
        case Logger::LEVEL_ERROR:
            $class = 'label label-danger';
            break;
        case Logger::LEVEL_WARNING:
            $class = 'label label-warning';
            break;
        case Logger::LEVEL_INFO:
            $class = 'label label-primary';
            break;
        default:
            $class = 'label label-default';
            break;
    }
    return Html::tag('span', Logger::getLevelName($data['level']), ['class' => $class]);
}, 'format' => 'html', 'filter' => [Logger::LEVEL_TRACE => ' Trace ', Logger::LEVEL_INFO => ' Info ', Logger::LEVEL_WARNING => ' Warning ', Logger::LEVEL_ERROR => ' Error '], 'filterInputOptions' => ['class' => 'form-control chosen-select', 'id' => null, 'prompt' => ' All '], 'headerOptions' => ['class' => 'text-align-center'], 'footerOptions' => ['class' => 'text-align-center font-weight-bold th'], 'contentOptions' => ['class' => 'text-align-center']], ['attribute' => 'category', 'headerOptions' => ['class' => 'text-align-center'], 'footerOptions' => ['class' => 'text-align-center font-weight-bold th'], 'contentOptions' => ['class' => 'font-size-10px']], ['attribute' => 'message', 'value' => function ($data) {
    $description = Html::encode(is_string($data['message']) ? $data['message'] : VarDumper::export($data['message']));
    $message = '<a href="javascript:;" class="spoiler-title" data-title="" data-content="' . $description . '">' . Stringy::substr(Stringy::collapseWhitespace($description), 0, 60, 'UTF-8') . '...' . '</a>';
    $trace = '';
    if (!empty($data['trace'])) {
        $trace .= Html::ul($data['trace'], ['class' => 'trace', 'item' => function ($trace) {
            return "<li>{$trace['file']} ({$trace['line']})</li>";
        }]);
    }
    $message .= '<div class="spoiler-content"><strong>Message: </strong><br /><pre>' . $description . '</pre>' . (!empty($trace) ? '<br /><p><strong>Trace: </strong>' . $trace . '</p>' : '') . '</div>';
    return $message;
}, 'format' => 'html', 'options' => ['width' => '50%'], 'contentOptions' => ['class' => 'spoiler']]]]);
Exemplo n.º 25
0
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="url-index">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>
    <?php 
// echo $this->render('_search', ['model' => $searchModel]);
?>

    <p>
        <?php 
echo Html::a(Yii::t('app', 'Create Url'), ['create'], ['class' => 'btn btn-success']);
?>
    </p>

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'id', 'url:ntext', ['label' => 'history', 'format' => 'html', 'value' => function ($model) {
    $data = $model->history;
    if ($data) {
        return Html::ul($data);
    } else {
        return '<i style="color:red">not set</i>';
    }
}], ['class' => 'yii\\grid\\ActionColumn']]]);
?>

</div>
Exemplo n.º 26
0
Arquivo: Tree.php Projeto: Liv1020/cms
    public function renderNodes($models)
    {
        $options["item"] = function ($model) {
            $isOpen = false;
            $isActive = false;
            $controller = \Yii::$app->cms->moduleCms()->createControllerByID("admin-tree");
            $controller->setModel($model);
            $child = "";
            foreach ($this->_openedTmp as $activeNode) {
                if (Validate::validate(new IsSame($activeNode), $model)->isValid()) {
                    $isOpen = true;
                    break;
                }
            }
            if ($isOpen && $model->children) {
                $child = $this->renderNodes($model->children);
            }
            $openCloseLink = "";
            $currentLink = "";
            if ($model->children) {
                $openedIds = $this->_getOpenIds();
                if ($isOpen) {
                    $newOptionsOpen = [];
                    foreach ($openedIds as $id) {
                        if ($id != $model->id) {
                            $newOptionsOpen[] = $id;
                        }
                    }
                    $urlOptionsOpen = array_unique($newOptionsOpen);
                    $params = \Yii::$app->request->getQueryParams();
                    $params[$this->openedRequestName] = $urlOptionsOpen;
                    $currentLink = UrlHelper::construct("cms/admin-tree/index")->setData($params);
                    $openCloseLink = Html::a(Html::tag("span", "", ["class" => "glyphicon glyphicon-minus", "title" => \Yii::t('app', "Minimize")]), $currentLink, ['class' => 'btn btn-xs btn-default']);
                } else {
                    $urlOptionsOpen = array_unique(array_merge($openedIds, [$model->id]));
                    $params = \Yii::$app->request->getQueryParams();
                    $params[$this->openedRequestName] = $urlOptionsOpen;
                    $currentLink = UrlHelper::construct("cms/admin-tree/index")->setData($params);
                    $openCloseLink = Html::a(Html::tag("span", "", ["class" => "glyphicon glyphicon-plus", "title" => \Yii::t('app', "Restore")]), $currentLink, ['class' => 'btn btn-xs btn-default']);
                }
                $openCloseLink = Html::tag("div", $openCloseLink, ["class" => "sx-node-open-close"]);
            }
            if ($this->_getMode() == 'multi') {
                $params = \Yii::$app->request->getQueryParams();
                $isSelected = in_array($model->id, $this->_getSelectedIds()) ? true : false;
                if ($isSelected) {
                    $result = [];
                    foreach ($this->_getSelectedIds() as $id) {
                        if ($id != $model->id) {
                            $result[] = $id;
                        }
                    }
                    $params[$this->selectedRequestName] = $result;
                } else {
                    $params[$this->selectedRequestName] = array_unique(array_merge($this->_getSelectedIds(), [$model->id]));
                }
                $link = UrlHelper::construct("cms/admin-tree/index")->setData($params);
                $controllElement = Html::checkbox('tree_id', $isSelected, ['value' => $model->id, 'style' => 'float: left; margin-left: 5px; margin-right: 5px;', 'onclick' => new JsExpression(<<<JS
        sx.Tree.select("{$model->id}", "{$link}"); return false;
JS
)]);
            } else {
                if ($this->_getMode() == 'single') {
                    $params = \Yii::$app->request->getQueryParams();
                    $isSelected = in_array($model->id, $this->_getSelectedIds()) ? true : false;
                    if ($isSelected) {
                        $params[$this->selectedRequestName] = [];
                    } else {
                        $params[$this->selectedRequestName] = [$model->id];
                    }
                    $link = UrlHelper::construct("cms/admin-tree/index")->setData($params);
                    $controllElement = Html::radio('tree_id', $isSelected, ['value' => $model->id, 'class' => 'sx-readio', 'style' => 'float: left; margin-left: 5px; margin-right: 5px;', 'onclick' => new JsExpression(<<<JS
        sx.Tree.selectSingle("{$model->id}");
JS
)]);
                } else {
                    if ($this->_getMode() == 'combo') {
                        $params = \Yii::$app->request->getQueryParams();
                        $isSelected = in_array($model->id, $this->_getSelectedIds()) ? true : false;
                        if ($isSelected) {
                            $result = [];
                            foreach ($this->_getSelectedIds() as $id) {
                                if ($id != $model->id) {
                                    $result[] = $id;
                                }
                            }
                            $params[$this->selectedRequestName] = $result;
                        } else {
                            $params[$this->selectedRequestName] = array_unique(array_merge($this->_getSelectedIds(), [$model->id]));
                        }
                        $link = UrlHelper::construct("cms/admin-tree/index")->setData($params);
                        $controllElement = Html::radio('tree_id', false, ['value' => $model->id, 'class' => 'sx-readio', 'style' => 'float: left; margin-left: 5px; margin-right: 5px;', 'onclick' => new JsExpression(<<<JS
                        sx.Tree.selectSingle("{$model->id}");
JS
)]);
                        $controllElement .= Html::checkbox('tree_id', $isSelected, ['value' => $model->id, 'style' => 'float: left; margin-left: 5px; margin-right: 5px;', 'onclick' => new JsExpression(<<<JS
        sx.Tree.select("{$model->id}", "{$link}"); return false;
JS
)]);
                    } else {
                        $controllElement = '';
                    }
                }
            }
            /**
             * @var $model \skeeks\cms\models\Tree
             */
            $additionalName = '';
            if ($model->level == 0) {
                if ($model->site) {
                    $additionalName = $model->site->name;
                }
            } else {
                if ($model->name_hidden) {
                    $additionalName = $model->name_hidden;
                }
            }
            $link = Html::a('<span class="glyphicon glyphicon-eye-open"></span>', $model->getAbsoluteUrl(), ["target" => "_blank", "class" => "btn-tree-node-controll btn btn-default btn-xs show-at-site", "title" => \Yii::t('app', "Show at site")]);
            $subsection = \Yii::t('app', 'Create subsection');
            return Html::tag("li", Html::tag("div", $openCloseLink . $controllElement . Html::tag("div", Html::a($model->name . ($additionalName ? ' [' . $additionalName . ']' : ''), $currentLink), ["class" => "sx-label-node level-" . $model->level . " status-" . $model->active]) . ($model->treeType ? Html::tag("div", $model->treeType->name, ["class" => "pull-left sx-tree-type"]) : '') . Html::tag("div", DropdownControllerActions::widget(["controller" => $controller, "renderFirstAction" => false, "containerClass" => "dropdown pull-left", 'clientOptions' => ['pjax-id' => 'sx-pjax-tree']]) . Html::tag("div", <<<HTML
                                        <a href="#" class="btn-tree-node-controll btn btn-default btn-xs add-tree-child" title="{$subsection}" data-id={$model->id}><span class="glyphicon glyphicon-plus"></span></a>
HTML
, ["class" => "pull-left sx-controll-act"]) . Html::tag("div", $link, ["class" => "pull-left sx-controll-act"]), ["class" => "sx-controll-node row"]), ["class" => "row"]) . $child, ["class" => "sx-tree-node " . ($isActive ? " active" : "") . ($isOpen ? " open" : ""), "data-id" => $model->id]);
        };
        $ul = Html::ul($models, $options);
        return $ul;
    }
Exemplo n.º 27
0
    public function testUl()
    {
        $data = [1, 'abc', '<>'];
        $expected = <<<EOD
<ul>
<li>1</li>
<li>abc</li>
<li>&lt;&gt;</li>
</ul>
EOD;
        $this->assertEqualsWithoutLE($expected, Html::ul($data));
        $expected = <<<EOD
<ul class="test">
<li class="item-0">1</li>
<li class="item-1">abc</li>
<li class="item-2"><></li>
</ul>
EOD;
        $this->assertEqualsWithoutLE($expected, Html::ul($data, ['class' => 'test', 'item' => function ($item, $index) {
            return "<li class=\"item-{$index}\">{$item}</li>";
        }]));
    }
Exemplo n.º 28
0
                <th>css</th>
                <td><?php 
        echo Html::ul($bundle['css'], ['class' => 'assets']);
        ?>
</td>
            </tr>
            <?php 
    }
    ?>
            <?php 
    if (!empty($bundle['js'])) {
        ?>
            <tr>
                <th>js</th>
                <td><?php 
        echo Html::ul($bundle['js'], ['class' => 'assets']);
        ?>
</td>
            </tr>
            <?php 
    }
    ?>
            <?php 
    if (!empty($bundle['depends'])) {
        ?>
            <tr>
                <th>depends</th>
                <td><ul class="assets">
                    <?php 
        foreach ($bundle['depends'] as $depend) {
            ?>
Exemplo n.º 29
0
<?php

use yii\helpers\Html;
$this->title = 'Список курсов';
echo Html::ul($kursy, ['item' => function ($item, $index) {
    return Html::tag('li', Html::a($item['nazvanie'], '/moi-kursy/list?kurs=' . $item['id']), ['class' => 'list-group']);
}]);
Exemplo n.º 30
0
$count = 0;
foreach ($guide->chapters as $chapterTitle => $sections) {
    if ($count && $count % $blocksPerRow === 0) {
        echo '</div><div class="row">';
    }
    ?>
        <div class="col-sm-6 col-md-3">
            <div class="panel panel-primary">
                <div class="panel-heading">
                    <h3 class="panel-title"><?php 
    echo Html::encode($chapterTitle);
    ?>
</h3>
                </div>
                <div class="panel-body">
                <?php 
    echo Html::ul($sections, ['item' => function ($name, $title) use($guide) {
        return '<li>' . Html::a(Html::encode($title), ['guide/view', 'section' => $name, 'language' => $guide->language, 'version' => $guide->version, 'type' => $guide->typeUrlName]) . '</li>';
    }, 'class' => 'list-unstyled']);
    ?>
                </div>
            </div>
        </div>
    <?php 
    $count++;
}
?>
        </div>
</div>
</div>