Skip to content

Commit

Permalink
Merge pull request #1968 from escopecz/report-widgets-fix
Browse files Browse the repository at this point in the history
Chart report widgets fixed
  • Loading branch information
escopecz committed Jul 8, 2016
2 parents 711c240 + a9b2efc commit 9b83722
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 10 deletions.
2 changes: 1 addition & 1 deletion app/bundles/CoreBundle/Helper/Chart/ChartQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ public function completeTimeData($rawData, $countAverage = false)
* PHP DateTime cannot parse the Y W (ex 2016 09)
* format, so we transform it into d-M-Y.
*/
if ($this->unit === 'W' && $this->isMysql()) {
if ($this->unit === 'W' && isset($item['date'])) {
list($year, $week) = explode(' ', $item['date']);
$newDate = new \DateTime();
$newDate->setISODate($year, $week);
Expand Down
4 changes: 3 additions & 1 deletion app/bundles/CoreBundle/Views/Helper/table.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@
<?php $item = str_replace(array('http://', 'https://'), '', $item); ?>
<?php echo $view['assets']->shortenText($item['value'], $shortenLinkText); ?>
</a>
<?php else: ?>
<?php elseif(isset($item['value'])): ?>
<?php echo $item['value']; ?>
<?php elseif(is_string($item)): ?>
<?php echo $item; ?>
<?php endif; ?>
</td>
<?php endforeach; ?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,28 @@
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
*/

echo $view->render(
'MauticCoreBundle:Helper:chart.html.php',
[
'chartData' => $chartData,
'chartType' => $chartType,
'chartHeight' => $chartHeight
]
);
if (isset($chartData['data'])) {
$chartData = $chartData['data'];
}

if ($chartType === 'table') {
echo $view->render(
'MauticCoreBundle:Helper:table.html.php',
[
'headItems' => isset($chartData[0]) ? array_keys($chartData[0]) : [],
'bodyItems' => $chartData
]
);
} else {
echo $view->render(
'MauticCoreBundle:Helper:chart.html.php',
[
'chartData' => $chartData,
'chartType' => $chartType,
'chartHeight' => $chartHeight
]
);
}
?>

<div class="pull-right mr-md mb-md">
Expand Down

0 comments on commit 9b83722

Please sign in to comment.