From: dave
" . $post_owner->name . "
"; - } else { - echo "" . elgg_echo('profile:deleteduser') . "
"; - } - - //display the date of the comment - echo "" . friendly_time($vars['entity']->time_created) . "
"; - - //display the actual message posted - echo parse_urls(elgg_view("output/longtext",array("value" => $vars['entity']->value))); - - // if comment owner, group owner, or site admin - display edit-form - if (groups_can_edit_discussion($vars['entity'], page_owner_entity()->owner_guid)) { - //get the edit form and details - $submit_input = elgg_view('input/submit', array('internalname' => 'submit', 'value' => elgg_echo('save'))); - $text_textarea = elgg_view('input/longtext', array('internalname' => 'postComment'.$vars['entity']->id, 'value' => $vars['entity']->value)); - $post = elgg_view('input/hidden', array('internalname' => 'post', 'value' => $vars['entity']->id)); - $field = elgg_view('input/hidden', array('internalname' => 'field_num', 'value' => $vars['entity']->id)); - $topic = elgg_view('input/hidden', array('internalname' => 'topic', 'value' => get_input('topic'))); - $group = elgg_view('input/hidden', array('internalname' => 'group', 'value' => get_input('group_guid'))); - $edittopic_title = elgg_echo('groups:edittopic'); - - $form_body = <<" . $post_owner->name . "
"; + } else { + echo "" . elgg_echo('profile:deleteduser') . "
"; + } + + //display the date of the comment + echo "" . friendly_time($vars['entity']->time_created) . "
"; + + //display the actual message posted + echo parse_urls(elgg_view("output/longtext",array("value" => $vars['entity']->description))); + echo "". elgg_echo("grouptopic:notcreated") . "
"; \ No newline at end of file diff --git a/mod/groups/views/default/forum/viewposts.php b/mod/groups/views/default/forum/viewposts.php index 0ff70a38a..aa8b334f2 100644 --- a/mod/groups/views/default/forum/viewposts.php +++ b/mod/groups/views/default/forum/viewposts.php @@ -1,61 +1,48 @@ wwwroot."pg/groups/world/"); - elgg_push_breadcrumb($group->name, $group->getURL()); - elgg_push_breadcrumb(elgg_echo('item:object:groupforumtopic'), $CONFIG->wwwroot."pg/groups/forum/{$vars['entity']->container_guid}"); - elgg_push_breadcrumb($vars['entity']->title); - - echo elgg_view('navigation/breadcrumbs'); - - //display follow up comments - $count = $vars['entity']->countAnnotations('group_topic_post'); - $offset = (int) get_input('offset',0); - - $baseurl = $vars['url'] . "mod/groups/topicposts.php?topic={$vars['entity']->guid}&group_guid={$vars['entity']->container_guid}"; - echo elgg_view('navigation/pagination',array( - 'limit' => 50, - 'offset' => $offset, - 'baseurl' => $baseurl, - 'count' => $count, - )); +/** + * Elgg groups plugin display topic posts + */ + +// set up breadcrumbs +$group_guid = get_input('group_guid'); +$group = get_entity($group_guid); +elgg_push_breadcrumb(elgg_echo('groups'), $CONFIG->wwwroot."pg/groups/world/"); +elgg_push_breadcrumb($group->name, $group->getURL()); +elgg_push_breadcrumb(elgg_echo('item:object:groupforumtopic'), $CONFIG->wwwroot."pg/groups/forum/{$vars['entity']->container_guid}"); +elgg_push_breadcrumb($vars['entity']->title); + +echo elgg_view('navigation/breadcrumbs'); + +//display follow up comments +$count = $vars['entity']->countAnnotations('group_topic_post'); +$offset = (int) get_input('offset',0); + +$baseurl = $vars['url'] . "mod/groups/topicposts.php?topic={$vars['entity']->guid}&group_guid={$vars['entity']->container_guid}"; +echo elgg_view('navigation/pagination',array( + 'limit' => 50, + 'offset' => $offset, + 'baseurl' => $baseurl, + 'count' => $count, + )); ?>" . elgg_echo("groups:topiccloseddesc") . "
"; - } else { + }elseif(page_owner_entity()->isMember($vars['user'])){ + //comments are on and the user viewing is a member + echo elgg_view_comments($vars['entity']); + }else{ + //the user is not a member so cannot post a comment + echo elgg_view_comments($vars['entity'], false); } - -?> diff --git a/mod/groups/views/default/groups/css.php b/mod/groups/views/default/groups/css.php index fc160453a..d435b1f7c 100644 --- a/mod/groups/views/default/groups/css.php +++ b/mod/groups/views/default/groups/css.php @@ -150,5 +150,4 @@ - force tinyMCE to correct width */ .edit_comment .defaultSkin table.mceLayout { width: 694px !important; -} - +} \ No newline at end of file diff --git a/mod/groups/views/default/groups/forum_latest.php b/mod/groups/views/default/groups/forum_latest.php index 3c6ce6ccf..865b04ca2 100644 --- a/mod/groups/views/default/groups/forum_latest.php +++ b/mod/groups/views/default/groups/forum_latest.php @@ -8,23 +8,26 @@ if($vars['entity']->forum_enable != 'no'){ 'object', 'subtypes' => 'groupforumtopic', 'annotation_names' => 'group_topic_post', 'container_guid' => $vars['entity']->guid, 'limit' => 6, 'order_by' => 'maxtime desc')); + $forum = elgg_get_entities(array('types' => 'object', 'subtypes' => 'groupforumtopic', 'container_guid' => $vars['entity']->guid, 'limit' => 6)); if($forum){ foreach($forum as $f){ - $count_annotations = $f->countAnnotations("group_topic_post"); + $count_annotations = $f->countAnnotations("generic_comment"); echo "guid}&group_guid={$vars['entity']->guid}\">" . $f->title . "
"; - echo "".elgg_echo('groups:posts').": " . $count_annotations . "
".elgg_echo('comments').": " . $count_annotations . "
".elgg_echo("groups:addtopic")."
"; + if(page_owner_entity()->isMember($vars['user'])){ + $create_discussion = $vars['url'] . "mod/groups/addtopic.php?group_guid=" . page_owner(); + echo "".elgg_echo("groups:addtopic")."
"; + }else{ + echo "". elgg_echo("grouptopic:notcreated") . "
"; + } } -}//end of forum active check -?> \ No newline at end of file +}//end of forum active check \ No newline at end of file diff --git a/mod/groups/views/default/object/groupforumtopic.php b/mod/groups/views/default/object/groupforumtopic.php index 8d5d655c0..e32f83cd4 100644 --- a/mod/groups/views/default/object/groupforumtopic.php +++ b/mod/groups/views/default/object/groupforumtopic.php @@ -1,71 +1,71 @@ - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - */ +/** + * Elgg Groups latest discussion listing + * + * @package ElggGroups + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 +*/ - //get the required variables - $title = htmlentities($vars['entity']->title, ENT_QUOTES, 'UTF-8'); - //$description = get_entity($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); - $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; - } +//get the required variables +$title = htmlentities($vars['entity']->title, ENT_QUOTES, 'UTF-8'); +//$description = get_entity($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); +$counter = $vars['entity']->countAnnotations("generic_comment"); +$last_post = $vars['entity']->getAnnotations("generic_comment", 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); +$u = get_user($last_user); - //select the correct output depending on where you are - if(get_context() == "search"){ - - $info = "" . sprintf(elgg_echo('group:created'), $forum_created, $counter) . "
";
- if (($last_time) && ($u)) $info.= sprintf(elgg_echo('groups:lastupdated'), friendly_time($last_time), " getURL() . "\">" . $u->name . "");
- $info .= '
" . elgg_echo('Topic') . ": guid}&group_guid={$group->guid}\">{$title}
"; - if ($group instanceof ElggGroup) { - $info .= "" . elgg_echo('group') . ": getURL()}\">".htmlentities($group->name, ENT_QUOTES, 'UTF-8') ."
"; - } - +//select the correct output depending on where you are +if(get_context() == "search"){ + var_export($counter); + if($counter == 1){ + $info = "" . sprintf(elgg_echo('groups:forum:created:single'), $forum_created, $counter) . "
";
}else{
+ $info = "
" . sprintf(elgg_echo('groups:forum:created'), $forum_created, $counter) . "
";
+ }
+ if (($last_time) && ($u)) $info.= sprintf(elgg_echo('groups:lastupdated'), friendly_time($last_time), " getURL() . "\">" . $u->name . "");
+ $info .= '
" . elgg_echo('Topic') . ": guid}&group_guid={$group->guid}\">{$title}
"; + if ($group instanceof ElggGroup) { + $info .= "" . elgg_echo('group') . ": getURL()}\">".htmlentities($group->name, ENT_QUOTES, 'UTF-8') ."
"; + } - $info = "" . sprintf(elgg_echo('group:created'), $forum_created, $counter) . "
"; - $info .= "" . elgg_echo('groups:started') . " " . $topic_owner->name . ": guid}&group_guid={$group->guid}\">{$title}
"; +}else{ + if($counter == 1){ + $info = "" . sprintf(elgg_echo('groups:forum:created:single'), $forum_created, $counter) . "
"; + }else{ + $info = "" . sprintf(elgg_echo('groups:forum:created'), $forum_created, $counter) . "
"; + } + $info .= "" . elgg_echo('groups:started') . " " . $topic_owner->name . ": guid}&group_guid={$group->guid}\">{$title}
"; - if (groups_can_edit_discussion($vars['entity'], page_owner_entity()->owner_guid)) { - // display the delete link to those allowed to delete - $info .= ""; + if (groups_can_edit_discussion($vars['entity'], page_owner_entity()->owner_guid)) { + // display the delete link to those allowed to delete + $info .= ""; - } + } - if (($last_time) && ($u)) { - $info.= "" . elgg_echo('groups:updated') . " " . friendly_time($last_time) . " by getURL() . "\">" . $u->name . "
"; - } - //get the user avatar - $icon = elgg_view("profile/icon",array('entity' => $topic_owner, 'size' => 'tiny')); + if (($last_time) && ($u)) { + $info.= "" . elgg_echo('groups:updated') . " " . friendly_time($last_time) . " by getURL() . "\">" . $u->name . "
"; } + //get the user avatar + $icon = elgg_view("profile/icon",array('entity' => $topic_owner, 'size' => 'tiny')); +} - //display - echo elgg_view_listing($icon, $info); - -?> \ No newline at end of file +//display +echo elgg_view_listing($icon, $info); \ No newline at end of file diff --git a/mod/groups/views/default/river/forum/topic/create.php b/mod/groups/views/default/river/forum/topic/create.php index 0b65f79b6..fb2a3556d 100644 --- a/mod/groups/views/default/river/forum/topic/create.php +++ b/mod/groups/views/default/river/forum/topic/create.php @@ -7,19 +7,20 @@ $group_guid = $object->container_guid; $group = get_entity($group_guid); $url = $vars['url'] . "mod/groups/topicposts.php?topic=" . $forumtopic . "&group_guid=" . $group_guid; - $comment = $object->getAnnotations("group_topic_post", 1, 0, "asc"); - foreach($comment as $c){ - $contents = $c->value; - } + //$comment = $object->getAnnotations("group_topic_post", 1, 0, "asc"); + //foreach($comment as $c){ + $contents = $object->description; + //} $contents = strip_tags($contents);//this is so we don't get large images etc in the activity river $url_user = "getURL()}\">{$performed_by->name}"; $string = sprintf(elgg_echo("groupforum:river:postedtopic"),$url_user) . ": "; $string .= "" . $object->title . ""; - if(get_context() != 'groups'){ - $string .= " " . elgg_echo('groups:ingroup') . " getURL()}\">" . $group->name . ""; + $string .= " " . elgg_echo('groups:ingroup') . " getURL()}\">" . $group->name . ""; + $string .= " ". friendly_time($object->time_created) .""; + if (isloggedin() && $object->status != "closed") { + $string .= '' . elgg_echo('generic_comments:text') . ''; + $string .= elgg_view('likes/forms/link', array('entity' => $object)); } - $string .= " ". friendly_time($object->time_created) ." Visit discussion"; - $string .= elgg_view('likes/forms/link', array('entity' => $object)); $string .= "