public function actionEdit($id) { $model = BlogCategory::findByPk($id); $model->reloadTranslations(); if (isset($_POST['BlogCategory']) && $model->setAttributes($_POST['BlogCategory'])->save()) { $model->saveTranslations(); Messages::get()->success(Translator::get()->t('Category saved!')); $this->goToAction('index'); } $this->assign('model', $model); }
<div class="blog-comments-list"> <?php foreach ($comments as $comment) { ?> <div class="comment"> <b><?php echo $comment->username; ?> </b> <?php echo htmlentities($comment->text); ?> </div> <?php } ?> </div> <?php } else { ?> <i><?php echo \app\components\htmltools\Translator::get()->t("Comments are hidden for this article!"); ?> </i> <?php } ?> </div> <?php } require_once dirname(dirname(__DIR__)) . '/layout/footer.php';
<?php require_once dirname(dirname(__DIR__)) . '/layout/header.php'; echo \mpf\widgets\datatable\Table::get(['dataProvider' => $model->getDataProvider(), 'columns' => ['url', 'author_id' => ['filter' => \mpf\helpers\ArrayHelper::get()->transform(\app\models\User::findAll(), ['id' => 'name']), 'value' => function (\mpf\modules\blog\models\BlogPost $model) { return $model->author->name; }], 'category_id' => ['filter' => \mpf\helpers\ArrayHelper::get()->transform(\mpf\modules\blog\models\BlogCategory::findAll(), ['id' => 'name']), 'value' => function (\mpf\modules\blog\models\BlogPost $model) { return $model->category->name; }], 'time_written' => ['class' => 'Date'], 'time_published' => ['class' => 'Date'], 'status' => ['filter' => \mpf\modules\blog\models\BlogPost::getStatuses(), 'value' => function (\mpf\modules\blog\models\BlogPost $model) { $all = \mpf\modules\blog\models\BlogPost::getStatuses(); return $all[$model->status]; }], ['class' => 'Actions', 'buttons' => ['delete' => ['class' => 'Delete'], 'edit' => ['class' => 'Edit'], 'publish' => ['post' => ['{{modelKey}}' => '$row->id'], 'confirmation' => \app\components\htmltools\Translator::get()->t("Are you sure that you want to publish the article?"), 'title' => '"Publish Article"', 'url' => "\\mpf\\WebApp::get()->request()->createURL('articles', 'publish')", 'icon' => '%MPF_ASSETS%images/oxygen/%SIZE%/actions/view-task.png', 'visible' => "\$row->status != " . \mpf\modules\blog\models\BlogPost::STATUS_PUBLISHED]], 'headerHtmlOptions' => ['style' => 'width:60px;']]]])->display(); require_once dirname(dirname(__DIR__)) . '/layout/footer.php';
?> </li> <?php } ?> </ul> </div> </div> <?php } ?> <?php foreach (\mpf\modules\blog\components\BlogConfig::get()->customSidePanels as $title => $content) { ?> <div class="blog-side-section"> <h2 class="blog-side-section-title"><?php echo \app\components\htmltools\Translator::get()->t($title); ?> </h2> <div class="blog-side-section-content"> <?php echo call_user_func($content); ?> </div> </div> <?php } ?> </div> </div>
echo \mpf\web\helpers\Html::get()->link(['home', 'read', ['id' => $article->id]], $article->getTitle()); ?> </h1> <div class="blog-article-header"> <?php echo \app\components\htmltools\Translator::get()->t("Written by"); ?> <?php echo $article->anonimous ? \app\components\htmltools\Translator::get()->t("Anonimous") : $article->author->name; ?> <?php echo \mpf\helpers\DateTimeHelper::get()->niceDate($article->time_published); ?> </div> <div class="blog-article-content"> <?php echo $article->getIcon(); ?> <?php echo $article->getContent(false); ?> </div> <div class="blog-article-footer"> <?php echo \mpf\web\helpers\Html::get()->link(['home', 'read', ['id' => $article->id]], \app\components\htmltools\Translator::get()->t('Read entire article')); ?> </div> </div> <?php } require_once dirname(dirname(__DIR__)) . '/layout/footer.php';