<?php
namespace Modules\Partners\Corporates\Dashboard; class Controller extends \ModulesAbstract\Dashboard\Controller { protected $actionsCfg = [ 'index' => ['checkSection' => true, 'checkOption' => false], 'indexWithoutCorporate' => ['checkSection' => true, 'checkOption' => false], 'selectFirstTemplate' => ['checkSection' => false, 'checkOption' => false], 'changeTemplate' => ['checkSection' => false, 'checkOption' => false], 'editDashboardElement' => ['checkSection' => false, 'checkOption' => false], 'editWidgetElement' => ['checkSection' => false, 'checkOption' => false], 'renderElement' => ['checkSection' => false, 'checkOption' => false], 'callMethod' => ['checkSection' => false, 'checkOption' => false], 'lock' => ['checkSection' => false, 'checkOption' => false], 'unlock' => ['checkSection' => false, 'checkOption' => false], ]; protected function getDashboardId() { return 'Modules\\Partners\\Corporates\\Dashboard\\Dashboard'; } protected function getStorageObj() { $storageObj = new \App\Dashboard\Storage\Database(); return $storageObj; } protected function populateOption(\Engine\Dashboard\GeneralAbstract $dashboardObj, $idEntity) { $dashboardObj->setOption('idCorporate', $idEntity); $dashboardObj->setTitle($this->lang['dashboard']['title']); } protected function actionIndex($R) { if ($R['idEntity']) { return parent::actionIndex($R); } return $this->execute('indexWithoutCorporate', $R); } protected function actionIndexWithoutCorporate($R) { $msgs = new \App\MessagesCollector(); if ($R['save']) { if (!$R['corporate']['id']) { $msgs->addError($this->lang['indexWithoutCorporate']['msgs']['noCorporateSelected']); } else { $params['idEntity'] = $R['corporate']['id']; return $this->execute('index', $params); } } $view = new View_IndexWithoutCorporate($this); $view->getMessagesCollector()->appendMessages($msgs); return new \Engine\Mvc\Response\Html($view->render()); } } 