Zum Inhalt springen

cwt_feedit und checkbox

Erstellt am 24. April 2005 · 1 Antwort · letzte Antwort am 12. November 2005

Tags: Frage

jonny12 ·

Hallo Leute,
für eine Formular habe ich um es im FE zu editieren die EXT
cwt_feedit eingesetzt. Leider funktionieren checkboxen nicht. Weiß jemand ob und wie man es zum laufen bekommt?

Gruß
Thomas

stiwi ·

ich habe eben kurz checkbox-support eingebaut:
inhalt der neuen class.tx_cwtfeedit_pi1.php.

<?php
/***************************************************************
*  Copyright notice
*
*  (c) 2003 Sebastian Faulhaber (s.faulhaber@web-sol.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 'CWT Frontend Edit' for the 'cwt_feedit' extension.
 *
 * @author	Sebastian Faulhaber <s.faulhaber@web-sol.de>
 */


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

class tx_cwtfeedit_pi1 extends tslib_pibase {
	var $prefixId = "tx_cwtfeedit_pi1";		// Same as class name
	var $scriptRelPath = "pi1/class.tx_cwtfeedit_pi1.php";	// Path to this script relative to the extension dir.
	var $extKey = "cwt_feedit"; // The extension key.
	var $table = null; //Holds the table name.
	var $items = null; //Holds information about the columns to render
	var $record_uid = null; //Holds the uid of the record, that
	var $cruser_id = null; //Hold the fe user uid.
	var $back_pid = null; //Holds the pid of the page the user will be sent back to
	var $back_values = null; //Values, which will be appended to all back links
	var $parent_class = null; //A reference to the calling class, from which this class is instantiated.
	var $mode = "VIEW_EDITPROFILE"; //Decides how the  form is rendered. Possible values are "VIEW_EDITPROFILE", "VIEW_EDITPROFILE_PREVIEW" ,"VIEW_EDITPROFILE_RESULT", "VIEW_EDITPROFILE_ERROR"
	var $cObj = null; //
	var $debug = false; //If true, then debug messages appear in the frontend. For developing purposes only.
    var $fileFunc = null;

	var $lasterror=""; // added by F.Rakow, Store some Default Error Text
	//DB relation support added by Mikael Conley, Wildside

	/*
	*  Constructor
	*
	*  @param	 $items	   Information about the fields to integrate. Here is an example:
	*					$items["username"]["label"] = "Username:";
	*					$items["username"]["helptext"] = "All characters and numbers are allowed.";
	*					$items["username"]["error_msg"] = "Please specify a valid username!";
	*					$items["username"]["eval_func"] = "checkRequired"; (more evaluation methods will be supported in future releases.)
	*  @param	 $record_uid UID of the record that should be edited.
	*  @param	 $cruser_id UID of the feuser, who wants to edit the record
	*  @param	 $back_pid PID of the page, the user will be sent back to e.g. "45"
	*  @param	 $back_values Values, that are appended to the back link. e.g. array("action" => "showall", "myVar" => "myValue")
	*  @param	 $parent_class A reference to the calling class, from which this class is instantiated.
	*  @param	 $ext_keys Extension keys for ext's that extend the table we are working on. (must be an array!)
	*  @return null
	*/
	function tx_cwtfeedit_pi1($table, $items, $record_uid, $cruser_id, $back_pid, $back_values, &$parent_class, $ext_keys) {
        // Call Constructor!!. Needed for the display of the correct language values, according to typoscript settings!
		$this->tslib_pibase();
		//Load TCA for table
		t3lib_div::loadTCA($table);
		//Merge TCA form $ext_keys
		$this->mergeExtendingTCAs($ext_keys);
		// Initialize new cObj
		$cObj = t3lib_div :: makeInstance("tslib_cObj");
        //Initialize fileFunc object
        $fileFunc = t3lib_div::makeInstance("t3lib_basicFileFunctions");

		//Assign items to global.
		$this->table = $table;
		$this->items = $items;
		$this->record_uid = $record_uid;
		$this->cruser_id = $cruser_id;
		$this->back_pid = $back_pid;
		$this->back_values = $back_values;
		$this->parent_class = $parent_class;
		$this->cObj = $cObj;
        $this->fileFunc = $fileFunc;

		//Some debugging output
		if ($this->debug) {
			//t3lib_div::print_array($items);
			t3lib_div::print_array($GLOBALS['HTTP_POST_VARS'][$this->prefixId]);
			t3lib_div::print_array($_FILES);
            t3lib_div::print_array($this->items);
		}

		//Load Local Language values
		$this->pi_setPiVarDefaults();
		$this->pi_loadLL();

		/*
		* CONTROLLER
		*/
		//Decide, which form mode to use.
		$isSubmitted = false;
		$isSubmitted = $this->checkForSubmit();
		if ($isSubmitted) {
			//Get type of submit "PREVIEW", "DELETE" or "RESULT"
			$type = $this->getTypeOfSubmit();
			if ($type == "PREVIEW"){
				//Check all constraints
				//OKAY --> Preview mode
				if ($this->checkConstraintsAll($this->items)){
					$this->mode = "VIEW_EDITPROFILE_PREVIEW";
					if ($this->debug){ echo "Entering VIEW_EDITPROFILE_PREVIEW...<br>";}
				}
				//NOT OKAY --> Edit error mode
				else{
					$this->mode = "VIEW_EDITPROFILE_ERROR";
					if ($this->debug){ echo "Entering VIEW_EDITPROFILE_ERROR...<br>";}
				}
			}
			elseif($type == "DELETE"){
				//Set form mode
				$this->mode = "VIEW_EDITPROFILE";
				if ($this->debug){ echo "Entering VIEW_EDITPROFILE (DELETE)...<br>";}
			}
			elseif($type == "RESULT"){
				//Set form mode
				$this->mode = "VIEW_EDITPROFILE_RESULT";
				//Do the databasequery
				$res = $this->updateDatabaseRecord($this->items);
				if ($this->debug){ echo "Entering VIEW_EDITPROFILE_RESULT...<br>";}
			}
		}
		else{
			//Set form mode
			$this->mode = "VIEW_EDITPROFILE";
			if ($this->debug){ echo "Entering VIEW_EDITPROFILE...<br>";}
		}
		//Return
		return null;
	}

