value: // key: name of the field // value is an array of parameters to define the field: // type: is required! and must be one of the following: // text: usual text field // checkbox: shows checkbox returns value // select: creates a selection list (drop down) // if a the parameter 'valueList' is set (to an array of strings) // it will be shown. // if it is not set, the list will be generated from the index // therefore the field name must match an index field // (if not an error will appear) // suggest: a field that provides suggestion on the input the user makes // number: creates a number field, where the user can choose integers. // it is recommended to define 'min' and 'max' in the 'config' array // deactivated: the field will not be writable // hideable: set to 'true' if the field can be added by the user on demand // config: is an array of attributes for the elements // e.g. 'size' or 'maxlength' // e.g. 'familyName' =>['type'=>'text', 'config'=>[size'=>45,'maxlength'=>45)) // (this will end up in a field like this: // ) // alt: if you have a group of fields, that have to be chosen one of them exclusively. // create a field in the field declaration section for each but only one in the // field definition section with the default selection and put the names of the // others in the 'alt' parameter see: familyName // TODO do we need or want this static??? private $_parameters = [ 'fullScientificName' => [ 'type' => 'suggest', 'config' => [ 'size' => 45, 'maxlength' => 150, 'name' => 'fullScientificName' ], // Rukeia 16-02-2015: HIER kann der Name (so wie er in der URL auftaucht geändert werden], default ist "SearchForm[familyName]" // Rukeia 23-03-2015: hier kann man 'value'=>'vorgegebener Input' definieren 'class' => 'test', 'name' => 'Scientific Name' ], 'familyName' => [ // 'alt' => ['orderName', 'className', 'phylumName', 'kingdomName'], 'config' => [ 'size' => 45, 'maxlength' => 150, 'name' => 'family' ], 'type' => 'suggest', 'name' => 'Family' ] // 'hideable'=>'true' , 'country' => [ 'type' => 'select', 'config' => [ 'size' => 285, 'maxlength' => 150, 'name' => 'country' ], 'name' => 'Country' ] // Rukeia 30-02-2015: added , // 'isocountrycode' => [ // 'name' => 'ISO-Code' // ], 'unitID' => [ // 'type' => 'deactivated' 'config' => [ 'size' => 45, 'maxlength' => 150, 'name' => 'unitID' ], 'type' => 'text', // freigeschaltet von Gabi 'name' => 'Sample, Voucher or Strain No' ] // Rukeia 30-02-2015: added , // 'fk_tripleidstoreid' => [ // 'name' => 'Test' // ], // 'collectioncode' => [ // 'name' => 'Collection Code' // ], // 'institutioncode' => [ // 'name' => 'Institution Code' // ], // 'sequenceaccessionIdentifier' => [ // 'type' => 'suggest', // 'config' => [ // 'size' => 45, // 'maxlength' => 150, // 'name' => 'id' // ], // 'name' => 'Sequence Accession ID' // ], 'geneticlocus' => [ 'type' => 'select', 'name' => 'Genetic Locus', 'config' => [ 'size' => 285, 'maxlength' => 150, 'name' => 'geneticlocus' ] ] // 'hideable'=>'true' , // ACHTUNG Select-Feld benötigt, aber grouped by wird von SOLR noch nicht unterstützt; muss über facet gemacht werden /* * 'taxonomyId' => [ * 'type' => 'deactivated' , * 'config'=>['size'=>45,'maxlength'=>150], * 'hideable'=>'true' * ], */ 'continent' => [ 'type' => 'select', 'name' => 'Continent', // 'type' => 'deactivated', 'config' => [ 'size' => 285, 'maxlength' => 150, 'name' => 'continent' ], 'hideable' => 'true' ] // Gabi hinzugefügt , 'sea' => [ 'type' => 'select', 'name' => 'Sea', 'config' => [ 'size' => 285, 'maxlength' => 150, 'name' => 'sea' ], 'hideable' => 'true' ], 'ocean' => [ 'type' => 'select', 'name' => 'Ocean', 'config' => [ 'size' => 285, 'maxlength' => 150, 'name' => 'ocean' ], 'hideable' => 'true' ], 'longitudeFrom' => [ 'type' => 'text', 'config'=>['size'=>45,'maxlength'=>150,'name' => 'longitudeFrom' ], 'hideable'=>'true', 'name' => 'Longitude min' ], 'longitudeTo' => [ 'type' => 'text', 'config'=>['size'=>45,'maxlength'=>150,'name' => 'longitudeTo' ], 'hideable'=>'true', 'name' => 'Longitude max' ], 'latitudeFrom' => [ 'type' => 'text', 'config'=>['size'=>45,'maxlength'=>150,'name' => 'latitudeFrom' ], 'hideable'=>'true', 'name' => 'Latitude min' ], 'latitudeTo' => [ 'type' => 'text', 'config'=>['size'=>45,'maxlength'=>150,'name' => 'latitudeTo' ], 'hideable'=>'true', 'name' => 'Latitude max' ], 'collectionYearFrom' => [ 'type' => 'text' , 'config'=>['size'=>45,'maxlength'=>150,'name'=>'collectionYearFrom'], 'hideable'=>'true', 'name' => 'Collection year from' ], 'collectionYearTo' => [ 'type' => 'text' , 'config'=>['size'=>45,'maxlength'=>150,'name'=>'collectionYearTo'], 'hideable'=>'true', 'name' => 'Collection year to' ], 'locality' => [ 'type' => 'text', 'name' => 'Locality', 'config' => [ 'size' => 45, 'maxlength' => 150, 'name' => 'locality' ], 'hideable' => 'true' ], 'collectors' => [ 'type' => 'text', 'name' => 'Collectors', 'config' => [ 'size' => 45, 'maxlength' => 150, 'name' => 'collectors' ], 'hideable' => 'true' ], 'collectornumber' => [ 'type' => 'text', 'name' => "Collector's No", 'config' => [ 'size' => 45, 'maxlength' => 150, 'name' => 'collectornumber' ], 'hideable' => 'true' ], /* 'hasTypestatus' => [ 'type' => 'checkbox', 'config'=>['size'=>45,'maxlength'=>150], // 'type' => 'deactivated', 'hideable'=>'true' ], 'hasImage' => [ 'type' => 'checkbox', 'config'=>['size'=>45,'maxlength'=>150], 'hideable'=>'true' ], */ 'institution' => [ 'type' => 'select', 'name' => 'Repository', 'config' => [ 'size' => 285, 'maxlength' => 150, 'name' => 'institution' ], ], /* 'genBankRecordAvailable' => [ // 'type' => 'deactivated', 'type' => 'checkbox', 'hideable'=>'true' ], 'boldRecordAvailable' => [ 'type' => 'deactivated' // 'type' => 'checkbox' ], */ 'sampletype' => [ 'type' => 'select', 'name' => 'Sample Type', 'config' => [ 'size' => 285, 'maxlength' => 150, 'name' => 'sampletype' ], 'hideable' => 'true' ], /* 'boldId' => [ 'type' => 'deactivated', 'config'=>['size'=>45,'maxlength'=>150], // 'type' => 'text', 'hideable'=>'true' ) */ ]; /* * ----------------- field declarations ------------------------ * put here all the same fields as you defined in the parameters array */ // voucher/specimen // fields marked with ***main field*** should be permanent, the other are hidden, and // can be added by the user - this is set up with the hideable parameter in the defenition area public $familyName; // TODO also other ranks: order, class, phylum, kingdom ***main field*** public $orderName; // TODO public $className; // TODO public $phylumName; // TODO public $kingdomName; // TODO public $fullScientificName; // Species //TODO have also search with * like "ac*" ***main field*** public $taxonomyId; // TODO later, not yet in index public $country; // ***main field*** public $isocountrycode; public $continent; // TODO public $sea; // TODO public $ocean; // TODO public $longitudeFrom; public $longitudeTo; public $latitudeFrom; public $latitudeTo; public $collectionYearFrom; public $collectionYearTo; public $locality; public $collectors; public $collectornumber; // TODO search collectornumber and fieldnumber public $hasTypestatus; // TODO recheck with Gabi what cases we exactly want to find if this field is choosen (see email to Gabi) public $hasImage; // boolean public $unitID; // TODO make over when index DB is corrected by Patricia // ***main field*** !!!use multivalued!!! // DNA // public $extractionNo; public $institution; // TODO felder "GenBank/EMBL/DDBJ Accession No" und "BOLD Process ID" // solange es noch keine spalte sequenceaccession.BoldID gibt, // für beide in sequenceaccession.accessionIdentifier suchen public $sequenceaccessionIdentifier; public $geneticlocus; public $fk_tripleidstoreid; public $collectioncode; public $institutioncode; // TODO beide felder zusammen, solange es noch kein feld sequenceaccession.BoldID gibt, // checke if sequenceaccession.accessionIdentifier ist vorhanden public $genBankRecordAvailable; // public $boldRecordAvailable; // TODO gibt es eine sequenceaccession.BoldID // -> erst wenn die spalte in die index db gebaut wurde public $sampletype; /* * ----------------- other settings ---------------------------- */ // title of the form: // TODO put some html-classes arround the strings private $_extendedSearchFormTitle = 'SEARCH'; private $_previewTitle= 'RESULTS OVERVIEW'; private $_detailsTitle= 'DETAILS'; // search button text: private $_extendedSearchButtonLabel = 'Search'; // Rukeia 16-02-2015: Das ist das Search-Button-Label. private $_refineSearchButtonLabel = 'Refine search'; private $_newSearchButtonLabel = 'New search'; // what string represents if nothing is chosen in the drop down lists // (technically it leads to everything (*)) private $_selectionListNonChosen = "---"; // string that is presented in a suggestion list if // the input does not match to any item private $_sugesstionListNoMatch = "-- no match --"; // default size of fields // - if you don't give a size in the definition area this value will be used private $_fieldSize = 50; // ---- keep your hands off these parameters--------------- // ------they will be initialized automatically (e.g see init()) private $_hideableList = [ ]; private $_hideableListFields = [ ]; private $_completeList = [ ]; // Rukeia 30-03-2015: added private $_completeListFields = [ ]; // Rukeia 30-03-2015: added // ------------- getters-------------------------------------- public function getParameters() { return $this->_parameters; } public function getExtendedSearchFormTitle() { return $this->_extendedSearchFormTitle; } public function getPreviewTitle() { return $this->_previewTitle; } public function getDetailsTitle() { return $this->_detailsTitle; } public function getExtendedSearchButtonLabel() { return $this->_extendedSearchButtonLabel; } public function getNewSearchButtonLabel() { return $this->_newSearchButtonLabel; } public function getRefineSearchButtonLabel() { return $this->_refineSearchButtonLabel; } public function getFieldsPerRow() { return $this->_fieldsPerRow; } public function getSelectionListNonChosen() { return $this->_selectionListNonChosen; } public function getSugesstionListNoMatch() { return $this->_sugesstionListNoMatch; } public function getHideableList() { return $this->_hideableList; } public function getHideableListFields() { return $this->_hideableListFields; } public function getCompleteList() { // Rukeia 30-03-2015: added return $this->_completeList; } public function getCompleteListFields() { // Rukeia 30-03-2015: added return $this->_completeListFields; } public function getFieldSize() { return $this->_fieldSize; } // @override /** * Declares customized attribute labels. * If not declared here, an attribute would have a label that is * the same as its name with the first letter in upper case. */ public function attributeLabels() { return [ 'taxonomyId' => 'Taxonomy ID (NCBI)', 'fullScientificName' => 'Scientific Name', 'sequenceaccessionIdentifier' => 'Genetic Accession Number', 'geneticlocus' => 'Genetic Locus', 'hasImage' => 'Image available', 'sampletype' => 'Sample Type', 'hasTypestatus' => 'Type Specimen/Strain', 'unitID' => 'Sample, Voucher or Strain No', 'phylumName' => 'Phylum/Division Name', 'continent' => 'Continent', 'sea' => 'Sea', 'locality' => 'Locality', 'collectors' => 'Collectors', 'collectornumber' => "Collectors' No", 'institution' => 'Repository', 'genBankRecordAvailable' => 'with Genetic Accession Number', 'latitudeFrom'=>'Latitude min', 'latitudeTo'=>'Latitude max', 'longitudeFrom'=>'Longitude min', 'longitudeTo'=>'Longitude max', 'collectionYearFrom'=>'Collection year min', 'collectionYearTo'=>'Collection year max', ]; } // @override public function init() { foreach ( $this->_parameters as $key => $attr ) { if (isset ( $attr ['hideable'] ) && $attr ['hideable'] == 'true') { $this->_hideableList [] = $key; $this->_hideableListFields [] = $attr ['name']; } // Rukeia 30-03-2015: added $this->_completeList [] = $key; $this->_completeListFields [] = $attr ['name']; } } // ----------------- validation rules ------------------------ // @override /** * Declares the validation rules. * each field that has no rules has to be at least assigned to the 'safe' validator */ public function rules() { return [ [['unitID', 'fullScientificName'], 'trim'], ]; } /* * validator for coordinates */ public function isLongitude($attribute) { if (! ((is_double ( $attribute )) && ($attribute <= - 180) && $attribute >= 180)) { $this->addError ( $attribute, "this is not a valid coodinate" ); } } }