예제 #1
0
<div class="document-index">

    <?php 
echo $this->render('_search', ['model' => $searchModel]);
?>
    <?php 
echo $this->render('_tree', ['model' => $searchModel]);
?>

    <?php 
$gridColumns = [['class' => 'kartik\\grid\\SerialColumn', 'contentOptions' => ['class' => 'kartik-sheet-style'], 'width' => '30px', 'header' => '', 'headerOptions' => ['class' => 'kartik-sheet-style']], ['attribute' => 'id', 'width' => '70px', 'format' => 'raw', 'value' => function ($model) {
    $icon = $model->is_folder ? 'glyphicon glyphicon-folder-open' : 'glyphicon glyphicon-file';
    return "<span class='" . $icon . "'></span> " . $model->id;
}], 'name', ['attribute' => 'parent_id', 'vAlign' => 'middle', 'format' => 'raw', 'width' => '150px', 'value' => function ($model) {
    return $model->parent_id && $model->parent ? $model->parent->name : null;
}, 'filter' => Document::getAll(), 'filterType' => GridView::FILTER_SELECT2, 'filterWidgetOptions' => ['pluginOptions' => ['allowClear' => true]], 'filterInputOptions' => ['placeholder' => ' ', 'class' => 'form-control']], ['attribute' => 'template_id', 'vAlign' => 'middle', 'format' => 'raw', 'width' => '150px', 'value' => function ($model) {
    return $model->template_id && $model->template ? $model->template->name : null;
}, 'filter' => Template::getAll(), 'filterType' => GridView::FILTER_SELECT2, 'filterWidgetOptions' => ['pluginOptions' => ['allowClear' => true]], 'filterInputOptions' => ['placeholder' => ' ', 'class' => 'form-control']], ['attribute' => 'created_at', 'format' => ['date', 'dd.MM.Y HH:mm:ss'], 'width' => '200px', 'filter' => DatePicker::widget(['value' => isset($_GET['DocumentSearch']['created_at']) ? $_GET['DocumentSearch']['created_at'] : '', 'name' => 'DocumentSearch[created_at]', 'type' => DatePicker::TYPE_COMPONENT_APPEND, 'pluginOptions' => ['format' => 'dd.mm.yyyy', 'todayHighlight' => true]])], 'created_by', ['attribute' => 'status', 'vAlign' => 'middle', 'format' => 'raw', 'value' => function ($model) {
    switch ($model->status) {
        case Document::STATUS_BLOCKED:
            return '<span class="label label-danger">
                            <i class="glyphicon glyphicon-lock"></i> ' . Document::getStatusArray()[Document::STATUS_BLOCKED] . '</span>';
            break;
        case Document::STATUS_WAIT:
            return '<span class="label label-warning">
                            <i class="glyphicon glyphicon-hourglass"></i> ' . Document::getStatusArray()[Document::STATUS_WAIT] . '</span>';
            break;
        case Document::STATUS_ACTIVE:
            return '<span class="label label-success">
                            <i class="glyphicon glyphicon-ok"></i> ' . Document::getStatusArray()[Document::STATUS_ACTIVE] . '</span>';
            break;
예제 #2
0
        <div class="col-lg-6">
            <?php 
echo $form->field($model, 'alias', ['addon' => ['append' => ['content' => ButtonDropdown::widget(['label' => 'Сформировать', 'dropdown' => ['items' => [['label' => Yii::t('document', 'Из названия'), 'url' => '#', 'options' => ['class' => 'translate-name']], ['label' => Yii::t('document', 'Из заголовка'), 'url' => '#', 'options' => ['class' => 'translate-title']]]], 'options' => ['class' => 'btn-default']]), 'asButton' => true], 'groupOptions' => ['id' => 'alias-btn']]]);
?>
        </div>
        <div class="col-lg-6">
            <?php 
echo $form->field($model, 'status')->dropDownList(Document::getStatusArray());
?>
        </div>
    </div>

    <div class="row">
        <div class="col-lg-6">
            <?php 
echo $form->field($model, 'parent_id')->widget(Select2::classname(), ['data' => Document::getAll(), 'options' => ['placeholder' => '', 'class' => 'parent_id'], 'pluginOptions' => ['allowClear' => true]]);
?>
        </div>
        <div class="col-lg-6">
            <?php 
echo $form->field($model, 'template_id')->widget(Select2::classname(), ['data' => Template::getAll(), 'options' => ['placeholder' => '', 'class' => 'template_id'], 'pluginOptions' => ['allowClear' => true]]);
?>
        </div>
    </div>

    <div class="row">
        <div class="col-lg-6">
            <?php 
echo $form->field($model, 'meta_keywords')->textarea(['rows' => 2]);
?>
        </div>
예제 #3
0
        // Строка
        case 9:
            // Регулярное выражение
            echo Html::activeInput('text', $model, $attr_value, ['class' => 'form-control', 'id' => $attr_id]);
            break;
        case 3:
            // Флажок
            echo Html::activeCheckbox($model, $attr_value, ['class' => 'form-control', 'id' => $attr_id, 'label' => null]);
            break;
        case 5:
            // Текст
            echo Html::activeTextarea($model, $attr_value, ['class' => 'form-control', 'id' => $attr_id]);
            break;
        case 6:
            // Список (дочерние документы
            echo Select2::widget(['model' => $model, 'attribute' => $attr_value, 'data' => Document::getAll($field['param']), 'options' => ['id' => $attr_id, 'placeholder' => ''], 'pluginOptions' => ['allowClear' => true, 'class' => 'form-control', 'id' => $attr_id]]);
            break;
        case 8:
            // Файл (выбор с сервера)
            echo InputFile::widget(['controller' => 'elfinder', 'template' => '<div class="input-group">{input}<span class="input-group-btn">{button}</span></div>', 'options' => ['class' => 'form-control', 'id' => $attr_id], 'buttonOptions' => ['class' => 'btn btn-default'], 'buttonName' => Yii::t('document', 'Выбрать файл'), 'multiple' => false, 'name' => 'Document[fields][' . $field_id . '][data][' . $data_id . '][value]', 'value' => isset($model->fields[$field_id]['data'][$data_id]['value']) ? $model->fields[$field_id]['data'][$data_id]['value'] : null]);
            break;
        case 7:
            // Дата
            echo DatePicker::widget(['model' => $model, 'attribute' => $attr_value, 'options' => ['id' => $attr_id, 'placeholder' => ''], 'pluginOptions' => ['format' => 'dd.mm.yyyy', 'class' => 'form-control', 'id' => $attr_id]]);
            break;
    }
}
?>
            </div>
            <div class="help-block">
                <?php