Hi,
I have created a page-controller there you can store personal data. Below you can see the code:
-------------------------------------------------------------------------------------------
<?php
class Steckbrief extends Page {
static $icon = "themes/website/images/icons/steckbrief";
static $db = array(
'Name' => 'Text',
'Geburtsdatum' => 'Date',
'Anschrift' => 'Text',
'Telefon' => 'Text',
'Mobil' => 'Text',
'Email' => 'Text',
'Website' => 'Text',
'Socialnetwork' => 'Text',
'Sonstiges' => 'Text',
'Name2' => 'Text',
'Geburtsdatum2' => 'Date',
'Anschrift2' => 'Text',
'Telefon2' => 'Text',
'Mobil2' => 'Text',
'Email2' => 'Text',
'Website2' => 'Text',
'Socialnetwork2' => 'Text',
'Sonstiges2' => 'Text'
);
static $has_one = array(
'Photo' => 'Image',
'Photo2' => 'Image'
);
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Content', new TabSet('Personendaten'));
$fields->addFieldToTab('Root.Content.Personendaten.Person1', new TextField('Name'));
$fields->addFieldToTab('Root.Content.Personendaten.Person1', new DateField('Geburtsdatum'));
$fields->addFieldToTab('Root.Content.Personendaten.Person1', new TextField('Anschrift'));
$fields->addFieldToTab('Root.Content.Personendaten.Person1', new TextField('Telefon'));
$fields->addFieldToTab('Root.Content.Personendaten.Person1', new TextField('Mobil'));
$fields->addFieldToTab('Root.Content.Personendaten.Person1', new TextField('Email'));
$fields->addFieldToTab('Root.Content.Personendaten.Person1', new TextField('Website'));
$fields->addFieldToTab('Root.Content.Personendaten.Person1', new TextField('Socialnetwork'));
$fields->addFieldToTab('Root.Content.Personendaten.Person1', new TextField('Sonstiges'));
$fields->addFieldToTab('Root.Content.Personendaten.Person2', new TextField('Name2'));
$fields->addFieldToTab('Root.Content.Personendaten.Person2', new DateField('Geburtsdatum2'));
$fields->addFieldToTab('Root.Content.Personendaten.Person2', new TextField('Anschrift2'));
$fields->addFieldToTab('Root.Content.Personendaten.Person2', new TextField('Telefon2'));
$fields->addFieldToTab('Root.Content.Personendaten.Person2', new TextField('Mobil2'));
$fields->addFieldToTab('Root.Content.Personendaten.Person2', new TextField('Email2'));
$fields->addFieldToTab('Root.Content.Personendaten.Person2', new TextField('Website2'));
$fields->addFieldToTab('Root.Content.Personendaten.Person2', new TextField('Socialnetwork2'));
$fields->addFieldToTab('Root.Content.Personendaten.Person2', new TextField('Sonstiges2'));
$fields->addFieldToTab('Root.Content', new TabSet('Fotos'));
$fields->addFieldToTab('Root.Content.Fotos.Foto 375x500 px', new ImageField('Photo'));
$fields->addFieldToTab('Root.Content.Fotos.Foto 2 375x500 px', new ImageField('Photo2'));
return $fields;
}
}
class Steckbrief_Controller extends Page_Controller {
}
?>
-------------------------------------------------------------------------------------------
You can see there are Person1 and Person2 - each of them with own name: (Person1 -> Name) and (Person2 -> Name2). Also there are two birthdates: (Person1 -> Geburtsdatum) and (Person2 -> Geburtsdatum2).
Now I wold like to generate a birthdaylist sorted by date. At first - I think - I have to merge/combine the fields to have one new fieldset. Is it right? If yes, how to do? Hope, you can help me.
Thanks for your support!