[TYPO3-german] formhandler: formular ausblenden nach X datenbankträgen
Thomas Pronold
tp at tpronold.de
Mon May 12 11:21:25 CEST 2014
Funktioniert wunderbar, hier die Codesnippets, falls mal jemand über diese Frage stolpert:
Tx_Industrieformdata_Interceptor_Stop70.php:
class Tx_Industrieformdata_Interceptor_Stop70 extends Tx_Formhandler_AbstractInterceptor {
/**
* The main method called by the controller
*
* @return array The probably modified GET/POST parameters
*/
public function process() {
$this->log(TRUE);
$query = $GLOBALS['TYPO3_DB']->exec_SELECTquery("COUNT('uid') AS cnt", 'tx_industrieformdata_domain_model_registrations', 'pid=16 AND deleted=0 AND hidden=0', '', '', '1');
if ($GLOBALS['TYPO3_DB']->sql_num_rows($query)) {
if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($query)) {
if ($row['cnt'] >= $this->settings['registationLimit']) {
if ($this->settings['redirectPage']) {
$this->globals->getSession()->reset();
$this->utilityFuncs->doRedirectBasedOnSettings($this->settings, $this->gp);
return 'Registration closed';
}
}
}
}
return $this->gp;
}
}
TYPOSCRIPT:
initInterceptors {
1 {
class = Tx_Industrieformdata_Interceptor_Stop70
config {
redirectPage = 18
registationLimit = 70
}
}
}
--
Extensions:
emailobfuscator (improved email spam protection)
www.tpronold.de
More information about the TYPO3-german
mailing list