Commit 1277a6e8 authored by Clare Lenihan's avatar Clare Lenihan Committed by Clare Lenihan
Browse files

adding message on user/view.php when a user has no friends

parent 9118c00d
......@@ -224,6 +224,7 @@ $string['cantmessageuser'] = 'You cannot send this user a message';
$string['requestedfriendship'] = 'requested friendship';
$string['notinanygroups'] = 'Not in any groups';
$string['numberoffriends'] = 'Friends (%s of %s)';
$string['nofriends'] = 'No friends :(';
$string['addusertogroup'] = 'Add to ';
$string['inviteusertojoingroup'] = 'Invite to ';
$string['invitemembertogroup'] = 'Invite %s to join \'%s\'';
......
......@@ -85,20 +85,24 @@
{/if}
<h6>{$friendsmessage}</h6>
<div class="friends">
<table>
{foreach from=$friends item=row}
<tr>
{foreach from=$row item=friend}
<td class="friendcell">
<a href="{$WWWROOT}user/view.php?id={$friend}">
<img src="{$WWWROOT}thumb.php?type=profileicon&amp;maxwidth=60&amp;maxheight=60&amp;id={$friend}" alt="">
<br>{$friend|display_name|escape}
</a>
</td>
{if $friends}
<table>
{foreach from=$friends item=row}
<tr>
{foreach from=$row item=friend}
<td class="friendcell">
<a href="{$WWWROOT}user/view.php?id={$friend}">
<img src="{$WWWROOT}thumb.php?type=profileicon&amp;maxwidth=60&amp;maxheight=60&amp;id={$friend}" alt="">
<br>{$friend|display_name|escape}
</a>
</td>
{/foreach}
</tr>
{/foreach}
</tr>
{/foreach}
</table>
</table>
{else}
{str tag='nofriends' section='group'}
{/if}
</div>
</div>
</div>
......
......@@ -166,16 +166,18 @@ else {
$friendsmessage = get_string('Friends', 'group');
}
// get the friends into a 4x4 array
$friends = array();
for ($i = 0; $i < 4; $i++) {
$friends[$i] = array();
for($j = 4 * $i; $j < ($i + 1 ) * 4; $j++) {
if (isset($records[$j])) {
if ($records[$j]->usr1 == $userid) {
$friends[$i][] = $records[$j]->usr2;
}
else {
$friends[$i][] = $records[$j]->usr1;
if ($records) {
$friends = array();
for ($i = 0; $i < 4; $i++) {
$friends[$i] = array();
for($j = 4 * $i; $j < ($i + 1 ) * 4; $j++) {
if (isset($records[$j])) {
if ($records[$j]->usr1 == $userid) {
$friends[$i][] = $records[$j]->usr2;
}
else {
$friends[$i][] = $records[$j]->usr1;
}
}
}
}
......
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