Guest User

Untitled

a guest
Jun 20th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. <?php
  2. /**
  3. * Defines the GuidePage page type
  4. */
  5. class GuidePage extends Page {
  6. static $db = array(
  7. 'Certification' =>"Varchar(100)",
  8.  
  9. );
  10. static $has_one = array(
  11. 'Guide' => 'Image'
  12. );
  13.  
  14. function getCMSFields() {
  15. $fields = parent::getCMSFields();
  16. $fields->addFieldToTab("Root.Content.Images", new ImageField('Guide'));
  17.  
  18. $fields->addFieldToTab("Root.Content.Main", new CheckboxSetField ("Certification","Select the guide's certifications",
  19. array('IFMGA/UIAGM' => 'IFMGA/UIAGM','AMGA' => 'AMGA')),"Content");
  20. return $fields;
  21. }
  22.  
  23.  
  24. public function nextPager() {
  25. $where = "ParentID = ($this->ParentID + 0) AND Sort > ($this->Sort + 0 )";
  26. $pages = DataObject::get("SiteTree", $where, "Sort", "", 1);
  27. if($pages) {
  28. foreach($pages as $page) {
  29. return $page;
  30. }
  31. }
  32. }
  33. public function previousPager() {
  34. $where = "ParentID = ($this->ParentID + 0) AND Sort < ($this->Sort + 0)";
  35. $pages = DataObject::get("SiteTree", $where, "Sort DESC", "", 1);
  36. if($pages) {
  37. foreach($pages as $page) {
  38. return $page;
  39. }
  40. }
  41. }
  42.  
  43.  
  44.  
  45. }
  46. class GuidePage_Controller extends Page_Controller {
  47.  
  48. function getInfo(){
  49. if (Director::urlparam('ID')) {
  50. $Guide = DataObject::get_by_id("GuidePage",Director::urlparam('ID'));
  51. return $this->customise( array(
  52. 'Title' => $Guide->Title ."'s Profile",
  53. 'Content' => '' . $Guide->Content
  54. ))->renderWith("guide_getinfo");
  55. }
  56. }
  57.  
  58. }
  59. ?>
Add Comment
Please, Sign In to add comment