_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; } /* * ----------------- field declarations ------------------------ * put here all the same fields as you defined in the parameters array */ // voucher/specimen public $speciesName; 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 $name; public $taxonomyId; // TODO later, not yet in index public $identifiedBy; 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; public $institution; public $voucherCol; public $indexHerbarorium; public $sequenceaccessionIdentifier; public $geneticlocus; public $kingdom; public $tripleidstoreid; public $collectioncode; public $institutioncode; public $genBankRecordAvailable; public $sampletype; public $ipen; public $accessionStatus = 'onlyLiving'; public $unitaccessionnumber; public $recordbasis; public $preparationtype; // @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 [ [ ['fullScientificName', 'kingdom', 'phylumName','className','orderName','familyName','genusName','speciesName','geneticlocus','collectioncode', 'institutioncode','locality','collectors','collectornumber','cites','sampleavailability','sequenceaccessionIdentifier', 'unitID','ipen','unitaccessionnumber','hasImage','hasTypestatus','country','recordbasis','isocountrycode','continent', 'sea','ocean','sampletype','preparationtype','institution','latitudeFrom','latitudeTo','longitudeFrom','longitudeTo', 'collectionYearFrom','collectionYearTo','accessionStatus','identifiedBy' ], /*,'ScientificName','speciesName', */ 'match', 'pattern'=>'/^[^<>;]*$/', 'message'=>'invalid entry'], [ [ '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; } // ------------ functions -------------------- public function collectDropDownAttributesLists($model) { if (! isset ( $this->dropDownAttributes )) { $this->dropDownAttributes = array (); foreach ( $model->getParameters () as $name => $list ) { if (isset ( $list ['type'] ) && $list ['type'] == 'select') { array_push ( $this->dropDownAttributes, $name ); } } } if (! isset ( $this->_selectionlists )) { $this->_selectionlists = FormSelectionQueryManager::getAllLists ( $this->dropDownAttributes, $model->getSelectionListNonChosen () ); } return $this->_selectionlists; } public function createUrl($destination, $formParameters) { $nonEmptyFormParameters = array_filter ( $formParameters, 'strlen' ); unset ( $nonEmptyFormParameters ['yt0'] ); return Yii::$app->getUrlManager ()->createUrl ( $destination, $nonEmptyFormParameters ); } }