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' =>array('type'=>'text', 'config'=>array(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 = array ( 'fullScientificName' => array ( 'type' => 'suggest', 'config' => array ( 'size' => 45, 'maxlength' => 150, 'name' => 'name' ), // 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' => array ( // 'alt' => array('orderName', 'className', 'phylumName', 'kingdomName'), 'config' => array ( 'size' => 45, 'maxlength' => 150, 'name' => 'family' ), 'type' => 'suggest', 'name' => 'Family' ) // 'hideable'=>'true' , 'country' => array ( 'type' => 'select', 'config' => array ( 'size' => 285, 'maxlength' => 150, 'name' => 'country' ), 'name' => 'Country' ) // Rukeia 30-02-2015: added , 'isocountrycode' => array ( 'name' => 'Test' ), 'unitID' => array ( // 'type' => 'deactivated' 'config' => array ( 'size' => 45, 'maxlength' => 150, 'name' => 'unitID' ), 'type' => 'text', // freigeschaltet von Gabi 'name' => 'Sample, Voucher or Strain No' ) // Rukeia 30-02-2015: added , 'fk_tripleidstoreid' => array ( 'name' => 'Test' ), 'collectioncode' => array ( 'name' => 'Test' ), 'institutioncode' => array ( 'name' => 'Test' ), 'sequenceaccessionIdentifier' => array ( 'type' => 'suggest', 'config' => array ( 'size' => 45, 'maxlength' => 150, 'name' => 'id' ), 'name' => 'TEST' ), 'geneticlocus' => array ( 'type' => 'select', 'name' => 'Genetic Locus', 'config' => array ( 'size' => 285, 'maxlength' => 150, 'name' => 'locus' ) ) // 'hideable'=>'true' , // ACHTUNG Select-Feld benötigt, aber grouped by wird von SOLR noch nicht unterstützt; muss über facet gemacht werden /* * 'taxonomyId' => array ( * 'type' => 'deactivated' , * 'config'=>array('size'=>45,'maxlength'=>150), * 'hideable'=>'true' * ), */ 'continent' => array ( 'type' => 'select', 'name' => 'Continent', // 'type' => 'deactivated', 'config' => array ( 'size' => 285, 'maxlength' => 150, 'name' => 'continent' ), 'hideable' => 'true' ) // Gabi hinzugefügt , 'sea' => array ( 'type' => 'select', 'name' => 'Sea', 'config' => array ( 'size' => 285, 'maxlength' => 150, 'name' => 'sea' ), 'hideable' => 'true' ), 'ocean' => array ( 'type' => 'select', 'name' => 'Ocean', 'config' => array ( 'size' => 285, 'maxlength' => 150, 'name' => 'ocean' ), 'hideable' => 'true' ),/* 'longitudeFrom' => array ( 'type' => 'text', 'config'=>array('size'=>45,'maxlength'=>150), 'hideable'=>'true', 'config' => array ( // 'size' => 10 ) ), 'longitudeTo' => array ( 'type' => 'text', 'config'=>array('size'=>45,'maxlength'=>150), 'hideable'=>'true', 'config' => array ( // 'size' => 10 ) ), 'latitudeFrom' => array ( 'type' => 'text', 'config'=>array('size'=>45,'maxlength'=>150), 'hideable'=>'true', 'config' => array ( // 'size' => 10 ) ), 'latitudeTo' => array ( 'type' => 'text', 'config'=>array('size'=>45,'maxlength'=>150), 'hideable'=>'true', 'config' => array ( // 'size' => 10 ) ), 'collectionYearFrom' => array ( 'type' => 'text' , 'config'=>array('size'=>45,'maxlength'=>150), 'hideable'=>'true', 'config' => array ( // 'size' => 10 ) ), 'collectionYearTo' => array ( 'type' => 'text' , 'config'=>array('size'=>45,'maxlength'=>150), 'hideable'=>'true', 'config' => array ( // 'size' => 10 ) ), */ 'locality' => array ( 'type' => 'text', 'name' => 'Locality', 'config' => array ( 'size' => 45, 'maxlength' => 150, 'name' => 'locality' ), 'hideable' => 'true' ), 'collectors' => array ( 'type' => 'text', 'name' => 'Collectors', 'config' => array ( 'size' => 45, 'maxlength' => 150, 'name' => 'collectors' ), 'hideable' => 'true' ), 'collectornumber' => array ( 'type' => 'text', 'name' => "Collector's No", 'config' => array ( 'size' => 45, 'maxlength' => 150, 'name' => 'collectornumber' ), 'hideable' => 'true' ), /* 'hasTypestatus' => array ( 'type' => 'checkbox', 'config'=>array('size'=>45,'maxlength'=>150), // 'type' => 'deactivated', 'hideable'=>'true' ), 'hasImage' => array ( 'type' => 'checkbox', 'config'=>array('size'=>45,'maxlength'=>150), 'hideable'=>'true' ), */ 'institution' => array ( 'type' => 'select', 'name' => 'Repository', 'config' => array ( 'size' => 285, 'maxlength' => 150, 'name' => 'repository' ), 'hideable' => 'true' ), /* 'genBankRecordAvailable' => array ( // 'type' => 'deactivated', 'type' => 'checkbox', 'hideable'=>'true' ), 'boldRecordAvailable' => array ( 'type' => 'deactivated' // 'type' => 'checkbox' ), */ 'sampletype' => array ( 'type' => 'select', 'name' => 'Sample Type', 'config' => array ( 'size' => 285, 'maxlength' => 150, 'name' => 'sampletype' ), 'hideable' => 'true' ), /* 'boldId' => array ( 'type' => 'deactivated', 'config'=>array('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 = '

GGBN Data Portal

'; // search button text: private $_extendedSearchButtonLabel = 'Search'; // Rukeia 16-02-2015: Das ist das Search-Button-Label. // 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 = array (); private $_hideableListFields = array (); private $_completeList = array (); // Rukeia 30-03-2015: added private $_completeListFields = array (); // Rukeia 30-03-2015: added // ------------- getters-------------------------------------- public function getParameters() { return $this->_parameters; } public function getExtendedSearchFormTitle() { return $this->_extendedSearchFormTitle; } public function getExtendedSearchButtonLabel() { return $this->_extendedSearchButtonLabel; } 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 array ( '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' ); } // @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() { $date = getdate ( time () ); $year = $date ['year']; return array ( array ( 'latitudeFrom, latitudeTo', 'numerical', 'min' => - 90, 'max' => 90, 'tooSmall' => 'Coordinate Latitude must not be smaller than {min}.', 'tooBig' => 'Coordinate Latitude must not be bigger than {max}.' ), array ( 'longitudeFrom, longitudeTo', 'numerical', 'min' => - 180, 'max' => 180, 'tooSmall' => 'Coordinate Longitude must not be smaller than {min}.', 'tooBig' => 'Coordinate Longitude must not be bigger than {max}.' ), array ( 'collectionYearFrom, collectionYearTo', 'numerical', 'min' => 1000, 'max' => $year, 'tooSmall' => 'please put Collection Year in four digit representation e.g. "1785" or "2013"', 'tooBig' => 'Collection Year is in the future.' ), // make everything else that has no rules valid array ( 'familyName, orderName, className, phylumName, kingdomName, fullScientificName, taxonomyId, country, continent, sea, ocean, collectionYearFrom, collectionYearTo, locality, collectors, collectornumber, hasTypestatus, hasImage, unitID, collectioncode, institutioncode, fk_tripleidstoreid, institution, accessionIdentifier, geneticlocus, genBankRecordAvailable, boldRecordAvailable, sampletype, boldId', 'safe' ) ); } /* * validator for coordinates */ public function isLongitude($attribute) { if (! ((is_double ( $attribute )) && ($attribute <= - 180) && $attribute >= 180)) { $this->addError ( $attribute, "this is not a valid coodinate" ); } } }