	/* getElement($item_key="column")
	*
	*  Gets the html Code for a specific form item.
	*
	*  @param  $item_key  Fetches HTML for this item. Must be in format: "column"
	*					e.g. "username"
	*  @return String The html code for the form item.
	*/
	function getElement($item_key="column") {
		global $TYPO3_LOADED_EXT;
		//Html, that will be returned
		$code = null;
		//Get the item from global
		$item = $this->items[$item_key];
		//Check form mode and decide what to do
		$mode = $this->mode;
		//Get field information from TCA
		$TCA = $GLOBALS["TCA"][$this->table]["columns"][$item_key];
		//Get type of field
		$type = $TCA["config"]["type"];


        // *********************
        // added by F.Rakow
		$twice=false;

		// Test eval_functions
		$eval_functions = explode(",", $TCA["config"]["eval"]);
		//Add individual eval functions from the items Array
		if (isset($this->items[$item_key]["eval"])) {
			$eval_functions = array_merge($eval_functions, explode(",", $this->items[$item_key]["eval"]));
		}
		if (is_array($eval_functions))	{
			reset($eval_functions);

			while(list(,$cmd)=each($eval_functions))	{
				$cmdParts = split("\[|\]",$cmd);	// Point is to enable parameters after each command enclosed in brackets [..]. These will be in position 1 in the array.
				$theCmd = trim($cmdParts[0]);
				switch($theCmd)	{
					case "twice":
						$twice=true;
					break;
				}
			}
		}
        // if set then no editmode for this field!!
        if ($item["type"]=="preview") {
            if ($mode == "VIEW_EDITPROFILE"){
                $mode="VIEW_EDITPROFILE_PREVIEW";
            }
        }
		// **********************

		if ($mode == "VIEW_EDITPROFILE" || $mode == "VIEW_EDITPROFILE_ERROR"){
			// added by F.Rakow, password mode
			if ($type == "input" || $item["type"]=="password") {
				$code .= "<tr>";
				//Required indicator
				if ($this->checkIsRequired($item_key)){
					$code .= '<th valign="top" align="left">*</th>';
				}
				else{
					$code .= '<th valign="top" align="left"></th>';
				}
				$code .= '<th valign="top" align="left">'.$item["label"].'</th>';
				$code .= '<td valign="top"><input name="'.$this->prefixId."[".$item_key."]".'" type="'.($item["type"]=="password"?"password":"text").'" size="'.$TCA["config"]["size"].'" maxlength="'.$TCA["config"]["max"].'" value="'.$this->fetchValueFromItem($item_key).'"><br><small>'.$item["helptext"].'</small></td>';
				$code .= "</tr>";

			    // *********************
		        // added by F.Rakow, for password fields!!
				if ($twice) {
					$code .= "<tr>";
					//Required indicator
					if ($this->checkIsRequired($item_key)){
						$code .= '<th valign="top" align="left">*</th>';
					}
					else{
						$code .= '<th valign="top" align="left"></th>';
					}
					$code .= '<th valign="top" align="left">'.($item["label_again"]?$item["label_again"]:$item["label"]).'</th>';
					$code .= '<td valign="top"><input name="'.$this->prefixId."[".$item_key."_again]".'" type="'.($item["type"]=="password"?"password":"text").'" size="'.$TCA["config"]["size"].'" maxlength="'.$TCA["config"]["max"].'" value="'.$this->fetchValueFromItem($item_key."_again").'"><br><small>'.($item["helptext_again"]?$item["helptext_again"]:$item["helptext"]).'</small></td>';
					$code .= "</tr>";
				}
				// *********************

				//In case of "VIEW_EDITPROFILE_ERROR" append error row
				if ($mode == "VIEW_EDITPROFILE_ERROR" && !$this->checkConstraints($item_key)){
					$code .= "<tr>";
					$code .= "<td></td>";
					$code .= '<td colspan="2"><small><font color="red">'.($this->lasterror?$this->lasterror:$this->items[$item_key]["error_msg"]).'</font></small></td>';
					$code .= "</tr>";
				}
				
				//Return
				return $code;
			}
			elseif ($type == "select"){
			  $code .= "<tr>";
			  $code .= '<th valign="top" align="left"></th>';
			  $code .= '<th valign="top" align="left">'.$item["label"].'</th>';
			  $code .= '<td valign="top"><SELECT name="'.$this->prefixId."[".$item_key."]".'">';
			  //Generate Select items
			  if (!$TCA["config"]["foreign_table"]){
				  for ($i=0; $i < sizeof($TCA["config"]["items"]); $i++){
					//Check for selected
					if ($TCA["config"]["items"][$i][1] == $this->fetchValueFromItem($item_key)) {
						//Output selected
						$code .= '<option value="'.$TCA["config"]["items"][$i][1].'" selected>'.$this->getLLFromString($TCA["config"]["items"][$i][0]).'</option>';
					}
					else{
						//Output not selected
						$code .= '<option value="'.$TCA["config"]["items"][$i][1].'">'.$this->getLLFromString($TCA["config"]["items"][$i][0]).'</option>';
					}
				  }
			  }else{
			  		//Added by Mikael Conley, Wildside
			  		$query = 'SELECT * FROM '.$TCA[config][foreign_table].' '.$TCA[config][foreign_table_where];			  		
			  	  	$rows = $this->doDatabaseQuery($query);
			  	  	$foreignId = $this->fetchValueFromItem($item_key);
			  	  	foreach ($rows as $row){
			  	  		//Check for selected			  	  					  	  		
			  	  		if ($row[uid] == $foreignId){			  	  			
			  	  			//Output selected
							$code .= '<option value="'.$row[uid].'" selected>'.$this->getDBLabel($row, $TCA).'</option>';
						}else{
							//Output not selected
							$code .= '<option value="'.$row[uid].'">'.$this->getDBLabel($row, $TCA).'</option>';
						}
			  	  	}
			  }
			  $code .= "</SELECT><br><small>".$item["helptext"]."</small></td>";
			  $code .= "</tr>";

			  //In case of "VIEW_EDITPROFILE_ERROR" append error row
			  if ($mode == "VIEW_EDITPROFILE_ERROR" && !$this->checkConstraints($item_key)){
				 $code .= "<tr>";
				 $code .= "<td></td>";
				 $code .= '<td colspan="2"><small><font color="red">'.($this->lasterror?$this->lasterror:$this->items[$item_key]["error_msg"]).'</font></small></td>';
				 $code .= "</tr>";
			  }

			  //Return
			  return $code;
			}
			elseif ($type == "text"){
			  $code .= "<tr>";
			  $code .= '<th valign="top" align="left"></th>';
			  $code .= '<th valign="top" align="left">'.$item["label"].'</th>';
			  $code .= '<td valign="top"><TEXTAREA name="'.$this->prefixId."[".$item_key."]".'" rows="'.$TCA["config"]["rows"].'" cols="'.$TCA["config"]["cols"].'">'.$this->fetchValueFromItem($item_key).'</textarea><br><small>'.$this->items[$item_key]["helptext"].'</small></td>';

			  //In case of "VIEW_EDITPROFILE_ERROR" append error row
			  if ($mode == "VIEW_EDITPROFILE_ERROR" && !$this->checkConstraints($item_key)){
				 $code .= "<tr>";
				 $code .= "<td></td>";
				 $code .= '<td colspan="2"><small><font color="red">'.($this->lasterror?$this->lasterror:$this->items[$item_key]["error_msg"]).'</font></small></td>';
				 $code .= "</tr>";
			  }

			  //Return
			  return $code;
			}
			elseif ($type == "group" && $TCA["config"]["internal_type"] == "file"){
			  //Fetch filenames from database
			  $filenames = $this->fetchValuesForFiles($item_key);

			  //Get number of input fields
			  $size = $TCA["config"]["maxitems"];
			  $number = $size - sizeof($filenames);

			  //Get directory where the files reside
			  $dir = t3lib_div::getIndpEnv('TYPO3_SITE_URL').$TCA["config"]["uploadfolder"];

			  //Start creating the code
			  $code .= "<tr>";
			  $code .= '<th valign="top" align="left"></th>';
			  $code .= '<th valign="top" align="left">'.$item["label"].'</th>';
			  $code .= '<td valign="top">';

			  //Display filenames and create hidden fields for the value
			  for($i = 0; $i < sizeof($filenames); $i++){
			  	  /*
				  //TODO:Get file icon
				  $fI = pathinfo($filenames[$i]["name"]);
				  $fileIcon = '<img src="'.t3lib_div::getIndpEnv('TYPO3_SITE_URL').'typo3/gfx/fileicons/'.strtolower($fI['extension']).'.gif" width="18" height="16" alt=""/>';
				 */
				  //...
				  $code .= $fileIcon."&nbsp;&nbsp;".$filenames[$i]["name"]."&nbsp;&nbsp;".'<input type="image" src="'.$TYPO3_LOADED_EXT["cwt_feedit"]["siteRelPath"].'pi1/icon_delete.gif" name="'.$this->prefixId.'[submit_delete]['.$i.'] value="'.$this->pi_getLL("icon_delete").'">&nbsp;&nbsp;<small><a href="'.$dir."/".$filenames[$i]["name"].'" target="_blank">'.$this->pi_getLL("file_view").'</a></small><br>';
				  $code .= '<input type="hidden" name="'.$this->prefixId."[".$item_key."][".$i."][name]".'" value="'.$filenames[$i]["name"].'">';			  
				}
			  
			  //Display input fields
			  for($i = sizeof($filenames); $i < $number + sizeof($filenames); $i++){
				  $code .= '<input name="'.$this->prefixId."[".$item_key."][".$i."]".'" type="file"><br>';
			  }
			  $code .= "<small>".$this->items[$item_key]["helptext"]."</small></td>";

			  //In case of "VIEW_EDITPROFILE_ERROR" append error row
			  if ($mode == "VIEW_EDITPROFILE_ERROR" && !$this->checkConstraints($item_key)){
				 $code .= "<tr>";
				 $code .= "<td></td>";
				 $code .= '<td colspan="2"><small><font color="red">'.($this->lasterror?$this->lasterror:$this->items[$item_key]["error_msg"]).'</font></small></td>';
				 $code .= "</tr>";
			  }

			  //Return
			  return $code;			
			}

			// Checkboxupdate 2005.11.12
			// Stephan Diehl
			
			elseif ($type == "check") {
			  $code .= "<tr>";
			  $code .= '<th valign="top" align="left"></th>';
			  $code .= '<th valign="top" align="left">'.$item["label"].'</th>';
//			  $code .= '<td valign="top"><TEXTAREA name="'.$this->prefixId."[".$item_key."]".'" rows="'.$TCA["config"]["rows"].'" cols="'.$TCA["config"]["cols"].'">'.$this->fetchValueFromItem($item_key).'</textarea><br><small>'.$this->items[$item_key]["helptext"].'</small></td>';
			  $code .= '<td valign="top"><input type="checkbox" name="'.$this->prefixId."[".$item_key."]".'" '.($this->fetchValueFromItem($item_key)?'checked':'').'><br><small>'.$this->items[$item_key]["helptext"].'</small></td>';

			  //In case of "VIEW_EDITPROFILE_ERROR" append error row
			  if ($mode == "VIEW_EDITPROFILE_ERROR" && !$this->checkConstraints($item_key)){
				 $code .= "<tr>";
				 $code .= "<td></td>";
				 $code .= '<td colspan="2"><small><font color="red">'.($this->lasterror?$this->lasterror:$this->items[$item_key]["error_msg"]).'</font></small></td>';
				 $code .= "</tr>";
			  }

			  //Return
			  return $code;
			}
		}
		elseif ($mode == "VIEW_EDITPROFILE_PREVIEW"){
			if ($type == "input"){
				$code .= "<tr><td></td>";
				$code .= "<th valign=\"top\" align=\"left\">".$item["label"]."</th>";
				// Added by F.Rakow, password mode
				$code .= "<td>".($item["type"]=="password"?"*****":$this->fetchValueFromItem($item_key));
				$code .= '<input type="hidden" name="'.$this->prefixId."[".$item_key."]".'" value="'.$this->fetchValueFromItem($item_key).'">'."</td>";
				$code .= "</tr>";
			}
			elseif ($type == "select"){
				
				if (!$TCA["config"]["foreign_table"]){
					$code .= "<tr><td></td>";
					$code .= "<th valign=\"top\" align=\"left\">".$item["label"]."</th>";
					$code .= "<td>".$this->getLLFromString($TCA["config"]["items"][$this->fetchValueFromItem($item_key)][0]);
					$code .= '<input type="hidden" name="'.$this->prefixId."[".$item_key."]".'" value="'.$this->fetchValueFromItem($item_key).'">'."</td>";
					$code .= "</tr>";
				}else{
					// added by Mikael Conley, Wildside
					$query = 'SELECT * FROM '.$TCA[config][foreign_table].' WHERE uid = '.intval($this->fetchValueFromItem($item_key));
			  	  	$rows = $this->doDatabaseQuery($query);
			  	  	$code .= "<tr><td></td>";
					$code .= "<th valign=\"top\" align=\"left\">".$item["label"]."</th>";
					$code .= "<td>".$this->getDBLabel($rows[0], $TCA);
					$code .= '<input type="hidden" name="'.$this->prefixId."[".$item_key."]".'" value="'.$this->fetchValueFromItem($item_key).'">'."</td>";
					$code .= "</tr>";
				}
			}
			elseif ($type == "text"){
				$code .= "<tr><td></td>";
				$code .= "<th valign=\"top\" align=\"left\">".$item["label"]."</th>";
				$code .= "<td>".$this->fetchValueFromItem($item_key);
				$code .= '<input type="hidden" name="'.$this->prefixId."[".$item_key."]".'" value="'.$this->fetchValueFromItem($item_key).'">'."</td>";
				$code .= "</tr>";
			}
			elseif ($type == "group" && $TCA["config"]["internal_type"] == "file"){
			  //Fetch information on files
			  $files = $this->fetchValuesForFiles($item_key);
			  //Do the rest
			  $code .= "<tr><td></td>";
			  $code .= "<th valign=\"top\" align=\"left\">".$item["label"]."</th>";
			  $code .= '<td valign="top">';
			  for($i = 0; $i < sizeof($files); $i++){
				$code .= $files[$i]["name"]."<br>";
			  }
			  
			  //Generate Hidden fields
			  for($i = 0; $i < sizeof($files); $i++){
				$code .= '<input type="hidden" name="'.$this->prefixId."[$item_key][$i][name]".'" value="'.$files[$i]["name"].'">';
				$code .= '<input type="hidden" name="'.$this->prefixId."[$item_key][$i][type]".'" value="'.$files[$i]["type"].'">';
				$code .= '<input type="hidden" name="'.$this->prefixId."[$item_key][$i][tmp_name]".'" value="'.$files[$i]["tmp_name"].'">';												
				$code .= '<input type="hidden" name="'.$this->prefixId."[$item_key][$i][size]".'" value="'.$files[$i]["size"].'">';				
			  }
			  $code .= "</td>";
			}

			// Checkboxupdate 2005.11.12
			// Stephan Diehl
			
			elseif ($type == "check") {
				$code .= "<tr><td></td>";
				$code .= "<th valign=\"top\" align=\"left\">".$item["label"]."</th>";
				$code .= "<td>".($this->fetchValueFromItem($item_key)=="on"?"Ja":"Nein");
				$code .= '<input type="hidden" name="'.$this->prefixId."[".$item_key."]".'" value="'.$this->fetchValueFromItem($item_key).'">'."</td>";
				$code .= "</tr>";
			}
			return $code;
		}
		//Return
		return null;
	}
	
	
	/* getDbLabel($row){	
	*
	*  Gets the lables of the chosen table from the global TCA.
	*
	*  @return String with the label and alt label.
	*/
	function getDbLabel($row, $TCA){	
		// Added by Mikael Conley, Wildside
		$GTCActrl = $GLOBALS["TCA"][$TCA[config][foreign_table]][ctrl];		
		$label = $row[$GTCActrl["label"]];
		if ($GTCActrl["label_alt"]){
			$label .= ', '.$row[$GTCActrl["label_alt"]];
		}		
		return $label;		
	}

