Commit 7216ff49 authored by Jono Mingard's avatar Jono Mingard Committed by Robert Lyon
Browse files

Remove empty links in institutions list (Bug #1278668)



Also removed link to institution page for "No institution" (ie. the institution
title is no longer a link) since it can never have institution staff
or admins.

Also fixed up the max users count to not display count = 0

Change-Id: I667ef41431f59b5036ed82d277b683a161bc6045
Signed-off-by: default avatarJono Mingard <jonom@catalyst.net.nz>
parent c93b073a
......@@ -809,13 +809,17 @@ class Institution {
ii.name = \'mahara\', ii.displayname', $queryvalues, $offset, $limit);
if ($showdefault && $institutions && array_key_exists('mahara', $institutions)) {
$defaultinstmembers = count_records_sql('
SELECT COUNT(u.id) FROM {usr} u LEFT OUTER JOIN {usr_institution} i ON u.id = i.usr
$defaultinstarray = get_records_sql_assoc('
SELECT COUNT(u.id) AS members, COALESCE(SUM(u.staff), 0) AS staff, COALESCE(SUM(u.admin), 0) AS admins
FROM {usr} u LEFT OUTER JOIN {usr_institution} i ON u.id = i.usr
WHERE u.deleted = 0 AND i.usr IS NULL AND u.id != 0
');
$institutions['mahara']->members = $defaultinstmembers;
$institutions['mahara']->staff = '';
$institutions['mahara']->admins = '';
', array());
$defaultinst = current($defaultinstarray);
$institutions['mahara']->members = $defaultinst->members;
$institutions['mahara']->staff = $defaultinst->staff;
$institutions['mahara']->admins = $defaultinst->admins;
$institutions['mahara']->site = true;
$institutions['mahara']->maxuseraccounts = 0;
}
return $institutions;
}
......
{foreach from=$institutions item=institution}
<tr class="{cycle values='r0,r1'}">
<td><a href="{$WWWROOT}institution/index.php?institution={$institution->name}">{$institution->displayname}</a></td>
<td>
{if !$institution->site}<a href="{$WWWROOT}institution/index.php?institution={$institution->name}">{/if}
{$institution->displayname}
{if !$institution->site}</a>{/if}
</td>
<td class="center">
{if $institution->name != 'mahara'}
{if !$institution->site}
<a href="{$WWWROOT}admin/users/institutionusers.php?usertype=members&amp;institution={$institution->name}">{$institution->members}</a>
{else}
<a href="{$WWWROOT}admin/users/search.php?institution=mahara">{$institution->members}</a>
{/if}
</td>
<td class="center">{$institution->maxuseraccounts}</td>
<td class="center"><a href="{$WWWROOT}admin/users/institutionstaff.php?institution={$institution->name}">{$institution->staff}</a></td>
<td class="center"><a href="{$WWWROOT}admin/users/institutionadmins.php?institution={$institution->name}">{$institution->admins}</a></td>
<td class="center">{if $institution->maxuseraccounts}{$institution->maxuseraccounts}{/if}</td>
<td class="center">
{if !$institution->site}<a href="{$WWWROOT}admin/users/institutionstaff.php?institution={$institution->name}">{/if}
{$institution->staff}
{if !$institution->site}</a>{/if}</td>
<td class="center">
{if !$institution->site}<a href="{$WWWROOT}admin/users/institutionadmins.php?institution={$institution->name}">{/if}
{$institution->admins}
{if !$institution->site}</a>{/if}</td>
<td class="center">{if $institution->suspended}<span class="suspended">{str tag="suspendedinstitution" section=admin}</span>{/if}</td>
<td class="controls">
<form action="" method="post">
......
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