]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
cleanup of the groups plugin views
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>
Sat, 8 Jan 2011 14:37:46 +0000 (14:37 +0000)
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>
Sat, 8 Jan 2011 14:37:46 +0000 (14:37 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@7863 36083f99-b078-4883-b0ff-0f9b5a30f544

13 files changed:
mod/groups/all.php
mod/groups/languages/en.php
mod/groups/views/default/group/default.php
mod/groups/views/default/groups/css.php
mod/groups/views/default/groups/grouplisting.php [deleted file]
mod/groups/views/default/groups/sidebar/featured.php [moved from mod/groups/views/default/groups/featured.php with 58% similarity]
mod/groups/views/default/groups/sidebar/find.php [moved from mod/groups/views/default/groups/find.php with 100% similarity]
mod/groups/views/default/icon/group/default/large.php
mod/groups/views/default/icon/group/default/medium.php
mod/groups/views/default/icon/group/default/small.php
mod/groups/views/default/icon/group/default/tiny.php
mod/groups/views/default/object/groupforumtopic.php
mod/groups/views/default/settings/groups/edit.php

index 909e02894355637558b16c56f19b683008c68397..51030adc901229964b8ec519b0e974bcb26b1700 100644 (file)
@@ -47,11 +47,10 @@ switch ($filter) {
 $group_count = elgg_get_entities(array('types' => 'group', 'limit' => 10, 'count' => TRUE));
 
 //find groups
-$area2 .= elgg_view("groups/find");
+$area2 .= elgg_view("groups/sidebar/find");
 
 //featured groups
-$featured_groups = elgg_get_entities_from_metadata(array('metadata_name' => 'featured_group', 'metadata_value' => 'yes', 'types' => 'group', 'limit' => 10));
-$area2 .= elgg_view("groups/featured", array("featured" => $featured_groups));
+$area2 .= elgg_view("groups/sidebar/featured");
 
 elgg_set_context($context);
 
index 01dd8a2317a422baaf9d3bc4a59e35f6c1511065..f28bc08468c699fcd5509dede0f11b4dd469ad48 100644 (file)
@@ -149,9 +149,9 @@ $english = array(
        'groups:userinvited' => 'User has been invited.',
        'groups:usernotinvited' => 'User could not be invited.',
        'groups:useralreadyinvited' => 'User has already been invited',
-       'groups:updated' => "Last comment",
        'groups:invite:subject' => "%s you have been invited to join %s!",
-       'groups:started' => "Started by",
+       'groups:updated' => "Last comment by %s %s",
+       'groups:started' => "Started by %s",
        'groups:joinrequest:remove:check' => 'Are you sure you want to remove this join request?',
        'groups:invite:remove:check' => 'Are you sure you want to remove this invite?',
        'groups:invite:body' => "Hi %s,
index bc3710888135900dce4e6a3524ae55c020a62d6d..568867da998c8976769c75f1bb9d922960a510cc 100644 (file)
@@ -54,7 +54,7 @@ if (elgg_in_context('owner_block') || elgg_in_context('widgets')) {
 
 
 if ($vars['full']) {
-       echo elgg_view("groups/groupprofile",$vars);
+       echo elgg_view("groups/profile/profile_block", $vars);
 } else {
        // brief view
 
index be4d152f83e77430594f549b8c4320ae2087a886..5a7366fe3449c63059f8284ff418e1cc72e14160 100644 (file)
        font-size: 85%;
 }
 
+.groups-latest-comment {
+       float: right;
+}
+
+
 /* group listings */
 .group_count {
        float:right;
diff --git a/mod/groups/views/default/groups/grouplisting.php b/mod/groups/views/default/groups/grouplisting.php
deleted file mode 100644 (file)
index e7caa5f..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-<?php
-/**
- * Elgg user display (small)
- *
- * @package ElggGroups
- *
- * @uses $vars['entity'] The user entity
- */
-
-$icon = elgg_view(
-               "groups/icon", array(
-               'entity' => $vars['entity'],
-               'size' => 'tiny',
-));
-
-//get the membership type
-$membership = $vars['entity']->membership;
-if($membership == ACCESS_PUBLIC) {
-       $mem = elgg_echo("groups:open");
-} else {
-       $mem = elgg_echo("groups:closed");
-}
-
-$info .= "<p class='entity-subtext groups'>" . $mem . " / <b>" . get_group_members($vars['entity']->guid, 10, 0, 0, true) ."</b> " . elgg_echo("groups:member");
-
-//for admins only - display the feature or unfeature option
-if(isadminloggedin()) {
-       if($vars['entity']->featured_group == "yes"){
-               $url = elgg_add_action_tokens_to_url(elgg_get_site_url() . "action/groups/featured?group_guid=" . $vars['entity']->guid . "&action_type=unfeature");
-               $wording = elgg_echo("groups:makeunfeatured");
-       }else{
-               $url = elgg_add_action_tokens_to_url(elgg_get_site_url() . "action/groups/featured?group_guid=" . $vars['entity']->guid . "&action_type=feature");
-               $wording = elgg_echo("groups:makefeatured");
-       }
-       // display 'make featured' option
-       $info .= "<br /><a href=\"{$url}\">{$wording}</a>";
-}
-
-$info .= "</p>";
-$info .= "<p class='entity-title'><a href=\"" . $vars['entity']->getUrl() . "\">" . $vars['entity']->name . "</a></p>";
-$info .= "<p class='entity-subtext'>" . $vars['entity']->briefdescription . "</p>";
-
-echo elgg_view_image_block($icon, $info);
similarity index 58%
rename from mod/groups/views/default/groups/featured.php
rename to mod/groups/views/default/groups/sidebar/featured.php
index ef2be588545973bd6fd68a31b80c2fe40f77d485..47cb7f2abd350ee5475714a41a6a7fbff85d7d3f 100644 (file)
@@ -2,16 +2,21 @@
 /**
  * Featured groups
  *
- * @uses $vars['featured']
- *
  * @package ElggGroups
  */
-        
-if ($vars['featured']) {
+
+$featured_groups = elgg_get_entities_from_metadata(array(
+       'metadata_name' => 'featured_group',
+       'metadata_value' => 'yes',
+       'types' => 'group',
+       'limit' => 10,
+));
+
+if ($featured_groups) {
 
        elgg_push_context('widgets');
        $body = '';
-       foreach ($vars['featured'] as $group) {
+       foreach ($featured_groups as $group) {
                $body .= elgg_view_entity($group, false);
        }
        elgg_pop_context();
index e5e30ac3e54d1519d73e6a7bdac956325c5de26a..4bad6255abba44ae82b8fcee4fab5f3f4483de0e 100644 (file)
@@ -1,3 +1,5 @@
 <?php
-       echo elgg_get_site_url() . "mod/groups/graphics/defaultlarge.gif";
-?>
\ No newline at end of file
+/**
+ * Large default group icon
+ */
+echo elgg_get_site_url() . "mod/groups/graphics/defaultlarge.gif";
index f7bd9376df01cac84cc645849172cdfafb95ac7f..769357286e40e9e740fe6a89b3bb2ba02af65a34 100644 (file)
@@ -1,3 +1,5 @@
 <?php
-       echo elgg_get_site_url() . "mod/groups/graphics/defaultmedium.gif";
-?>
\ No newline at end of file
+/**
+ * Medium default group icon
+ */
+echo elgg_get_site_url() . "mod/groups/graphics/defaultmedium.gif";
index 2a0ef7d9360de8a8792fad83de283fa478cb43ec..0ff91f4c8e72d42ac5be307c448799cf9e6009bc 100644 (file)
@@ -1,3 +1,5 @@
 <?php
-       echo elgg_get_site_url() . "mod/groups/graphics/defaultsmall.gif";
-?>
\ No newline at end of file
+/**
+ * Small default group icon
+ */
+echo elgg_get_site_url() . "mod/groups/graphics/defaultsmall.gif";
index 2920da6b6b605e384b9c32d4d566e4b0cd1045e7..c16fe4a24b4434a3a120cae7a364bb2b291048fa 100644 (file)
@@ -1,3 +1,5 @@
 <?php
-       echo elgg_get_site_url() . "mod/groups/graphics/defaulttiny.gif";
-?>
\ No newline at end of file
+/**
+ * Tiny default group icon
+ */
+echo elgg_get_site_url() . "mod/groups/graphics/defaulttiny.gif";
index 551e256db91618c360002f880b1e937748fcadb3..e569bff77b0491321bffbc9210cb04d2abdb103f 100644 (file)
@@ -1,81 +1,71 @@
 <?php
 /**
- * Elgg Groups latest discussion listing
+ * Forum topic entity view
  *
  * @package ElggGroups
 */
 
-//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 = elgg_view_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;
-       }
+//$full = elgg_get_array_value('full', $vars, FALSE);
+$topic = elgg_get_array_value('entity', $vars, FALSE);
+
+if (!$topic) {
+       return true;
 }
 
-$u = get_user($last_user);
+$poster = $topic->getOwnerEntity();
+$group = $topic->getContainerEntity();
+$excerpt = elgg_get_excerpt($topic->description);
 
-//select the correct output depending on where you are
-if (elgg_get_context() == "search") {
-       var_export($counter);
-       if($counter == 1){
-               $info = "<p class='entity-subtext groups'>" . elgg_echo('groups:forum:created:single', array($forum_created, $counter)) .  "<br />";
-       }else{
-               $info = "<p class='entity-subtext groups'>" . elgg_echo('groups:forum:created', array($forum_created, $counter)) .  "<br />";
-       }
-       if (($last_time) && ($u)) $info.= elgg_echo('groups:lastupdated', array(elgg_view_friendly_time($last_time), " <a href=\"" . $u->getURL() . "\">" . $u->name . "</a>"));
-       $info .= '</p>';
-       //get the group avatar
-       $icon = elgg_view("profile/icon",array('entity' => $u, 'size' => 'tiny'));
-       //get the group and topic title
-       $info .= "<p class='entity-subtext'><b>" . elgg_echo('groups:topic') . ":</b> <a href=\"".elgg_get_site_url()."mod/groups/topicposts.php?topic={$vars['entity']->guid}&group_guid={$group->guid}\">{$title}</a></p>";
-       if ($group instanceof ElggGroup) {
-               $info .= "<p class='entity-title'><b>" . elgg_echo('group') . ":</b> <a href=\"{$group->getURL()}\">".htmlentities($group->name, ENT_QUOTES, 'UTF-8') ."</a></p>";
-       }
+$poster_icon = elgg_view('profile/icon', array('entity' => $poster, 'size' => 'tiny'));
+$poster_link = elgg_view('output/url', array(
+       'href' => $poster->getURL(),
+       'text' => $poster->name,
+));
+$poster_text = elgg_echo('groups:started', array($poster->name));
 
-} else {
-       if($counter == 1){
-               $info = "<p class='entity-subtext groups'>" . elgg_echo('groups:forum:created:single', array($forum_created, $counter)) . "</p>";
-       }else{
-               $info = "<p class='entity-subtext groups'>" . elgg_echo('groups:forum:created', array($forum_created, $counter)) . "</p>";
-       }
-       $info .= "<p class='entity-title'>" . elgg_echo('groups:started') . " " . $topic_owner->name . ": <a href=\"".elgg_get_site_url()."mod/groups/topicposts.php?topic={$vars['entity']->guid}&group_guid={$group->guid}\">{$title}</a></p>";
+$tags = elgg_view('output/tags', array('tags' => $topic->tags));
+$date = elgg_view_friendly_time($topic->time_created);
 
-       if (groups_can_edit_discussion($vars['entity'], elgg_get_page_owner()->owner_guid)) {
-                       // display the delete link to those allowed to delete
-                       $info .= "<div class='entity-metadata'>";
-                       $info .= '<span class="entity-edit">' . elgg_view("output/url", array(
-                                                                                                                                                       'href' => "mod/groups/edittopic.php?group={$vars['entity']->container_guid}&topic={$vars['entity']->guid}",
-                                                                                                                                                       'text' => elgg_echo('edit'),
-                                                                                                                                               ));
-                       $info .= '</span>';
+$comments_link = '';
+$comments_text = '';
+$num_comments = elgg_count_comments($topic);
+if ($num_comments != 0) {
+       $last_comment = $topic->getAnnotations("generic_comment", 1, 0, "desc");
+       $commenter = $last_comment[0]->getOwnerEntity();
+       $comment_time = elgg_view_friendly_time($last_comment[0]->time_created);
+       $comments_text = elgg_echo('groups:updated', array($commenter->name, $comment_time));
+       
+       $comments_link = elgg_view('output/url', array(
+               'href' => $topic->getURL() . '#topic-comments',
+               'text' => elgg_echo("comments") . " ($num_comments)",
+       ));
+}
 
-                       // display the delete link to those allowed to delete
-                       $info .= '<span class="delete-button">' . elgg_view("output/confirmlink", array(
-                                                                                                                                                       'href' => "action/groups/deletetopic?topic=" . $vars['entity']->guid . "&group=" . $vars['entity']->container_guid,
-                                                                                                                                                       'text' => elgg_echo('delete'),
-                                                                                                                                                       'confirm' => elgg_echo('deleteconfirm'),
-                                                                                                                                               ));
-                       $info .= "</span></div>";
+$metadata = elgg_view('layout/objects/list/metadata', array(
+       'entity' => $topic,
+       'handler' => 'forum',
+));
 
-}
+$subtitle = "$poster_text $date $comments_link <span class=\"groups-latest-comment\">$comments_text</span>";
 
-       if (($last_time) && ($u)) {
-               $commenter_link = "<a href\"{$u->getURL()}\">$u->name</a>";
-               $text = elgg_echo('groups:lastcomment', array(elgg_view_friendly_time($last_time), $commenter_link));
-               $info .= "<p class='entity-subtext'>$text</p>";
-       }
-       //get the user avatar
-       $icon = elgg_view("profile/icon",array('entity' => $topic_owner, 'size' => 'tiny'));
+// do not show the metadata and controls in widget view
+if (elgg_in_context('widgets')) {
+       $metadata = '';
 }
 
-//display
-echo elgg_view_listing($icon, $info);
\ No newline at end of file
+if ($full) {
+
+} else {
+       // brief view
+
+       $params = array(
+               'entity' => $topic,
+               'metadata' => $metadata,
+               'subtitle' => $subtitle,
+               'tags' => $tags,
+               'content' => $excerpt,
+       );
+       $list_body = elgg_view('layout/objects/list/body', $params);
+
+       echo elgg_view_image_block($poster_icon, $list_body);
+}
index 311e58dee8d7c06d928926a9640d1353a0035c81..25feed3aa55e17da3c82fc60f85632150de23a58 100644 (file)
@@ -1,18 +1,22 @@
 <?php
-       $hidden_groups = $vars['entity']->hidden_groups;
-       if (!$hidden_groups) $hidden_groups = 'no';
-?>     
-<p>
-       <?php echo elgg_echo('groups:allowhiddengroups'); ?>
-       
-       <?php
-               echo elgg_view('input/pulldown', array(
-                       'internalname' => 'params[hidden_groups]',
-                       'options_values' => array(
-                               'no' => elgg_echo('option:no'),
-                               'yes' => elgg_echo('option:yes')
-                       ),
-                       'value' => $hidden_groups
-               ));
-       ?>
-</p>
\ No newline at end of file
+/**
+ * Groups plugin settings
+ */
+
+// set default value
+if (!isset($vars['entity']->hidden_groups)) {
+       $vars['entity']->hidden_groups = 'no';
+}
+
+echo '<p>';
+echo elgg_echo('groups:allowhiddengroups');
+echo ' ';
+echo elgg_view('input/pulldown', array(
+       'internalname' => 'params[hidden_groups]',
+       'options_values' => array(
+               'no' => elgg_echo('option:no'),
+               'yes' => elgg_echo('option:yes')
+       ),
+       'value' => $vars['entity']->hidden_groups,
+));
+echo '</p>';