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 /mod/groups/views/default/groups/profile | |
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
Diffstat (limited to 'mod/groups/views/default/groups/profile')
6 files changed, 267 insertions, 0 deletions
diff --git a/mod/groups/views/default/groups/profile/activity_widget.php b/mod/groups/views/default/groups/profile/activity_widget.php new file mode 100644 index 000000000..3ac385553 --- /dev/null +++ b/mod/groups/views/default/groups/profile/activity_widget.php @@ -0,0 +1,35 @@ +<?php +/** + * Groups latest activity + * + * @package Groups + */ +?> +<span class="group_widget_link"><a href="<?php echo elgg_get_site_url() . "pg/groups/activity/" . elgg_get_page_owner_guid(); ?>"><?php echo elgg_echo('link:view:all')?></a></span> +<h3><?php echo elgg_echo("activity"); ?></h3> +<?php + $owner = elgg_get_page_owner(); + $group_guid = $owner->guid; + $limit = 5; + + $offset = (int) get_input('offset', 0); + + // Sanitise variables -- future proof in case they get sourced elsewhere + $limit = (int) $limit; + $offset = (int) $offset; + $group_guid = (int) $group_guid; + + $sql = "SELECT {$CONFIG->dbprefix}river.id, {$CONFIG->dbprefix}river.type, {$CONFIG->dbprefix}river.subtype, {$CONFIG->dbprefix}river.action_type, {$CONFIG->dbprefix}river.access_id, {$CONFIG->dbprefix}river.view, {$CONFIG->dbprefix}river.subject_guid, {$CONFIG->dbprefix}river.object_guid, {$CONFIG->dbprefix}river.posted FROM {$CONFIG->dbprefix}river INNER JOIN {$CONFIG->dbprefix}entities AS entities1 ON {$CONFIG->dbprefix}river.object_guid = entities1.guid INNER JOIN {$CONFIG->dbprefix}entities AS entities2 ON entities1.container_guid = entities2.guid WHERE entities2.guid = $group_guid OR {$CONFIG->dbprefix}river.object_guid = $group_guid ORDER BY posted DESC limit {$offset},{$limit}"; + + $items = get_data($sql); + + if (count($items) > 0) { + $river_items = elgg_view('river/item/list',array( + 'limit' => $limit, + 'offset' => $offset, + 'items' => $items + )); + } + echo $river_items; + +?> 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/profile/widgets.php b/mod/groups/views/default/groups/profile/widgets.php new file mode 100644 index 000000000..af558c90d --- /dev/null +++ b/mod/groups/views/default/groups/profile/widgets.php @@ -0,0 +1,30 @@ +<?php +/** +* Profile widgets/tools +* +* @package ElggGroups +*/ + +// tools widget area +echo "<div id='group_tools_latest' class='clearfix'>"; + + // activity latest + echo "<div class='group_tool_widget activity clearfix'>"; + 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/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 "</div>"; +?> +<script type="text/javascript"> +$(document).ready(function () { // subclass every other group tool widget + $('#group_tools_latest').find('.group_tool_widget:odd').addClass('odd'); +}); +</script> |