so wieder ein stück weiter ....leider nicht mit dem gewünschten Ergebnis :-(
Code:
$GLOBALS['TL_DCA']['tl_member']['fields']['fav_player'] = array
(
'label' => &$GLOBALS['TL_LANG']['tl_member']['fav_player'],
'exclude' => true,
'filter' => true,
'inputType' => 'select',
'foreignKey' => 'tl_playerlist.id',
'options_callback' => array('tl_playerlist', 'getplayers'),
'eval' => array('feGroup'=>'personal', 'feViewable'=>true, 'feEditable'=>true, 'mandatory'=>false, 'tl_class'=>'w50', 'includeBlankOption'=>true, 'chosen'=>true),
'sql' => "varchar(32) NOT NULL default ''"
);
// Class Erweiterung
class tl_playerlist extends tl_member
{
public function getPlayers()
{
$players = array();
$objplayers = $this->Database->prepare("SELECT id,number,firstname,lastname
FROM tl_playerlist
ORDER by number, firstname, lastname")
->execute();
while ($objplayers->next())
{
$k = $objplayers->id;
$v = $objplayers->number;
if($objplayers->firstname)
{
$v .= ' '.$objplayers->firstname;
}
if($objplayers->lastname)
{
$v .= ' '.$objplayers->lastname;
}
$players[$k] =$v;
}
return $players;
}
}
bringt mich leider nur zu dem selben Ergebnis wie mein vorangegangener code alleine :-(
Code:
$GLOBALS['TL_DCA']['tl_member']['fields']['fav_player'] = array
(
'label' => &$GLOBALS['TL_LANG']['tl_member']['fav_player'],
'exclude' => true,
'filter' => true,
'inputType' => 'select',
'foreignKey'=> 'tl_playerlist.(CONCAT(number," - ",firstname," ",lastname))',
'eval' => array('feGroup'=>'personal', 'feViewable'=>true, 'feEditable'=>true, 'mandatory'=>false, 'tl_class'=>'w50', 'includeBlankOption'=>true, 'chosen'=>true),
'sql' => "varchar(20) NOT NULL default ''"
in der fav_player wird immer noch nur die id gespeichert ....was in der Memberlist Ausgabe wieder zu favorisierter Spieler = 4 führt