/**
  * Lists all BlogCatalog models.
  * @return mixed
  */
 public function actionIndex()
 {
     //if(!Yii::$app->user->can('readPost')) throw new HttpException(403, 'No Auth');
     $searchModel = new BlogCatalogSearch();
     $dataProvider = BlogCatalog::get(0, BlogCatalog::find()->all());
     return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]);
 }
Esempio n. 2
0
 public function run()
 {
     $cacheId = Yii::$app->params["domain"] . '_blog_catalog';
     $catalogs = Yii::$app->cache->get($cacheId);
     if ($catalogs === false) {
         $queryCatalogs = BlogCatalog::find();
         $catalogs = $queryCatalogs->all();
         Yii::$app->cache->set($cacheId, $catalogs, $this->cacheDuration);
     }
     $dataProvider = BlogCatalog::get(0, $catalogs, 0, 2, ' ');
     return $this->render('catalogsList', ['title' => $this->title, 'dataProvider' => $dataProvider, 'cacheDuration' => $this->cacheDuration]);
 }
Esempio n. 3
0
use sircovsw\blog\models\BlogCatalog;
use kartik\markdown\MarkdownEditor;
use mihaildev\ckeditor\CKEditor;
/* @var $this yii\web\View */
/* @var $model backend\modules\blog\models\BlogPost */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="blog-post-form">

	<?php 
$form = ActiveForm::begin(['options' => ['class' => 'form-horizontal', 'enctype' => 'multipart/form-data'], 'fieldConfig' => ['template' => "{label}\n<div class=\"col-lg-10\">{input}</div>\n<div class=\"col-lg-5\">{error}</div>", 'labelOptions' => ['class' => 'col-lg-2 control-label']]]);
?>

	<?php 
echo $form->field($model, 'catalog_id')->dropDownList(ArrayHelper::map(BlogCatalog::get(0, BlogCatalog::find()->all()), 'id', 'str_label'));
?>

	<?php 
echo $form->field($model, 'title')->textInput(['maxlength' => 128]);
?>

	<?php 
echo $form->field($model, 'brief')->textarea(['rows' => 6]);
?>

	<?php 
echo $form->field($model, 'content')->widget(CKEditor::className(), ['editorOptions' => ['preset' => 'full', 'inline' => false]]);
?>

	<?php 
Esempio n. 4
0
<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use yii\helpers\ArrayHelper;
use sircovsw\blog\models\BlogCatalog;
use sircovsw\blog\Module;
/* @var $this yii\web\View */
/* @var $model sircovsw\blog\models\BlogCatalog */
/* @var $form yii\widgets\ActiveForm */
//fix the issue that it can assign itself as parent
$parentCatalog = ArrayHelper::merge([0 => Module::t('blog', 'Root Catalog')], ArrayHelper::map(BlogCatalog::get(0, BlogCatalog::find()->all()), 'id', 'str_label'));
unset($parentCatalog[$model->id]);
?>

<div class="blog-catalog-form">

	<?php 
$form = ActiveForm::begin(['options' => ['class' => 'form-horizontal', 'enctype' => 'multipart/form-data'], 'fieldConfig' => ['template' => "{label}\n<div class=\"col-lg-3\">{input}</div>\n<div class=\"col-lg-5\">{error}</div>", 'labelOptions' => ['class' => 'col-lg-2 control-label']]]);
?>

	<?php 
echo $form->field($model, 'parent_id')->dropDownList($parentCatalog);
?>

	<?php 
echo $form->field($model, 'title')->textInput(['maxlength' => 255]);
?>

	<?php 
echo $form->field($model, 'surname')->textInput(['maxlength' => 128]);