diff options
author | dave <dave@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2009-02-22 17:49:42 +0000 |
---|---|---|
committer | dave <dave@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2009-02-22 17:49:42 +0000 |
commit | de382a941d30b9f06e8fe440dc40549305badc84 (patch) | |
tree | a8d611ad7fec93fa4205562b1ff08d8af9d5f06f /mod | |
parent | d40aa55fa4ca33ce81abeab362276b582df46e92 (diff) | |
download | elgg-de382a941d30b9f06e8fe440dc40549305badc84.tar.gz elgg-de382a941d30b9f06e8fe440dc40549305badc84.tar.bz2 |
new group discussion layout
git-svn-id: https://code.elgg.org/elgg/trunk@2880 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod')
-rw-r--r-- | mod/groups/forum.php | 9 | ||||
-rw-r--r-- | mod/groups/languages/en.php | 3 | ||||
-rw-r--r-- | mod/groups/views/default/object/groupforumtopic.php | 114 |
3 files changed, 69 insertions, 57 deletions
diff --git a/mod/groups/forum.php b/mod/groups/forum.php index fd319e7c9..dd4b734b2 100644 --- a/mod/groups/forum.php +++ b/mod/groups/forum.php @@ -15,10 +15,11 @@ if (!(page_owner_entity() instanceof ElggGroup)) forward();
//get any forum topics
- //$topics = get_entities("object", "groupforumtopic", 0, "", 50, 0, false, 0, get_input('group_guid'));
- $topics = get_entities_from_annotations("object", "groupforumtopic", "group_topic_post", "", 0, get_input('group_guid'), 20, 0, "desc", false);
-
- $area2 = elgg_view("forum/topics", array('entity' => $topics));
+ //get any forum topics
+ $topics = list_entities_from_annotations("object", "groupforumtopic", "group_topic_post", "", 20, 0, get_input('group_guid'), false, false, false);
+ set_context('search');
+ $area2 = elgg_view("forum/topics", array('topics' => $topics));
+ set_context('groups');
$body = elgg_view_layout('two_column_left_sidebar',$area1, $area2);
diff --git a/mod/groups/languages/en.php b/mod/groups/languages/en.php index b2a641501..13a26eac4 100644 --- a/mod/groups/languages/en.php +++ b/mod/groups/languages/en.php @@ -133,8 +133,9 @@ 'groups:alreadymember' => 'You are already a member of this group!',
'groups:userinvited' => 'User has been invited.',
'groups:usernotinvited' => 'User could not be invited.',
-
+ 'groups:updated' => "Updated",
'groups:invite:subject' => "%s you have been invited to join %s!",
+ 'groups:started' => "Started by",
'groups:invite:body' => "Hi %s,
You have been invited to join the '%s' group, click below to confirm:
diff --git a/mod/groups/views/default/object/groupforumtopic.php b/mod/groups/views/default/object/groupforumtopic.php index 65eca23fd..b58a41052 100644 --- a/mod/groups/views/default/object/groupforumtopic.php +++ b/mod/groups/views/default/object/groupforumtopic.php @@ -1,54 +1,64 @@ -<?php - - /** - * Elgg Groups latest discussion listing - * - * @package ElggGroups - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider <info@elgg.com> - * @copyright Curverider Ltd 2008-2009 - * @link http://elgg.com/ - */ - - //get the required variables - $title = $vars['entity']->title; - $description = autop($vars['entity']->description); - $group = get_entity($vars['entity']->container_guid); +<?php
+
+ /**
+ * Elgg Groups latest discussion listing
+ *
+ * @package ElggGroups
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider <info@elgg.com>
+ * @copyright Curverider Ltd 2008-2009
+ * @link http://elgg.com/
+ */
+
+ //get the required variables
+ $title = $vars['entity']->title;
+ $description = autop($vars['entity']->description);
+ $topic_owner = get_user($vars['entity']->owner_guid);
+ $group = get_entity($vars['entity']->container_guid);
$forum_created = friendly_time($vars['entity']->time_created);
- //if (isloggedin()) { - $counter = $vars['entity']->countAnnotations("group_topic_post"); - $last_post = $vars['entity']->getAnnotations("group_topic_post", 1, 0, "desc"); -
- //} - - //get the time and user - if ($last_post) { - foreach($last_post as $last) - { - $last_time = $last->time_created; - $last_user = $last->owner_guid; - } - } - - $u = get_user($last_user); - - $info = "<p class=\"latest_discussion_info\">" . sprintf(elgg_echo('group:created'), $forum_created, $counter) . "<br /><span class=\"timestamp\">"; - if ($last_time) $info.= sprintf(elgg_echo('groups:lastupdated'), friendly_time($last_time), "<br />by <a href=\"" . $u->getURL() . "\">" . $u->username . "</a>");
- //if ($u = get_user($last_user)) {
- // $info .= "<br />by <a href=\"" . $u->getURL() . "\">" . $u->username . "</a>";
- //}
- $info .= '</span></p>'; - //get the group avatar - $icon = elgg_view("profile/icon",array('entity' => $group, 'size' => 'small')); - //get the group and topic title
- if ($group instanceof ElggGroup) - $info .= "<p>" . elgg_echo('group') . ": <a href=\"{$group->getURL()}\">{$group->name}</a></p>"; - - $info .= "<p>" . elgg_echo('topic') . ": <a href=\"{$vars['url']}mod/groups/topicposts.php?topic={$vars['entity']->guid}&group_guid={$group->guid}\">{$title}</a></p>"; - //get the forum description - $info .= $description; - - //display - echo elgg_view_listing($icon, $info); - + $counter = $vars['entity']->countAnnotations("group_topic_post");
+ $last_post = $vars['entity']->getAnnotations("group_topic_post", 1, 0, "desc");
+
+ //get the time and user
+ if ($last_post) {
+ foreach($last_post as $last)
+ {
+ $last_time = $last->time_created;
+ $last_user = $last->owner_guid;
+ }
+ }
+
+ $u = get_user($last_user);
+
+ //select the correct output depending on where you are
+ if(get_context() == "search"){
+
+ $info = "<p class=\"latest_discussion_info\">" . sprintf(elgg_echo('group:created'), $forum_created, $counter) . "<br /><span class=\"timestamp\">";
+ if ($last_time) $info.= sprintf(elgg_echo('groups:lastupdated'), friendly_time($last_time), "<br />by <a href=\"" . $u->getURL() . "\">" . $u->username . "</a>");
+ $info .= '</span></p>';
+ //get the group avatar
+ $icon = elgg_view("profile/icon",array('entity' => $group, 'size' => 'small'));
+ //get the group and topic title
+ if ($group instanceof ElggGroup)
+ $info .= "<p>" . elgg_echo('group') . ": <a href=\"{$group->getURL()}\">{$group->name}</a></p>";
+
+ $info .= "<p>" . elgg_echo('topic') . ": <a href=\"{$vars['url']}mod/groups/topicposts.php?topic={$vars['entity']->guid}&group_guid={$group->guid}\">{$title}</a></p>";
+ //get the forum description
+ $info .= $description;
+
+ }else{
+
+ $info = "<p class=\"latest_discussion_info\"><span class=\"timestamp\">" . sprintf(elgg_echo('group:created'), $forum_created, $counter) . "</span></p>";
+ //get the user avatar
+ $icon = elgg_view("profile/icon",array('entity' => $topic_owner, 'size' => 'small'));
+ $info .= "<p>" . elgg_echo('groups:started') . " " . $topic_owner->name . ": <a href=\"{$vars['url']}mod/groups/topicposts.php?topic={$vars['entity']->guid}&group_guid={$group->guid}\">{$title}</a></p>";
+ if ($last_time) $info.= "<p>" . elgg_echo('groups:updated') . " " . friendly_time($last_time) . " by <a href=\"" . $u->getURL() . "\">" . $u->username . "</a></p>";
+
+ $info .= $description;
+
+ }
+
+ //display
+ echo elgg_view_listing($icon, $info);
+
?>
\ No newline at end of file |