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 = [
'kingdom' => [
'type' => 'select',
'name' => 'Kingdom',
'config' => [
'size' => 285,
'maxlength' => 150,
'name' => 'kingdom'
]
],
'phylumName' => [
'type' => 'text',
'name' => 'Phylum',
'config' => [
'size' => 285,
'maxlength' => 150,
'name' => 'phylumName'
],
'hidden'=>true,
],
'className' => [
'type' => 'text',
'name' => 'Class',
'config' => [
'size' => 285,
'maxlength' => 150,
'name' => 'className'
],
'hidden'=>true,
],
'orderName' => [
'type' => 'text',
'name' => 'Order',
'config' => [
'size' => 285,
'maxlength' => 150,
'name' => 'orderName'
],
'hidden'=>true,
],
'familyName' => [
'type' => 'text',
'name' => 'Family',
'config' => [
'size' => 285,
'maxlength' => 150,
'name' => 'familyName'
],
'hidden'=>true,
],
'genusName' => [
'type' => 'text',
'name' => 'Genus',
'config' => [
'size' => 285,
'maxlength' => 150,
'name' => 'genusName'
],
'hidden'=>true,
],
'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'
],
// 'isocountrycode' => [
// 'name' => 'ISO-Code'
// ],
'unitID' => [
'config' => [
'size' => 45,
'maxlength' => 150,
'name' => 'unitID'
],
'type' => 'text', // freigeschaltet von Gabi
'name' => 'Sample, Voucher or Strain No.'
],
'sequenceaccessionIdentifier' => [
'type' => 'suggest',
'name' => 'Genetic Accession No.',
'config' => [
'size' => 45,
'maxlength' => 150,
'name' => 'sequenceaccessionIdentifier'
]
],
'geneticlocus' => [
'type' => 'select',
'name' => 'Genetic Locus',
'config' => [
'size' => 285,
'maxlength' => 150,
'name' => 'geneticlocus'
] ,
'hideable' => 'true'
],
'institution' => [
'type' => 'select',
'name' => 'Repository',
'config' => [
'size' => 285,
'maxlength' => 150,
'name' => 'institution'
]
],
'voucherCol' => [
'type' => 'select',
'name' => 'Voucher collection',
'config' => [
'size' => 285,
'maxlength' => 150,
'name' => 'voucherCol'
]
],
/* 'genBankRecordAvailable' => [
// 'type' => 'deactivated',
'type' => 'checkbox',
'hideable'=>'true'
],
'boldRecordAvailable' => [
'type' => 'deactivated'
// 'type' => 'checkbox'
], */
'cites' => [
'type' => 'radio',
'name' => 'CITES list',
'config' => [
'size' => 285,
'maxlength' => 150,
'name' => 'cites'
],
'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'
],
'collectornumber' => [
'type' => 'text',
'name' => "Collector's No.",
'config' => [
'size' => 45,
'maxlength' => 150,
'name' => 'collectornumber'
],
'hideable' => 'true'
],
'collectors' => [
'type' => 'text',
'name' => 'Collectors',
'config' => [
'size' => 45,
'maxlength' => 150,
'name' => 'collectors'
],
'hideable' => 'true'
],
'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'
],
'locality' => [
'type' => 'text',
'name' => 'Locality',
'config' => [
'size' => 45,
'maxlength' => 150,
'name' => 'locality'
],
'hideable' => 'true'
],
'ocean' => [
'type' => 'select',
'name' => 'Ocean',
'config' => [
'size' => 285,
'maxlength' => 150,
'name' => 'ocean'
],
'hideable' => 'true'
],
'sampleavailability' => [
'type' => 'radio',
'name' => 'Sample availability (loan)',
'config' => [
'size' => 285,
'maxlength' => 150,
'name' => 'sampleavailability'
],
'hideable' => 'true'
],
'sampletype' => [
'type' => 'select',
'name' => 'Sample Type',
'config' => [
'size' => 285,
'maxlength' => 150,
'name' => 'sampletype'
],
'hideable' => 'true'
],
'sea' => [
'type' => 'select',
'name' => 'Sea',
'config' => [
'size' => 285,
'maxlength' => 150,
'name' => 'sea'
],
'hideable' => 'true'
],
/* 'hasTypestatus' => [
'type' => 'checkbox',
'config'=>['size'=>45,'maxlength'=>150],
// 'type' => 'deactivated',
'hideable'=>'true'
],
'hasImage' => [
'type' => 'checkbox',
'config'=>['size'=>45,'maxlength'=>150],
'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 $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;
public $hasTypestatus; // boolean
public $hasImage; // boolean
public $unitID;
public $cites;
public $sampleavailability;
// ***main field*** !!!use multivalued!!!
// DNA
// public $extractionNo;
public $institution;
public $voucherCol;
// 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 = 'Refine 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' => 'Sample, Voucher or Strain No.',
'phylumName' => 'Phylum/Division Name',
'continent' => 'Continent',
'sea' => 'Sea',
'locality' => 'Locality',
'collectors' => 'Collectors',
'collectornumber' => "Collectors' No.",
'institution' => 'Repository',
'voucherCol' => 'Voucher collection',
'genBankRecordAvailable' => 'with Genetic Accession Number',
'collectionYear' => 'Collection year',
'coordinates' => 'Coordinates',
'cites' => 'CITES list',
'sampleavailability' => 'Sample availability (loan)'
];
}
// // @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;
// }
}