16/10/2013 10:17am

PHP | Problem -


<?php

class GalleryHolder extends Page {

private static $singular_name = 'Gallery Holder';
private static $plural_name = 'Gallery Holders';
private static $description = 'A Gallery Holder is required for one or multiple Galleries';

private static $can_be_root = true;
private static $allowed_children = array('Gallery');
private static $default_child = 'Gallery';

private static $icon = 'mysite/icons/gallery_holder_icon.png';

//////////////////////////////////////////////

private static $db = array(

);

private static $has_one = array(

);

private static $has_many = array(

);

private static $many_many = array(

);

private static $defaults = array(

);

//////////////////////////////////////////////

public function getCMSFields() {
$fields = parent::getCMSFields();

// $fields->removeFieldsFromTab('Root.Main', array('Content', 'Metadata', 'MetaDescription', 'ExtraMeta'));

return $fields;
}

}

class GalleryHolder_Controller extends Page_Controller {

public function getChildren(){
$Children = $this->Children();
return $Children;
}

public function getRandomPreview($num=3) {
$galleryImages = DataObject::get('VisualObject', '', 'RAND()', '', $num)->filter(array(
'Visibility' => 'true'
));
return $galleryImages;
}



}

?>


Post Comment