[TYPO3-german] Extension und relationen der Tabellen

hard.one - mphanke news- at -hardone-.-de
Thu Apr 19 14:53:54 CEST 2007


Hi,

das wichtigste findest du in der getfieldcontent-Funktion. Da werden die 
einzelnen Strings ausgeworfen.

Viel Spaß damit.

HTH

Martin

SOURCE :

function makelist($res)	{
		$items=array();
			// Make list table rows
		while($this->internal['currentRow'] = 
$GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))	{
			$items[]=$this->makeListItem();
		}
	
		$out = '<div'.$this->pi_classParam('listrow').'>
			'.implode(chr(10),$items).'
			</div>';
		return $out;
	}
	
	/**
	 * Implodes a single row from a database to a single line
	 *
	 * @return	Imploded column values
	 */
	function makeListItem()	{
	  $mailForm = '';
		$data = array(
		  "tx_pilmailform_pi1" => array(
			  "tavUID" => $this->getFieldContent('uid'),
			),
		);
		
		$mailForm = $this->pi_linkToPage($this->conf["mailformLabel"], 
$this->conf["mailformID"], '', $data);
		$callbackForm = $this->pi_linkToPage($this->conf["callbackLabel"], 
$this->conf["callbackID"], '', $data);

		$markerArray['###SALUTATION###']=$this->getFieldContent('salutation');
		$markerArray['###LASTNAME###']=$this->getFieldContent('last_name');
		$markerArray['###FIRSTNAME###']=$this->getFieldContent('first_name');
		$markerArray['###POS###']=$this->getFieldContent('position');
		$markerArray['###PHONE###']=$this->getFieldContent('fon');
		$markerArray['###FAX###']=$this->getFieldContent('fax');
		$markerArray['###EMAIL###']= $mailForm;
		$markerArray['###CALLBACK###']= $callbackForm;
		$markerArray['###DIVISION###']=$this->getFieldContent('division');
		$markerArray['###SUBDIVISION###']=$this->getFieldContent('subdivision');
		$markerArray['###LOCATION###']=$this->getFieldContent('location');
		$markerArray['###IMAGE###']=$this->getFieldContent('image');
//		$markerArray['###APPROACH###']=$this->getFieldContent('approach');

		$content = 
$this->cObj->substituteMarkerArrayCached($this->templateCode,$markerArray);
		$content.='<!-- ROW DATA -->';
		return $content;
	}


	function getFieldContent($fN)	{
		switch($fN) {
/*			case 'uid':
				return 
$this->pi_list_linkSingle($this->internal['currentRow'][$fN],$this->internal['currentRow']['uid'],1); 
// The "1" means that the display of single items is CACHED! Set to zero 
to disable caching.
			break;*/
			case 'salutation':
					 if(intval($this->internal['currentRow'][$fN]) == 0)
					   return 'Herr';
					 else	if(intval($this->internal['currentRow'][$fN]) == 1)
					   return 'Frau';
		  break;
			case 'position':
					 if(!count($this->DataPosition)){
					   $query = 'SELECT * FROM tx_hoemployees_position WHERE 
pid='.intval($this->conf['pidList']).$this->cObj->enableFields('tx_hoemployees_position');
						 $res = mysql(TYPO3_db, $query);
						
						 while($row = mysql_fetch_assoc($res)){
						 			$this->DataPosition[$row['uid']] = $row;
						 }

					 }
					 return 
$this->DataPosition[$this->internal['currentRow']['position']]['position'];
			break;
			case 'subdivision':
					 if(!count($this->DataSubDivision)){
					   $query = 'SELECT * FROM tx_hoemployees_subdivision WHERE 
pid='.intval($this->conf['pidList']).$this->cObj->enableFields('tx_hoemployees_subdivision');
						 $res = mysql(TYPO3_db, $query);
						
						 while($row = mysql_fetch_assoc($res)){
						 			$this->DataSubDivision[$row['uid']] = $row;
						 }

					 }
					 return 
$this->DataSubDivision[$this->internal['currentRow']['subdivision']]['subdivision'];
			break;
			case 'division':
					 if(!count($this->DataDivision)){
					   $query = 'SELECT * FROM tx_hoemployees_division WHERE 
pid='.intval($this->conf['pidList']).$this->cObj->enableFields('tx_hoemployees_division');
						 $res = mysql(TYPO3_db, $query);
						
						 while($row = mysql_fetch_assoc($res)){
						 			$this->DataDivision[$row['uid']] = $row;
						 }
					 }
				 	 return 
$this->DataDivision[$this->internal['currentRow']['division']]['division'];
			break;
			case 'location':
					 if(!count($this->DataLocation)){
					   $query = 'SELECT * FROM tx_hoemployees_city WHERE 
pid='.intval($this->conf['pidList']).$this->cObj->enableFields('tx_hoemployees_city');
						
						 $res = mysql(TYPO3_db, $query);
						
						 while($row = mysql_fetch_assoc($res)){
						 			$this->DataLocation[$row['uid']] = $row;
						 }
					 }
					 return 
$this->DataLocation[$this->internal['currentRow']['location']]['city'];
			break;
			case 'image':
				if($this->internal['currentRow'][$fN] != null)
				{
					return '<img 
src="/uploads/'.$this->prefixId.'/'.$this->internal['currentRow'][$fN].'" 
width="80" height="80">';
				}
				else
					return '';
			break;
			default:
				return $this->internal['currentRow'][$fN];
			break;
		}
	}


More information about the TYPO3-german mailing list