Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mahara
mahara
Commits
5224d28d
Commit
5224d28d
authored
May 14, 2009
by
Nigel McNie
Browse files
Show institutions a user is a member of on the Find Friends page and their profile page.
parent
6252c757
Changes
5
Hide whitespace changes
Inline
Side-by-side
htdocs/lang/en.utf8/mahara.php
View file @
5224d28d
...
...
@@ -73,6 +73,7 @@ $string['last'] = 'Last';
$string
[
'lastpage'
]
=
'Last page'
;
$string
[
'accept'
]
=
'Accept'
;
$string
[
'memberofinstitutions'
]
=
'Member of %s'
;
$string
[
'reject'
]
=
'Reject'
;
$string
[
'sendrequest'
]
=
'Send request'
;
$string
[
'reason'
]
=
'Reason'
;
...
...
htdocs/lib/user.php
View file @
5224d28d
...
...
@@ -1022,6 +1022,7 @@ function get_users_data($userlist) {
}
$record
->
messages
=
(
$record
->
messages
==
'allow'
||
$record
->
friend
&&
$record
->
messages
==
'friends'
||
$USER
->
get
(
'admin'
))
?
1
:
0
;
$record
->
institutions
=
get_institution_string_for_user
(
$record
->
id
);
}
if
(
!
$data
||
!
$views
=
get_views
(
array_keys
(
$data
),
null
,
null
))
{
...
...
@@ -1116,6 +1117,26 @@ function get_users_data($userlist) {
return
$ordereddata
;
}
function
get_institution_string_for_user
(
$userid
)
{
static
$institutions
=
null
;
if
(
is_null
(
$institutions
))
{
$institutions
=
get_records_assoc
(
'institution'
,
''
,
''
,
''
,
'name, displayname'
);
}
$user
=
new
User
;
$user
->
find_by_id
(
$userid
);
$userinstitutions
=
array
();
foreach
(
$user
->
get
(
'institutions'
)
as
$institution
)
{
$userinstitutions
[]
=
$institutions
[
$institution
->
institution
]
->
displayname
;
}
if
(
$userinstitutions
)
{
return
get_string
(
'memberofinstitutions'
,
'mahara'
,
join
(
', '
,
$userinstitutions
));
}
return
''
;
}
function
friends_control_sideblock
(
$returnto
=
'myfriends'
)
{
global
$USER
;
$form
=
array
(
...
...
htdocs/theme/raw/templates/user/user.tpl
View file @
5224d28d
{
if
$user
->
pending
}
<td
class=
"pending friendinfo"
>
<ul
class=
"actionlist"
>
{
if
$user
->
institutions
}
<li>
{
$user
->
institutions
|
escape
}
</li>
{/
if
}
<li>
{
$user
->
accept
}
</li>
<li>
<a
href=
"
{
$WWWROOT
}
user/denyrequest.php?id=
{
$user
->
id
}
&returnto=
{
$page
}
"
id=
"btn-denyrequest"
>
...
...
@@ -39,6 +40,7 @@
{
elseif
$user
->
friend
}
<td
class=
"friendinfo"
>
<ul
class=
"actionlist"
>
{
if
$user
->
institutions
}
<li>
{
$user
->
institutions
|
escape
}
</li>
{/
if
}
{
if
$user
->
messages
}
<li>
<a
href=
"
{
$WWWROOT
}
user/sendmessage.php?id=
{
$user
->
id
}
&returnto=
{
$page
}
"
id=
"btn-sendmessage"
>
...
...
@@ -95,6 +97,7 @@
{
elseif
$user
->
requestedfriendship
}
<td
class=
"friendinfo"
>
<ul
class=
"actionlist"
>
{
if
$user
->
institutions
}
<li>
{
$user
->
institutions
|
escape
}
</li>
{/
if
}
{
if
$user
->
messages
}
<li>
<a
href=
"
{
$WWWROOT
}
user/sendmessage.php?id=
{
$user
->
id
}
&returnto=
{
$page
}
"
id=
"btn-sendmessage"
>
...
...
@@ -123,6 +126,7 @@
{
else
}
<td
class=
"friendinfo"
>
<ul
class=
"actionlist"
>
{
if
$user
->
institutions
}
<li>
{
$user
->
institutions
|
escape
}
</li>
{/
if
}
{
if
$user
->
messages
}
<li>
<a
href=
"
{
$WWWROOT
}
user/sendmessage.php?id=
{
$user
->
id
}
&returnto=
{
$page
}
"
id=
"btn-sendmessage"
>
...
...
@@ -156,4 +160,4 @@
{/
if
}
</div>
</td>
{/
if
}
\ No newline at end of file
{/
if
}
htdocs/theme/raw/templates/user/view.tpl
View file @
5224d28d
...
...
@@ -4,6 +4,7 @@
{
include
file
=
"columnleftstart.tpl"
}
<div
id=
"userview"
>
<div
class=
"user-icon right"
>
{
$institutions
}
{
if
!
empty
(
$loginas
)
}
<strong><a
href=
"
{
$WWWROOT
}
admin/users/changeuser.php?id=
{
$USERID
}
"
>
{
$loginas
}
</a></strong>
{/
if
}
...
...
htdocs/user/view.php
View file @
5224d28d
...
...
@@ -287,6 +287,7 @@ $smarty->assign('loginas', $loginas);
if
(
isset
(
$introduction
))
{
$smarty
->
assign
(
'introduction'
,
$introduction
);
}
$smarty
->
assign
(
'institutions'
,
get_institution_string_for_user
(
$userid
));
$smarty
->
assign
(
'canmessage'
,
can_send_message
(
$loggedinid
,
$userid
));
$smarty
->
assign
(
'NAME'
,
$name
);
$smarty
->
assign
(
'USERID'
,
$userid
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment