function __construct($controller, $name, $cleanupID) { // Get The clean Up we need to edit $cleanupgroup = DataObject::get_one('CleanUpGroup', "CleanUpGroup.ID = '{$cleanupID}'"); //Get The Regions //$lat = $cleanupgroup->LocationLatitude; //$lon = $cleanupgroup->LocationLongitude; //$loc = $cleanupgroup->LocationAddress; $image1 = new ImageUploadField("Image", "Upload an image"); $image1->setUploadFolder("EventImages2010"); //$image1->uploadOnSubmit(); //$image1->noUploadOnSubmit(); //fields $uploadimagesFields = new CompositeField(new HeaderField('Add an Image to your Event Gallery', 3), new LiteralField('Help', '<p class="help">Please upload as many images as you would like by clicking "Upload Images" again when redirected to your event\'s page.</p><p>The maximum allowed file size is 2MB and allowed file extensions are jpg, gif and png.</p><p><strong>NOTE - Because this image is hosted on Flickr, there may be a delay between uploading your image and it appearing in your event\'s image gallery. </strong> <p>Thank you for contributing.</p>'), $image1, new TextField('Caption', 'Image Caption'), new HiddenField('CleanUpID', 'CleanUpID', $cleanupID)); $fields = new FieldSet($uploadimagesFields); //val and doubleselect stuff Requirements::javascript("mysite/javascript/UploadFormVal.js"); //actions $actions = new FieldSet(new FormAction('uploadimages', 'Upload')); parent::__construct($controller, $name, $fields, $actions); }
function __construct($controller, $name, $cleanupID) { // Get The clean Up we need to edit $cleanupgroup = DataObject::get_one('CleanUpGroup', "CleanUpGroup.ID = '{$cleanupID}'"); //Get The Regions //$lat = $cleanupgroup->LocationLatitude; //$lon = $cleanupgroup->LocationLongitude; //$loc = $cleanupgroup->LocationAddress; $image1 = new ImageUploadField("EventImage", "Upload an event image"); $image1->setUploadFolder("EventImages2010"); //$image1->uploadOnSubmit(); //$image1->noUploadOnSubmit(); //fields $uploadimagesFields = new CompositeField(new LiteralField('Help', '<p class="help">The maximum allowed file size is 150KB and allowed file extensions are jpg, gif and png.</p>'), $image1, new HiddenField('CleanUpID', 'CleanUpID', $cleanupID)); $fields = new FieldSet($uploadimagesFields); //val and doubleselect stuff Requirements::javascript("mysite/javascript/UploadFormVal.js"); //actions $actions = new FieldSet(new FormAction('uploadimages', 'Upload')); parent::__construct($controller, $name, $fields, $actions); }
/** * customizes the backends fields, mainly for ModelAdmin * * @param array $params configuration parameters * * @return FieldList the fields for the backend */ public function getMinimizedCMSFields($params = null) { $fields = $this->getCMSFieldsForContext(array_merge(array('restrictFields' => array('SortOrder')), (array) $params)); if ($this->ID) { $imageUploadField = new ImageUploadField('Image', $this->fieldLabel('Image')); $imageUploadField->setUploadFolder('assets/Uploads/PartnerLogos'); $fields->insertBefore($imageUploadField, 'SortOrder'); } $fields->removeByName('Content'); $fields->removeByName('Description'); $fields->removeByName('SortOrder'); return $fields; }