Пример #1
0
 function _init()
 {
     parent::_init();
     $app = App::i();
     $app->hook('view.render(<<*>>):before', function () use($app) {
         $this->jsObject['assets']['logo-prefeitura'] = $this->asset('img/logo-prefeitura.png', false);
     });
 }
Пример #2
0
 function _init()
 {
     parent::_init();
     $app = App::i();
     $app->hook('view.render(<<*>>):before', function () use($app) {
         $this->_publishAssets();
     });
 }
Пример #3
0
 protected function _init()
 {
     parent::_init();
     $app = App::i();
     $app->hook("controller(site).render(page)", function () use($app) {
         $page = $this->data[0];
         $app->view->bodyClasses[] = "page-" . $page;
     });
 }
Пример #4
0
 function _init()
 {
     parent::_init();
     $app = App::i();
     $app->hook('API.<<*>>(space).query', function (&$data, &$select_properties, &$dql_joins, &$dql_where) {
         $dql_where .= ' AND e._type = 132';
     });
     $app->hook('view.render(<<*>>):before', function () use($app) {
         $this->_publishAssets();
     });
 }
Пример #5
0
 protected function _init()
 {
     parent::_init();
     $app = App::i();
     $app->hook("controller(site).render(page)", function () use($app) {
         $page = $this->data[0];
         $app->view->bodyClasses[] = "page-" . $page;
     });
     $app->hook('view.partial(<<*>>widget-areas):after', function ($part, &$html) use($app) {
         $html = '
             <div class="widget">
                 <h3>Código do Agente</h3>
                 <div class="agent-code">' . $this->controller->requestedEntity->id . '</div>
             </div>' . $html;
     });
 }
Пример #6
0
 protected function _init()
 {
     parent::_init();
     $app = App::i();
     $app->hook('entity(<<Agent|Space|Event|Project>>).save:after', function () use($app) {
         if (!$this->getValidationErrors()) {
             $num = strtoupper(substr($this->entityType, 0, 2)) . '-' . $this->id;
             $this->num_sniic = $num;
         }
     });
     $app->hook('view.render(<<*>>):before', function () use($app) {
         $this->jsObject['angularAppDependencies'][] = 'entity.controller.agentTypes';
     });
     $app->hook('template(<<space|agent|project|event>>.<<create|edit|single>>.name):after', function () {
         $this->enqueueScript('app', 'num-sniic', 'js/num-sniic.js');
         $this->part('num-sniic', ['entity' => $this->data->entity]);
     });
     $app->hook('template(agent.<<create|edit|single>>.type):after', function () {
         $this->part('tipologia-agente', ['entity' => $this->data->entity]);
     });
     $app->hook('template(space.<<create|edit|single>>.tab-about-service):before', function () {
         $this->part('mais-campos', ['entity' => $this->data->entity]);
     });
     // BUSCA POR NÚMERO SNIIC
     // adiciona o join do metadado
     $app->hook('repo(<<*>>).getIdsByKeywordDQL.join', function (&$joins, $keyword) {
         $joins .= "\n                LEFT JOIN \n                        e.__metadata num_sniic \n                WITH \n                        num_sniic.key = 'num_sniic'";
     });
     // filtra pelo valor do keyword
     $app->hook('repo(<<*>>).getIdsByKeywordDQL.where', function (&$where, $keyword) {
         $where .= "OR lower(num_sniic.value) LIKE lower(:keyword)";
     });
     // BUSCA POR NÚMERO MUNICIPIO
     // adiciona o join do metadado
     $app->hook('repo(<<*>>).getIdsByKeywordDQL.join', function (&$joins, $keyword) {
         $joins .= "\n                LEFT JOIN \n                        e.__metadata En_Municipio \n                WITH \n                        En_Municipio.key = 'En_Municipio'";
     });
     // filtra pelo valor do keyword
     $app->hook('repo(<<*>>).getIdsByKeywordDQL.where', function (&$where, $keyword) {
         $where .= "OR lower(En_Municipio.value) LIKE lower(:keyword)";
     });
 }
 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();
         });
     }
 }
