Hi dalesaurus,
you are right. This is the wrong forum for this question.
for the use in the CMS i have written these lines into stammdaten.php:
class Stammdaten extends DataObject {
static $singular_name = 'Stammdaten';
static $plural_name = 'Stammdaten';
static $db = array(
'Firmenname' => 'Varchar',
'Strasse' => 'Varchar',
'PLZ' => 'Int',
'Ort' => 'Varchar',
'Vorwahl' => 'Int',
'Telefon' => 'Int',
'Fax' => 'Int',
'Mail' => 'Varchar',
'Web' => 'Varchar'
);
function getCMSFields() {
$fields = new FieldSet(
new TextField('Firmenname', 'Firmenname'),
new DropdownField(
'ID',
'Bitte einen Bereich waehlen.',
Dataobject::get("SiteTree", "SiteTree.ParentID = '20'", "SiteTree.ID", "", "")->toDropdownMap("ID", "Title")
),
new TextField('Strasse', 'Strasse'),
new NumericField('PLZ', 'PLZ'),
new TextField('Ort', 'Ort'),
new NumericField('Vorwahl', 'Vorwahl'),
new NumericField('Telefon', 'Telefon'),
new NumericField('Fax', 'Fax'),
new EmailField('Mail', 'Mail'),
new TextField('Web', 'Web')
);
return $fields;
}
static $has_one = array(
'LogoGesamtuebersicht' => 'Stammdaten_Thumbnail',
'LogoDetailuebersicht' => 'Stammdaten_Thumbnail',
'LogoLaufband' => 'Stammdaten_Thumbnail'
);
static $searchable_fields = array (
'Firmenname',
'PLZ',
'Ort',
'Ansprechpartner.Nachname'
);
static $summary_fields = array(
'Firmenname',
'PLZ',
'Ort'
);
static $field_labels = array (
//'Ansprechpartner.Nachname'
);
static $has_many = array(
'Ansprechpartner' => 'Ansprechpartner',
'Referenzen' => 'Referenz'
);
public function SplitList($val=5) {
return ($this->iteratorPos + 1) % $val == 0;
}
}