/**
  * Add the default search parameter fields to the CMS form.
  */
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     // Remove the Behaviour and Access tabs so no one can muck with those fields.
     $fields->removeByName('Behaviour');
     $fields->removeByName('Access');
     // Add a new "Settings" tab.
     $fields->findOrMakeTab("Root.Content.Settings", "Default Search Settings");
     // A short description of why this tab is here.
     $fields->addFieldToTab("Root.Content.Settings", new LiteralField("DefaultDescriptiveText", '<div style="padding:8px;font-size:10px;color:#333333;"><p>Use the following fields to enter the default job search criteria for the SimplyHired Jobamatic API. These values will be used when initially populating the job listling page on your site.</p></div>'));
     // Default search query field.
     $fields->addFieldToTab("Root.Content.Settings", new TextField("DefaultQuery", "Search string"));
     $fields->addFieldToTab("Root.Content.Settings", new LiteralField("DefaultQueryText", $this->getQueryDescriptionText()));
     // Default location field
     $fields->addFieldToTab("Root.Content.Settings", new TextField("DefaultLocation", "Location"));
     $fields->addFieldToTab("Root.Content.Settings", new LiteralField("DefaultLocationText", '<div style="padding:8px;font-size:10px;color:#333333;"><p>(Optional) A collection of terms indicating the geographic filter for the results. Location can be a zipcode, state, or city-state combination. Currently, there is no support for multiple location search.</p></div>'));
     // Default miles field
     $fields->addFieldToTab("Root.Content.Settings", new TextField("DefaultMiles", "Miles"));
     $fields->addFieldToTab("Root.Content.Settings", new LiteralField("DefaultMilesText", '<div style="padding:8px;font-size:10px;color:#333333;"><p>(Optional). A parameter indicating the number of miles from the location specified by the &quot;<em>Location</em>&quot; parameter above. Miles value should be a positive integer from &quot;1&quot; to &quot;100&quot;. (To exclude this field in the API requests, leave blank.) Miles represents the radius from the zip code, if specified in Location, or an approximate geographical &quot;city center&quot; if only city and state are present. If Miles is not specified, search will default to a radius of 25 miles. For jobs only within a specific city use &quot;mi-exact&quot;.</p></div>'));
     // Default sort field.
     $fields->addFieldToTab("Root.Content.Settings", new DropdownField("DefaultSort", "Sort by", JobamaticPage::getDropdownOptions('sort')));
     $fields->addFieldToTab("Root.Content.Settings", new LiteralField("DefaultSortText", '<div style="padding:8px;font-size:10px;color:#333333;"><p>A parameter indicating the sort order of organic jobs (sponsored jobs have a fixed sort order).</p></div>'));
     // Default window size field.
     $fields->addFieldToTab("Root.Content.Settings", new DropdownField("DefaultWindowSize", "Results per page", JobamaticPage::getDropdownOptions('window')));
     $fields->addFieldToTab("Root.Content.Settings", new LiteralField("DefaultWindowSizeText", '<div style="padding:8px;font-size:10px;color:#333333;"><p>A positive integer representing the number of results returned. When available, the XML Results API will return 10 jobs by default. The API is limited to a maximum of 100 results per request.</p></div>'));
     return $fields;
 }
 function __construct($controller, $name, $fields = null, $actions = null, $useAdvanced = FALSE)
 {
     if (!$fields) {
         $query = isset($_GET['SearchQuery']) ? urldecode($_GET['SearchQuery']) : '';
         $fields = new FieldSet(new TextField('SearchQuery', 'Search for', $query, 300));
     }
     if ($useAdvanced === TRUE) {
         $fields->push(new LiteralField('Spacer', '<div style="height:1px;"></div>'));
         $fields->push(new TextField('SearchLocation', 'Location', isset($_GET['SearchLocation']) ? urldecode($_GET['SearchLocation']) : ''));
         $fields->push(new TextField('SearchMiles', 'Miles', isset($_GET['SearchMiles']) ? urldecode($_GET['SearchMiles']) : NULL, 4));
         $fields->push(new DropdownField('SearchSort', 'Sort', JobamaticPage::getDropdownOptions('sort'), isset($_GET['SearchSort']) ? urldecode($_GET['SearchSort']) : ''));
         $fields->push(new DropdownField('SearchWindow', 'Results per page', JobamaticPage::getDropdownOptions('window'), isset($_GET['SearchWindow']) ? urldecode($_GET['SearchWindow']) : ''));
     }
     if (!$actions) {
         $actions = new FieldSet(new FormAction("jobresults", 'Search Jobs'));
     }
     parent::__construct($controller, $name, $fields, $actions, new RequiredFields(array('SearchQuery')));
     $this->setFormMethod('get');
     $this->disableSecurityToken();
 }