Exemplo n.º 1
0
 public function actionIndex($id, $page = 1)
 {
     $page = $page < 1 ? 1 : $page;
     $this->assign("subcategory", ForumSubcategory::findByPk($id));
     $this->assign('threads', ForumThread::findAllForSubcategory($id, $page));
     $this->assign('currentPage', $page);
     $this->assign('categories', ForumCategory::findAllBySection($this->sectionId, true));
 }
Exemplo n.º 2
0
<?php

/* @var $this \mpf\modules\forum\components\Controller */
/* @var $model \mpf\modules\forum\models\ForumThread */
echo \app\components\htmltools\Page::get()->title(\mpf\web\helpers\Html::get()->link($this->updateURLWithSection(['home', 'index']), $this->forumTitle) . " " . \mpf\modules\forum\components\Config::value('FORUM_PAGE_TITLE_SEPARATOR') . " " . \mpf\web\helpers\Html::get()->link($this->updateURLWithSection(['category', 'index', ['category' => $model->subcategory->category->url_friendly_name, 'id' => $model->subcategory->category_id]]), $model->subcategory->category->name) . " " . \mpf\modules\forum\components\Config::value('FORUM_PAGE_TITLE_SEPARATOR') . " " . \mpf\web\helpers\Html::get()->link($this->updateURLWithSection(['subcategory', 'index', ['category' => $model->subcategory->category->url_friendly_name, 'subcategory' => $model->subcategory->url_friendly_title, 'id' => $model->subcategory->category_id]]), $model->subcategory->title) . " " . \mpf\modules\forum\components\Config::value('FORUM_PAGE_TITLE_SEPARATOR') . " " . \mpf\web\helpers\Html::get()->link($this->updateURLWithSection(['thread', 'index', ['category' => $model->subcategory->category->url_friendly_name, 'subcategory' => $model->subcategory->url_friendly_title, 'id' => $model->id]]), $model->title) . " " . \mpf\modules\forum\components\Config::value('FORUM_PAGE_TITLE_SEPARATOR') . " " . \mpf\modules\forum\components\Translator::get()->translate("Move post"));
?>

<div class="forum-page <?php 
echo $this->forumPageTheme;
?>
">
    <?php 
$this->displayComponent('searchbar');
?>
    <?php 
$this->displayComponent('topuserpanel');
?>
    <?php 
echo \mpf\widgets\form\Form::get(['name' => 'move', 'model' => $model, 'theme' => 'default-wide', 'fields' => [['name' => 'subcategory_id', 'type' => 'select', 'options' => \mpf\modules\forum\models\ForumSubcategory::getAllForSelectTree($this->sectionId)]]])->display();
?>
</div>
Exemplo n.º 3
0
 public function afterMove($oldSub, $threadURL)
 {
     if ($oldSub == $this->subcategory_id) {
         return;
     }
     // same sub;
     $sub = ForumSubcategory::findByPk($oldSub);
     if ($sub->last_active_thread_id = $this->id) {
         $sub->checkLastActivity();
     }
     $sub->recalculateNumbers()->save();
     ForumSubcategory::findByPk($this->subcategory_id)->checkLastActivity()->recalculateNumbers()->save();
     if (WebApp::get()->user()->id != $this->user_id) {
         ModelHelper::notifyUser('thread.moved', $threadURL, ["admin" => WebApp::get()->user()->name, 'adminId' => WebApp::get()->user()->id, "title" => $this->title, "threadId" => $this->id, "newCategory" => $this->subcategory->category->name . Config::value('FORUM_PAGE_TITLE_SEPARATOR') . $this->subcategory->title], $this->user_id);
     }
 }
Exemplo n.º 4
0
 public function actionDelete()
 {
     if (isset($_POST['ForumUserGroup'])) {
         $models = ForumUserGroup::findAllByPk($_POST['ForumUserGroup']);
         foreach ($models as $model) {
             $model->delete();
         }
         Messages::get()->success("Deleted!");
         $this->goBack();
     }
     if (isset($_POST['ForumCategory'])) {
         $models = ForumCategory::findAllByPk($_POST['ForumCategory']);
         foreach ($models as $model) {
             $model->delete();
         }
         Messages::get()->success("Deleted!");
         $this->goBack();
     }
     if (isset($_POST['ForumSubcategory'])) {
         $models = ForumSubcategory::findAllByPk($_POST['ForumSubcategory']);
         foreach ($models as $model) {
             $model->delete();
         }
         Messages::get()->success("Deleted!");
         $this->goBack();
     }
 }