/** * @inheritdoc */ public function init() { parent::init(); if (!isset($this->successCreate)) { $this->successCreate = Module::t('page', 'Page has been successfully created.'); } if (!isset($this->errorCreate)) { $this->errorCreate = Module::t('page', 'Page has not been created. Please try again!'); } if (!isset($this->successUpdate)) { $this->successUpdate = Module::t('page', 'Page has been successfully saved.'); } if (!isset($this->successBatchUpdate)) { $this->successBatchUpdate = Module::t('page', '{count} pages have been successfully saved.'); } if (!isset($this->errorUpdate)) { $this->errorUpdate = Module::t('page', 'Page has not been saved. Please try again!'); } if (!isset($this->successDelete)) { $this->successDelete = Module::t('page', 'Page has been successfully deleted.'); } if (!isset($this->successBatchDelete)) { $this->successBatchDelete = Module::t('page', 'Pages have been successfully deleted.'); } }
/** * @inheritdoc */ public function init() { if (!isset($this->successCreate)) { $this->successCreate = Module::t('menu-item', 'Menu item has been successfully created.'); } if (!isset($this->errorCreate)) { $this->errorCreate = Module::t('menu-item', 'Menu item has not been created. Please try again!'); } if (!isset($this->successUpdate)) { $this->successUpdate = Module::t('menu-item', 'Menu item has been successfully saved.'); } if (!isset($this->successBatchUpdate)) { $this->successBatchUpdate = Module::t('menu-item', '{count} menu items have been successfully saved.'); } if (!isset($this->errorUpdate)) { $this->errorUpdate = Module::t('menu-item', 'Menu item has not been saved. Please try again!'); } if (!isset($this->successDelete)) { $this->successDelete = Module::t('menu-item', 'Menu item has been successfully deleted.'); } if (!isset($this->successBatchDelete)) { $this->successBatchDelete = Module::t('menu-item', 'Menu items have been successfully deleted.'); } parent::init(); }
?> <?php Pjax::begin(['id' => 'page-form']); ?> <?php $form = ActiveForm::begin(['id' => 'batch-update-form', 'options' => ['data-pjax' => 1]]); ?> <?php echo new FieldSet('category', [new TabSet('tabs', [new Tab('main', Module::t('category', 'Main'), [$model->isNewRecord ? $form->field($model, 'type')->dropDownList($model::getTypesList(), ['data-field' => 'type']) : null, $form->field($model, 'title')->textInput(['maxlength' => true]), $form->field($model, 'slug')->textInput(['maxlength' => true]), $form->field($model, 'content')->widget(CKEditor::className(), ['options' => ['rows' => 6], 'clientOptions' => ['filebrowserBrowseUrl' => Url::to(['/elfinder/manager']), 'filebrowserImageBrowseUrl' => Url::to(['/elfinder/manager', 'filter' => 'image'])]]), $form->field($model, 'status')->dropDownList($model::getStatusesList())])])]); ?> <?php echo Html::submitButton($model->isNewRecord ? Module::t('module', 'Create') : Module::t('module', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-primary' : 'btn btn-success']); ?> <?php ActiveForm::end(); ?> <?php Pjax::end(); ?> <?php if ($model->isNewRecord) { $url = Url::to(['create']); $script = <<<JS var type = '[data-field="type"]';
<?php use im\cms\Module; use vova07\imperavi\Widget as Imperavi; /* @var $this yii\web\View */ /* @var $model im\cms\models\Page */ /* @var $form yii\widgets\ActiveForm */ ?> <?php echo !isset($attributes) || in_array('title', $attributes) ? $form->field($model, 'title')->textInput(['maxlength' => 100]) : ''; ?> <?php echo !isset($attributes) || in_array('slug', $attributes) ? $form->field($model, 'slug')->textInput(['maxlength' => 100]) : ''; ?> <?php echo !isset($attributes) || in_array('content', $attributes) ? $form->field($model, 'content')->widget(Imperavi::className(), ['settings' => ['minHeight' => 300]]) : ''; ?> <?php echo !isset($attributes) || in_array('status', $attributes) ? $form->field($model, 'status')->dropDownList($model::getStatusesList(), ['prompt' => Module::t('page', 'Select status')]) : '';
<?php if ($model->display == WidgetArea::DISPLAY_ALWAYS) { echo $form->field($model, "[{$model->id}]display")->hiddenInput()->label(false); } else { echo $form->field($model, "[{$model->id}]display")->dropDownList(WidgetArea::getDisplayOptions(), ['data-action' => 'display']); } ?> <?php echo $form->field($model, "[{$model->id}]code")->hiddenInput()->label(false); ?> <?php echo Html::beginTag('div', $widgetArea->dropAreaOptions); if ($widgets = $model->widgets) { foreach ($widgets as $index => $widget) { echo $this->render('/widget-area/_selected_widget', ['widget' => $widget, 'form' => $form, 'widgetArea' => $model, 'index' => $index + 1]); } } else { ?> <div class="drop-area-placeholder" data-cont="drop-area-placeholder"><?php echo Module::t('widget-area', 'Drag widgets here'); ?> </div> <?php } echo Html::endTag('div'); ?> <div data-cont="temp"></div>
<?php use im\cms\Module; use yii\helpers\Html; use yii\grid\GridView; use yii\widgets\Pjax; /* @var $this yii\web\View */ /* @var $searchModel im\cms\models\MenuSearch */ /* @var $dataProvider yii\data\ActiveDataProvider */ $this->title = Module::t('menu', 'Menus'); $this->params['subtitle'] = Module::t('menu', 'Menus list'); $this->params['breadcrumbs'][] = $this->title; ?> <div class="box"> <div class="box-header with-border"> <h3 class="box-title"><?php echo $this->params['subtitle']; ?> </h3> <div class="box-tools pull-right"> <?php echo Html::a('<i class="fa fa-plus"></i>', ['create'], ['class' => 'btn btn-sm btn-default']); ?> </div> </div> <div class="box-body"> <?php Pjax::begin(); ?> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => ['name', ['class' => 'yii\\grid\\ActionColumn', 'template' => '{update} {delete}']]]);
/** * @inheritdoc */ public function attributeLabels() { return ['id' => Module::t('template', 'ID'), 'name' => Module::t('template', 'Name'), 'layout_id' => Module::t('template', 'Layout')]; }
/** * @return array Display options */ public static function getDisplayOptions() { return [self::DISPLAY_INHERIT => Module::t('page', 'Inherit'), self::DISPLAY_CUSTOM => Module::t('page', 'Custom'), self::DISPLAY_NONE => Module::t('page', 'Don\'t display')]; }
foreach ($attributes['pageMeta'] as $attribute) { ?> <?php echo Html::checkbox("attributes[pageMeta][]", true, ['value' => $attribute->name, 'label' => $attribute->label]); ?> <?php } } if (isset($attributes['openGraph'])) { ?> <h4><?php echo Module::t('page', 'Social Meta Tags'); ?> </h4> <h5><?php echo Module::t('page', 'Open Graph'); ?> </h5> <?php foreach ($attributes['openGraph'] as $attribute) { ?> <?php echo Html::checkbox("attributes[openGraph][]", true, ['value' => $attribute->name, 'label' => $attribute->label]); ?> <?php } } echo '<br>'; echo Html::submitButton(Module::t('page', 'Update'), ['class' => 'btn btn-success']); ActiveForm::end(); $this->registerJs("\n jQuery('#{$form->getId()} .select-all-attributes').on('click', function(e) {\n jQuery('#{$form->getId()}').find(':checkbox').prop('checked', this.checked);\n e.stopPropagation();\n });\n");
<?php // echo $form->field($model, 'meta_description') ?> <?php // echo $form->field($model, 'created_at') ?> <?php // echo $form->field($model, 'updated_at') ?> <?php echo $form->field($model, 'status')->dropDownList($model::getStatusesList(), ['prompt' => '']); ?> <div class="form-group"> <?php echo Html::submitButton(Module::t('page', 'Search'), ['class' => 'btn btn-primary']); ?> <?php echo Html::resetButton(Module::t('page', 'Reset'), ['class' => 'btn btn-default']); ?> </div> <?php ActiveForm::end(); ?> </div>
/** * @inheritdoc */ public function getCMSDescription() { return Module::t('page', 'Widget for displaying banners on the page.'); }
<?php use im\cms\Module; use yii\helpers\Html; use yii\grid\GridView; use yii\widgets\Pjax; /* @var $this yii\web\View */ /* @var $searchModel im\cms\models\TemplateSearch */ /* @var $dataProvider yii\data\ActiveDataProvider */ $this->title = Module::t('template', 'Templates'); $this->params['subtitle'] = Module::t('template', 'Templates list'); $this->params['breadcrumbs'][] = $this->title; ?> <div class="box"> <div class="box-header with-border"> <h3 class="box-title"><?php echo $this->params['subtitle']; ?> </h3> <div class="box-tools pull-right"> <?php echo Html::a('<i class="fa fa-plus"></i>', ['create'], ['class' => 'btn btn-sm btn-default']); ?> </div> </div> <div class="box-body"> <?php Pjax::begin(); ?> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => ['name', ['class' => 'yii\\grid\\ActionColumn', 'template' => '{update} {delete}']]]);
/** * @return array */ public static function getDisplayList() { return [self::DISPLAY_LIST => Module::t('menu-item', 'List'), self::DISPLAY_DROPDOWN => Module::t('menu-item', 'Dropdown'), self::DISPLAY_FULL_WIDTH_DROPDOWN => Module::t('menu-item', 'Full width dropdown'), self::DISPLAY_GRID => Module::t('menu-item', 'Grid (requires css class for items)')]; }
?> " data-popover-title="<?php echo Module::t('page', 'Fields to update'); ?> " data-modal="remotePjaxModal" class="btn btn-sm btn-default"> <i class="fa fa-edit"></i> </a>--> <a href="<?php echo Url::to(['create']); ?> " title="<?php echo Module::t('page', 'Create'); ?> " class="btn btn-sm btn-default"> <i class="fa fa-plus"></i> </a> <?php Toolbar::end(); ?> </div> </div> <div class="box-body"> <?php Pjax::begin(); ?> <?php echo GridView::widget($gridConfig);
<?php use im\cms\Module; use yii\helpers\Html; use yii\widgets\ActiveForm; /* @var $this yii\web\View */ /* @var $widget im\cms\models\ContentWidget */ /* @var $form yii\widgets\ActiveForm|im\forms\components\DynamicActiveForm */ ?> <?php $form = ActiveForm::begin(['id' => 'content-widget-form', 'options' => ['data-pjax' => 1]]); ?> <?php echo $form->field($widget, 'banner_id')->textInput(); ?> <?php echo Html::submitButton(Module::t('page', 'Save'), ['class' => $widget->isNewRecord ? 'btn btn-primary btn-large' : 'btn btn-success btn-large']); ?> <?php ActiveForm::end();
/* @var $model im\cms\models\Page */ /* @var $pageMeta im\cms\models\PageMeta */ /* @var $openGraph im\cms\models\OpenGraph */ $this->title = Module::t('page', 'Batch editing'); ?> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal"> <span aria-hidden="true">×</span> <span class="sr-only">Close</span> </button> <h4 class="modal-title"><?php echo $this->title; ?> </h4> </div> <div class="modal-body"> <?php echo FlashMessages::widget(); ?> <?php echo $this->render('_batch_form', ['page' => $model, 'pageMeta' => $pageMeta, 'openGraph' => $openGraph, 'attributes' => $attributes]); ?> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal"><?php echo Module::t('page', 'Close'); ?> </button> </div>
<?php use im\cms\Module; use yii\helpers\Html; use yii\widgets\ActiveForm; /* @var $this yii\web\View */ /* @var $model im\catalog\models\widgets\ProductCategoriesList */ /* @var $form yii\widgets\ActiveForm|im\forms\components\DynamicActiveForm */ /* @var $fieldConfig array */ $fieldConfig = isset($fieldConfig) ? $fieldConfig : []; ?> <?php if (!isset($form)) { $form = ActiveForm::begin(['id' => 'product-categories-widget', 'options' => ['data-pjax' => 1]]); } ?> <?php echo $form->field($model, 'depth', $fieldConfig)->textInput(); ?> <?php if (!isset($form)) { echo Html::submitButton(Module::t('module', 'Save'), ['class' => $model->isNewRecord ? 'btn btn-primary' : 'btn btn-success']); ActiveForm::end(); }
/** * @return array Statuses list */ public static function getStatusesList() { return [self::STATUS_UNPUBLISHED => Module::t('page', 'Unpublished'), self::STATUS_PUBLISHED => Module::t('page', 'Published'), self::STATUS_DELETED => Module::t('page', 'Deleted')]; }
<button class="btn btn-sm btn-default" title="<?php echo Module::t('category', 'Create'); ?> " data-toolbar-action="create"><span class="fa fa-plus" aria-hidden="true"></span></button> <button class="btn btn-sm btn-default" title="<?php echo Module::t('category', 'Edit'); ?> " data-toolbar-action="edit" data-not-selected-message="<?php echo Module::t('category', 'Please, select category to edit'); ?> "><span class="fa fa-pencil" aria-hidden="true"></span></button> <button class="btn btn-sm btn-default" title="<?php echo Module::t('category', 'Delete'); ?> " data-toolbar-action="delete" data-not-selected-message="<?php echo Module::t('category', 'Please, select categories to delete'); ?> "><span class="fa fa-trash-o" aria-hidden="true"></span></button> <?php JsTreeToolbar::end(); ?> </div> <div class="clearfix"></div> </div> </div> </div> <div class="col-xs-8"> <?php TreeDetails::begin(['id' => $treeDetailsId]); ?> <?php
<?php use im\cms\Module; /* @var $this yii\web\View */ /* @var $model im\cms\models\Page */ /* @var $form yii\widgets\ActiveForm */ $layouts = $model->getAvailableLayoutsList(); ?> <?php if ($layouts) { echo !isset($attributes) || in_array('layout_id', $attributes) ? $form->field($model, 'layout_id', ['labelOptions' => ['label' => Module::t('page', 'Layout')]])->dropDownList($layouts, ['prompt' => $model->getDefaultLayout()->getName()]) : ''; } ?>
/** * @inheritdoc */ public function getCMSDescription() { return Module::t('page', 'Widget for displaying content blocks on the page.'); }
/* @var $this yii\web\View */ /* @var $model im\cms\models\Template */ $this->title = Module::t('template', 'Templates'); $this->params['subtitle'] = Module::t('template', 'Template updating'); $this->params['breadcrumbs'] = [['label' => $this->title, 'url' => ['index']], $this->params['subtitle']]; ?> <div class="box box-success"> <div class="box-header with-border"> <h3 class="box-title"><?php echo $this->params['subtitle']; ?> </h3> <div class="box-tools pull-right"> <?php echo Html::a('<i class="fa fa-reply"></i>', ['index'], ['class' => 'btn btn-sm btn-default', 'title' => Module::t('module', 'Cancel')]); ?> <?php echo Html::a('<i class="fa fa-plus"></i>', ['create'], ['class' => 'btn btn-sm btn-default', 'title' => Module::t('module', 'Create')]); ?> <?php echo Html::a('<i class="fa fa-trash-o"></i>', ['delete', 'id' => $model->id], ['class' => 'btn btn-sm btn-default', 'title' => Module::t('module', 'Delete'), 'data-confirm' => Module::t('module', 'Are you sure you want to delete this item?'), 'data-method' => 'delete']); ?> </div> </div> <div class="box-body"> <?php echo $this->render('_form', ['model' => $model]); ?> </div> </div>
/** * Deletes an existing Template model. * If deletion is successful, the browser will be redirected to the 'index' page. * @param integer $id * @return mixed */ public function actionDelete($id) { $this->findModel($id)->delete(); Yii::$app->session->setFlash('success', Module::t('template', 'Template has been successfully deleted.')); return $this->redirect(['index']); }
<?php use im\cms\Module; /* @var $this yii\web\View */ /* @var $model im\cms\models\MenuItem */ $this->title = Module::t('menu-item', 'Menu items'); $this->params['subtitle'] = Module::t('menu-item', 'Menu item creation'); $this->params['breadcrumbs'] = [['label' => $this->title, 'url' => ['index']], $this->params['subtitle']]; ?> <div class="box box-primary"> <div class="box-header with-border"> <h3 class="box-title"><?php echo $this->params['subtitle']; ?> </h3> </div> <div class="box-body"> <?php echo $this->render('_form', ['model' => $model]); ?> </div> </div>
$layoutManager = Yii::$app->get('layoutManager'); if (is_string($layout)) { $layout = $layoutManager->getLayout($layout); } $availableWidgets = $layoutManager->getAvailableWidgets(); ?> <div class="row"> <div class="col-sm-6"> <h4><?php echo Module::t('layout', 'Widgets'); ?> </h4> <?php foreach ($layout->widgetAreas as $widgetArea) { echo WidgetArea::widget(['model' => $widgetArea, 'form' => $form]); } ?> </div> <div class="col-sm-6"> <h4><?php echo Module::t('layout', 'Available widgets'); ?> </h4> <?php foreach ($availableWidgets as $widget) { echo AvailableWidget::widget(['widget' => $widget]); } ?> </div> </div>
<?php use im\cms\Module; use yii\helpers\Html; /* @var $this yii\web\View */ /* @var $model im\cms\models\Page */ $this->title = Module::t('page', 'Pages'); $this->params['subtitle'] = Module::t('page', 'Page creation'); $this->params['breadcrumbs'] = [['label' => $this->title, 'url' => ['index']], $this->params['subtitle']]; ?> <div class="box box-primary"> <div class="box-header with-border"> <h3 class="box-title"><?php echo $this->params['subtitle']; ?> </h3> <div class="box-tools pull-right"> <?php echo Html::a('<i class="fa fa-reply"></i>', ['index'], ['class' => 'btn btn-sm btn-default', 'title' => Module::t('module', 'Cancel')]); ?> </div> </div> <div class="box-body"> <?php echo $this->render('_form', ['model' => $model]); ?> </div> </div>
} ?> <?php Block::end(); $tabs[] = ['label' => Module::t('page', 'Meta information'), 'content' => $content]; } ?> <?php if ($tabs) { ?> <div class="nav-tabs-custom"> <?php echo Tabs::widget(['items' => $tabs]); ?> </div> <?php } ?> <?php echo Html::submitButton(Module::t('page', 'Save'), ['class' => 'btn btn-success btn-large']); ?> <?php ActiveForm::end(); ?>