Antwort
 
LinkBack Themen-Optionen Thema durchsuchen Thema bewerten Ansicht
  #1  
Alt 24.04.08, 11:18
Forum Zuschauer
 
Registriert seit: 09.04.08
Alter: 42
Beiträge: 10
Checkboxes

Hi,

noch eine Anfrage bzgl. checkboxen habe ich. Wie kann ich im Typoscript die Werte der Checkboxen korrekt verarbeiten? Ich habe ein Feld mit mehreren Checkboxen und möchte jeweils die gewählte Checkbox in ein Tabellenfeld einer anderen Tabelle schreiben. Im Backend sehe ich z.b. sowas:

Please select...: 1 (uid69_0)
Please select...: 1 (uid69_1)

Folgender Typoscript schnippsel scheint aber nicht zu funktionieren:
plugin.tx_powermail_pi1 {
dbEntry.tx_mytable.uid69_0 = mytablefield
}

Kann mir jemand sagen wie man das richtig machen muss?

vielen Dank
Radi
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!Spurl this Post!Reddit! Diesen Post bei linksilo.de bookmarken!
Mit Zitat antworten
Sponsored Links
  #2  
Alt 24.04.08, 11:50
Benutzerbild von einpraegsam.net
Forum Stammgast
 
Registriert seit: 11.05.07
Ort: Nürnberg
Alter: 29
Beiträge: 244

Zitat:
Zitat von Radiesel Beitrag anzeigen
Hi,

noch eine Anfrage bzgl. checkboxen habe ich. Wie kann ich im Typoscript die Werte der Checkboxen korrekt verarbeiten? Ich habe ein Feld mit mehreren Checkboxen und möchte jeweils die gewählte Checkbox in ein Tabellenfeld einer anderen Tabelle schreiben. Im Backend sehe ich z.b. sowas:

Please select...: 1 (uid69_0)
Please select...: 1 (uid69_1)

Folgender Typoscript schnippsel scheint aber nicht zu funktionieren:
plugin.tx_powermail_pi1 {
dbEntry.tx_mytable.uid69_0 = mytablefield
}

Kann mir jemand sagen wie man das richtig machen muss?

vielen Dank
Radi

Hello again,


wir sind gerade dabei die Klasse für den Datenbankeinträge in fremde Tabellen zu verbessern. Ich denke, das Werte in zweiter Ebene noch implementiert werden müssen.


Grüße, Alex
__________________
einpraegsam.net alias wunschtacho

Powermail :: Einprägsam :: Xing Profil :: Wunschtacho :: JustPowder :: conject
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!Spurl this Post!Reddit! Diesen Post bei linksilo.de bookmarken!
Mit Zitat antworten
  #3  
Alt 24.04.08, 12:23
Benutzerbild von einpraegsam.net
Forum Stammgast
 
Registriert seit: 11.05.07
Ort: Nürnberg
Alter: 29
Beiträge: 244

Falls du nicht mehr auf die neue Powermail Version warten willst/kannst, kannst du die class.tx_powermail_db.php mit diesem Inhalt tauschen:

PHP-Code:
<?php
/***************************************************************
*  Copyright notice
*
*  (c) 2007 Mischa Heißmann, Alexander Kellner <typo3.2008@heissmann.org, alexander.kellner@einpraegsam.net>
*  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');

// This class saves powermail values in OTHER db tables if wanted (this class is not the main database class for storing)
class tx_powermail_db extends tslib_pibase {

    var 
$extKey 'powermail';
    var 
$scriptRelPath 'pi1/class.tx_powermail_pi1.php'// Path to pi1 to get locallang.xml from pi1 folder
    
var $dbInsert 1// Disable db insert for testing only
    
    
    // Main Function for inserting datas to other tables
    
function main($conf$sessiondata$ok) {
        if(
$ok) { // if it's allowed to save db values
            
            // config
            
global $TSFE;
            
$this->cObj $TSFE->cObj// cObject
            
$this->conf $conf;
            
$this->sessiondata $sessiondata;
            
$db_allowed = ( $this->cObj->cObjGetSingle($this->conf['dbEntry.']['tt_address.']['enable'], $this->conf['dbEntry.']['tt_address.']['enable.']) != '' $this->cObj->cObjGetSingle($this->conf['dbEntry.']['tt_address.']['enable'], $this->conf['dbEntry.']['tt_address.']['enable.']) : $this->conf['dbEntry.']['tt_address'] );
            
$db_values = array(); // init dbArray
            
            // Let's go
            
if (isset($this->conf['dbEntry.']) && is_array($this->conf['dbEntry.'])) { // Only if any dbEntry is set per typoscript
                
foreach ($this->conf['dbEntry.'] as $key => $value) { // One loop for every table to insert
                    
                    // 1. Insert dynamic values to array
                    
if (isset($this->conf['dbEntry.'][$key]) && is_array($this->conf['dbEntry.'][$key])) { // Only if its an array
                        
foreach ($this->conf['dbEntry.'][$key] as $kk => $vv) { // One loop for every field to insert in current table
                            
$vvv str_replace(';',',',t3lib_div::trimExplode(',',$vv,1)); // if value should be saved in more fields
                            
for ($i=0$i<count($vvv); $i++) { // one loop for every field (if a value should be saved to more fields
                                
if (strpos(strtolower($kk), "_") === false) { // if there is no underscore (uid34)
                                    
if ($this->sessiondata[strtolower($kk)] && $this->fieldExists($vvv[$i], str_replace('.','',$key))) { // If value exists and db field exists
                                        
$db_values[$vvv[$i]] = $this->sessiondata[strtolower($kk)]; // generate array for saving to db (if there is a value in the session AND table/field exist)
                                    
}
                                } else { 
// if there is an underscore (uid34_1) maybe for checkboxes
                                    
$keyparts t3lib_div::trimExplode('_'strtolower($kk), 1); // array for 34 and 1
                                    
if ($this->sessiondata[$keyparts[0]][$keyparts[1]] && $this->fieldExists($vvv[$i], str_replace('.','',$key))) { // If value exists and db field exists
                                        
$db_values[$vvv[$i]] = $this->sessiondata[$keyparts[0]][$keyparts[1]]; // generate array for saving to db (if there is a value in the session AND table/field exist)
                                    
}
                                }
                            }
                        }
                    }
                    
                    
                    
// 2. Insert static values to same array
                    
if (isset($this->conf['dbEntryDefault.'][$key]) && is_array($this->conf['dbEntryDefault.'][$key])) { // Only if any dbEntryDefault is set per typoscript
                        
foreach ($this->conf['dbEntryDefault.'][$key] as $sk => $sv) { // One loop for every field to insert in current table
                            
if( $this->fieldExists($skstr_replace('.','',$key)) ) { // If database table exists
                                
                                
if ($sv == '[pid]'$db_values[$sk] = $GLOBALS['TSFE']->id// add current pid
                                
elseif ($sv == '[tstamp]'$db_values[$sk] = time(); // add current timestamp
                                
else $db_values[$sk] = ( $this->cObj->cObjGetSingle($this->conf['dbEntryDefault.'][$key][$sk], $this->conf['dbEntryDefault.'][$key][$sk.'.']) ? $this->cObj->cObjGetSingle($this->conf['dbEntryDefault.'][$key][$sk], $this->conf['dbEntryDefault.'][$key][$sk.'.']) : $this->conf['dbEntryDefault.'][$key][$sk] ); // add static value from ts
                                
                            
}
                        }
                    }
                    
                    
// 3. DB insert
                    
if ($this->dbInsert && $db_allowed != '0' && isset($db_values) && is_array($db_values)) { // if its allowed and db array is not empty
                        
$GLOBALS['TYPO3_DB']->exec_INSERTquery(str_replace('.','',$key), $db_values); // DB entry for every table
                    
}
                    
                }
            }
                
            
        }
    }
    
    
    
// Function fieldExists() checks if a table and field exist
    
function fieldExists($field ''$table '') {
        if (!empty(
$field) && !empty($table) && strpos($field".") === false) {
            
$row1 $GLOBALS['TYPO3_DB']->sql_fetch_assocmysql_query('SHOW TABLES LIKE "'.$table.'"') ); // check if table exist
            
if($row1$row2 $GLOBALS['TYPO3_DB']->sql_fetch_assocmysql_query('DESCRIBE '.$table.' '.$field) ); // check if field exist (if table is wront - errormessage)
            
            
if($row1 && $row2) return 1// table and field exist
            
else return 0// table or field don't exist
        
}
    }
    
}

if (
defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/lib/class.tx_powermail_db.php'])    {
    include_once(
$TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/powermail/lib/class.tx_powermail_db.php']);
}

?>

Beispiel typoscript:
HTML-Code:
plugin.tx_powermail_pi1 {
	# ENABLE: enable or disable db insert (0/1)
	dbEntry.tt_address.enable = TEXT
	dbEntry.tt_address.enable.value = 1

	# DYNAMIC: enter values from piVars (POST parameter)
	dbEntry.tt_address.uid41 = email
	dbEntry.tt_address.uid65 = last_name,first_name
	
	# DYNAMIC: enter default value (second level)
	dbEntry.tt_address.uid72_0 = phone
	dbEntry.tt_address.uid72_1 = mobile
	
	# STATIC: enter current page id
	dbEntryDefault.tt_address.pid = TEXT
	dbEntryDefault.tt_address.pid.field = uid
	
	# STATIC: enter default value
	dbEntryDefault.tt_address.name = Alex
	
	# STATIC: enter default value
	dbEntryDefault.tt_address.www = TEXT
	dbEntryDefault.tt_address.www.value = www.test.de
	
	# STATIC: enter current timestamp
	dbEntryDefault.tt_address.tstamp = TEXT
	dbEntryDefault.tt_address.tstamp.data = date:U
}
Grüße, Alex
__________________
einpraegsam.net alias wunschtacho

Powermail :: Einprägsam :: Xing Profil :: Wunschtacho :: JustPowder :: conject
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!Spurl this Post!Reddit! Diesen Post bei linksilo.de bookmarken!
Mit Zitat antworten
  #4  
Alt 24.04.08, 12:31
Forum Zuschauer
 
Registriert seit: 09.04.08
Alter: 42
Beiträge: 10

Ihr seit der Hit....

vielen Dank für die schnellen Antworten. Habt Ihr eine ungefähre Ahnung, wann die neue Version released wird? Abhängig davon würde ich dann halt den Code-Schnippsel einbauen oder warten.....

danke
Radiesel
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!Spurl this Post!Reddit! Diesen Post bei linksilo.de bookmarken!
Mit Zitat antworten
  #5  
Alt 24.04.08, 12:46
Benutzerbild von einpraegsam.net
Forum Stammgast
 
Registriert seit: 11.05.07
Ort: Nürnberg
Alter: 29
Beiträge: 244

Release Datum der 1.2.0 ist noch nicht genau durchdacht - wir wollen eventuell noch ein paar Features mit reinquetschen...
__________________
einpraegsam.net alias wunschtacho

Powermail :: Einprägsam :: Xing Profil :: Wunschtacho :: JustPowder :: conject
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!Spurl this Post!Reddit! Diesen Post bei linksilo.de bookmarken!
Mit Zitat antworten
Antwort


Themen-Optionen Thema durchsuchen
Thema durchsuchen:

Erweiterte Suche
Ansicht Thema bewerten
Thema bewerten:

Forumregeln
Es ist Ihnen nicht erlaubt, neue Themen zu verfassen.
Es ist Ihnen nicht erlaubt, auf Beiträge zu antworten.
Es ist Ihnen nicht erlaubt, Anhänge anzufügen.
Es ist Ihnen nicht erlaubt, Ihre Beiträge zu bearbeiten.

vB Code ist An.
Smileys sind An.
[IMG] Code ist An.
HTML-Code ist Aus.
Trackbacks are An
Pingbacks are An
Refbacks are An


Ähnliche Themen
Thema Autor Forum Antworten Letzter Beitrag
FE User Registration: Checkboxes statt Select iruizgal Extension modifizieren oder neu erstellen 0 20.09.06 15:53
Problem mit den checkboxes Werten. daniel Extension modifizieren oder neu erstellen 6 23.08.04 16:03


Alle Zeitangaben in WEZ +1. Es ist jetzt 11:04 Uhr.


Powered by vBulletin® Version 3.6.8 Patch Level 2 (Deutsch)
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0
Template-Modifikationen durch TMS