= 3000)
echo $item_count . " (or more) record";
else
echo $item_count . " record";
if ($item_count > 1) {
echo "s";
}
echo " found ";
if ($item_count >= 3000)
echo " -- The display is limited to 3000 records.";
} else
echo "No records found.";
?>
Your search:
'get',
'action' => $submitURL,
'enableClientValidation' => true,
'validateOnSubmit' => true
] );
echo $form->errorSummary ( $model );
echo "";
$suggestFields = [
'fullScientificName'
];
$defaultFields = [
'familyName',
'phylumName',
'className',
'orderName',
'genusName',
'unitID',
'sequenceaccessionIdentifier',
'locality',
'collectors',
'collectornumber'
];
$selectFields = [
'country',
'geneticlocus',
'kingdom',
'continent',
'ocean',
'sea',
'institution',
'voucherCol',
'sampletype',
'collectioncode',
'institutioncode' ,
'indexHerbarorium'
]
;
$checkFields=['hasTypestatus', 'hasImage'];
$radioB=[];
foreach ( $elements as $key => $param ) {
if (isset ( $param ['type'] )) {
// echo "param config :".$param ['config'] ['name']."
";
// 1. preparation for the field generation
$type = $param ['type'];
$selectedValue = '';
foreach ( $suggestFields as $tf )
if ($param ['config'] ['name'] == $tf && isset ( $filters [$tf] )) {
$param ['config'] ['value'] = $filters [$tf];
$param ['type'] = 'suggest';
}
foreach ( $defaultFields as $tf )
if ($param ['config'] ['name'] == $tf && isset ( $filters [$tf] )) {
$param ['config'] ['value'] = $filters [$tf];
$param ['type'] = 'default';
}
foreach ( $checkFields as $tf ){
if ($param ['config'] ['name'] == $tf && isset ( $filters [$tf] )) {
$param ['config'] ['value'] = $filters [$tf];
$param ['type'] = 'checkbox';
$selectedValue = $filters [$tf];
$radioB[$tf] = $filters [$tf];
}
}
if ($param ['config'] ['name'] == 'cites' && isset ( $filters ['cites'] )) {
$param ['config'] ['value'] = $filters ['cites'];
$param ['type'] = 'radio';
}
// if ($param ['config'] ['name'] == 'hasImage' && isset ( $filters ['hasImage'] )) {
// $param ['config'] ['value'] = $filters ['hasImage'];
// $param ['type'] = 'checkbox';
// }
// if ($param ['config'] ['name'] == 'hasTypestatus' && isset ( $filters ['hasTypestatus'] )) {
// $param ['config'] ['value'] = $filters ['hasTypestatus'];
// $param ['type'] = 'checkbox';
// }
if ($param ['config'] ['name'] == 'Coordinates' && (isset ( $filters ['latitudeFrom'] ) || isset ( $filters ['latitudeTo'] ) || isset ( $filters ['longitudeTo'] ) || isset ( $filters ['longitudeFrom'] ))) {
handleCoordinates ( $filters, $key, $param, $selectionLists, $this, $model, $form, $selectedValue );
}
if ($param ['config'] ['name'] == 'Collection Year' && (isset ( $filters ['collectionYearFrom'] ) || isset ( $filters ['collectionYearTo'] ))) {
handleGatheringyear ( $filters, $key, $param, $selectionLists, $this, $model, $form, $selectedValue );
}
foreach ( $selectFields as $tf )
if ($param ['config'] ['name'] == $tf && isset ( $filters [$tf] )) {
$selectedValue = $filters [$tf];
$param ['type'] = 'select';
$param ['config'] ['value'] = $filters [$tf];
}
$htmlOpts = isset ( $param ['config'] ) ? $param ['config'] : array ();
// Rukeia 30-03-2015: If the field was not used for the search, it's set not to be displayed in the
// first place and it gets a button to hide it again:
if (! isset ( $param ['config'] ['value'] ) && $selectedValue == '') { // Rukeia 30-03-2015: added
$hide_option = "style=\"display:none;\"";
$hide_button = "
request->baseUrl . "/images/close.png \" parent_name=\"" . $key . "\" class=\"hide_button\" alt=\"close\"/>";
} else {
$hide_option = "";
$hide_button = "
request->baseUrl . "/images/close.png \" parent_name=\"" . $key . "\" class=\"hide_button\" alt=\"close\"/>";
}
// use default size if no size is given
if (! isset ( $param ['config'] ['size'] )) {
$param ['config'] ['size'] = $model->getFieldSize ();
}
// surround label and fields with div
echo "
";
// 2. label - could be common text label or drop down choice
// choose whether the label is a dropdown choice:
if (isset ( $param ['alt'] ) && is_array ( $param ['alt'] ) && sizeof ( $param ['alt'] > 0 )) {
$altList = array (
$key
) + $param ['alt'];
echo Html::dropDownList ( $key, $key, $altList, $htmlOptions = array (
'class' => "dropDownLabel",
'id2' => $key
) );
$htmlOpts += array (
"class" => "hasSelectableLabel_" . $key,
"id2" => $key
);
$alt = true;
} else {
$altList = null;
// echo $form->labelEx ( $model, $key );
$form->field ( $model, $key )->label ( $key );
$alt = false;
}
echo $hide_button;
// 3. field itself (different types -depending on $type
CreateFormManager::createField ( $this, $model, $form, $key, $param, $selectionLists, $htmlOpts, $selectedValue, $hide_option, $hide_button ); // Rukeia 26-03-2015: added $selectedValue; Wozu werden hier $hide_option, $hide_button gebraucht?
// if there are alternate fields create them and hide them:
if ($alt) {
if (isset ( $htmlOpts ['style'] )) {
$htmlOpts ['style'] += " display:none;";
} else {
$htmlOpts ['style'] = "display:none;";
}
foreach ( $altList as $altField ) {
unset ( $param ['valueList'] );
CreateFormManager::createField ( $this, $model, $form, $altField, $param, $selectionLists, $htmlOpts, $selectedValue ); // Rukeia 26-03-2015: added $selectedValue
}
}
echo "
";
}
}
// echo "
Info: The scientificnames are extended to synonyms and accepted names based on the GBIF Checklist - ongoing work ";
// 0. this provides the pulldown thing that contains the search field list
echo "";
$notUsedFields = array ();
$notUsedElements = array ();
// echo '
';
echo '
';
echo "
";
echo Html::submitButton ( $model->refineSearchButtonLabel, [
'class' => 'btn btn-success'
] );
echo " ";
echo "
";
echo Accordion::widget ( [
'items' => [
[
'header' => "Add search field",
'content' => $this->render ( '/search/searchFieldSelection', [
'hideable_fields' => $model->getCompleteListFields (),
'hidden_elements' => $model->getCompleteList ()
], true )
]
],
'options' => [
'tag' => 'div',
'autoHeight' => false,
'active' => false,
'delay' => '100'
],
'itemOptions' => [
'tag' => 'div',
'class' => 'balmusette_search'
],
'headerOptions' => [
'tag' => 'button',
'class' => 'btn btn-success'
],
'clientOptions' => [
'collapsible' => true,
'active' => false
]
] );
echo "
";
echo Html::button ( $model->newSearchButtonLabel, array (
'onclick' => 'js:document.location.href="' . Yii::$app->getUrlManager ()->createUrl ( [
'search/index'
] ) . '"',
'class' => 'btn btn-success'
) );
echo "
";
$searchPage = Yii::$app->getUrlManager ()->createUrl ( [
'search/index'
] );
ActiveForm::end ();
?>
array (),
"url" => array (),
"isocountrycode" => array (),
"unitID" => array (),
"institutioncode" => array (),
"collectioncode" => array (),
"trick17ID" => array (),
"kindofunit" => array (),
"country" => array (),
"collectors" => array (),
"collectornumber" => array (),
"gatheringyear" => array (),
"indexHerbarorium" => [ ],
"locality" => [ ],
"multimedia" => [ ]
);
// "associatedID" => array ()
if (isset ( $response ))
foreach ( $response as $doc ) {
if ($doc->fullScientificName == "") {
if ($doc->familyName != "") {
$value = $doc->familyName;
} else {
if ($doc->orderName != "") {
$value = $doc->orderName;
} else {
if ($doc->className != "") {
$value = $doc->className;
} else {
if ($doc->phylumName != "") {
$value = $doc->phylumName;
} else {
if ($doc->kingdomName != "") {
$value = $doc->kingdomName;
} else
$value = "no identification";
}
}
}
}
array_push ( $content_array ["value"], $value );
} else {
$value = $doc->fullScientificName;
array_push ( $content_array ["value"], $value );
}
$names = $doc->fullScientificName_nc;
if (! empty ( $names ))
foreach ( $names as $n ) {
if ((strpos ( $n, "N/A" )) === false)
array_push ( $nameExtended, $n );
}
asort ( $nameExtended );
// if (is_array ( $doc ['upperUnitIDs'] )) {
// array_push ( $content_array["associatedID"],implode($doc ['upperUnitIDs'],", "));
// }
// else array_push ( $content_array["associatedID"],"nothing");
$filters = createFilters ( $doc, $recordFilters );
$url = createRecordActionUrl ( $filters );
array_push ( $content_array ["url"], $url );
array_push ( $content_array ["isocountrycode"], $doc->isocountrycode );
array_push ( $content_array ["unitID"], $doc->unitID );
array_push ( $content_array ["trick17ID"], $doc->trick17ID );
array_push ( $content_array ["institutioncode"], $doc->institutioncode );
array_push ( $content_array ["collectioncode"], $doc->collectioncode );
array_push ( $content_array ["kindofunit"], $doc->sampletype );
array_push ( $content_array ["country"], $doc->country );
array_push ( $content_array ["collectors"], $doc->collectors );
$cn = $doc->collectornumbers_nc;
if (sizeof ( $cn ) > 0) {
$f = false;
foreach ( $cn as $c ) {
if ((strpos ( $c, "N/A" )) === false && (strpos ( $c, "s.n." )) === false) {
array_push ( $content_array ["collectornumber"], $c );
$f = true;
}
}
if (! $f)
array_push ( $content_array ["collectornumber"], "s.n." );
} else
array_push ( $content_array ["collectornumber"], "s.n." );
// array_push ( $content_array ["collectornumber"], $doc->collectornumber );
array_push ( $content_array ["gatheringyear"], $doc->gatheringyear );
array_push ( $content_array ["indexHerbarorium"], $doc->indexHerbarorium );
$imgF = false;
$imgFilled = false;
if ($doc->hasImage) {
if (isset ( $doc->multimediaurl )) {
foreach ( $doc->multimediaurl as $murl ) {
if ($murl != "N/A") {
if (! $imgFilled) {
if (strpos ( $murl, "http" ) === FALSE) {
if (sizeof ( $doc->multimediaurl ) > 1)
continue;
else {
$murl = "http://" . $murl;
array_push ( $content_array ["multimedia"], "
yes " );
$imgF = true;
$imgFilled = true;
}
} else {
array_push ( $content_array ["multimedia"], "
yes " );
$imgF = true;
$imgFilled = true;
}
}
}
}
}
}
if (! $imgF)
array_push ( $content_array ["multimedia"], "no" );
}
if (isset ( $response )) {
echo "
Click on a Scientific name to see the specimen's full details or select several checkboxes and click on the button \"See units\"";
if (! empty ( $nameExtended ) && isset ( $filters ['fullScientificName'] ))
echo "
The query has been extended to the names " . implode ( ", ", array_unique ( $nameExtended ) ) . "
";
$form = ActiveForm::begin ( [
'id' => 'form',
'type' => ActiveForm::TYPE_INLINE,
'enableAjaxValidation' => true,
'enableClientScript' => true,
'validateOnSubmit' => true,
'validateOnType' => false,
'validateOnChange' => false,
'validationUrl' => [
'multiunits/add'
]
] );
echo "
Scientific name
Country
Collector(s)
Col. no.
Year
IH
Subcollection
Specimen ID
Image
";
// if (! Yii::$app->user->isGuest) {
// echo "Selected ";
// }
echo "
";
for($i = 0; $i <= sizeof ( $content_array ["value"] ) - 1; $i ++) {
echo "";
$val = preg_replace ( '*\/*', 'SLASH', $content_array ["unitID"] [$i] . "---" . $content_array ["collectioncode"] [$i] . "---" . $content_array ["institutioncode"] [$i] );
// Yii::info("VAL : ".$val);
$val = str_replace ( "(", "PARO", $val );
$val = str_replace ( ")", "PARF", $val );
$val = str_replace ( ":", "DBLPT", $val );
// Yii::info("VAL2 : ".$val);
echo '' . $form->field ( $multiUnitsM, 'checked[' . $val . ']', [
'validateOnBlur' => false,
'validateOnChange' => false
] )->checkbox ( [
'class' => 'select-checkbox'
] ) . ' ';
echo "" . $content_array ["value"] [$i] . " ";
echo "" . $content_array ["country"] [$i] . " ";
// if (isset ( $content_array ["trick17ID"] [$i] ) && $content_array ["trick17ID"] [$i] != $content_array ["unitID"] [$i])
// echo "" . $content_array ["unitID"] [$i] . " (" . $content_array ["trick17ID"] [$i] . ") ";
// else
echo "" . $content_array ["collectors"] [$i] . " ";
echo "" . $content_array ["collectornumber"] [$i] . " ";
echo "" . $content_array ["gatheringyear"] [$i] . " ";
echo "" . $content_array ["indexHerbarorium"] [$i] . " ";
echo "" . $content_array ["collectioncode"] [$i] . " ";
echo "" . $content_array ["unitID"] [$i] . " ";
echo "" . $content_array ["multimedia"] [$i] . " ";
echo " ";
}
echo "
";
if ($item_count >10)
echo "
Go to page
";
ActiveForm::end ();
}
/**
* This function checks whether a sample is available for order.
*
* @param unknown $line
* an array containing the information on the sample
* @return boolean true, if the sample can be ordered; false if it is missing, consumed or blocked.
*/
function isAvailable($line) {
// sample missing or consumed
if ($line ["disposition_clean"] === 'missing' || $line ['disposition_clean'] === 'consumed') {
return false;
} // sample still blocked
elseif (strtotime ( $line ['blockedUntil'] ) - time () > 0) {
return false;
} elseif ($line ['blocked'] == 'yes') {
return false;
} else {
return true;
}
}
function handleCoordinates($filters, $key, $param, $selectionLists, $this, $model, $form, $selectedValue) {
try {
$latitudeFrom = $filters ['latitudeFrom'];
} catch ( Exception $e ) {
$latitudeFrom = NULL;
}
try {
$latitudeTo = $filters ['latitudeTo'];
} catch ( Exception $e ) {
$latitudeTo = NULL;
}
try {
$longitudeFrom = $filters ['longitudeFrom'];
} catch ( Exception $e ) {
$longitudeFrom = NULL;
}
try {
$longitudeTo = $filters ['longitudeTo'];
} catch ( Exception $e ) {
$longitudeTo = NULL;
}
$hide_option = "";
$hide_button = "
request->baseUrl . "/images/close.png \" parent_name=\"" . $key . "\" class=\"hide_button\" alt=\"close\"/>";
$htmlOpts = [
"name" => $param ['config'] ['name'],
"attribute1" => "latitudeFrom",
"attribute2" => "latitudeTo",
"attribute3" => "longitudeFrom",
"attribute4" => "longitudeTo",
"attribute1value" => $latitudeFrom,
"attribute2value" => $latitudeTo,
"attribute3value" => $longitudeFrom,
"attribute4value" => $longitudeTo,
'type' => \kartik\field\FieldRange::INPUT_TEXT
];
echo "
";
CreateFormManager::createField ( $this, $model, $form, $key, $param, $selectionLists, $htmlOpts, $selectedValue, $hide_option, $hide_button );
echo $hide_button;
echo "
";
}
function handleGatheringyear($filters, $key, $param, $selectionLists, $this, $model, $form, $selectedValue) {
try {
$collectionYearFrom = $filters ['collectionYearFrom'];
} catch ( Exception $e ) {
$collectionYearFrom = NULL;
}
try {
$collectionYearTo = $filters ['collectionYearTo'];
} catch ( Exception $e ) {
$collectionYearTo = NULL;
}
$hide_option = "";
$hide_button = "
request->baseUrl . "/images/close.png \" parent_name=\"" . $key . "\" class=\"hide_button\" alt=\"close\"/>";
$htmlOpts = [
"name" => $param ['config'] ['name'],
"attribute1" => "collectionYearFrom",
"attribute2" => "collectionYearTo",
"attribute1value" => $collectionYearFrom,
"attribute2value" => $collectionYearTo,
"type" => \kartik\field\FieldRange::INPUT_TEXT
];
echo "
";
CreateFormManager::createField ( $this, $model, $form, $key, $param, $selectionLists, $htmlOpts, $selectedValue, $hide_option, $hide_button );
echo $hide_button;
echo "
";
}
?>