function retornaShapesSelecionados($objLayer, $map_file, $objMapa, $indexado = false) { $shapes = array(); $qyfile = dirname($map_file) . "/" . $objLayer->name . "_qy.map"; if (!file_exists($qyfile)) { return $shapes; } $handle = fopen($qyfile, "r"); $conteudo = fread($handle, filesize($qyfile)); fclose($handle); $listaDeIndices = unserialize($conteudo); if (count($listaDeIndices) == 0) { return $shapes; } $versao = versao(); $versao = $versao["principal"]; if ($objLayer->connectiontype != MS_POSTGIS) { //pega os shapes selecionados carregaquery2($map_file, $objLayer, $objMapa); $sopen = $objLayer->open(); if ($sopen == MS_FAILURE) { return "erro"; } $res_count = $objLayer->getNumresults(); $centroides = array(); $shapes = array(); //pega um shape especifico for ($i = 0; $i < $res_count; ++$i) { if ($versao >= 6) { $shape = $objLayer->getShape($objLayer->getResult($i)); $shp_index = $shape->index; } else { $result = $objLayer->getResult($i); $shp_index = $result->shapeindex; $shape = $objLayer->getfeature($shp_index, -1); } if ($indexado == true) { $shapes[$shp_index] = $shape; } else { $shapes[] = $shape; } } $fechou = $objLayer->close(); } else { //var_dump($listaDeIndices);exit; $rect = ms_newRectObj(); $rect->set("minx", -180); $rect->set("miny", -90); $rect->set("maxx", 180); $rect->set("maxy", 90); $status = $objLayer->open(); $status = $objLayer->whichShapes($rect); while ($shape = $objLayer->nextShape()) { if (in_array($shape->index, $listaDeIndices)) { if ($indexado == true) { $shapes[$shape->index] = $shape; } else { $shapes[] = $shape; } } } $objLayer->close(); } return $shapes; }
function redesenhaCorpo($tipoimagem, $utilizacgi, $locmapserv) { ms_ResetErrorList(); if (file_exists($this->locaplic . "/classe_imagem.php")) { include_once $this->locaplic . "/classe_imagem.php"; } else { include_once "classe_imagem.php"; } $nomer = ""; $qy = file_exists($this->qyfile); if ($qy) { foreach ($this->layers as $l) { $l->set("template", "none.htm"); carregaquery2($this->arquivo, $l, $this->mapa); } } $legenda = $this->mapa->legend; // //prepara a legenda para incluir no mapa, preenchendo os nomes das classes que podem estar em branco //isso ocorre quando o layer tem s� uma classe // if ($legenda->status == MS_EMBED) { foreach ($this->layers as $layer) { if ($layer->data != "" && strtoupper($layer->getmetadata("escondido")) != "SIM" && strtoupper($layer->getmetadata("tema")) != "NAO") { if ($layer->numclasses > 0) { $classe = $layer->getclass(0); if ($classe->name == "" || $classe->name == " ") { $classe->set("name", $layer->getmetadata("tema")); } } } } } $nome = nomeRandomico(); // //gera a imagem do mapa //se estiver sendo utilizado o cgi para desenhar a imagem //é necessário criar uma imagem vazia para capturar o nome que será retornado // if (isset($utilizacgi) && strtolower($utilizacgi) == "sim" && $tipoimagem == "nenhum" && !$qy) { foreach ($this->layers as $l) { $l->set("status", MS_OFF); } $imgo = @$this->mapa->draw(); } else { //if($tipoimagem != "nenhum") //{ $of = $this->mapa->outputformat; $of->set("imagemode", MS_IMAGEMODE_RGB); //} if (!$qy) { $imgo = @$this->mapa->draw(); } else { $imgo = @$this->mapa->drawQuery(); } $mensagemErro = ""; $error = ms_GetErrorObj(); while ($error && $error->code != MS_NOERR) { //printf("<br>Error in %s: %s<br>\n", $error->routine, $error->message); $mensagemErro .= $error->routine . " " . $error->message; $error = $error->next(); } ms_ResetErrorList(); $mensagemErro = str_replace("'", " ", $mensagemErro); $mensagemErro = str_replace(":", " ", $mensagemErro); $mensagemErro = str_replace("\n", " ", $mensagemErro); $nomer = $imgo->imagepath . "mapa" . $nome . ".png"; $imgo->saveImage($nomer); // //aplica o filtro de imagem se estiver definido em $tipoimagem // if ($tipoimagem !== "nenhum") { $tiposImagem = explode(" ", $tipoimagem); foreach ($tiposImagem as $tipoimagem) { $m = new Imagem($nomer); if ($tipoimagem == "cinza") { imagepng($m->cinzaNormal(), str_replace("\\", "/", $nomer)); } if ($tipoimagem == "sepiaclara") { imagepng($m->sepiaClara(), str_replace("\\", "/", $nomer)); } if ($tipoimagem == "sepianormal") { imagepng($m->sepiaNormal(), str_replace("\\", "/", $nomer)); } if ($tipoimagem == "negativo") { imagepng($m->negativo(), str_replace("\\", "/", $nomer)); } if ($tipoimagem == "detectaBordas") { imagepng($m->detectaBordas(), str_replace("\\", "/", $nomer)); } if ($tipoimagem == "embassa") { imagepng($m->embassa(), str_replace("\\", "/", $nomer)); } if ($tipoimagem == "gaussian_blur") { imagepng($m->gaussian_blur(), str_replace("\\", "/", $nomer)); } if ($tipoimagem == "selective_blur") { imagepng($m->selective_blur(), str_replace("\\", "/", $nomer)); } if ($tipoimagem == "mean_removal") { imagepng($m->mean_removal(), str_replace("\\", "/", $nomer)); } if ($tipoimagem == "pixelate") { imagepng($m->pixelate(), str_replace("\\", "/", $nomer)); } } } $nomer = $imgo->imageurl . basename($nomer); } if ($imgo == "") { return "erro"; } $e = $this->mapa->extent; $ext = $e->minx . " " . $e->miny . " " . $e->maxx . " " . $e->maxy; if (isset($utilizacgi) && strtolower($utilizacgi) == "sim" && !$qy) { $nomer = $locmapserv . "?map=" . $this->arquivo . "&mode=map&" . nomeRandomico(); } $res["mapscale"] = $this->mapa->scaledenom; $res["mapres"] = $this->mapa->resolution; $res["pixelsize"] = $this->mapa->cellsize; $res["mapexten"] = $ext; $res["mapimagem"] = $nomer; $res["w"] = $imgo->width; $res["h"] = $imgo->height; $res["mappath"] = $imgo->imagepath; $res["mapurl"] = $imgo->imageurl; $res["erro"] = $mensagemErro; return $res; }
function selecaoTema($temao, $tipo, $buffer = 0) { if (!$this->layer) { return "erro"; } $this->layer->set("tolerance", 0); if ($tipo == "novo") { $this->selecaoLimpa(); $tipo = "adiciona"; } if ($tipo == "limpa") { return $this->selecaoLimpa(); } if ($tipo == "inverte") { return $this->selecaoInverte(); } $layero = $this->mapa->getlayerbyname($temao); if ($layero->type == MS_LAYER_LINE || $layero->type == 1) { return "erro. O tema de sobreposicao nao pode ser do tipo linear."; } $tipoLayer = $this->layer->type; $tipoLayero = $layero->type; $this->layer->set("template", "none.htm"); $layero->set("template", "none.htm"); //if (file_exists($this->qyfile)) //{$this->mapa->loadquery($this->qyfile);} $indxlayer = $this->layer->index; carregaquery2($this->arquivo, $layero, $this->mapa); $res_count = $this->layer->getNumresults(); $res_counto = $layero->getNumresults(); if ($res_counto == 0) { return false; } $shp_atual = array(); if ($this->qyfileTema != "" && file_exists($this->qyfileTema)) { $shp_atual = $this->unserializeQ($this->qyfileTema); } $shpi = array(); $i = $layero->index; $selecao = ""; if ($layero->data != "") { $sopen = $layero->open(); if ($sopen == MS_FAILURE) { return "erro"; } $res_count = $layero->getNumresults(); for ($i = 0; $i < $res_count; ++$i) { if ($this->v >= 6) { $sh = $layero->getShape($layero->getResult($i)); } else { $result = $layero->getResult($i); $s = $result->shapeindex; $sh = $layero->getfeature($s, -1); } if ($buffer > 0) { $sh = $this->bufferShape($sh, $buffer); } $tiposh = $sh->type; if ($tiposh == 2) { $ident = @$this->layer->querybyshape($sh); } if ($tiposh == 0) { $lin = $sh->line(0); $npt = $lin->numpoints; if ($npt == 1) { $ptlin = $lin->point(0); $ident = $this->layer->queryByPoint($ptlin, 1, 0); } if ($npt > 1) { for ($k = 0; $k < $npt; $k++) { $ptlin = $lin->point($k); $s = $this->layer->queryByPoint($ptlin, 1, 0); if ($s != 1) { $res_countl = $this->layer->getNumresults(); for ($kk = 0; $kk < $res_countl; $kk++) { $result = $this->layer->getResult($kk); $shpi[] = $result->shapeindex; } } } $ident = 1; } } if ($ident != 1) { $res_countl = $this->layer->getNumresults(); for ($ii = 0; $ii < $res_countl; $ii++) { $result = $this->layer->getResult($ii); $shpi[] = $result->shapeindex; } } } $layero->close(); if (count($shpi) > 0) { $selecao = "ok"; } } if ($selecao != "ok" && $layero->data == "") { $layero->queryByRect($this->mapa->extent); $sopen = $layero->open(); if ($sopen == MS_FAILURE) { return "erro"; } $conta = $layero->getNumresults(); for ($k = 0; $k < $conta; $k++) { if ($this->v >= 6) { $s = @$layero->getShape($layero->getResult($k)); } else { $s = @$layero->getfeature($k, -1); } if ($buffer > 0) { $s = $this->bufferShape($s, $buffer); } if ($s) { if ($s->type == 2) { $this->layer->querybyshape($s); $res_count = $this->layer->getNumresults(); for ($i = 0; $i < $res_count; ++$i) { $result = $this->layer->getResult($i); $shpi[] = $result->shapeindex; } } else { $lin = $s->line(0); $npt = $lin->numpoints; for ($c = 0; $c < $npt; $c++) { $pt = $lin->point($c); $this->layer->set("tolerance", 0); $this->layer->set("toleranceunits", 6); if ($this->layer->type == MS_POINT || $this->layer->type == MS_LINE) { $this->layer->set("tolerance", 5); $ident = $this->layer->queryByPoint($pt, 1, 0); } else { $ident = $this->layer->queryByPoint($pt, 1, 0); } if ($ident != 1) { $res_countl = $this->layer->getNumresults(); for ($ii = 0; $ii < $res_countl; $ii++) { $result = $this->layer->getResult($ii); if ($result->shapeindex != "") { $shpi[] = $result->shapeindex; } } } } } } } $layero->close(); } if ($tipo == "adiciona" && count($shpi) > 0) { return $this->selecaoAdiciona($shpi, $shp_atual); } if ($tipo == "retira" && count($shp_atual) > 0) { return $this->selecaoRetira($shpi, $shp_atual); } }
function distanciaptpt($temaorigem, $temadestino, $temaoverlay, $locaplic, $itemorigem = "", $itemdestino = "") { // error_reporting(0); set_time_limit(180); // para manipular dbf if ($this->dbaseExiste == false) { include_once dirname(__FILE__) . "/../pacotes/phpxbase/api_conversion.php"; } // define o nome do novo shapefile que será criado $nomefinal = nomeRandomico(); $nomeshp = $this->diretorio . "/" . $nomefinal; $existesel = carregaquery2($this->arquivo, $this->layer, $this->mapa); if ($existesel == "nao") { return "errox"; } $layerorigem = $this->mapa->getlayerbyname($temaorigem); $layerdestino = $this->mapa->getlayerbyname($temadestino); $layeroverlay = $this->mapa->getlayerbyname($temaoverlay); $shapesorigem = retornaShapesSelecionados($layerorigem, $this->arquivo, $this->mapa); if (count($shapesorigem) == 0) { return "erro"; } $layeroverlay->set("tolerance", 0); $layerdestino->set("tolerance", 0); $layeroverlay->queryByrect($this->mapa->extent); $layerdestino->queryByFeatures($layeroverlay->index); $sopen = $layerdestino->open(); if ($sopen == MS_FAILURE) { return "erro"; } $res_count = $layerdestino->getNumresults(); for ($i = 0; $i < $res_count; ++$i) { if ($this->v >= 6) { $shapesdestino[] = $layerdestino->getShape($layerdestino->getResult($i)); } else { $result = $layerdestino->getResult($i); $shp_index = $result->shapeindex; $shapesdestino[] = $layerdestino->getshape(-1, $shp_index); } } $layerdestino->close(); $rect = $this->mapa->extent; $projInObj = $layerorigem->getProjection(); if ($projInObj == "") { $projInObj = ms_newprojectionobj("proj=longlat,ellps=WGS84,datum=WGS84,no_defs"); } $projOutObj = ms_newprojectionobj("proj=poly,ellps=GRS67,lat_0=" . $rect->miny . ",lon_0=" . $rect->minx . ",x_0=5000000,y_0=10000000"); $origemdestino = array(); if (count($shapesorigem) == 0) { return "erro"; } if (count($shapesdestino) == 0) { return "erro"; } $novoshpf = ms_newShapefileObj($nomeshp, MS_SHP_ARC); // cria o dbf $def[] = array("dist_m", "N", "10", "2"); $def[] = array("origem", "C", "255"); $def[] = array("destino", "C", "255"); if ($this->dbaseExiste == false) { $db = xbase_create($nomeshp . ".dbf", $def); xbase_close($db); } else { $db = dbase_create($nomeshp . ".dbf", $def); dbase_close($db); } // acrescenta os pontos no novo shapefile $dbname = $nomeshp . ".dbf"; if ($this->dbaseExiste == false) { $db = xbase_open($dbname, 2); } else { $db = dbase_open($dbname, 2); } foreach ($shapesorigem as $sorigem) { if ($itemorigem != "") { $valororigem = $sorigem->values[$itemorigem]; } else { $valororigem = ""; } foreach ($shapesdestino as $sdestino) { $linha = ms_newLineObj(); $linha->add($sorigem->getCentroid()); $linha->add($sdestino->getCentroid()); if ($itemdestino != "") { $valordestino = $sdestino->values[$itemdestino]; } else { $valordestino = ""; } $ShapeObj = ms_newShapeObj(MS_SHAPE_LINE); $ShapeObj->add($linha); $novoshpf->addShape($ShapeObj); $ShapeObj->project($projInObj, $projOutObj); $distancia = $ShapeObj->getLength(); $registro = array($distancia, $valororigem, $valordestino); if ($this->dbaseExiste == false) { xbase_add_record($db, $registro); } else { dbase_add_record($db, $registro); } } } if ($this->dbaseExiste == false) { xbase_close($db); } else { dbase_close($db); } // adiciona no mapa atual o novo tema $novolayer = criaLayer($this->mapa, MS_LAYER_LINE, MS_DEFAULT, "Distancias (" . $nomefinal . ")", $metaClasse = "SIM"); $novolayer->set("data", $nomeshp . ".shp"); $novolayer->setmetadata("DOWNLOAD", "SIM"); $novolayer->set("template", "none.htm"); $classe = $novolayer->getclass(0); $estilo = $classe->getstyle(0); $estilo->set("symbolname", "linha"); $estilo->set("size", 4); $cor = $estilo->color; $cor->setrgb(255, 210, 0); // limpa selecao if (file_exists($this->qyfile)) { unlink($this->qyfile); } return $nomeshp . ".shp"; }
function getDataStore($nomelayer, $colunasvalor, $colunanomeregiao, $titulo, $descricao, $ext = "", $mapType = "") { //$indicatorID, $year, $region){ if (!function_exists("versao")) { include dirname(__FILE__) . "/../../classesphp/funcoes_gerais.php"; } $versao = versao(); $versao = $versao["principal"]; $mapa = ms_newMapObj($this->map_file); if ($ext == "") { $mapa = extPadrao($mapa); } else { $e = str_replace(",", " ", $ext); $e = explode(" ", $ext); $extatual = $mapa->extent; $extatual->setextent(min($e[0], $e[2]), min($e[1], $e[3]), max($e[0], $e[2]), max($e[1], $e[3])); } $layer = $mapa->getlayerbyname($nomelayer); $layer->set("template", "none.html"); $existesel = "nao"; if ($this->postgis_mapa != "" && $this->postgis_mapa != " ") { if ($layer->connectiontype == MS_POSTGIS) { $lcon = $layer->connection; if ($lcon == " " || $lcon == "" || in_array($lcon, array_keys($this->postgis_mapa))) { if ($lcon == " " || $lcon == "") { $layer->set("connection", $this->postgis_mapa); } else { $layer->set("connection", $this->postgis_mapa[$lcon]); } } } } $itens = pegaItens($layer, $mapa); carregaquery2($this->map_file, $layer, $mapa); if ($layer->getNumresults() > 0) { $existesel = "sim"; } if ($existesel == "nao") { $layer->querybyrect($mapa->extent); } $layer->open(); $res_count = $layer->getNumresults(); $dataStore = array(); $dataStore['indicators']['valores'] = array("name" => $titulo, "description" => $descricao, "source" => "", "decimals" => 2, "max" => 0, "min" => 0); for ($i = 0; $i < $res_count; $i++) { $valitem = array(); if ($versao >= 6) { $shape = $layer->getShape($layer->getResult($i)); } else { $shape = $layer->getFeature($layer->getResult($i)->shapeindex); } $pt = $shape->getCentroid(); $texto = $shape->values[$colunanomeregiao]; /* if(!mb_detect_encoding($texto,"ISO-8859-1",true)){ $texto = mb_convert_encoding($texto,"ISO-8859-1","UTF-8"); } */ if ($mapType == "bar") { $wkt = ""; } else { $wkt = $shape->toWkt(); } $dataStore['features'][$i] = array("featureID" => $i, "name" => $texto, "lon" => round($pt->x, 6), "lat" => round($pt->y, 6), "wkt" => $wkt); //[0] � o ano foreach ($colunasvalor as $colunavalor) { $valor = $shape->values[$colunavalor]; settype($valor, "float"); //echo $valor; if (is_numeric($valor)) { $valor = number_format($valor, 2, '.', ''); $dataStore['indicators']['valores']['values'][$colunavalor][$i] = $valor; $indicatorYears[$colunavalor] = $colunavalor; $todosV[] = $valor; } } } $fechou = $layer->close(); $dataStore['indicators']['valores']['years'] = $indicatorYears; $dataStore['indicators']['valores']['max'] = max($todosV); $dataStore['indicators']['valores']['min'] = min($todosV); //echo "<pre>"; //var_dump($dataStore); return $dataStore; /* $sqlregion = ''; if ($region) $sqlregion = "region = $region AND"; $sqlyear = ''; if ($year) $sqlyear = "AND year = $year"; // Add features - exclude Antarctica $sql = "SELECT un AS featureID, name, lon, lat, AsText(geom) AS wkt FROM $this->featureTable WHERE $sqlregion un != 10 ORDER BY featureID"; $features = $this->dbc->query($sql); while($row = $features->fetch_array(MYSQLI_ASSOC)) { // First field should be feature id $featureID = array_shift($row); // Add feature to dataStore $dataStore['features'][$featureID] = $row; } $indicatorYears = array(); // Select indicator metadata $sql = "SELECT name, description, source, decimals, (SELECT ROUND(MAX(value),decimals) FROM indicator_values, $this->featureTable WHERE variable=$indicatorID AND indicator_values.area=un $sqlyear) AS max, (SELECT ROUND(MIN(value),decimals) FROM indicator_values, $this->featureTable WHERE variable=$indicatorID AND indicator_values.area=un $sqlyear) AS min FROM $this->indicatorTable WHERE id=$indicatorID"; $result = $this->dbc->query($sql); $indicator = $result->fetch_assoc(); $precision = $indicator['decimals']; // Add indicator to dataStore $dataStore['indicators'][$indicatorID] = $indicator; // Select indicator values (only values that have features) $sql = "SELECT indvalues.area AS featureID, indvalues.year, indvalues.value FROM $this->valuesTable AS indvalues, $this->featureTable WHERE indvalues.variable=$indicatorID AND indvalues.area=un $sqlyear ORDER BY indvalues.value"; // Needed for qunatiles calculation $result = $this->dbc->query($sql); // Add indicator values to dataStore while($row = $result->fetch_row()) { $dataStore['indicators'][$indicatorID]['values'][$row[1]][$row[0]] = number_format($row[2], $precision, '.', ''); // Find all years with values (could also be a separate sql for better performance) $indicatorYears[$row[1]] = $row[1]; } sort($indicatorYears); $dataStore['indicators'][$indicatorID]['years'] = $indicatorYears; return $dataStore; */ }
$mapa = ms_newMapObj($map_file); substituiConObj($temp, $postgis_mapa); if ($ext && $ext != "") { $e = explode(" ", $ext); $extatual = $mapa->extent; $extatual->setextent(min($e[0], $e[2]), min($e[1], $e[3]), max($e[0], $e[2]), max($e[1], $e[3])); } $layer = $mapa->getlayerbyname($temarel); $layer->set("template", "none.html"); //$layer->set("data",$layer->data."options='-c client_encoding=LATIN1'"); $existesel = "nao"; /* if (file_exists($map_file."qy")) {$mapa->loadquery($map_file."qy");} */ carregaquery2($map_file, $layer, $mapa); if ($layer->getNumresults() > 0) { $existesel = "sim"; } if ($existesel == "nao") { $layer->querybyrect($mapa->extent); } $layer->open(); if (strtoupper($layer->getmetadata("convcaracter")) == "NAO") { $convC = false; } else { $convC = true; } //$registros[] = array(); $res_count = $layer->getNumresults(); for ($i = 0; $i < $res_count; $i++) {
function dadosLinhaDoTempo($map_file, $tema, $ext = "") { $map = ms_newMapObj($map_file); if ($ext && $ext != "") { $e = explode(" ", $ext); $extatual = $map->extent; $extatual->setextent(min($e[0], $e[2]), min($e[1], $e[3]), max($e[0], $e[2]), max($e[1], $e[3])); } $layer = $map->getLayerByName($tema); $selecionados = carregaquery2($map_file, $layer, $map); if ($exclui == "") { $exclui = "nulo"; } //define os itens para pegar os dados $itens = array(); if ($layer->getmetadata("ltempoformatodata") == "") { return "Nao esta definido o metadata com o formato do campo"; } if ($layer->getmetadata("ltempoiteminicio") != "") { $iteminicio = $layer->getmetadata("ltempoiteminicio"); $itens[] = $iteminicio; } else { return "Nao esta definido o metadata com o item inicial"; } $itemi = ""; if ($layer->getmetadata("ltempoitemimagem") != "") { $itemi = $layer->getmetadata("ltempoitemimagem"); $itens[] = $itemi; } $itemicone = ""; if ($layer->getmetadata("ltempoitemicone") != "") { $itemicone = $layer->getmetadata("ltempoitemicone"); $itens[] = $itemicone; } $itemfim = ""; if ($layer->getmetadata("ltempoitemfim") != "") { $itemfim = $layer->getmetadata("ltempoitemfim"); $itens[] = $itemfim; } $itemtitulo = $iteminicio; if ($layer->getmetadata("ltempoitemtitulo") != "") { $itemtitulo = $layer->getmetadata("ltempoitemtitulo"); $itens[] = $itemtitulo; } $itemdescricao = $itemtitulo; if ($layer->getmetadata("ltempoitemdescricao") != "") { $itemdescricao = $layer->getmetadata("ltempoitemdescricao"); $itens[] = $itemdescricao; } $itemtip = $itemdescricao; if ($layer->getmetadata("ltempoitemtip") != "") { $itemtip = $layer->getmetadata("ltempoitemtip"); $itens[] = $itemtip; } $itemlink = ""; if ($layer->getmetadata("ltempoitemlink") != "") { $itemlink = $layer->getmetadata("ltempoitemlink"); $itens[] = $itemlink; } $converteE = "sim"; if ($layer->getmetadata("ltempoconvencode") != "") { $converteE = $layer->getmetadata("ltempoconvencode"); } $dados = pegaValoresM($map, $layer, $itens, $exclui, $selecionados, true, true); $eventos = array(); $anos = array(); foreach ($dados as $dado) { if ($itemi == "") { $image = ''; } else { $image = $dado[$itemi]; } if ($itemicone == "") { $icone = 'dark-red-circle.png'; } else { $icone = $dado[$itemicone]; } if ($itemfim == "") { $fim = ''; } else { $fim = $dado[$itemfim]; } if ($itemlink == "") { $link = ''; } else { $link = $dado[$link]; } $titulo = $dado[$itemtitulo]; $desc = $dado[$itemdescricao]; if (function_exists("mb_convert_encoding") && strtolower($converteE) == "sim") { $titulo = mb_convert_encoding($titulo, "UTF-8", "ISO-8859-1"); $desc = mb_convert_encoding($desc, "UTF-8", "ISO-8859-1"); } if ($dado[$iteminicio] != 0 && $dado[$iteminicio] != '-') { $eventos[] = array('start' => $dado[$iteminicio], 'end' => $fim, 'title' => "<span title='clique para selecionar' onclick='tituloclique(\"" . $dado["centroide"] . "\")' onmouseover='tituloover(\"" . $dado["centroide"] . "\")' onmouseout='tituloout()'>" . $titulo . "</span>", 'description' => $dado[$iteminicio] . " " . $fim . "<br>" . $desc, 'icon' => $icone, 'image' => $image, 'link' => $link); $anos[] = $fim; $anos[] = $dado[$iteminicio]; } } //echo "<pre>"; return array("dateTimeFormat" => $layer->getmetadata("ltempoformatodata"), "wikiURL" => "", "wikiSection" => "", "events" => $eventos, "menorano" => min($anos), "maiorano" => max($anos)); }