Commit c38a17ef authored by Cecilia Vela Gurovic's avatar Cecilia Vela Gurovic Committed by Robert Lyon
Browse files

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)
parent 0b52ec7b
...@@ -195,19 +195,24 @@ function site_statistics($full=false) { ...@@ -195,19 +195,24 @@ function site_statistics($full=false) {
// Views graph // Views graph
$smarty = smarty_core(); $smarty = smarty_core();
$maxblocktypes = 5; $maxblocktypes = 5;
$smarty->assign('blocktypecounts', get_records_sql_array(" $blocktypecounts = get_records_sql_array("
b.blocktype, b.blocktype,
CASE WHEN bi.artefactplugin IS NULL THEN b.blocktype
ELSE bi.artefactplugin || '/' || b.blocktype END AS langsection,
COUNT( AS blocks COUNT( AS blocks
FROM {block_instance} b FROM {block_instance} b
JOIN {blocktype_installed} bi ON (b.blocktype = JOIN {blocktype_installed} bi ON (b.blocktype =
JOIN {view} v ON (b.view = AND v.type = 'portfolio') JOIN {view} v ON (b.view = AND v.type = 'portfolio')
GROUP BY b.blocktype, langsection GROUP BY b.blocktype
ORDER BY blocks DESC", ORDER BY blocks DESC",
array(), 0, $maxblocktypes 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('viewtypes', true);
$smarty->assign('viewcount', $data['views']); $smarty->assign('viewcount', $data['views']);
$data['viewsinfo'] = $smarty->fetch('admin/viewstatssummary.tpl'); $data['viewsinfo'] = $smarty->fetch('admin/viewstatssummary.tpl');
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<h4>{str tag=blockcountsbytype section=admin}</h4> <h4>{str tag=blockcountsbytype section=admin}</h4>
<ul class="list-group list-group-lite unstyled"> <ul class="list-group list-group-lite unstyled">
{foreach from=$blocktypecounts item=item} {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>
{/foreach} {/foreach}
</ul> </ul>
{if $viewtypes} {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