%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/vacivi36/intranet.vacivitta.com.br/protected/modules/wiki/controllers/
Upload File :
Create Path :
Current File : /home/vacivi36/intranet.vacivitta.com.br/protected/modules/wiki/controllers/OverviewController.php

<?php
/**
 * @link https://www.humhub.org/
 * @copyright Copyright (c) 2018 HumHub GmbH & Co. KG
 * @license https://www.humhub.com/licences
 */

namespace humhub\modules\wiki\controllers;

use Yii;
use yii\data\Pagination;
use humhub\modules\wiki\helpers\Url;
use humhub\modules\wiki\models\WikiPage;


/**
 * Class OverviewController
 * @package humhub\modules\wiki\controllers
 */
class OverviewController extends BaseController
{

    /**
     * @return $this|void|\yii\web\Response
     * @throws \yii\base\Exception
     */
    public function actionIndex()
    {
        $homePage = $this->getHomePage();
        if ($homePage !== null) {
            return $this->redirect(Url::toWiki($homePage));
        }

        return $this->redirect(Url::toOverview($this->contentContainer));
    }


    /**
     * @return OverviewController|string|\yii\console\Response|\yii\web\Response
     * @throws \yii\base\Exception
     */
    public function actionListCategories()
    {
        if (!$this->hasPages()) {
            return $this->render('no-pages', [
                'canCreatePage' => $this->canCreatePage(),
                'createPageUrl' => $this->contentContainer->createUrl('/wiki/page/edit'),
                'contentContainer' => $this->contentContainer
            ]);
        }

        return $this->render('list-categories', [
            'homePage' => $this->getHomePage(),
            'contentContainer' => $this->contentContainer,
            'canCreate' => $this->canCreatePage(),
        ]);

    }

    public function actionUpdateFoldingState(int $categoryId)
    {
        if (Yii::$app->user->isGuest) {
            return;
        }

        if (empty($categoryId)) {
            return;
        }

        $userSettings = Yii::$app->user->getIdentity()->getSettings();
        $foldingStateParamName = 'wiki.foldedCategory.' . $categoryId;

        if (Yii::$app->request->get('state')) {
            $userSettings->set($foldingStateParamName, true);
        } else {
            $userSettings->delete($foldingStateParamName);
        }
    }
}

Zerion Mini Shell 1.0