[TYPO3-german] hook - eigener marker - pbsurvey

walk2moon walk2moon at gmx.de
Wed Oct 8 16:08:51 CEST 2008


Hallo,

das mit dem Marker hat sich nun erledigt. Ich habe den Parameter nun in ein hidden field gepackt. Nun habe ich aber das Problem, dass ich noch nicht recht verstehe, wie ich nun meinen Wert aus dem hidden field in die Datenbank bekomme. pbsurvey speichert an der relevanten Stelle wie folgt:

<code>
/**
	 * Store new result in database or, if update, update the previous one, in the beginning of the survey.
	 * Set finished and endtsstamp when survey has been finished.
	 *
	 * @param	 boolean	   True if the survey is finished
	 * @return   string        Error message if query to database failed
     */
    function storeResults($boolFinished) {
    	if ($boolFinished) {
			$arrDb['finished'] = 1;
			$arrDb['endtstamp'] = time();
			if (!$this->arrSessionData['uid'] && $this->arrConfig['anonymous_mode']) {
				setcookie($this->extKey."[".$this->arrConfig['pid']."][responses]", $this->arrSessionData['responses']+1, (time()+60*60*24*$this->arrConfig['cookie_lifetime'])); // add 1 to the amount of responses		
			}
    	}
		$arrDb['user'] = intval($this->arrSessionData['uid']);
		$arrDb['begintstamp'] = intval($this->arrSessionData['begintstamp']);
		$arrDb['ip'] = $this->arrSessionData['uip'];
		$arrDb['pid'] = intval($this->arrConfig['pid']);
		$arrDb['language_uid'] = $GLOBALS['TSFE']->config['config']['language'];
		if (($this->arrSessionData['rid'] && $this->intStage==0) || $boolFinished) { // Surveyresult is an update and first page submitted
			$strWhere = 'uid=' . intval($this->arrSessionData['rid']);
			print_r($arrSessionData);
			$dbRes = $GLOBALS['TYPO3_DB']->exec_UPDATEquery($this->strResultsTable,$strWhere,$arrDb);
		} elseif ($this->intStage==0) {
			$arrDb['crdate'] = time();
			$dbRes = $GLOBALS['TYPO3_DB']->exec_INSERTquery($this->strResultsTable,$arrDb); // Insert result
			$this->arrSessionData['rid'] = $GLOBALS['TYPO3_DB']->sql_insert_id();
			if (!$this->arrSessionData['uid'] && $this->arrConfig['anonymous_mode']) { // Anonymous survey, check acces by cookie
				setcookie($this->extKey."[".$this->arrConfig['pid']."][rid]", $this->arrSessionData['rid'], (time()+60*60*24*$this->arrConfig['cookie_lifetime']));
			}
		}
		if ($GLOBALS['TYPO3_DB']->sql_error()) {
			$strOutput = $this->surveyError('failed_saving_data');
        }
        return $strOutput;
    }
</code>

Diese Funktion wird beim Absenden der Umfrage aufgerufen.

Wie bekomme ich jetzt den Wert aus meinem Hidden Field in das Datenbank-Feld tx_extsurvey_new?
Brauche da wohl noch nen Denkanstoß.

Grüße
Walter 

-- 
Psssst! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger


More information about the TYPO3-german mailing list