11/03/2012 1:07am

PHP | Problem -


<?php 

class ResourcePage extends Page
{
static $db = array(
'HotelName' => 'Text',
'Lat' => 'Text',
'Long' => 'Text'
);

static $has_many = array (
'Resources' => 'Resource'
);

public static $has_one = array(
'RelatedLink1' => 'SiteTree',
'RelatedLink2' => 'SiteTree',
'RelatedLink3' => 'SiteTree',
'HotelThumb' => 'File'
);

public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->addFieldToTab( 'Root.Content.Main', new TextField( 'HotelName' ) );
$fields->addFieldToTab( 'Root.Content.Main', new TextField( 'Lat' ) );
$fields->addFieldToTab( 'Root.Content.Main', new TextField( 'Long' ) );
$fields->addFieldToTab( 'Root.Content.Main', new FileIFrameField( 'HotelThumb' ) );

$treedropdownfield1 = new TreeDropdownField("RelatedLink1ID", "Choose a hotel that wish to link to:", "SiteTree");
$treedropdownfield2 = new TreeDropdownField("RelatedLink2ID", "Choose a hotel that wish to link to:", "SiteTree");
$treedropdownfield3 = new TreeDropdownField("RelatedLink3ID", "Choose a hotel that wish to link to:", "SiteTree");

$fields->addFieldToTab("Root.Content.RelatedHotels", $treedropdownfield1);
$fields->addFieldToTab("Root.Content.RelatedHotels", $treedropdownfield2);
$fields->addFieldToTab("Root.Content.RelatedHotels", $treedropdownfield3);


$manager = new ImageDataObjectManager(
$this, // Controller
'Resources', // Source name
'Resource', // Source class
'Attachment', // File name on DataObject
array(
'Description' => 'Description'
), // Headings
'getCMSFields_forPopup' // Detail fields (function name or FieldSet object)
// Filter clause
// Sort clause
// Join clause
);
$fields->addFieldToTab("Root.Content.Hotel Images",$manager);
return $fields;
}
}


Post Comment