	/* getFormHeader()
	*
	*  Gets the html Code for the form header.
	*
	*  @return String The html code for the form item.
	*/
	function getFormHeader() {
		//HTML that will be returned
		$code = null;
		//Check form mode and decide what to do
		$mode = $this->mode;
		//Create form header
		if ($mode == "VIEW_EDITPROFILE" || $mode == "VIEW_EDITPROFILE_ERROR" || $mode == "VIEW_EDITPROFILE_PREVIEW" ){
				$code .= '<form action="" method="POST" enctype="multipart/form-data">';
		}
		elseif ($this->mode == "VIEW_EDITPROFILE_RESULT"){

		}
		//Return
		return $code;
	}

	/* getFormFooter()
	*
	*  Gets the html Code for the form footer.
	*
	*  @return String The html code for the form item.
	*/
	function getFormFooter() {
		//HTML that will be returned
		$code = null;
		//Check form mode and decide what to do
		$mode = $this->mode;
		//Display Buttons
		if ($mode == "VIEW_EDITPROFILE" || $mode == "VIEW_EDITPROFILE_ERROR"){
			$code .= "<tr>";
			$code .= '<td colspan="3">';
			$code .= '<INPUT name="'.$this->prefixId."[".$this->pi_getLL("submit_name")."]".'" TYPE="SUBMIT" value="'.$this->pi_getLL("submit_value").'">';
			$code .= '<INPUT name="cancel" TYPE="BUTTON" value="'.$this->pi_getLL("back_value").'" onClick="location.replace(\''.$this->parent_class->pi_getPageLink($this->back_pid,"", $this->back_values).'\')">';
			$code .= "</td>";
			$code .= "</tr>";
			$code .= "</form>";
		}
		elseif ($mode == "VIEW_EDITPROFILE_PREVIEW"){
			$code .= "<tr>";
			$code .= '<td colspan="3">';
			$code .= '<INPUT name="'.$this->prefixId."[".$this->pi_getLL("submit_preview_name")."]".'" TYPE="SUBMIT" value="'.$this->pi_getLL("submit_preview_value").'">';
			$code .= '<INPUT name="cancel" TYPE="BUTTON" value="'.$this->pi_getLL("back_value").'" onClick="location.replace(\''.$this->parent_class->pi_getPageLink($this->back_pid,"", $this->back_values).'\')">';
			$code .= "</td>";
			$code .= "</tr>";
			$code .= "</form>";
		}
		elseif ($mode == "VIEW_EDITPROFILE_RESULT"){
			$code .= $this->pi_getLL("result_text")."<br>";
			$code .= '<a href="'.$this->parent_class->pi_getPageLink($this->back_pid,"", $this->back_values).'">'.$this->pi_getLL("result_back").'</a>';
		}

		//Return
		return $code;
	}

