<?php /** * this view generates fields for search form * <br/><br/> * @author Gabriele Droege, Patricia Kelbert (BGBM, GGBN/DNA Bank Network) <contact@dnabank-network.org> * @version yii 2.0.3 * @package View * @var $this SearchController * @var $model SearchForm * @var $selectionLists - created in the controller * @var $form CActiveForm * @copyright Copyright © 2011 DNA Bank Network http://www.dnabank-network.org * <br/>The contents of this file are subject to the Mozilla Public License Version 1.1 * @filesource * @license http://www.mozilla.org/MPL/ MPL */ use yii\helpers\Html; use yii\web\View; use yii\helpers\Url; $this->title = 'GGBN Portal'; // $this->title = 'Search'; // $this->params ['breadcrumbs'] [] = $this->title; $this->registerJs ( " $('.tabs-search .tab-links a').on('click', function(e) { var currentAttrValue = $(this).attr('href'); // Show/Hide Tabs $(currentAttrValue).show(); $(currentAttrValue).siblings().hide(); // Change/remove current tab to active $(this).parent('li').addClass('active hop').siblings().removeClass('active'); e.preventDefault(); });" ); ?> <div class="jumbotron"> <h2>Statistics <img id="help" alt="help" title="help - information about the backbones used" src="/<?php echo Yii::$app->params['siteName']?>/images/icons/help.png" /> </h2> </div> <div class="container"> <div class="tabs-search"> <ul class="tab-links"> <li class="active"><a href="#Global">Global statistics</a></li> <li><a href="#Repository">Repositories</a></li> <!-- <li><a href="#Orders">Orders overview</a></li> --> <li><a href="#Samples">No. samples</a></li> <li><a href="#Species">No. taxa</a></li> </ul> </div> <div class="tab-content"> <div id="Global" class="tab active"> <h5>Filter by kind of unit and taxa</h5> <div class="row"> <div class="col-lg-6" id="chartg1a" style="width: 500px; height: 400px;"></div> <div class="col-lg-6" id="chartg1b" style="width: 500px; height: 400px;"></div> <div class="col-lg-6" id="chart2" style="width: 500px; height: 400px;"></div> </div> <br /> <hr /> <div class="row"> <div class="col-lg-6" id="chartrepo1" style="width: 500px; height: 400px;"></div> <div class="col-lg-6" id="chartrepo2" style="width: 500px; height: 400px;"></div> </div> <hr /> <br /> <h5>Filter by continent or ocean</h5> <div class="row"> <div class="col-lg-6" id="chartcontinent" style="width: 500px; height: 400px;"></div> <div class="col-lg-6" id="chartocean" style="width: 500px; height: 400px;"></div> </div> </div> <!-- end div global --> <div id="Repository" class="hop"> <div class="clearer"></div> <div id="chartg2" style="width: 900px; height: 500px;"></div> <br /> <ul> or select from the list <?php foreach ( $registries as $registry ) { echo "<li>"; echo Html::a ( $registry, [ 'stats/details', 'registry' => $registry ], [ 'class' => 'profile-link' ] ); echo "</li>"; } ?> </ul> </div> <!-- <div id="Orders" class="hop"> --> <!-- <div class="row"> --> <!-- <div class="col-lg-6" id="chartorder" style="margin-top: 20px; width: 800px; height: 300px;"></div> <!-- </div> --> <!-- <br /> --> <!-- </div> --> <div id="Samples" class="hop"> <div class="row"> <div class="col-lg-6" id="chartsamples" style="margin-top: 20px; width: 800px; height: 500px;"></div> </div> <br /> <button class="button-reset" id="button-reset-year">Reset Zoom</button> <!-- <div class="row"> <div class="col-lg-6" id="chartsamplesmonth" style="margin-top: 20px; width: 800px; height: 500px;"></div> </div> <br /> <button class="button-reset" id="button-reset-month">Reset Zoom</button> --> </div> <div id="Species" class="hop"> <div class="row"> <div class="col-lg-6" id="chartspecies" style="margin-top: 20px; width: 800px; height: 300px;"></div> <div class="col-lg-6" id="chartgenus" style="margin-top: 20px; width: 800px; height: 300px;"></div> <div class="col-lg-6" id="chartfamilies" style="margin-top: 20px; width: 800px; height: 300px;"></div> </div> <br /> </div> </div> <!-- end div tab content --> <script type="text/javascript"> $(document).ready(function(){ var samplesAll=<?php echo $samplesYearAll;?>; var samplesDNA=<?php echo $samplesYearDNA;?>; var samplesTissue=<?php echo $samplesYearTissue;?>; var samplesCulture=<?php echo $samplesYearCulture;?>; var samplesSpecimen=<?php echo $samplesYearSpecimen;?>; var samplesEnviro=<?php echo $samplesYearEnviro;?>; $.jqplot.config.enablePlugins = true; var plotsamples = $.jqplot('chartsamples', [samplesAll, samplesDNA, samplesTissue, samplesCulture, samplesSpecimen, samplesEnviro], { title:'Samples, grouped by year', seriesDefaults: { showMarker:false, pointLabels: { show:false } }, axes:{ xaxis:{ renderer:$.jqplot.DateAxisRenderer, tickOptions:{formatString:'%Y',angle:25}, rendererOptions:{ tickRenderer:$.jqplot.CanvasAxisTickRenderer }, tickInterval:'1 year', min:'January 1, 2009 8:00AM', } }, series:[{label: ' All',lineWidth:4, markerOptions:{style:'square'}}, {label: ' DNA',lineWidth:4, markerOptions:{style:'square'}}, {label: ' Tissue',lineWidth:4, markerOptions:{style:'square'}}, {label: ' Culture',lineWidth:4, markerOptions:{style:'square'}}, {label: ' Specimen',lineWidth:4, markerOptions:{style:'square'}}, {label: ' Enviro',lineWidth:4, markerOptions:{style:'square'}} ], legend: { show:true ,location: 'e' , placement : "outside", }, cursor:{ show: true, zoom:true, showTooltip:false } }); $('#button-reset-year').click(function() { plotsamples.resetZoom() }); /* var samplesAll=<?php //echo $samplesYearAll;?>; var samplesDNA=<?php //echo $samplesYearDNA;?>; var samplesTissue=<?php //echo $samplesYearTissue;?>; var samplesCulture=<?php //echo $samplesYearCulture;?>; var samplesSpecimen=<?php //echo $samplesYearSpecimen;?>; var samplesEnviro=<?php //echo $samplesYearEnviro;?>; $.jqplot.config.enablePlugins = true; var plotsamplesm = $.jqplot('chartsamplesmonth', [samplesAll, samplesDNA, samplesTissue, samplesCulture, samplesSpecimen, samplesEnviro], { title:'Samples 2015, grouped by month', axes:{ xaxis:{ renderer:$.jqplot.DateAxisRenderer, tickOptions:{formatString:'%Y-%m',angle:25}, rendererOptions:{ tickRenderer:$.jqplot.CanvasAxisTickRenderer }, tickInterval:'1 month', min:'January 1, 2015 8:00AM', } }, series:[{label: ' All',lineWidth:4, markerOptions:{style:'square'}}, {label: ' DNA',lineWidth:4, markerOptions:{style:'square'}}, {label: ' Tissue',lineWidth:4, markerOptions:{style:'square'}}, {label: ' Culture',lineWidth:4, markerOptions:{style:'square'}}, {label: ' Specimen',lineWidth:4, markerOptions:{style:'square'}}, {label: ' Enviro',lineWidth:4, markerOptions:{style:'square'}} ], legend: { show:true ,location: 'e' , placement : "outside", }, cursor:{ show: true, zoom:true, showTooltip:false } }); $('#button-reset-month').click(function() { plotsamplesm.resetZoom() }); */ //remove the quotes when reactivating the chart! var dataOrder=""<?php //echo $statistics_all;?>; var dataDNA=""<?php //echo $statistics_dna;?>; var dataTissue=""<?php //echo $statistics_tissue;?>; var dataReq=""<?php //echo $statistics_request;?>; // $.jqplot.config.enablePlugins = true; // var plot1 = $.jqplot('chartorder', [dataOrder,dataDNA,dataTissue,dataReq], { // title:'Orders, grouped by month', // axes:{ // xaxis:{ // renderer:$.jqplot.DateAxisRenderer, // tickOptions:{formatString:'%Y-%m '}, // tickInterval:'1 month', // min:'August 1, 2015 8:00AM', // } // }, // series:[{label: ' All',lineWidth:4, markerOptions:{style:'square'}}, // {label: ' DNA',lineWidth:4, markerOptions:{style:'square'}}, // {label: ' Tissue',lineWidth:4, markerOptions:{style:'square'}}, // {label: ' On request',lineWidth:4, markerOptions:{style:'square'}} ], // legend: { show:true ,location: 'e' , placement : "outside", }, // // cursor:{ // // zoom:true, // // looseZoom: true // // } // }); <?php if(!empty($speciesYear) && $speciesYear!="[]"):?> var data=<?php echo $speciesYear;?>; var plot1 = $.jqplot('chartspecies', [data], { title:'Number of species, grouped by year', seriesDefaults: { showMarker:false, pointLabels: { show:true} }, axes:{ xaxis:{ renderer:$.jqplot.DateAxisRenderer, tickOptions:{formatString:'%Y'}, tickInterval:'1 year', min:'January 1, 2009 8:00AM', } }, series:[{ lineWidth:4, markerOptions:{ style:'square' } }], // cursor:{ // zoom:true, // looseZoom: true // } }); <?php endif;?> <?php if(!empty($genusYear) && $genusYear!="[]"):?> var data=<?php echo $genusYear;?>; var plot1 = $.jqplot('chartgenus', [data], { title:'Number of genera, grouped by year', seriesDefaults: { showMarker:false, pointLabels: { show:true } }, axes:{ xaxis:{ renderer:$.jqplot.DateAxisRenderer, tickOptions:{formatString:'%Y'}, tickInterval:'1 year', min:'January 1, 2009 8:00AM', } }, series:[{ lineWidth:4, markerOptions:{ style:'square' } }], // cursor:{ // zoom:true, // looseZoom: true // } }); <?php endif;?> <?php if(!empty($familiesYear) && $familiesYear!="[]"):?> var data=<?php echo $familiesYear;?>; var plot1 = $.jqplot('chartfamilies', [data], { title:'Number of families, grouped by year', seriesDefaults: { showMarker:false, pointLabels: { show:true } }, axes:{ xaxis:{ renderer:$.jqplot.DateAxisRenderer, tickOptions:{formatString:'%Y'}, tickInterval:'1 year', min:'January 1, 2009 8:00AM', } }, series:[{ lineWidth:4, markerOptions:{ style:'square' } }], // cursor:{ // zoom:true, // looseZoom: true // } }); <?php endif;?> <?php if(!empty($kindofunitdatasamples) && $kindofunitdatasamples!="[]"):?> var data =<?php echo $kindofunitdatasamples;?>; var plot1 = jQuery.jqplot ('chartg1a', [data], { title: 'Kind of units - samples', grid: {borderColor: 'white', shadow: false, drawBorder: false}, seriesDefaults: { // Make this a pie chart. renderer: jQuery.jqplot.PieRenderer, rendererOptions: { // Put data labels on the pie slices. // By default, labels show the percentage of the slice. showDataLabels: true, fill: false, sliceMargin: 4, lineWidth: 5, } }, highlighter: { show: true, sizeAdjust: 7.5 }, legend: { show:true, location: 'e' } } ); <?php endif;?> <?php if(!empty($kindofunitdatavouchers) && $kindofunitdatavouchers!="[]"):?> var data =<?php echo $kindofunitdatavouchers;?>; var plot2 = jQuery.jqplot ('chartg1b', [data], { title: 'Kind of units - vouchers', grid: {borderColor: 'white', shadow: false, drawBorder: false}, seriesDefaults: { // Make this a pie chart. renderer: jQuery.jqplot.PieRenderer, rendererOptions: { // Put data labels on the pie slices. // By default, labels show the percentage of the slice. showDataLabels: true, fill: false, sliceMargin: 4, lineWidth: 5, } }, highlighter: { show: true, sizeAdjust: 7.5 }, legend: { show:true, location: 'e' } } ); <?php endif;?> <?php if(!empty($repositoriessamples) && $repositoriessamples!="[]"):?> var data =<?php echo $repositoriessamples;?>; var plot1 = jQuery.jqplot ('chartrepo1', [data], { title: 'Repositories - samples', grid: {borderColor: 'white', shadow: false, drawBorder: false}, seriesDefaults: { // Make this a pie chart. renderer: jQuery.jqplot.PieRenderer, rendererOptions: { // Put data labels on the pie slices. // By default, labels show the percentage of the slice. showDataLabels: true, fill: false, sliceMargin: 4, lineWidth: 5, } }, highlighter: { show: true, sizeAdjust: 7.5 }, legend: { show:true, location: 'e' } } ); <?php endif;?> <?php if(!empty($repositoriesvouchers) && $repositoriesvouchers!="[]"):?> var data =<?php echo $repositoriesvouchers;?>; var plot1 = jQuery.jqplot ('chartrepo2', [data], { title: 'Repositories - vouchers', grid: {borderColor: 'white', shadow: false, drawBorder: false}, seriesDefaults: { // Make this a pie chart. renderer: jQuery.jqplot.PieRenderer, rendererOptions: { // Put data labels on the pie slices. // By default, labels show the percentage of the slice. showDataLabels: true, fill: false, sliceMargin: 4, lineWidth: 5, } }, highlighter: { show: true, sizeAdjust: 7.5 }, legend: { show:true, location: 'e' } } ); <?php endif;?> <?php if(!empty($datasets) && $datasets!="[]"):?> var line1 =<?php echo $datasets;?>; var plot2 = $.jqplot('chartg2', [line1], { title: '<b>Number of DNA, tissue or environmental sample records (including multiple samples from the same specimen). <br/>Display with logarithmic scale.</b>', grid: {borderColor: 'white', shadow: false, drawBorder: false}, // animate: !$.jqplot.use_excanvas, series:[{renderer:$.jqplot.BarRenderer}], seriesDefaults: { rendererOptions: { varyBarColor:true, barDirection: 'horizontal', barWidth:4 }}, axesDefaults: { tickRenderer: $.jqplot.CanvasAxisTickRenderer , tickOptions: { // angle: -30, fontSize: '11pt', } }, highlighter: { show: true, sizeAdjust: 7.5 }, axes: { xaxis: { renderer: $.jqplot.LogAxisRenderer, tickOptions: { angle: 50 } }, yaxis: { renderer: $.jqplot.CategoryAxisRenderer } }, }); <?php endif;?> <?php if (! empty ( $countries ) && $countries != "[]") echo " var data =" . $countries . "; var plot2 = $.jqplot ('chartcontinent', [data], { title: 'Countries - click to access to the records', grid: {borderColor: 'white', shadow: false, drawBorder: false}, seriesDefaults: { // Make this a pie chart. renderer: jQuery.jqplot.PieRenderer, rendererOptions: { // Put data labels on the pie slices. // By default, labels show the percentage of the slice. showDataLabels: true, highlightMouseOver: true }, }, legend: { show:true, location: 'ne' } } );"; elseif (! empty ( $continents ) && $continents != "[]") echo "var data =" . $continents . "; var plot2 = $.jqplot ('chartcontinent', [data], { title: 'Continents - click to refine', grid: {borderColor: 'white', shadow: false, drawBorder: false}, seriesDefaults: { // Make this a pie chart. renderer: jQuery.jqplot.PieRenderer, rendererOptions: { // Put data labels on the pie slices. // By default, labels show the percentage of the slice. showDataLabels: true, highlightMouseOver: true }, }, legend: { show:true, location: 'ne' } } );"?> <?php if (! empty ( $seas ) && $seas != "[]") echo " var data =" . $seas . "; var plot2 = $.jqplot ('chartocean', [data], { title: 'Seas - click to access to the records', grid: {borderColor: 'white', shadow: false, drawBorder: false}, seriesDefaults: { // Make this a pie chart. renderer: jQuery.jqplot.PieRenderer, rendererOptions: { // Put data labels on the pie slices. // By default, labels show the percentage of the slice. showDataLabels: true, highlightMouseOver: true }, }, legend: { show:true, location: 'ne' } } );"; elseif (! empty ( $oceans ) && $oceans != "[]") echo "var data =" . $oceans . "; var plot2 = $.jqplot ('chartocean', [data], { title: 'Oceans - click to refine', grid: {borderColor: 'white', shadow: false, drawBorder: false}, seriesDefaults: { // Make this a pie chart. renderer: jQuery.jqplot.PieRenderer, rendererOptions: { // Put data labels on the pie slices. // By default, labels show the percentage of the slice. showDataLabels: true, highlightMouseOver: true }, }, legend: { show:true, location: 'ne' } } );"?> <?php if (! empty ( $species ) && $species != "[]") { echo " var data =" . $species . "; var plot2 = $.jqplot ('chart2', [data], { title: 'Species for the genus " . $genus . "- click to access to the records', grid: {borderColor: 'white', shadow: false, drawBorder: false}, seriesDefaults: { // Make this a pie chart. renderer: jQuery.jqplot.PieRenderer, rendererOptions: { // Put data labels on the pie slices. // By default, labels show the percentage of the slice. showDataLabels: true, highlightMouseOver: true }, }, legend: { show:true, location: 'ne' } } );"; } else if (! empty ( $genera ) && $genera != "[]") { echo " var data =" . $genera . "; var plot2 = $.jqplot ('chart2', [data], { title: 'Genera for the family " . $familia . "- click to refine', grid: {borderColor: 'white', shadow: false, drawBorder: false}, seriesDefaults: { // Make this a pie chart. renderer: jQuery.jqplot.PieRenderer, rendererOptions: { // Put data labels on the pie slices. // By default, labels show the percentage of the slice. showDataLabels: true, highlightMouseOver: true }, }, legend: { show:true, location: 'ne' } } );"; } else if (! empty ( $families ) && $families != "[]") { echo " var data =" . $families . "; var plot2 = $.jqplot ('chart2', [data], { title: 'Families for the order " . $ordo . "- click to refine', grid: {borderColor: 'white', shadow: false, drawBorder: false}, seriesDefaults: { // Make this a pie chart. renderer: jQuery.jqplot.PieRenderer, rendererOptions: { // Put data labels on the pie slices. // By default, labels show the percentage of the slice. showDataLabels: true, highlightMouseOver: true }, }, legend: { show:true, location: 'ne' } } );"; } else if (! empty ( $orders ) && $orders != "[]") { echo "var data = " . $orders . "; var plot2 = $.jqplot ('chart2', [data], { title: 'Order for the class " . $classis . "- click to refine', grid: {borderColor: 'white', shadow: false, drawBorder: false}, seriesDefaults: { // Make this a pie chart. renderer: jQuery.jqplot.PieRenderer, rendererOptions: { // Put data labels on the pie slices. // By default, labels show the percentage of the slice. showDataLabels: true, highlightMouseOver: true }, }, legend: { show:true, location: 'ne' } } );"; } else echo " var data =" . $classes . "; if(data.length>10){ var plot2 = $.jqplot ('chart2', [data], { title: 'Classes - click to refine', grid: {borderColor: 'white', shadow: false, drawBorder: false}, seriesDefaults: { // Make this a pie chart. renderer: jQuery.jqplot.PieRenderer, rendererOptions: { // Put data labels on the pie slices. // By default, labels show the percentage of the slice. showDataLabels: true, highlightMouseOver: true }, }, legend: { show:true, location: 'ne' } } ); } else{ var plot2 = $.jqplot ('chart2', [data], { title: 'Classes - click to refine', grid: {borderColor: 'white', shadow: false, drawBorder: false}, seriesDefaults: { // Make this a pie chart. renderer: jQuery.jqplot.PieRenderer, rendererOptions: { // Put data labels on the pie slices. // By default, labels show the percentage of the slice. showDataLabels: true, fill: false, sliceMargin: 4, lineWidth: 6, highlightMouseOver: true }, }, legend: { show:true, location: 'ne' } } ); }"; ?> $('#chartg2').bind('jqplotDataClick', function (ev, seriesIndex, pointIndex, data) { var r = line1[pointIndex].toString().split("(")[0].trim(); var url = 'http://'+$(location).attr('hostname')+'/<?php echo Yii::$app->params['siteName']?>/stats/details?registry='+r; $(location).attr('href',url); }); $("#chartg2").bind('jqplotDataHighlight', function(ev, seriesIndex, pointIndex, data) { var $this = $(this); var r = line1[pointIndex].toString().split("(")[0].trim(); $this.attr('title', "Click to get the detailed stats for "+r); $this.css('cursor','pointer'); }); $("#chartg2").bind('jqplotDataUnhighlight', function(ev, seriesIndex, pointIndex, data) { var $this = $(this); $this.attr('title',""); $this.css('cursor',''); }); $("#chart2").bind('jqplotDataHighlight', function(ev, seriesIndex, pointIndex, data) { var $this = $(this); $this.attr('title', data[0] + ": " + data[1]); $this.css('cursor','pointer'); }); $("#chart2").bind('jqplotDataUnhighlight', function(ev, seriesIndex, pointIndex, data) { var $this = $(this); $this.attr('title',""); $this.css('cursor',''); }); $("#chart2 .jqplot-table-legend-label").bind("click", function() { var $this = $(this); var url =""; var sepa="?"; if($(location).attr('href').indexOf("?")>-1) sepa="&"; <?php if (! empty ( $species )) { echo "url = 'http://'+$(location).attr('hostname')+'/" . Yii::$app->params ['siteName'] . "/search/browse?'+'fullScientificName='+encodeURI($(this).text().split('(')[0].trim());"; echo "$(location).attr('href',url);"; } else { if (! empty ( $genera )) { echo "url += sepa+'genus='+$(this).text().split('(')[0].trim();sepa='&';"; } else if (! empty ( $families )) { echo "url += sepa+'familia='+$(this).text().split('(')[0].trim();sepa='&';"; } else if (! empty ( $orders )) { echo "url += sepa+'ordo='+$(this).text().split('(')[0].trim();sepa='&';"; } else if (! empty ( $classes )) { echo "url += sepa+'classis='+$(this).text().split('(')[0].trim();sepa='&';"; } echo "$(location).attr('href',$(location).attr('href')+url);"; } ?> }); $('#chart2').bind('jqplotDataClick', function (ev, seriesIndex, pointIndex, data) { var $this = $(this); var url =""; var sepa="?"; if($(location).attr('href').indexOf("?")>-1) sepa="&"; <?php if (! empty ( $species )) { echo "url = 'http://'+$(location).attr('hostname')+'/" . Yii::$app->params ['siteName'] . "/search/browse?'+'fullScientificName='+encodeURI(data.toString().split('(')[0].trim()+'*');"; echo "$(location).attr('href',url);"; } else { if (! empty ( $genera )) { echo "url += sepa+'genus='+data.toString().split('(')[0].trim();sepa='&';"; } else if (! empty ( $families )) { echo "url += sepa+'familia='+data.toString().split('(')[0].trim();sepa='&';"; } else if (! empty ( $orders )) { echo "url += sepa+'ordo='+data.toString().split('(')[0].trim();sepa='&';"; } else if (! empty ( $classes )) { echo "url += sepa+'classis='+data.toString().split('(')[0].trim();sepa='&';"; } echo "$(location).attr('href',$(location).attr('href')+url);"; } ?> }); $('#chartcontinent').bind('jqplotDataClick', function (ev, seriesIndex, pointIndex, data) { var $this = $(this); var url =""; var sepa="?"; <?php if (! empty ( $countries )) { echo "url = 'http://'+$(location).attr('hostname')+'/" . Yii::$app->params ['siteName'] . "/search/browse?'+'country='+encodeURI(data.toString().split('(')[0].trim());"; echo "$(location).attr('href',url);"; } else { echo "url = 'http://'+$(location).attr('hostname')+'/" . Yii::$app->params ['siteName'] . "/stats/index';"; echo "url += sepa+'continent='+data.toString().split('(')[0].trim();"; echo "$(location).attr('href',url);"; } ?> }); $("#chartcontinent .jqplot-table-legend-label").bind("click", function() { var $this = $(this); var url =""; var sepa="?"; <?php if (! empty ( $countries )) { echo "url = 'http://'+$(location).attr('hostname')+'/" . Yii::$app->params ['siteName'] . "/search/browse?'+'country='+encodeURI($(this).text().split('(')[0].trim());"; echo "$(location).attr('href',url);"; } else { echo "url = 'http://'+$(location).attr('hostname')+'/" . Yii::$app->params ['siteName'] . "/stats/index';"; echo "url += sepa+'continent='+$(this).text().split('(')[0].trim();"; echo "$(location).attr('href',url);"; } ?> }); $("#chartcontinent").bind('jqplotDataHighlight', function(ev, seriesIndex, pointIndex, data) { var $this = $(this); var r = line1[pointIndex].toString().split("(")[0].trim(); $this.attr('title', "Click to get the detailed stats for "+r); $this.css('cursor','pointer'); }); $("#chartcontinent").bind('jqplotDataUnhighlight', function(ev, seriesIndex, pointIndex, data) { var $this = $(this); $this.attr('title',""); $this.css('cursor',''); }); $('#chartocean').bind('jqplotDataClick', function (ev, seriesIndex, pointIndex, data) { var $this = $(this); var url =""; var sepa="?"; <?php if (! empty ( $seas )) { echo "url = 'http://'+$(location).attr('hostname')+'/" . Yii::$app->params ['siteName'] . "/search/browse?'+'sea='+encodeURI(data.toString().split('(')[0].trim());"; echo "$(location).attr('href',url);"; } else { echo "url = 'http://'+$(location).attr('hostname')+'/" . Yii::$app->params ['siteName'] . "/stats/index';"; echo "url += sepa+'ocean='+data.toString().split('(')[0].trim();"; echo "$(location).attr('href',url);"; } ?> }); $("#chartocean .jqplot-table-legend-label").bind("click", function() { var $this = $(this); var url =""; var sepa="?"; <?php if (! empty ( $seas )) { echo "url = 'http://'+$(location).attr('hostname')+'/" . Yii::$app->params ['siteName'] . "/search/browse?'+'sea='+encodeURI($(this).text().split('(')[0].trim());"; echo "$(location).attr('href',url);"; } else { echo "url = 'http://'+$(location).attr('hostname')+'/" . Yii::$app->params ['siteName'] . "/stats/index';"; echo "url += sepa+'ocean='+$(this).text().split('(')[0].trim();"; echo "$(location).attr('href',url);"; } ?> }); $("#chartocean").bind('jqplotDataHighlight', function(ev, seriesIndex, pointIndex, data) { var $this = $(this); var r = line1[pointIndex].toString().split("(")[0].trim(); $this.attr('title', "Click to get the detailed stats for "+r); $this.css('cursor','pointer'); }); $("#chartocean").bind('jqplotDataUnhighlight', function(ev, seriesIndex, pointIndex, data) { var $this = $(this); $this.attr('title',""); $this.css('cursor',''); }); $("#chartg1a").bind('jqplotDataHighlight', function(ev, seriesIndex, pointIndex, data) { var $this = $(this); $this.attr('title', data[0] + ": " + data[1]); $this.css('cursor','pointer'); }); $("#chartg1a").bind('jqplotDataUnhighlight', function(ev, seriesIndex, pointIndex, data) { var $this = $(this); $this.attr('title',""); $this.css('cursor',''); }); $('#chartg1a').bind('jqplotDataClick', function (ev, seriesIndex, pointIndex, data) { var url =""; var burl=$(location).attr('href').split("?")[0]; var filter=$(location).attr('href').split("?")[1]; var sep="?"; if(filter !=null){ var filters=filter.split("&"); for (i=0;i<filters.length;i++){ if (filters[i].indexOf("sampletype")==-1 ){ if(i==0 || sep=="?"){ url+=sep+filters[i]; sep="&"; } else url+=sep+filters[i]; }else{ var oldvalue=filters[i].split("sampletype=")[1]; if(oldvalue==data.toString().split('(')[0].trim()){ var url = 'http://'+$(location).attr('hostname')+'/<?php echo Yii::$app->params['siteName']?>/search/browse?'; for (j=0;j<filters.length;j++){ if(j==0) sep=""; else sep="&"; url+=sep+filters[j]; } return $(location).attr('href',url); } } } url+=sep+'sampletype='+data.toString().split('(')[0].trim(); } else url+=sep+'sampletype='+data.toString().split('(')[0].trim(); $(location).attr('href',burl+url); }); $("#chartg1a .jqplot-table-legend-label").bind("click", function() { var url =""; var burl=$(location).attr('href').split("?")[0]; var filter=$(location).attr('href').split("?")[1]; var sep="?"; if(filter !=null){ var filters=filter.split("&"); for (i=0;i<filters.length;i++){ if (filters[i].indexOf("sampletype")==-1 ){ if(i==0 || sep=="?"){ url+=sep+filters[i]; sep="&"; } else url+=sep+filters[i]; }else{ var oldvalue=filters[i].split("sampletype=")[1].trim(); if(oldvalue==$(this).text().split('(')[0].trim()){ var url = 'http://'+$(location).attr('hostname')+'/<?php echo Yii::$app->params['siteName']?>/search/browse?'; for (j=0;j<filters.length;j++){ if(j==0) sep=""; else sep="&"; url+=sep+filters[j]; } return $(location).attr('href',url); } } } url+=sep+'sampletype='+$(this).text().split('(')[0].trim(); } else url+=sep+'sampletype='+$(this).text().split('(')[0].trim(); $(location).attr('href',burl+url); }); $("#chartg1b").bind('jqplotDataHighlight', function(ev, seriesIndex, pointIndex, data) { var $this = $(this); $this.attr('title', data[0] + ": " + data[1]); $this.css('cursor','pointer'); }); $("#chartg1b").bind('jqplotDataUnhighlight', function(ev, seriesIndex, pointIndex, data) { var $this = $(this); $this.attr('title',""); $this.css('cursor',''); }); $('#chartg1b').bind('jqplotDataClick', function (ev, seriesIndex, pointIndex, data) { var url =""; var burl=$(location).attr('href').split("?")[0]; var filter=$(location).attr('href').split("?")[1]; var sep="?"; if(filter !=null){ var filters=filter.split("&"); for (i=0;i<filters.length;i++){ if (filters[i].indexOf("sampletype")==-1 ){ if(i==0 || sep=="?"){ url+=sep+filters[i]; sep="&"; } else url+=sep+filters[i]; }else{ var oldvalue=filters[i].split("sampletype=")[1]; if(oldvalue==data.toString().split('(')[0].trim()){ var url = 'http://'+$(location).attr('hostname')+'/<?php echo Yii::$app->params['siteName']?>/search/browse?'; for (j=0;j<filters.length;j++){ if(j==0) sep=""; else sep="&"; url+=sep+filters[j]; } return $(location).attr('href',url); } } } url+=sep+'sampletype='+data.toString().split('(')[0].trim(); } else url+=sep+'sampletype='+data.toString().split('(')[0].trim(); $(location).attr('href',burl+url); }); $("#chartg1b .jqplot-table-legend-label").bind("click", function() { var url =""; var burl=$(location).attr('href').split("?")[0]; var filter=$(location).attr('href').split("?")[1]; var sep="?"; if(filter !=null){ var filters=filter.split("&"); for (i=0;i<filters.length;i++){ if (filters[i].indexOf("sampletype")==-1 ){ if(i==0 || sep=="?"){ url+=sep+filters[i]; sep="&"; } else url+=sep+filters[i]; }else{ var oldvalue=filters[i].split("sampletype=")[1].trim(); if(oldvalue==$(this).text().split('(')[0].trim()){ var url = 'http://'+$(location).attr('hostname')+'/<?php echo Yii::$app->params['siteName']?>/search/browse?'; for (j=0;j<filters.length;j++){ if(j==0) sep=""; else sep="&"; url+=sep+filters[j]; } return $(location).attr('href',url); } } } url+=sep+'sampletype='+$(this).text().split('(')[0].trim(); } else url+=sep+'sampletype='+$(this).text().split('(')[0].trim(); $(location).attr('href',burl+url); }); $(".hop").hide(); $("#help").on('click', function(e) { window.open('http://wiki.ggbn.org/ggbn/GGBN_Data_Portal_Explanations','_blank'); }); }); </script> </div>