Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function Form() {
- $measurement = new TextField('Measurement', 'Measurement');
- $siteId = new TextField('SiteId', 'Site ID');
- $recentTimeCount = DropdownField::create('recenttimecount')
- ->setSource(array(0 => '1',
- 1 => '2',
- 1 => '3',
- 1 => '4',
- 1 => '5',
- 1 => '6',
- 1 => '10',
- 1 => '12'))->setEmptyString('select');
- $recentTimeUnit = DropdownField::create('recenttimeunit')
- ->setSource(array(0 => 'Hour',
- 1 => 'Day',
- 2 => 'Week',
- 3 => 'Month'))->setEmptyString('select');
- $tickSpacingCount = Dropdownfield::create('tickspacingcount')
- ->setSource(array(0 => '1',
- 1 => '2',
- 2 => '3',
- 3 => '4',
- 4 => '5',
- 5 => '6',
- 6 => '10',
- 7 => '12'))->setEmptyString('select');
- $tickSpacingUnit = Dropdownfield::create('tickspacingunit')
- ->setSource(array(0 => 'Hour',
- 1 => 'Day',
- 2 => 'Week',
- 3 => 'Month'))->setEmptyString('select');
- $topLabel = new TextField('toplable', 'Top Label');
- $verticalLabel = new TextField('verticallabel', 'Vertical Label');
- $timeRangeStart = new DateField('timerangestart', 'Start Date');
- $timeRangeEnd = new DateField('timerangeend', 'End Date');
- $color = Dropdownfield::create('color')
- ->setSource(array(0 => 'Red',
- 1 => 'Blue'))->setEmptyString('select');
- $xAxis = Dropdownfield::create('xAxis')
- ->setSource(array(0 => '600',
- 1 => '900',
- 2 => '1200'))->setEmptyString('select');
- $yAxis = Dropdownfield::create('yAxis')
- ->setSource(array(0 => '300',
- 1 => '450',
- 2 => '600'))->setEmptyString('select');
- $returnType = 'Graph';
- $fields = new FieldList(
- $measurement,
- $siteId,
- $recentTimeCount,
- $recentTimeUnit,
- $tickSpacingCount,
- $tickSpacingUnit,
- $topLabel,
- $verticalLabel,
- $timeRangeStart,
- $timeRangeEnd,
- $color,
- $xAxis,
- $yAxis,
- $returnType
- );
- $validator = new RequiredFields('measurement',
- 'SiteId',
- 'recenttimecount',
- 'recenttimeunit',
- 'tickspacingcount',
- 'tickspacingunit',
- 'toplable',
- 'verticallabel',
- 'timerangestart',
- 'timerangeend',
- 'color',
- 'xAxis',
- 'yAxis');
- if ($this->HasGraphBinary())
- {
- $fields->push(LiteralField::create('MyGraph', '<img src="' . $this->myGraph . ' "</img>'));
- }
- $action = new FormAction('doSubmit', _t('GraphingPage.SubmitText', 'Generate Graph'));
- $actions = new FieldList(
- $action
- );
- $form = new Form($this, 'Form', $fields, $actions, $validator);
- return $form;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement