예제 #1
0
 public function actionEdit($id)
 {
     $article = BlogPost::findByPk($id);
     $article->edited_by = WebApp::get()->user()->id;
     $article->edit_time = date('Y-m-d H:i:s');
     $article->edit_number += 1;
     $article->beforeEdit();
     if (isset($_POST['BlogPost']) && $article->setAttributes(['anonimous' => 0]) && $article->setAttributes($_POST['BlogPost'])->save()) {
         $article->afterAdminEdit();
         $this->goToPage('home', 'read', ['id' => $article->id, 'title' => $article->url]);
     }
     $this->assign('model', $article);
     Messages::get()->info("Add " . BlogConfig::get()->introductionSeparator . " to set the limit for text displayed on the articles list!");
 }
예제 #2
0
        <?php 
echo $article->getCover();
?>
    </div>
    <div class="blog-article-content">
        <?php 
echo $article->getIcon();
?>
        <?php 
echo $article->getContent(true);
?>
    </div>
</div>

<?php 
if (\mpf\modules\blog\components\BlogConfig::get()->allowComments) {
    ?>
    <div class="blog-article-comments">
        <?php 
    if ($article->allow_comments) {
        ?>
            <div class="comment-form">
                <?php 
        if (\mpf\WebApp::get()->user()->isGuest()) {
            ?>
                    <?php 
            echo \mpf\widgets\form\Form::get(['name' => 'save', 'model' => $model, 'theme' => 'default-wide', 'fields' => ['username', 'email', ['name' => 'text', 'type' => 'textarea']]])->display();
            ?>
                <?php 
        } else {
            ?>
예제 #3
0
 /**
  * Get database table name.
  * @return string
  */
 public static function getTableName()
 {
     return BlogConfig::get()->tablesPrefix . "comments";
 }
예제 #4
0
 public function getAuthorIcon()
 {
     return WebApp::get()->request()->getWebRoot() . BlogConfig::get()->userAvatarURL . ($this->author->icon ?: 'default.png');
 }
예제 #5
0
                            <?php 
        echo \mpf\web\helpers\Html::get()->link(['home', 'category', ['id' => $category->id, 'name' => $category->name]], $category->getTitle());
        ?>
                        </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 
}
?>
예제 #6
0
<?php

if (\mpf\modules\blog\components\BlogConfig::get()->customHeader) {
    ?>
    <?php 
    require_once \mpf\modules\blog\components\BlogConfig::get()->customHeader;
    ?>
    <?php 
    return;
}
echo \app\components\htmltools\Page::get()->title($this->blogTitle . ($this->subTitle ? ' - ' . $this->subTitle : ''));
?>
<div id="blog-page">
    <div id="main-blog-section">
        
    
예제 #7
0
 /**
  * @return string
  */
 public function getDescription()
 {
     if (!$this->translation) {
         $this->translation = self::getDb()->table(BlogConfig::get()->tablesPrefix . 'categories_translations')->where("category_id = :id AND language = :lang", [':id' => $this->id, ':lang' => BlogConfig::get()->getActiveLanguage()]);
     }
     return $this->translation['description'];
 }