Example #1
0
 function get_listado($excluir_predefinidos = true)
 {
     $proyecto = $this->db->quote($this->proyecto->get_id());
     $sql = "SELECT * FROM apex_puntos_montaje WHERE proyecto={$proyecto}";
     $pms_base = $this->db->consultar($sql);
     $rs = array();
     foreach ($pms_base as $registro) {
         $punto = toba_punto_montaje_factory::construir($registro);
         if ($excluir_predefinidos && $punto->es_interno()) {
             continue;
         }
         $rs[] = $punto->to_array();
     }
     return $rs;
 }
 function get_datos($tabla, $filtro = array())
 {
     $where = 'true';
     $order = '';
     $filtro_valores = $this->conexion->quote($filtro);
     if (isset($filtro['fecha_desde'])) {
         $where .= " AND aud.auditoria_fecha::date >= {$filtro_valores['fecha_desde']}";
     }
     if (isset($filtro['fecha_hasta'])) {
         $where .= " AND aud.auditoria_fecha::date <= {$filtro_valores['fecha_hasta']}";
     }
     if (isset($filtro['usuario'])) {
         $where .= " AND aud.auditoria_usuario = {$filtro_valores['usuario']}";
     }
     if (isset($filtro['operacion'])) {
         $where .= " AND aud.auditoria_operacion = {$filtro_valores['operacion']}";
     }
     if (isset($filtro['auditoria_id_solicitud'])) {
         $where .= " AND aud.auditoria_id_solicitud = {$filtro_valores['auditoria_id_solicitud']}";
     }
     if (isset($filtro['ordenar']) && $filtro['ordenar'] == 'clave') {
         $claves = $this->get_campos_claves($tabla);
         $order = implode(', ', $claves) . ', ';
     }
     if (isset($filtro['campo']) && isset($filtro['valor'])) {
         $resultado = null;
         if (preg_match('/^\\w*$/i', $filtro['campo'], $resultado)) {
             $where .= " AND aud.{$filtro['campo']} = {$filtro_valores['valor']}";
         }
     }
     $sql = "SELECT \n\t\t\t\t\taud.*,\n\t\t\t\t\tCASE \n\t\t\t\t\t\tWHEN aud.auditoria_operacion = 'U' THEN 'Modificación'\n\t\t\t\t\t\tWHEN aud.auditoria_operacion = 'I' THEN 'Alta'\n\t\t\t\t\t\tWHEN aud.auditoria_operacion = 'D' THEN 'Baja'\n\t\t\t\t\tEND as operacion_nombre\n\t\t\t\tFROM\n\t\t\t\t\t{$this->schema_logs}.{$tabla} as aud\n\t\t\t\tWHERE\n\t\t\t\t\t{$where}\n\t\t\t\tORDER BY {$order} aud.auditoria_fecha\n\t\t";
     $datos = $this->conexion->consultar($sql);
     return $datos;
 }