Hi,
I'm experiencing a problem with Filedom. I created a download class and a dowloadPage. All works fine, but when i create second page in the siteroot with this downloadpage template and when i display the items in the dom, all the downloads show up (also the ones from the first page in the siteroot).
Is there any way to add some kind of filter so that page1 shows only the entries in the dom for page one and page2 shows only the entries from the page2 dom?
this is my code so far:
Download.php
<?php
class Download extends DataObject
{
static $db = array (
'Naam' => 'Text',
'Omschrijving' => 'Text',
);
static $has_one = array (
'Bijlage' => 'File',
'DownloadPage' => 'DownloadPage'
);
public function getCMSFields_forPopup()
{
return new FieldSet(
new TextField('Naam'),
new TextareaField('Omschrijving'),
new FileIFrameField('Bijlage')
);
}
}
?>
DownloadPage.php
<?php
class DownloadPage extends Page
{
static $has_many = array (
'Bijlagen' => 'Download'
);
public function getCMSFields()
{
$f = parent::getCMSFields();
$manager = new FileDataObjectManager(
$this, // Controller
'Bijlagen', // Source name
'Download', // Source class
'Bijlage', // File name on DataObject
array(
'Naam' => 'Name',
'Omschrijving' => 'Description',
), // Headings
'getCMSFields_forPopup' // Detail fields (function name or FieldSet object)
// Filter clause
// Sort clause
// Join clause
);
$f->addFieldToTab("Root.Content.Downloads",$manager);
return $f;
}
}
class DownloadPage_Controller extends Page_Controller {
function AllDownloads() {
$bijlagen = DataObject::get_one("DownloadPage");
return ($bijlagen) ? DataObject::get("Download","", "", "", "") : false;
}
};
?>