	/* checkForSubmit()
	*
	*  Checks, if the user has submitted the form.
	*
	*  @return Boolean
	*/
	function checkForSubmit() {
		//Get the post vars from globals
		$submit = $GLOBALS['HTTP_POST_VARS'][$this->prefixId]["submit"];
		$submit_preview = $GLOBALS['HTTP_POST_VARS'][$this->prefixId]["submit_preview"];
		$submit_result = $GLOBALS['HTTP_POST_VARS'][$this->prefixId]["submit_result"];
		if ($submit != null || $submit_preview != null || $submit_result != null) {

			//Debug
			if ($this->debug){
				echo "Submit value: ".$submit.$submit_preview.$submit_result."<br>";
			}
			return true;
		}
		else{
			return false;
		}
	}

	/* getTypeOfSubmit()
	*
	*  Get type of submit: "PREVIEW", "DELETE" or "RESULT"
	*
	*  @return String Type of submit.
	*/
	function getTypeOfSubmit() {
		//Get the post vars
		$submit = $GLOBALS['HTTP_POST_VARS'][$this->prefixId]["submit"];
		$submit_preview = $GLOBALS['HTTP_POST_VARS'][$this->prefixId]["submit_preview"];
		$submit_delete = $GLOBALS['HTTP_POST_VARS'][$this->prefixId]["submit_delete"];
		//Check the vars
		//User wants PREVIEW
		if ($submit != null){
		   return "PREVIEW";
		}
		//user wants RESULT
		elseif ($submit_preview != null){
		   return "RESULT";
		}
		elseif($submit_delete != null){
			return "DELETE";

		}
		//Return
		return null;
	}

	/* checkConstraints($item_key)
	*
	*  Checks the contraints for a given $this->items with the defined eval function of the
	*  item.
	*  @param $item_key The item key e.g. "username"
	*  @return Boolean true if constraints are okay, otherwise false.
	*/
	function checkConstraints($item_key) {
		$this->lasterror="";
		$twice=(substr($item_key,-6)=="_again");
		if ($twice) {
			return true;
		}
		//Get the value from post vars
		$item_value = $GLOBALS['HTTP_POST_VARS'][$this->prefixId][$item_key];
		//Get field information from TCA
		$TCA = $GLOBALS["TCA"][$this->table]["columns"][$item_key];
		//Get eval functions
		$eval_functions = explode(",", $TCA["config"]["eval"]);
		//Add individual eval functions from the items Array
		if (isset($this->items[$item_key]["eval"])) {
			$eval_functions = array_merge($eval_functions, explode(",", $this->items[$item_key]["eval"]));
		}
		//IN case we are dealing with files
		if ($TCA["config"]["type"] == "group" && $TCA["config"]["internal_type"] == "file" && $_FILES[$this->prefixId]["name"][$item_key] != null) {
			//check the constraints for all files of the group
			$keys = array_keys($_FILES[$this->prefixId]["name"][$item_key]);
			for($i = 0; $i < sizeof($_FILES[$this->prefixId]["name"][$item_key]); $i++){
				//Check the php error value
				if (!$this->evalFileError($_FILES[$this->prefixId]["error"][$item_key][$keys[$i]])) {
					return false;
				}
				//Check if the filesize is okay
				if (!$this->evalFileSize($_FILES[$this->prefixId]["size"][$item_key][$keys[$i]], $TCA["config"]["max_size"])) {
					return false;
				}
				//Check, if the file type is okay
				if (!$this->evalFileType($_FILES[$this->prefixId]["name"][$item_key][$keys[$i]], $TCA["config"]["allowed"])) {
					return false;
				}
			}

		}
		//Check constraints for item
		for ($i=0; $i < sizeof($eval_functions); $i++){
			//added some usefull functions, based on the fe_adminLib.inc, F.Rakow
			//Call the different eval functions
			$cmdParts = split("\[|\]",$eval_functions[$i]);	// Point is to enable parameters after each command enclosed in brackets [..]. These will be in position 1 in the array.
			$theCmd = trim($cmdParts[0]);
			switch($theCmd) {

				case "required":
					if (!$this->evalRequired($item_value)){
						  return false;
					}
				break;
			 	case "date":
					if (!$this->evalDate($item_value)){
						return false;
					}
				break;
				case "uniqueInPid":
				break;
				case "twice":
					if (strcmp($item_value, $GLOBALS['HTTP_POST_VARS'][$this->prefixId][$item_key."_again"]))	{
						$this->lasterror=$this->pi_getLL("error_twice","You must enter the same value twice");
						return false;
					}
				break;
				case "email":
					if (!$this->cObj->checkEmail($item_value))	{
						$this->lasterror=$this->pi_getLL("error_email","You must enter a valid email address");
						return false;
				}
				break;
				case "atLeast":
					$chars=intval($cmdParts[1]);
					if (strlen($item_value)<$chars)	{
						$this->lasterror=sprintf($this->pi_getLL("error_atLeast","You must enter at least %s characters!"), $chars);
						return false;
					}
				break;
				case "atMost":
					$chars=intval($cmdParts[1]);
					if (strlen($item_value)>$chars)	{
						$this->lasterror=sprintf($this->pi_getLL("error_atMost","You must enter at most %s characters!"), $chars);
						return false;
					}
				break;
				case "inBranch":
					$pars = explode(";",$cmdParts[1]);
					if (intval($pars[0]))	{
						$pid_list = $this->cObj->getTreeList(
							intval($pars[0]),
							intval($pars[1]) ? intval($pars[1]) : 999,
							intval($pars[2])
						);
						if (!$pid_list || !t3lib_div::inList($pid_list,$item_value))	{
							$this->lasterror=sprintf($this->pi_getLL("error_inBranch","The value was not a valid value from this list: %s"), $pid_list);
							return false;
						}
					}
				break;
			}
		}
		//Return true / false
		return true;
	}

	/* checkConstraintsAll()
	*
	*  Checks if the constrints of all items from $this->items are okay and then results
	*  true or false.
	*  @return Boolean true if constraints are okay, otherwise false.
	*/
	function checkConstraintsAll($items) {
		//Check constraints for items
		for ($i=0; $i < sizeof($items); $i++){
			 //Get the item key
			 $item_key = array_keys($items);
			 $item_key = $item_key[$i];
			 if (!$this->checkConstraints($item_key)){
				  return false;
			 }
		}
		//Return true / false
		return true;
	}

	/* evalRequired($value)
	*
	*	Check if the required value is empty or not.
	*/
	function evalRequired($value) {
		//Check the constraint
		if ($value == null){
			return false;
		}
		else{
			 return true;
		}
	}

	/* evalDate($value)
	*
	*  Check if the value is a correct date.
	*/
	function evalDate($value) {
		//Check the constraint
		if (($timestamp = strtotime($value)) === -1) {
			 //Debug
			 if ($this->debug){
				 echo "'".$value."' is no valid Date!";
			 }
			return false;
		}
		else{
			 return true;
		}
	}

	/* evalFileSize($value)
	*
	*	Check if the size of a file is okay.
	*/
	function evalFileSize($value, $allowed_size) {
		//Value is given in bytes so divide by 1000
		$value = $value / 1000;
		//Check the constraint
		if ($value <= $allowed_size){
			return true;
		}
		else{
			 if ($this->debug) {echo "File size exceeds maximum.<br>";}
			 return false;
		}
	}

	/* evalFileError($error_code)
	*
	*	Check the error value from the $_FILES array.
	*/
	function evalFileError($error_code) {
		if ($this->debug) {echo "File error: ".$error_code;}
		//Value is given in bytes so divide by 1000
		if ($error_code == "0") {
			if ($this->debug) {echo "File upload okay.";}
			return true;
		}
		elseif ($error_code == "1"){
			if ($this->debug) {echo "filesize exceeds upload_max_filesize in php.ini!";}
			return false;
		}
		elseif ($error_code == "3"){
			if ($this->debug) {echo "The file was uploaded partially!";}
			return false;
		}
		elseif ($error_code == "4"){
			if ($this->debug) {echo "No file was uploaded!";}
			return true;
		}
		else{
			return true;
		}
	}

	/* evalFileType($filename,$types)

	*
	*	Check if the filename is allowed
	*/
	function evalFileType($filename,$types) {
		//Validate input vars
		if ($filename == null || $filename == ""){
			//No file given, so return true
			return true;
		}
		//Explode the filename
		$filename = explode(".", $filename);
		$type = $filename[sizeof($filename)-1];
		$type = strtolower($type);
		//Create the type array from tca value
		$types = explode(",", $types);
		//Check if in array
		if (in_array($type, $types)) {
			return true;
		}
		else{
			return false;
		}
	}
	function checkIsRequired($item_key="column"){
		//Load TCA for item
		$table = $this->table;
		$label = $item_key;
		t3lib_div::loadTCA($table);
		$TCA = $GLOBALS["TCA"][$table]["columns"][$label]["config"]["eval"];
		$TCA = explode(",", $TCA);
		if (in_array("required", $TCA)){
			return true;
		}
		else{
			 return false;
		}
	}

	/*	cleanFilename($filename)
	*
	*	Returns a string where any character not matching [a-zA-Z0-9_-] is substituted by "_"
	*
	*	@param	 $filename	String, that should be cleaned. e.g. 'My File.doc'
	*	@return	 $filename	String. e.g. 'My_File.doc'
	*/
	function cleanFilename($filename) {
        //The cleaning function comes from 'class.t3lib_basicfilefunc.php'
        $filename = $this->fileFunc->cleanFilename($filename);
		return $filename;
	}

	/*	makeFilenameUnique($filename)
	*
	*  Makes the filename unique by appending a timestamp. (Considering, that one fe_user
    *  can only edit one field at the same time, the filename is really unique.)
	*  @param	 $filename  The filename without slashes and directory! e.g. 'MyFile.doc'
	*  @return	 $filename  The filename with an appended timestamp. e.g. 'MyFile_1038737318.doc'
	*/
	function makeFilenameUnique($filename) {
		//Get timestamp
		$hash = time();
		//Explode it by '.'
		$filename = explode(".",$filename);
		//
		$filename = $filename[0]."_".$hash.".".$filename[1];
		return $filename;
	}

	/* getLLFromString($string)
	*
	*  Fetches the local language value from a given string.
	*  @param $string Must be in format: "LLL:EXT:cwt_community/locallang_db.php:tx_cwtcommunity_guestbook.status.I.0"
	*  @return String Local Language Value
	*/
	function getLLFromString($string){
		$string = explode(":", $string);
		$pathToFile = $string[1].":".$string[2];
		$ll_key = $string[3];
		//Read file
		$LOCAL_LANG = $this->readLLfile($pathToFile);
		return $this->getLLL($ll_key, $LOCAL_LANG);  
	}

        /**
        * Reads local lang files. This function was copied from 'tslib_fe' for
        * Typo3 3.6 compatibility reasons.
        */
        function readLLfile($fileRef)        {
                $file = t3lib_div::getFileAbsFileName($fileRef);
                if (@is_file($file))        {
                        include($file);
                }
                return is_array($LOCAL_LANG)?$LOCAL_LANG:array();
        }

     /**
     * Returns 'locallang' label This function was copied from 'tslib_fe' for
     * Typo3 3.6 compatibility reasons.
     */
     function getLLL($index,$LOCAL_LANG)        {
			 //Changed by Alwin Viereck 06.07.05
             if ($GLOBALS["TSFE"]->config["config"]["language"])        {
                     return $LOCAL_LANG[$GLOBALS["TSFE"]->config["config"]["language"]][$index];
             } else {
                     return $LOCAL_LANG["default"][$index];
             }
     }
		

	/* fetchValueFromItem($item_key)
	*
	*  Fetches the value of an item_key from database, if in "VIEW_EDITPROFILE" mode.
	*  From post vars, if in "VIEW_EDITPROFILE_ERROR" or "VIEW_EDITPROFILE_PREVIEW" mode.
	*
	*/
	function fetchValueFromItem($item_key){
		if ($this->mode == "VIEW_EDITPROFILE" && $GLOBALS['HTTP_POST_VARS'][$this->prefixId]["submit_delete"] == null){

			// Check for eval_function twice
			$twice=(substr($item_key,-6)=="_again");
			if ($twice) {
				$item_key=substr($item_key,0,-6);
			}
			//Do the query
			if ($this->debug){ echo "Fetching values from DATABASE...<br>";}			
			$res = $this->doDatabaseQuery("SELECT ".$item_key." FROM ".$this->table." WHERE uid=".intval($this->record_uid));
			$res = $res[0][$item_key];
			
		}
		elseif($this->mode == "VIEW_EDITPROFILE" && $GLOBALS['HTTP_POST_VARS'][$this->prefixId]["submit_delete"] != null){
			if ($this->debug){ echo "Fetching values from POST VARS...<br>";}
			 $res = $GLOBALS['HTTP_POST_VARS'][$this->prefixId][$item_key];
		}
		elseif ($this->mode == "VIEW_EDITPROFILE_ERROR" || $this->mode == "VIEW_EDITPROFILE_PREVIEW" || $this->mode == "VIEW_EDITPROFILE_RESULT"){
			if ($this->debug){ echo "Fetching values from POST VARS...<br>";}
			 $res = $GLOBALS['HTTP_POST_VARS'][$this->prefixId][$item_key];
		}
		//Return
		return $res;
	}
	
