set_no_cache(); // Turning caching off - good while developing. $this->conf = $conf; $this->PSingle = intval($this->conf["PidSingle"]); $this->PMap = intval($this->conf["PidMap"]); $this->PSearch = intval($this->conf["PidSearch"]); $this->Lval = intval($this->conf["AltLangID"]); //this select the alternative language //$this->altlang=false; $this->L = t3lib_div::GPvar("L"); if (!isset($this->L)) { $this->L=0; $this->altlang=false; }else { if ($this->L == $this->Lval){ $this->altlang=true; }else{ $this->altlang=false; } }//end if select the alternative language $categories=array(); $catComplete=array(); $localities=array(); $locComplete=array(); $this->initCategories(); $this->initLocalities(); $this->tx_travelguide_pi1 = t3lib_div::GPvar("tx_travelguide_pi1"); $this->local_cObj = t3lib_div::makeInstance("tslib_cObj"); // Local cObj. switch((string)$this->tx_travelguide_pi1["CMD"]) { case "singleView": $this->internal["currentTable"] = "tx_travelguide_main"; $this->internal["currentRow"] = $this->pi_getRecord("tx_travelguide_main",intval($this->tx_travelguide_pi1["uid"])); return $this->pi_wrapInBaseClass($this->singleView($content,$conf)); break; case "mapView": $this->internal["currentTable"] = "tx_travelguide_main"; $this->internal["currentRow"] = $this->pi_getRecord("tx_travelguide_main",intval($this->tx_travelguide_pi1["uid"])); return $this->pi_wrapInBaseClass($this->mapView($content,$conf)); break; default: if (strstr($this->cObj->currentRecord,"tt_content")) { $conf["pidList"] = $this->cObj->data["pages"]; $conf["recursive"] = $this->cObj->data["recursive"]; } return $this->pi_wrapInBaseClass($this->listView($content,$conf)); break; } } /** * from tt_news by Kasper Sk�rh�j */ function initCategories() { // Fetching catagories: $query = "select * from tx_travelguide_cat where 1=1 AND NOT tx_travelguide_cat.deleted AND NOT tx_travelguide_cat.hidden".$this->cObj->enableFields("tx_travelguide_cat"); $res = mysql(TYPO3_db,$query); echo mysql_error(); $this->categories=array(); $this->catComplete=array(); while($row = mysql_fetch_assoc($res)) { // if serve per togliere il 4 stelle //&& $row["titlealt"]!='' if ($this->altlang ) { (eregi('hotel', $row["titlealt"])) ? $this->categories[$row["uid"]] = "Hotel" : $this->categories[$row["uid"]] = $row["titlealt"]; $this->catComplete[$row["uid"]] = $row["titlealt"]; }else{ (eregi('hotel', $row["title"])) ? $this->categories[$row["uid"]] = "Hotel" : $this->categories[$row["uid"]] = $row["title"]; $this->catComplete[$row["uid"]] = $row["title"]; }//end if }//end while }//end function /** * from tt_news by Kasper Sk�rh�j */ function initLocalities() { // Fetching catagories: $query = "select * from tx_travelguide_place where 1=1 AND NOT tx_travelguide_place.deleted".$this->cObj->enableFields("tx_travelguide_place"); $res = mysql(TYPO3_db,$query); echo mysql_error(); $this->localities=array(); $this->locComplete=array(); while($row = mysql_fetch_assoc($res)) { $this->localities[$row["uid"]] = $row["cap"].' - '.$row["placename"]; $this->locComplete[$row["uid"]] = $row["placename"]; } } /** * [Put your description here] */ function listView($content,$conf) { $this->conf=$conf; // Setting the TypoScript passed to this function in $this->conf $this->pi_setPiVarDefaults(); $this->pi_loadLL(); // Loading the LOCAL_LANG values $lConf = $this->conf["listView."]; // Local settings for the listView function /* $this->piVars["showUid"] = $this->travel_guide_uid; if (!$this->piVars["showUid"]) {$this->piVars["showUid"] = $this->travel_guide_map_uid;} if ($this->piVars["showUid"]) { // If a single element should be displayed: $this->internal["currentTable"] = "tx_travelguide_main"; $this->internal["currentRow"] = $this->pi_getRecord("tx_travelguide_main",$this->piVars["showUid"]); if ($this->travel_guide_uid) {$content = $this->singleView($content,$conf);} if ($this->travel_guide_map_uid) {$content = $this->mapView($content,$conf);} return $content; } else { */ $items=array( "1"=> $this->pi_getLL("list_mode_1","Mode 1"), "2"=> $this->pi_getLL("list_mode_2","Mode 2"), "3"=> $this->pi_getLL("list_mode_3","Mode 3"), ); if (!isset($this->piVars["pointer"])) $this->piVars["pointer"]=0; if (!isset($this->piVars["mode"])) $this->piVars["mode"]=1; // Initializing the query parameters: list($this->internal["orderBy"],$this->internal["descFlag"]) = explode(":",$this->piVars["sort"]); $this->internal["results_at_a_time"]=t3lib_div::intInRange($lConf["results_at_a_time"],0,1000,3); // Number of results to show in a listing. $this->internal["maxPages"]=t3lib_div::intInRange($lConf["maxPages"],0,1000,2);; // The maximum number of "pages" in the browse-box: "Page 1", "Page 2", etc. //$this->internal["searchFieldList"]="name,address,tel,fax,email,site,par1,par2,par3,par4,par5"; //$this->internal["orderByList"]="uid,name,tel,fax,email,site"; $this->internal["searchFieldList"]="name,par1,par2,par3,par4,par5"; if ($this->piVars["mode"]==1) $this->internal["orderByList"]="cat, name"; if ($this->piVars["mode"]==2) $this->internal["orderByList"]="name"; if ($this->piVars["mode"]==3) $this->internal["orderByList"]="place, name"; $this->internal["orderByList"]= 'ORDER BY '.$this->internal["orderByList"]; // Get number of records: (($this->piVars['sword']!='') OR (intval($this->piVars['scat'])>0) OR (intval($this->piVars['sloc'])>0)) ? $query = $this->tg_makesearchquery($this->piVars['sword'],$this->piVars['scat'],$this->piVars['sloc'],1) : $query = $this->pi_list_query("tx_travelguide_main",1); //$query = $this->pi_list_query("tx_travelguide_main",1); $res = mysql(TYPO3_db,$query); if (mysql_error()) debug(array(mysql_error(),$query)); list($this->internal["res_count"]) = mysql_fetch_row($res); // Make listing query, pass query to MySQL: //pi_list_query($table,$count=0,$addWhere='',$mm_cat='',$groupBy='',$orderBy='',$query='') //$query.= " ORDER BY ".$this->internal["orderByList"]; if (($this->piVars['sword']!='') OR (intval($this->piVars['scat'])>0) OR (intval($this->piVars['sloc'])>0)) { $start_at = $this->piVars["pointer"] * $this->internal["results_at_a_time"]; $limit= ' LIMIT '.$start_at.', '.$this->internal["results_at_a_time"]; $query = $this->tg_makesearchquery($this->piVars['sword'],$this->piVars['scat'],$this->piVars['sloc'],0,$this->internal["orderByList"].$limit); }else{ $query = $this->pi_list_query("tx_travelguide_main",'','','','',$this->internal["orderByList"],''); } //echo $query = $this->pi_list_query("tx_travelguide_main"); //echo $query = "SELECT tx_travelguide_main.* FROM tx_travelguide_main WHERE pid IN (16) AND NOT tx_travelguide_main.deleted AND NOT tx_travelguide_main.hidden ORDER BY name LIMIT 0,15"; $res = mysql(TYPO3_db,$query); if (mysql_error()) debug(array(mysql_error(),$query)); $this->internal["currentTable"] = "tx_travelguide_main"; //echo ''.$query.''; // Put the whole list together: $fullTable=""; // Clear var; //$fullTable.=t3lib_div::view_array($this->piVars); // DEBUG: Output the content of $this->piVars for debug purposes. REMEMBER to comment out the IP-lock in the debug() function in t3lib/config_default.php if nothing happens when you un-comment this line! //$fullTable.=t3lib_div::view_array($this->conf); // DEBUG: Output the content of $this->piVars for debug purposes. REMEMBER to comment out the IP-lock in the debug() function in t3lib/config_default.php if nothing happens when you un-comment this line! // Adds the search box: //$fullTable.= ($this->piVars['sword']!='') ? 'parola_on' : 'parola_off'; $fullTable.=$this->tg_searchBox('',$this->PSearch); $fullTable.='
![]() | |
![]() | |
![]() |
'. $this->pi_getLL("list_orderby","Order by :") .' | '. $this->pi_list_modeSelector($items,' cellspacing=2 cellpadding=2') .' |
![]() | |
![]() | |
![]() |
'.$link_name_singleView.' pi_classParam("listrowField-address").'>'.$this->getFieldContent("address").' pi_classParam("listrowField-place").'>'.$this->localities[$this->getFieldContent("place")].' pi_classParam("listrowField-tel").'>'.$this->getFieldHeader("tel").': '.$this->getFieldContent("tel").' - pi_classParam("listrowField-fax").'>'.$this->getFieldHeader("fax").': '.$this->getFieldContent("fax").' pi_classParam("listrowField-desc").'>'.$link_singleView.' - pi_classParam("listrowField-reachus").'>'.$str_maps.' '.$str_email.''.$str_site.' |
'.$link_logo_singleView.' |
![]() | |
![]() | |
![]() |
pi_classParam("singleViewField-par1").'>'.$par1.' | |
![]() | |
pi_classParam("singleViewField-par2").'>'.$par2.' | |
![]() | |
pi_classParam("singleViewField-par3").'>'.$par3.' | |
![]() | |
pi_classParam("singleViewField-par4").'>'.$par4.' |
'.$this->pi_list_linkSingle($this->pi_getLL("back","Back"),$this->getFieldContent("pid"),0).'
'. return $content; } /** * David modded */ function mapView($content,$conf) { $this->conf=$conf; $this->pi_setPiVarDefaults(); $this->pi_loadLL(); // this is for a statistic of visits $inc_query = 'UPDATE tx_travelguide_main SET map_clicks = map_clicks+1 WHERE uid='.$this->internal["currentRow"]["uid"]; mysql_query($inc_query); $this->initCategories(); $this->initLocalities(); $imgMaxWidth = '350'; $imgsrc= 'uploads/tx_travelguide/'.$this->getFieldContent("map"); $altinfo = $this->getFieldContent("mapalttext"); ($altinfo != '')? $altinfo .= ', ' : $altinfo .= ''; $altinfo .= $this->categories[$this->getFieldContent("cat")].' '.$this->getFieldContent("name"); $map_str = $this->renderImage($imgsrc,$imgMaxWidth,$altinfo); $content=$this->makeListItem(); // This sets the title of the page for use in indexed search results: if ($this->internal["currentRow"]["title"]) $GLOBALS["TSFE"]->indexedDocTitle=$this->internal["currentRow"]["title"]; if ($this->altlang) { $par5 = $this->getFieldContent("par5alt"); }else{ $par5 = $this->getFieldContent("par5"); } $content.='pi_classParam("mapViewField-map").'>'.$map_str.'
pi_classParam("mapViewField-par5").'>'.$par5.'