Commit 2b4665d1c33cc4f5e73ac8bf3eefdea9f1d41391
1 parent
294ab4fa
Exists in
master
and in
7 other branches
--no commit message
Showing
1 changed file
with
30 additions
and
1 deletions
Show diff stats
ferramentas/saiku/esquemaxml.php
| ... | ... | @@ -13,9 +13,20 @@ foreach($regioes as $regiao){ |
| 13 | 13 | } |
| 14 | 14 | exit; |
| 15 | 15 | */ |
| 16 | + | |
| 17 | +//cria as dimensoes de tipo temporal | |
| 18 | +$sqlAno = "select nu_ano from i3geo_metaestat.dim_tempo group by nu_ano order by nu_ano"; | |
| 19 | +$xml .= " | |
| 20 | + <Dimension name='Anual' type='TimeDimension' caption='Tempo: ano'> | |
| 21 | + <Hierarchy hasAll='true' primaryKey='nu_ano'> | |
| 22 | + <view alias='tempo_ano' ><SQL dialect='generic' >$sqlAno</SQL></view> | |
| 23 | + <Level name='Ano' column='nu_ano' type='Numeric' uniqueMembers='true' | |
| 24 | + levelType='TimeYears'/> | |
| 25 | + </Hierarchy> | |
| 26 | + </Dimension> | |
| 27 | +"; | |
| 16 | 28 | foreach($regioes as $regiao){ |
| 17 | 29 | $caminho = $m->hierarquiaPath($regiao["codigo_tipo_regiao"]); |
| 18 | - | |
| 19 | 30 | // |
| 20 | 31 | //verifica se a regiao tem hierarquia |
| 21 | 32 | if(empty($caminho)){ |
| ... | ... | @@ -138,6 +149,24 @@ foreach($tbs as $tb){ |
| 138 | 149 | <Table name='".$c["tabela"]."' schema='".$c["esquemadb"]."' /> |
| 139 | 150 | <DimensionUsage foreignKey='".$c["colunaidgeo"]."' name='codigo_tipo_regiao_".$c["codigo_tipo_regiao"]."' source='codigo_tipo_regiao_".$c["codigo_tipo_regiao"]."'/> |
| 140 | 151 | "; |
| 152 | + //verifica as dimensoes do tipo tempo | |
| 153 | + $dimTempo = array(); | |
| 154 | + foreach($tb as $medida){ | |
| 155 | + $parametros = $m->listaParametro($medida["id_medida_variavel"],"","",$apenasTempo=true,$ordenaPeloPai=false); | |
| 156 | + foreach($parametros as $parametro){ | |
| 157 | + if($parametro["tipo"] == 1){ | |
| 158 | + $VirtualCubeDimension[] = " | |
| 159 | + <VirtualCubeDimension name='Anual' /> | |
| 160 | + "; | |
| 161 | + $dimTempo[] = " | |
| 162 | + <DimensionUsage foreignKey='".$parametro["coluna"]."' name='Anual_{$c["esquemadb"]}{$c["tabela"]}' source='Anual'/> | |
| 163 | + "; | |
| 164 | + } | |
| 165 | + } | |
| 166 | + //echo "<pre>";var_dump($parametro);exit; | |
| 167 | + } | |
| 168 | + $xml .= implode(" ",array_unique($dimTempo)); | |
| 169 | + | |
| 141 | 170 | //inclui cada elemento em medida |
| 142 | 171 | foreach($tb as $medida){ |
| 143 | 172 | $agregador = "sum"; | ... | ... |