<?php use pavlinter\admpages2\Module; use yii\helpers\Html; /* @var $this yii\web\View */ /* @var $model pavlinter\admpages2\models\Page */ /* @var $id_parent integer */ Yii::$app->i18n->disableDot(); $this->title = Module::t('', 'Create Page'); $this->params['breadcrumbs'] = []; $model::breadcrumbsTree($this->params['breadcrumbs'], $id_parent, ['lastLink' => true]); array_unshift($this->params['breadcrumbs'], ['label' => Module::t('', 'Pages'), 'url' => ['index', 'id_parent' => 0]]); $this->params['breadcrumbs'][] = $this->title; Yii::$app->i18n->resetDot(); ?> <div class="page-create"> <h1><?php echo Html::encode($this->title); ?> </h1> <?php echo $this->render('_form', ['model' => $model, 'id_parent' => $id_parent]); ?> </div>
$url = ['delete', 'id' => $model->id]; if ($model->id_parent) { $url['id_parent'] = $model->id_parent; } else { $url['id_parent'] = 0; } return Html::a('<span class="glyphicon glyphicon-trash"></span>', $url, ['title' => Module::t('title', 'Delete', ['dot' => false]), 'data-confirm' => Module::t('', 'Are you sure you want to delete this item?', ['dot' => false]), 'data-method' => 'post', 'data-pjax' => '0']); }, 'view' => function ($url, $model) { if ($model->alias) { return Html::a('<span class="glyphicon glyphicon-eye-open"></span>', $model->url(), ['title' => Module::t('title', 'View', ['dot' => false]), 'data-pjax' => '0', 'target' => '_blank']); } }, 'copy' => function ($url, $model) { $url = ['create', 'id' => $model->id]; if ($model->id_parent) { $url['id_parent'] = $model->id_parent; } else { $url['id_parent'] = 0; } return Html::a('<span class="fa fa-copy"></span>', $url, ['title' => Module::t('title', 'Copy', ['dot' => false]), 'data-pjax' => '0']); }, 'subpages' => function ($url, $model) { return Html::a('<span class="fa fa-plus-circle"></span>', ['', 'id_parent' => $model->id], ['title' => Module::t('title', 'Sub pages', ['dot' => false]), 'data-pjax' => '0']); }, 'files' => function ($url, $model) { if (!isset(Module::getInstance()->files[$model->type])) { return null; } return Html::a('<span class="fa fa-cloud-download"></span>', ['files', 'id' => $model->id], ['title' => Module::t('title', 'Files', ['dot' => false]), 'data-pjax' => '0']); }]]]]); ?> </div>
<div class="admpage-form"> <?php $form = Adm::begin('ActiveForm'); ?> <?php echo $form->errorSummary([$model] + $model->getLangModels(), ['class' => 'alert alert-danger']); ?> <div class="row"> <div class="col-xs-12 col-sm-6 col-md-3"> <?php echo $form->field($model, 'id_parent')->widget(\kartik\widgets\Select2::classname(), ['data' => $parentsData, 'options' => ['placeholder' => Module::t('', 'Select ...', ['dot' => false])], 'pluginOptions' => ['allowClear' => true]]); ?> </div> <div class="col-xs-12 col-sm-6 col-md-3"> <?php echo $form->field($model, 'layout')->widget(\kartik\widgets\Select2::classname(), ['data' => Module::getInst()->pageLayouts]); ?> </div> <div class="col-xs-12 col-sm-6 col-md-3"> <?php echo $form->field($model, 'type')->widget(\kartik\widgets\Select2::classname(), ['data' => Module::getInst()->pageTypes]); ?> </div> <div class="col-xs-12 col-sm-6 col-md-3"> <?php
Assets::addLangFile(Yii::$app->language, $this); $this->registerJs(' var btn = $.fn.button.noConflict(); $.fn.btn = btn; $("#elfinder").elfinder({ url : "' . Url::to(ArrayHelper::merge(['/adm/elfinder/connect', 'startPath' => $startPath], $elfinderData)) . '", lang : "' . Yii::$app->language . '", customData: {"' . Yii::$app->request->csrfParam . '":"' . Yii::$app->request->csrfToken . '"}, rememberLastDir : false, }); '); ?> <div class="admpages-files"> <h1><?php echo Html::encode($this->title); ?> </h1> <p> <?php echo Html::a(Module::t('', 'Update'), ['update', 'id' => $model->id, 'id_parent' => $id_parent], ['class' => 'btn btn-primary']); ?> <?php echo Html::a(Module::t('', 'Delete'), ['delete', 'id' => $model->id, 'id_parent' => $id_parent], ['class' => 'btn btn-danger', 'data' => ['confirm' => Module::t('', 'Are you sure you want to delete this item?', ['dot' => false]), 'method' => 'post']]); ?> </p> <div id="elfinder"></div> </div>