list-item.php 2.33 KB
<?php

/**
 * @author Alla Kuzmenko
 * @copyright (c), Thread
 */
use yii\helpers\{
    ArrayHelper, Html
};
use yii\widgets\Breadcrumbs;
use yii\bootstrap\Dropdown;

$get = Yii::$app->getRequest()->get();
$this->beginContent('@app/layouts/main.php');
?>
<div class="row white-bg page-heading">
    <div class="col-md-7">
        <h2>
            <?= Yii::t($this->context->module->name, $this->context->module->title) ?>.
            <?php // Yii::t($this->context->module->name, $this->context->group->lang->title) ?>
            <?= Yii::t($this->context->module->name, $this->context->title) ?>
        </h2>
        <?= Breadcrumbs::widget([
            'homeLink' => false,
            'links' => [
                [
                    'label' => Yii::t($this->context->module->name, $this->context->module->title),
                ],
                /*[
                    'label' => Yii::t($this->context->module->name, $this->context->group->lang->title),
                ],*/
                [
                    'label' => Yii::t($this->context->module->name, $this->context->title),
                ],
                Yii::t('app', 'List'),
            ],
        ]) ?>
    </div>
    <div class="col-md-2">
    </div>
    <div class="col-md-2">
        <h2 class="btn-group" role="group">
            <?php
            echo Html::button(Yii::t('app', 'Create') . ' <span class="caret"></span>', [
                'type' => 'button',
                'class' => 'btn btn-primary dropdown-toggle',
                'data-toggle' => 'dropdown',
                'aria-haspopup' => 'true',
                'aria-expanded' => 'false'
            ]);
            $items = $this->context->module::typeRange();
            $items_n = [];
            foreach ($items as $type => $label) {
                $items_n[] = ['label' => $label, 'url' =>  ArrayHelper::merge(['create', 'type' => $type], $get)];
            }
            echo Dropdown::widget([
                'items' => $items_n
            ]);
            unset($items, $items_n);

            echo  Html::a(Html::tag('i', '', ['class' => 'fa fa-trash']), ArrayHelper::merge([
                'trash'], $get),
                ['class' => 'btn btn-default', 'title' => Yii::t('app', 'Trash')]); ?>
        </h2>
    </div>
</div>

<div class="animated fadeIn">
    <?= $content; ?>
</div>

<?php $this->endContent(); ?>