/** * Initiate the standard Metadata catalogue search form. The * additional parameter $defaults defines the default values for the form. * * @param Controller $controller The parent controller, necessary to create the appropriate form action tag. * @param String $name The method on the controller that will return this form object. * @param FieldSet $fields All of the fields in the form - a {@link FieldSet} of {@link FormField} objects. * @param FieldSet $actions All of the action buttons in the form - a {@link FieldSet} of {@link FormAction} objects * @param Validator $validator Override the default validator instance (Default: {@link RequiredFields}) */ function __construct($controller, $name, FieldSet $fields = null, FieldSet $actions = null, $validator = null) { $recaptchaField = $this->getRecaptchaField(); if (!$fields) { // Create fields //adding extra class for custom validation $title = new TextField('MDTitle', "TITLE"); $title->addExtraClass("required"); $fields = new FieldSet(new CompositeField($title, new TextareaField('MDAbstract'), new CalendarDateField('MDDateTime1'), new DropdownField('MDDateType1', 'DateType', MDCodeTypes::get_date_types(), ""), new CalendarDateField('MDDateTime2'), new DropdownField('MDDateType2', 'DateType', MDCodeTypes::get_date_types(), ""), new CalendarDateField('MDDateTime3'), new DropdownField('MDDateType3', 'DateType', MDCodeTypes::get_date_types(), ""), new ListboxField('MDTopicCategory', 'Category', MDCodeTypes::get_categories(), "", 8, true)), new CompositeField(new DropdownField('MDSpatialRepresentationType', 'Spatial Representation Type', MDCodeTypes::get_spatial_representation_type(), ""), new TextField('MDGeographicDiscription', 'Geographic Description'), new TextField('MDWestBound'), new TextField('MDEastBound'), new TextField('MDSouthBound'), new TextField('MDNorthBound'), new DropdownField('ISOPlaces', 'ISOPlaces', MDCodeTypes::get_places(), "170;180;-52.57806;-32.41472"), new DropdownField('Places', 'Places', NewZealandPlaces::get_nzplaces(), "-141;160;-7;-90"), new DropdownField('OffshoreIslands', 'NZ Offshore islands', NewZealandPlaces::get_nzoffshoreislands(), ""), new DropdownField('Dependencies', 'NZ Dependencies in the South West Pacific', NewZealandPlaces::get_nzdependencies(), ""), new DropdownField('Regions', 'Regions', NewZealandPlaces::get_nzregions(), ""), new DropdownField('TAs', 'TAs', NewZealandPlaces::get_nzta(), "")), new CompositeField(new TextField('MDIndividualName'), new TextField('MDOrganisationName'), new TextField('MDPositionName'), new TextField('MDVoice'), new HiddenField('MDVoiceData'), new EmailField('MDElectronicMailAddress'), new HiddenField('MDElectronicMailAddressData')), new CompositeField(new DropdownField('ResourceFormatsList1', 'ResourceFormatsList1', MDCodeTypes::get_resource_formats(), ""), new TextField('MDResourceFormatName1', 'MDResourceFormatName1', ""), new TextField('MDResourceFormatVersion1', 'MDResourceFormatVersion1', "")), new CompositeField(new DropdownField('ResourceFormatsList2', 'ResourceFormatsList2', MDCodeTypes::get_resource_formats(), ""), new TextField('MDResourceFormatName2', 'MDResourceFormatName2', ""), new TextField('MDResourceFormatVersion2', 'MDResourceFormatVersion2', "")), new CompositeField(new DropdownField('ResourceFormatsList3', 'ResourceFormatsList3', MDCodeTypes::get_resource_formats(), ""), new TextField('MDResourceFormatName3', 'MDResourceFormatName3', ""), new TextField('MDResourceFormatVersion3', 'MDResourceFormatVersion3', "")), new CompositeField(new DropdownField('ResourceFormatsList4', 'ResourceFormatsList4', MDCodeTypes::get_resource_formats(), ""), new TextField('MDResourceFormatName4', 'MDResourceFormatName4', ""), new TextField('MDResourceFormatVersion4', 'MDResourceFormatVersion4', "")), new CompositeField(new DropdownField('ResourceFormatsList5', 'ResourceFormatsList5', MDCodeTypes::get_resource_formats(), ""), new TextField('MDResourceFormatName5', 'MDResourceFormatName5', ""), new TextField('MDResourceFormatVersion5', 'MDResourceFormatVersion5', "")), new CompositeField(new DropDownField('MDHierarchyLevel', 'MDHierarchyLevel', MDCodeTypes::get_scope_codes_keys(), ""), new HiddenField('MDHierarchyLevelData', 'MDHierarchyLevelData', ""), new TextField('MDHierarchyLevelName', 'MDHierarchyLevelName', ""), new HiddenField('MDHierarchyLevelNameData', 'MDHierarchyLevelNameData', ""), new TextField('MDParentIdentifier', 'MDParentIdentifier', "")), new CompositeField(new TextField('CIOnlineLinkage', 'CIOnlineLinkage', ""), new HiddenField('CIOnlineLinkageData', 'CIOnlineLinkageData', ""), new DropdownField('CIOnlineProtocol', 'CIOnlineProtocol', MDCodeTypes::get_online_resource_protocol(), ""), new TextField('CIOnlineName', 'CIOnlineName', ""), new TextField('CIOnlineDescription', 'CIOnlineDescription', ""), new DropdownField('CIOnlineFunction', 'CIOnlineFunction', MDCodeTypes::get_online_resource_function(), "")), new CompositeField(new DropdownField('useLimitation', 'License', MDCodeTypes::get_use_limitation(), ""))); } if ($recaptchaField) { $fields->push($recaptchaField); } if (!$actions) { $actions = new FieldSet(new FormAction('doRegisterMetadata', 'Submit')); } if (!$validator) { $validator = new RequiredFields('MDTitle', 'MDAbstract', 'MDElectronicMailAddress', 'MDDateTime', 'MDTopicCategory'); } $validator->setJavascriptValidationHandler('none'); parent::__construct($controller, $name, $fields, $actions, $validator); }
/** * Returns the nice, human readable string for the codetype (defined by * the OGC ISO standard). * * @return string */ public function getPlaceName() { $index = $this->MDWestBound . ";" . $this->MDEastBound . ";" . $this->MDSouthBound . ";" . $this->MDNorthBound; $result = ''; $codeTypes = MDCodeTypes::get_places(); if (isset($codeTypes[$index])) { $result = $codeTypes[$index]; } return $result; }