Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Defines the GuidePage page type
- */
- class GuidePage extends Page {
- static $db = array(
- 'Certification' =>"Varchar(100)",
- );
- static $has_one = array(
- 'Guide' => 'Image'
- );
- function getCMSFields() {
- $fields = parent::getCMSFields();
- $fields->addFieldToTab("Root.Content.Images", new ImageField('Guide'));
- $fields->addFieldToTab("Root.Content.Main", new CheckboxSetField ("Certification","Select the guide's certifications",
- array('IFMGA/UIAGM' => 'IFMGA/UIAGM','AMGA' => 'AMGA')),"Content");
- return $fields;
- }
- public function nextPager() {
- $where = "ParentID = ($this->ParentID + 0) AND Sort > ($this->Sort + 0 )";
- $pages = DataObject::get("SiteTree", $where, "Sort", "", 1);
- if($pages) {
- foreach($pages as $page) {
- return $page;
- }
- }
- }
- public function previousPager() {
- $where = "ParentID = ($this->ParentID + 0) AND Sort < ($this->Sort + 0)";
- $pages = DataObject::get("SiteTree", $where, "Sort DESC", "", 1);
- if($pages) {
- foreach($pages as $page) {
- return $page;
- }
- }
- }
- }
- class GuidePage_Controller extends Page_Controller {
- function getInfo(){
- if (Director::urlparam('ID')) {
- $Guide = DataObject::get_by_id("GuidePage",Director::urlparam('ID'));
- return $this->customise( array(
- 'Title' => $Guide->Title ."'s Profile",
- 'Content' => '' . $Guide->Content
- ))->renderWith("guide_getinfo");
- }
- }
- }
- ?>
Add Comment
Please, Sign In to add comment