Zum Inhalt springen

Daten im Frontend eingeben

Erstellt am 27. März 2008 · 1 Antwort · letzte Antwort am 27. März 2008

Tags: Frage

p.​scholle ·

Hallo an alle!

Ich bin dabei meine erste Extension zu bauen:
Eine Geschenke-Wunschliste (Frontend-Plugin).

Beim Geschenk ist die Beschreibung und der Gesamtpreis hinterlegt, den ich über das Backend eingetragen habe. Der Gast (eingeloggter User) soll dann anteilig einen gewissen Geldbetrag dazugeben. In der Liste soll dann der Betrag der noch übrig ist angezeigt werden. (Bsp.: 5 Leute beteiligen sich an einem Stuhl, der 300 Euro kostet).

Die Auflistung der Geschenke mit Preis, Beschreibung und Bild habe ich (zum Glück) schon hinbekommen. Jetzt brauch ich noch die Eingabemöglichkeit des Gasts, also ein Formularfeld mit Button daneben, wo der Gast seinen Anteil reinschreibt und was dann in einer extra Tabelle mit Beziehung zu feuser und der Geschenke-Tabelle reingeschrieben wird.

Eine Tabelle mit Beziehung zur Tabelle feuser und zu der Geschenke-Tabelle und dem Feld Anteil hab ich schon angelegt.

Wie realisiere ich jetzt die Eingabamaske?

Ich stehe gerade auf'm Schlauch, hoffe ihr versteht was ich meine #giggle#
Danke!

Hier noch der bisherige Code:

<?php
/***************************************************************
*  Copyright notice
*
*  (c) 2008  <>
*  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!
***************************************************************/

require_once(PATH_tslib.'class.tslib_pibase.php');


/**
 * Plugin 'Wish List' for the 'wishlist' extension.
 *
 * @author	 <>
 * @package	TYPO3
 * @subpackage	tx_wishlist
 */
class tx_wishlist_pi1 extends tslib_pibase {
	var $prefixId      = 'tx_wishlist_pi1';		// Same as class name
	var $scriptRelPath = 'pi1/class.tx_wishlist_pi1.php';	// Path to this script relative to the extension dir.
	var $extKey        = 'wishlist';	// The extension key.
	var $pi_checkCHash = true;
	
	/**
	 * The main method of the PlugIn
	 *
	 * @param	string		$content: The PlugIn content
	 * @param	array		$conf: The PlugIn configuration
	 * @return	The content that is displayed on the website
	 */
	function main($content,$conf) {
		$this->conf = $conf;
		$this->pi_setPiVarDefaults();
		$this->pi_loadLL();
		$this->templateCode = $this->cObj->fileResource("fileadmin/wishlist/wishlist.tmpl");
		if ($this->templateCode=="") {
			return "<h3>Mitglieder: Kein HTML-Template gefunden:</h3>".$this->conf["templateFile"];
		}
		$content .= $this->displayAll();
		return $this->pi_wrapInBaseClass($content);
	}
		
	function displayAll(){
		$content = "";
		$lconf = $this->conf["displayAll."];
		$template = $this->cObj->getSubpart($this->templateCode,"###TEMPLATE_DISPLAY_ALL###");
		$markerArray=array();
		$wrappedSubpartArray=array();
		$rows = $this->getItems();
		while( list($c,$row)=each($rows) ){
			if ($row["image"] == false) {$lconf["image."]["file"] = "media/emoticons/sad.gif";}
			else {
				$lconf["image."]["file"] = "uploads/tx_wishlist/".($row["photo"]);
			}
		
			$theImgCode = $this->cObj->IMAGE($lconf["image."]);
			$markerArray["###GESCHENK###"] = $row['geschenk'];
			$markerArray["###BESCHREIBUNG###"] = $row['description'];
			$markerArray["###PREIS###"] = $row['preis'];
			$markerArray["###IMAGE###"] = $theImgCode;

			$content.=$this->cObj->substituteMarkerArrayCached($template,$markerArray,array(),
			$wrappedSubpartArray);
		}
		return $content;
	}

	function getItems(){
		$this->config["pid_list"] = trim($this->cObj->stdWrap($this->conf["pid_list"],$this->conf
		["pid_list."]));
		$this->config["pid_list"] = $this->config["pid_list"] ? implode(t3lib_div::intExplode(",",$this->config["pid_list"]),",") : $this->cObj->data["pages"];
		list($pid) = explode(",",$this->config["pid_list"]);
		$this->pid = $pid;
		$query = "SELECT * FROM tx_wishlist_wishlist WHERE pid=" . $GLOBALS["TSFE"]->id .
		$this->cObj->enableFields("tx_wishlist_wishlist"); 
		//WHERE pid IN (".$pid.")".$this->cObj->enableFields ("tx_wishlist_wishlist")." ORDER BY sorting";
		$res = mysql(TYPO3_db,$query);
		$out = array();
		while( $row = mysql_fetch_assoc($res) ){
			$out[]=$row;
		}
		return $out;
	}
}

		if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/wishlist/pi1/class.tx_wishlist_pi1.php'])	{
		include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/wishlist/pi1/class.tx_wishlist_pi1.php']);
}

?>