Advertisement
Guest User

Untitled

a guest
Jul 28th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.67 KB | None | 0 0
  1. <?php
  2. class MemberDecorator extends DataObjectDecorator {
  3.  
  4. //Add extra database fields
  5. public function extraStatics()
  6. {
  7. return array(
  8. 'db' => array(
  9. "Degree" => "Enum('Bcom, Bcom(hons), BA, LLB, BSc, Bcom/LLB, BA/LLB, BSc/LLB, Bcom, Masters, MBus, PGDipcom')",
  10. "OtherDegree" => "Varchar",
  11. "StudentID" => "Varchar",
  12. "CellNumber" => "Varchar",
  13. "CurrentMajor" => "Varchar",
  14. "YearOfStudy" => "Enum('1st Year, 2nd Year, 3rd Year, 4th Year, 5th Year, 6th Year Plus, Postgraduate (Not Honours)')",
  15. "ExpectedGraduation" => "Varchar"
  16. )
  17. );
  18. }
  19.  
  20. //Add form fields to CMS
  21. public function updateCMSFields(FieldSet &$fields)
  22. {
  23. $fields->addFieldToTab("Root.Profile", new TextField('StudentID', 'Student ID Number'));
  24. $fields->addFieldToTab("Root.Profile", new TextField('CellNumber', 'Cell Phone Number'));
  25. $fields->addFieldToTab("Root.Profile", new DropdownField('Degree','Please select your degree from the following', $this->dbObject('Degree')->enumValues()));
  26. $fields->addFieldToTab("Root.Profile", new TextField('OtherDegree', 'Additional degree combination / other degree (if applicable)'));
  27. $fields->addFieldToTab("Root.Profile", new TextField('CurrentMajor', 'Current Major(s)'));
  28. $fields->addFieldToTab("Root.Profile", new DropdownField('YearOfStudy','Current Year of Study', $this->dbObject('YearOfStudy')->enumValues()));
  29. $fields->addFieldToTab("Root.Profile", new TextField('ExpectedGraduation', 'Year in which you expect to graduate'));
  30.  
  31. }
  32.  
  33. //Link to the edit profile page
  34. function Link()
  35. {
  36. if($ProfilePage = DataObject::get_one('EditProfilePage'))
  37. {
  38. return $ProfilePage->Link();
  39. }
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement