Skip to content

Commit

Permalink
Fixed issue #17271: Print statistics are totally broken (near empty) (#…
Browse files Browse the repository at this point in the history
…1882)

* Fixed issue #17271: Print statistics are totally broken (near empty)
Dev: same fix than 3X

* Dev: Fix chrome issue
Dev: legend shown next to graph

Co-authored-by: Jessica Höck <thedirtypanda001@gmail.com>
  • Loading branch information
Shnoulle and thedirtypanda committed Aug 26, 2021
1 parent 2f2c367 commit 5ceb483
Show file tree
Hide file tree
Showing 11 changed files with 531 additions and 713 deletions.
10 changes: 6 additions & 4 deletions application/helpers/admin/statistics_helper.php
Expand Up @@ -827,7 +827,8 @@ protected function buildOutputList($rt, $language, $surveyid, $outputType, $sql,
. gT("Calculation") . "</strong></th>\n"
. "\t\t<th width='50%' align='right' ><strong>"
. gT("Result") . "</strong></th>\n"
. "\t</tr></thead>\n";
. "\t</tr></thead>\n"
."<tbody>\n";

foreach ($showem as $res) {
$statisticsoutput .= "<tr><td>" . $res[0] . "</td><td>" . $res[1] . "</td></tr>";
Expand Down Expand Up @@ -903,7 +904,8 @@ protected function buildOutputList($rt, $language, $surveyid, $outputType, $sql,
. gT("Calculation") . "</strong></th>\n"
. "\t\t<th width='50%' align='right' ><strong>"
. gT("Result") . "</strong></th>\n"
. "\t</tr></thead>\n";
. "\t</tr></thead>\n"
."<tbody>\n";

break;
default:
Expand Down Expand Up @@ -1075,7 +1077,7 @@ protected function buildOutputList($rt, $language, $surveyid, $outputType, $sql,
$statisticsoutput .= "<tr><td class='statisticsbrowsecolumn' colspan='3' style='display: none'>
<div class='statisticsbrowsecolumn' id='columnlist_{$fieldname}'></div></td></tr>";
}
$statisticsoutput .= "</table>\n";
$statisticsoutput .= "</tbody></table>\n";

break;
default:
Expand Down Expand Up @@ -3430,7 +3432,7 @@ protected function displayResults($outputs, $results, $rt, $outputType, $surveyi
$statisticsoutput .= Yii::app()->getController()->renderPartial('/admin/export/generatestats/_statisticsoutput_graphs', $aData, true);
$statisticsoutput_footer .= Yii::app()->getController()->renderPartial('/admin/export/generatestats/_statisticsoutput_footer', $aData, true);
}
$statisticsoutput .= "</table></div><!-- in statistics helper --> \n";
$statisticsoutput .= "</tbody></table></div><!-- in statistics helper --> \n";
}
$statisticsoutput = $statisticsoutput . $statisticsoutput_footer . "</script>";
return array("statisticsoutput" => $statisticsoutput, "pdf" => $this->pdf, "astatdata" => $astatdata);
Expand Down
6 changes: 5 additions & 1 deletion application/views/admin/export/generatestats/_header.php
Expand Up @@ -14,7 +14,10 @@
?>

<!-- Message Box -->

<div style="clear: both; margin-bottom: 10px;" class="hidden-print"></div>
<div class="jumbotron message-box">

<h2><?php eT("Results"); ?></h2>
<p><?php eT("Number of records in this query:") ?>&nbsp;<?php echo $results; ?></p>
<p><?php eT("Total records in survey:"); ?>&nbsp;<?php echo $total; ?></p>
Expand All @@ -27,10 +30,11 @@
<?php echo CHtml::form(["admin/responses/sa/browse/surveyid/{$surveyid}"], 'post') . "\n"; ?>
<p>
<?php Yii::app()->user->setState('sql_' . $surveyid, $sql); ?>
<input type='submit' class='btn btn-default' value='<?php eT("Browse"); ?>'/>
<input type='submit' class='btn btn-default hidden-print' value='<?php eT("Browse"); ?>'/>
<input type='hidden' name='subaction' value='all'/>
</p>
<?php echo CHtml::endForm() ?>
<?php endif; ?>

</div>
<input type="hidden" id="showGraphOnPageLoad"/>
Expand Up @@ -16,11 +16,11 @@
$qqid = str_replace ( '-', '__' , $qqid );
?>
<tr>
<td colspan='4' style=\"text-align:center\" id='statzone_<?php echo $rt;?>'>
<td colspan='4 id='statzone_<?php echo $rt;?>'>
<?php if(count($labels) < 70): ?>
<!-- Charts -->
<div class="row">
<div class="col-lg-8 col-md-12 chartjs-container" id="chartjs-container-<?php echo $qqid; ?>"
<div class="col-lg-8 col-md-12 chartjs-container text-center" id="chartjs-container-<?php echo $qqid; ?>"
data-chartname="<?php echo $sChartname; // The name of the jschart object ?>"
data-qid="<?php echo $qqid; // the question id ?>"
data-type="<?php echo $charttype; // the chart start type (bar, donut, etc.) ?>"
Expand Down Expand Up @@ -59,7 +59,7 @@
</tr>

<!-- Buttons to change graph type -->
<tr>
<tr class="hidden-print">
<td colspan='4'>
<div class="chartjs-buttons" style="text-align:center">

Expand Down Expand Up @@ -121,4 +121,4 @@
var labels_percent_<?php echo $qqid; ?>=<?php echo json_encode($graph_labels_percent); // the array of labels ?>;
var grawdata_percent_<?php echo $qqid;?>=<?php echo json_encode($grawdata_percent); // the datas to generate the graph using percentages (pie, Doughnut, polar ) ?>;
</script>*/
?>
?>
Expand Up @@ -9,15 +9,15 @@
*/
?>
<!-- _statisticsoutput_header -->
<div class="col-lg-<?php echo $nbcols; ?> col-sm-12 printable" >
<div class="col-lg-<?php echo $nbcols; ?> col-sm-12 statisticsbloc" >
<table class='statisticstable table table-bordered printable' id="quid_<?php echo $outputs['parentqid'];?>">
<thead>
<tr class='success'>
<th colspan='4' align='center' style='text-align: center; '>
<strong>
<?php echo sprintf(gT("Summary for %s"),$outputs['qtitle']); ?>
</strong>
<button class="pull-right action_js_export_to_pdf btn btn-default btn-sm" data-question-id="quid_<?php echo $outputs['parentqid'];?>" data-toggle="tooltip" title="<?php eT('Export this question to PDF.'); ?>">
<button class="pull-right action_js_export_to_pdf btn btn-default btn-sm hidden-print" data-question-id="quid_<?php echo $outputs['parentqid'];?>" data-toggle="tooltip" title="<?php eT('Export this question to PDF.'); ?>">
<i class="fa fa-file-pdf-o"></i>
</button>
</th>
Expand Down
4 changes: 2 additions & 2 deletions application/views/admin/export/statistics_browse_view.php
Expand Up @@ -46,7 +46,7 @@

<?php $sort=(isset($sortby) && $sortby==$column && $sortmethod=='asc') ? 'desc' : 'asc'; ?>
<?php if(!$disabled): ?>
<a href="#" class='sortorder' id='sortorder_<?php echo $column ?>_<?php echo $column ?>_<?php echo $sort ?>_<?php echo $sorttype ?>'>
<a href="#" class='sortorder hidden-print' id='sortorder_<?php echo $column ?>_<?php echo $column ?>_<?php echo $sort ?>_<?php echo $sorttype ?>'>
<span class="<?php echo $iconClass?>"></span>
</a>
<?php endif;?>
Expand All @@ -56,7 +56,7 @@
foreach ($data as $row) {
?>
<?php if(Permission::model()->hasSurveyPermission($surveyid,'responses','read')){ ?>
<div class='statisticscolumnid col-sm-1'>
<div class='statisticscolumnid col-sm-1 hidden-print'>
<a href='<?php echo Yii::app()->getController()->createUrl("admin/responses/sa/view/surveyid/".$surveyid."/id/".$row['id']); ?>' target='_blank' title='<?php eT("View response"); ?>' data-toggle="tooltip" data-placement="top">
<span class="fa fa-search"></span>
</a>
Expand Down
@@ -1,5 +1,5 @@
<!-- views/admin/export/statistics_subviews/_header.php -->
<h3 id="survey-statistics">
<h3 id="survey-statistics" class="hidden-print">
<?php eT("Statistics"); ?>
<span id="statistics-render-chevron" class="fa fa-chevron-up"></span>
</h3>
14 changes: 7 additions & 7 deletions application/views/admin/export/statistics_view.php
Expand Up @@ -14,21 +14,21 @@
<?php $this->renderPartial('/admin/export/statistics_subviews/_statistics_view_scripts', array('sStatisticsLanguage' => $sStatisticsLanguage, 'surveyid' => $surveyid, 'showtextinline' => $showtextinline)); ?>
<?php echo CHtml::form(array("admin/statistics/sa/index/surveyid/{$surveyid}/"), 'post', array('name' => 'generate-statistics', 'class' => '', 'id' => 'generate-statistics')); ?>
<div id='statisticsview' class='side-body <?php echo getSideBodyClass(false); ?>'>
<div class="row">
<div class="h1 visible-print-block text-center"><?php echo flattenText($oSurvey->defaultlanguage->surveyls_title,1); ?></div>
<div class="row hidden-print">
<div class="col-md-12">
<div class="col-md-3 text-left">
<h4>
<h4 class="hidden-print">
<span class="fa fa-bar-chart"></span> &nbsp;&nbsp;&nbsp;
<?php eT("Statistics"); ?>
</h4>
</div>
</div>
<h3></h3>
</div>


<!-- General filters -->
<div class="row">
<div class="row hidden-print">
<div class="col-sm-12 content-right">

<!-- Header -->
Expand Down Expand Up @@ -68,7 +68,7 @@
</div>

<!-- Response filter -->
<div class="row">
<div class="row hidden-print">
<div class="col-lg-12 content-right">
<div style='clear: both'></div>

Expand Down Expand Up @@ -143,7 +143,7 @@
</div>
</div>
</div>
<div class="row">
<div class="row hidden-print">
<div class="col-lg-12 content-left">
<button id="statisticsExportImages" class="btn btn-info" style="margin: auto;"><?= gT('Export images') ?></button>
<p><?php eT('Make sure all images on this screen are loaded before clicking on the button.'); ?></p>
Expand All @@ -154,4 +154,4 @@
App()->getClientScript()->registerScript('StatisticsViewBSSwitcher', "
LS.renderBootstrapSwitch();
", LSYii_ClientScript::POS_POSTSCRIPT);
?>
?>

0 comments on commit 5ceb483

Please sign in to comment.