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
aee07961
Commit
aee07961
authored
Jul 01, 2008
by
Nigel McNie
Committed by
Nigel McNie
Jul 01, 2008
Browse files
Show latest forum posts on the group homepage.
parent
2106da31
Changes
2
Hide whitespace changes
Inline
Side-by-side
htdocs/group/view.php
View file @
aee07961
...
...
@@ -51,12 +51,34 @@ $offset = param_integer('offset', 0);
$limit
=
param_integer
(
'limit'
,
5
);
list
(
$html
,
$pagination
,
$count
,
$offset
)
=
group_get_membersearch_data
(
$id
,
$query
,
$offset
,
$limit
);
// Latest forums posts
// NOTE: it would be nicer if there was some generic way to get information
// from any installed interaction. But the only interaction plugin is forum,
// and group info pages might be replaced with views anyway...
$foruminfo
=
get_records_sql_array
(
'
SELECT
p.id, p.subject, p.body, p.poster, p.topic, t.forum, pt.subject AS topicname
FROM
{interaction_forum_post} p
INNER JOIN {interaction_forum_topic} t ON (t.id = p.topic)
INNER JOIN {interaction_instance} i ON (i.id = t.forum)
INNER JOIN {interaction_forum_post} pt ON (pt.topic = p.topic AND pt.parent IS NULL)
WHERE
i.group = ?
AND i.deleted = 0
AND t.deleted = 0
AND p.deleted = 0
ORDER BY
p.ctime DESC
LIMIT 5;
'
,
array
(
$id
));
$smarty
=
smarty
(
array
(
'paginator'
,
'groupmembersearch'
),
array
(),
array
(),
array
(
'sideblocks'
=>
array
(
interaction_sideblock
(
$id
,
$role
))));
$smarty
->
assign
(
'group'
,
$group
);
$smarty
->
assign
(
'query'
,
$query
);
$smarty
->
assign
(
'results'
,
$html
);
$smarty
->
assign
(
'pagination'
,
$pagination
[
'html'
]);
$smarty
->
assign
(
'pagination_js'
,
$pagination
[
'javascript'
]);
$smarty
->
assign
(
'foruminfo'
,
$foruminfo
);
$smarty
->
display
(
'group/view.tpl'
);
?>
htdocs/theme/default/templates/group/view.tpl
View file @
aee07961
...
...
@@ -42,17 +42,15 @@
</form>
</td>
<td>
<h3>
Latest Forum Posts
</h3>
<table>
<tr>
<th>
Thread/Thread Starter
</th>
<th>
Latest Post
</th>
</tr>
<tr>
<td><a
href=
""
>
Whatever
</a><br><a
href=
""
>
Mike
</a></td>
<td>
This is some content of some post...
</td>
</tr>
</table>
<h3>
{
str
tag
=
latestforumposts
section
=
group
}
</h3>
{
foreach
from
=
$foruminfo
item
=
postinfo
}
<div>
<h4><a
href=
"
{
$WWWROOT
}
interaction/forum/topic.php?id=
{
$postinfo
->
topic
|
escape
}
#post
{
$postinfo
->
id
|
escape
}
"
>
{
$postinfo
->
topicname
|
escape
}
</a></h4>
<div><a
href=
"
{
$WWWROOT
}
user/view.php?id=
{
$postinfo
->
poster
|
escape
}
"
>
{
$postinfo
->
poster
|
display_name
|
escape
}
</a></div>
<p>
{
$postinfo
->
body
|
str_shorten
:
100
:
true
}
</p>
</div>
{/
foreach
}
<p><a
href=
"
{
$WWWROOT
}
interaction/forum/?group=
{
$group
->
id
|
escape
}
"
>
{
str
tag
=
gotoforums
}
»
</a></p>
</td>
</tr>
</table>
...
...
Write
Preview
Markdown
is supported
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