Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class MemberDecorator extends DataObjectDecorator {
- //Add extra database fields
- public function extraStatics()
- {
- return array(
- 'db' => array(
- "Degree" => "Enum('Bcom, Bcom(hons), BA, LLB, BSc, Bcom/LLB, BA/LLB, BSc/LLB, Bcom, Masters, MBus, PGDipcom')",
- "OtherDegree" => "Varchar",
- "StudentID" => "Varchar",
- "CellNumber" => "Varchar",
- "CurrentMajor" => "Varchar",
- "YearOfStudy" => "Enum('1st Year, 2nd Year, 3rd Year, 4th Year, 5th Year, 6th Year Plus, Postgraduate (Not Honours)')",
- "ExpectedGraduation" => "Varchar"
- )
- );
- }
- //Add form fields to CMS
- public function updateCMSFields(FieldSet &$fields)
- {
- $fields->addFieldToTab("Root.Profile", new TextField('StudentID', 'Student ID Number'));
- $fields->addFieldToTab("Root.Profile", new TextField('CellNumber', 'Cell Phone Number'));
- $fields->addFieldToTab("Root.Profile", new DropdownField('Degree','Please select your degree from the following', $this->dbObject('Degree')->enumValues()));
- $fields->addFieldToTab("Root.Profile", new TextField('OtherDegree', 'Additional degree combination / other degree (if applicable)'));
- $fields->addFieldToTab("Root.Profile", new TextField('CurrentMajor', 'Current Major(s)'));
- $fields->addFieldToTab("Root.Profile", new DropdownField('YearOfStudy','Current Year of Study', $this->dbObject('YearOfStudy')->enumValues()));
- $fields->addFieldToTab("Root.Profile", new TextField('ExpectedGraduation', 'Year in which you expect to graduate'));
- }
- //Link to the edit profile page
- function Link()
- {
- if($ProfilePage = DataObject::get_one('EditProfilePage'))
- {
- return $ProfilePage->Link();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement