|
- <?php
-
-
-
- namespace backend\controllers;
-
- use common\helpers\Souke;
- use yii\filters\AccessControl;
-
-
- class DevelopmentController extends BackendController
- {
-
-
- public function behaviors()
- {
- return [
- 'access' => [
- 'class' => AccessControl::class,
- 'rules' => [
- [
- 'allow' => true,
- 'roles' => ['@'],
- 'matchCallback' => function ($rule, $action) {
- return $this->getUserModule()
- ->getAuthorizationChecker()
- ->isGrantedAsProducer($this->getUserCurrent());
- }
- ]
- ],
- ],
- ];
- }
-
-
-
- public function actionIndex()
- {
- $producerModule = $this->getProducerModule();
- $versionsArray = Souke::getVersions();
- $versionsRenderArray = [];
- foreach ($versionsArray as $version) {
- $versionsRenderArray[$version] = [
- 'version' => $version,
- 'content' => $this->renderFile('@common/versions/' . $version . '.php', [
- 'userCurrent' => $this->getUserCurrent()
- ])
- ];
- }
-
- $producerModule->updateOpendistribVersion($this->getProducerCurrent());
-
- return $this->render('index', [
- 'versionsArray' => $versionsRenderArray
- ]);
- }
- }
|