public function __construct($controller, $name = null, $sourceClass = null, $fileFieldName = null, $fieldList = null, $detailFormFields = null, $sourceFilter = "", $sourceSort = "", $sourceJoin = "") { $this->setFilter('AlbumID', _t('ImageGalleryManager.CHOOSEALBUM', 'Choose an album'), $controller->Albums()->toDropdownMap('ID', 'AlbumName')); if ($controller->Albums()->Count() > 0) { $this->filter = "AlbumID_" . $controller->Albums()->First()->ID; } parent::__construct($controller, $name, $sourceClass, $fileFieldName, $fieldList, $detailFormFields, $sourceFilter, $sourceSort, $sourceJoin); if (!class_exists("ImageDataObjectManager")) { die("<strong>" . _t('ImageGalleryManager.ERROR', 'Error') . "</strong>: " . _t('ImageGalleryManager.DATAOBJECTMANAGER', 'ImageGallery requires the DataObjectManager module.')); } $this->setAddTitle(_t("ImageGalleryPage.IMAGES", "images") . " " . _t("ImageGalleryPage.TO", "to") . " \"" . $this->CurrentAlbumTitle() . "\""); $this->filter_empty_string = false; }
public function __construct($controller, $name, $sourceClass = "Image", $headings = null) { if ($headings === null) { $headings = array('Title' => 'Title', 'Filename' => 'Filename'); } $fields = singleton($sourceClass)->getCMSFields(); $fields->removeByName("OwnerID"); $fields->removeByName("Parent"); $fields->removeByName("Filename"); $fields->removeByName("SortOrder"); $fields->removeByName("Sort"); $fields->push(new ReadonlyField('Filename')); $fields->push(new SimpleTreeDropdownField('ParentID', 'Folder', "Folder")); $fields->push(new HiddenField('ID', '', $controller->ID)); parent::__construct($controller, $name, $sourceClass, null, $headings, $fields, "Classname != 'Folder'"); }
public function __construct($controller, $name, $sourceClass, $fileFieldName, $fieldList = null, $detailFormFields = null, $sourceFilter = "", $sourceSort = "", $sourceJoin = "") { parent::__construct($controller, $name, $sourceClass, $fileFieldName, $fieldList, $detailFormFields, $sourceFilter, $sourceSort, $sourceJoin); if (!class_exists("ImageDataObjectManager")) { die("<strong>Error</strong>: PhotoAlbumPage requires the DataObjectManager module."); } $this->setGridLabelField('Caption'); $this->setAddTitle('Photos'); // We have to specify this here or when you subclass the PhotoAlbumPage the manager can't work out the parent relationship. // I.E. it looks for PhotoAlbumPage_Photo -- has_one -- SubClass, rather than the correct relation of PhotoAlbumPage_Photo -- has_one -- PhotoAlbumPage. $this->setParentClass('PhotoAlbumPage'); }