Commit 403c021d authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Show group navigation on forum pages

parent 6b34bf0b
......@@ -25,7 +25,7 @@
*/
define('INTERNAL', 1);
define('MENUITEM', 'groups');
define('MENUITEM', 'groups/forums');
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
safe_require('interaction', 'forum');
require('group.php');
......@@ -54,7 +54,7 @@ else { // edit post
}
$parent = get_record_sql(
'SELECT p.subject, p.body, p.topic, p.parent, p.poster, ' . db_format_tsfield('p.ctime', 'ctime') . ', m.user AS moderator, t.id AS topic, t.forum, t.closed AS topicclosed, p2.subject AS topicsubject, f.group AS "group", f.title AS forumtitle, g.name AS groupname, COUNT(p3.id)
'SELECT p.subject, p.body, p.topic, p.parent, p.poster, ' . db_format_tsfield('p.ctime', 'ctime') . ', m.user AS moderator, t.id AS topic, t.forum, t.closed AS topicclosed, p2.subject AS topicsubject, f.group AS "group", f.title AS forumtitle, g.name AS groupname, g.grouptype, COUNT(p3.id)
FROM {interaction_forum_post} p
INNER JOIN {interaction_forum_topic} t ON (p.topic = t.id AND t.deleted != 1)
INNER JOIN {interaction_forum_post} p2 ON (p2.topic = t.id AND p2.parent IS NULL)
......@@ -70,7 +70,7 @@ $parent = get_record_sql(
INNER JOIN {interaction_instance} f2 ON (t2.forum = f2.id AND f2.deleted != 1 AND f2.group = f.group)
WHERE p.id = ?
AND p.deleted != 1
GROUP BY 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14',
GROUP BY 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15',
array(0, $parentid)
);
......@@ -239,7 +239,10 @@ function addpost_submit(Pieform $form, $values) {
redirect('/interaction/forum/topic.php?id=' . $values['topic'] . '#post' . $postid);
}
$smarty = smarty(array(), array(), array(), array('sideblocks' => array(interaction_sideblock($parent->group))));
$smarty = smarty(array(), array(), array(), array(
'sideblocks' => array(interaction_sideblock($parent->group)),
'group' => (object) array('id' => $parent->group, 'name' => $parent->groupname, 'grouptype' => $parent->grouptype),
));
$smarty->assign('breadcrumbs', $breadcrumbs);
$smarty->assign('heading', TITLE);
$smarty->assign('editform', $editform);
......
......@@ -25,7 +25,7 @@
*/
define('INTERNAL', 1);
define('MENUITEM', 'groups');
define('MENUITEM', 'groups/forums');
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
safe_require('interaction', 'forum');
require_once('group.php');
......@@ -58,7 +58,7 @@ else { // edit topic
}
$forum = get_record_sql(
'SELECT f.group AS groupid, f.title, g.name AS groupname
'SELECT f.group AS groupid, f.title, g.name AS groupname, g.grouptype
FROM {interaction_instance} f
INNER JOIN {group} g ON (g.id = f.group AND g.deleted = ?)
WHERE f.id = ?
......@@ -253,7 +253,10 @@ function edittopic_submit(Pieform $form, $values) {
}
}
$smarty = smarty(array(), array(), array(), array('sideblocks' => array(interaction_sideblock($forum->groupid))));
$smarty = smarty(array(), array(), array(), array(
'sideblocks' => array(interaction_sideblock($forum->groupid)),
'group' => (object) array('id' => $forum->groupid, 'name' => $forum->groupname, 'grouptype' => $forum->grouptype),
));
$smarty->assign('breadcrumbs', $breadcrumbs);
$smarty->assign('heading', TITLE);
$smarty->assign('editform', $editform);
......
......@@ -25,7 +25,7 @@
*/
define('INTERNAL', 1);
define('MENUITEM', 'groups');
define('MENUITEM', 'groups/forums');
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
safe_require('interaction', 'forum');
require_once('group.php');
......@@ -35,7 +35,7 @@ require_once('pieforms/pieform.php');
$topicid = param_integer('id');
$topic = get_record_sql(
'SELECT p.subject, p.poster, p.id AS firstpost, ' . db_format_tsfield('p.ctime', 'ctime') . ', t.id, f.group AS groupid, g.name AS groupname, f.id AS forumid, f.title AS forumtitle, t.closed, sf.forum AS forumsubscribed, st.topic AS topicsubscribed
'SELECT p.subject, p.poster, p.id AS firstpost, ' . db_format_tsfield('p.ctime', 'ctime') . ', t.id, f.group AS groupid, g.name AS groupname, g.grouptype, f.id AS forumid, f.title AS forumtitle, t.closed, sf.forum AS forumsubscribed, st.topic AS topicsubscribed
FROM {interaction_forum_topic} t
INNER JOIN {interaction_instance} f ON (t.forum = f.id AND f.deleted != 1)
INNER JOIN {group} g ON (g.id = f.group AND g.deleted = ?)
......@@ -157,7 +157,10 @@ for ($i = 0; $i < $count; $i++) {
// builds the first post (with index 0) which has as children all the posts in the topic
$posts = buildpost(0, '', $posts);
$smarty = smarty(array(), array(), array(), array('sideblocks' => array(interaction_sideblock($topic->groupid))));
$smarty = smarty(array(), array(), array(), array(
'sideblocks' => array(interaction_sideblock($topic->groupid)),
'group' => (object) array('id' => $topic->groupid, 'name' => $topic->groupname, 'grouptype' => $topic->grouptype),
));
$smarty->assign('breadcrumbs', $breadcrumbs);
$smarty->assign('heading', TITLE);
$smarty->assign('topic', $topic);
......
......@@ -25,7 +25,7 @@
*/
define('INTERNAL', 1);
define('MENUITEM', 'groups');
define('MENUITEM', 'groups/forums');
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
require_once('group.php');
safe_require('interaction', 'forum');
......@@ -41,14 +41,14 @@ $topicsperpage = 25;
$offset = (int)($offset / $topicsperpage) * $topicsperpage;
$forum = get_record_sql(
'SELECT f.title, f.description, f.id, COUNT(t.id) AS topiccount, s.forum AS subscribed, g.id AS groupid, g.name AS groupname
'SELECT f.title, f.description, f.id, COUNT(t.id) AS topiccount, s.forum AS subscribed, g.id AS groupid, g.name AS groupname, g.grouptype
FROM {interaction_instance} f
INNER JOIN {group} g ON (g.id = f."group" AND g.deleted = ?)
LEFT JOIN {interaction_forum_topic} t ON (t.forum = f.id AND t.deleted != 1 AND t.sticky != 1)
LEFT JOIN {interaction_forum_subscription_forum} s ON (s.forum = f.id AND s."user" = ?)
WHERE f.id = ?
AND f.deleted != 1
GROUP BY 1, 2, 3, 5, 6, 7',
GROUP BY 1, 2, 3, 5, 6, 7, 8',
array(0, $userid, $forumid)
);
......@@ -245,7 +245,10 @@ addLoadEvent(function() {
});
EOF;
$smarty = smarty(array(), array(), array(), array('sideblocks' => array(interaction_sideblock($forum->groupid))));
$smarty = smarty(array(), array(), array(), array(
'sideblocks' => array(interaction_sideblock($forum->groupid)),
'group' => (object) array('id' => $forum->groupid, 'name' => $forum->groupname, 'grouptype' => $forum->grouptype)
));
$smarty->assign('breadcrumbs', $breadcrumbs);
$smarty->assign('heading', TITLE);
$smarty->assign('forum', $forum);
......
Supports Markdown
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