Commit 35639889 authored by Cecilia Vela Gurovic's avatar Cecilia Vela Gurovic Committed by Robert Lyon

Bug 1797278: getting blocktype title through class

at the moment we are assuming the string to get
the title of a blocktype is 'title'
but this doesnt have to be the case,
like in the blocktype myviews


Change-Id: Ifeaac2731df6f495f00f3e12a806327e65ff63a9
(cherry picked from commit 2b8287dc)
(cherry picked from commit c38a17ef)
parent c4d2b5fe
......@@ -195,19 +195,24 @@ function site_statistics($full=false) {
// Views graph
$smarty = smarty_core();
$maxblocktypes = 5;
$smarty->assign('blocktypecounts', get_records_sql_array("
$blocktypecounts = get_records_sql_array("
CASE WHEN bi.artefactplugin IS NULL THEN b.blocktype
ELSE bi.artefactplugin || '/' || b.blocktype END AS langsection,
COUNT( AS blocks
FROM {block_instance} b
JOIN {blocktype_installed} bi ON (b.blocktype =
JOIN {view} v ON (b.view = AND v.type = 'portfolio')
GROUP BY b.blocktype, langsection
GROUP BY b.blocktype
ORDER BY blocks DESC",
array(), 0, $maxblocktypes
foreach ($blocktypecounts as $blocktype) {
safe_require('blocktype', $blocktype->blocktype);
$classname = generate_class_name('blocktype', $blocktype->blocktype);
$blocktype->title = $classname::get_title();
$smarty->assign('blocktypecounts', $blocktypecounts);
$smarty->assign('viewtypes', true);
$smarty->assign('viewcount', $data['views']);
$data['viewsinfo'] = $smarty->fetch('admin/viewstatssummary.tpl');
......@@ -5,7 +5,7 @@
<h4>{str tag=blockcountsbytype section=admin}</h4>
<ul class="list-group list-group-lite unstyled">
{foreach from=$blocktypecounts item=item}
<li class="list-group-item">{str tag=title section=blocktype.$item->langsection}: {$item->blocks}</li>
<li class="list-group-item">{$item->title}: {$item->blocks}</li>
{if $viewtypes}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment