[TYPO3-german] Checkbox - wie in TS überprüfen ob ausgewählt ?

andreas stein andre01 at typotemp.com
Wed Dec 13 15:54:34 CET 2006



Hallo,

Für jene, die eine rasche Lösung suchen:

Inkludiere folgendes Script:
includeLibs.multipleSelect = fileadmin/templates/multipleCheckbox.inc


Das Script braucht noch einige Variablen:

######
## table = table where you want to find to find the multiple checkbox
## select = here you can set search criteria // or replace in the script 
'uid="'.t3lib_div::_GP('userUID').'"' for e.c.
## var = name of the multiple checkbox in the table
## count = how many possible answers or values the variable has
## val = the value to check

temp.checkbox = USER
temp.checkbox.userFunc = user_selectFunc
temp.checkbox.userFunc.table = fe_users
temp.checkbox.userFunc.select = pid=24
temp.checkbox.userFunc.var = tx_feuserext_arzt_praxinfo1
temp.checkbox.userFunc.count = 19


Wie etwa so kann man dann überprüfen ob ein bestimmter Wert einer Checkbox 
gesetzt ist:

checkbox = TEXT
checkbox.data = 
LLL:EXT:feuserext/locallang_db.xml:fe_users.tx_feuserext_arzt_praxinfo.I.1
checkbox.wrap = <b>|</b>
checkbox.if.isTrue.cObject < temp.checkbox
checkbox.if.isTrue.cObject.userFunc.val = 1


Und hier das Script (nicht voll ausgereift, da gerade zu wenig Zeit ;) Danke 
an rainer & co:

<?php

 function user_selectFunc($content,$conf) {
  $boxArr[] = array();
  $lConf = $conf["userFunc."];;
  $table = $lConf["table"];
  $select = $lConf["select"];
  $var = $lConf["var"];
  $count = $lConf["count"];
  $val = $lConf["val"];
  $k = 1;

 $res = 
$GLOBALS['TYPO3_DB']->exec_SELECTquery($var,$table,$select,'','','');
 $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);


   $features = $row[$var];
   for ($m=0; $m < $count; $m++) {
    if ($features & $k) {
     $boxArr[$m]=1;
    } else {
     $boxArr[$m]=0;
    }
    $k *= 2;
   }
$content = $boxArr[$val];
return $content;
}

?>



> I want to display the values of a multible checkbox if they are checked.
>
> 20. = TEXT
> 20.data = 
> LLL:EXT:feuserext/locallang_db.xml:fe_users.tx_feuserext_arzt_praxinfo.I.1
> 20.if.isTrue.data = DB : fe_users:24:tx_feuserext_arzt_praxinfo|1
>



>
> 20. = TEXT
> 20.data = 
> LLL:EXT:feuserext/locallang_db.xml:fe_users.tx_feuserext_arzt_praxinfo.I.1
> 20.if.isTrue.data = DB : fe_users:24:tx_feuserext_arzt_praxinfo|1
>




More information about the TYPO3-german mailing list