diff options
author | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-01-07 02:50:45 +0000 |
---|---|---|
committer | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-01-07 02:50:45 +0000 |
commit | 1d527097e116d130fdeb58871f040e6a30449ef2 (patch) | |
tree | 4a2430c1a225671972719e9ab0cea720b32e2385 | |
parent | 3a917aa158c1ef0945c8b4892eaa8f87e5fa1a1e (diff) | |
download | elgg-1d527097e116d130fdeb58871f040e6a30449ef2.tar.gz elgg-1d527097e116d130fdeb58871f040e6a30449ef2.tar.bz2 |
cleaned up the group profile
git-svn-id: http://code.elgg.org/elgg/trunk@7853 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r-- | mod/groups/groupprofile.php | 97 | ||||
-rw-r--r-- | mod/groups/views/default/groups/closedmembership.php | 16 | ||||
-rw-r--r-- | mod/groups/views/default/groups/forum_latest.php | 34 | ||||
-rw-r--r-- | mod/groups/views/default/groups/groupprofile.php | 135 | ||||
-rw-r--r-- | mod/groups/views/default/groups/profile/activity_widget.php (renamed from mod/groups/views/default/groups/activity_latest.php) | 0 | ||||
-rw-r--r-- | mod/groups/views/default/groups/profile/buttons.php | 53 | ||||
-rw-r--r-- | mod/groups/views/default/groups/profile/closed_membership.php | 16 | ||||
-rw-r--r-- | mod/groups/views/default/groups/profile/forum_widget.php | 51 | ||||
-rw-r--r-- | mod/groups/views/default/groups/profile/profile_block.php | 82 | ||||
-rw-r--r-- | mod/groups/views/default/groups/profile/widgets.php (renamed from mod/groups/views/default/groups/profileitems.php) | 12 | ||||
-rw-r--r-- | mod/groups/views/default/groups/sidebar/members.php (renamed from mod/groups/views/default/groups/members.php) | 0 |
11 files changed, 250 insertions, 246 deletions
diff --git a/mod/groups/groupprofile.php b/mod/groups/groupprofile.php index 43473e261..1c35163ad 100644 --- a/mod/groups/groupprofile.php +++ b/mod/groups/groupprofile.php @@ -1,56 +1,43 @@ <?php - /** - * Full group profile - * - * @package ElggGroups - */ - - $group_guid = get_input('group_guid'); - elgg_set_context('groups'); - - global $autofeed; - $autofeed = true; - - $group = get_entity($group_guid); - if ($group) { - set_page_owner($group_guid); - - $title = $group->name; - - // Hide some items from closed groups when the user is not logged in. - $view_all = true; - - $groupaccess = group_gatekeeper(false); - if (!$groupaccess) - $view_all = false; - - $area2 .= elgg_view_entity($group, TRUE); - - if ($view_all) { - //group profile 'items' - these are not real widgets, just contents to display - $area2 .= elgg_view('groups/profileitems',array('entity' => $group)); - - //group members - $area3 = elgg_view('groups/members',array('entity' => $group)); - } else { - $area2 .= elgg_view('groups/closedmembership', array('entity' => $group, 'user' => get_loggedin_user(), 'full' => true)); - } - - $content = $area1 . $area2; - $params = array( - 'content' => $content, - 'sidebar' => $area3 - ); - $body = elgg_view_layout('one_column_with_sidebar', $params); - } else { - $title = elgg_echo('groups:notfound'); - - $area2 = elgg_view_title($title); - $area2 .= "<p class='margin-top'>".elgg_echo('groups:notfound:details')."</p>"; - - $body = elgg_view_layout('one_column_with_sidebar', array('content' => $area2)); - } - - // Finally draw the page - echo elgg_view_page($title, $body); -?>
\ No newline at end of file +/** + * Profile of a group + * + * @package ElggGroups + */ + +$guid = get_input('group_guid'); +elgg_set_context('groups'); + +elgg_set_page_owner_guid($guid); + +// can the user see all content +$group_access = group_gatekeeper(false); + +// turn this into a core function +global $autofeed; +$autofeed = true; + +$group = get_entity($guid); + +elgg_push_breadcrumb(elgg_echo('groups:all'), elgg_get_site_url() . "pg/groups/world"); +elgg_push_breadcrumb($group->name); + +$sidebar = ''; +$content = elgg_view('groups/profile/profile_block', array('entity' => $group)); +if (group_gatekeeper(false)) { + $content .= elgg_view('groups/profile/widgets', array('entity' => $group)); + $sidebar = elgg_view('groups/sidebar/members', array('entity' => $group)); +} else { + $content .= elgg_view('groups/profile/closed_membership'); +} + +$params = array( + 'content' => $content, + 'sidebar' => $sidebar, + 'title' => $group->name, + 'buttons' => elgg_view('groups/profile/buttons', array('entity' => $group)), + 'filter' => '', +); +$body = elgg_view_layout('content', $params); + +echo elgg_view_page($title, $body); diff --git a/mod/groups/views/default/groups/closedmembership.php b/mod/groups/views/default/groups/closedmembership.php deleted file mode 100644 index d5abe1e09..000000000 --- a/mod/groups/views/default/groups/closedmembership.php +++ /dev/null @@ -1,16 +0,0 @@ -<?php - /** - * Elgg groups plugin full profile view (for a closed group you haven't joined). - * - * @package ElggGroups - */ - -?> -<p class="margin-top"> -<?php -echo elgg_echo('groups:closedgroup'); -if (isloggedin()) { - echo ' ' . elgg_echo('groups:closedgroup:request'); -} -?> -</p> diff --git a/mod/groups/views/default/groups/forum_latest.php b/mod/groups/views/default/groups/forum_latest.php deleted file mode 100644 index 9b6f292e0..000000000 --- a/mod/groups/views/default/groups/forum_latest.php +++ /dev/null @@ -1,34 +0,0 @@ -<?php - -// Latest forum discussion for the group home page - -//check to make sure this group forum has been activated -if($vars['entity']->forum_enable != 'no'){ -?> -<span class="group_widget_link"><a href="<?php echo elgg_get_site_url() . "pg/groups/forum/" . elgg_get_page_owner_guid(); ?>"><?php echo elgg_echo('link:view:all')?></a></span> -<h3><?php echo elgg_echo('groups:latestdiscussion'); ?></h3> -<?php - - $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("generic_comment"); - - echo "<div class='entity-listing clearfix'>"; - echo "<div class='entity-listing-icon'>" . elgg_view('profile/icon',array('entity' => $f->getOwnerEntity(), 'size' => 'tiny')) . "</div>"; - echo "<div class='entity-listing-info'><p class='entity-title'><a href=\"".elgg_get_site_url()."mod/groups/topicposts.php?topic={$f->guid}&group_guid={$vars['entity']->guid}\">" . $f->title . "</a></p>"; - echo "<p class='entity-subtext'>".elgg_echo('comments').": " . $count_annotations . "</p></div>"; - echo "</div>"; - } - } else { - if(elgg_get_page_owner()->isMember(get_loggedin_user())){ - $create_discussion = elgg_get_site_url() . "mod/groups/addtopic.php?group_guid=" . elgg_get_page_owner_guid(); - echo "<p class='margin-top'><a href=\"{$create_discussion}\">".elgg_echo("groups:addtopic")."</a></p>"; - }else{ - echo "<p class='margin-top'>". elgg_echo("grouptopic:notcreated") . "</p>"; - } - } - -}//end of forum active check
\ No newline at end of file diff --git a/mod/groups/views/default/groups/groupprofile.php b/mod/groups/views/default/groups/groupprofile.php deleted file mode 100644 index a21985bea..000000000 --- a/mod/groups/views/default/groups/groupprofile.php +++ /dev/null @@ -1,135 +0,0 @@ -<?php -/** - * Elgg groups plugin full profile view. - * - * @package ElggGroups - */ - - -$user = get_loggedin_user(); -elgg_push_breadcrumb(elgg_echo('groups:all'), elgg_get_site_url()."pg/groups/world"); - -// action or page url => label -$actions = array(); - -if ($vars['entity']->canEdit()) { - // breadcrumb trail - elgg_push_breadcrumb(elgg_echo('groups:yours'), elgg_get_site_url()."pg/groups/member/{$user->username}"); - - // edit and invite - $url = elgg_get_site_url() . "mod/groups/edit.php?group_guid={$vars['entity']->getGUID()}"; - $actions[$url] = elgg_echo('groups:edit'); - $url = elgg_get_site_url() . "mod/groups/invite.php?group_guid={$vars['entity']->getGUID()}"; - $actions[$url] = elgg_echo('groups:invite'); -} - -if ($vars['entity']->isMember($user)) { - // breadcrumb trail - elgg_push_breadcrumb(elgg_echo('groups:yours'), elgg_get_site_url()."pg/groups/member/{$user->username}"); - - // leave - $url = elgg_get_site_url() . "action/groups/leave?group_guid={$vars['entity']->getGUID()}"; - $url = elgg_add_action_tokens_to_url($url); - $actions[$url] = elgg_echo('groups:leave'); -} else { - // join - // admins can always join. - if ($vars['entity']->isPublicMembership() || $vars['entity']->canEdit()) { - $url = elgg_get_site_url() . "action/groups/join?group_guid={$vars['entity']->getGUID()}"; - $url = elgg_add_action_tokens_to_url($url); - $actions[$url] = elgg_echo('groups:join'); - } else { - // request membership - $url = elgg_get_site_url() . "action/groups/joinrequest?group_guid={$vars['entity']->getGUID()}"; - $url = elgg_add_action_tokens_to_url($url); - $actions[$url] = elgg_echo('groups:joinrequest'); - } -} - - -// build action buttons -$action_buttons = ''; -if (!empty($actions)) { - $action_buttons = '<div class="content-header-options">'; - foreach ($actions as $url => $action) { - $action_buttons .= "<a class=\"elgg-action-button\" href=\"$url\">$action</a>"; - } - $action_buttons .= '</div>'; -} - -// display breadcrumb -elgg_push_breadcrumb($vars['entity']->name); -echo elgg_view('navigation/breadcrumbs'); - -// build and display header -echo <<<__HTML -<div id="content-header" class="clearfix"> - <div class="content-header-title"> - <h2>{$vars['entity']->name}</h2> - </div> - $action_buttons -</div> -__HTML; - -?> -<div class="group_profile clearfix"> - <div class="group_profile_column icon"> - <div class="group_profile_icon"> - <?php - echo elgg_view( - "groups/icon", array( - 'entity' => $vars['entity'], - 'size' => 'large', - )); - ?> - </div> - - <div class="group_stats"> - <?php - echo "<p><b>" . elgg_echo("groups:owner") . ": </b><a href=\"" . get_user($vars['entity']->owner_guid)->getURL() . "\">" . get_user($vars['entity']->owner_guid)->name . "</a></p>"; - ?> - <p><?php - $count = $vars['entity']->getMembers(0, 0, TRUE); - echo elgg_echo('groups:members') . ": " . $count; - - ?></p> - </div> - </div> - - <div class="group_profile_column info"> - <?php - if ($vars['full'] == true) { - if (is_array($vars['config']->group) && sizeof($vars['config']->group) > 0){ - - foreach($vars['config']->group as $shortname => $valtype) { - if ($shortname != "name") { - $value = $vars['entity']->$shortname; - - if (!empty($value)) { - //This function controls the alternating class - $even_odd = ( 'odd' != $even_odd ) ? 'odd' : 'even'; - } - - echo "<p class=\"{$even_odd}\">"; - echo "<b>"; - echo elgg_echo("groups:{$shortname}"); - echo ": </b>"; - - $options = array( - 'value' => $vars['entity']->$shortname - ); - - if ($valtype == 'tags') { - $options['tag_names'] = $shortname; - } - - echo elgg_view("output/{$valtype}", $options); - - echo "</p>"; - } - } - } - } - ?> - </div> -</div> diff --git a/mod/groups/views/default/groups/activity_latest.php b/mod/groups/views/default/groups/profile/activity_widget.php index 3ac385553..3ac385553 100644 --- a/mod/groups/views/default/groups/activity_latest.php +++ b/mod/groups/views/default/groups/profile/activity_widget.php diff --git a/mod/groups/views/default/groups/profile/buttons.php b/mod/groups/views/default/groups/profile/buttons.php new file mode 100644 index 000000000..68cd2591a --- /dev/null +++ b/mod/groups/views/default/groups/profile/buttons.php @@ -0,0 +1,53 @@ +<?php +/** + * Content header action buttons + * + * @uses $vars['entity'] + */ + +if (!isloggedin()) { + return true; +} + + +$actions = array(); + +// group owners +if ($vars['entity']->canEdit()) { + // edit and invite + $url = elgg_get_site_url() . "mod/groups/edit.php?group_guid={$vars['entity']->getGUID()}"; + $actions[$url] = elgg_echo('groups:edit'); + $url = elgg_get_site_url() . "mod/groups/invite.php?group_guid={$vars['entity']->getGUID()}"; + $actions[$url] = elgg_echo('groups:invite'); +} + +// group members +if ($vars['entity']->isMember($user)) { + // leave + $url = elgg_get_site_url() . "action/groups/leave?group_guid={$vars['entity']->getGUID()}"; + $url = elgg_add_action_tokens_to_url($url); + $actions[$url] = elgg_echo('groups:leave'); +} else { + // join - admins can always join. + if ($vars['entity']->isPublicMembership() || $vars['entity']->canEdit()) { + $url = elgg_get_site_url() . "action/groups/join?group_guid={$vars['entity']->getGUID()}"; + $url = elgg_add_action_tokens_to_url($url); + $actions[$url] = elgg_echo('groups:join'); + } else { + // request membership + $url = elgg_get_site_url() . "action/groups/joinrequest?group_guid={$vars['entity']->getGUID()}"; + $url = elgg_add_action_tokens_to_url($url); + $actions[$url] = elgg_echo('groups:joinrequest'); + } +} + +// display action buttons +if ($actions) { + foreach ($actions as $url => $action) { + echo elgg_view('output/url', array( + 'text' => $action, + 'href' => $url, + 'class' => 'elgg-action-button', + )); + } +} diff --git a/mod/groups/views/default/groups/profile/closed_membership.php b/mod/groups/views/default/groups/profile/closed_membership.php new file mode 100644 index 000000000..f80103711 --- /dev/null +++ b/mod/groups/views/default/groups/profile/closed_membership.php @@ -0,0 +1,16 @@ +<?php +/** + * Display message about closed membership + * + * @package ElggGroups + */ + +?> +<p class="mtm"> +<?php +echo elgg_echo('groups:closedgroup'); +if (isloggedin()) { + echo ' ' . elgg_echo('groups:closedgroup:request'); +} +?> +</p> diff --git a/mod/groups/views/default/groups/profile/forum_widget.php b/mod/groups/views/default/groups/profile/forum_widget.php new file mode 100644 index 000000000..265926fb5 --- /dev/null +++ b/mod/groups/views/default/groups/profile/forum_widget.php @@ -0,0 +1,51 @@ +<?php +/** + * Latest forum posts + * + * @uses $vars['entity'] + */ + +if ($vars['entity']->forum_enable == 'no') { + return true; +} + +$group = $vars['entity']; + + +$all_link = elgg_view('output/url', array( + 'href' => "pg/groups/forum/$group->guid", + 'text' => elgg_echo('link:view:all'), +)); + +$header = "<span class=\"group-widget-viewall\">$all_link</span>"; +$header .= '<h3>' . elgg_echo('groups:latestdiscussion') . '</h3>'; + + +elgg_push_context('widgets'); +$options = array( + 'type' => 'object', + 'subtype' => 'groupforumtopic', + 'container_guid' => $group->getGUID(), + 'limit' => 6, + 'full_view' => false, + 'pagination' => false, +); +$content = elgg_list_entities($options); +elgg_pop_context(); + +if (!$content) { + $content = '<p>' . elgg_echo('grouptopic:notcreated') . '</p>'; +} + +$new_link = elgg_view('output/url', array( + 'href' => "mod/groups/addtopic.php?group_guid=" . $group->getGUID(), + 'text' => elgg_echo('groups:addtopic'), +)); +$content .= "<span class='elgg-widget-more'>$new_link</span>"; + + +$params = array( + 'header' => $header, + 'body' => $content, +); +echo elgg_view('layout/objects/module', $params); diff --git a/mod/groups/views/default/groups/profile/profile_block.php b/mod/groups/views/default/groups/profile/profile_block.php new file mode 100644 index 000000000..98595ad07 --- /dev/null +++ b/mod/groups/views/default/groups/profile/profile_block.php @@ -0,0 +1,82 @@ +<?php +/** + * Group profile + * + * Icon and profile fields + * + * @uses $vars['group'] + */ + +if (!isset($vars['entity']) || !$vars['entity']) { + echo elgg_echo('groups:notfound'); + return true; +} + +$group = $vars['entity']; +$owner = $group->getOwnerEntity(); + +$profile_fields = elgg_get_config('group'); + +?> +<div class="group_profile clearfix"> + <div class="group_profile_column icon"> + <div class="group_profile_icon"> + <?php + echo elgg_view('groups/icon', array( + 'entity' => $group, + 'size' => 'large', + )); + ?> + </div> + <div class="group_stats"> + <p> + <b><?php echo elgg_echo("groups:owner"); ?>: </b> + <?php + echo elgg_view('output/url', array( + 'text' => $owner->name, + 'value' => $owner->getURL(), + )); + ?> + </p> + <p> + <?php + echo elgg_echo('groups:members') . ": " . $group->getMembers(0, 0, TRUE); + ?> + </p> + </div> + </div> + + <div class="group_profile_column info"> +<?php +if (is_array($profile_fields) && count($profile_fields) > 0) { + + $even_odd = 'odd'; + foreach ($profile_fields as $key => $valtype) { + // do not show the name + if ($key == 'name') { + continue; + } + + $value = $group->$key; + if (empty($value)) { + continue; + } + + $options = array('value' => $group->$key); + if ($valtype == 'tags') { + $options['tag_names'] = $key; + } + + echo "<p class=\"{$even_odd}\">"; + echo "<b>"; + echo elgg_echo("groups:$key"); + echo ": </b>"; + echo elgg_view("output/$valtype", $options); + echo "</p>"; + + $even_odd = ($even_odd == 'even') ? 'odd' : 'even'; + } +} +?> + </div> +</div> diff --git a/mod/groups/views/default/groups/profileitems.php b/mod/groups/views/default/groups/profile/widgets.php index 6f5fa32ce..af558c90d 100644 --- a/mod/groups/views/default/groups/profileitems.php +++ b/mod/groups/views/default/groups/profile/widgets.php @@ -1,6 +1,6 @@ <?php /** -* Elgg groups - group homepage (profile) - provide an area for tools to extend with their latest content. +* Profile widgets/tools * * @package ElggGroups */ @@ -10,16 +10,16 @@ echo "<div id='group_tools_latest' class='clearfix'>"; // activity latest echo "<div class='group_tool_widget activity clearfix'>"; - echo elgg_view("groups/activity_latest",array('entity' => $vars['entity'])); + echo elgg_view("groups/profile/activity_widget", array('entity' => $vars['entity'])); echo "</div>"; // forum latest - echo "<div class='group_tool_widget forum clearfix'>"; - echo elgg_view("groups/forum_latest",array('entity' => $vars['entity'])); - echo "</div>"; + //echo "<div class='group_tool_widget forum clearfix'>"; + echo elgg_view("groups/profile/forum_widget", array('entity' => $vars['entity'])); + //echo "</div>"; // enable tools to extend this area - echo elgg_view("groups/tool_latest",array('entity' => $vars['entity'])); + echo elgg_view("groups/tool_latest", array('entity' => $vars['entity'])); echo "</div>"; ?> diff --git a/mod/groups/views/default/groups/members.php b/mod/groups/views/default/groups/sidebar/members.php index b4e9199af..b4e9199af 100644 --- a/mod/groups/views/default/groups/members.php +++ b/mod/groups/views/default/groups/sidebar/members.php |