0) { $_SESSION[PROGETTO]['s_idLang_site'] = $p_idLang ; } else { $defIdLang = (!$_SESSION[PROGETTO]['settings']['default_id_lingua'])? 1 : $_SESSION[PROGETTO]['settings']['default_id_lingua']; $p_idLang = ($_SESSION[PROGETTO]['s_idLang_site'] >0) ? $_SESSION[PROGETTO]['s_idLang_site'] : $defIdLang; if($_SESSION[PROGETTO]['s_idLang_site'] >0) { $p_idLang = $_SESSION[PROGETTO]['s_idLang_site']; } else { $p_idLang = $defIdLang; $_SESSION[PROGETTO]['s_idLang_site'] = $defIdLang; } } $thisPage = $_SERVER['PHP_SELF']; $_SESSION[PROGETTO]['sitePage'] = $_SERVER['PHP_SELF']; // ...questo blocco serve a tenere in memoria la pagina selezionata fino a che si è in una section if ($_SESSION[PROGETTO]['idSection_site']!=$idSection || $idSection < 0) { $_SESSION[PROGETTO]['idSection_site'] = ($idSection > 0)? $idSection : $_SESSION[PROGETTO]['idSection_site']; $_SESSION[PROGETTO]['curPage_site'] = 1; $curPage = 1; } else { // operazioni all'interno di una section if($curPage < 0) { $curPage = $_SESSION[PROGETTO]['curPage_site']; } else { $_SESSION[PROGETTO]['curPage_site'] = $curPage; } } //********************************************* $curTemplateDir = dirname(__FILE__) . "/templates"; $t = new Template("$curTemplateDir"); $sectionMng = new SiteSectionMng() ; $sectionMng->setCurSectionID($idSection); $sectionMng->setCurOperation($op); $sectionMng->setPageList($pageList); //********************************************* // ..controllo della presenza delle info sulle sezioni e creazione blocco menù //if(!$_SESSION[PROGETTO]['sections_site']['stored']) //{ $sectionMng->getAndStoreSections($_SESSION[PROGETTO]['s_idLang_site']); $_SESSION[PROGETTO]['firstIdSezione'] = $sectionMng->firstIdSezione; //if(MULTILANG == true && !$_SESSION[PROGETTO]['lingue']) if($_SESSION[PROGETTO]['settings']['multilingua'] == "true" && !$_SESSION[PROGETTO]['lingue']) { $sectionMng->loadAndStoreLingue(); } //} if($idSection < 0 or !$_SESSION[PROGETTO]['sections_site'][$idSection]) { $idSection = $_SESSION[PROGETTO]['firstIdSezione']; } // .. creazione del Blocco Menù if(SHOW_MENU == true) { createMenuBlock(); } // .. creazione del Blocco lingue if($_SESSION[PROGETTO]['settings']['multilingua'] == "true") { createLingueBlock(); } $idRif = ($sub_p != -1) ? $sub_p : $idSection; // ..impostazione dei filtri if($filterBy > 0) { $filter = array('id_elenco' => $id_elenco, 'filterBy' => $filterBy); } if(FLASH_SITE != true) { //*** SITO HTML **** // .. creazione del blocco del corpo sezione $templateData = $sectionMng->getTemplateData($idSection, $idRif, $id, $_SESSION[PROGETTO]['s_idLang_site'], $filter); // ..definizione del tmp da utilizzare $curTmp = $_SESSION[PROGETTO]['sections_site'][$idRif]['tmp_file']; //print_r($templateData); if($curTmp != "") { // correzioni al tmp if($id != -1) { $split = split("\.", $curTmp); $curTmp = $split[0] ."_e.". $split[1]; } if($filterBy > 0 & $id < 0) { $split = split("\.", $curTmp); $curTmp = $split[0] ."_f.". $split[1]; } } else { $curTmp = "empty.tmp"; } createTmpBlocksAndVars($templateData['data']); } // aggiunte al framework $crediti = ($p_idLang == 1)? "Crediti" : "Credits"; $genesi = ($p_idLang == 1)? "Genesi" : "Genesys project"; $notelegali = ($p_idLang == 1)? "Note legali" : "Legal Notices"; // Settaggio delle variabili del template $t->assign_vars ( array ( 'link_home' => $thisPage."?p=7", 'assetPath' => "asset/", 'PAGE_name' => HTML_PAGE_NAME, 'p' => $idSection, 'sub_p' => $sub_p, 'id' => $id, 'SERVICES_URL' => SERVICES_URL, 'lang' => $lang, 'idSel' => $idSel, 'idLang' => $_SESSION[PROGETTO]['s_idLang_site'], 'curPage' => $curTmp, 'thisPage' => $thisPage, 'var1' => $p_var1, 'var2' => $p_var2, 'var3' => $p_var3, 'crediti' => $crediti, 'genesi' => $genesi, 'notelegali' => $notelegali ) ); // Settaggio delle variabili del CSS while ($item = each($_SESSION[PROGETTO]['CSS_VARS'])) { $varName = $item[0]; $varValue = $item[1]; ${$varName} = $varValue; //echo "
".$item[0].": ".$item[1]. " > ".$CSS_bodyColor; } //..variabili comuni $arrTempls = array ( 'TMP_START_HTML' => "startHtml.tmp", 'TMP_footer' => "footer.tmp", 'TMP_sezBody_init' => "sezBody_init.tmp", 'TMP_sezBody_end' => "sezBody_end.tmp" ); if(FLASH_SITE) { $arrTempls['TMP_toRender'] = "indexPageFlash.tmp"; $arrTempls['TMP_flashSite'] ="flashSite.tmp"; } else { $arrTempls['TMP_toRender'] = "indexPage.tmp"; $arrTempls['TMP_header'] = "header.tmp"; $arrTempls['TMP_sub_menu'] = "sub_menu.tmp"; $arrTempls['TMP_cur_page'] = $curTmp; if(SHOW_SWF_HEADER) { $arrTempls['TMP_swf_header'] = $swfHeaderFile; } if(SHOW_MENU) { $arrTempls['TMP_menu_up'] = "menu_up.tmp"; } } $t->set_filenames ( $arrTempls ); $t->assign_var_from_handle('INC_START_HTML', 'TMP_START_HTML'); $t->assign_var_from_handle('INC_footer', 'TMP_footer'); $t->assign_var_from_handle('INC_sezBody_init', 'TMP_sezBody_init'); $t->assign_var_from_handle('INC_sezBody_end', 'TMP_sezBody_end'); if(FLASH_SITE) { // SITO IN FLASH $t->assign_var_from_handle('INC_flashSite', 'TMP_flashSite'); } else { // SITO IN HTML $t->assign_var_from_handle('INC_curPage', 'TMP_cur_page'); $t->assign_var_from_handle('INC_header', 'TMP_header'); $t->assign_var_from_handle('INC_SUB_MENU', 'TMP_sub_menu'); if(SHOW_SWF_HEADER) { $t->assign_var_from_handle('INC_swf_header', 'TMP_swf_header'); } if(SHOW_MENU) { $t->assign_var_from_handle('INC_menu_up', 'TMP_menu_up'); } } $t->pparse("TMP_toRender"); function createMenuBlock() { global $t; global $idSection; global $thisPage; $tree = $_SESSION[PROGETTO]['sections_site'][$idSection]['tree']; $arrTree = split("-", $tree); $numRows = 0; $primo = true; while(($primo == true) || ($idToScan > 0)) { $idRif = ($primo == true) ? 3 : $idToScan; $rifArr = array(); $rifArr = getSectionsByIdParent($idRif); $backUrl = "$thisPage?p=" . $arrTree[$numRows-1]; $idToScan = null; $primo = null; for($m=0; $m < count($rifArr); $m++) { if($_SESSION[PROGETTO]['sections_site'][$rifArr[$m]['id']]['render_menu'] >0) { $t->assign_block_vars ( "MENU_ROWS", array( 'id' =>$numRows ) ); $url = "$thisPage?p=" . $rifArr[$m]['id']; $blockName = ($rifArr[$m]['id'] == $idSection) ? "SELECTED" :"NOT_SELECTED"; $t->assign_block_vars ( "MENU_ROWS.$blockName", array( 'label' => $rifArr[$m]['nome'], 'url' => $url ) ); } } $numRows++; } } function createLingueBlock() { global $t; global $idSection; global $p_idLang; for($n =0; $n < count($_SESSION[PROGETTO]['lingue']); $n++) { $t->assign_block_vars ( "LINGUE",array(""=>"") ); $url = "$thisPage?p=$idSection&idLang=" . $_SESSION[PROGETTO]['lingue'][$n]['id']; $blockName = ($_SESSION[PROGETTO]['lingue'][$n]['id'] == $p_idLang) ? "SELECTED" :"NOT_SELECTED"; $t->assign_block_vars ( "LINGUE.$blockName", array( 'label' => $_SESSION[PROGETTO]['lingue'][$n]['lingua'], 'url' => $url ) ); } } function getSectionsByIdParent($p_idParent) { $returnArr = array(); $rifArr = array(); $rifArr = $_SESSION[PROGETTO]['sections_site']; while($sect = each($rifArr)) { $id = $sect[0]; $section = $sect[1]; $idParent = $section['id_parent']; $nome = $section['nome']; if(strval($idParent) == strval($p_idParent)) { array_push($returnArr, $section); } } return $returnArr; } function createTmpBlocksAndVars($p_data) { global $id; global $t; global $idSection; global $sub_p; global $filter; if(is_array($p_data)) { while($item = each($p_data)) { $nameItem = $item[0]; $valueItem = $item[1]; switch($valueItem['type']) { case "vars": $t->assign_vars ( $valueItem['data'] ); break; case "block": for($n =0; $n < count($valueItem['data']); $n++) { $t->assign_block_vars ( $nameItem, $valueItem['data'][$n] ); scanField($valueItem['data'][$n], $nameItem); } break; case "istanze": for($n =0; $n < count($valueItem['data']); $n++) { $nomeIstanza = $valueItem['data'][$n]['nome']; $valoreIstanza = $valueItem['data'][$n]['valore']; if(is_array($valoreIstanza)) { //..caso delle istanza con un valore multiplo (allegato, gallery) for($i =0; $i < count($valoreIstanza); $i++) { $t->assign_block_vars ( $nomeIstanza, $valoreIstanza[$i] ); } } else { //..caso delle istanza con un valore solo (s_text, l_text, image) $t->assign_vars ( array ( $nomeIstanza =>$valoreIstanza ) ); } } break; case "lista": $elemArr = array(); for($n =0; $n < count($valueItem['data']); $n++) { $istanceArr = array(); for($e = 0; $e < count($valueItem['data'][$n]); $e++) { $nomeIstanza = $valueItem['data'][$n][$e]['nome']; $valoreIstanza = $valueItem['data'][$n][$e]['valore']; $elemArr[$nomeIstanza] = $valoreIstanza; if(is_array($valoreIstanza)) { array_push($istanceArr, array( "nome" =>$nomeIstanza, "valore" =>$valoreIstanza)); } } $t->assign_block_vars ( $nameItem, $elemArr ); for($f = 0; $f < count($istanceArr); $f++) { $nomeIst = $istanceArr[$f]['nome']; $valIst = $istanceArr[$f]['valore']; for($fn = 0; $fn < count($valIst); $fn++) { $t->assign_block_vars ( "$nameItem.$nomeIst", $valIst[$fn] ); } } } break; case "sub_menu": $rifArr = $valueItem['data']; for($m=0; $m < count($rifArr); $m++) { $t->assign_block_vars ( "SUB_MENU", array( 'id' =>$numRows ) ); $url = "$thisPage?p=".$idSection."&sub_p=" . $rifArr[$m]['id']; $blockName = ($rifArr[$m]['id'] == $sub_p) ? "SELECTED" :"NOT_SELECTED"; $t->assign_block_vars ( "SUB_MENU.$blockName", array( 'label' => $rifArr[$m]['nome'], 'separa' => $rifArr[$m]['separa'], 'url' => $url ) ); } break; case "elenco": $rifArr = $valueItem['data']; for($m=0; $m < count($rifArr); $m++) { $t->assign_block_vars ( "elenco_".$rifArr[$m]['n_elenco'], array( 'id' =>$numRows ) ); $url = "$thisPage?p=".$idSection."&filterBy=" . $rifArr[$m]['id_item']; $url_direct = "$thisPage?p=".$idSection."&filterBy=" . $rifArr[$m]['id_item']."&id=".$rifArr[$m]['firstId']; $blockName = ($rifArr[$m]['id_item'] == $filter['filterBy']) ? "SELECTED" :"NOT_SELECTED"; $t->assign_block_vars ( "elenco_".$rifArr[$m]['n_elenco'].".$blockName", array( 'label' => $rifArr[$m]['nome'], 'url' => $url, 'url_firstItem' => $url_direct ) ); } break; } } } } function scanField($p_fieldRif, $nameItem) { global $t; if(is_array($p_fieldRif)) { while($item2 = each($p_fieldRif)) { $key2 = $item2[0]; $value2 = $item2[1]; if(is_array($value2)) { //for($m = 0 ;$massign_block_vars ( $nameItem.".$key2", array( "valore" => $value3) ); } } } } } ?>