/**
* Listagem de notícias
*/
$order = $fields = $from = $where = "";
$headlinenchar = 300;
$total = 0;
$_pini = $_url["pini"];
$_numlimit = 0;
$_d = $_m = $_y = $inicio_limit = 0;
$from = "infrecord t1";
/** Variaveis da URL **/
if($_vurl) {
if($_vurl & 131072) {
$_d = prepData("d");
$_m = prepData("m");
$_y = prepData("y");
}
}
/** Herança **/
if($_inheritance) {
if($_inheritance & 131072 && isset($_vars["_ctd"])) {
$_ctd = $_vars["_ctd"];
}
}
/** Modificadores **/
if($_mods) {
if($_mods & 131072) {
$_co = $_ctd;
$_ctd = 0;
} elseif($_mods & 262144) {
$_cop = $_ctd;
$_ctd = 0;
} elseif($_mods & 524288) {
$_ctd = $_co;
$co = 0;
}elseif($_mods & 1048576) {
$_ctd = $_cop;
$cop = 0;
}
}
/** Flags **/
// Não Repetir código utilizados
if($_flags & 4) {
$utilizados = getCod($_tp);
if($utilizados) {
reset($utilizados);
$aux = "";
while(list($key, $val) = each($utilizados)) $aux.= ",$key";
if($aux) {
$aux = substr($aux, 1);
$where.= " and t1.codinf not in ($aux)";
}
}
}
// Faz um auto-seleciona do primeiro registo
$selecionaprimeiro = 0;
if($_flags & 131072 && !$_co) {
$selecionaprimeiro = 1;
}
if($_tp)
$where.= " and t1.codtype=$_tp ";
/** Parâmetros **/
if(isset($_p["property"]) && $_p["property"] && $_ctd) {
$property=$_p["property"];
$from.= ", property t2";
$where.= " and t2.codpp=$_ctd and t2.codtypepp=$property and t2.codtypeobj=$_tp and t1.codinf=t2.codobj";
}
// Ordem
if($_p["order"]) {
$order= " order by ".$_p["order"];
} else {
$order = " order by t1.ord desc";
}
// Where adicional
if($_p["where"]) {
$where.= " and ".$_p["where"];
}
/** Parâmetros do Tipo **/
// Campo Publicar -> Data de publicação entre limites
$pub = $_type->getParameter("pub");
if($pub == 1) {
$where.= " and t1.pub = 2";
} elseif($pub == 2) {
$where.= " and t1.datapi<=now() and t1.datapf>=now()";
}
// Processa o $_cop
if($_cop || $_flags & 8) {
$where.= " and t1.codfth=$_cop";
}
/*
// Introduzir o campo codlingua se o módulo tiver multilingua
$lgsuport = $_type->getParamter("lgsuport");
if($lgsuport) {
$where.= " and t1.codlg=$_LG";
}
*/
// Variáveis que serão utilizadas dentro do ciclo e fora do ciclo, mais do que uma vez
$autoDest = $_type->getParameter("autoDest");
$text_f = isset($_v["TEXT"]);
$title_f = isset($_v["TITLE"]);
$headline_f = isset($_v["HEADLINE"]);
$text2_f = isset($_v["TEXT2"]);
$record_url_f = isset($_v["RECORD_URL"]);
$fields = getFields($_it);
if(!$fields) {
$fields =" t1.codinf as _co, t1.codtype as _tp, t1.codfth as _cop";
if($title_f) {
$fields.= ",t1.title";
}
if($text_f) {
$fields.= ",t1.itext";
}
if($text2_f) {
$fields.= ",t1.itext2";
}
if($headline_f) {
if($autoDest && !$text_f) {
$fields.= ",t1.itext";
} else {
$fields.= ",t1.headline";
}
}
setFields($_it, $fields);
}
// destFlag = 2 - Destaque
if($_flags & 2) {
$where.= " and t1.destFlag = 2" ;
}
/** Processamento Final **/
//dia
if($_d && $_d!="-1" && $_d!="")
$where.= " and DAY(data)=$_d";
//mes
if($_m && $_m!="-1" && $_m!="")
$where.= " and MONTH(data)=$_m";
//ano
if($_y && $_y!="-1" && $_y!="")
$where.= " and YEAR(data)=$_y";
if($where)
$where = substr($where, 5); // and //
$sql = "select SQL_CALC_FOUND_ROWS ".$fields." from ".$from.($where?" where $where":"");
$vpini = "";
if(isset($_p["pini"])) {
$vpini = $_p["pini"];
repvar("COP", $_cop, $vpini);
$_pini = prepData($vpini);
}
$numreg = $_p["numreg"];
if($numreg) {
// Verifica se existe um valor de co, sem valor de pini. Pode acontecer que o valor de co está
// numa página diferente da primeira.
// Nesse caso, temos que calcular um valor para o pini, para que o cursor e a listagem surjam com
// o registo selecionado activo.
/* $auxordem = 0;
if($_co) {
$res = $bd->e("select ord from infrecord where codinf=$_co");
if(nr($res))
$auxordem = fc($res);
fr($res);
}
if($_p["numlimit"]) {
$_numlimit = $_p["numlimit"];
}
if(!$vpini) {
$vpini = "pini";
}
if(!$_pini && $auxordem) {
$auxWhere = "where ".($where?$where." and ":"")." t1.ord>=$auxordem";
$res = $bd->e("select count(t1.codnoticia) from $from $auxWhere $order");
$totRegAntes = fc($res);
fr($res);
if($totRegAntes > $_numreg) {
$_pini = (divInt($totRegAntes, $_numreg) - 1) * $_numreg;
if($totRegAntes % $_numreg)
$_pini += $_numreg;
$pini = $GLOBALS[$vpini] = $_pini;
}
}
$_pini+=$_numlimit; */
//apenas estava esta linha
$order.= " limit $_pini, ".$numreg;
}
$sql.= $order;
$r1 = $bd->e($sql);
$total = sql_total();
$totalreg = nr($r1);
if($_debug)
debug($this, "_TP:$_tp; _COP:$_cop; _CO: $_co; _CTD=$_ctd", $sql, $totalreg);
$lst = $lstcolunas= "";
if($totalreg) {
if($_p["colini"]) {
$ncol = $_p["colini"];
} else {
$ncol = 1;
}
$parimpar = $parimparlinha = 0;
$totalcount = 0;
$nlinha = $nColunas = 1;
$record = $first = $first_on = $colaux = $row = $odd = $even = $last_on = $last = $on = $row_odd = $row_even = $last_of_line="";
if(isset($_i["odd"])) $odd = $_i["odd"];
if(isset($_i["even"])) $even = $_i["even"];
if(isset($_i["last_on"])) $last_on = $_i["last_on"];
if(isset($_i["first"])) $first = $_i["first"];
if(isset($_i["first_on"])) $first_on = $_i["first_on"];
if(isset($_i["last"])) $last = $_i["last"];
if(isset($_i["on"])) $on = $_i["on"];
if(isset($_i["row_odd"])) $row_odd = $_i["row_odd"];
if(isset($_i["row_even"])) $row_even = $_i["row_even"];
if(isset($_i["last_of_line"])) $last_of_line = $_i["last_of_line"];
if($_p["nCols"] > 1) {
$nColunas = $_p["nCols"];
$row = $_i["row"];
}
if(isset($_p["headlinenchar"])) {
$headlinenchar = $_p["headlinenchar"];
}
if(isset($_i["record"])) $record = $_i["record"];
while($_vars = fd($r1)) {
$_co2 = $_vars["_co"];
regCod($_tp, $_co2);
$_vars["numreg"] = ++$totalcount;
$text = $headline = $title = $text2 = "";
if($selecionaprimeiro && $totalcount == 1) {
$_url["co"] = $_co2;
}
if($nColunas > 1 && $ncol == $nColunas && isset($_i["last_of_line"])) {
$reg = $last_of_line;
}
elseif($first_on && $totalcount==1 && $_co2 == $_url["co"]){
$reg = $first_on;
}
elseif($first && $totalcount==1){
$reg = $first;
}
elseif($last_on && $totalreg == $totalcount && $_co2 == $_url["co"]){
$reg = $last_on;
}
elseif($last && $totalreg == $totalcount){
$reg = $last;
}
elseif($on && $_co2 == $_url["co"]){
$reg = $on;
}
elseif($parimpar && $even){
$reg = $even;
}
elseif(!$parimpar && $odd){
$reg = $odd;
}
elseif($parimparlinha && $row_even){
$reg = $row_even;
}
elseif(!$parimparlinha && $row_odd){
$reg = $row_odd;
}
else{
$reg = $record;
}
$parimpar = !$parimpar;
$this->buildSons($reg, $_vars);
if($record_url_f) {
$url = getURL($_vars);
repvar("RECORD_URL", $url, $reg);
}
if($text_f) {
repvar("TEXT", $_vars["itext"], $reg);
}
if($title_f) {
repvar("TITLE", $_vars["title"], $reg);
}
if($headline_f) {
if($autoDest == 1) {
$auxtexto = strip_tags($_vars["itext"]);
repvar("HEADLINE", stripParagraph($auxtexto, $headlinenchar), $reg);
} else {
repvar("HEADLINE", $_vars["headline"], $reg);
}
}
repvar("COD", $_co2, $reg);
repvar("COP", $_vars["_cop"], $reg);
$lst.= $reg;
if($nColunas > 1) {
$ncol++;
if($ncol > $nColunas) {
$subint = ($nlinha == 1 && $first?$first:$row);
$colaux.= repvar("COLS", $lst, $subint);
$lst = "";
$ncol = 1;
$nlinha++;
}
}
}
if($ncol > 1){
$subint = ($nlinha == 1 && $first?$first:$row);
$lstcolunas.= repvar("COLS", $lst, $subint);
}
if($nColunas <= 1) {
repvar("LIST", $lst, $_html);
} else {
repvar("LIST", $lstcolunas, $_html);
}
} else { // Não tem registos nenhuns, verifica se tem a interface vazio definida
if(isset($_i["empty"]))
$_html = $_i["empty"];
elseif(isset($_i["empty_lst"]))
//$_html = str_repvar("[[V:LST]]", $_int->i["vazio_lst"], $_html);
repvar("LIST", $_i["empty_lst"], $_html);
elseif(!$_mainint)
$_html = "";
}
fr($r1);
repvar("TP", $_tp, $_html);
$url = (isset($_p["url"])?$_p["url"]:"");
if($url) {
if($_cop) {
repvar("COP", $_cop, $url);
}
}
// Variáveis para filhos. Ex: cursor
$_vars["totalreg"] = $totalreg;
if($vpini) {
$_vars["vpini"] = $vpini;
}
$_vars["totalregistos"] = $total-$_numlimit;
$_vars["registospagina"] = (isset($_p["numreg"])?$_p["numreg"]:$totalreg);
$_vars["cursorurl"] = $url;
$_vars["_tp"] = $_tp;
/**
* Listagem de notícias
*/
$order = $fields = $from = $where = "";
$headlinenchar = 300;
$total = 0;
$_pini = $_url["pini"];
$_numlimit = 0;
$_d = $_m = $_y = $inicio_limit = 0;
$from = "infrecord t1";
/** Variaveis da URL **/
if($_vurl) {
if($_vurl & 131072) {
$_d = prepData("d");
$_m = prepData("m");
$_y = prepData("y");
}
}
/** Herança **/
if($_inheritance) {
if($_inheritance & 131072 && isset($_vars["_ctd"])) {
$_ctd = $_vars["_ctd"];
}
}
/** Modificadores **/
if($_mods) {
if($_mods & 131072) {
$_co = $_ctd;
$_ctd = 0;
} elseif($_mods & 262144) {
$_cop = $_ctd;
$_ctd = 0;
} elseif($_mods & 524288) {
$_ctd = $_co;
$co = 0;
}elseif($_mods & 1048576) {
$_ctd = $_cop;
$cop = 0;
}
}
/** Flags **/
// Não Repetir código utilizados
if($_flags & 4) {
$utilizados = getCod($_tp);
if($utilizados) {
reset($utilizados);
$aux = "";
while(list($key, $val) = each($utilizados)) $aux.= ",$key";
if($aux) {
$aux = substr($aux, 1);
$where.= " and t1.codinf not in ($aux)";
}
}
}
// Faz um auto-seleciona do primeiro registo
$selecionaprimeiro = 0;
if($_flags & 131072 && !$_co) {
$selecionaprimeiro = 1;
}
if($_tp)
$where.= " and t1.codtype=$_tp ";
/** Parâmetros **/
if(isset($_p["property"]) && $_p["property"] && $_ctd) {
$property=$_p["property"];
$from.= ", property t2";
$where.= " and t2.codpp=$_ctd and t2.codtypepp=$property and t2.codtypeobj=$_tp and t1.codinf=t2.codobj";
}
// Ordem
if($_p["order"]) {
$order= " order by ".$_p["order"];
} else {
$order = " order by t1.ord desc";
}
// Where adicional
if($_p["where"]) {
$where.= " and ".$_p["where"];
}
/** Parâmetros do Tipo **/
// Campo Publicar -> Data de publicação entre limites
$pub = $_type->getParameter("pub");
if($pub == 1) {
$where.= " and t1.pub = 2";
} elseif($pub == 2) {
$where.= " and t1.datapi<=now() and t1.datapf>=now()";
}
// Processa o $_cop
if($_cop || $_flags & 8) {
$where.= " and t1.codfth=$_cop";
}
/*
// Introduzir o campo codlingua se o módulo tiver multilingua
$lgsuport = $_type->getParamter("lgsuport");
if($lgsuport) {
$where.= " and t1.codlg=$_LG";
}
*/
// Variáveis que serão utilizadas dentro do ciclo e fora do ciclo, mais do que uma vez
$autoDest = $_type->getParameter("autoDest");
$text_f = isset($_v["TEXT"]);
$title_f = isset($_v["TITLE"]);
$headline_f = isset($_v["HEADLINE"]);
$text2_f = isset($_v["TEXT2"]);
$record_url_f = isset($_v["RECORD_URL"]);
$fields = getFields($_it);
if(!$fields) {
$fields =" t1.codinf as _co, t1.codtype as _tp, t1.codfth as _cop";
if($title_f) {
$fields.= ",t1.title";
}
if($text_f) {
$fields.= ",t1.itext";
}
if($text2_f) {
$fields.= ",t1.itext2";
}
if($headline_f) {
if($autoDest && !$text_f) {
$fields.= ",t1.itext";
} else {
$fields.= ",t1.headline";
}
}
setFields($_it, $fields);
}
// destFlag = 2 - Destaque
if($_flags & 2) {
$where.= " and t1.destFlag = 2" ;
}
/** Processamento Final **/
//dia
if($_d && $_d!="-1" && $_d!="")
$where.= " and DAY(data)=$_d";
//mes
if($_m && $_m!="-1" && $_m!="")
$where.= " and MONTH(data)=$_m";
//ano
if($_y && $_y!="-1" && $_y!="")
$where.= " and YEAR(data)=$_y";
if($where)
$where = substr($where, 5); // and //
$sql = "select SQL_CALC_FOUND_ROWS ".$fields." from ".$from.($where?" where $where":"");
$vpini = "";
if(isset($_p["pini"])) {
$vpini = $_p["pini"];
repvar("COP", $_cop, $vpini);
$_pini = prepData($vpini);
}
$numreg = $_p["numreg"];
if($numreg) {
// Verifica se existe um valor de co, sem valor de pini. Pode acontecer que o valor de co está
// numa página diferente da primeira.
// Nesse caso, temos que calcular um valor para o pini, para que o cursor e a listagem surjam com
// o registo selecionado activo.
/* $auxordem = 0;
if($_co) {
$res = $bd->e("select ord from infrecord where codinf=$_co");
if(nr($res))
$auxordem = fc($res);
fr($res);
}
if($_p["numlimit"]) {
$_numlimit = $_p["numlimit"];
}
if(!$vpini) {
$vpini = "pini";
}
if(!$_pini && $auxordem) {
$auxWhere = "where ".($where?$where." and ":"")." t1.ord>=$auxordem";
$res = $bd->e("select count(t1.codnoticia) from $from $auxWhere $order");
$totRegAntes = fc($res);
fr($res);
if($totRegAntes > $_numreg) {
$_pini = (divInt($totRegAntes, $_numreg) - 1) * $_numreg;
if($totRegAntes % $_numreg)
$_pini += $_numreg;
$pini = $GLOBALS[$vpini] = $_pini;
}
}
$_pini+=$_numlimit; */
//apenas estava esta linha
$order.= " limit $_pini, ".$numreg;
}
$sql.= $order;
$r1 = $bd->e($sql);
$total = sql_total();
$totalreg = nr($r1);
if($_debug)
debug($this, "_TP:$_tp; _COP:$_cop; _CO: $_co; _CTD=$_ctd", $sql, $totalreg);
$lst = $lstcolunas= "";
if($totalreg) {
if($_p["colini"]) {
$ncol = $_p["colini"];
} else {
$ncol = 1;
}
$parimpar = $parimparlinha = 0;
$totalcount = 0;
$nlinha = $nColunas = 1;
$record = $first = $first_on = $colaux = $row = $odd = $even = $last_on = $last = $on = $row_odd = $row_even = $last_of_line="";
if(isset($_i["odd"])) $odd = $_i["odd"];
if(isset($_i["even"])) $even = $_i["even"];
if(isset($_i["last_on"])) $last_on = $_i["last_on"];
if(isset($_i["first"])) $first = $_i["first"];
if(isset($_i["first_on"])) $first_on = $_i["first_on"];
if(isset($_i["last"])) $last = $_i["last"];
if(isset($_i["on"])) $on = $_i["on"];
if(isset($_i["row_odd"])) $row_odd = $_i["row_odd"];
if(isset($_i["row_even"])) $row_even = $_i["row_even"];
if(isset($_i["last_of_line"])) $last_of_line = $_i["last_of_line"];
if($_p["nCols"] > 1) {
$nColunas = $_p["nCols"];
$row = $_i["row"];
}
if(isset($_p["headlinenchar"])) {
$headlinenchar = $_p["headlinenchar"];
}
if(isset($_i["record"])) $record = $_i["record"];
while($_vars = fd($r1)) {
$_co2 = $_vars["_co"];
regCod($_tp, $_co2);
$_vars["numreg"] = ++$totalcount;
$text = $headline = $title = $text2 = "";
if($selecionaprimeiro && $totalcount == 1) {
$_url["co"] = $_co2;
}
if($nColunas > 1 && $ncol == $nColunas && isset($_i["last_of_line"])) {
$reg = $last_of_line;
}
elseif($first_on && $totalcount==1 && $_co2 == $_url["co"]){
$reg = $first_on;
}
elseif($first && $totalcount==1){
$reg = $first;
}
elseif($last_on && $totalreg == $totalcount && $_co2 == $_url["co"]){
$reg = $last_on;
}
elseif($last && $totalreg == $totalcount){
$reg = $last;
}
elseif($on && $_co2 == $_url["co"]){
$reg = $on;
}
elseif($parimpar && $even){
$reg = $even;
}
elseif(!$parimpar && $odd){
$reg = $odd;
}
elseif($parimparlinha && $row_even){
$reg = $row_even;
}
elseif(!$parimparlinha && $row_odd){
$reg = $row_odd;
}
else{
$reg = $record;
}
$parimpar = !$parimpar;
$this->buildSons($reg, $_vars);
if($record_url_f) {
$url = getURL($_vars);
repvar("RECORD_URL", $url, $reg);
}
if($text_f) {
repvar("TEXT", $_vars["itext"], $reg);
}
if($title_f) {
repvar("TITLE", $_vars["title"], $reg);
}
if($headline_f) {
if($autoDest == 1) {
$auxtexto = strip_tags($_vars["itext"]);
repvar("HEADLINE", stripParagraph($auxtexto, $headlinenchar), $reg);
} else {
repvar("HEADLINE", $_vars["headline"], $reg);
}
}
repvar("COD", $_co2, $reg);
repvar("COP", $_vars["_cop"], $reg);
$lst.= $reg;
if($nColunas > 1) {
$ncol++;
if($ncol > $nColunas) {
$subint = ($nlinha == 1 && $first?$first:$row);
$colaux.= repvar("COLS", $lst, $subint);
$lst = "";
$ncol = 1;
$nlinha++;
}
}
}
if($ncol > 1){
$subint = ($nlinha == 1 && $first?$first:$row);
$lstcolunas.= repvar("COLS", $lst, $subint);
}
if($nColunas <= 1) {
repvar("LIST", $lst, $_html);
} else {
repvar("LIST", $lstcolunas, $_html);
}
} else { // Não tem registos nenhuns, verifica se tem a interface vazio definida
if(isset($_i["empty"]))
$_html = $_i["empty"];
elseif(isset($_i["empty_lst"]))
//$_html = str_repvar("[[V:LST]]", $_int->i["vazio_lst"], $_html);
repvar("LIST", $_i["empty_lst"], $_html);
elseif(!$_mainint)
$_html = "";
}
fr($r1);
repvar("TP", $_tp, $_html);
$url = (isset($_p["url"])?$_p["url"]:"");
if($url) {
if($_cop) {
repvar("COP", $_cop, $url);
}
}
// Variáveis para filhos. Ex: cursor
$_vars["totalreg"] = $totalreg;
if($vpini) {
$_vars["vpini"] = $vpini;
}
$_vars["totalregistos"] = $total-$_numlimit;
$_vars["registospagina"] = (isset($_p["numreg"])?$_p["numreg"]:$totalreg);
$_vars["cursorurl"] = $url;
$_vars["_tp"] = $_tp;
/**
* Listagem de notícias
*/
$order = $fields = $from = $where = "";
$headlinenchar = 300;
$total = 0;
$_pini = $_url["pini"];
$_numlimit = 0;
$_d = $_m = $_y = $inicio_limit = 0;
$from = "infrecord t1";
/** Variaveis da URL **/
if($_vurl) {
if($_vurl & 131072) {
$_d = prepData("d");
$_m = prepData("m");
$_y = prepData("y");
}
}
/** Herança **/
if($_inheritance) {
if($_inheritance & 131072 && isset($_vars["_ctd"])) {
$_ctd = $_vars["_ctd"];
}
}
/** Modificadores **/
if($_mods) {
if($_mods & 131072) {
$_co = $_ctd;
$_ctd = 0;
} elseif($_mods & 262144) {
$_cop = $_ctd;
$_ctd = 0;
} elseif($_mods & 524288) {
$_ctd = $_co;
$co = 0;
}elseif($_mods & 1048576) {
$_ctd = $_cop;
$cop = 0;
}
}
/** Flags **/
// Não Repetir código utilizados
if($_flags & 4) {
$utilizados = getCod($_tp);
if($utilizados) {
reset($utilizados);
$aux = "";
while(list($key, $val) = each($utilizados)) $aux.= ",$key";
if($aux) {
$aux = substr($aux, 1);
$where.= " and t1.codinf not in ($aux)";
}
}
}
// Faz um auto-seleciona do primeiro registo
$selecionaprimeiro = 0;
if($_flags & 131072 && !$_co) {
$selecionaprimeiro = 1;
}
if($_tp)
$where.= " and t1.codtype=$_tp ";
/** Parâmetros **/
if(isset($_p["property"]) && $_p["property"] && $_ctd) {
$property=$_p["property"];
$from.= ", property t2";
$where.= " and t2.codpp=$_ctd and t2.codtypepp=$property and t2.codtypeobj=$_tp and t1.codinf=t2.codobj";
}
// Ordem
if($_p["order"]) {
$order= " order by ".$_p["order"];
} else {
$order = " order by t1.ord desc";
}
// Where adicional
if($_p["where"]) {
$where.= " and ".$_p["where"];
}
/** Parâmetros do Tipo **/
// Campo Publicar -> Data de publicação entre limites
$pub = $_type->getParameter("pub");
if($pub == 1) {
$where.= " and t1.pub = 2";
} elseif($pub == 2) {
$where.= " and t1.datapi<=now() and t1.datapf>=now()";
}
// Processa o $_cop
if($_cop || $_flags & 8) {
$where.= " and t1.codfth=$_cop";
}
/*
// Introduzir o campo codlingua se o módulo tiver multilingua
$lgsuport = $_type->getParamter("lgsuport");
if($lgsuport) {
$where.= " and t1.codlg=$_LG";
}
*/
// Variáveis que serão utilizadas dentro do ciclo e fora do ciclo, mais do que uma vez
$autoDest = $_type->getParameter("autoDest");
$text_f = isset($_v["TEXT"]);
$title_f = isset($_v["TITLE"]);
$headline_f = isset($_v["HEADLINE"]);
$text2_f = isset($_v["TEXT2"]);
$record_url_f = isset($_v["RECORD_URL"]);
$fields = getFields($_it);
if(!$fields) {
$fields =" t1.codinf as _co, t1.codtype as _tp, t1.codfth as _cop";
if($title_f) {
$fields.= ",t1.title";
}
if($text_f) {
$fields.= ",t1.itext";
}
if($text2_f) {
$fields.= ",t1.itext2";
}
if($headline_f) {
if($autoDest && !$text_f) {
$fields.= ",t1.itext";
} else {
$fields.= ",t1.headline";
}
}
setFields($_it, $fields);
}
// destFlag = 2 - Destaque
if($_flags & 2) {
$where.= " and t1.destFlag = 2" ;
}
/** Processamento Final **/
//dia
if($_d && $_d!="-1" && $_d!="")
$where.= " and DAY(data)=$_d";
//mes
if($_m && $_m!="-1" && $_m!="")
$where.= " and MONTH(data)=$_m";
//ano
if($_y && $_y!="-1" && $_y!="")
$where.= " and YEAR(data)=$_y";
if($where)
$where = substr($where, 5); // and //
$sql = "select SQL_CALC_FOUND_ROWS ".$fields." from ".$from.($where?" where $where":"");
$vpini = "";
if(isset($_p["pini"])) {
$vpini = $_p["pini"];
repvar("COP", $_cop, $vpini);
$_pini = prepData($vpini);
}
$numreg = $_p["numreg"];
if($numreg) {
// Verifica se existe um valor de co, sem valor de pini. Pode acontecer que o valor de co está
// numa página diferente da primeira.
// Nesse caso, temos que calcular um valor para o pini, para que o cursor e a listagem surjam com
// o registo selecionado activo.
/* $auxordem = 0;
if($_co) {
$res = $bd->e("select ord from infrecord where codinf=$_co");
if(nr($res))
$auxordem = fc($res);
fr($res);
}
if($_p["numlimit"]) {
$_numlimit = $_p["numlimit"];
}
if(!$vpini) {
$vpini = "pini";
}
if(!$_pini && $auxordem) {
$auxWhere = "where ".($where?$where." and ":"")." t1.ord>=$auxordem";
$res = $bd->e("select count(t1.codnoticia) from $from $auxWhere $order");
$totRegAntes = fc($res);
fr($res);
if($totRegAntes > $_numreg) {
$_pini = (divInt($totRegAntes, $_numreg) - 1) * $_numreg;
if($totRegAntes % $_numreg)
$_pini += $_numreg;
$pini = $GLOBALS[$vpini] = $_pini;
}
}
$_pini+=$_numlimit; */
//apenas estava esta linha
$order.= " limit $_pini, ".$numreg;
}
$sql.= $order;
$r1 = $bd->e($sql);
$total = sql_total();
$totalreg = nr($r1);
if($_debug)
debug($this, "_TP:$_tp; _COP:$_cop; _CO: $_co; _CTD=$_ctd", $sql, $totalreg);
$lst = $lstcolunas= "";
if($totalreg) {
if($_p["colini"]) {
$ncol = $_p["colini"];
} else {
$ncol = 1;
}
$parimpar = $parimparlinha = 0;
$totalcount = 0;
$nlinha = $nColunas = 1;
$record = $first = $first_on = $colaux = $row = $odd = $even = $last_on = $last = $on = $row_odd = $row_even = $last_of_line="";
if(isset($_i["odd"])) $odd = $_i["odd"];
if(isset($_i["even"])) $even = $_i["even"];
if(isset($_i["last_on"])) $last_on = $_i["last_on"];
if(isset($_i["first"])) $first = $_i["first"];
if(isset($_i["first_on"])) $first_on = $_i["first_on"];
if(isset($_i["last"])) $last = $_i["last"];
if(isset($_i["on"])) $on = $_i["on"];
if(isset($_i["row_odd"])) $row_odd = $_i["row_odd"];
if(isset($_i["row_even"])) $row_even = $_i["row_even"];
if(isset($_i["last_of_line"])) $last_of_line = $_i["last_of_line"];
if($_p["nCols"] > 1) {
$nColunas = $_p["nCols"];
$row = $_i["row"];
}
if(isset($_p["headlinenchar"])) {
$headlinenchar = $_p["headlinenchar"];
}
if(isset($_i["record"])) $record = $_i["record"];
while($_vars = fd($r1)) {
$_co2 = $_vars["_co"];
regCod($_tp, $_co2);
$_vars["numreg"] = ++$totalcount;
$text = $headline = $title = $text2 = "";
if($selecionaprimeiro && $totalcount == 1) {
$_url["co"] = $_co2;
}
if($nColunas > 1 && $ncol == $nColunas && isset($_i["last_of_line"])) {
$reg = $last_of_line;
}
elseif($first_on && $totalcount==1 && $_co2 == $_url["co"]){
$reg = $first_on;
}
elseif($first && $totalcount==1){
$reg = $first;
}
elseif($last_on && $totalreg == $totalcount && $_co2 == $_url["co"]){
$reg = $last_on;
}
elseif($last && $totalreg == $totalcount){
$reg = $last;
}
elseif($on && $_co2 == $_url["co"]){
$reg = $on;
}
elseif($parimpar && $even){
$reg = $even;
}
elseif(!$parimpar && $odd){
$reg = $odd;
}
elseif($parimparlinha && $row_even){
$reg = $row_even;
}
elseif(!$parimparlinha && $row_odd){
$reg = $row_odd;
}
else{
$reg = $record;
}
$parimpar = !$parimpar;
$this->buildSons($reg, $_vars);
if($record_url_f) {
$url = getURL($_vars);
repvar("RECORD_URL", $url, $reg);
}
if($text_f) {
repvar("TEXT", $_vars["itext"], $reg);
}
if($title_f) {
repvar("TITLE", $_vars["title"], $reg);
}
if($headline_f) {
if($autoDest == 1) {
$auxtexto = strip_tags($_vars["itext"]);
repvar("HEADLINE", stripParagraph($auxtexto, $headlinenchar), $reg);
} else {
repvar("HEADLINE", $_vars["headline"], $reg);
}
}
repvar("COD", $_co2, $reg);
repvar("COP", $_vars["_cop"], $reg);
$lst.= $reg;
if($nColunas > 1) {
$ncol++;
if($ncol > $nColunas) {
$subint = ($nlinha == 1 && $first?$first:$row);
$colaux.= repvar("COLS", $lst, $subint);
$lst = "";
$ncol = 1;
$nlinha++;
}
}
}
if($ncol > 1){
$subint = ($nlinha == 1 && $first?$first:$row);
$lstcolunas.= repvar("COLS", $lst, $subint);
}
if($nColunas <= 1) {
repvar("LIST", $lst, $_html);
} else {
repvar("LIST", $lstcolunas, $_html);
}
} else { // Não tem registos nenhuns, verifica se tem a interface vazio definida
if(isset($_i["empty"]))
$_html = $_i["empty"];
elseif(isset($_i["empty_lst"]))
//$_html = str_repvar("[[V:LST]]", $_int->i["vazio_lst"], $_html);
repvar("LIST", $_i["empty_lst"], $_html);
elseif(!$_mainint)
$_html = "";
}
fr($r1);
repvar("TP", $_tp, $_html);
$url = (isset($_p["url"])?$_p["url"]:"");
if($url) {
if($_cop) {
repvar("COP", $_cop, $url);
}
}
// Variáveis para filhos. Ex: cursor
$_vars["totalreg"] = $totalreg;
if($vpini) {
$_vars["vpini"] = $vpini;
}
$_vars["totalregistos"] = $total-$_numlimit;
$_vars["registospagina"] = (isset($_p["numreg"])?$_p["numreg"]:$totalreg);
$_vars["cursorurl"] = $url;
$_vars["_tp"] = $_tp;
/**
* Listagem de notícias
*/
$order = $fields = $from = $where = "";
$headlinenchar = 300;
$total = 0;
$_pini = $_url["pini"];
$_numlimit = 0;
$_d = $_m = $_y = $inicio_limit = 0;
$from = "infrecord t1";
/** Variaveis da URL **/
if($_vurl) {
if($_vurl & 131072) {
$_d = prepData("d");
$_m = prepData("m");
$_y = prepData("y");
}
}
/** Herança **/
if($_inheritance) {
if($_inheritance & 131072 && isset($_vars["_ctd"])) {
$_ctd = $_vars["_ctd"];
}
}
/** Modificadores **/
if($_mods) {
if($_mods & 131072) {
$_co = $_ctd;
$_ctd = 0;
} elseif($_mods & 262144) {
$_cop = $_ctd;
$_ctd = 0;
} elseif($_mods & 524288) {
$_ctd = $_co;
$co = 0;
}elseif($_mods & 1048576) {
$_ctd = $_cop;
$cop = 0;
}
}
/** Flags **/
// Não Repetir código utilizados
if($_flags & 4) {
$utilizados = getCod($_tp);
if($utilizados) {
reset($utilizados);
$aux = "";
while(list($key, $val) = each($utilizados)) $aux.= ",$key";
if($aux) {
$aux = substr($aux, 1);
$where.= " and t1.codinf not in ($aux)";
}
}
}
// Faz um auto-seleciona do primeiro registo
$selecionaprimeiro = 0;
if($_flags & 131072 && !$_co) {
$selecionaprimeiro = 1;
}
if($_tp)
$where.= " and t1.codtype=$_tp ";
/** Parâmetros **/
if(isset($_p["property"]) && $_p["property"] && $_ctd) {
$property=$_p["property"];
$from.= ", property t2";
$where.= " and t2.codpp=$_ctd and t2.codtypepp=$property and t2.codtypeobj=$_tp and t1.codinf=t2.codobj";
}
// Ordem
if($_p["order"]) {
$order= " order by ".$_p["order"];
} else {
$order = " order by t1.ord desc";
}
// Where adicional
if($_p["where"]) {
$where.= " and ".$_p["where"];
}
/** Parâmetros do Tipo **/
// Campo Publicar -> Data de publicação entre limites
$pub = $_type->getParameter("pub");
if($pub == 1) {
$where.= " and t1.pub = 2";
} elseif($pub == 2) {
$where.= " and t1.datapi<=now() and t1.datapf>=now()";
}
// Processa o $_cop
if($_cop || $_flags & 8) {
$where.= " and t1.codfth=$_cop";
}
/*
// Introduzir o campo codlingua se o módulo tiver multilingua
$lgsuport = $_type->getParamter("lgsuport");
if($lgsuport) {
$where.= " and t1.codlg=$_LG";
}
*/
// Variáveis que serão utilizadas dentro do ciclo e fora do ciclo, mais do que uma vez
$autoDest = $_type->getParameter("autoDest");
$text_f = isset($_v["TEXT"]);
$title_f = isset($_v["TITLE"]);
$headline_f = isset($_v["HEADLINE"]);
$text2_f = isset($_v["TEXT2"]);
$record_url_f = isset($_v["RECORD_URL"]);
$fields = getFields($_it);
if(!$fields) {
$fields =" t1.codinf as _co, t1.codtype as _tp, t1.codfth as _cop";
if($title_f) {
$fields.= ",t1.title";
}
if($text_f) {
$fields.= ",t1.itext";
}
if($text2_f) {
$fields.= ",t1.itext2";
}
if($headline_f) {
if($autoDest && !$text_f) {
$fields.= ",t1.itext";
} else {
$fields.= ",t1.headline";
}
}
setFields($_it, $fields);
}
// destFlag = 2 - Destaque
if($_flags & 2) {
$where.= " and t1.destFlag = 2" ;
}
/** Processamento Final **/
//dia
if($_d && $_d!="-1" && $_d!="")
$where.= " and DAY(data)=$_d";
//mes
if($_m && $_m!="-1" && $_m!="")
$where.= " and MONTH(data)=$_m";
//ano
if($_y && $_y!="-1" && $_y!="")
$where.= " and YEAR(data)=$_y";
if($where)
$where = substr($where, 5); // and //
$sql = "select SQL_CALC_FOUND_ROWS ".$fields." from ".$from.($where?" where $where":"");
$vpini = "";
if(isset($_p["pini"])) {
$vpini = $_p["pini"];
repvar("COP", $_cop, $vpini);
$_pini = prepData($vpini);
}
$numreg = $_p["numreg"];
if($numreg) {
// Verifica se existe um valor de co, sem valor de pini. Pode acontecer que o valor de co está
// numa página diferente da primeira.
// Nesse caso, temos que calcular um valor para o pini, para que o cursor e a listagem surjam com
// o registo selecionado activo.
/* $auxordem = 0;
if($_co) {
$res = $bd->e("select ord from infrecord where codinf=$_co");
if(nr($res))
$auxordem = fc($res);
fr($res);
}
if($_p["numlimit"]) {
$_numlimit = $_p["numlimit"];
}
if(!$vpini) {
$vpini = "pini";
}
if(!$_pini && $auxordem) {
$auxWhere = "where ".($where?$where." and ":"")." t1.ord>=$auxordem";
$res = $bd->e("select count(t1.codnoticia) from $from $auxWhere $order");
$totRegAntes = fc($res);
fr($res);
if($totRegAntes > $_numreg) {
$_pini = (divInt($totRegAntes, $_numreg) - 1) * $_numreg;
if($totRegAntes % $_numreg)
$_pini += $_numreg;
$pini = $GLOBALS[$vpini] = $_pini;
}
}
$_pini+=$_numlimit; */
//apenas estava esta linha
$order.= " limit $_pini, ".$numreg;
}
$sql.= $order;
$r1 = $bd->e($sql);
$total = sql_total();
$totalreg = nr($r1);
if($_debug)
debug($this, "_TP:$_tp; _COP:$_cop; _CO: $_co; _CTD=$_ctd", $sql, $totalreg);
$lst = $lstcolunas= "";
if($totalreg) {
if($_p["colini"]) {
$ncol = $_p["colini"];
} else {
$ncol = 1;
}
$parimpar = $parimparlinha = 0;
$totalcount = 0;
$nlinha = $nColunas = 1;
$record = $first = $first_on = $colaux = $row = $odd = $even = $last_on = $last = $on = $row_odd = $row_even = $last_of_line="";
if(isset($_i["odd"])) $odd = $_i["odd"];
if(isset($_i["even"])) $even = $_i["even"];
if(isset($_i["last_on"])) $last_on = $_i["last_on"];
if(isset($_i["first"])) $first = $_i["first"];
if(isset($_i["first_on"])) $first_on = $_i["first_on"];
if(isset($_i["last"])) $last = $_i["last"];
if(isset($_i["on"])) $on = $_i["on"];
if(isset($_i["row_odd"])) $row_odd = $_i["row_odd"];
if(isset($_i["row_even"])) $row_even = $_i["row_even"];
if(isset($_i["last_of_line"])) $last_of_line = $_i["last_of_line"];
if($_p["nCols"] > 1) {
$nColunas = $_p["nCols"];
$row = $_i["row"];
}
if(isset($_p["headlinenchar"])) {
$headlinenchar = $_p["headlinenchar"];
}
if(isset($_i["record"])) $record = $_i["record"];
while($_vars = fd($r1)) {
$_co2 = $_vars["_co"];
regCod($_tp, $_co2);
$_vars["numreg"] = ++$totalcount;
$text = $headline = $title = $text2 = "";
if($selecionaprimeiro && $totalcount == 1) {
$_url["co"] = $_co2;
}
if($nColunas > 1 && $ncol == $nColunas && isset($_i["last_of_line"])) {
$reg = $last_of_line;
}
elseif($first_on && $totalcount==1 && $_co2 == $_url["co"]){
$reg = $first_on;
}
elseif($first && $totalcount==1){
$reg = $first;
}
elseif($last_on && $totalreg == $totalcount && $_co2 == $_url["co"]){
$reg = $last_on;
}
elseif($last && $totalreg == $totalcount){
$reg = $last;
}
elseif($on && $_co2 == $_url["co"]){
$reg = $on;
}
elseif($parimpar && $even){
$reg = $even;
}
elseif(!$parimpar && $odd){
$reg = $odd;
}
elseif($parimparlinha && $row_even){
$reg = $row_even;
}
elseif(!$parimparlinha && $row_odd){
$reg = $row_odd;
}
else{
$reg = $record;
}
$parimpar = !$parimpar;
$this->buildSons($reg, $_vars);
if($record_url_f) {
$url = getURL($_vars);
repvar("RECORD_URL", $url, $reg);
}
if($text_f) {
repvar("TEXT", $_vars["itext"], $reg);
}
if($title_f) {
repvar("TITLE", $_vars["title"], $reg);
}
if($headline_f) {
if($autoDest == 1) {
$auxtexto = strip_tags($_vars["itext"]);
repvar("HEADLINE", stripParagraph($auxtexto, $headlinenchar), $reg);
} else {
repvar("HEADLINE", $_vars["headline"], $reg);
}
}
repvar("COD", $_co2, $reg);
repvar("COP", $_vars["_cop"], $reg);
$lst.= $reg;
if($nColunas > 1) {
$ncol++;
if($ncol > $nColunas) {
$subint = ($nlinha == 1 && $first?$first:$row);
$colaux.= repvar("COLS", $lst, $subint);
$lst = "";
$ncol = 1;
$nlinha++;
}
}
}
if($ncol > 1){
$subint = ($nlinha == 1 && $first?$first:$row);
$lstcolunas.= repvar("COLS", $lst, $subint);
}
if($nColunas <= 1) {
repvar("LIST", $lst, $_html);
} else {
repvar("LIST", $lstcolunas, $_html);
}
} else { // Não tem registos nenhuns, verifica se tem a interface vazio definida
if(isset($_i["empty"]))
$_html = $_i["empty"];
elseif(isset($_i["empty_lst"]))
//$_html = str_repvar("[[V:LST]]", $_int->i["vazio_lst"], $_html);
repvar("LIST", $_i["empty_lst"], $_html);
elseif(!$_mainint)
$_html = "";
}
fr($r1);
repvar("TP", $_tp, $_html);
$url = (isset($_p["url"])?$_p["url"]:"");
if($url) {
if($_cop) {
repvar("COP", $_cop, $url);
}
}
// Variáveis para filhos. Ex: cursor
$_vars["totalreg"] = $totalreg;
if($vpini) {
$_vars["vpini"] = $vpini;
}
$_vars["totalregistos"] = $total-$_numlimit;
$_vars["registospagina"] = (isset($_p["numreg"])?$_p["numreg"]:$totalreg);
$_vars["cursorurl"] = $url;
$_vars["_tp"] = $_tp;
/**
* Listagem de notícias
*/
$order = $fields = $from = $where = "";
$headlinenchar = 300;
$total = 0;
$_pini = $_url["pini"];
$_numlimit = 0;
$_d = $_m = $_y = $inicio_limit = 0;
$from = "infrecord t1";
/** Variaveis da URL **/
if($_vurl) {
if($_vurl & 131072) {
$_d = prepData("d");
$_m = prepData("m");
$_y = prepData("y");
}
}
/** Herança **/
if($_inheritance) {
if($_inheritance & 131072 && isset($_vars["_ctd"])) {
$_ctd = $_vars["_ctd"];
}
}
/** Modificadores **/
if($_mods) {
if($_mods & 131072) {
$_co = $_ctd;
$_ctd = 0;
} elseif($_mods & 262144) {
$_cop = $_ctd;
$_ctd = 0;
} elseif($_mods & 524288) {
$_ctd = $_co;
$co = 0;
}elseif($_mods & 1048576) {
$_ctd = $_cop;
$cop = 0;
}
}
/** Flags **/
// Não Repetir código utilizados
if($_flags & 4) {
$utilizados = getCod($_tp);
if($utilizados) {
reset($utilizados);
$aux = "";
while(list($key, $val) = each($utilizados)) $aux.= ",$key";
if($aux) {
$aux = substr($aux, 1);
$where.= " and t1.codinf not in ($aux)";
}
}
}
// Faz um auto-seleciona do primeiro registo
$selecionaprimeiro = 0;
if($_flags & 131072 && !$_co) {
$selecionaprimeiro = 1;
}
if($_tp)
$where.= " and t1.codtype=$_tp ";
/** Parâmetros **/
if(isset($_p["property"]) && $_p["property"] && $_ctd) {
$property=$_p["property"];
$from.= ", property t2";
$where.= " and t2.codpp=$_ctd and t2.codtypepp=$property and t2.codtypeobj=$_tp and t1.codinf=t2.codobj";
}
// Ordem
if($_p["order"]) {
$order= " order by ".$_p["order"];
} else {
$order = " order by t1.ord desc";
}
// Where adicional
if($_p["where"]) {
$where.= " and ".$_p["where"];
}
/** Parâmetros do Tipo **/
// Campo Publicar -> Data de publicação entre limites
$pub = $_type->getParameter("pub");
if($pub == 1) {
$where.= " and t1.pub = 2";
} elseif($pub == 2) {
$where.= " and t1.datapi<=now() and t1.datapf>=now()";
}
// Processa o $_cop
if($_cop || $_flags & 8) {
$where.= " and t1.codfth=$_cop";
}
/*
// Introduzir o campo codlingua se o módulo tiver multilingua
$lgsuport = $_type->getParamter("lgsuport");
if($lgsuport) {
$where.= " and t1.codlg=$_LG";
}
*/
// Variáveis que serão utilizadas dentro do ciclo e fora do ciclo, mais do que uma vez
$autoDest = $_type->getParameter("autoDest");
$text_f = isset($_v["TEXT"]);
$title_f = isset($_v["TITLE"]);
$headline_f = isset($_v["HEADLINE"]);
$text2_f = isset($_v["TEXT2"]);
$record_url_f = isset($_v["RECORD_URL"]);
$fields = getFields($_it);
if(!$fields) {
$fields =" t1.codinf as _co, t1.codtype as _tp, t1.codfth as _cop";
if($title_f) {
$fields.= ",t1.title";
}
if($text_f) {
$fields.= ",t1.itext";
}
if($text2_f) {
$fields.= ",t1.itext2";
}
if($headline_f) {
if($autoDest && !$text_f) {
$fields.= ",t1.itext";
} else {
$fields.= ",t1.headline";
}
}
setFields($_it, $fields);
}
// destFlag = 2 - Destaque
if($_flags & 2) {
$where.= " and t1.destFlag = 2" ;
}
/** Processamento Final **/
//dia
if($_d && $_d!="-1" && $_d!="")
$where.= " and DAY(data)=$_d";
//mes
if($_m && $_m!="-1" && $_m!="")
$where.= " and MONTH(data)=$_m";
//ano
if($_y && $_y!="-1" && $_y!="")
$where.= " and YEAR(data)=$_y";
if($where)
$where = substr($where, 5); // and //
$sql = "select SQL_CALC_FOUND_ROWS ".$fields." from ".$from.($where?" where $where":"");
$vpini = "";
if(isset($_p["pini"])) {
$vpini = $_p["pini"];
repvar("COP", $_cop, $vpini);
$_pini = prepData($vpini);
}
$numreg = $_p["numreg"];
if($numreg) {
// Verifica se existe um valor de co, sem valor de pini. Pode acontecer que o valor de co está
// numa página diferente da primeira.
// Nesse caso, temos que calcular um valor para o pini, para que o cursor e a listagem surjam com
// o registo selecionado activo.
/* $auxordem = 0;
if($_co) {
$res = $bd->e("select ord from infrecord where codinf=$_co");
if(nr($res))
$auxordem = fc($res);
fr($res);
}
if($_p["numlimit"]) {
$_numlimit = $_p["numlimit"];
}
if(!$vpini) {
$vpini = "pini";
}
if(!$_pini && $auxordem) {
$auxWhere = "where ".($where?$where." and ":"")." t1.ord>=$auxordem";
$res = $bd->e("select count(t1.codnoticia) from $from $auxWhere $order");
$totRegAntes = fc($res);
fr($res);
if($totRegAntes > $_numreg) {
$_pini = (divInt($totRegAntes, $_numreg) - 1) * $_numreg;
if($totRegAntes % $_numreg)
$_pini += $_numreg;
$pini = $GLOBALS[$vpini] = $_pini;
}
}
$_pini+=$_numlimit; */
//apenas estava esta linha
$order.= " limit $_pini, ".$numreg;
}
$sql.= $order;
$r1 = $bd->e($sql);
$total = sql_total();
$totalreg = nr($r1);
if($_debug)
debug($this, "_TP:$_tp; _COP:$_cop; _CO: $_co; _CTD=$_ctd", $sql, $totalreg);
$lst = $lstcolunas= "";
if($totalreg) {
if($_p["colini"]) {
$ncol = $_p["colini"];
} else {
$ncol = 1;
}
$parimpar = $parimparlinha = 0;
$totalcount = 0;
$nlinha = $nColunas = 1;
$record = $first = $first_on = $colaux = $row = $odd = $even = $last_on = $last = $on = $row_odd = $row_even = $last_of_line="";
if(isset($_i["odd"])) $odd = $_i["odd"];
if(isset($_i["even"])) $even = $_i["even"];
if(isset($_i["last_on"])) $last_on = $_i["last_on"];
if(isset($_i["first"])) $first = $_i["first"];
if(isset($_i["first_on"])) $first_on = $_i["first_on"];
if(isset($_i["last"])) $last = $_i["last"];
if(isset($_i["on"])) $on = $_i["on"];
if(isset($_i["row_odd"])) $row_odd = $_i["row_odd"];
if(isset($_i["row_even"])) $row_even = $_i["row_even"];
if(isset($_i["last_of_line"])) $last_of_line = $_i["last_of_line"];
if($_p["nCols"] > 1) {
$nColunas = $_p["nCols"];
$row = $_i["row"];
}
if(isset($_p["headlinenchar"])) {
$headlinenchar = $_p["headlinenchar"];
}
if(isset($_i["record"])) $record = $_i["record"];
while($_vars = fd($r1)) {
$_co2 = $_vars["_co"];
regCod($_tp, $_co2);
$_vars["numreg"] = ++$totalcount;
$text = $headline = $title = $text2 = "";
if($selecionaprimeiro && $totalcount == 1) {
$_url["co"] = $_co2;
}
if($nColunas > 1 && $ncol == $nColunas && isset($_i["last_of_line"])) {
$reg = $last_of_line;
}
elseif($first_on && $totalcount==1 && $_co2 == $_url["co"]){
$reg = $first_on;
}
elseif($first && $totalcount==1){
$reg = $first;
}
elseif($last_on && $totalreg == $totalcount && $_co2 == $_url["co"]){
$reg = $last_on;
}
elseif($last && $totalreg == $totalcount){
$reg = $last;
}
elseif($on && $_co2 == $_url["co"]){
$reg = $on;
}
elseif($parimpar && $even){
$reg = $even;
}
elseif(!$parimpar && $odd){
$reg = $odd;
}
elseif($parimparlinha && $row_even){
$reg = $row_even;
}
elseif(!$parimparlinha && $row_odd){
$reg = $row_odd;
}
else{
$reg = $record;
}
$parimpar = !$parimpar;
$this->buildSons($reg, $_vars);
if($record_url_f) {
$url = getURL($_vars);
repvar("RECORD_URL", $url, $reg);
}
if($text_f) {
repvar("TEXT", $_vars["itext"], $reg);
}
if($title_f) {
repvar("TITLE", $_vars["title"], $reg);
}
if($headline_f) {
if($autoDest == 1) {
$auxtexto = strip_tags($_vars["itext"]);
repvar("HEADLINE", stripParagraph($auxtexto, $headlinenchar), $reg);
} else {
repvar("HEADLINE", $_vars["headline"], $reg);
}
}
repvar("COD", $_co2, $reg);
repvar("COP", $_vars["_cop"], $reg);
$lst.= $reg;
if($nColunas > 1) {
$ncol++;
if($ncol > $nColunas) {
$subint = ($nlinha == 1 && $first?$first:$row);
$colaux.= repvar("COLS", $lst, $subint);
$lst = "";
$ncol = 1;
$nlinha++;
}
}
}
if($ncol > 1){
$subint = ($nlinha == 1 && $first?$first:$row);
$lstcolunas.= repvar("COLS", $lst, $subint);
}
if($nColunas <= 1) {
repvar("LIST", $lst, $_html);
} else {
repvar("LIST", $lstcolunas, $_html);
}
} else { // Não tem registos nenhuns, verifica se tem a interface vazio definida
if(isset($_i["empty"]))
$_html = $_i["empty"];
elseif(isset($_i["empty_lst"]))
//$_html = str_repvar("[[V:LST]]", $_int->i["vazio_lst"], $_html);
repvar("LIST", $_i["empty_lst"], $_html);
elseif(!$_mainint)
$_html = "";
}
fr($r1);
repvar("TP", $_tp, $_html);
$url = (isset($_p["url"])?$_p["url"]:"");
if($url) {
if($_cop) {
repvar("COP", $_cop, $url);
}
}
// Variáveis para filhos. Ex: cursor
$_vars["totalreg"] = $totalreg;
if($vpini) {
$_vars["vpini"] = $vpini;
}
$_vars["totalregistos"] = $total-$_numlimit;
$_vars["registospagina"] = (isset($_p["numreg"])?$_p["numreg"]:$totalreg);
$_vars["cursorurl"] = $url;
$_vars["_tp"] = $_tp;
/**
* Listagem de notícias
*/
$order = $fields = $from = $where = "";
$headlinenchar = 300;
$total = 0;
$_pini = $_url["pini"];
$_numlimit = 0;
$_d = $_m = $_y = $inicio_limit = 0;
$from = "infrecord t1";
/** Variaveis da URL **/
if($_vurl) {
if($_vurl & 131072) {
$_d = prepData("d");
$_m = prepData("m");
$_y = prepData("y");
}
}
/** Herança **/
if($_inheritance) {
if($_inheritance & 131072 && isset($_vars["_ctd"])) {
$_ctd = $_vars["_ctd"];
}
}
/** Modificadores **/
if($_mods) {
if($_mods & 131072) {
$_co = $_ctd;
$_ctd = 0;
} elseif($_mods & 262144) {
$_cop = $_ctd;
$_ctd = 0;
} elseif($_mods & 524288) {
$_ctd = $_co;
$co = 0;
}elseif($_mods & 1048576) {
$_ctd = $_cop;
$cop = 0;
}
}
/** Flags **/
// Não Repetir código utilizados
if($_flags & 4) {
$utilizados = getCod($_tp);
if($utilizados) {
reset($utilizados);
$aux = "";
while(list($key, $val) = each($utilizados)) $aux.= ",$key";
if($aux) {
$aux = substr($aux, 1);
$where.= " and t1.codinf not in ($aux)";
}
}
}
// Faz um auto-seleciona do primeiro registo
$selecionaprimeiro = 0;
if($_flags & 131072 && !$_co) {
$selecionaprimeiro = 1;
}
if($_tp)
$where.= " and t1.codtype=$_tp ";
/** Parâmetros **/
if(isset($_p["property"]) && $_p["property"] && $_ctd) {
$property=$_p["property"];
$from.= ", property t2";
$where.= " and t2.codpp=$_ctd and t2.codtypepp=$property and t2.codtypeobj=$_tp and t1.codinf=t2.codobj";
}
// Ordem
if($_p["order"]) {
$order= " order by ".$_p["order"];
} else {
$order = " order by t1.ord desc";
}
// Where adicional
if($_p["where"]) {
$where.= " and ".$_p["where"];
}
/** Parâmetros do Tipo **/
// Campo Publicar -> Data de publicação entre limites
$pub = $_type->getParameter("pub");
if($pub == 1) {
$where.= " and t1.pub = 2";
} elseif($pub == 2) {
$where.= " and t1.datapi<=now() and t1.datapf>=now()";
}
// Processa o $_cop
if($_cop || $_flags & 8) {
$where.= " and t1.codfth=$_cop";
}
/*
// Introduzir o campo codlingua se o módulo tiver multilingua
$lgsuport = $_type->getParamter("lgsuport");
if($lgsuport) {
$where.= " and t1.codlg=$_LG";
}
*/
// Variáveis que serão utilizadas dentro do ciclo e fora do ciclo, mais do que uma vez
$autoDest = $_type->getParameter("autoDest");
$text_f = isset($_v["TEXT"]);
$title_f = isset($_v["TITLE"]);
$headline_f = isset($_v["HEADLINE"]);
$text2_f = isset($_v["TEXT2"]);
$record_url_f = isset($_v["RECORD_URL"]);
$fields = getFields($_it);
if(!$fields) {
$fields =" t1.codinf as _co, t1.codtype as _tp, t1.codfth as _cop";
if($title_f) {
$fields.= ",t1.title";
}
if($text_f) {
$fields.= ",t1.itext";
}
if($text2_f) {
$fields.= ",t1.itext2";
}
if($headline_f) {
if($autoDest && !$text_f) {
$fields.= ",t1.itext";
} else {
$fields.= ",t1.headline";
}
}
setFields($_it, $fields);
}
// destFlag = 2 - Destaque
if($_flags & 2) {
$where.= " and t1.destFlag = 2" ;
}
/** Processamento Final **/
//dia
if($_d && $_d!="-1" && $_d!="")
$where.= " and DAY(data)=$_d";
//mes
if($_m && $_m!="-1" && $_m!="")
$where.= " and MONTH(data)=$_m";
//ano
if($_y && $_y!="-1" && $_y!="")
$where.= " and YEAR(data)=$_y";
if($where)
$where = substr($where, 5); // and //
$sql = "select SQL_CALC_FOUND_ROWS ".$fields." from ".$from.($where?" where $where":"");
$vpini = "";
if(isset($_p["pini"])) {
$vpini = $_p["pini"];
repvar("COP", $_cop, $vpini);
$_pini = prepData($vpini);
}
$numreg = $_p["numreg"];
if($numreg) {
// Verifica se existe um valor de co, sem valor de pini. Pode acontecer que o valor de co está
// numa página diferente da primeira.
// Nesse caso, temos que calcular um valor para o pini, para que o cursor e a listagem surjam com
// o registo selecionado activo.
/* $auxordem = 0;
if($_co) {
$res = $bd->e("select ord from infrecord where codinf=$_co");
if(nr($res))
$auxordem = fc($res);
fr($res);
}
if($_p["numlimit"]) {
$_numlimit = $_p["numlimit"];
}
if(!$vpini) {
$vpini = "pini";
}
if(!$_pini && $auxordem) {
$auxWhere = "where ".($where?$where." and ":"")." t1.ord>=$auxordem";
$res = $bd->e("select count(t1.codnoticia) from $from $auxWhere $order");
$totRegAntes = fc($res);
fr($res);
if($totRegAntes > $_numreg) {
$_pini = (divInt($totRegAntes, $_numreg) - 1) * $_numreg;
if($totRegAntes % $_numreg)
$_pini += $_numreg;
$pini = $GLOBALS[$vpini] = $_pini;
}
}
$_pini+=$_numlimit; */
//apenas estava esta linha
$order.= " limit $_pini, ".$numreg;
}
$sql.= $order;
$r1 = $bd->e($sql);
$total = sql_total();
$totalreg = nr($r1);
if($_debug)
debug($this, "_TP:$_tp; _COP:$_cop; _CO: $_co; _CTD=$_ctd", $sql, $totalreg);
$lst = $lstcolunas= "";
if($totalreg) {
if($_p["colini"]) {
$ncol = $_p["colini"];
} else {
$ncol = 1;
}
$parimpar = $parimparlinha = 0;
$totalcount = 0;
$nlinha = $nColunas = 1;
$record = $first = $first_on = $colaux = $row = $odd = $even = $last_on = $last = $on = $row_odd = $row_even = $last_of_line="";
if(isset($_i["odd"])) $odd = $_i["odd"];
if(isset($_i["even"])) $even = $_i["even"];
if(isset($_i["last_on"])) $last_on = $_i["last_on"];
if(isset($_i["first"])) $first = $_i["first"];
if(isset($_i["first_on"])) $first_on = $_i["first_on"];
if(isset($_i["last"])) $last = $_i["last"];
if(isset($_i["on"])) $on = $_i["on"];
if(isset($_i["row_odd"])) $row_odd = $_i["row_odd"];
if(isset($_i["row_even"])) $row_even = $_i["row_even"];
if(isset($_i["last_of_line"])) $last_of_line = $_i["last_of_line"];
if($_p["nCols"] > 1) {
$nColunas = $_p["nCols"];
$row = $_i["row"];
}
if(isset($_p["headlinenchar"])) {
$headlinenchar = $_p["headlinenchar"];
}
if(isset($_i["record"])) $record = $_i["record"];
while($_vars = fd($r1)) {
$_co2 = $_vars["_co"];
regCod($_tp, $_co2);
$_vars["numreg"] = ++$totalcount;
$text = $headline = $title = $text2 = "";
if($selecionaprimeiro && $totalcount == 1) {
$_url["co"] = $_co2;
}
if($nColunas > 1 && $ncol == $nColunas && isset($_i["last_of_line"])) {
$reg = $last_of_line;
}
elseif($first_on && $totalcount==1 && $_co2 == $_url["co"]){
$reg = $first_on;
}
elseif($first && $totalcount==1){
$reg = $first;
}
elseif($last_on && $totalreg == $totalcount && $_co2 == $_url["co"]){
$reg = $last_on;
}
elseif($last && $totalreg == $totalcount){
$reg = $last;
}
elseif($on && $_co2 == $_url["co"]){
$reg = $on;
}
elseif($parimpar && $even){
$reg = $even;
}
elseif(!$parimpar && $odd){
$reg = $odd;
}
elseif($parimparlinha && $row_even){
$reg = $row_even;
}
elseif(!$parimparlinha && $row_odd){
$reg = $row_odd;
}
else{
$reg = $record;
}
$parimpar = !$parimpar;
$this->buildSons($reg, $_vars);
if($record_url_f) {
$url = getURL($_vars);
repvar("RECORD_URL", $url, $reg);
}
if($text_f) {
repvar("TEXT", $_vars["itext"], $reg);
}
if($title_f) {
repvar("TITLE", $_vars["title"], $reg);
}
if($headline_f) {
if($autoDest == 1) {
$auxtexto = strip_tags($_vars["itext"]);
repvar("HEADLINE", stripParagraph($auxtexto, $headlinenchar), $reg);
} else {
repvar("HEADLINE", $_vars["headline"], $reg);
}
}
repvar("COD", $_co2, $reg);
repvar("COP", $_vars["_cop"], $reg);
$lst.= $reg;
if($nColunas > 1) {
$ncol++;
if($ncol > $nColunas) {
$subint = ($nlinha == 1 && $first?$first:$row);
$colaux.= repvar("COLS", $lst, $subint);
$lst = "";
$ncol = 1;
$nlinha++;
}
}
}
if($ncol > 1){
$subint = ($nlinha == 1 && $first?$first:$row);
$lstcolunas.= repvar("COLS", $lst, $subint);
}
if($nColunas <= 1) {
repvar("LIST", $lst, $_html);
} else {
repvar("LIST", $lstcolunas, $_html);
}
} else { // Não tem registos nenhuns, verifica se tem a interface vazio definida
if(isset($_i["empty"]))
$_html = $_i["empty"];
elseif(isset($_i["empty_lst"]))
//$_html = str_repvar("[[V:LST]]", $_int->i["vazio_lst"], $_html);
repvar("LIST", $_i["empty_lst"], $_html);
elseif(!$_mainint)
$_html = "";
}
fr($r1);
repvar("TP", $_tp, $_html);
$url = (isset($_p["url"])?$_p["url"]:"");
if($url) {
if($_cop) {
repvar("COP", $_cop, $url);
}
}
// Variáveis para filhos. Ex: cursor
$_vars["totalreg"] = $totalreg;
if($vpini) {
$_vars["vpini"] = $vpini;
}
$_vars["totalregistos"] = $total-$_numlimit;
$_vars["registospagina"] = (isset($_p["numreg"])?$_p["numreg"]:$totalreg);
$_vars["cursorurl"] = $url;
$_vars["_tp"] = $_tp;
/**
* Listagem de notícias
*/
$order = $fields = $from = $where = "";
$headlinenchar = 300;
$total = 0;
$_pini = $_url["pini"];
$_numlimit = 0;
$_d = $_m = $_y = $inicio_limit = 0;
$from = "infrecord t1";
/** Variaveis da URL **/
if($_vurl) {
if($_vurl & 131072) {
$_d = prepData("d");
$_m = prepData("m");
$_y = prepData("y");
}
}
/** Herança **/
if($_inheritance) {
if($_inheritance & 131072 && isset($_vars["_ctd"])) {
$_ctd = $_vars["_ctd"];
}
}
/** Modificadores **/
if($_mods) {
if($_mods & 131072) {
$_co = $_ctd;
$_ctd = 0;
} elseif($_mods & 262144) {
$_cop = $_ctd;
$_ctd = 0;
} elseif($_mods & 524288) {
$_ctd = $_co;
$co = 0;
}elseif($_mods & 1048576) {
$_ctd = $_cop;
$cop = 0;
}
}
/** Flags **/
// Não Repetir código utilizados
if($_flags & 4) {
$utilizados = getCod($_tp);
if($utilizados) {
reset($utilizados);
$aux = "";
while(list($key, $val) = each($utilizados)) $aux.= ",$key";
if($aux) {
$aux = substr($aux, 1);
$where.= " and t1.codinf not in ($aux)";
}
}
}
// Faz um auto-seleciona do primeiro registo
$selecionaprimeiro = 0;
if($_flags & 131072 && !$_co) {
$selecionaprimeiro = 1;
}
if($_tp)
$where.= " and t1.codtype=$_tp ";
/** Parâmetros **/
if(isset($_p["property"]) && $_p["property"] && $_ctd) {
$property=$_p["property"];
$from.= ", property t2";
$where.= " and t2.codpp=$_ctd and t2.codtypepp=$property and t2.codtypeobj=$_tp and t1.codinf=t2.codobj";
}
// Ordem
if($_p["order"]) {
$order= " order by ".$_p["order"];
} else {
$order = " order by t1.ord desc";
}
// Where adicional
if($_p["where"]) {
$where.= " and ".$_p["where"];
}
/** Parâmetros do Tipo **/
// Campo Publicar -> Data de publicação entre limites
$pub = $_type->getParameter("pub");
if($pub == 1) {
$where.= " and t1.pub = 2";
} elseif($pub == 2) {
$where.= " and t1.datapi<=now() and t1.datapf>=now()";
}
// Processa o $_cop
if($_cop || $_flags & 8) {
$where.= " and t1.codfth=$_cop";
}
/*
// Introduzir o campo codlingua se o módulo tiver multilingua
$lgsuport = $_type->getParamter("lgsuport");
if($lgsuport) {
$where.= " and t1.codlg=$_LG";
}
*/
// Variáveis que serão utilizadas dentro do ciclo e fora do ciclo, mais do que uma vez
$autoDest = $_type->getParameter("autoDest");
$text_f = isset($_v["TEXT"]);
$title_f = isset($_v["TITLE"]);
$headline_f = isset($_v["HEADLINE"]);
$text2_f = isset($_v["TEXT2"]);
$record_url_f = isset($_v["RECORD_URL"]);
$fields = getFields($_it);
if(!$fields) {
$fields =" t1.codinf as _co, t1.codtype as _tp, t1.codfth as _cop";
if($title_f) {
$fields.= ",t1.title";
}
if($text_f) {
$fields.= ",t1.itext";
}
if($text2_f) {
$fields.= ",t1.itext2";
}
if($headline_f) {
if($autoDest && !$text_f) {
$fields.= ",t1.itext";
} else {
$fields.= ",t1.headline";
}
}
setFields($_it, $fields);
}
// destFlag = 2 - Destaque
if($_flags & 2) {
$where.= " and t1.destFlag = 2" ;
}
/** Processamento Final **/
//dia
if($_d && $_d!="-1" && $_d!="")
$where.= " and DAY(data)=$_d";
//mes
if($_m && $_m!="-1" && $_m!="")
$where.= " and MONTH(data)=$_m";
//ano
if($_y && $_y!="-1" && $_y!="")
$where.= " and YEAR(data)=$_y";
if($where)
$where = substr($where, 5); // and //
$sql = "select SQL_CALC_FOUND_ROWS ".$fields." from ".$from.($where?" where $where":"");
$vpini = "";
if(isset($_p["pini"])) {
$vpini = $_p["pini"];
repvar("COP", $_cop, $vpini);
$_pini = prepData($vpini);
}
$numreg = $_p["numreg"];
if($numreg) {
// Verifica se existe um valor de co, sem valor de pini. Pode acontecer que o valor de co está
// numa página diferente da primeira.
// Nesse caso, temos que calcular um valor para o pini, para que o cursor e a listagem surjam com
// o registo selecionado activo.
/* $auxordem = 0;
if($_co) {
$res = $bd->e("select ord from infrecord where codinf=$_co");
if(nr($res))
$auxordem = fc($res);
fr($res);
}
if($_p["numlimit"]) {
$_numlimit = $_p["numlimit"];
}
if(!$vpini) {
$vpini = "pini";
}
if(!$_pini && $auxordem) {
$auxWhere = "where ".($where?$where." and ":"")." t1.ord>=$auxordem";
$res = $bd->e("select count(t1.codnoticia) from $from $auxWhere $order");
$totRegAntes = fc($res);
fr($res);
if($totRegAntes > $_numreg) {
$_pini = (divInt($totRegAntes, $_numreg) - 1) * $_numreg;
if($totRegAntes % $_numreg)
$_pini += $_numreg;
$pini = $GLOBALS[$vpini] = $_pini;
}
}
$_pini+=$_numlimit; */
//apenas estava esta linha
$order.= " limit $_pini, ".$numreg;
}
$sql.= $order;
$r1 = $bd->e($sql);
$total = sql_total();
$totalreg = nr($r1);
if($_debug)
debug($this, "_TP:$_tp; _COP:$_cop; _CO: $_co; _CTD=$_ctd", $sql, $totalreg);
$lst = $lstcolunas= "";
if($totalreg) {
if($_p["colini"]) {
$ncol = $_p["colini"];
} else {
$ncol = 1;
}
$parimpar = $parimparlinha = 0;
$totalcount = 0;
$nlinha = $nColunas = 1;
$record = $first = $first_on = $colaux = $row = $odd = $even = $last_on = $last = $on = $row_odd = $row_even = $last_of_line="";
if(isset($_i["odd"])) $odd = $_i["odd"];
if(isset($_i["even"])) $even = $_i["even"];
if(isset($_i["last_on"])) $last_on = $_i["last_on"];
if(isset($_i["first"])) $first = $_i["first"];
if(isset($_i["first_on"])) $first_on = $_i["first_on"];
if(isset($_i["last"])) $last = $_i["last"];
if(isset($_i["on"])) $on = $_i["on"];
if(isset($_i["row_odd"])) $row_odd = $_i["row_odd"];
if(isset($_i["row_even"])) $row_even = $_i["row_even"];
if(isset($_i["last_of_line"])) $last_of_line = $_i["last_of_line"];
if($_p["nCols"] > 1) {
$nColunas = $_p["nCols"];
$row = $_i["row"];
}
if(isset($_p["headlinenchar"])) {
$headlinenchar = $_p["headlinenchar"];
}
if(isset($_i["record"])) $record = $_i["record"];
while($_vars = fd($r1)) {
$_co2 = $_vars["_co"];
regCod($_tp, $_co2);
$_vars["numreg"] = ++$totalcount;
$text = $headline = $title = $text2 = "";
if($selecionaprimeiro && $totalcount == 1) {
$_url["co"] = $_co2;
}
if($nColunas > 1 && $ncol == $nColunas && isset($_i["last_of_line"])) {
$reg = $last_of_line;
}
elseif($first_on && $totalcount==1 && $_co2 == $_url["co"]){
$reg = $first_on;
}
elseif($first && $totalcount==1){
$reg = $first;
}
elseif($last_on && $totalreg == $totalcount && $_co2 == $_url["co"]){
$reg = $last_on;
}
elseif($last && $totalreg == $totalcount){
$reg = $last;
}
elseif($on && $_co2 == $_url["co"]){
$reg = $on;
}
elseif($parimpar && $even){
$reg = $even;
}
elseif(!$parimpar && $odd){
$reg = $odd;
}
elseif($parimparlinha && $row_even){
$reg = $row_even;
}
elseif(!$parimparlinha && $row_odd){
$reg = $row_odd;
}
else{
$reg = $record;
}
$parimpar = !$parimpar;
$this->buildSons($reg, $_vars);
if($record_url_f) {
$url = getURL($_vars);
repvar("RECORD_URL", $url, $reg);
}
if($text_f) {
repvar("TEXT", $_vars["itext"], $reg);
}
if($title_f) {
repvar("TITLE", $_vars["title"], $reg);
}
if($headline_f) {
if($autoDest == 1) {
$auxtexto = strip_tags($_vars["itext"]);
repvar("HEADLINE", stripParagraph($auxtexto, $headlinenchar), $reg);
} else {
repvar("HEADLINE", $_vars["headline"], $reg);
}
}
repvar("COD", $_co2, $reg);
repvar("COP", $_vars["_cop"], $reg);
$lst.= $reg;
if($nColunas > 1) {
$ncol++;
if($ncol > $nColunas) {
$subint = ($nlinha == 1 && $first?$first:$row);
$colaux.= repvar("COLS", $lst, $subint);
$lst = "";
$ncol = 1;
$nlinha++;
}
}
}
if($ncol > 1){
$subint = ($nlinha == 1 && $first?$first:$row);
$lstcolunas.= repvar("COLS", $lst, $subint);
}
if($nColunas <= 1) {
repvar("LIST", $lst, $_html);
} else {
repvar("LIST", $lstcolunas, $_html);
}
} else { // Não tem registos nenhuns, verifica se tem a interface vazio definida
if(isset($_i["empty"]))
$_html = $_i["empty"];
elseif(isset($_i["empty_lst"]))
//$_html = str_repvar("[[V:LST]]", $_int->i["vazio_lst"], $_html);
repvar("LIST", $_i["empty_lst"], $_html);
elseif(!$_mainint)
$_html = "";
}
fr($r1);
repvar("TP", $_tp, $_html);
$url = (isset($_p["url"])?$_p["url"]:"");
if($url) {
if($_cop) {
repvar("COP", $_cop, $url);
}
}
// Variáveis para filhos. Ex: cursor
$_vars["totalreg"] = $totalreg;
if($vpini) {
$_vars["vpini"] = $vpini;
}
$_vars["totalregistos"] = $total-$_numlimit;
$_vars["registospagina"] = (isset($_p["numreg"])?$_p["numreg"]:$totalreg);
$_vars["cursorurl"] = $url;
$_vars["_tp"] = $_tp;
Mapa do Portal - Portal do Município de Vila Nova de Famalicão - Portugal