Aded initial test modeladmin

This commit is contained in:
Sam Minnee 2008-10-02 22:48:55 +00:00
parent 32730154e1
commit ebca093fd7
6 changed files with 80 additions and 0 deletions

View File

@ -0,0 +1,7 @@
<?php
// Set up TestModelAdmin
Director::addRules(100, array(
'admin/test' => 'TestModelAdmin',
));
LeftAndMain::add_menu_item('test', 'Test ModelAdmin', 'admin/test', 'TestModelAdmin');

View File

@ -0,0 +1,16 @@
<?php
class TestModelAdmin extends ModelAdmin {
protected static $managed_models = array(
"Client",
"Contact",
"Project",
"Developer",
);
function Link() {
return 'admin/test';
}
}
?>

15
code/model/Client.php Normal file
View File

@ -0,0 +1,15 @@
<?php
class Client extends DataObject {
static $db = array(
"Name" => "Varchar",
);
static $many_many = array(
"Contacts" => "Contact",
);
static $belongs_many_many = array(
"Projects" => "Project",
);
}
?>

14
code/model/Contact.php Normal file
View File

@ -0,0 +1,14 @@
<?php
class Contact extends DataObject {
static $db = array(
"FirstName" => "Varchar",
"Surname" => "Varchar",
"Email" => "Varchar",
);
static $belongs_many_many = array(
"Clients" => "Client",
);
}
?>

15
code/model/Developer.php Normal file
View File

@ -0,0 +1,15 @@
<?php
class Developer extends DataObject {
static $db = array(
"FirstName" => "Varchar",
"Surname" => "Varchar",
"Email" => "Varchar",
"Username" => "Varchar",
);
static $belongs_many_many = array(
"Projects" => "Project",
);
}
?>

13
code/model/Project.php Normal file
View File

@ -0,0 +1,13 @@
<?php
class Project extends DataObject {
static $db = array(
"Name" => "Varchar",
);
static $many_many = array(
"Clients" => "Client",
"Developers" => "Developer",
);
}
?>