Exemplo n.º 1
0
 public function CreateHeatmapForm()
 {
     $includeWatermark = array("1" => "Yes,Include Watermark", "0" => "No,Remove Watermark");
     $fields = new FieldList($imageField = new FileField('OriginalImage', 'Upload an Image File'), new LiteralField('UploadInfo', 'Acceptable images are jpg or png, 500-1600 pixels wide by 500-1200 pixels height.<hr>'), new OptionsetField('IncludeWatermark', 'Include Watermark?', $includeWatermark, 1));
     $imageField->getValidator()->setAllowedExtensions(array('jpg', 'jpeg', 'png'));
     $imageField->setAttribute('class', 'jfilestyle');
     $imageField->setAttribute('data-buttonText', "<img src='themes/attwiz/images/button-create-heatmap-browse.jpg'></img>");
     $imageField->setAttribute('data-placeholder', 'No file selected..');
     // Create action
     $actions = new FieldList($submit = new FormAction('processCreateHeatmap', ''));
     $submit->setAttribute('src', 'themes/attwiz/images/button-create-heatmap-blue-bg.jpg');
     // Create action
     $validator = new RequiredFields('OriginalImage', 'IncludeWatermark');
     return new Form($this, 'CreateHeatmapForm', $fields, $actions, $validator);
 }