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??? public $_parameters = [ 'fullScientificName' => [ 'type' => 'suggest', 'config' => [ 'size' => 45, 'maxlength' => 150, 'name' => 'fullScientificName' ], 'class' => 'test', 'name' => 'Scientific name' ], 'country' => [ 'type' => 'select', 'config' => [ 'size' => 285, 'maxlength' => 150, 'name' => 'country' ], 'name' => 'Country' ], 'locality' => [ 'type' => 'text', 'name' => 'Locality', 'config' => [ 'size' => 45, 'maxlength' => 150, 'name' => 'locality' ], // 'hideable' => 'true' ], 'collectors' => [ 'type' => 'text', 'name' => 'Collector(s)', 'config' => [ 'size' => 45, 'maxlength' => 150, 'name' => 'collectors' ] ] // 'hideable' => 'true' , 'collectornumber' => [ 'type' => 'text', 'name' => "Field or collector number", 'config' => [ 'size' => 45, 'maxlength' => 150, 'name' => 'collectornumber' ] ] // 'hideable' => 'true' , 'indexHerbarorium' => [ 'type' => 'select', 'name' => 'Index Herbarorium code', 'config' => [ 'size' => 285, 'maxlength' => 150, 'name' => 'indexHerbarorium', 'disabled' => true, ], 'disabled' => true, ], 'collectioncode' => [ 'type' => 'select', 'name' => 'Collection or subcollection', 'config' => [ 'size' => 285, 'maxlength' => 150, 'name' => 'collectioncode' ], 'hideable' => 'true', ], // 'isocountrycode' => [ // 'name' => 'ISO-Code' // ], 'unitID' => [ 'config' => [ 'size' => 45, 'maxlength' => 150, 'name' => 'unitID' ], 'type' => 'text', // freigeschaltet von Gabi 'name' => 'Specimen ID' ], 'institutioncode' => [ 'type' => 'select', 'name' => 'Institution code', 'config' => [ 'size' => 285, 'maxlength' => 150, 'name' => 'institutioncode' ] , 'hideable' => 'true', ], 'institution' => [ 'type' => 'select', 'name' => 'Repository', 'config' => [ 'size' => 285, 'maxlength' => 150, 'name' => 'institution' ], 'hideable' => 'true', ], 'collectionYear' => [ 'type' => 'range', 'config' => [ 'size' => 40, 'width' => '150px', 'name' => 'Collection Year', 'attribute1' => 'collectionYearFrom', 'attribute2' => 'collectionYearTo', 'attribute1value' => 'collectionYearFrom', 'attribute2value' => 'collectionYearTo', 'type' => \kartik\field\FieldRange::INPUT_TEXT ], 'hideable' => 'true', 'name' => 'Collection Year' ], 'continent' => [ 'type' => 'select', 'name' => 'Continent', 'config' => [ 'size' => 285, 'maxlength' => 150, 'name' => 'continent' ], 'hideable' => 'true' ], 'coordinates' => [ 'type' => 'range', 'config' => [ 'size' => 40, 'width' => '150px', 'name' => 'Coordinates', 'label' => 'Latitude', 'attribute1' => 'latitudeFrom', 'attribute2' => 'latitudeTo', 'attribute1value' => 'latitudeFrom', 'attribute2value' => 'latitudeTo', 'label2' => 'Longitude', 'attribute3' => 'longitudeFrom', 'attribute4' => 'longitudeTo', 'attribute3value' => 'longitudeFrom', 'attribute4value' => 'longitudeTo', 'type' => \kartik\field\FieldRange::INPUT_TEXT ], 'hideable' => 'true', 'name' => 'Coordinates' ], 'ocean' => [ 'type' => 'select', 'name' => 'Ocean', 'config' => [ 'size' => 285, 'maxlength' => 150, 'name' => 'ocean' ], 'hideable' => 'true' ], 'sea' => [ 'type' => 'select', 'name' => 'Sea', 'config' => [ 'size' => 285, 'maxlength' => 150, 'name' => 'sea' ], 'hideable' => 'true' ], 'hasTypestatus' => [ 'type' => 'checkbox', 'name' => 'Type status' , 'config' => [ 'size' => 45, 'maxlength' => 150, 'name' => 'hasTypestatus' ], // 'type' => 'deactivated', // 'hideable' => 'true' ], 'hasImage' => [ 'type' => 'checkbox', 'name' => 'Multimedia' , 'config' => [ 'size' => 45, 'maxlength' => 150, 'name' => 'hasImage' , ], // '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 $genusName; public $familyName; public $orderName; public $className; public $phylumName; public $kingdomName; 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; public $cites; // ***main field*** !!!use multivalued!!! // DNA // public $extractionNo; public $institution; public $voucherCol; public $indexHerbarorium; // 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 $kingdom; public $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 = 'Search'; // private $_newSearchButtonLabel = 'New search'; // private $_saveSearchButtonLabel = 'Save Search'; // Hartebrodt 22-07-15 // private $_searchName; // Hartebrodt 23-07-15: name a search to store it in the database // // 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', 'kingdom' => 'Kingdom', 'hasImage' => 'Image available', 'sampletype' => 'Sample Type', 'hasTypestatus' => 'Type Specimen/Strain', 'unitID' => 'Specimen ID', 'phylumName' => 'Phylum/Division Name', 'continent' => 'Continent', 'sea' => 'Sea', 'locality' => 'Locality', 'collectors' => 'Collector(s)', 'collectornumber' => "Field or collector number", 'institution' => 'Repository', 'voucherCol' => 'Voucher collection', 'genBankRecordAvailable' => 'with Genetic Accession Number', 'collectionYear' => 'Collection year', 'coordinates' => 'Coordinates', 'cites' => 'CITES list', 'collectioncode' => 'Collection or subcollection', 'institutioncode' => 'Institution code', 'indexHerbarorium'=>'Index Herbariorum code' ]; } // // @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() { // Yii::info ( "RULES VALIDATION" ); return [ [ [ 'unitID', 'fullScientificName' ], 'trim' ], [ [ 'latitudeFrom', 'latitudeTo' ], 'number', 'min' => - 90, 'max' => 90 ], [ [ 'longitudeFrom', 'longitudeTo' ], 'number', 'min' => - 180, 'max' => 180 ], [ [ 'latitudeFrom', 'latitudeTo', 'longitudeFrom', 'longitudeTo' ], 'makedouble' ], [ [ 'collectionYearFrom', 'collectionYearTo' ], 'default', 'value' => null ], [ [ 'collectionYearFrom', 'collectionYearTo' ], 'date', 'format' => 'yyyy' ] ]; // [['latitudeFrom','latitudeTo'],'isLatitude'], // [['longitudeFrom','longitudeTo'],'isLongitude'], } // /* // * validator for coordinates // */ // public function makedouble($attribute) { // // Yii::info ( "makedouble" ); // return $attribute*1.0; // } }