示例#1
0
<?php

require_once dirname(dirname(__DIR__)) . '/layout/header.php';
?>

<?php 
echo \mpf\widgets\form\Form::get(['name' => 'save', 'model' => $model, 'theme' => 'default-wide', 'fields' => \mpf\modules\blog\models\BlogCategory::getFormFields()])->display();
?>

<?php 
require_once dirname(dirname(__DIR__)) . '/layout/footer.php';
示例#2
0
 /**
  * @return string[]
  */
 public static function getFormFields()
 {
     $f = ['url', ['name' => 'allow_comments', 'type' => 'checkbox'], ['name' => 'category_id', 'type' => 'select', 'options' => ArrayHelper::get()->transform(BlogCategory::findAll(), ['id' => 'name'])], ['name' => 'image_icon', 'type' => 'image', 'urlPrefix' => BlogConfig::get()->articleImageURL], ['name' => 'image_cover', 'type' => 'image', 'urlPrefix' => BlogConfig::get()->articleImageURL], ['name' => 'keywords', 'type' => 'seoKeywords'], ['name' => 'visibility', 'type' => 'select', 'options' => BlogConfig::get()->visibilityOptions], ['name' => 'anonimous', 'type' => 'checkbox']];
     foreach (BlogConfig::get()->languages as $lang) {
         $f[] = 'title[' . $lang . ']';
         $f[] = ['name' => 'content[' . $lang . ']', 'type' => 'markdown'];
     }
     return $f;
 }
示例#3
0
    echo \app\components\htmltools\Translator::get()->t('Categories');
    ?>
                <?php 
    if (\mpf\modules\blog\components\UserAccess::canEditCategories()) {
        ?>
                    <?php 
        echo \mpf\web\helpers\Html::get()->link(['categories', 'index'], \mpf\web\helpers\Html::get()->mpfImage('oxygen/22x22/actions/configure.png', \app\components\htmltools\Translator::get()->t('Manage Categories')), ['class' => 'blog-manage-categories-link', 'title' => \app\components\htmltools\Translator::get()->t('Manage Categories')]);
        ?>
                <?php 
    }
    ?>
            </h2>
            <div class="blog-side-section-content">
                <ul class="blog-categories-list">
                    <?php 
    foreach (\mpf\modules\blog\models\BlogCategory::findAll() as $category) {
        ?>
                        <li>
                            <?php 
        echo \mpf\web\helpers\Html::get()->link(['home', 'category', ['id' => $category->id, 'name' => $category->name]], $category->getTitle());
        ?>
                        </li>
                    <?php 
    }
    ?>
                </ul>
            </div>
        </div>
    <?php 
}
?>
示例#4
0
<?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';
示例#5
0
 public function actionDelete()
 {
     $model = BlogCategory::findByPk($_POST['BlogCategory']);
     $model->delete();
     $this->goToAction('index');
 }