Commit 9e1a0c3f authored by Penny Leach's avatar Penny Leach
Browse files

fixed the side block in groups to be smarter

parent 9ebfaa4f
......@@ -311,11 +311,31 @@ addLoadEvent(function () { switchPending(1) });
EOF;
}
$interactiontypes = array_flip(
array_map(
create_function('$a', 'return $a->name;'),
plugins_installed('interaction')
)
);
if (!$interactions = get_records_select_array('interaction_instance',
'"group" = ? AND deleted = ?', array($id, 0),
'plugin, ctime', 'id, plugin, title')) {
$interactions = array();
}
foreach ($interactions as $i) {
if (!is_array($interactiontypes[$i->plugin])) {
$interactiontypes[$i->plugin] = array();
}
$interactiontypes[$i->plugin][] = $i;
}
// Add a sideblock for group interactions
$sideblock = array(
'name' => 'groupinteractions',
'weight' => -5,
'data' => get_records_array('interaction_instance', 'group', $id, 'ctime', 'id, plugin, title'),
'data' => $interactiontypes,
);
$smarty = smarty(array('tablerenderer'), array(), array(), array('sideblocks' => array($sideblock)));
......
......@@ -2,9 +2,16 @@
{if $data}
<ul>
{foreach from=$data item=interaction}
<li><a href="{$WWWROOT}interaction/{$interaction->plugin|escape}/?id={$interaction->id|escape}">{$interaction->title|escape}</a></li>
{/foreach}
{foreach from=$data item=interactions key=plugin}
<li><a href="{$WWWROOT}interaction/{$plugin}/index.php?group={$group->id}">{str tag=nameplural section='interaction.$plugin}</a></li>
{if $interactions}
<ul>
{foreach from=$interactions item=interaction}
<li><a href="{$WWWROOT}interaction/{$interaction->plugin|escape}/view.php?id={$interaction->id|escape}">{$interaction->title|escape}</a></li>
{/foreach}
</ul>
{/if}
{/foreach}
</ul>
{else}
<p>{str tag=nointeractions section=group}</p>
......
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