protected function _init() { parent::_init(); $app = App::i(); $this->_cadastro = Controllers\Cadastro::i(); $this->_enqueueStyles(); $this->_enqueueScripts(); $this->_publishAssets(); $this->assetManager->publishAsset('img/icon-diaspora.png', 'img/icon-diaspora.png'); $this->assetManager->publishAsset('img/icon-telegram.png', 'img/icon-telegram.png'); $this->assetManager->publishAsset('img/icon-instagram.png', 'img/icon-instagram.png'); $this->assetManager->publishAsset('img/icon-whatsapp.png', 'img/icon-whatsapp.png'); $this->assetManager->publishAsset('img/icon-culturadigital.png', 'img/icon-culturadigital.png'); $app->hook('GET(site.index):before', function () use($app) { $app->redirect($app->createUrl('cadastro', 'index')); }); if ($redeCulturaViva = $this->_cadastro->getUsermeta()) { $this->jsObject['redeCulturaViva'] = $redeCulturaViva; $inscricao = $this->_cadastro->getInscricao(); $this->jsObject['redeCulturaViva']->statusInscricao = $inscricao->status; } $this->assetManager->publishAsset('img/bg.png', 'img/bg.png'); $this->assetManager->publishAsset('img/slider-home-topo/Home01.jpg', 'img/slider-home-topo/Home01.jpg'); $this->assetManager->publishAsset('img/banner-home2.jpg', 'img/banner-home2.jpg'); $app->hook('view.render(site/search):before', function () { $this->jsObject['searchFilters'] = ['agent' => ['rcv_tipo' => 'EQ(ponto)']]; }); $app->hook('view.render(cadastro/<<*>>):before', function () use($app) { $this->jsObject['templateUrl']['taxonomyCheckboxes'] = $this->asset('js/directives/taxonomy-checkboxes.html', false); $area = $app->getRegisteredTaxonomy('MapasCulturais\\Entities\\Agent', 'area'); $this->jsObject['areasDeAtuacao'] = array_values($area->restrictedTerms); $this->jsObject['assets']['pinShadow'] = $this->asset('img/pin-sombra.png', false); $this->jsObject['assets']['pinMarker'] = $this->asset('img/marker-icon.png', false); $this->jsObject['assets']['pinAgent'] = $this->asset('img/pin-agente.png', false); }); $app->hook('view.render(<<*>>):before', function () use($app) { $this->jsObject['apiCNPJ'] = $app->config['rcv.apiCNPJ']; $this->jsObject['apiHeader'] = $app->config['rcv.apiHeader']; }); $app->hook('entity(agent).file(gallery).insert:after', function () { $this->transform('avatarBig'); }); /** DESABILITANDO ROTAS **/ return; if (!$app->user->is('admin') && !$app->user->is('guest')) { $ids = json_decode($app->user->redeCulturaViva); $inscricao = $app->repo('Registration')->find($ids->inscricao); // ROTAS DESLIGADAS PARA USUÁRIOS QUE NÃO TIVERAM SUA INSCRIÇÃO APROVADA if ($inscricao->status <= 0) { // desabilita o painel $app->hook('GET(panel.<<*>>):before', function () use($app) { $app->redirect($app->createUrl('cadastro', 'index'), 307); }); // desabilita criação de agentes e espaços $app->hook('GET(<<<project|event>>.<<create|edit>>):before', function () use($app) { $app->pass(); }); $app->hook('POST(<<project|event>>.index):before', function () use($app) { $app->pass(); }); } // desabilita criação de agentes e espaços para usuários não admin $app->hook('GET(<<agent|space>>.<<create|edit>>):before', function () use($app) { $app->pass(); }); $app->hook('POST(<<agent|space>>.index):before', function () use($app) { $app->pass(); }); } }