$num){ $tm[$t]=str_replace("+","+",$tm[$t]); $tm[$t]=urldecode($tm[$t]); $tm[$t]=str_replace("+","+",$tm[$t]); $params[]=$tm[$t]; } } } /////////// estils /////////// estils /////////// estils /////////// estils /////////// estils /////////// estils /////////// estils if($params[0]=="estils"){ if($params[1]=='normal'){ $_SESSION['estils']='normal'; } if($params[1]=='mobil'){ $_SESSION['estils']='mobil'; } if($params[1]=='sense'){ $_SESSION['estils']='sense estils'; } } if(!isset($_SESSION['estils'])){ ////////// Detector de iPhone ////////// $browser = strpos($_SERVER['HTTP_USER_AGENT'], "iPhone"); if ($browser === false) { $_SESSION['estils']='normal'; } else{ $_SESSION['estils']='mobil'; } } ////////// Configuració del web ////////// Configuració del web ////////// Configuració del web ////////// Configuració del web $cnf=new CONFIGURACIO_EXT(); $cnf->getConf(); $urlbase=$cnf->URL; $tpl->assign("URLBASE",$cnf->URL); $cnf->URL.="/".$_SESSION['url_idioma']; $ne=new IDIOMA_EXT(); $idioma_do=$ne->getIdiomaByIco($_SESSION['url_idioma']); if(!$idioma_do->ID_IDIOMA){ $nep=new IDIOMA_EXT(); $idioma_do=$nep->getIdiomaDefault(); header("Location: ".$urlbase."/".$idioma_do->ICONO."/"); } if($params[0]=="estils"){ header('Location: '.$cnf->URL.'/'); } $_SESSION['idioma']=$idioma_do->ID_IDIOMA; $pe=new PLANA_EXT(); $tm=''; for($p=0;$pID_IDIOMA=$_SESSION['idioma']; $ne->find(); $ne->fetch(); if($ne->CODI_IDIOMA){ @setlocale(LC_ALL,$ne->CODI_IDIOMA); $_SESSION['codi_idioma']=$ne->CODI_IDIOMA; } $tmp=explode(",",$params[sizeof($params)-1]); ////////// Items if($params[0]=="borsa"){ $ne=new BORSA_PUBLIC(); $not=$ne->getBorsaByTitol($params[sizeof($params)-1]); $pe=new PLANA_EXT(); $params=$pe->getCamiById($not[0]['borsa']->ID_PLANA); $tpl->assign("borsa",$not); $ne->setHit($not[0]['borsa']->ID_BORSA); $params=array_reverse($params); } if($params[0]=="actuacio"){ $ne=new ACTUACIO_PUBLIC(); $not=$ne->getActuacioByTitol($params[sizeof($params)-1]); $pe=new PLANA_EXT(); $params=$pe->getCamiById($not[0]['actuacio']->ID_PLANA); $tpl->assign("actuacio",$not); $ne->setHit($not[0]['actuacio']->ID_ACTUACIO); $params=array_reverse($params); } if($params[0]=="directori"){ $ne=new DIRECTORI_EXT(); $not=$ne->getDirectorisByPermalink($params[sizeof($params)-1]); $pe=new PLANA_EXT(); $params=$pe->getCamiById($not[0]['directori']->ID_PLANA); $tpl->assign("directori",$not); $ne->setHit($not[0]['directori']->ID_DIRECTORI); $params=array_reverse($params); } if($params[0]=="tramit"){ $ne=new TRAMIT_EXT(); $not=$ne->getTramitsByTitol($params[sizeof($params)-1]); $pe=new PLANA_EXT(); $params=$pe->getCamiById($not[0]['tramit']->ID_PLANA); $tpl->assign("tramit",$not); $ne->setHit($not[0]['tramit']->ID_TRAMIT); $params=array_reverse($params); } if($params[0]=="servei"){ $ne=new SERVEI_PUBLIC(); $not=$ne->getServeiByTitol($params[sizeof($params)-1]); $pe=new PLANA_EXT(); $params=$pe->getCamiById($not[0]['servei']->ID_PLANA); $tpl->assign("servei",$not); $ne->setHit($not[0]['servei']->ID_SERVEI); $params=array_reverse($params); } if($params[0]=="tauler"){ $ne=new TAULER_EXT(); $not=$ne->getNoticiaByTitol($params[1]); $pe=new PLANA_EXT(); $params=$pe->getCamiById($not[0]['noticia']->ID_PLANA); $tpl->assign("noticia",$not); $ne->setHit($not[0]['noticia']->ID_NOTICIA); $params=array_reverse($params); } if ($params [0] == "enquesta") { $ne = new ENQUESTA_EXT ( ); $not = $ne->getEnquestaById ($params [1]); $pe = new PLANA_EXT ( ); $params = $pe->getCamiById ( $not [0] ['enquesta']->ID_PLANA ); $tpl->assign ( "enquesta", $not ); $params = array_reverse ( $params ); } if($params[0]=="noticia"){ $ne=new NOTICIA_EXT(); $not=$ne->getNoticiaByTitol($params[1]); $pe=new PLANA_EXT(); $params=$pe->getCamiById($not[0]['noticia']->ID_PLANA); $tpl->assign("noticia",$not); $ne->setHit($not[0]['noticia']->ID_NOTICIA); $params=array_reverse($params); } if($params[0]=="agenda"){ $ne=new AGENDA_EXT(); $age=$ne->getAgendaByTitol($params[1]); $pe=new PLANA_EXT(); $params=$pe->getCamiById($age[0]['agenda']->ID_PLANA); $tpl->assign("agenda",$age); $ne->setHit($age[0]['agenda']->ID_AGENDA); $params=array_reverse($params); } if($params[0]=="producte"){ $ne=new PRODUCTE_EXT(); $not=$ne->getProducteByTitol($params[1]); $pe=new PLANA_EXT(); $params=$pe->getCamiById($not[0]['producte']->ID_PLANA); $tpl->assign("producte",$not); $ne->setHit($not[0]['producte']->ID_PRODUCTE); $params=array_reverse($params); } if(ereg("/logout-usuari/",$_SERVER['REQUEST_URI'])){ unset($_SESSION['pub_usuari']); unset($_SESSION['pub_usuari_id']); } if(ereg("/login-usuari/",$_SERVER['REQUEST_URI'])){ $usr=new USUARI_WEB_EXT(); $usr=$usr->getUsuari($_POST['pub_usuari'],$_POST['clau']); if($usr){ $_SESSION['pub_usuari_id']=$usr->ID_USUARI; }else{ $tpl->assign("login_ko","1"); } } if($_SESSION['pub_usuari_id']){ $usr=new USUARI_WEB_EXT(); $usr=$usr->getUsuariById($_SESSION['pub_usuari_id']); $_SESSION['pub_usuari']=$usr; } ////////// Paginador $ultim=$params[sizeof($params)-1]; if(ereg("pag,",$ultim)){ $ax=explode(",",$ultim); $_REQUEST['pageID']=$ax[1]; //Num pagina unset($params[sizeof($params)-1]); } $tpl->assign("params",$params); $params_all=$params; ////////// Pagina $cont=0; for($p=0;$pgetIdPlanaByNom($params[$p]); if(!$pp->ID_PLANA){ $params_cat[]=$params[$p]; }else{ $paux[]=$params[$p]; if($cont==0){ if(!$params[0]){ $params[0]="inici"; } $pl=new PLANA_EXT(); $idp=$pl->getIdPlanaByNom($params[0]); $_REQUEST['idplana']=$idp->ID_PLANA; $idplana=$idp->ID_PLANA; } if($cont==1){ $pl=new PLANA_EXT(); $idp=$pl->getIdPlanaByNom($params[0]); $_REQUEST['idpare']=$idp->ID_PLANA; $pare=$idp->ID_PLANA; $pl=new PLANA_EXT(); $idp=$pl->getIdPlanaByNom($params[1],$pare); $_REQUEST['idplana']=$idp->ID_PLANA; $idplana=$idp->ID_PLANA; } if($cont==2){ $pl=new PLANA_EXT(); $idp=$pl->getIdPlanaByNom($params[0]); $pl=new PLANA_EXT(); $pp=$pl->getIdPlanaByNom($params[1],$idp->ID_PLANA); $_REQUEST['idpare']=$idp->ID_PLANA; $pare=$idp->ID_PLANA; $pl=new PLANA_EXT(); $idp=$pl->getIdPlanaByNom($params[2],$pp->ID_PLANA); $_REQUEST['idplana']=$idp->ID_PLANA; $idplana=$idp->ID_PLANA; } $cont++; } } $tpl->assign("paux",$paux); $params_base=$paux; $params=$paux; if($chg_idioma==1){ if($idioma_do->PLANA_INICI==0){ $idplana=0; $_REQUEST['idplana']=0; }else{ $idplana=$idioma_do->PLANA_INICI; $_REQUEST['idplana']=$idplana; } } if($_REQUEST['idpare']){ $pare=$_REQUEST['idpare']; }else{ $pare=$idplana; } $tpl->assign("pare",$pare); $tpl->assign("idplana",$idplana); ////////// Foto principal de la pàgina ////////// Foto principal de la pïàgina ////////// Foto principal de la pàgina $pl=new PLANA_EXT(); $foto_seccio=$pl->getPlanaByIdAll($pare); $r=explode("/",$foto_seccio[0]['imatges'][0]['img']->NOM_ARXIU); $na=$r[sizeof($r)-1]; $tpl->assign("foto_seccio",$na); ////////// Suma 1 visita a la pàgina ////////// Suma 1 visita a la pàgina ////////// Suma 1 visita a la pàgina $pl=new PLANA_EXT(); $pl->setHits($idplana); ////////// Configuració de la pàgina ////////// Configuració de la pàgina ////////// Configuració de la pàgina ////////// Configuració de la pàgina ////////// Configuració de la pàgina $pa=new PLANA_EXT(); $pa->get($idplana); $pa->fetch(); if($pa->ID_PLANA!=$pa->REDIRECT_URL){ $idplana=$pa->REDIRECT_URL; } $idplana_real=$pa->ID_PLANA; $idplana_redireccio=$pa->REDIRECT_URL; $pl=new PLANA_EXT(); $pl->getConfPlana($idplana_redireccio); $confplana=$pl->getConfPlana($idplana_redireccio); $tpl->assign("confplana",$confplana); // si te un formulari asignat if($pl->FORMULARI){ $frm=new FORMULARI_PUBLIC(); $form=$frm->getFormulari($pl->FORMULARI); $tpl->assign("form",$form); } // Template base $var_tpl=$pl->ARXIU_TPL; $tpl->assign("tpl",$pl->ARXIU_TPL); ////////// Idiomes ////////// Idiomes ////////// Idiomes ////////// Idiomes ////////// Idiomes ////////// Idiomes ////////// Idiomes ////////// Idiomes ////////// Idiomes $idi=new IDIOMA_EXT(); $idis=$idi->getIdiomes(); $tpl->assign("idiomes",$idis); $idi=new IDIOMA_EXT(); $idisG=$idi->getIdiomesGencat(); $tpl->assign("idiomesGencat",$idisG); ////////// forçar clau api per al prova.cat ////////// forçar clau api per al prova.cat ////////// forçar clau api per al prova.cat if(ereg("prova.cat",$_SERVER['HTTP_HOST'])){ $cnf->GOOGLE_MAPS_KEY="ABQIAAAAEF61jhZ3kcyq6p0tk0djWRSUBUGytTY2aZYQgfZRiZoWdWmCehS4IGXfThXUKgCVgIFjRSkGfmzxvg"; } ////////// configuració del web especifica per l'idioma actual ////////// configuració del web especifica per l'idioma actual $cnf2=new IDIOMA_EXT(); $cnf2->getConf($_SESSION['idioma']); foreach ($cnf2 as $key=>$value){ if($key!='NOM'){ $cnf->$key=utf8_decode($value); } } ////////// passem el $cnf al $conf $conf=$cnf; $_SESSION['cnf']=$cnf; $tpl->assign("cnf",$cnf); ////////// URLS COMPARTIDES ////////// URLS COMPARTIDES ////////// URLS COMPARTIDES ////////// URLS COMPARTIDES ////////// URLS COMPARTIDES include_once('urls.php'); ////////// AMBITS ////////// AMBITS ////////// AMBITS ////////// AMBITS ////////// AMBITS ////////// AMBITS ////////// AMBITS $pla=new PLANA_EXT(); $plana_redireccio=$pla->getPlanaById($idplana_redireccio); if(($cnf->ID_PLANA_AMBIT==$plana_redireccio->PARE)){ // carreguem el id d'un ambit segons el nom $ab=new AMBIT_EXT(); $a=$ab->getAmbitById($idplana_redireccio, $cnf->ID_PLANA_AMBIT); //$a=$ab->getAmbitByNom($params[sizeof($params)-1],$cnf->ID_PLANA_AMBIT); $idambit=$a->ID_PLANA; // en cas de tenir un ambit carregat if($idambit){ // noticies de l'ambit $not=new NOTICIA_EXT(); $noticies=$not-> getNoticiesByAmbit($idambit); $tpl->assign("noticies",$noticies); // actes de l'ambit $not=new AGENDA_EXT(); $actes=$not-> getActesByAmbit($idplana_redireccio,$destacada="0",$limit=0,$idambit); $tpl->assign("actes",$actes); // anuncis de l'ambit $not=new TAULER_EXT(); $tauler=$not-> getNoticiesByAmbit($idambit,$conf->ID_PLANA_TAULER); $tpl->assign("taulers",$tauler); // perfils de l'ambit $not=new TAULER_EXT(); $tauler=$not-> getNoticiesByAmbit($idambit,$conf->ID_PLANA_PERFIL); $tpl->assign("perfil",$tauler); // serveis de l'ambit $srv=new SERVEI_PUBLIC(); $serveis=$srv->getServeisAmbit($idambit); $tpl->assign("serveis",$serveis); // directoris de l'ambit $srv=new DIRECTORI_EXT(); $dire=$srv->getDirectorisAmbit($idambit); $tpl->assign("directoris",$dire); // actuacions de l'ambit $srv=new ACTUACIO_PUBLIC(); $dire=$srv->getActuacionsAmbit($idambit); $tpl->assign("actuacions",$dire); // borsas de l'ambit $srv=new BORSA_PUBLIC(); $dire=$srv->getBorsesAmbit($idambit); $tpl->assign("borses",$dire); // tramits de l'ambit $srv=new TRAMIT_EXT(); $tr=$srv->getTramitsAmbit($idambit); $tpl->assign("tramits",$tr); // productes de l'ambit $not=new PRODUCTE_EXT(); $noticies=$not-> getProductesByAmbit($idambit); $tpl->assign("productes",$productes); ////////// Destacats ////////// Destacats $pl=new DESTACAT_EXT(); $dest=$pl->getDestacatsByAmbit($idambit); $tpl->assign("destacatsAmbit",$dest); ////////// fills de la pàgina ////////// fills de la pàgina $pe=new PLANA_EXT(); $fills=$pe->getFillsPlanaById($idambit); $tpl->assign("fills",$fills); // template $tpl->assign("tpl","tplAmbit.tpl.php"); } } ////////// Informació de la plana pare ////////// Informació de la plana pare ////////// Informació de la plana pare ////////// Informació de la plana pare $pl=new PLANA_EXT();$nom_pare=$pl->getPlanaById($pare); $tpl->assign("nom_pare",$nom_pare); /////////// Components, moduls i les seves consultes /////////// Components, moduls i les seves consultes /////////// Components, moduls i les seves consultes $md=new MODUL_PLANA_EXT(); $moduls_plana=$md->getModulsByPlana($idplana_redireccio); for($m=0;$mPHP){ ////////// Modul enquesta case "md_enquesta" : $en = new ENQUESTA_EXT ( ); $dr = $en->getEnquestes (); $tpl->assign ( "enquestes", $dr ); break; ////////// Modul de productes case "md_prod": $not=new PRODUCTE_EXT(); $tpl->assign("params_cat",$params_cat); if(sizeof($params_cat)>0){ $pb=$params_cat[sizeof($params_cat)-1]; $categoria=$params_cat[sizeof($params_cat)-1]; $nc=new PRODUCTE_CATEGORIA(); $nc->NOM=$pb; $nc->whereAdd("ID_PLANA=".$idplana_redireccio); $nc->find(); $nc->fetch(); $dr=$not->getProductes($idplana_redireccio,0,"all",$nc->ID_PRODUCTE_CATEGORIA,0); }else{ $dr=$not->getProductes($idplana_redireccio,0,"all",0,0); } $pbase=""; for($u=0;$uURL."/".url_encode(utf8_decode($pbase)); if($categoria){ $_SESSION['categoria_producte']=$categoria; } if(!ereg("/producte/",$_SERVER['REQUEST_URI'])&&!$categoria){ $_SESSION['categoria_producte']=''; } $cats_dir=$not->getParentSelectView($idplana_redireccio,"cat",$nc->ID_PRODUCTE_CATEGORIA,$urlbase,$cnf->TOTES_CATEGORIES); $tpl->assign("cats_producte",$cats_dir); $tpl->assign("productes",$dr); break; ////////// Modul de notícies case "md_noticia": $not=new NOTICIA_EXT(); ///// recollim l'any i el mes per la hemeroteca if(ereg("hemeroteca-",$params_cat[sizeof($params_cat)-1])){ $hemeroteca=explode("hemeroteca-",$params_cat[sizeof($params_cat)-1]); $data=explode("-",$hemeroteca[1]); $_SESSION['hemeroteca_any']=$data[0]; if($data[1]){ $_SESSION['hemeroteca_mes']=$data[1]; }else{ $_SESSION['hemeroteca_mes']=''; } }else{ $_SESSION['hemeroteca_any']=''; $_SESSION['hemeroteca_mes']=''; } ////// $tpl->assign("params_cat",$params_cat); if(sizeof($params_cat)>0){ $pb=$params_cat[sizeof($params_cat)-1]; $nc=new NOTICIA_CATEGORIA(); $nc->NOM=$pb; $nc->whereAdd("ID_PLANA=".$idplana_redireccio); $nc->find(); $nc->fetch(); if($_SESSION['hemeroteca_mes']>0 or $_SESSION['hemeroteca_any']>0){ $dr=$not->getNoticiesHemeroteca($idplana_redireccio,0,"all",$nc->ID_NOTICIA_CATEGORIA,0); }else{ $dr=$not->getNoticies($idplana_redireccio,0,"all",$nc->ID_NOTICIA_CATEGORIA,0); } }else{ if($_SESSION['hemeroteca_mes']>0 or $_SESSION['hemeroteca_any']>0){ $dr=$not->getNoticiesHemeroteca($idplana_redireccio,0,"all",0,0); }else{ $dr=$not->getNoticies($idplana_redireccio,0,"all",0,0); } } $pbase=""; for($u=0;$uURL."/".url_encode(utf8_decode($pbase)); $cats_dir=$not->getParentSelectView($idplana_redireccio,"cat",$nc->ID_NOTICIA_CATEGORIA,$urlbase,$cnf->TOTES_CATEGORIES); $tpl->assign("cats_noticia",$cats_dir); ///// hemeroteca de noticias $hemeroteca_anys=$not->getHemerotecaAnys($idplana_redireccio,"hemeroteca",$urlbase); $tpl->assign("hemeroteca_anys",$hemeroteca_anys); if(ereg("hemeroteca-",$params_cat[sizeof($params_cat)-1])){ $mesos=$not->getHemerotecaMesos($idplana_redireccio,"hemeroteca",$urlbase); $tpl->assign("hemeroteca_mesos",$mesos); } ////// $tpl->assign("noticies",$dr); break; ////////// Modul tauler d'anuncis case "md_tauler": $not=new TAULER_EXT(); $tpl->assign("params_cat",$params_cat); if(sizeof($params_cat)>0){ $pb=$params_cat[sizeof($params_cat)-1]; $nc=new TAULER_CATEGORIA(); $nc->NOM=$pb; $nc->whereAdd("ID_PLANA=".$idplana_redireccio); $nc->find(); $nc->fetch(); $dr=$not->getNoticies($idplana_redireccio,0,"all",$nc->ID_NOTICIA_CATEGORIA); }else{ $dr=$not->getNoticies($idplana_redireccio,0,"all"); } $pbase=""; for($u=0;$uURL."/".url_encode(utf8_decode($pbase)); $cats_dir=$not->getParentSelectView($idplana_redireccio,"cat",$nc->ID_NOTICIA_CATEGORIA,$urlbase,$cnf->TOTES_CATEGORIES); $tpl->assign("cats_tauler",$cats_dir); $tpl->assign("noticies",$dr); break; ////////// Modul directoris case "md_directori": $not=new DIRECTORI_EXT(); $tpl->assign("params_cat",$params_cat); if(sizeof($params_cat)>0){ $pb=$params_cat[sizeof($params_cat)-1]; $nc=new DIRECTORI_CATEGORIA(); $nc->NOM=$pb; $nc->whereAdd("ID_PLANA=".$idplana_redireccio); $nc->find(); $nc->fetch(); $dr=$not->getDirectoris($idplana_redireccio,0,$nc->ID_DIRECTORI_CATEGORIA); }else{ $dr=$not->getDirectoris($idplana_redireccio,0); } $pbase=""; for($u=0;$uURL."/".url_encode(utf8_decode($pbase)); $cats_dir=$not->getParentSelectView($idplana_redireccio,"cat",$nc->ID_DIRECTORI_CATEGORIA,$urlbase,$cnf->TOTES_CATEGORIES); $tpl->assign("cats_dir",$cats_dir); $tpl->assign("directoris",$dr); break; ////////// Modul borsa de treball case "md_borsa": $act = new BORSA_PUBLIC(); $tpl->assign("params_cat",$params_cat); if(sizeof($params_cat)>0){ $pb=$params_cat[sizeof($params_cat)-1]; $nc=new BORSA_CATEGORIA(); $nc->NOM=$pb; $nc->whereAdd("ID_PLANA=".$idplana_redireccio); $nc->find(); $nc->fetch(); $dr=$act->getBorses($idplana_redireccio,0,$nc->ID_BORSA_CATEGORIA); }else{ $dr=$act->getBorses($idplana_redireccio,0); } $pbase=""; for($u=0;$uURL."/".url_encode(utf8_decode($pbase)); $cats_dir=$act->getParentSelectView($idplana_redireccio,"cat",$nc->ID_BORSA_CATEGORIA,$urlbase,$cnf->TOTES_CATEGORIES); $tpl->assign("cats_borsa",$cats_dir); $tpl->assign("borses",$dr); break; ////////// Modul actuacions case "md_actuacions": $act = new ACTUACIO_PUBLIC(); $tpl->assign("params_cat",$params_cat); if(sizeof($params_cat)>0){ $pb=$params_cat[sizeof($params_cat)-1]; $nc=new ACTUACIO_CATEGORIA(); $nc->NOM=$pb; $nc->whereAdd("ID_PLANA=".$idplana_redireccio); $nc->find(); $nc->fetch(); $dr=$act->getActuacions($idplana_redireccio,0,$nc->ID_ACTUACIO_CATEGORIA); }else{ $dr=$act->getActuacions($idplana_redireccio,0); } $pbase=""; for($u=0;$uURL."/".url_encode(utf8_decode($pbase)); $cats_dir=$act->getParentSelectView($idplana_redireccio,"cat",$nc->ID_ACTUACIO_CATEGORIA,$urlbase,$cnf->TOTES_CATEGORIES); $tpl->assign("cats_act",$cats_dir); $tpl->assign("actuacions",$dr); break; ////////// Modul carrerer case "md_carrerer": $ma = new CARRERER_EXT(); $dades = $ma->getDadesCarrerer($idplana_redireccio); $tpl->assign("dades",$dades); $dd=new MODUL_PLANA(); $dd->whereAdd("ID_MODUL=18"); $dd->find(); $cont=0; while($dd->fetch()){ $pl=new PLANA_IDIOMA(); $pl->whereAdd("ID_PLANA=".$dd->ID_PLANA); $pl->find(); $pl->fetch(); if($pl->ID_IDIOMA==$_SESSION['idioma']){ $res[$cont]['plana']=$pl; $dir=new DIRECTORI_EXT(); $daux=$dir->getParentCat($dd->ID_PLANA);//548 $res[$cont]['categoria']=$daux; $cont++; } } $tpl->assign("llegenda",$res); $dd=new DIRECTORI(); $dd->whereAdd("ID_IDIOMA=".$_SESSION['idioma']); if($_POST['pagina']){ $dd->whereAdd("ID_PLANA=".$_POST['pagina']); } $dd->whereAdd("LONGITUT !=''"); $dd->whereAdd("LATITUT != ''"); $dd->find(); while($dd->fetch()){ $dirmapa[]=clone($dd); } $tpl->assign("dirmapa",$dirmapa); break; ////////// Modul tramits case "md_tramit": $not=new TRAMIT_EXT(); $tpl->assign("params_cat",$params_cat); if(sizeof($params_cat)>0){ $pb=$params_cat[sizeof($params_cat)-1]; $nc=new TRAMIT_CATEGORIA(); $nc->NOM=$pb; $nc->whereAdd("ID_PLANA=".$idplana_redireccio); $nc->find(); $nc->fetch(); $dr=$not->getTramits($idplana_redireccio,0,$nc->ID_TRAMIT_CATEGORIA); }else{ $dr=$not->getTramits($idplana_redireccio,0); } $not=new TRAMIT_EXT(); $pbase=""; for($u=0;$uURL."/".url_encode(utf8_decode($pbase)); $cats_dir=$not->getParentSelectView($idplana_redireccio,"cat",$nc->ID_TRAMIT_CATEGORIA,$urlbase,$cnf->TOTES_CATEGORIES); $tpl->assign("cats_tramit",$cats_dir); $tpl->assign("tramits",$dr); break; ////////// Modul serveis case "md_servei": $not=new SERVEI_PUBLIC(); $tpl->assign("params_cat",$params_cat); if(sizeof($params_cat)>0){ $pb=$params_cat[sizeof($params_cat)-1]; $nc=new SERVEI_CATEGORIA(); $nc->NOM=$pb; $nc->whereAdd("ID_PLANA=".$idplana_redireccio); $nc->find(); $nc->fetch(); $dr=$not->getServeis($idplana_redireccio,0,$nc->ID_SERVEI_CATEGORIA); }else{ $dr=$not->getServeis($idplana_redireccio,0); } $not=new SERVEI_PUBLIC(); $pbase=""; for($u=0;$uURL."/".url_encode(utf8_decode($pbase)); $cats_dir=$not->getParentSelectView($idplana_redireccio,"cat",$nc->ID_SERVEI_CATEGORIA,$urlbase,$cnf->TOTES_CATEGORIES); $tpl->assign("cats_servei",$cats_dir); $tpl->assign("serveis",$dr); break; ////////// Modul agenda case "md_agenda": $ag=new AGENDA_EXT(); $tpl->assign("params_cat",$params_cat); if(sizeof($params_cat)>0){ $nc=new AGENDA_CATEGORIA(); $nc->NOM=$params_cat[sizeof($params_cat)-1]; $nc->whereAdd("ID_PLANA=".$idplana_redireccio); $nc->find(); $nc->fetch(); $agendes=$ag->getActes($idplana_redireccio,0,0,"all",$nc->ID_AGENDA_CATEGORIA); }else{ $agendes=$ag->getActes($idplana_redireccio,0,0,"all"); } $pbase=""; for($u=0;$uURL."/".url_encode(utf8_decode($pbase)); $ne=new AGENDA_EXT(); if(isset($params[1])){ $urlbase=$conf->URL."/".url_encode(utf8_decode($params[0]."/".$params[1]))."/"; }else{ $urlbase=$conf->URL."/".url_encode(utf8_decode($params[0]))."/"; } $cats=$ne->getParentSelectView($idplana_redireccio,"cat",$nc->ID_AGENDA_CATEGORIA,$urlbase,$cnf->TOTES_CATEGORIES); $tpl->assign("cats_agenda",$cats); $tpl->assign("agendes",$agendes); break; ////////// Modul picassa case "md_picassa": $pic=new PICASA_EXT(); $user=$pic->getUserByPlana($idplana_redireccio); //RECUPAREM USUARI PICASA ini_set('include_path', './classes/picasa/'); require_once("classes/picasa/Picasa.php"); if(!ereg("foto",$_SERVER['REQUEST_URI'])&&(!ereg("idgaleria",$_SERVER['REQUEST_URI']))){ $p=new Picasa(); $account=$p->getAlbumsByUsername($user);// $username, $maxResults=null, $startIndex=null, $visibility="public", $thumbsize=null, $imgmax=null) { $albums=$account->getAlbums(); $tpl->assign("albums",$albums); }else{ if(ereg("foto",$_SERVER['REQUEST_URI'])){ $idfoto=$params_all[sizeof($params_all)-1]; $idalbum=$params_all[sizeof($params_all)-3]; if($idfoto){ $p=new Picasa(); $image = $p->getImageById($user,$idalbum, $idfoto); $album = $p->getAlbumById($user, $idalbum); $tool_picasa[0]['nom']=$album->getTitle(); $tool_picasa[0]['id']=$idalbum; $tool_picasa[1]['nom']=$image->getDescription(); $tool_picasa[1]['id']=$idfoto; $images = $album->getImages(); for($a=0;$agetIdNum(); } $pos=array_search($idfoto,$nums); $seg=$pos+1; $ant=$pos-1; if($segassign("foto_seguent",$images[$seg]->getIdNum()); } if($ant>=0){ $tpl->assign("foto_anterior",$images[$ant]->getIdNum()); } $tpl->assign("actual",$pos); $tpl->assign("total",sizeof($images)-1); $tpl->assign("idalbum",$idalbum); $tpl->assign("image",$image); } }else{ if(ereg("idgaleria",$_SERVER['REQUEST_URI'])){ $idalbum=$params_all[sizeof($params_all)-1]; if($idalbum){ $p=new Picasa(); $album = $p->getAlbumById($user, $idalbum); $tool_picasa[0]['nom']=$album->getTitle(); $tool_picasa[0]['id']=$idalbum; $images = $album->getImages(); $tpl->assign("images",$images); } } } } break; ////////// Modul mapa simple google maps case "md_mapa": $ma = new MAPA_EXT(); $dades = $ma->getDadesMapa($idplana_redireccio); $tpl->assign("dades",$dades); break; ////////// Modul mapa de la web case "md_mapaweb": $cr=new core(); $mw=$cr->getMapaWeb("",0,$url,1,0,$conf); $tpl->assign("mapaweb",$mw); break; ////////// Modul cercador case "md_cercador": $tmp=explode("/",$_SERVER['REQUEST_URI']); if(ereg("pag,",$tmp[sizeof($tmp)-2])){ $paraula=$tmp[sizeof($tmp)-3]; }else{ $paraula=$tmp[sizeof($tmp)-2]; } if($paraula){ $paraula=urldecode($paraula); $cr=new core(); if(!$_POST['params_cerca']){ $_POST['params_cerca'][0]="plana"; } if(!ereg("pag,",$tmp[sizeof($tmp)-2])){ $_SESSION['params_cerca']=$_POST['params_cerca']; } $cerca=$cr->findCerca($paraula,$_SESSION['params_cerca']); $tpl->assign("paraulac",$paraula); $tpl->assign("cerca",$cerca); $tpl->assign("params_cerca",$_SESSION['params_cerca']); } break; ////////// Modul videos case "md_youtube": break; ////////// Modul butlletí case "md_newsletter": $tmp=explode("/",$_SERVER['REQUEST_URI']); $accio=$tmp[sizeof($tmp)-1]; $but=new BUTLLETI(); $but->ID_PLANA=$idplana_redireccio; $but->orderBy("ID_BUTLLETI DESC"); $but->find(); $but->fetch(); $but_ultim[]=clone($but); $tpl->assign("but_ultim",$but_ultim); $tmp_accio=explode(",",$accio); if($tmp_accio[1]&&$tmp_accio[2]&&$tmp_accio[3]){ $but=new BUTLLETI_MAILER(); $but->whereAdd("EMAIL='".$tmp_accio[1]."' and PASS='".$tmp_accio[2]."' and ID_PLANA=".$tmp_accio[3]); $but->find(); $but->fetch(); $but->CONFIRMAT=1; $but->update(); $tpl->assign("ok_confirmat",1); } if($tmp_accio[0]=="subscribe"){ if($_POST['email']!=''){ if (ereg("([A-Za-z0-9_.-]+@[A-Za-z0-9_.-]+\.[A-Za-z0-9_-]+)", $_POST['email'])) { $do=new BUTLLETI_EXT(); if($do->addMailer($_POST)){ $tpl->assign("ok",1); }else{ $tpl->assign("err_repe",1); } }else{ $tpl->assign("err_mailnovalid",1); } } } if($accio=="unsubscribe"){ $do=new BUTLLETI_EXT(); if (ereg("([A-Za-z0-9_.-]+@[A-Za-z0-9_.-]+\.[A-Za-z0-9_-]+)", $_POST['email'])) { if($do->delMailer($_POST)){ $tpl->assign("okdel",1); }else{ $tpl->assign("err_del",1); } }else{ $tpl->assign("err_mailnovalid",1); } } }//fi del switch }//fi del for $tpl->assign("tool_picasa",$tool_picasa); $tpl->assign("path_aux",$path_aux); $tpl->assign("moduls",$moduls_plana); /////////////////////// Menús /////////////////////// Menús /////////////////////// Menús /////////////////////// Menús /////////////////////// Menús /////////////////////// Menús // _getMenuByNom('nom del menu'); $mn=new MENU_EXT(); $mn->selectAdd(); $mn->selectAdd('distinct NOM_MENU'); $mn->find(); while($mn->fetch()){ $mn2=new MENU_EXT(); $menuaux=$mn2->getMenuByNom($mn->NOM_MENU); $tpl->assign($mn->NOM_MENU,$menuaux); } /////////////////////FI Menús/////////////////////// $cr=new core(); $cr->IDIOMA=$_SESSION['idioma']; $menu_seccio=$cr->getMenuByPare($idplana,$pare,$cnf->URL,1,$pare); $tpl->assign("menu_seccio",$menu_seccio); ////////// Destacats dins de l'ambit o fils del ambit////////// Destacats dins de l'ambit o fils del ambit if($_SESSION['conf']->ID_PLANA_AMBIT==$pare){ $cr=new core(); $pp=$cr->getCami($idplana); foreach($pp as $cami){ if($cami['pare']==$pare){ $ambit=$cami['idplana']; } } $pl=new DESTACAT_EXT(); $dest=$pl->getDestacatsByAmbit($ambit); $tpl->assign("destacats",$dest); } /////////////////////// Camí de formiga /////////////////////// Camí de formiga /////////////////////// Camí de formiga /////////////////////// Camí de formiga if($cnf->MOSTRA_CAMI=='1'){ $cr=new core(); $pp=$cr->getCami($idplana_real) ; for($i=0;$igetPlanaById($pp[$i]['idplana']); $pla=new PLANA_EXT(); $lnk=$pla->getCamiById($idplana_real); $lnk=array_reverse($lnk); $tmp=""; $link[$i]['nom']=$pp[$i]['nom']; for($a=0;$aassign("path",$link); } /////////////////////// Interior /////////////////////// Interior /////////////////////// Interior /////////////////////// Interior /////////////////////// Interior if($_REQUEST['idplana']){ ////////// Carreguem les fotos de la portada (Opcional segons disseny) $im=new IMATGE_EXT(); $pi=$im->getImatges(0,"FRONTPAGE"); for($f=0;$fNOM_ARXIU); $foto[$f]['img']=$fo[sizeof($fo)-1]; $foto[$f]['nom']=utf8_decode($pi[$f]['img_dades']->NOM); $foto[$f]['des']=utf8_decode($pi[$f]['img_dades']->DESCRIPCIO); } $tpl->assign("ss",$foto); $ale=rand(0,sizeof($foto)-1); $tpl->assign("imatge_home",$foto[$ale]); ////////// Cerquem la pàgina $pl=new PLANA_EXT();$plana_actual=$pl->getPlanaById($idplana_redireccio); $tpl->assign("plana_actual",$plana_actual); ////////// Paragrafs de la pàgina $pf=new PARAGRAF_EXT();$pfs=$pf->getParagraf($idplana_redireccio); $tpl->assign("pfs",$pfs); ////////// Imatges de la pàgina $im=new IMATGE_EXT(); $pi=$im->getImatges($idplana_redireccio,"PLANA"); $tpl->assign("imatges_plana",$pi); ////////// documents de la pàgina $im=new DOCUMENT_EXT(); $pi=$im->getDocuments($idplana_redireccio,"PLANA"); $tpl->assign("docs_plana",$pi); ////////// Links de la pàgina $im=new LINK_EXT(); $pi=$im->getLinks($idplana_redireccio,"PLANA",$_SESSION['idioma']); $tpl->assign("links_plana",$pi); ////////// Vídeos de la pàgina $im=new YOUTUBE_EXT(); $pi=$im->getVideos($idplana_redireccio,"PLANA"); $tpl->assign("videos_plana",$pi); ////////// Destacats ////////// Destacats $pl=new DESTACAT_EXT(); $dest=$pl->getDestacats(); $tpl->assign("destacats",$dest); ////////// Template Fills ////////// Template Fills if(($var_tpl=="tplFills.tpl.php")||($var_tpl=="tplFillsNoFoto.tpl.php")){ ////////// fills de la pàgina ////////// fills de la pàgina $pe=new PLANA_EXT(); $fills=$pe->getFillsPlanaById($idplana_redireccio); $tpl->assign("fills",$fills); } ////////// Template Actualitat ////////// Template Actualitat if($var_tpl=="tplActualitat.tpl.php"){ $ne=new NOTICIA_EXT(); ////////// Últimes 4 Notícies ////////// Últimes 4 Notícies $noticies=$ne->getNoticies($conf->ID_PLANA_NOTICIES,0,"all",0,4); $tpl->assign("noticies",$noticies); ////////// Últims 4 Actes ////////// Últims 4 Actes $not=new AGENDA_EXT(); $agendes=$not->getActes($conf->ID_PLANA_AGENDA,0,4); $tpl->assign("actes",$agendes); ////////// Últims 4 anuncis ////////// Últims 4 anuncis $ne=new TAULER_EXT(); $t=$ne->getNoticies($conf->ID_PLANA_TAULER,0,"all",0,4); $tpl->assign("tauler",$t); } ////////// Template ////////// Template $tpl->display("tpl/seccio.tpl.php"); }else{ /////////////////////// Portada /////////////////////// Portada /////////////////////// Portada /////////////////////// Portada /////////////////////// Portada ////////// Imatges a portada ////////// Imatges a portada $im=new IMATGE_EXT(); $pi=$im->getImatges(0,"FRONTPAGE"); for($f=0;$fNOM_ARXIU); $foto[$f]['img']=$fo[sizeof($fo)-1]; $foto[$f]['nom']=utf8_decode($pi[$f]['img_dades']->NOM); $foto[$f]['des']=utf8_decode($pi[$f]['img_dades']->DESCRIPCIO); } $tpl->assign("ss",$foto); $ale=rand(0,sizeof($foto)-1); $tpl->assign("imatge_home",$foto[$ale]); ////////// Ambits a portada ////////// Ambits a portada $amb=new AMBIT_EXT(); $ambits=$amb->getAmbitsAll($conf->ID_PLANA_AMBIT); $tpl->assign("ambits",$ambits); ////////// Notícies destacades ////////// Notícies destacades $ne=new NOTICIA_EXT(); $noticies=$ne->getNoticiesDestacada($conf->ID_PLANA_NOTICIES);//$idplana opcional $tpl->assign("noticies",$noticies); ////////// Agenda destacada ////////// Agenda destacada $ae=new AGENDA_EXT(); $actes=$ae->getActesDestacats($conf->ID_PLANA_AGENDA);//$idplana opcional $tpl->assign("actes",$actes); ////////// Anuncis destacats ////////// Anuncis destacats $ne=new TAULER_EXT(); $t=$ne->getNoticiesDestacada($conf->ID_PLANA_TAULER); //$idplana opcional $tpl->assign("taulers",$t); ////////// Perfil ////////// Perfil $ne=new TAULER_EXT(); $t=$ne->getNoticiesDestacada($conf->ID_PLANA_PERFIL); //$idplana opcional $tpl->assign("perfil",$t); ////////// Productes destacats ////////// Productes destacats $ne=new PRODUCTE_EXT(); $productes=$ne->getProductesDestacada($conf->ID_PLANA_PRODUCTE); //$idplana opcional $tpl->assign("productes",$productes); ////////// Destacats ////////// Destacats $pl=new DESTACAT_EXT(); $dest=$pl->getDestacats(); $tpl->assign("destacats",$dest); ////////// Template ////////// Template $tpl->display("tpl/index.tpl.php"); } ?>