Zum Inhalt springen

sp_directory abändern

Erstellt am 8. September 2008 · 8 Antworten · letzte Antwort am 11. September 2008

Tags: Frage

mike_sebaro ·

Hallo

ich habe sp_directory im Einsatz.
Beim Suchformular, wird ja die Möglcihkeit der suche nach PLZ angeboten.
Ich würde das gerne soweit abändern, dass die dropdownbox nicht mit den PLZ sondern mit den Telefonnummern generiert wirde.

Habe hier folgende Zeile gefunden:

$markerArray["###DROPDOWN###"] = $this->makeDropDownList($id,$row[pid],$row[zip]);

Die glaube ich dafür zuständig ist, allerdings ändert sich da bei mir gar nichts :-(

Hiermal die datei:

<?php
/***************************************************************
*  Copyright notice
*  
*  (c) 2004 Carsten Horst (carsten@sprog.de)
*  All rights reserved
*
*  This script is part of the Typo3 project. The Typo3 project is 
*  free software; you can redistribute it and/or modify
*  it under the terms of the GNU General Public License as published by
*  the Free Software Foundation; either version 2 of the License, or
*  (at your option) any later version.
* 
*  The GNU General Public License can be found at
*  http://www.gnu.org/copyleft/gpl.html.
* 
*  This script is distributed in the hope that it will be useful,
*  but WITHOUT ANY WARRANTY; without even the implied warranty of
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*  GNU General Public License for more details.
*
*  This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/** 
 * Plugin 'Address Directory' for the 'sp_directory' extension.
 *
 * @author	Carsten Horst <carsten@sprog.de>
 */


 
require_once(PATH_tslib."class.tslib_pibase.php");
require_once(PATH_t3lib."class.t3lib_basicfilefunc.php");

class tx_spdirectory_pi1 extends tslib_pibase {

	var $prefixId = "tx_spdirectory_pi1";		// Same as class name
	var $scriptRelPath = "pi1/class.tx_spdirectory_pi1.php";	// Path to this script relative to the extension dir.
	var $extKey = "sp_directory";	// The extension key.
	

	/**
	 * Doing the things...
	 */
	function main($content,$conf)	{
		$this->conf=$conf;
		$this->pi_setPiVarDefaults();
		$this->pi_loadLL();


#t3lib_div::debug(($GLOBALS["TYPO_VERSION"] >= '3.6.0'));
		//Default-Values
		$this->internal[currentTable] = tt_address;
		//delete sword
		$this->piVars[sword] = ($this->piVars[modifier]!=search) ? "" : $sword;

		// pid_list is the pid/list of pids from where to fetch the tt_address items.
		if (strstr($this->cObj->currentRecord,"tt_content")) {
			$this->conf["pidList"] = $this->cObj->data["pages"];
        	        $this->conf["recursive"] = $this->cObj->data["recursive"];
		}

		//prepare TypoLinks
		$this->typolink_conf = $this->conf["typolink."];
		$this->typolink_conf["useCacheHash"] = 1;		

		//Should fields be hidden?
		t3lib_div::inList($GLOBALS['TSFE']->fe_user->user['usergroup'],$this->conf["hidden_fields_fegroup"] || $this->conf["hidden_fields_fegroup"]="") ? $this->conf["hide_field"] = 0 : $this->conf["hide_field"] = 1; 
		$this->conf["hidden_fields"] = strtolower($this->conf["hidden_fields"]);
		
		//parese template
		$this->listTemplateCode = $this->cObj->fileResource($this->conf["templateFile"]);
		$this->top = $this->cObj->getSubpart($this->listTemplateCode, "###TOPVIEW###");
		$this->bottom = $this->cObj->getSubpart($this->listTemplateCode, "###BOTTOMVIEW###");
		$this->listIentry = $this->cObj->getSubpart($this->listTemplateCode, "###LISTIVIEW###");
		$this->listIIentry = $this->cObj->getSubpart($this->listTemplateCode, "###LISTIIVIEW###");
		$this->listIIIentry = $this->cObj->getSubpart($this->listTemplateCode, "###LISTIIIVIEW###");
		$this->searchElement = $this->cObj->getSubpart($this->listTemplateCode, "###SEARCHELEMENT###");
		$this->nono = $this->cObj->getSubpart($this->listTemplateCode, "###NOVIEW###");
		$this->detail = $this->cObj->getSubpart($this->listTemplateCode, "###SINGLEVIEW###");

		switch($this->piVars[mode])	{
			
			case "detail":		
				$content = $this->makeDetail($this->piVars[value]);
				$content .= $this->makeEditLink(edit,$this->piVars[value]);
			break;
			case "enter":
				$content = $this->makeForm(enter,$this->piVars[modifier]);
			break;
			case "edit":
				$content = $this->makeForm(edit,$this->piVars[modifier],$this->piVars[value]);
			break;
			default: //"list" 
				$displaybottom = true;
				$tmpcontent = $content;
				$content .= $this->makeTop();
				switch($this->piVars[modifier])	{
					case "zip":
						$content .= $this->makelist(zip,$this->piVars[value]);
					break;
					case "search":
						$this->piVars[sword] = $this->piVars[value]; 
						$content .= $this->makelist(search,$this->piVars[value]);					
					break;
					case "cat":
						$content .= $this->makelist(cat,$this->piVars[value]);
					break;
					default: //"abc"
						switch($this->piVars[value])	{
							case "":
							case "all":
                                                                switch($this->cObj->data["tx_spdirectory_mode"])        {
                                                                        case "0":
                                                                                $content .= $this->makelist(abc,all);
                                                                        break;
                                                                        case "1":
                                                                                $content .= $this->makelist(catorder,all);
                                                                        break;
                                                                        case "2":
                                                                                $content .= $this->makelist(ziporder,all);
                                                                        break;
                                                                        case "3":
                                                                                $content = $tmpcontent;
                                                                                $tmpcontent = "";
                                                                                $content .= $this->makeSearchelement();
                                                                                $displaybottom = false;
                                                                        break;
                                                                }
							break;
							default:
								$content .= $this->makelist(abc,$this->piVars[value],$this->piVars[pointer]);
							break;
						}
					break;
				}
				
				if ($displaybottom) {
					$content .= $this->makeBottom($this->piVars[modifier],$this->piVars[value]);
					$content .= $this->makeEditLink(enter);
				}
				
			break;		
			
		}
		
	return $this->pi_wrapInBaseClass($content);	
	}

	/**
         * Create the edit Link, when an authorized User is logged in
         */
	function makeEditLink($action,$id="")	{

		switch($action)	{
		
			case "enter":
				$content = ($GLOBALS['TSFE']->fe_user->user['usergroup'] && $this->conf["default_fegroup"]) ? '<table cellpadding="7" cellspacing="0" border="0" width="100%"><tr><td align="right">'.$this->makeLink($this->pi_getLL("new_entry"),enter,"","","0").'</td></tr></table>' : "";
			break;
			case "edit":
				$content = ($this->checkAccess($id)) ? '<table cellpadding="7" cellspacing="0" border="0" width="100%"><tr><td align="right">'.$this->makeLink($this->pi_getLL("edit_entry"),edit,"first",$id,"0").'</td></tr></table>' : "";
			break;
		}
	return $content;
	}

	/**
         * Make the detail page
         */
	function makeDetail($id)	{

		$pidList = $this->pi_getPidList($this->conf["pidList"],$this->conf["recursive"]);
		$query = "SELECT * FROM tt_address WHERE pid IN (".$pidList.")"." ".$this->cObj->enableFields(tt_address)." AND uid = ".$id;
		$res = mysql(TYPO3_db,$query);
		$row = mysql_fetch_assoc($res);
			
		$markerArray["###NAME###"] = $this->cObj->stdWrap(htmlentities($row[name]),$this->conf["DetailName."]);
		$markerArray["###DESCRIPTION###"] = ($this->conf["hide_field"] && t3lib_div::inList($this->conf["hidden_fields"],"description")) ? "" : $this->cObj->stdWrap(nl2br(htmlentities($row[description])),$this->conf["DetailDescr."]);
		$markerArray["###STREET###"] = ($this->conf["hide_field"] && t3lib_div::inList($this->conf["hidden_fields"],"street")) ? "" : $this->cObj->stdWrap(nl2br(htmlentities($row[address])),$this->conf["DetailStreet."]);
		$markerArray["###ZIP###"] = ($this->conf["hide_field"] && t3lib_div::inList($this->conf["hidden_fields"],"zip")) ? "" : $this->cObj->stdWrap(htmlentities($row[zip]),$this->conf["DetailZip."]);
		$markerArray["###CITY###"] = ($this->conf["hide_field"] && t3lib_div::inList($this->conf["hidden_fields"],"city")) ? "" : $this->cObj->stdWrap(htmlentities($row[city]),$this->conf["DetailCity."]);
		$markerArray["###PHONE###"] = ($this->conf["hide_field"] && t3lib_div::inList($this->conf["hidden_fields"],"phone")) ? "" : (($row[phone]) ? $this->cObj->stdWrap($this->pi_getLL("phone").": ".$row[phone],$this->conf["DetailPhone."]) : "");
		$markerArray["###MOBILE###"] = ($this->conf["hide_field"] && t3lib_div::inList($this->conf["hidden_fields"],"mobile")) ? "" : (($row[mobile]) ? $this->cObj->stdWrap($this->pi_getLL("mobile").": ".$row[mobile],$this->conf["DetailMobile."]) : "");
		$markerArray["###FAX###"] = ($this->conf["hide_field"] && t3lib_div::inList($this->conf["hidden_fields"],"fax")) ? "" : (($row[fax]) ? $this->cObj->stdWrap($this->pi_getLL("fax").": ".$row[fax],$this->conf["DetailFax."]) : "");
		$markerArray["###WWW###"] = ($this->conf["hide_field"] && t3lib_div::inList($this->conf["hidden_fields"],"www")) ? "" : (($row[www]) ? $this->makeHTTPLink($row[www],$this->pi_getLL("www")) : '<font color="'.$this->conf[inactive].'">WWW</font>');
		$markerArray["###EMAIL###"] = ($this->conf["hide_field"] && t3lib_div::inList($this->conf["hidden_fields"],"email")) ? "" : (($row[email]) ? $this->makeMailtoLink($row[email]) : '<font color="'.$this->conf[inactive].'">E-Mail</font>');
		$markerArray["###DROPDOWN###"] = $this->makeDropDownList($id,$row[pid],$row[zip]);			
		//insert picture
		$markerArray["###IMAGE###"] = ($this->conf["hide_field"] && t3lib_div::inList($this->conf["hidden_fields"],"image")) ? "" : (($row[image]) ? $this->getImage($row[image],$this->conf) : "");
		$over[detail]="";
		$markerArray["###BACK###"] = '<a href="javascript:history.back(1)">'.$this->pi_getLL("back").'</a>';
		$content= $this->cObj->substituteMarkerArrayCached($this->detail,$markerArray,array(),array());	

	return $content;
	}
	
	
	function makeTop()	{
	
		$markerArray["###ATOZ###"] = $this->makeABC('tt_address','name',$this->piVars[value]);
		$markerArray["###CATEGORY###"] = $this->makeJumper($this->piVars[modifier],$this->piVars[value]); 
		$markerArray["###ZIP###"] = $this->makeZIP($this->piVars[modifier],$this->piVars[value]); 
		$markerArray["###SEARCH###"] = $this->makeSearchbox($this->piVars[value]);
		$content = $this->cObj->substituteMarkerArrayCached($this->top,$markerArray,array(),array());
		
	return $content;
	}

	function makeSearchelement()	{

                $markerArray["###CATEGORY###"] = $this->makeJumper($this->piVars[modifier],$this->piVars[value]);
                $markerArray["###ZIP###"] = $this->makeZIP($this->piVars[modifier],$this->piVars[value]);
                $markerArray["###SEARCH###"] = $this->makeSearchbox($this->piVars[value]);
                $content = $this->cObj->substituteMarkerArrayCached($this->searchElement,$markerArray,array(),array());

        return $content;
        }

	function makeDropDownList($id,$pid,$zip) {

		$pidList = $this->pi_getPidList($this->conf["pidList"],$this->conf["recursive"]);
		if ($this->conf["displayDropDownAll"]) {
			$query = "SELECT name,uid FROM tt_address WHERE pid IN (".$pidList.")"." ".$this->cObj->enableFields(tt_address)." ORDER BY NAME";
		} else {
			$pidList = ($this->cObj->data["tx_spdirectory_dspfolder"]) ? $pid : $pidList;
			switch($this->cObj->data["tx_spdirectory_mode"])        {
				case "0":
					$query = "SELECT name,uid FROM tt_address WHERE pid IN (".$pidList.")"." ".$this->cObj->enableFields(tt_address)." ORDER BY NAME";
				break;
                        	case "1":
					$q = "SELECT uid_foreign FROM tx_spdirectory_cat_mm WHERE uid_local='".$id."'";
                                        $r = $res = mysql(TYPO3_db,$q);
                                        while ($ro = mysql_fetch_assoc($r)) {
                                                $cat[] = $ro[uid_foreign];
                                        }
                                        $catList = implode(',', $cat);
					$query = "SELECT DISTINCT tt_address.name,tt_address.uid FROM tt_address,tx_spdirectory_cat_mm WHERE tt_address.uid=tx_spdirectory_cat_mm.uid_local AND tx_spdirectory_cat_mm.uid_foreign IN (".$catList.") AND tt_address.pid IN (".$pidList.")"." ".$this->cObj->enableFields(tt_address)." ORDER BY NAME";
				break;
                	        case "2":
					$query = "SELECT name,uid,zip FROM tt_address WHERE pid IN (".$pidList.")"." ".$this->cObj->enableFields(tt_address)." AND zip='".$zip."' ORDER BY NAME";
				break;
			}
		}
		$res = mysql(TYPO3_db,$query);
		
		$content = "
		<script language=\"JavaScript\" type=\"text/JavaScript\">
                <!--
                function MM_jumpMenu(targ,selObj,restore){
	                eval(targ+\".location='\"+selObj.options[selObj.selectedIndex].value+\"'\");
        	        if (restore) selObj.selectedIndex=0;
                }
                //-->
                </script>";

		$content .= '<select name="menu2" size=1 onchange="MM_jumpMenu(\'self\',this,0)" class="tx_spdirectory-pi1-small">';
		while($row = mysql_fetch_assoc($res)) {
			$content .= '<option value="'.$this->makeLink("",detail,"",$row[uid],$cache=1,$pointer=0).'"';
			$content .= ($id == $row[uid]) ? ' selected style="color: '.$this->conf[active].';">' : '>';
			$content .= htmlentities($row[name]).'</option>';
		}
		$content .= '</select>';

	return $content;
	}
	
	function makelist($modifier,$value)	{

		$query = $this->makeListQuery($modifier,$value);
		$res=mysql(TYPO3_db,$query);
		$lastsys = "";
		$splitMark = md5(microtime());

		switch($modifier)	{

                        case "catorder":
                                $lastcat = "";
                                while($row = mysql_fetch_assoc($res))   {

					if (($lastsys == $row[title]) || !$this->cObj->data["tx_spdirectory_dspfolder"]) {
						$markerArray["###SYSFOLDER###"] = "";
						$markerArray["###W1B###"] = "";
						$markerArray["###W1E###"] = "";
					} else {
						list($markerArray["###W1B###"],$markerArray["###W1E###"]) = explode($splitMark,$this->cObj->stdWrap($splitMark,$this->conf["wrap1."]));
						$markerArray["###SYSFOLDER###"] = htmlentities($row[title]);
						$lastsys = $row[title];
						$lastcat = "";
					}
                                        if ($lastcat == $row[catname]) {
                                                $markerArray["###CATEGORY###"] = "";
						$markerArray["###W2B###"] = "";
                                                $markerArray["###W2E###"] = "";
                                        } else {
						list($markerArray["###W2B###"],$markerArray["###W2E###"]) = explode($splitMark,$this->cObj->stdWrap($splitMark,$this->conf["wrap2."]));
                                                $markerArray["###CATEGORY###"] = htmlentities($row[catname]);
                                                $lastcat = $row[catname];
                                        }
					$over[detail]=$row[uid];
					$markerArray["###NAME###"] = $this->cObj->stdWrap(($this->conf["displayNameLink"]) ? $this->makeLink(htmlentities($row[name]),detail,$modifier,$row[uid],1,$pointer) : htmlentities($row[name]),$this->conf["ListName."]);
                                        $markerArray["###STREET###"] = ($this->conf["hide_field"] && t3lib_div::inList($this->conf["hidden_fields"],strtolower("street"))) ? "" : $this->cObj->stdWrap(htmlentities($row[address]),$this->conf["ListStreet."]);
                                        $markerArray["###ZIP###"] = ($this->conf["hide_field"] && t3lib_div::inList($this->conf["hidden_fields"],"zip")) ? "" : $this->cObj->stdWrap(htmlentities($row[zip]),$this->conf["ListZip."]);
                                        $markerArray["###CITY###"] = ($this->conf["hide_field"] && t3lib_div::inList($this->conf["hidden_fields"],"city")) ? "" : $this->cObj->stdWrap(htmlentities($row[city]),$this->conf["ListCity."]);
                                        $markerArray["###PHONE###"] = ($this->conf["hide_field"] && t3lib_div::inList($this->conf["hidden_fields"],"phone")) ? "" : (($row[phone]) ? $this->cObj->stdWrap($this->pi_getLL("phone").": ".$row[phone],$this->conf["ListPhone."]) : "");
                                        $markerArray["###MOBILE###"] = ($this->conf["hide_field"] && t3lib_div::inList($this->conf["hidden_fields"],"mobile")) ? "" : (($row[mobile]) ? $this->cObj->stdWrap($this->pi_getLL("mobile").": ".$row[mobile],$this->conf["ListMobile."]) : "");
                                        $markerArray["###FAX###"] = ($this->conf["hide_field"] && t3lib_div::inList($this->conf["hidden_fields"],"fax")) ? "" : (($row[fax]) ? $this->cObj->stdWrap($this->pi_getLL("fax").": ".$row[fax],$this->conf["ListFax."]) : "");
					$markerArray["###WWW###"] = ($this->conf["hide_field"] && t3lib_div::inList($this->conf["hidden_fields"],"www")) ? "" : (($row[www]) ? $this->makeHTTPLink($row[www],$this->pi_getLL("www")) : '<font color="'.$this->conf[inactive].'">WWW</font>');
                                        $markerArray["###EMAIL###"] = ($this->conf["hide_field"] && t3lib_div::inList($this->conf["hidden_fields"],"email")) ? "" : (($row[email]) ? $this->makeMailtoLink($row[email]) : '<font color="'.$this->conf[inactive].'">E-Mail</font>');
                                        $markerArray["###IMAGE###"] = ($this->conf["hide_field"] && t3lib_div::inList($this->conf["hidden_fields"],"image")) ? "" : (($row[image]) ? $this->getImage($row[image],$this->conf) : "");
                                        $markerArray["###DETAILS###"] = $this->makeLink($this->pi_getLL("details"),detail,$modifier,$row[uid],1,$pointer);
                                        $wieviele=1;
                                        $content .= $this->cObj->substituteMarkerArrayCached($this->listIIentry,$markerArray,array(),array());
                                }
                        break;


			case "ziporder":
				$lastzip = "";
				while($row = mysql_fetch_assoc($res))   {
					if (($lastsys == $row[title]) || !$this->cObj->data["tx_spdirectory_dspfolder"]) {
                                                $markerArray["###SYSFOLDER###"] = "";
						$markerArray["###W1B###"] = "";
                                                $markerArray["###W1E###"] = "";
                                        } else {
						list($markerArray["###W1B###"],$markerArray["###W1E###"]) = explode($splitMark,$this->cObj->stdWrap($splitMark,$this->conf["wrap1."]));
                                                $markerArray["###SYSFOLDER###"] = htmlentities($row[title]);
                                                $lastsys = $row[title];
						$lastzip = "";
                                        }
					if ($lastzip == $row[zip]) {
						$markerArray["###ZIPCAT###"] = "";
						$markerArray["###CITYCAT###"] = "";
						$markerArray["###W3B###"] = "";
                                                $markerArray["###W3E###"] = "";
					} else {
						list($markerArray["###W3B###"],$markerArray["###W3E###"]) = explode($splitMark,$this->cObj->stdWrap($splitMark,$this->conf["wrap3."]));
						$markerArray["###ZIPCAT###"] = htmlentities($row[zip]);
						$markerArray["###CITYCAT###"] = htmlentities($row[city]);
						$lastzip = $row[zip];
					}
$over[detail]=$row[uid];
                                        $markerArray["###NAME###"] = $this->cObj->stdWrap(($this->conf["displayNameLink"]) ? $this->makeLink(htmlentities($row[name]),detail,$modifier,$row[uid],1,$pointer) : htmlentities($row[name]),$this->conf["ListName."]);
                                        $markerArray["###STREET###"] = ($this->conf["hide_field"] && t3lib_div::inList($this->conf["hidden_fields"],"street")) ? "" : $this->cObj->stdWrap(htmlentities($row[address]),$this->conf["ListStreet."]);
                                        $markerArray["###ZIP###"] = ($this->conf["hide_field"] && t3lib_div::inList($this->conf["hidden_fields"],"zip")) ? "" : $this->cObj->stdWrap(htmlentities($row[zip]),$this->conf["ListZip."]);
                                        $markerArray["###CITY###"] = ($this->conf["hide_field"] && t3lib_div::inList($this->conf["hidden_fields"],"city")) ? "" : $this->cObj->stdWrap(htmlentities($row[city]),$this->conf["ListCity."]);
                                        $markerArray["###PHONE###"] = ($this->conf["hide_field"] && t3lib_div::inList($this->conf["hidden_fields"],"phone")) ? "" : (($row[phone]) ? $this->cObj->stdWrap($this->pi_getLL("phone").": ".$row[phone],$this->conf["ListPhone."]) : "");
                                        $markerArray["###MOBILE###"] = ($this->conf["hide_field"] && t3lib_div::inList($this->conf["hidden_fields"],"mobile")) ? "" : (($row[mobile]) ? $this->cObj->stdWrap($this->pi_getLL("mobile").": ".$row[mobile],$this->conf["ListMobile."]) : "");
                                        $markerArray["###FAX###"] = ($this->conf["hide_field"] && t3lib_div::inList($this->conf["hidden_fields"],"fax")) ? "" : (($row[fax]) ? $this->cObj->stdWrap($this->pi_getLL("fax").": ".$row[fax],$this->conf["ListFax."]) : ""); 
                                        $markerArray["###WWW###"] = ($this->conf["hide_field"] && t3lib_div::inList($this->conf["hidden_fields"],"www")) ? "" : (($row[www]) ? $this->makeHTTPLink($row[www],$this->pi_getLL("www")) : '<font color="'.$this->conf[inactive].'">WWW</font>');
                                        $markerArray["###EMAIL###"] = ($this->conf["hide_field"] && t3lib_div::inList($this->conf["hidden_fields"],"email")) ? "" : (($row[email]) ? $this->makeMailtoLink($row[email]) : '<font color="'.$this->conf[inactive].'">E-Mail</font>');
                                        $markerArray["###IMAGE###"] = ($this->conf["hide_field"] && t3lib_div::inList($this->conf["hidden_fields"],"image")) ? "" : (($row[image]) ? $this->getImage($row[image],$this->conf) : "");
                                        $markerArray["###DETAILS###"] = $this->makeLink($this->pi_getLL("details"),detail,$modifier,$row[uid],1,$pointer);
                                        $wieviele=1;
					$content .= $this->cObj->substituteMarkerArrayCached($this->listIIIentry,$markerArray,array(),array());
				}
			break;

			default:						
				while($row = mysql_fetch_assoc($res))	{
					if (($lastsys == $row[title]) || !$this->cObj->data["tx_spdirectory_dspfolder"]) {
                                                $markerArray["###SYSFOLDER###"] = "";
						$markerArray["###W1B###"] = "";
                                                $markerArray["###W1E###"] = "";
                                        } else {
						list($markerArray["###W1B###"],$markerArray["###W1E###"]) = explode($splitMark,$this->cObj->stdWrap($splitMark,$this->conf["wrap1."]));
                                                $markerArray["###SYSFOLDER###"] = htmlentities($row[title]);
                                                $lastsys = $row[title];
                                        }

					$over[detail]=$row[uid];
					$markerArray["###NAME###"] = $this->cObj->stdWrap(($this->conf["displayNameLink"]) ? $this->makeLink(htmlentities($row[name]),detail,$modifier,$row[uid],1,$pointer) : htmlentities($row[name]),$this->conf["ListName."]);
					$markerArray["###STREET###"] = ($this->conf["hide_field"] && t3lib_div::inList($this->conf["hidden_fields"],"street")) ? "" : $this->cObj->stdWrap(htmlentities($row[address]),$this->conf["ListStreet."]);
					$markerArray["###ZIP###"] = ($this->conf["hide_field"] && t3lib_div::inList($this->conf["hidden_fields"],"zip")) ? "" : $this->cObj->stdWrap(htmlentities($row[zip]),$this->conf["ListZip."]);
					$markerArray["###CITY###"] = ($this->conf["hide_field"] && t3lib_div::inList($this->conf["hidden_fields"],"city")) ? "" : $this->cObj->stdWrap(htmlentities($row[city]),$this->conf["ListCity."]);
					$markerArray["###PHONE###"] = ($this->conf["hide_field"] && t3lib_div::inList($this->conf["hidden_fields"],"phone")) ? "" : (($row[phone]) ? $this->cObj->stdWrap($this->pi_getLL("phone").": ".$row[phone],$this->conf["ListPhone."]) : "");
					$markerArray["###MOBILE###"] = ($this->conf["hide_field"] && t3lib_div::inList($this->conf["hidden_fields"],"mobile")) ? "" : (($row[mobile]) ? $this->cObj->stdWrap($this->pi_getLL("mobile").": ".$row[mobile],$this->conf["ListMobile."]) : "");
					$markerArray["###FAX###"] = ($this->conf["hide_field"] && t3lib_div::inList($this->conf["hidden_fields"],"fax")) ? "" : (($row[fax]) ? $this->cObj->stdWrap($this->pi_getLL("fax").": ".$row[fax],$this->conf["ListFax."]) : "");		
					$markerArray["###WWW###"] = ($this->conf["hide_field"] && t3lib_div::inList($this->conf["hidden_fields"],"www")) ? "" : (($row[www]) ? $this->makeHTTPLink($row[www],$this->pi_getLL("www")) : '<font color="'.$this->conf[inactive].'">WWW</font>');
					$markerArray["###EMAIL###"] = ($this->conf["hide_field"] && t3lib_div::inList($this->conf["hidden_fields"],"email")) ? "" : (($row[email]) ? $this->makeMailtoLink($row[email]) : '<font color="'.$this->conf[inactive].'">E-Mail</font>');
					$markerArray["###IMAGE###"] = ($this->conf["hide_field"] && t3lib_div::inList($this->conf["hidden_fields"],"image")) ? "" : (($row[image]) ? $this->getImage($row[image],$this->conf) : "");
					$markerArray["###DETAILS###"] = $this->makeLink($this->pi_getLL("details"),detail,$modifier,$row[uid],1,$pointer);
					$content .= $this->cObj->substituteMarkerArrayCached($this->listIentry,$markerArray,array(),array());
					$wieviele=1;
				}
					$markerArray["###SORRY###"] = $this->pi_getLL("sorry");
				$content = ($wieviele) ? $content : $this->cObj->substituteMarkerArrayCached($this->nono,$markerArray,array(),array());
			break;
		}
           
	return $content;
	}
	
	function makeBottom($modifier,$value)	{
	
		$markerArray["###PAGES###"] = $this->make123($modifier,$value);
		$content = $this->cObj->substituteMarkerArrayCached($this->bottom,$markerArray,array(),array());
		
	return $content;
	}


	
	
	/**
	 * Erzeugen der Buchstabenleiste in Abhängigkeit von den vorkommenden Buchstaben, 
	 * des aktuellen Buchstabens und des Anzeigemodus (Normal, Suche, Kategorie)
	 */
	function makeABC($table,$column,$value)	{
		$alphabet=array(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z);
		$value == (in_array($value,$alphabet)) ? "all" : $value;

		$pidlist = $this->pi_getPidlist($this->conf["pidList"],$this->conf["recursive"]);

		$query="SELECT ".$column." FROM ".$table." WHERE pid IN (".$pidlist.")"." ".$this->cObj->enableFields($table);

		$res = mysql(TYPO3_db,$query);
		
		while($tempo = mysql_fetch_assoc($res))	{
			$atoz[]=str_replace (array("Ä", "Ö", "Ü"), array("A", "O", "U"), strtoupper($tempo[$column]{0}));
		}
		$atoz[none]=1;


		
		for($i=0;$i<sizeof($alphabet);$i++)	{

			if(in_array($alphabet[$i],$atoz))	{
				$atozlist .= ($value==$alphabet[$i]) ? '<font color="'.$this->conf[active].'">'.$alphabet[$i].'</font>'.' ' : $this->makeLink($alphabet[$i],liste,abc,$alphabet[$i]).' ';
			}
			else	{
				$atozlist .= '<font color="'.$this->conf[inactive].'">'.$alphabet[$i].'</font>'.' ';
			}
		}
		$atozlist .= ($value==all) ? '<font color="'.$this->conf[active].'">'.$this->pi_getLL("all").'</font>' : $this->makeLink($this->pi_getLL("all"),liste,abc,all);

	return $atozlist;
	}

	
	
	function makeLink($string,$mode,$modifier,$value="",$cache=1,$pointer=0)	{
		
		$over = array(mode => $mode, modifier => $modifier, value => $value, pointer => $pointer);
		$link = ($string) ?	$this->pi_linkTP_keepPIvars($string,$over,$cache) : $link = $this->pi_linkTP_keepPIvars_url($over,$cache);	

	return $link;
	}
	
	
	
	/**
	 * Erzeugen der Seitenleiste in Abhängigkeit von aktueller Seite und zu übergebender Variable
	 */	
	
	function make123($modifier,$value)	{

		$query = $this->makeListQuery($modifier,$value,1);
		$res = mysql(TYPO3_db,$query);
		$rescount = mysql_fetch_row($res);
		$pages=ceil($rescount[0]/$this->conf["itemsPerPage"]);
	
			$pagelist = $this->pi_getLL("page");;
			for($i=0;$i<$pages;$i++)	{
				$j=$i+1;
				$pagelist .= ($this->piVars[pointer]==$i) ? ' <font color="'.$this->conf[active].'">'.$j.'</font>' : ' '.$this->makeLink($j,liste,$modifier,$value,1,$i);
 			}
		

	return $pagelist;
	}
	
	/**
	 * Erzeugen der Query
	 */		
	function makeListQuery($modifier,$value,$count=0)	{
		$this->internal["orderBy"] = "name";
		$this->internal["orderByList"] = "name";
		$this->internal["searchFieldList"]="name, description, address, city, www";
		$this->internal["results_at_a_time"] = $this->conf["itemsPerPage"];
		$value = mysql_escape_string($value);
		$select = '';

		switch($modifier)	{

			case "search":
				$this->internal["searchFieldlist"]="name, description, address, city, www";
				$this->piVars[sword]=$value;
				
			break;
			
			case "cat":
				$this->piVars[sword]="";
				$addWhere = 'AND tx_spdirectory_cat.uid = '.$value;	
				$mmcat["table"] = 'tx_spdirectory_cat';
                                $mmcat["mmtable"] = 'tx_spdirectory_cat_mm';
			break;
			
			case "zip":
				$this->piVars[sword]="";
				$addWhere = "AND tt_address.zip = '".$value."'";	
			break;

			case "abc":
				$mychar=str_replace(array("A", "O", "U"), array("AÄ1234567890", "OÖ", "UÜ"),$value);
				$mychar=$mychar.strtolower($mychar);
				$addWhere = ($value!=all) ? 'AND tt_address.name REGEXP "^['.$mychar.']"' : "";		
				if ($this->cObj->data["tx_spdirectory_dspfolder"] && !$count) {
					$select = ",pages.title";
					$addQuery = "FROM tt_address,pages WHERE tt_address.pid IN (".$this->pi_getPidList($this->conf['pidList'],$this->conf['recursive']).") AND tt_address.pid=pages.uid AND pages.uid IN (".$this->pi_getPidList($this->conf['pidList'],$this->conf['recursive']).") ".$this->cObj->enableFields(tt_address);
					$orderby = "ORDER BY pages.title, tt_address.name";
				}
			break;
		
			case "catorder":
				$mychar=str_replace(array("A", "O", "U"), array("AÄ1234567890", "OÖ", "UÜ"),$value);
                                $mychar=$mychar.strtolower($mychar);
                                $addWhere = ($value!=all) ? 'AND tt_address.name REGEXP "^['.$mychar.']"' : "";
				if ($this->cObj->data["tx_spdirectory_dspfolder"] && !$count) {
					$orderby = "ORDER BY pages.title,tx_spdirectory_cat.catname,tt_address.name";
					$select = ",pages.title,tx_spdirectory_cat.catname";
					$addQuery ="FROM tt_address,pages,tx_spdirectory_cat,tx_spdirectory_cat_mm WHERE tt_address.uid=tx_spdirectory_cat_mm.uid_local AND tx_spdirectory_cat.uid=tx_spdirectory_cat_mm.uid_foreign AND tt_address.pid IN (".$this->pi_getPidList($this->conf['pidList'],$this->conf['recursive']).") AND tt_address.pid=pages.uid AND pages.uid IN (".$this->pi_getPidList($this->conf['pidList'],$this->conf['recursive']).") ".$this->cObj->enableFields(tt_address);
				} else {
					$orderby = "ORDER BY tx_spdirectory_cat.catname,tt_address.name";
					$select = ",tx_spdirectory_cat.catname";
                                        $addQuery ="FROM tt_address,tx_spdirectory_cat,tx_spdirectory_cat_mm WHERE tt_address.uid=tx_spdirectory_cat_mm.uid_local AND tx_spdirectory_cat.uid=tx_spdirectory_cat_mm.uid_foreign AND tt_address.pid IN (".$this->pi_getPidList($this->conf['pidList'],$this->conf['recursive']).") ".$this->cObj->enableFields(tt_address);
				}
                        break;

			case "ziporder":
				$mychar=str_replace(array("A", "O", "U"), array("AÄ1234567890", "OÖ", "UÜ"),$value);
				$mychar=$mychar.strtolower($mychar);
                                $addWhere = ($value!=all) ? 'AND tt_address.name REGEXP "^['.$mychar.']"' : "";
				if ($this->cObj->data["tx_spdirectory_dspfolder"] && !$count) {
	                                $orderby = "ORDER BY pages.title,tt_address.zip,tt_address.name";
					$select = ",pages.title";
					$addQuery = "FROM tt_address,pages WHERE tt_address.pid IN (".$this->pi_getPidList($this->conf['pidList'],$this->conf['recursive']).") AND tt_address.pid=pages.uid AND pages.uid IN (".$this->pi_getPidList($this->conf['pidList'],$this->conf['recursive']).") ".$this->cObj->enableFields(tt_address);
				} else {
					$orderby = "ORDER BY tt_address.zip,tt_address.name";
				}
                        break;
		
		}
		
		if ($GLOBALS["TYPO_VERSION"] >= '3.6.0') {
			$queryArr=$this->pi_list_query($this->internal[currentTable],$count,$addWhere,$mmcat,"",$orderby,$addQuery,TRUE);
			$query = 'SELECT '.$queryArr[SELECT].$select;
			$query .= ' FROM '.$queryArr[FROM];
			$query .= ($queryArr[WHERE]) ? ' WHERE '.$queryArr[WHERE] : '';
			$query .= ($queryArr[GROUPBY]) ? ' GROUP BY '.$queryArr[GROUPBY] : '';
			$query .= ($queryArr[ORDERBY]) ? ' ORDER BY '.$queryArr[ORDERBY] : '';
			$query .= ($queryArr[LIMIT]) ? ' LIMIT '.$queryArr[LIMIT] : '';
		} else {
			$aq = ($select & $addQuery) ? $select.' '.$addQuery : $addQuery;
			$query = $this->pi_list_query($this->internal[currentTable],$count,$addWhere,$mmcat,"",$orderby,$aq);
		}
	return $query;
	}
	
	function makeSearchbox($search)	{
		
		$code = '	<table cellspacing=0 cellpadding=0 border=0><tr>
					<form method="POST" action="'.$this->makeLink("",liste,search,"",0).'">
					<td><input type="text" class="tx_spdirectory-pi1-small" name="tx_spdirectory_pi1[value]"';
					
		$code .= 	($this->piVars[modifier]==search) ? ' value="'.$search.'"' : "" ;
					
		$code .= ($this->piVars[modifier]==search) ? ' style="color: '.$this->conf[active].';font-size: 10px;"' : ' style="font-size: 10px;"';		 
					
		$code .= '	></td>
					<td><input type="submit" value="'.$this->pi_getLL("search").'" class="tx_spdirectory-pi1-small"></td>
					</form></tr></table>';
	
	return $code;
	}
	
	
	function makeMailtoLink($emailadr)	{
                $this->typolink_conf["parameter"] = $emailadr;
		$code = $this->cObj->typolink($emailadr, $this->typolink_conf);

	return $code;
	}	

        function makeHTTPLink($url,$name)      {
                $this->typolink_conf["parameter"] = $url;
                $code = $this->cObj->typolink($name, $this->typolink_conf);

	return $code;
        }
							


	function makeJumper($modifier,$value)	{
		
		$pidlist = $this->pi_getPidlist($this->conf["pidList"],$this->conf["recursive"]);

		$query = "SELECT DISTINCT tx_spdirectory_cat.catname AS name, tx_spdirectory_cat_mm.uid_foreign AS id FROM tt_address, tx_spdirectory_cat, tx_spdirectory_cat_mm WHERE tt_address.pid IN (".$pidlist.")".$this->cObj->enableFields(tt_address)." AND tx_spdirectory_cat_mm.uid_local = tt_address.uid AND tx_spdirectory_cat.uid = tx_spdirectory_cat_mm.uid_foreign";
		$res = mysql(TYPO3_db,$query);
		
		while($tempo = mysql_fetch_assoc($res))	{
			$entries .= '<option value="'.$this->makeLink("",liste,cat,$tempo[id],$cache=1,$pointer=0).'"';
			$entries .= ($tempo[id]==$value&&$modifier==cat) ? ' selected style="color: '.$this->conf[active].';"' : "";
			$entries .= '>'.$tempo[name].'</option>';
		}
		
		$code="
		
		<script language=\"JavaScript\" type=\"text/JavaScript\">
		<!--
		function MM_jumpMenu(targ,selObj,restore){ 
  		eval(targ+\".location='\"+selObj.options[selObj.selectedIndex].value+\"'\");
  		if (restore) selObj.selectedIndex=0;
		}
		//-->
		</script>

		<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><form name=\"form1\">
  		<tr>
   		<td><select name=\"menu1\" onChange=\"MM_jumpMenu('self',this,0)\" class=\"tx_spdirectory-pi1-small\">
		<option value=\"".$this->pi_linkTP_keepPIvars_url("",1)."\">".$this->pi_getLL("category")."</option>".$entries."
  		</select></td>
  		</tr></form></table>
		
		";
	
	
	
	return $code;
	}
	
	function makeZIP($modifier,$value)	{
		
		$pidlist = $this->pi_getPidlist($this->conf["pidList"],$this->conf["recursive"]);

		$query = "SELECT DISTINCT zip FROM tt_address WHERE tt_address.pid IN (".$pidlist.")"." ".$this->cObj->enableFields(tt_address)." ORDER BY zip";
		$res = mysql(TYPO3_db,$query);
		
		while($tempo = mysql_fetch_assoc($res))	{
			$entries .= '<option value="'.$this->makeLink("",liste,zip,$tempo[zip],$cache=1,$pointer=0).'"';
			$entries .= ($tempo[zip]==$value&&$modifier==zip) ? ' selected style="color: '.$this->conf[active].'"' : "";
			$entries .= '>'.$tempo[zip].'</option>';
		}
		
		$code="
		
		<script language=\"JavaScript\" type=\"text/JavaScript\">
		<!--
		function MM_jumpMenu(targ,selObj,restore){ 
  		eval(targ+\".location='\"+selObj.options[selObj.selectedIndex].value+\"'\");
  		if (restore) selObj.selectedIndex=0;
		}
		//-->
		</script>

		<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><form name=\"form1\">
  		<tr>
   		<td><select name=\"menu1\" onChange=\"MM_jumpMenu('self',this,0)\" class=\"tx_spdirectory-pi1-small\">
		<option value=\"".$this->pi_linkTP_keepPIvars_url("",1)."\">".$this->pi_getLL("zip")."</option>".$entries."
  		</select></td>
  		</tr></form></table>
		
		";
	
	return $code;
	
	}
	function getImage($image,$conf)	{
			$this->conf=$conf;
			$varLogo = $this->conf["image."];
			$varLogo["file"] = "uploads/pics/".($image);
	return $theImgCode=$this->cObj->IMAGE($varLogo);
	}
	
	function makeError($string)	{
		$this->fehler=1;
		return '<font color="red">'.$string.'</font>';
	}

	function makeForm($mode="enter",$modifier="first",$id="")	{	
	
		//Formular bauen			
		$this->listeTemplateCode = $this->cObj->fileResource($this->conf["templateFile"]);
		$this->enter = $this->cObj->getSubpart($this->listeTemplateCode, "###ENTERVIEW###");

		$over = array(mode => "edit", modifier => "submit", value =>$this->piVars[value], pointer => "0");
                $link = $this->pi_linkTP_keepPIvars_url($over,$cache);

		$markerArray["###ACTION###"] = $link;
		$markerArray["###ERROR###"] = "";
		$markerArray["###DOTTED###"] = $this->pi_classParam("dotted");
		$markerArray["###SMALL###"] = $this->pi_classParam("small");
#		$markerArray["###NEWENTRY###"] = $this->pi_getLL("newentry");
		$markerArray["###NAME###"] = $this->pi_getLL("name");				
		$markerArray["###STREET###"] = $this->pi_getLL("street");
		$markerArray["###ZIP###"] = $this->pi_getLL("zip");
		$markerArray["###CITY###"] = $this->pi_getLL("city");
		$markerArray["###PHONE###"] = $this->pi_getLL("phone");
		$markerArray["###MOBILE###"] = $this->pi_getLL("mobile");
		$markerArray["###FAX###"] = $this->pi_getLL("fax");
		$markerArray["###EMAIL###"] = $this->pi_getLL("email");
		$markerArray["###EDITENTRY###"] = $this->pi_getLL("edit_entry");
		$markerArray["###WWW###"] = $this->pi_getLL("www");
		$markerArray["###IMAGE###"] = $this->pi_getLL("image");
		$markerArray["###DESCRIPTION###"] = $this->pi_getLL("description");
		$markerArray["###SUBMIT###"] = $this->pi_getLL("submit");
		$markerArray["###CATEGORY###"] = $this->pi_getLL("category");
		$markerArray["###SELECT###"] = $this->makeCategory($this->piVars[category]);
		$markerArray["###FOLDER###"] = ($this->cObj->data["tx_spdirectory_dspfolder"]) ? $this->pi_getLL("folder") : "";
		$markerArray["###SELECTFOLDER###"] = ($this->cObj->data["tx_spdirectory_dspfolder"]) ? $this->makeFolder("") : "";	
	
		switch($mode)	{
			case "enter":
				$hidden[mode]=enter;
				$hidden[modifier]=submit;
				switch($modifier)	{
					case "submit":
						$markerArray = $this->evalForm($markerArray);
						if(!$this->fehler)	{
							$image=$this->storeImage();					
							$goto = $this->storeDB($image);
							$success = $this->makeSuccess($goto);
						}
						else	{
							$markerArray["###NAMEV###"] = $this->piVars[name];				
							$markerArray["###STREETV###"] = $this->piVars[address];
							$markerArray["###ZIPV###"] = $this->piVars[zip];
							$markerArray["###CITYV###"] = $this->piVars[city];
							$markerArray["###PHONEV###"] = $this->piVars[phone];
							$markerArray["###MOBILEV###"] = $this->piVars[mobile];
							$markerArray["###FAXV###"] = $this->piVars[fax];
							$markerArray["###EMAILV###"] = $this->piVars[email];
							$markerArray["###WWWV###"] = $this->piVars[www];
							$markerArray["###DESCRIPTIONV###"] = $this->piVars[description];					
						}
					break;
					default:
						$markerArray["###NAMEV###"] = "";				
						$markerArray["###STREETV###"] = "";
						$markerArray["###ZIPV###"] = "";
						$markerArray["###CITYV###"] = "";
						$markerArray["###PHONEV###"] = "";
						$markerArray["###MOBILEV###"] = "";
						$markerArray["###FAXV###"] = "";
						$markerArray["###EMAILV###"] = "";
						$markerArray["###WWWV###"] = "";
						$markerArray["###DESCRIPTIONV###"] = "";
					break;
				}

			
			break;
			case "edit";
				$markerArray["###IMAGE###"] = $this->pi_getLL("new_image");
				$markerArray["###SUBMIT###"] = $this->pi_getLL("edit_delete");
				$markerArray["###HIDDEN###"] = '<input name="tx_spdirectory_pi1[delete]" type="checkbox" id="tx_spdirectory_pi1[delete]" value="1">'.$this->pi_getLL("delete").'&nbsp;&nbsp;&nbsp;';
				
				$hidden[mode]=edit;
				$hidden[modifier]=submit;
				$hidden[value]=$id;
				switch($modifier)	{
					case "submit";
						if($this->piVars[delete])	{
							if ($this->checkAccess($id)) {
								$this->deleteFromDB($id);
								$success = $this->makeSuccess($goto);
							} else {
				                         	$this->fehler=1;
			        	                 	$markerArray["###ERROR###"] = "<font color=red>".$this->pi_getLL("error_noaccess")."</font><br><br>";
							}
						} else {
							$markerArray = $this->evalForm($markerArray);
							if(!$this->fehler)	{
								$image=$this->storeImage();
								$goto = $this->updateDB($image,$id);
								$success = $this->makeSuccess($goto);
							
							}
							else	{
								$markerArray["###NAMEV###"] = $this->piVars[name];				
								$markerArray["###STREETV###"] = $this->piVars[address];
								$markerArray["###ZIPV###"] = $this->piVars[zip];
								$markerArray["###CITYV###"] = $this->piVars[city];
								$markerArray["###PHONEV###"] = $this->piVars[phone];
								$markerArray["###MOBILEV###"] = $this->piVars[mobile];
								$markerArray["###FAXV###"] = $this->piVars[fax];
								$markerArray["###EMAILV###"] = $this->piVars[email];
								$markerArray["###WWWV###"] = $this->piVars[www];
								$markerArray["###DESCRIPTIONV###"] = $this->piVars[description];	
							}
						}
					break;
					default:
						//Get Data from DB
						$pidlist = $this->pi_getPidlist($this->conf["pidList"],$this->conf["recursive"]);
						$query = "SELECT tt_address.*,tx_spdirectory_cat_mm.uid_foreign FROM tt_address,tx_spdirectory_cat,tx_spdirectory_cat_mm WHERE tt_address.uid=tx_spdirectory_cat_mm.uid_local AND tx_spdirectory_cat.uid=tx_spdirectory_cat_mm.uid_foreign AND tt_address.pid IN (".$pidlist.")"." ".$this->cObj->enableFields(tt_address)." AND tt_address.uid = ".$id;

						$i=0;
						$res = mysql(TYPO3_db,$query);
						while($row = mysql_fetch_assoc($res)) {
							$category[$i++] = $row[uid_foreign];
							if ($i = 1) {
								//Assign Data to Fields
								$markerArray["###NAMEV###"] = $row[name];
								$markerArray["###STREETV###"] = $row[address];
								$markerArray["###ZIPV###"] = $row[zip];
								$markerArray["###CITYV###"] = $row[city];
								$markerArray["###PHONEV###"] = $row[phone];
								$markerArray["###MOBILEV###"] = $row[mobile];
								$markerArray["###FAXV###"] = $row[fax];
								$markerArray["###EMAILV###"] = $row[email];
								$markerArray["###WWWV###"] = $row[www];
								$markerArray["###DESCRIPTIONV###"] = $row[description];
								$markerArray["###SELECT###"] = $this->makeCategory($category);
								$markerArray["###SELECTFOLDER###"] = ($this->cObj->data["tx_spdirectory_dspfolder"]) ? $this->makeFolder($row[pid]) : "";
							}
						}
						//No category selected
						if ($i == 0) {

							$query = "SELECT * FROM tt_address WHERE pid IN (".$pidlist.")"." ".$this->cObj->enableFields(tt_address)." AND uid = ".$id;

							$res = mysql(TYPO3_db,$query);
                	                                while($row = mysql_fetch_assoc($res)) {
								//Assign Data to Fields
                                	                        $markerArray["###NAMEV###"] = $row[name];
                                        	                $markerArray["###STREETV###"] = $row[address];
                                                	        $markerArray["###ZIPV###"] = $row[zip];
                                                        	$markerArray["###CITYV###"] = $row[city];
	                                                        $markerArray["###PHONEV###"] = $row[phone];
        	                                                $markerArray["###MOBILEV###"] = $row[mobile];
                	                                        $markerArray["###FAXV###"] = $row[fax];
                        	                                $markerArray["###EMAILV###"] = $row[email];
                                	                        $markerArray["###WWWV###"] = $row[www];
                                        	                $markerArray["###DESCRIPTIONV###"] = $row[description];
                                                	        $markerArray["###SELECT###"] = $this->makeCategory($category);
                                                        	$markerArray["###SELECTFOLDER###"] = ($this->cObj->data["tx_spdirectory_dspfolder"]) ? $this->makeFolder($row[pid]) : "";
							}
						}
					break;
				}
		}
		$markerArray["###HIDDEN###"] .= $this->makeHidden($hidden);
	
		$return = (!$success) ? $this->cObj->substituteMarkerArrayCached($this->enter,$markerArray,array(),array()) : $success;
	
	return $return;	
	}	
	
	function makeHidden($hidden)	{
		while(list($key,$value) = each($hidden))	{
			$code .= '<input type="hidden" name="tx_spdirectory_pi1['.$key.']" value="'.$value.'">';
		}
	return $code;
	}
	
	function evalForm($markerArray)	{
		$markerArray["###NAME###"] = ($this->piVars[name] || !t3lib_div::inList(strtolower($this->conf["required_fields"]),"name")) ? $markerArray["###NAME###"] : $this->makeError($markerArray["###NAME###"]);			
		$markerArray["###STREET###"] = ($this->piVars[address] || !t3lib_div::inList(strtolower($this->conf["required_fields"]),"street")) ? $markerArray["###STREET###"] : $this->makeError($markerArray["###STREET###"]);	
		$markerArray["###ZIP###"] = (preg_match("([0-9]{5})",$this->piVars[zip]) || !t3lib_div::inList(strtolower($this->conf["required_fields"]),"zip")) ? $markerArray["###ZIP###"] : $this->makeError($markerArray["###ZIP###"]);
		$markerArray["###CITY###"] = ($this->piVars[city] || !t3lib_div::inList(strtolower($this->conf["required_fields"]),"city")) ? $markerArray["###CITY###"] : $this->makeError($markerArray["###CITY###"]);
		$markerArray["###EMAIL###"] = (preg_match("(^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@([a-zA-Z0-9-]+\.)+([a-zA-Z]{2,3})$)",$this->piVars[email]) || !t3lib_div::inList(strtolower($this->conf["required_fields"]),"email")) ? $markerArray["###EMAIL###"] : $this->makeError($markerArray["###EMAIL###"]);
		$markerArray["###WWW###"] = (preg_match("/^(http:|ftp:\/\/).*(\.+).*/i",$this->piVars[www]) || !t3lib_div::inList(strtolower($this->conf["required_fields"]),"www")) ? $markerArray["###WWW###"] : $this->makeError($markerArray["###WWW###"]);
#		$markerArray["###ERROR###"] = ($this->fehler) ? "<font color=red>".$this->pi_getLL("error")."</font><br><br>" : "";
		$markerArray["###IMAGE###"] = ($this->evalImage()!=error || !t3lib_div::inList(strtolower($this->conf["required_fields"]),"image")) ? $markerArray["###IMAGE###"] : $this->makeError($markerArray["###IMAGE###"]);	
		$markerArray["###CATEGORY###"] = ($this->piVars[category] || !t3lib_div::inList(strtolower($this->conf["required_fields"]),"category")) ? $markerArray["###CATEGORY###"] : $this->makeError($markerArray["###CATEGORY###"]);	

		$accessOK = "";
		if ($this->piVars[value]) {
			$accessOK = $this->checkAccess($this->piVars[value]);
		} else {
			$accessOK = $this->checkAccess(-1);
		}
		$accessOK = ereg('[0-9]', $accessOK);
                if (!$accessOK) {
			$this->fehler=1;
			$markerArray["###ERROR###"] = "<font color=red>".$this->pi_getLL("error_noaccess")."</font><br><br>";
		} else {
			$markerArray["###ERROR###"] = ($this->fehler) ? "<font color=red>".$this->pi_getLL("error")."</font><br><br>" : "";
		}

	return $markerArray;
	}
	
	function evalImage()	{
		//Bildtyp checken
		$bildtypen = array("gif","jpg","png");
		
		//Bild vorhanden?
		if($this->piVars[image]!=none)	{
		
			@$typ = getimagesize($this->piVars[image]);
			if($typ[2]!= 1 && $typ[2]!= 2 && $typ[2]!= 3 || $GLOBALS[tx_spdirectory_pi1_size][image]>210000)	{
				$type=error;
			}
			else	{
				$type=$bildtypen["$typ[2]"];
			}
		}
		else	{
			$type=none;
		}
		
		
	return $type;
	}
	
	function storeDB($image)	{

		$pid = ($this->piVars[folder]) ? $this->piVars[folder] : $GLOBALS["TSFE"]->page[uid];
	
		$query='INSERT INTO tt_address (pid,tstamp,name,address,zip,city,phone,mobile,fax,email,www,description,image,tx_spdirectory_cat,tx_spdirectory_fegroup,tx_spdirectory_feuser) 
				VALUES ("'.$pid.'","'.time().'","'.mysql_escape_string($this->piVars[name]).'","'.mysql_escape_string($this->piVars[address]).'","'.mysql_escape_string($this->piVars[zip]).'","'.mysql_escape_string($this->piVars[city]).'","'.mysql_escape_string($this->piVars[phone]).'","'.mysql_escape_string($this->piVars[mobile]).'","'.mysql_escape_string($this->piVars[fax]).'","'.mysql_escape_string($this->piVars[email]).'","'.mysql_escape_string($this->piVars[www]).'","'.mysql_escape_string(strip_tags($this->piVars[description])).'","'.$image.'","0","'.$this->conf["default_fegroup"].'","'.$GLOBALS['TSFE']->fe_user->user[uid].'")';

		$res = mysql(TYPO3_db,$query);
		
		$id=mysql_insert_id();

		$i=1;
                foreach ($this->piVars[category] as $cat) {
                        $query = 'INSERT INTO tx_spdirectory_cat_mm (uid_local,uid_foreign,sorting) VALUES ("'.$id.'", "'.$cat.'", "'.$i++.'")';
                        $res = mysql(TYPO3_db,$query);
                }
		
		$res = mysql (TYPO3_db, "DELETE FROM cache_pages WHERE page_id = ".$GLOBALS["TSFE"]->page[uid]);
	
	return $id;
	}
	
	function updateDB($image,$id)	{
	
		$pid = ($this->piVars[folder]) ? $this->piVars[folder] : $GLOBALS["TSFE"]->page[uid];

		$query =	"UPDATE tt_address SET
					pid = '".$pid."', 
					name = '".mysql_escape_string($this->piVars[name])."',
					address = '".mysql_escape_string($this->piVars[address])."',
					zip = '".mysql_escape_string($this->piVars[zip])."',
					city = '".mysql_escape_string($this->piVars[city])."',
					phone = '".mysql_escape_string($this->piVars[phone])."',
					mobile = '".mysql_escape_string($this->piVars[mobile])."',
					fax = '".mysql_escape_string($this->piVars[fax])."',
					email = '".mysql_escape_string($this->piVars[email])."',
					www = '".mysql_escape_string($this->piVars[www])."',
					description = '".mysql_escape_string(strip_tags($this->piVars[description]))."',";
					
		$query .= ($image) ? "image = '".$image."'," : "";
				
		$query .=	"tx_spdirectory_cat = '0'
					WHERE uid = '".$id."'";
		$res = mysql(TYPO3_db,$query);
		$res = mysql (TYPO3_db, "DELETE FROM cache_pages WHERE page_id = ".$GLOBALS["TSFE"]->page[uid]);

		$res = mysql(TYPO3_db, "DELETE FROM tx_spdirectory_cat_mm WHERE uid_local = ".$id);

		$i=1;
		foreach ($this->piVars[category] as $cat) {
			$query = 'INSERT INTO tx_spdirectory_cat_mm (uid_local,uid_foreign,sorting) VALUES ("'.$id.'", "'.$cat.'", "'.$i++.'")';
			$res = mysql(TYPO3_db,$query);
		}
		
	}
	
	function deleteFromDB($id)	{
		$query = "DELETE FROM tt_address WHERE uid = $id";
		$res = mysql(TYPO3_db,$query);

		$query = "DELETE FROM tx_spdirectory_cat_mm WHERE uid_local = $id";
                $res = mysql(TYPO3_db,$query);

		$res = mysql (TYPO3_db, "DELETE FROM cache_pages WHERE page_id = ".$GLOBALS["TSFE"]->page[uid]);
	}
	
	function storeImage()	{

		if($GLOBALS[HTTP_POST_FILES][tx_spdirectory_pi1][name][image])	{

			$this->fileFunc = t3lib_div::makeInstance("t3lib_basicFileFunctions");
			$sauber = $this->fileFunc->cleanFileName($GLOBALS[HTTP_POST_FILES][tx_spdirectory_pi1][name][image]); 
			$unique = $this->fileFunc->getUniqueName($sauber,PATH_site.$TYPO3_LOADED_EXT[$key]["siteRelPath"]."uploads/pics/");
			move_uploaded_file($this->piVars[image],$unique);		
		}
		$return = pathinfo($unique);

	return $return[basename];
	
	}
	
	function makeCategory($id)	{
		
		$pidlist = $this->pi_getPidlist($this->conf["pidList"],$this->conf["recursive"]);

		$query = "SELECT uid, catname FROM tx_spdirectory_cat WHERE pid IN (".$pidlist.")"." ".$this->cObj->enableFields(tx_spdirectory_cat)." ORDER BY catname";
		$res = mysql(TYPO3_db,$query);
		
		while($tempo = mysql_fetch_assoc($res))	{

			$entries .= '<option value="'.$tempo[uid].'"';
			if (is_array($id)) {
				$entries .= (in_array($tempo[uid],$id)) ? " selected" : "";
			} else {
				$entries .= ($tempo[uid]==$id) ? " selected" : "";
			}
			$entries .= '>'.$tempo[catname].'</option>';
		}
		
		$code='
		<select name="tx_spdirectory_pi1[category][]" class="tx_spdirectory-pi1-small" size="5" multiple>
		'.$entries.'
  		</select>
		';
	return $code;
	}

	function makeFolder($id)      {

		$pidlist = $this->pi_getPidlist($this->conf["pidList"],$this->conf["recursive"]);

                $query = "SELECT uid,title FROM pages WHERE uid IN (".$pidlist.")"." ".$this->cObj->enableFields(pages)." ORDER BY title";
                $res = mysql(TYPO3_db,$query);

                while($tempo = mysql_fetch_assoc($res)) {

                        $entries .= '<option value="'.$tempo[uid].'"';
			$entries .= ($tempo[uid]==$id) ? " selected" : "";
                        $entries .= '>'.$tempo[title].'</option>';
                }

                $code='
                <select name="tx_spdirectory_pi1[folder]" class="tx_spdirectory-pi1-small">
                '.$entries.'
                </select>
                ';
        return $code;
        }


	function makeSuccess($goto)	{
		
		$success = $this->cObj->getSubpart($this->listeTemplateCode, "###SUCCESSVIEW###");
		$markerArray["###DOTTED###"] = $this->pi_classParam("dotted");
		$markerArray["###SMALL###"] = $this->pi_classParam("small");
		$url[tx_spdirectory_pi1][detail]=$goto;
		unset($this->piVars);
		$markerArray["###BACK###"] = $this->makeLink($this->pi_getLL("back"),liste,abc,all);
		$markerArray["###THANKS###"] =$this->pi_getLL("thanks");
		$markerArray["###EDITENTRY###"] =$this->pi_getLL("edit_entry");
		
		$success = $this->cObj->substituteMarkerArrayCached($success,$markerArray,array(),array());	
		
	return $success;
	}

	function checkAccess($id)	{

		$access = 0;
		$query = 'SELECT tx_spdirectory_fegroup,tx_spdirectory_feuser FROM tt_address WHERE uid = '.$id;
                $res = mysql(TYPO3_db,$query);
		$row = mysql_fetch_assoc($res);
		if ($id == -1) {
			$access = t3lib_div::inList($GLOBALS['TSFE']->fe_user->user['usergroup'],$this->conf["default_fegroup"]);
		} else {
	                $access = t3lib_div::inList($GLOBALS['TSFE']->fe_user->user['usergroup'],$row[tx_spdirectory_fegroup]) || $GLOBALS['TSFE']->fe_user->user[uid]==$row[tx_spdirectory_feuser];
		}
	return $access;
	}

}



if (defined("TYPO3_MODE") && $TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["ext/sp_directory/pi1/class.tx_spdirectory_pi1.php"])	{
	include_once($TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["ext/sp_directory/pi1/class.tx_spdirectory_pi1.php"]);
}
?>

Kann mir hier jemand helen?

Ich danke im voraus für die unterstützung.

Mfg Mike

mike_sebaro ·

ja das weiß ich bereits, trotzdem danke für die Info.
Das ganze ist auch abgesichert, läuft auch nicht im Internet das ganze.

Aber leider hilft mir das bei meinem Problem nicht weiter.

mfg mike

einpraegsam.​net ·
mike_sebaro schrieb
$markerArray["###DROPDOWN###"] = $this->makeDropDownList($id,$row[pid],$row[zip]);

Schuss ins Blaue:

$markerArray["###DROPDOWN###"] = $this->makeDropDownList($id,$row['pid'],$row['phone']);
mike_sebaro ·

Hallo

hab das ganze jetzt mal in Phone geändert, Cache gelöscht etc leider wird das Dropdown feld immer noch mit den PLZ erstellt nicht mit den Telefonnummern.

Ne Idee dazu?

Ich danke im voraus.

Mfg Mike

einpraegsam.​net ·
mike_sebaro schrieb

leider wird das Dropdown feld immer noch mit den PLZ erstellt nicht mit den Telefonnummern.

Dann haben wir die falsche Zeile erwischt - ich müsste mich auch erstmal in das Ding einarbeiten...

mike_sebaro ·

hab in der zwischenzeit schon gesucht, allerdings find ich nirgends was, wo mit der dropdown boy zusammen hängt :-(

ich verzweifle noch!

einpraegsam.​net ·

Schau' dir mal diese Funktion genauer an:

function makeZIP($modifier,$value)      {
               
                $pidlist = $this->pi_getPidlist($this->conf["pidList"],$this->conf["recursive"]);

                $query = "SELECT DISTINCT zip FROM tt_address WHERE tt_address.pid IN (".$pidlist.")"." ".$this->cObj->enableFields(tt_address)." ORDER BY zip";
                $res = mysql(TYPO3_db,$query);
               
                while($tempo = mysql_fetch_assoc($res)) {
                        $entries .= '<option value="'.$this->makeLink("",liste,zip,$tempo[zip],$cache=1,$pointer=0).'"';
                        $entries .= ($tempo[zip]==$value&&$modifier==zip) ? ' selected style="color: '.$this->conf[active].'"' : "";
                        $entries .= '>'.$tempo[zip].'</option>';
                }
               
                $code="
               
                <script language=\"JavaScript\" type=\"text/JavaScript\">
                <!--
                function MM_jumpMenu(targ,selObj,restore){
              eval(targ+\".location='\"+selObj.options[selObj.selectedIndex].value+\"'\");
              if (restore) selObj.selectedIndex=0;
                }
                //-->
                </script>

                <table border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><form name=\"form1\">
              <tr>
             <td><select name=\"menu1\" onChange=\"MM_jumpMenu('self',this,0)\" class=\"tx_spdirectory-pi1-small\">
                <option value=\"".$this->pi_linkTP_keepPIvars_url("",1)."\">".$this->pi_getLL("zip")."</option>".$entries."
              </select></td>
              </tr></form></table>
               
                ";
       
        return $code;
       
        }
mike_sebaro ·

Hi

danke, das wars, habs jetzt soweit hinbekommen, dass die Liste aus den Nummern generiert wird, allerdings taucht jetzt das nächste Problem auf :-(

Wenn ich dann eine Nummer auswähle wird das ganze nicht verlinkt, sprich das suchergebnis tauch nicht auf :-(

Noch eine Idee dazu?

Ich danke dir!

Mfg