	/* fetchValuesForFiles($item_key)
	* 
	*  [Description]
	*
	*/
	function fetchValuesForFiles($item_key){
		if ($this->mode == "VIEW_EDITPROFILE" && $GLOBALS['HTTP_POST_VARS'][$this->prefixId]["submit_delete"] == null){
			// Check for eval_function twice
			$twice=(substr($item_key,-6)=="_again");
			if ($twice) {
				$item_key=substr($item_key,0,-6);
			}
			//Do the query
			if ($this->debug){ echo "Fetching values from DATABASE...<br>";}			
			$res = $this->doDatabaseQuery("SELECT ".$item_key." FROM ".$this->table." WHERE uid=".intval($this->record_uid));
			$res = $res[0][$item_key];
			//Bring it to the right format
			$res = explode(",", $res);
			//In case theres nothing to explode, the next three lines fix the prob

			if ($res[0] == null || $res[0] == "") {
				  $res = array();
			}
			//If okay, then construct the array
			else{
				$temp = array();
				for($i = 0; $i < sizeof($res); $i++){
					$temp[$i]["name"] = $res[$i];
				}
				$res = $temp;
			}
		}
		elseif ($this->mode == "VIEW_EDITPROFILE_PREVIEW" || $this->mode == "VIEW_EDITPROFILE_RESULT" || $GLOBALS['HTTP_POST_VARS'][$this->prefixId]["submit_delete"] != null){
			if ($this->debug){ echo "Fetching FILE values from POST VARS...<br>";}

			//Okay...now recreate the $_FILES array
			if ($this->mode == "VIEW_EDITPROFILE_RESULT" || $this->mode == "VIEW_EDITPROFILE_PREVIEW") {
				$files = array();
				for($i = 0; $i < sizeof($GLOBALS['HTTP_POST_VARS'][$this->prefixId][$item_key]); $i++){
					//the [name] tells us, that the file does not come from $_FILES and must be added
					if (is_array($GLOBALS['HTTP_POST_VARS'][$this->prefixId][$item_key][$i])) {
						$temp = array();
						$temp["name"] = $GLOBALS['HTTP_POST_VARS'][$this->prefixId][$item_key][$i]["name"];
						//Add to files
						$files[] = $temp;
					}
				}

				//Move the files to upload folder
				//Get field information from TCA
				$TCA = $GLOBALS["TCA"][$this->table]["columns"][$item_key];
				$dir = PATH_site.$TCA["config"]["uploadfolder"];
				$this->moveTempFilesToDir($dir, $item_key);
			}
			else{
				//In case of DELETE determine, which file was deleted
				$delete_key = null;
				$delete_key = $GLOBALS['HTTP_POST_VARS'][$this->prefixId]["submit_delete"];
				$delete_key = array_keys($delete_key);
				$delete_key = $delete_key[0];

				$files = array();
				for($i = 0; $i < sizeof($GLOBALS['HTTP_POST_VARS'][$this->prefixId][$item_key]); $i++){
					//the [name] tells us, that the file does not come from $_FILES and must be added
					if (is_array($GLOBALS['HTTP_POST_VARS'][$this->prefixId][$item_key][$i]) && $i != $delete_key) {
						$temp = array();
						$temp["name"] = $GLOBALS['HTTP_POST_VARS'][$this->prefixId][$item_key][$i]["name"];
						//Add to files
						$files[] = $temp;
					}
				}
			}

			//get names and further information of files, that were uploaded.
			@$keys = array_keys($_FILES[$this->prefixId]["name"][$item_key]);
			for($i = 0; $i < sizeof($keys); $i++){
				//Only add files, that were uploaded
				if ($_FILES[$this->prefixId]["name"][$item_key][$keys[$i]] != null) {
					$temp = array();
					$temp["name"] = $_FILES[$this->prefixId]["name"][$item_key][$keys[$i]];
					$temp["type"] = $_FILES[$this->prefixId]["type"][$item_key][$keys[$i]];
					$temp["tmp_name"] = $_FILES[$this->prefixId]["tmp_name"][$item_key][$keys[$i]];
					$temp["size"] = $_FILES[$this->prefixId]["size"][$item_key][$keys[$i]];
					//Add to files
					$files[] = $temp;
				}
			}

			if ($this->mode != "VIEW_EDITPROFILE_RESULT") {


			}

			//Return the array
			return $files;
		}
		elseif ($this->mode == "VIEW_EDITPROFILE_ERROR"){
			//In case of error, display the files from post values

			$files = array();
			for($i = 0; $i < sizeof($GLOBALS['HTTP_POST_VARS'][$this->prefixId][$item_key]); $i++){
				//the [name] tells us, that the file does not come from $_FILES and must be added
				if (is_array($GLOBALS['HTTP_POST_VARS'][$this->prefixId][$item_key][$i])) {
					$temp = array();
					$temp["name"] = $GLOBALS['HTTP_POST_VARS'][$this->prefixId][$item_key][$i]["name"];
					//Add to files
					$files[] = $temp;
				}
			}
			return $files;
		}
		//Return
		return $res;
	}

	/* moveTempFilesToDir($dir)
	* 
	*  Moves files from the path given in $_FILES to the specified directory for further handling.
	*  @param $dir String. Directory where the files should be moved to.
	*  @param $item_key String. The item key from $this->items. e.g. 'tx_cwttest_images'
	*/
	function moveTempFilesToDir($dir, $item_key){
		//Validate $_FILES
		if ($_FILES[$this->prefixId]["name"][$item_key] == null){
			//Do nothing
			return null;
		}
		//For all files in $_FILES
		$keys = array_keys($_FILES[$this->prefixId]["name"][$item_key]);
		//Move the files
		for($i = 0; $i < sizeof($keys); $i++){
			$filename = $_FILES[$this->prefixId]["name"][$item_key][$keys[$i]];
			t3lib_div::upload_copy_move($_FILES[$this->prefixId]["tmp_name"][$item_key][$keys[$i]], $dir."/".$filename);
		}
	}

