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
202c4906
Commit
202c4906
authored
Nov 24, 2006
by
Richard Mansfield
Browse files
Staff users get extra user fields in view user page
parent
6b6c2f2a
Changes
2
Show whitespace changes
Inline
Side-by-side
htdocs/theme/default/templates/user/view.tpl
View file @
202c4906
...
...
@@ -3,12 +3,23 @@
{
include
file
=
"adminmenu.tpl"
}
<div
class=
"content"
>
<h3>
{
$NAME
}
</h3>
<table><tbody>
{
foreach
from
=
$PROFILE
item
=
item
}
<tr><td>
{
str
section
=
artefact
.
internal
tag
=
$item.name
}
</td><td>
{
$item.value
}
</td></tr>
{
foreach
from
=
$USERFIELDS
key
=
key
item
=
item
}
<tr><td>
{
str
section
=
mahara
tag
=
$key
}
</td><td>
{
$item
}
</td></tr>
{/
foreach
}
</tbody></table>
<table><tbody>
{
foreach
from
=
$PROFILE
key
=
key
item
=
item
name
=
profile
}
{
if
$smarty.foreach.profile.first
}
<tr><th>
{
str
section
=
artefact
.
internal
tag
=
profile
}
</th></tr>
{/
if
}
<tr><td>
{
str
section
=
artefact
.
internal
tag
=
$key
}
</td><td>
{
$item
}
</td></tr>
{/
foreach
}
</tbody></table>
</div>
{
include
file
=
"footer.tpl"
}
htdocs/user/view.php
View file @
202c4906
...
...
@@ -30,11 +30,22 @@ require(dirname(dirname(__FILE__)).'/init.php');
$userid
=
param_integer
(
'id'
,
''
);
$profile
=
array
();
$userfields
=
array
();
if
(
!
$user
=
get_record
(
'usr'
,
'id'
,
$userid
))
{
$name
=
get_string
(
'usernotfound'
);
}
else
{
$name
=
display_name
(
$user
);
// If the logged in user is on staff, get full name, institution, id number, email address
if
(
$USER
->
get
(
'staff'
))
{
$userfields
[
'fullname'
]
=
$user
->
firstname
.
' '
.
$user
->
lastname
;
$userfields
[
'institution'
]
=
$user
->
institution
;
$userfields
[
'studentid'
]
=
$user
->
studentid
;
$userfields
[
'emailaddress'
]
=
$user
->
email
;
}
// Get public profile fields:
safe_require
(
'artefact'
,
'internal'
);
$publicfields
=
call_static_method
(
generate_artefact_class_name
(
'profile'
),
'get_public_fields'
);
foreach
(
array_keys
(
$publicfields
)
as
$field
)
{
...
...
@@ -43,14 +54,14 @@ else {
if
(
$emails
=
get_records_array
(
'artefact_internal_profile_email'
,
'owner'
,
$userid
))
{
foreach
(
$emails
as
$email
)
{
$fieldname
=
$email
->
principal
?
'principalemailaddress'
:
'emailaddress'
;
$profile
[
]
=
array
(
'name'
=>
$fieldname
,
'value'
=
>
$email
->
email
)
;
$profile
[
$fieldname
]
=
$email
->
email
;
}
}
}
else
{
$c
=
new
$classname
(
0
,
array
(
'owner'
=>
$userid
));
// email is different
if
(
$value
=
$c
->
render
(
ARTEFACT_FORMAT_LISTITEM
,
null
))
{
$profile
[
]
=
array
(
'name'
=>
$field
,
'value'
=
>
$value
)
;
$profile
[
$field
]
=
$value
;
}
}
}
...
...
@@ -59,6 +70,7 @@ else {
$smarty
=
smarty
();
$smarty
->
assign
(
'searchform'
,
searchform
());
$smarty
->
assign
(
'NAME'
,
$name
);
$smarty
->
assign
(
'USERFIELDS'
,
$userfields
);
$smarty
->
assign
(
'PROFILE'
,
$profile
);
$smarty
->
display
(
'user/view.tpl'
);
...
...
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