public function getValueNice() { $retValue = $this->Value; $codes = MDCodeTypes::get_scope_codes(); if (isset($codes[$this->Value])) { $retValue = $codes[$this->Value]; } return $retValue; }
public function getTopicCategoryNice() { $retValue = ''; $codeTypes = MDCodeTypes::get_categories(); if (isset($codeTypes[$this->Value])) { if ($codeTypes[$this->Value] != "(please select a category)") { $retValue = $codeTypes[$this->Value]; } } return $retValue; }
/** * 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 getDateTypeNice() { $index = $this->MDDateType; $codeTypes = MDCodeTypes::get_date_types(); return isset($codeTypes[$index]) ? $codeTypes[$index] : MDCodeTypes::$default_for_null_value; }
/** * This method loads a provided array into the data structure. * It also creates dependencies, such as contact data objects * and populate the values into those objects. * * @param $data array of db-values. */ public function loadData($data) { if ($data == null) { return; } if (!is_array($data)) { return; } foreach ($data as $k => $v) { // store data into this object (no ':" in the string) if (strpos($k, ':') === false) { $this->{$k} = Convert::xml2raw($v); } else { // A ':' is used as a namespace marker. It is used to // create the related data objects, such as MDContacts. $relations = explode(':', $k); $fieldName = array_pop($relations); $relObj = $this; // iterate through the relationships. At the moment, this // loading process just works for 1 level hierarchies. foreach ($relations as $relation) { if ($relation == 'PointOfContacts') { // load the sub-array into the MDContact object $item = new MDContact(); $item->loadData($v); // add the new MDContect to the collection class of this // object. $relObj->PointOfContacts()->add($item); } if ($relation == 'MDContacts') { // load the sub-array into the MDContact object $item = new MDContact(); $item->loadData($v); // add the new MDContect to the collection class of this // object. $relObj->MDContacts()->add($item); } if ($relation == 'MDResourceConstraints') { // load the sub-array into the MDResourceConstraints object if (is_array($v)) { foreach ($v as $vitem) { $item = new MDResourceConstraint(); $item->loadData($vitem); // add the new MDContect to the collection class of this // object. $relObj->MDResourceConstraints()->add($item); } } } if ($relation == 'MDResourceFormats') { if (is_array($v)) { foreach ($v as $vitem) { // load the sub-array into the MDResourceFormats object $item = new MDResourceFormat(); $item->loadData($vitem); // add the new MDContect to the collection class of this // object. $relObj->MDResourceFormats()->add($item); } } } if ($relation == 'MDTopicCategory') { if (is_array($v)) { foreach ($v as $vitem) { // load the sub-array into the MDResourceFormats object $item = new MDTopicCategory(); $item->loadData($vitem); // add the new MDTopicCategory to the collection class of this // object. $relObj->MDTopicCategory()->add($item); } } } if ($relation == 'MDCitationDates') { if (is_array($v)) { foreach ($v as $vitem) { // load the sub-array into the MDResourceFormats object $item = new MDCitationDate(); $item->loadData($vitem); // add the new MDContect to the collection class of this // object. $relObj->MDCitationDates()->add($item); } } } if ($relation == 'MCPMDCreativeCommons') { if (is_array($v)) { foreach ($v as $vitem) { // load the sub-array into the MDContact object $item = new MCPMDCreativeCommons(); $item->loadData($vitem); // add the new MCPMDCreativeCommons to the collection class of this // object. $relObj->MCPMDCreativeCommons()->add($item); } } } if ($relation == 'CIOnlineResources') { if (is_array($v)) { foreach ($v as $vitem) { // load the sub-array into the MDContact object $item = new CIOnlineResource(); $item->loadData($vitem); // add the new MDContect to the collection class of this // object. $relObj->CIOnlineResources()->add($item); } } } if ($relation == 'MDHierarchyLevel') { if (is_array($v)) { foreach ($v as $vitem) { $codes = MDCodeTypes::get_scope_codes(); if (isset($codes[$vitem['Value']])) { $item = new MDHierarchyLevel(); $item->loadData($vitem); $relObj->MDHierarchyLevel()->add($item); } } } } if ($relation == 'MDHierarchyLevelName') { if (is_array($v)) { foreach ($v as $vitem) { $item = new MDHierarchyLevelName(); $item->loadData($vitem); $relObj->MDHierarchyLevelName()->add($item); } } } } } } }
/** * Returns the nice, human readable string for the codetype (defined by * the OGC ISO standard). * * @return string */ public function getUseConstraintsNice() { $index = $this->useConstraints; $codeTypes = MDCodeTypes::get_resource_constraints(); return isset($codeTypes[$index]) ? $codeTypes[$index] : MDCodeTypes::$default_for_null_value; }
/** * Returns the nice, human readable string for the codetype (defined by * the OGC ISO standard). * * @return string */ public function getCIOnlineFunctionNice() { $index = $this->CIOnlineFunction; $codeTypes = MDCodeTypes::get_online_resource_function(); return isset($codeTypes[$index]) ? $codeTypes[$index] : MDCodeTypes::$default_for_null_value; }