	/* updateDatabaseRecord($items)
	*
	*  This function updates the values in database for the record with the
	*  appropriate record uid.
	*/
	function updateDatabaseRecord($items){
	   //Get the array keys
	   $item_keys = array_keys($items);
	   //Preparing query
	   $part = array();
	   $temp = array();
	   for ($i=0; $i < sizeof($item_keys);$i++){
			//Get field information from TCA
			$TCA = $GLOBALS["TCA"][$this->table]["columns"][$item_keys[$i]];
			//Get type of field
			$type = $TCA["config"]["type"];
		   //Special handling for file items
		   if ($type == "group" && $TCA["config"]["internal_type"] == "file") {
			   $files = $this->fetchValuesForFiles($item_keys[$i]);
			   for($j = 0; $j < sizeof($files); $j++){
					//Get values from database
					$res = $this->doDatabaseQuery("SELECT ".$item_keys[$i]." FROM ".$this->table." WHERE uid = ".intval($this->record_uid));
					$res = explode(",", $res[0][$item_keys[$i]]);
					//Check if file was uploaded and filename has to be cleaned and has to be made unique
					if (!in_array($files[$j]["name"], $res)){
						//Clean filename
						$filename = null;
						$filename = $this->cleanFilename($files[$j]["name"]);
						//Make filename unique
						$filename = $this->makeFilenameUnique($filename);
						//Rename the file
						$dir = PATH_site.$TCA["config"]["uploadfolder"];
						rename($dir."/".$files[$j]["name"], $dir."/".$filename);
					}
					else{
						$filename = $files[$j]["name"];
					}
					//Add it
					$part[] = $filename;
			   }
			   $temp[] = $item_keys[$i]."='".implode(",", $part)."'";
		   }

		   // Checkbox update 2005.11.12
		   // Stephan Diehl
		   
		   elseif ($type == "check") {
		   	$temp[] = $item_keys[$i]."='".($this->fetchValueFromItem($item_keys[$i])=='on'?'1':'0')."'";
		   }
		   //Normal items
		   else{
				$temp[] = $item_keys[$i]."='".mysql_escape_string($this->fetchValueFromItem($item_keys[$i]))."'";
		   }
	   }
	   $temp = implode(", ", $temp);
	   //Add time stamp
	   $temp .= ", tstamp='".time()."'";
	   //Create the query
	   $query = "UPDATE ".$this->table." SET ".$temp." WHERE uid=".intval($this->record_uid);

	   //Debug
	   if ($this->debug){ echo $query."<br>";}

	   //Finally do the query!
	   $res = $this->doDatabaseUpdateQuery($query);
	}

	/* mergeExtendingTCAs($ext_keys)
	*
	*  Merges the $tempColumns from extensions, that extend the table, we are currently
	*  working on. In case you wrote an extension, that extends the "fe_users", then
	*  the TCA information for the additional fields will be merged with the "fe_users" TCA.
	*
	*  @param array Extension TCA's that should be merged.
	*/
	function mergeExtendingTCAs($ext_keys){
		global $TYPO3_LOADED_EXT;
		//Merge all ext_keys
		if (is_array($ext_keys)) {
			for($i = 0; $i < sizeof($ext_keys); $i++){
				//Include the ext_table
				$_EXTKEY=$ext_keys[$i]; // added by F.Rakow
				include($TYPO3_LOADED_EXT[$ext_keys[$i]]["ext_tables.php"]);
				//Add the tempColumns to target tables TCA
				//t3lib_extMgm::addTCAcolumns($this->table,$tempColumns,1);
			}
		}
	}

	/* createBlankRecord($cruser_id, $table)
	*
	*  This function creates a blank record in the target table. This function can be called
	*  without instatiating this class.
	*
	*  @param  $cruser_id The fe user uid, of the user, that wants to create the record
	*  @param  $table The table, where the record will be created.
	*  @return $uid The uid of the record we have just created.
	*/
	function createBlankRecord($cruser_id, $table) {
		//Get globals
		//$cruser_id = $this->cruser_id;
		//$table = $this->table;
		//Get the timestamp
		$time = time();
		//Do the query
		$res = $this->doDatabaseUpdateQuery("INSERT INTO '".$table."' (crdate, cruser_id, tstamp) VALUES (".$time.",".intval($cruser_id).",".$time.")");
		//Get the uid of the record, that we have just created
		$uid = $this->doDatabaseQuery("SELECT uid FROM ".$table." WHERE crdate = ".$time." AND cruser_id = ".intval($cruser_id));
		return $uid[0]["uid"];
	}

	/* doDatabaseQuery($query)
	*
	*  This function runs queries on the typo3 database and returns the
	*  result set in an associative array e.g. $return[0]['myAttribute'].
	*  Please notice, that this function is only suitable for 'SELECT'
	*  queries.
	*
	*  @param $query Database query, which will be executed. e.g. 'SELECT * FROM myTable'
	*  @return array Associative array with query results
	*/
	function doDatabaseQuery($query)
	{
		// Do the query
		$res = mysql(TYPO3_db, $query);
		// Preparing result set
		$rows = array();
		while ($row = mysql_fetch_assoc($res)) {
			$rows[] = $row;
		}
		// Debugging
		if ($this -> debug) {
			echo "Query: $query<br>";
			print_r($rows);
			echo "<br>";
		}
		// Return the array
		return $rows;
	}

	/* doDatabaseUpdateQuery($query)
	*
	*  [Description]
	*  @param $query Database query, which will be executed. e.g. 'UPDATE myTable SET myAttribute=myValue WHERE...'
	*  @return null
	*/
	function doDatabaseUpdateQuery($query)
	{
		// Do the query
		$res = mysql(TYPO3_db, $query);
		// Debugging
		if ($this -> debug) {
			echo "Query: $query<br>";
			echo "<br>";
		}
		// Return the array
		return null;
	}

}



if (defined("TYPO3_MODE") && $TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["ext/cwt_feedit/pi1/class.tx_cwtfeedit_pi1.php"])	{
	include_once($TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["ext/cwt_feedit/pi1/class.tx_cwtfeedit_pi1.php"]);
}

?>

Gruss
Stephan