예제 #1
0
 protected function _init()
 {
     $app = App::i();
     /*
      *  Modifica a consulta da API de espaços para só retornar Bibliotecas 
      * 
      * @see protectec/application/conf/space-types.php
      */
     $app->hook('API.<<*>>(space).query', function (&$data, &$select_properties, &$dql_joins, &$dql_where) {
         $dql_where .= ' AND e._type >= 20 AND e._type <= 29';
     });
     parent::_init();
     $app->hook('template(space.<<create|edit|single>>.tabs):end', function () {
         $this->part('tabs-biblioteca', ['entity' => $this->data->entity]);
     });
     $app->hook('template(space.<<create|edit|single>>.tabs-content):end', function () {
         $this->part('tab-publico', ['entity' => $this->data->entity]);
         $this->part('tab-acervo', ['entity' => $this->data->entity]);
         $this->part('tab-infraestrutura', ['entity' => $this->data->entity]);
         $this->part('tab-gestao', ['entity' => $this->data->entity]);
         $this->part('tab-servicos', ['entity' => $this->data->entity]);
     });
     $app->hook('template(space.<<create|edit|single>>.acessibilidade):after', function () {
         $this->part('acessibilidade', ['entity' => $this->data->entity]);
     });
 }
예제 #2
0
 protected function _init()
 {
     parent::_init();
     $app = App::i();
     $this->jsObject['infoboxFields'] .= ',num_sniic';
     $app->hook('template(site.search.<<agent|space|event>>-infobox-new-fields-before):begin', function () use($app) {
         $this->part('infobox-new-fields-before');
     });
     $app->hook('template(panel.<<agents|spaces|events|projects>>.panel-new-fields-before):begin', function ($entity) use($app) {
         $this->part('panel-new-fields-before', ['entity' => $entity]);
     });
     $app->hook('controller(panel).extraFields(<<space|project|event>>)', function (&$fields) {
         $fields[] = 'num_sniic';
     });
 }
예제 #3
0
 protected function _init()
 {
     $app = App::i();
     // Adds Museus Space Types to JS
     $this->jsObject['mus_spaceTypes'] = $this->mus_getSpaceTypes();
     /*
      *  Modifica a consulta da API de espaços para só retornar Museus
      * 
      * @see protectec/application/conf/space-types.php
      */
     $app->hook('API.<<*>>(space).query', function (&$data, &$select_properties, &$dql_joins, &$dql_where) {
         $dql_where .= ' AND e._type >= 60 AND e._type <= 69';
     });
     parent::_init();
     // BUSCA POR CÓDIGO DO MUSEU
     // adiciona o join do metadado
     $app->hook('repo(<<*>>).getIdsByKeywordDQL.join', function (&$joins, $keyword) {
         $joins .= "\n                LEFT JOIN \n                        e.__metadata mus_cod\n                WITH \n                        mus_cod.key = 'mus_cod'";
     });
     // filtra pelo valor do keyword
     $app->hook('repo(<<*>>).getIdsByKeywordDQL.where', function (&$where, $keyword) {
         $where .= "OR lower(mus_cod.value) LIKE lower(:keyword)";
     });
     // modificações nos templates
     $app->hook('template(space.<<*>>.num-sniic):before', function () {
         $entity = $this->data->entity;
         if ($entity->mus_cod) {
             echo "<small><span class='label'>Código:</span> {$entity->mus_cod}</small>";
         }
     });
     $app->hook('template(space.<<create|edit|single>>.tabs):end', function () {
         $this->part('tabs-museu', ['entity' => $this->data->entity]);
     });
     $app->hook('template(space.<<create|edit|single>>.tabs-content):end', function () {
         $this->part('tab-publico', ['entity' => $this->data->entity]);
         $this->part('tab-mais', ['entity' => $this->data->entity]);
     });
     $app->hook('template(space.<<create|edit|single>>.tab-about-service):begin', function () {
         $this->part('about-servive-begin', ['entity' => $this->data->entity]);
     });
     $app->hook('template(space.<<create|edit|single>>.acessibilidade):after', function () {
         $entity = $this->data->entity;
         ?>
     <?php 
         if ($this->isEditable() || $entity->mus_acessibilidade_visual) {
             ?>
     <p>
         <span class="label">Acessibilidade para pessoas com deficiências auditivas e visuais: </span>
         <editable-multiselect entity-property="mus_acessibilidade_visual" empty-label="Selecione" allow-other="true" box-title="Acessibilidade para pessoas com deficiências auditivas e visuais" help-text="O museu oferece instalações e serviços destinados às pessoas com deficiências auditivas e visuais?"></editable-multiselect>
     </p>
     <?php 
         }
         ?>
         <?php 
     });
     $app->hook('template(space.<<*>>.location):after', function () {
         $this->enqueueScript('app', 'endereco-correspondencia', 'js/endereco-correspondencia.js');
         $this->part('endereco-correspondencia', ['entity' => $this->data->entity]);
     });
     // own
     $app->hook('POST(space.own)', function () use($app) {
         $this->requireAuthentication();
         $entity = $this->getRequestedEntity();
         if ($entity->mus_owned) {
             throw new \MapasCulturais\Exceptions\PermissionDenied($app->user, $entity, 'own');
         }
         $app->disableAccessControl();
         $entity->mus_owned = true;
         $entity->owner = $app->user->profile;
         $entity->save(true);
         $app->enableAccessControl();
         $this->json(true);
     });
     $app->hook('template(space.single.header-image):after', function () {
         $this->enqueueScript('app', 'botao-meu-museu', 'js/botao-meu-museu.js');
         $this->part('botao-meu-museu', ['entity' => $this->data->entity]);
     });
     $app->hook('view.render(space/<<*>>):before', function () {
         $this->addTaxonoyTermsToJs('mus_area');
         $this->includeOpeningTimeAssets();
     });
     /*
     $app->hook('template(space.<<create|edit|single>>.acessibilidade):after', function(){
         $this->part('acessibilidade', ['entity' => $this->data->entity]);
     });
     */
 }