Hi Everyone
I want to built Reregistration system for Trips that planned in my community club. So, I created the TripHolder
<?php
/**
* Defines the TripHolder page type
*/
class TripHolder extends Page {
static $db = array(
);
static $has_one = array(
);
static $allowed_children = array('Trip');
}
class TripHolder_Controller extends Page_Controller {
}
?>
And also the Trip page:
<?php
/**
* Trip Page
*/
class Trip extends Page
{
static $db = array(
'Departure' => 'Date',
'Return' => 'Date',
'Location' => 'Text',
'Seats' => 'Int'
);
static $has_one = array(
);
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Content.Main', $dateField = new DateField('Departure','Departure Date of the Trip (for example: 20/12/2010)'), 'Content');
$dateField->setConfig('showcalendar', true);
$dateField->setConfig('dateformat', 'dd/MM/YYYY');
$fields->addFieldToTab('Root.Content.Main', $dateField = new DateField('Return','Return Date of the Trip (for example: 20/12/2010)'), 'Content');
$dateField->setConfig('showcalendar', true);
$dateField->setConfig('dateformat', 'dd/MM/YYYY');
$fields->addFieldToTab('Root.Content.Main', new TextField('Location','The Trip Location'), 'Content');
$fields->addFieldToTab('Root.Content.Main', new NumericField('Seats','The Available Seats on the Trip'), 'Content');
return $fields;
}
}
class Trip_Controller extends Page_Controller {
}
?>
And, I extended the member class:
<?php
class MyMember extends Member {
static $db = array(
"Mobile" => "Int",
"Institute" => "Text",
"City" => "Text",
"Institute" => "Text",
);
}
?>
So, My question is how can I make the many_many relation between MyMember class and Trip page and then member can register in a Trip.