source: sipes/0.3-modules/ente_planificador_hierarchical/views/ente_planificador_hierarchical_handler_filter_hierarchical_member.inc @ 2fa3319

stableversion-3.0
Last change on this file since 2fa3319 was 303fae2, checked in by José Gregorio Puentes <jpuentes@…>, 9 años ago

se agregaron los modulos

  • Propiedad mode establecida a 100755
File size: 2.3 KB
Línea 
1<?php
2  /**
3  *
4  * Sistema Automatizado para la Planificación Estratégico-Situacional en la Administración Pública Venezolana
5  * @file ente_planificador_hierarchical_handler_filter_hierarchical_member.inc
6  * Drupal part Module ente_planificador_hierarchical module
7  * Copyright 2015 Sistema Automatizado para la Planificación Estratégico-Situacional en la Administración Pública Venezolana (CENDITEL)
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
22  *
23  * Probado con un servidor Apache 2.0,
24  * Postgresql version 7.4.7 y 8.1 mysql 5.0.32 y PHP version 4.3.11 y 5.2.0-8
25  *
26  * @author Cenditel Merida - Msc. Juan Vizcarrondo
27  * @date 2015-02-14 // (a&#241;o-mes-dia)
28  * @version 0.2 // (0.1)
29  *
30  */
31
32
33/**
34 * Filter nodes based on whether they have an ente.
35 */
36class ente_planificador_hierarchical_handler_filter_hierarchical_member extends views_handler_filter_boolean_operator {
37  function query() {
38    global $user;
39    if (!user_access('admin planificador')) {
40      $inputs = array();
41      $this->ensure_my_table();
42      $table_alias = $this->table_alias;
43      if ($user->entes) {
44        $inputs[] = $user->entes;
45        $inputs[] = $user->entes;
46        $this->query->add_where($this->options['group'], (empty($this->value) ? "NOT " : "") . " (" . $table_alias . ".father = %d OR (" . $table_alias . ".nid = %d AND " . $table_alias . ".father = 0))", $inputs);
47      }
48      else {
49        //if user not has ente, not allow search any ente
50        $this->query->add_where($this->options['group'], (empty($this->value) ? "NOT " : "") . " " . $table_alias . ".nid = 0");
51      }
52    }
53  }
54}
Nota: Vea TracBrowser para ayuda de uso del navegador del repositorio.