Пример #8
0
    function _init()
    {
        parent::_init();
        $app = App::i();
        $app->hook('view.render(<<*>>):before', function () use($app) {
            $this->jsObject['assets']['logo-prefeitura'] = $this->asset('img/logo-prefeitura.png', false);
        });
        $theme = $this;
        $app->hook('GET(project.virada-cultural-2015.docx)', function () use($app, $theme) {
            $this->requireAuthentication();
            $project_id = 632;
            $entity = $app->repo('Project')->find($project_id);
            $entity->checkPermission('@control');
            $ids = $entity->getChildrenIds();
            $ids[] = $entity->id;
            $in = implode(',', array_map(function ($e) {
                return '@Project:' . $e;
            }, $ids));
            $events = $app->controller('Event')->apiQuery(['@select' => 'id,name,classificacaoEtaria,singleUrl,occurrences,terms,status,owner.id,owner.name,owner.singleUrl,project.id,project.name', 'project' => 'IN(' . $in . ')', '@permissions' => 'view', '@files' => '(avatar.avatarSmall):url']);
            $parceiros = ['Centro Acadêmico XI de Agosto' => [], 'Cultura Inglesa Festival' => [], 'Secretaria da Cultura do Estado de São Paulo' => [], 'Coletivo Teatral Commune' => [], 'Sesc São Paulo' => [], 'Família 100 Conflito' => [], 'Movimento Cultural Penha' => [], 'RenattodSousa Foto Galeria' => [], 'Kaapora Cultural' => [], 'Garageclub' => [], 'Associação Viva e Deixe Viver Contadores de História' => [], 'Garrafas Bar' => [], 'Cia. Teatral Bola de Neve' => [], 'Memorial da Inclusão: Os Caminhos da Pessoa com Deficiência' => [], 'Caixa Cultural São Paulo' => [], 'Dia da Música' => [], 'Serviço Funerário do Município de São Paulo' => [], 'Espaçoarte eventos' => [], 'UNAS' => [], 'Centro de Tradições Nordestinas' => [], 'Virada Coral' => [], 'Consulado Geral de Portugal em São Paulo' => [], 'Auditório Ibirapuera' => [], 'MASP' => []];
            $eventos_smc = [];
            foreach ($events as $e) {
                $e['owner']['name'] = trim(str_replace('  ', ' ', $e['owner']['name']));
                if (isset($parceiros[$e['owner']['name']])) {
                    $parceiros[$e['owner']['name']][] = $e;
                } else {
                    $eventos_smc[] = $e;
                }
            }
            $enderecos = [];
            $group_events = function ($events) use($enderecos) {
                $spaces = [];
                foreach ($events as $event) {
                    foreach ($event['occurrences'] as $occ) {
                        if (!isset($spaces[$occ->space->name])) {
                            $spaces[$occ->space->name] = [$occ->space->endereco];
                        }
                        if ($occ->rule->duration != 1440) {
                            $data = $occ->startsOn->format('Y-m-d') . ' ' . $occ->startsAt->format('H:i');
                            $spaces[$occ->space->name][$data] = $event['name'];
                        } else {
                            if (!isset($spaces[$occ->space->name]['24h'])) {
                                $spaces[$occ->space->name]['24h'] = [];
                            }
                            $spaces[$occ->space->name]['24h'][] = $event['name'];
                        }
                    }
                }
                foreach ($spaces as $name => $evts) {
                    ksort($spaces[$name]);
                }
                return $spaces;
            };
            $print_parceiro = function ($eventos, $parceiro = false) use($project_id, $group_events) {
                $projetos = [];
                $eventos_parceiro = [];
                foreach ($eventos as $evento) {
                    if ($evento['project']['id'] != $project_id) {
                        if (!isset($projetos[$evento['project']['name']])) {
                            $projetos[$evento['project']['name']] = [];
                        }
                        $projetos[$evento['project']['name']][] = $evento;
                    } else {
                        $eventos_parceiro[] = $evento;
                    }
                }
                $eventos_smc = $group_events($eventos_parceiro);
                $eventos_projeto = [];
                foreach ($projetos as $name => $evts) {
                    $eventos_projeto[$name] = $group_events($evts);
                }
                //                var_dump($eventos_smc);
                $print = function ($eventos, $h = 'h1') {
                    ksort($eventos);
                    foreach ($eventos as $palco => $evts) {
                        echo "<{$h}>{$palco}</{$h}>";
                        $endereco = $evts[0];
                        unset($evts[0]);
                        if ($endereco != $palco) {
                            echo "<em>{$endereco}</em><br><br>";
                        }
                        if (isset($evts['24h'])) {
                        } else {
                            $format = 'H:i';
                        }
                        $format = '\\d\\i\\a d \\à\\s H:i';
                        foreach ($evts as $hora => $nome) {
                            if ($hora == '24h') {
                                foreach ($nome as $n) {
                                    echo "  <b>{$hora}</b>   -   {$n}<br>";
                                }
                            } else {
                                $dt = new \DateTime($hora);
                                $hora = $dt->format($format);
                                echo "  <b>{$hora}</b>   -   {$nome}<br>";
                            }
                        }
                    }
                };
                if ($parceiro) {
                    $h1 = 'h2';
                    $h2 = 'h3';
                    $h3 = 'h4';
                } else {
                    $h1 = 'h1';
                    $h2 = 'h2';
                    $h3 = 'h3';
                }
                if ($parceiro) {
                    echo "<h1>{$parceiro}</h1>";
                }
                $print($eventos_smc, $h2);
                foreach ($eventos_projeto as $projeto => $evts) {
                    echo "<{$h1}>{$projeto}</{$h1}>";
                    $print($evts, $h3);
                }
            };
            $response = $app->response();
            $response->header("Content-Type", "application/vnd.openxmlformats-officedocument.wordprocessingml.document");
            $response->header('Content-Disposition', 'attachment; filename=virada-cultural-2015.docx');
            ?>
<html>
    <body>
        <?php 
            $print_parceiro($eventos_smc);
            ?>

        <?php 
            foreach ($parceiros as $parceiro => $eventos) {
                if (!$eventos) {
                    continue;
                }
                ?>
            <?php 
                $print_parceiro($eventos, $parceiro);
                ?>
        <?php 
            }
            ?>
    </body>
</html>
            <?php 
        });
    }