public function generateExtensionsBreakdown()
{
$finalHTML = $this->getBasedPage('extension_list');
// List of extensions used
$res = $this->sqlite->query(<<<SQL
SELECT analyzer, count(*) AS count FROM results
WHERE analyzer LIKE "Extensions/Ext%"
GROUP BY analyzer
ORDER BY count(*) DESC
SQL
);
// $fileHTML = $this->getTopFile();
$html = '';
$xAxis = array();
$data = array();
while ($value = $res->fetchArray(\SQLITE3_ASSOC)) {
$shortName = str_replace('Extensions/Ext', 'ext/', $value['analyzer']);
$xAxis[] = "'" . $shortName . "'";
$data[$value['analyzer']] = $value['count'];
// <a href="#" title="' . $value['analyzer'] . '">
$html .= '<div class="clearfix">
<div class="block-cell-name">' . $shortName . '</div>
<div class="block-cell-issue text-center">' . $value['count'] . '</div>
</div>';
}
$finalHTML = $this->injectBloc($finalHTML, "TOPFILE", $html);
$blocjs = <<<JAVASCRIPT
<script>
\$(document).ready(function() {
Highcharts.theme = {
colors: ["#F56954", "#f7a35c", "#ffea6f", "#D2D6DE"],
chart: {
backgroundColor: null,
style: {
fontFamily: "Dosis, sans-serif"
}
},
title: {
style: {
fontSize: '16px',
fontWeight: 'bold',
textTransform: 'uppercase'
}
},
tooltip: {
borderWidth: 0,
backgroundColor: 'rgba(219,219,216,0.8)',
shadow: false
},
legend: {
itemStyle: {
fontWeight: 'bold',
fontSize: '13px'
}
},
xAxis: {
gridLineWidth: 1,
labels: {
style: {
fontSize: '12px'
}
}
},
yAxis: {
minorTickInterval: 'auto',
title: {
style: {
textTransform: 'uppercase'
}
},
labels: {
style: {
fontSize: '12px'
}
}
},
plotOptions: {
candlestick: {
lineColor: '#404048'
}
},
// General
background2: '#F0F0EA'
};
// Apply the theme
Highcharts.setOptions(Highcharts.theme);
\$('#filename').highcharts({
credits: {
enabled: false
},
exporting: {
enabled: false
},
chart: {
type: 'column'
},
title: {
text: ''
},
xAxis: {
categories: [SCRIPTDATAFILES]
},
yAxis: {
min: 0,
title: {
text: ''
},
stackLabels: {
enabled: false,
style: {
fontWeight: 'bold',
color: (Highcharts.theme && Highcharts.theme.textColor) || 'gray'
}
}
},
legend: {
align: 'right',
x: 0,
verticalAlign: 'top',
y: -10,
floating: false,
backgroundColor: (Highcharts.theme && Highcharts.theme.background2) || 'white',
borderColor: '#CCC',
borderWidth: 1,
shadow: false
},
tooltip: {
headerFormat: '<b>{point.x}</b><br/>',
pointFormat: '{series.name}: {point.y}<br/>Total: {point.stackTotal}'
},
plotOptions: {
column: {
stacking: 'normal',
dataLabels: {
enabled: false,
color: (Highcharts.theme && Highcharts.theme.dataLabelsColor) || 'white',
style: {
textShadow: '0 0 3px black'
}
}
}
},
series: [{
name: 'Calls',
data: [CALLCOUNT]
}]
});
});
</script>
JAVASCRIPT;
$tags = array();
$code = array();
// Filename Overview
$tags[] = 'CALLCOUNT';
$code[] = implode(', ', $data);
$tags[] = 'SCRIPTDATAFILES';
$code[] = implode(', ', $xAxis);
$blocjs = str_replace($tags, $code, $blocjs);
$finalHTML = $this->injectBloc($finalHTML, "BLOC-JS", $blocjs);
$this->putBasedPage('extension_list', $finalHTML);
}