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
f4d9502e
Commit
f4d9502e
authored
Nov 19, 2014
by
Robert Lyon
Committed by
Gerrit Code Review
Nov 19, 2014
Browse files
Merge "Fetching / passing the institution comment sort order (Bug #1037531)"
parents
fd537e30
c3e794c2
Changes
3
Hide whitespace changes
Inline
Side-by-side
htdocs/artefact/comment/lib.php
View file @
f4d9502e
...
...
@@ -333,7 +333,8 @@ class ArtefactTypeComment extends ArtefactType {
$options
->
artefact
=
null
;
$options
->
export
=
false
;
$options
->
onview
=
false
;
$options
->
sort
=
'earliest'
;
$sortorder
=
get_user_institution_comment_sort_order
();
$options
->
sort
=
(
!
empty
(
$sortorder
))
?
$sortorder
:
'earliest'
;
return
$options
;
}
...
...
htdocs/lib/mahara.php
View file @
f4d9502e
...
...
@@ -3986,3 +3986,29 @@ function server_busy($threshold = false) {
}
return
false
;
}
/**
* Find out a user's institution sort order for comments on artefacts within view page.
* If they belong to one institution that has specified a sort order, then this will
* be that institution's comment sort.
* If they belong to multiple institutions then the arbitrarily "first" institution's
* sort order will be used.
*
* @param int $userid Which user to check (defaults to $USER)
* @return string Sort order - either 'earliest', 'latest'.
*/
function
get_user_institution_comment_sort_order
(
$userid
=
null
)
{
$instsorts
=
get_configs_user_institutions
(
'commentsortorder'
,
$userid
);
$sortorder
=
null
;
// Every user belongs to at least one institution
foreach
(
$instsorts
as
$sort
)
{
// If the user belongs to multiple institutions, arbitrarily use the sort
// from the first one that has specified a sort.
if
(
!
empty
(
$sort
))
{
$sortorder
=
$sort
;
break
;
}
}
return
$sortorder
;
}
htdocs/theme/raw/artefact/comment/templates/commentlist.tpl
View file @
f4d9502e
...
...
@@ -30,7 +30,7 @@
{
if
$item
->
author
}
<div
class=
"author"
><a
href=
"
{
$item
->
author
->
profileurl
}
"
class=
"username"
>
{
$item
->
author
|
display_name
}
</a><span
class=
"postedon"
>
-
{
$item
->
date
}
{
if
$item
->
updated
}
[
{
str
tag
=
Updated
}
:
{
$item
->
updated
}
]
{/
if
}
</span></div>
{
else
}
{
$item
->
authorname
}
<div
class=
"author"
>
{
$item
->
authorname
}
<span
class=
"postedon"
>
-
{
$item
->
date
}
</span></div>
{/
if
}
{
if
$item
->
deletedmessage
}
<div
class=
"deleteddetails"
>
{
$item
->
deletedmessage
}
</div>
...
...
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