diff options
Diffstat (limited to 'mod/groups/views/default')
37 files changed, 1337 insertions, 0 deletions
diff --git a/mod/groups/views/default/annotation/group_topic_post.php b/mod/groups/views/default/annotation/group_topic_post.php new file mode 100644 index 000000000..f38d2a77a --- /dev/null +++ b/mod/groups/views/default/annotation/group_topic_post.php @@ -0,0 +1,19 @@ +<?php +/* + * Embeds an edit link for the annotation + */ + +$annotation = elgg_extract('annotation', $vars); + +echo elgg_view('annotation/default', $vars); + +if ($annotation->canEdit()) { + $form = elgg_view_form('discussion/reply/save', array(), array_merge(array( + 'entity' => get_entity($annotation->entity_guid), + 'annotation' => $annotation + ), $vars) + ); + + echo "<div class=\"hidden mbm\" id=\"edit-annotation-$annotation->id\">$form</div>"; +} + diff --git a/mod/groups/views/default/discussion/closed.php b/mod/groups/views/default/discussion/closed.php new file mode 100644 index 000000000..78bca108b --- /dev/null +++ b/mod/groups/views/default/discussion/closed.php @@ -0,0 +1,6 @@ +<?php +/** + * Topic is closed + */ +echo "<h3>" . elgg_echo("groups:topicisclosed") . "</h3>"; +echo "<p>" . elgg_echo("groups:topiccloseddesc") . "</p>";
\ No newline at end of file diff --git a/mod/groups/views/default/discussion/group_module.php b/mod/groups/views/default/discussion/group_module.php new file mode 100644 index 000000000..e0bcd55d6 --- /dev/null +++ b/mod/groups/views/default/discussion/group_module.php @@ -0,0 +1,48 @@ +<?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' => "discussion/owner/$group->guid", + 'text' => elgg_echo('link:view:all'), + 'is_trusted' => true, +)); + +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('discussion:none') . '</p>'; +} + +$new_link = elgg_view('output/url', array( + 'href' => "discussion/add/" . $group->getGUID(), + 'text' => elgg_echo('groups:addtopic'), + 'is_trusted' => true, +)); + +echo elgg_view('groups/profile/module', array( + 'title' => elgg_echo('discussion:group'), + 'content' => $content, + 'all_link' => $all_link, + 'add_link' => $new_link, +));
\ No newline at end of file diff --git a/mod/groups/views/default/discussion/replies.php b/mod/groups/views/default/discussion/replies.php new file mode 100644 index 000000000..2bfb6f0cd --- /dev/null +++ b/mod/groups/views/default/discussion/replies.php @@ -0,0 +1,28 @@ +<?php +/** + * List replies with optional add form + * + * @uses $vars['entity'] ElggEntity + * @uses $vars['show_add_form'] Display add form or not + */ + +$show_add_form = elgg_extract('show_add_form', $vars, true); + +echo '<div id="group-replies" class="mtl">'; + +$options = array( + 'guid' => $vars['entity']->getGUID(), + 'annotation_name' => 'group_topic_post', +); +$html = elgg_list_annotations($options); +if ($html) { + echo '<h3>' . elgg_echo('group:replies') . '</h3>'; + echo $html; +} + +if ($show_add_form) { + $form_vars = array('class' => 'mtm'); + echo elgg_view_form('discussion/reply/save', $form_vars, $vars); +} + +echo '</div>'; diff --git a/mod/groups/views/default/forms/discussion/reply/save.php b/mod/groups/views/default/forms/discussion/reply/save.php new file mode 100644 index 000000000..083fefb78 --- /dev/null +++ b/mod/groups/views/default/forms/discussion/reply/save.php @@ -0,0 +1,57 @@ +<?php +/** + * Discussion topic reply form body + * + * @uses $vars['entity'] A discussion topic object + * @uses $vars['inline'] Display a shortened form? + */ + +if (isset($vars['entity']) && elgg_is_logged_in()) { + echo elgg_view('input/hidden', array( + 'name' => 'entity_guid', + 'value' => $vars['entity']->getGUID(), + )); + + $inline = elgg_extract('inline', $vars, false); + + $annotation = elgg_extract('annotation', $vars); + + $value = ''; + + if ($annotation) { + $value = $annotation->value; + echo elgg_view('input/hidden', array( + 'name' => 'annotation_id', + 'value' => $annotation->id + )); + } + + if ($inline) { + echo elgg_view('input/text', array('name' => 'group_topic_post', 'value' => $value)); + echo elgg_view('input/submit', array('value' => elgg_echo('reply'))); + } else { +?> + <div> + <label> + <?php + if ($annotation) { + echo elgg_echo('edit'); + } else { + echo elgg_echo("reply"); + } + ?> + </label> + <?php echo elgg_view('input/longtext', array('name' => 'group_topic_post', 'value' => $value)); ?> + </div> + <div class="elgg-foot"> +<?php + if ($annotation) { + echo elgg_view('input/submit', array('value' => elgg_echo('save'))); + } else { + echo elgg_view('input/submit', array('value' => elgg_echo('reply'))); + } +?> + </div> +<?php + } +} diff --git a/mod/groups/views/default/forms/discussion/save.php b/mod/groups/views/default/forms/discussion/save.php new file mode 100644 index 000000000..a6582ede7 --- /dev/null +++ b/mod/groups/views/default/forms/discussion/save.php @@ -0,0 +1,57 @@ +<?php +/** + * Discussion topic add/edit form body + * + */ + +$title = elgg_extract('title', $vars, ''); +$desc = elgg_extract('description', $vars, ''); +$status = elgg_extract('status', $vars, ''); +$tags = elgg_extract('tags', $vars, ''); +$access_id = elgg_extract('access_id', $vars, ACCESS_DEFAULT); +$container_guid = elgg_extract('container_guid', $vars); +$guid = elgg_extract('guid', $vars, null); + +?> +<div> + <label><?php echo elgg_echo('title'); ?></label><br /> + <?php echo elgg_view('input/text', array('name' => 'title', 'value' => $title)); ?> +</div> +<div> + <label><?php echo elgg_echo('groups:topicmessage'); ?></label> + <?php echo elgg_view('input/longtext', array('name' => 'description', 'value' => $desc)); ?> +</div> +<div> + <label><?php echo elgg_echo('tags'); ?></label> + <?php echo elgg_view('input/tags', array('name' => 'tags', 'value' => $tags)); ?> +</div> +<div> + <label><?php echo elgg_echo("groups:topicstatus"); ?></label><br /> + <?php + echo elgg_view('input/dropdown', array( + 'name' => 'status', + 'value' => $status, + 'options_values' => array( + 'open' => elgg_echo('groups:topicopen'), + 'closed' => elgg_echo('groups:topicclosed'), + ), + )); + ?> +</div> +<div> + <label><?php echo elgg_echo('access'); ?></label><br /> + <?php echo elgg_view('input/access', array('name' => 'access_id', 'value' => $access_id)); ?> +</div> +<div class="elgg-foot"> +<?php + +echo elgg_view('input/hidden', array('name' => 'container_guid', 'value' => $container_guid)); + +if ($guid) { + echo elgg_view('input/hidden', array('name' => 'topic_guid', 'value' => $guid)); +} + +echo elgg_view('input/submit', array('value' => elgg_echo("save"))); + +?> +</div> diff --git a/mod/groups/views/default/forms/groups/edit.php b/mod/groups/views/default/forms/groups/edit.php new file mode 100644 index 000000000..41d97e6c3 --- /dev/null +++ b/mod/groups/views/default/forms/groups/edit.php @@ -0,0 +1,169 @@ +<?php +/** + * Group edit form + * + * @package ElggGroups + */ + +// only extract these elements. +$name = $membership = $vis = $entity = null; +extract($vars, EXTR_IF_EXISTS); + +?> +<div> + <label><?php echo elgg_echo("groups:icon"); ?></label><br /> + <?php echo elgg_view("input/file", array('name' => 'icon')); ?> +</div> +<div> + <label><?php echo elgg_echo("groups:name"); ?></label><br /> + <?php echo elgg_view("input/text", array( + 'name' => 'name', + 'value' => $name + )); + ?> +</div> +<?php + +$group_profile_fields = elgg_get_config('group'); +if ($group_profile_fields > 0) { + foreach ($group_profile_fields as $shortname => $valtype) { + $line_break = '<br />'; + if ($valtype == 'longtext') { + $line_break = ''; + } + echo '<div><label>'; + echo elgg_echo("groups:{$shortname}"); + echo "</label>$line_break"; + echo elgg_view("input/{$valtype}", array( + 'name' => $shortname, + 'value' => elgg_extract($shortname, $vars) + )); + echo '</div>'; + } +} +?> + +<div> + <label> + <?php echo elgg_echo('groups:membership'); ?><br /> + <?php echo elgg_view('input/dropdown', array( + 'name' => 'membership', + 'value' => $membership, + 'options_values' => array( + ACCESS_PRIVATE => elgg_echo('groups:access:private'), + ACCESS_PUBLIC => elgg_echo('groups:access:public') + ) + )); + ?> + </label> +</div> + +<?php + +if (elgg_get_plugin_setting('hidden_groups', 'groups') == 'yes') { + $access_options = array( + ACCESS_PRIVATE => elgg_echo('groups:access:group'), + ACCESS_LOGGED_IN => elgg_echo("LOGGED_IN"), + ACCESS_PUBLIC => elgg_echo("PUBLIC") + ); +?> + +<div> + <label> + <?php echo elgg_echo('groups:visibility'); ?><br /> + <?php echo elgg_view('input/access', array( + 'name' => 'vis', + 'value' => $vis, + 'options_values' => $access_options, + )); + ?> + </label> +</div> + +<?php +} + +if (isset($vars['entity'])) { + $entity = $vars['entity']; + $owner_guid = $vars['entity']->owner_guid; +} else { + $entity = false; +} + +if ($entity && ($owner_guid == elgg_get_logged_in_user_guid() || elgg_is_admin_logged_in())) { + $owner_guid = $vars['entity']->owner_guid; + $members = array(); + foreach ($vars['entity']->getMembers(0) as $member) { + $members[$member->guid] = "$member->name (@$member->username)"; + } +?> + +<div> + <label> + <?php echo elgg_echo('groups:owner'); ?><br /> + <?php echo elgg_view('input/dropdown', array( + 'name' => 'owner_guid', + 'value' => $owner_guid, + 'options_values' => $members, + 'class' => 'groups-owner-input', + )); + ?> + </label> + <?php + if ($owner_guid == elgg_get_logged_in_user_guid()) { + echo '<span class="elgg-text-help">' . elgg_echo('groups:owner:warning') . '</span>'; + } + ?> +</div> + +<?php +} + +$tools = elgg_get_config('group_tool_options'); +if ($tools) { + usort($tools, create_function('$a,$b', 'return strcmp($a->label,$b->label);')); + foreach ($tools as $group_option) { + $group_option_toggle_name = $group_option->name . "_enable"; + $value = elgg_extract($group_option_toggle_name, $vars); +?> +<div> + <label> + <?php echo $group_option->label; ?><br /> + </label> + <?php echo elgg_view("input/radio", array( + "name" => $group_option_toggle_name, + "value" => $value, + 'options' => array( + elgg_echo('groups:yes') => 'yes', + elgg_echo('groups:no') => 'no', + ), + )); + ?> +</div> +<?php + } +} +?> +<div class="elgg-foot"> +<?php + +if ($entity) { + echo elgg_view('input/hidden', array( + 'name' => 'group_guid', + 'value' => $entity->getGUID(), + )); +} + +echo elgg_view('input/submit', array('value' => elgg_echo('save'))); + +if ($entity) { + $delete_url = 'action/groups/delete?guid=' . $entity->getGUID(); + echo elgg_view('output/confirmlink', array( + 'text' => elgg_echo('groups:delete'), + 'href' => $delete_url, + 'confirm' => elgg_echo('groups:deletewarning'), + 'class' => 'elgg-button elgg-button-delete float-alt', + )); +} +?> +</div> diff --git a/mod/groups/views/default/forms/groups/find.php b/mod/groups/views/default/forms/groups/find.php new file mode 100644 index 000000000..ddf639b74 --- /dev/null +++ b/mod/groups/views/default/forms/groups/find.php @@ -0,0 +1,16 @@ +<?php +/** + * Group tag-based search form body + */ + +$tag_string = elgg_echo('groups:search:tags'); + +$params = array( + 'name' => 'tag', + 'class' => 'elgg-input-search mbm', + 'value' => $tag_string, + 'onclick' => "if (this.value=='$tag_string') { this.value='' }", +); +echo elgg_view('input/text', $params); + +echo elgg_view('input/submit', array('value' => elgg_echo('search:go'))); diff --git a/mod/groups/views/default/forms/groups/invite.php b/mod/groups/views/default/forms/groups/invite.php new file mode 100644 index 000000000..ef3131782 --- /dev/null +++ b/mod/groups/views/default/forms/groups/invite.php @@ -0,0 +1,22 @@ +<?php +/** + * Elgg groups invite form + * + * @package ElggGroups + */ + +$group = $vars['entity']; +$owner = $group->getOwnerEntity(); +$forward_url = $group->getURL(); +$friends = elgg_get_logged_in_user_entity()->getFriends('', 0); + +if ($friends) { + echo elgg_view('input/friendspicker', array('entities' => $friends, 'name' => 'user_guid', 'highlight' => 'all')); + echo '<div class="elgg-foot">'; + echo elgg_view('input/hidden', array('name' => 'forward_url', 'value' => $forward_url)); + echo elgg_view('input/hidden', array('name' => 'group_guid', 'value' => $group->guid)); + echo elgg_view('input/submit', array('value' => elgg_echo('invite'))); + echo '</div>'; +} else { + echo elgg_echo('groups:nofriendsatall'); +}
\ No newline at end of file diff --git a/mod/groups/views/default/forms/groups/search.php b/mod/groups/views/default/forms/groups/search.php new file mode 100644 index 000000000..850b6088e --- /dev/null +++ b/mod/groups/views/default/forms/groups/search.php @@ -0,0 +1,20 @@ +<?php +/** + * Group search form + * + * @uses $vars['entity'] ElggGroup + */ + +$params = array( + 'name' => 'q', + 'class' => 'elgg-input-search mbm', + 'value' => $tag_string, +); +echo elgg_view('input/text', $params); + +echo elgg_view('input/hidden', array( + 'name' => 'container_guid', + 'value' => $vars['entity']->getGUID(), +)); + +echo elgg_view('input/submit', array('value' => elgg_echo('search:go'))); diff --git a/mod/groups/views/default/group/default.php b/mod/groups/views/default/group/default.php new file mode 100644 index 000000000..d9460dff4 --- /dev/null +++ b/mod/groups/views/default/group/default.php @@ -0,0 +1,37 @@ +<?php +/** + * Group entity view + * + * @package ElggGroups + */ + +$group = $vars['entity']; + +$icon = elgg_view_entity_icon($group, 'tiny'); + +$metadata = elgg_view_menu('entity', array( + 'entity' => $group, + 'handler' => 'groups', + 'sort_by' => 'priority', + 'class' => 'elgg-menu-hz', +)); + +if (elgg_in_context('owner_block') || elgg_in_context('widgets')) { + $metadata = ''; +} + + +if ($vars['full_view']) { + echo elgg_view('groups/profile/summary', $vars); +} else { + // brief view + $params = array( + 'entity' => $group, + 'metadata' => $metadata, + 'subtitle' => $group->briefdescription, + ); + $params = $params + $vars; + $list_body = elgg_view('group/elements/summary', $params); + + echo elgg_view_image_block($icon, $list_body, $vars); +} diff --git a/mod/groups/views/default/groups/css.php b/mod/groups/views/default/groups/css.php new file mode 100644 index 000000000..6f710ddab --- /dev/null +++ b/mod/groups/views/default/groups/css.php @@ -0,0 +1,80 @@ +<?php +/** + * Elgg Groups css + * + * @package groups + */ + +?> +.groups-profile > .elgg-image { + margin-right: 10px; +} +.groups-profile img { + width: 100%; + height: auto; +} +.groups-stats { + background: #eeeeee; + padding: 5px; + margin-top: 10px; + + -webkit-border-radius: 5px; + -moz-border-radius: 5px; + border-radius: 5px; +} + +.groups-profile-fields .odd, +.groups-profile-fields .even { + background: #f4f4f4; + + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; + + padding: 2px 4px; + margin-bottom: 7px; +} + +.groups-profile-fields .elgg-output { + margin: 0; +} + +#groups-tools > li { + width: 48%; + min-height: 200px; + margin-bottom: 40px; +} + +#groups-tools > li:nth-child(odd) { + margin-right: 4%; +} + +.groups-widget-viewall { + float: right; + font-size: 85%; +} + +.groups-latest-reply { + float: right; +} + +.elgg-menu-groups-my-status li a { + display: block; + + -webkit-border-radius: 8px; + -moz-border-radius: 8px; + border-radius: 8px; + + background-color: white; + margin: 3px 0 5px 0; + padding: 2px 4px 2px 8px; +} +.elgg-menu-groups-my-status li a:hover { + background-color: #0054A7; + color: white; + text-decoration: none; +} +.elgg-menu-groups-my-status li.elgg-state-selected > a { + background-color: #4690D6; + color: white; +} diff --git a/mod/groups/views/default/groups/edit.php b/mod/groups/views/default/groups/edit.php new file mode 100644 index 000000000..5579ad54a --- /dev/null +++ b/mod/groups/views/default/groups/edit.php @@ -0,0 +1,15 @@ +<?php +/** + * Edit/create a group wrapper + * + * @uses $vars['entity'] ElggGroup object + */ + +$entity = elgg_extract('entity', $vars, null); + +$form_vars = array( + 'enctype' => 'multipart/form-data', + 'class' => 'elgg-form-alt', +); + +echo elgg_view_form('groups/edit', $form_vars, groups_prepare_form_vars($entity)); diff --git a/mod/groups/views/default/groups/group_sort_menu.php b/mod/groups/views/default/groups/group_sort_menu.php new file mode 100644 index 000000000..f5631a31f --- /dev/null +++ b/mod/groups/views/default/groups/group_sort_menu.php @@ -0,0 +1,36 @@ +<?php +/** + * All groups listing page navigation + * + * @uses $vars['selected'] Name of the tab that has been selected + */ + +$tabs = array( + 'newest' => array( + 'text' => elgg_echo('groups:newest'), + 'href' => 'groups/all?filter=newest', + 'priority' => 200, + ), + 'popular' => array( + 'text' => elgg_echo('groups:popular'), + 'href' => 'groups/all?filter=popular', + 'priority' => 300, + ), + 'discussion' => array( + 'text' => elgg_echo('groups:latestdiscussion'), + 'href' => 'groups/all?filter=discussion', + 'priority' => 400, + ), +); + +foreach ($tabs as $name => $tab) { + $tab['name'] = $name; + + if ($vars['selected'] == $name) { + $tab['selected'] = true; + } + + elgg_register_menu_item('filter', $tab); +} + +echo elgg_view_menu('filter', array('sort_by' => 'priority', 'class' => 'elgg-menu-hz')); diff --git a/mod/groups/views/default/groups/invitationrequests.php b/mod/groups/views/default/groups/invitationrequests.php new file mode 100644 index 000000000..94dbdf1f2 --- /dev/null +++ b/mod/groups/views/default/groups/invitationrequests.php @@ -0,0 +1,51 @@ +<?php +/** + * A user's group invitations + * + * @uses $vars['invitations'] Array of ElggGroups + */ + +if (!empty($vars['invitations']) && is_array($vars['invitations'])) { + $user = elgg_get_logged_in_user_entity(); + echo '<ul class="elgg-list">'; + foreach ($vars['invitations'] as $group) { + if ($group instanceof ElggGroup) { + $icon = elgg_view_entity_icon($group, 'tiny', array('use_hover' => 'true')); + + $group_title = elgg_view('output/url', array( + 'href' => $group->getURL(), + 'text' => $group->name, + 'is_trusted' => true, + )); + + $url = elgg_add_action_tokens_to_url(elgg_get_site_url()."action/groups/join?user_guid={$user->guid}&group_guid={$group->guid}"); + $accept_button = elgg_view('output/url', array( + 'href' => $url, + 'text' => elgg_echo('accept'), + 'class' => 'elgg-button elgg-button-submit', + 'is_trusted' => true, + )); + + $url = "action/groups/killinvitation?user_guid={$user->getGUID()}&group_guid={$group->getGUID()}"; + $delete_button = elgg_view('output/confirmlink', array( + 'href' => $url, + 'confirm' => elgg_echo('groups:invite:remove:check'), + 'text' => elgg_echo('delete'), + 'class' => 'elgg-button elgg-button-delete mlm', + )); + + $body = <<<HTML +<h4>$group_title</h4> +<p class="elgg-subtext">$group->briefdescription</p> +HTML; + $alt = $accept_button . $delete_button; + + echo '<li class="pvs">'; + echo elgg_view_image_block($icon, $body, array('image_alt' => $alt)); + echo '</li>'; + } + } + echo '</ul>'; +} else { + echo '<p class="mtm">' . elgg_echo('groups:invitations:none') . "</p>"; +} diff --git a/mod/groups/views/default/groups/js.php b/mod/groups/views/default/groups/js.php new file mode 100644 index 000000000..0319be14a --- /dev/null +++ b/mod/groups/views/default/groups/js.php @@ -0,0 +1,13 @@ +<?php +/** + * Javascript for Groups forms + * + * @package ElggGroups + */ +?> + +// this adds a class to support IE8 and older +elgg.register_hook_handler('init', 'system', function() { + // jQuery uses 0-based indexing + $('#groups-tools').children('li:even').addClass('odd'); +}); diff --git a/mod/groups/views/default/groups/membershiprequests.php b/mod/groups/views/default/groups/membershiprequests.php new file mode 100644 index 000000000..2bac0e32b --- /dev/null +++ b/mod/groups/views/default/groups/membershiprequests.php @@ -0,0 +1,47 @@ +<?php +/** + * A group's member requests + * + * @uses $vars['entity'] ElggGroup + * @uses $vars['requests'] Array of ElggUsers + */ + +if (!empty($vars['requests']) && is_array($vars['requests'])) { + echo '<ul class="elgg-list">'; + foreach ($vars['requests'] as $user) { + $icon = elgg_view_entity_icon($user, 'tiny', array('use_hover' => 'true')); + + $user_title = elgg_view('output/url', array( + 'href' => $user->getURL(), + 'text' => $user->name, + 'is_trusted' => true, + )); + + $url = "action/groups/addtogroup?user_guid={$user->guid}&group_guid={$vars['entity']->guid}"; + $url = elgg_add_action_tokens_to_url($url); + $accept_button = elgg_view('output/url', array( + 'href' => $url, + 'text' => elgg_echo('accept'), + 'class' => 'elgg-button elgg-button-submit', + 'is_trusted' => true, + )); + + $url = 'action/groups/killrequest?user_guid=' . $user->guid . '&group_guid=' . $vars['entity']->guid; + $delete_button = elgg_view('output/confirmlink', array( + 'href' => $url, + 'confirm' => elgg_echo('groups:joinrequest:remove:check'), + 'text' => elgg_echo('delete'), + 'class' => 'elgg-button elgg-button-delete mlm', + )); + + $body = "<h4>$user_title</h4>"; + $alt = $accept_button . $delete_button; + + echo '<li class="pvs">'; + echo elgg_view_image_block($icon, $body, array('image_alt' => $alt)); + echo '</li>'; + } + echo '</ul>'; +} else { + echo '<p class="mtm">' . elgg_echo('groups:requests:none') . '</p>'; +} diff --git a/mod/groups/views/default/groups/profile/activity_module.php b/mod/groups/views/default/groups/profile/activity_module.php new file mode 100644 index 000000000..832ff4a4b --- /dev/null +++ b/mod/groups/views/default/groups/profile/activity_module.php @@ -0,0 +1,44 @@ +<?php +/** + * Groups latest activity + * + * @todo add people joining group to activity + * + * @package Groups + */ + +if ($vars['entity']->activity_enable == 'no') { + return true; +} + +$group = $vars['entity']; +if (!$group) { + return true; +} + +$all_link = elgg_view('output/url', array( + 'href' => "groups/activity/$group->guid", + 'text' => elgg_echo('link:view:all'), + 'is_trusted' => true, +)); + + +elgg_push_context('widgets'); +$db_prefix = elgg_get_config('dbprefix'); +$content = elgg_list_river(array( + 'limit' => 4, + 'pagination' => false, + 'joins' => array("JOIN {$db_prefix}entities e1 ON e1.guid = rv.object_guid"), + 'wheres' => array("(e1.container_guid = $group->guid)"), +)); +elgg_pop_context(); + +if (!$content) { + $content = '<p>' . elgg_echo('groups:activity:none') . '</p>'; +} + +echo elgg_view('groups/profile/module', array( + 'title' => elgg_echo('groups:activity'), + 'content' => $content, + 'all_link' => $all_link, +)); 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..24526d378 --- /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 (elgg_is_logged_in()) { + echo ' ' . elgg_echo('groups:closedgroup:request'); +} +?> +</p> diff --git a/mod/groups/views/default/groups/profile/fields.php b/mod/groups/views/default/groups/profile/fields.php new file mode 100644 index 000000000..14827f11a --- /dev/null +++ b/mod/groups/views/default/groups/profile/fields.php @@ -0,0 +1,38 @@ +<?php +/** + * Group profile fields + */ + +$group = $vars['entity']; + +$profile_fields = elgg_get_config('group'); + +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 "<div class=\"{$even_odd}\">"; + echo "<b>"; + echo elgg_echo("groups:$key"); + echo ": </b>"; + echo elgg_view("output/$valtype", $options); + echo "</div>"; + + $even_odd = ($even_odd == 'even') ? 'odd' : 'even'; + } +} diff --git a/mod/groups/views/default/groups/profile/layout.php b/mod/groups/views/default/groups/profile/layout.php new file mode 100644 index 000000000..f513f10ae --- /dev/null +++ b/mod/groups/views/default/groups/profile/layout.php @@ -0,0 +1,13 @@ +<?php +/** + * Layout of the groups profile page + * + * @uses $vars['entity'] + */ + +echo elgg_view('groups/profile/summary', $vars); +if (group_gatekeeper(false)) { + echo elgg_view('groups/profile/widgets', $vars); +} else { + echo elgg_view('groups/profile/closed_membership'); +} diff --git a/mod/groups/views/default/groups/profile/module.php b/mod/groups/views/default/groups/profile/module.php new file mode 100644 index 000000000..9d0b18266 --- /dev/null +++ b/mod/groups/views/default/groups/profile/module.php @@ -0,0 +1,25 @@ +<?php +/** + * Group module (also called a group widget) + * + * @uses $vars['title'] The title of the module + * @uses $vars['content'] The module content + * @uses $vars['all_link'] A link to list content + * @uses $vars['add_link'] A link to create content + */ + +$group = elgg_get_page_owner_entity(); + +$header = "<span class=\"groups-widget-viewall\">{$vars['all_link']}</span>"; +$header .= '<h3>' . $vars['title'] . '</h3>'; + +if ($group->canWriteToContainer() && isset($vars['add_link'])) { + $vars['content'] .= "<span class='elgg-widget-more'>{$vars['add_link']}</span>"; +} + +echo '<li>'; +echo elgg_view_module('info', '', $vars['content'], array( + 'header' => $header, + 'class' => 'elgg-module-group', +)); +echo '</li>'; diff --git a/mod/groups/views/default/groups/profile/summary.php b/mod/groups/views/default/groups/profile/summary.php new file mode 100644 index 000000000..f1221f19a --- /dev/null +++ b/mod/groups/views/default/groups/profile/summary.php @@ -0,0 +1,57 @@ +<?php +/** + * Group profile summary + * + * 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(); + +if (!$owner) { + // not having an owner is very bad so we throw an exception + $msg = elgg_echo('InvalidParameterException:IdNotExistForGUID', array('group owner', $group->guid)); + throw new InvalidParameterException($msg); +} + +?> +<div class="groups-profile clearfix elgg-image-block"> + <div class="elgg-image"> + <div class="groups-profile-icon"> + <?php echo elgg_view_entity_icon($group, 'large', array('href' => '')); ?> + </div> + <div class="groups-stats"> + <p> + <b><?php echo elgg_echo("groups:owner"); ?>: </b> + <?php + echo elgg_view('output/url', array( + 'text' => $owner->name, + 'value' => $owner->getURL(), + 'is_trusted' => true, + )); + ?> + </p> + <p> + <?php + echo elgg_echo('groups:members') . ": " . $group->getMembers(0, 0, TRUE); + ?> + </p> + </div> + </div> + + <div class="groups-profile-fields elgg-body"> + <?php + echo elgg_view('groups/profile/fields', $vars); + ?> + </div> +</div> +<?php +?> + 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..7635cad4f --- /dev/null +++ b/mod/groups/views/default/groups/profile/widgets.php @@ -0,0 +1,24 @@ +<?php +/** +* Profile widgets/tools +* +* @package ElggGroups +*/ + +// tools widget area +echo '<ul id="groups-tools" class="elgg-gallery elgg-gallery-fluid mtl clearfix">'; + +// enable tools to extend this area +echo elgg_view("groups/tool_latest", $vars); + +// backward compatibility +$right = elgg_view('groups/right_column', $vars); +$left = elgg_view('groups/left_column', $vars); +if ($right || $left) { + elgg_deprecated_notice('The views groups/right_column and groups/left_column have been replaced by groups/tool_latest', 1.8); + echo $left; + echo $right; +} + +echo "</ul>"; + diff --git a/mod/groups/views/default/groups/sidebar/featured.php b/mod/groups/views/default/groups/sidebar/featured.php new file mode 100644 index 000000000..8bd51ab5c --- /dev/null +++ b/mod/groups/views/default/groups/sidebar/featured.php @@ -0,0 +1,25 @@ +<?php +/** + * Featured groups + * + * @package ElggGroups + */ + +$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 ($featured_groups as $group) { + $body .= elgg_view_entity($group, array('full_view' => false)); + } + elgg_pop_context(); + + echo elgg_view_module('aside', elgg_echo("groups:featured"), $body); +} diff --git a/mod/groups/views/default/groups/sidebar/find.php b/mod/groups/views/default/groups/sidebar/find.php new file mode 100644 index 000000000..c1a8da3c2 --- /dev/null +++ b/mod/groups/views/default/groups/sidebar/find.php @@ -0,0 +1,14 @@ +<?php +/** + * Group search + * + * @package ElggGroups + */ +$url = elgg_get_site_url() . 'groups/search'; +$body = elgg_view_form('groups/find', array( + 'action' => $url, + 'method' => 'get', + 'disable_security' => true, +)); + +echo elgg_view_module('aside', elgg_echo('groups:searchtag'), $body); diff --git a/mod/groups/views/default/groups/sidebar/members.php b/mod/groups/views/default/groups/sidebar/members.php new file mode 100644 index 000000000..11273d0e6 --- /dev/null +++ b/mod/groups/views/default/groups/sidebar/members.php @@ -0,0 +1,32 @@ +<?php +/** + * Group members sidebar + * + * @package ElggGroups + * + * @uses $vars['entity'] Group entity + * @uses $vars['limit'] The number of members to display + */ + +$limit = elgg_extract('limit', $vars, 14); + +$all_link = elgg_view('output/url', array( + 'href' => 'groups/members/' . $vars['entity']->guid, + 'text' => elgg_echo('groups:members:more'), + 'is_trusted' => true, +)); + +$body = elgg_list_entities_from_relationship(array( + 'relationship' => 'member', + 'relationship_guid' => $vars['entity']->guid, + 'inverse_relationship' => true, + 'types' => 'user', + 'limit' => $limit, + 'list_type' => 'gallery', + 'gallery_class' => 'elgg-gallery-users', + 'pagination' => false +)); + +$body .= "<div class='center mts'>$all_link</div>"; + +echo elgg_view_module('aside', elgg_echo('groups:members'), $body); diff --git a/mod/groups/views/default/groups/sidebar/my_status.php b/mod/groups/views/default/groups/sidebar/my_status.php new file mode 100644 index 000000000..4c36c0213 --- /dev/null +++ b/mod/groups/views/default/groups/sidebar/my_status.php @@ -0,0 +1,62 @@ +<?php +/** + * Group status for logged in user + * + * @package ElggGroups + * + * @uses $vars['entity'] Group entity + */ + +$group = elgg_extract('entity', $vars); +$user = elgg_get_logged_in_user_entity(); +$subscribed = elgg_extract('subscribed', $vars); + +if (!elgg_is_logged_in()) { + return true; +} +$t = new ElggMenuItem(); +// membership status +$is_member = $group->isMember($user); +$is_owner = $group->getOwnerEntity() == $user; + +if ($is_owner) { + elgg_register_menu_item('groups:my_status', array( + 'name' => 'membership_status', + 'text' => '<a>' . elgg_echo('groups:my_status:group_owner') . '</a>', + 'href' => false + )); +} elseif ($is_member) { + elgg_register_menu_item('groups:my_status', array( + 'name' => 'membership_status', + 'text' => '<a>' . elgg_echo('groups:my_status:group_member') . '</a>', + 'href' => false + )); +} else { + elgg_register_menu_item('groups:my_status', array( + 'name' => 'membership_status', + 'text' => elgg_echo('groups:join'), + 'href' => "/action/groups/join?group_guid={$group->getGUID()}", + 'is_action' => true + )); +} + +// notification info +if (elgg_is_active_plugin('notifications')) { + if ($subscribed) { + elgg_register_menu_item('groups:my_status', array( + 'name' => 'subscription_status', + 'text' => elgg_echo('groups:subscribed'), + 'href' => "notifications/group/$user->username", + 'is_action' => true + )); + } else { + elgg_register_menu_item('groups:my_status', array( + 'name' => 'subscription_status', + 'text' => elgg_echo('groups:unsubscribed'), + 'href' => "notifications/group/$user->username" + )); + } +} + +$body = elgg_view_menu('groups:my_status'); +echo elgg_view_module('aside', elgg_echo('groups:my_status'), $body); diff --git a/mod/groups/views/default/groups/sidebar/search.php b/mod/groups/views/default/groups/sidebar/search.php new file mode 100644 index 000000000..226835715 --- /dev/null +++ b/mod/groups/views/default/groups/sidebar/search.php @@ -0,0 +1,15 @@ +<?php +/** + * Search for content in this group + * + * @uses vars['entity'] ElggGroup + */ + +$url = elgg_get_site_url() . 'search'; +$body = elgg_view_form('groups/search', array( + 'action' => $url, + 'method' => 'get', + 'disable_security' => true, +), $vars); + +echo elgg_view_module('aside', elgg_echo('groups:search_in_group'), $body);
\ No newline at end of file diff --git a/mod/groups/views/default/object/groupforumtopic.php b/mod/groups/views/default/object/groupforumtopic.php new file mode 100644 index 000000000..34e0ee3cc --- /dev/null +++ b/mod/groups/views/default/object/groupforumtopic.php @@ -0,0 +1,98 @@ +<?php +/** + * Forum topic entity view + * + * @package ElggGroups +*/ + +$full = elgg_extract('full_view', $vars, FALSE); +$topic = elgg_extract('entity', $vars, FALSE); + +if (!$topic) { + return true; +} + +$poster = $topic->getOwnerEntity(); +$group = $topic->getContainerEntity(); +$excerpt = elgg_get_excerpt($topic->description); + +$poster_icon = elgg_view_entity_icon($poster, 'tiny'); +$poster_link = elgg_view('output/url', array( + 'href' => $poster->getURL(), + 'text' => $poster->name, + 'is_trusted' => true, +)); +$poster_text = elgg_echo('groups:started', array($poster->name)); + +$tags = elgg_view('output/tags', array('tags' => $topic->tags)); +$date = elgg_view_friendly_time($topic->time_created); + +$replies_link = ''; +$reply_text = ''; +$num_replies = elgg_get_annotations(array( + 'annotation_name' => 'group_topic_post', + 'guid' => $topic->getGUID(), + 'count' => true, +)); +if ($num_replies != 0) { + $last_reply = $topic->getAnnotations('group_topic_post', 1, 0, 'desc'); + $poster = $last_reply[0]->getOwnerEntity(); + $reply_time = elgg_view_friendly_time($last_reply[0]->time_created); + $reply_text = elgg_echo('groups:updated', array($poster->name, $reply_time)); + + $replies_link = elgg_view('output/url', array( + 'href' => $topic->getURL() . '#group-replies', + 'text' => elgg_echo('group:replies') . " ($num_replies)", + 'is_trusted' => true, + )); +} + +$metadata = elgg_view_menu('entity', array( + 'entity' => $vars['entity'], + 'handler' => 'discussion', + 'sort_by' => 'priority', + 'class' => 'elgg-menu-hz', +)); + +// do not show the metadata and controls in widget view +if (elgg_in_context('widgets')) { + $metadata = ''; +} + +if ($full) { + $subtitle = "$poster_text $date $replies_link"; + + $params = array( + 'entity' => $topic, + 'metadata' => $metadata, + 'subtitle' => $subtitle, + 'tags' => $tags, + ); + $params = $params + $vars; + $list_body = elgg_view('object/elements/summary', $params); + + $info = elgg_view_image_block($poster_icon, $list_body); + + $body = elgg_view('output/longtext', array('value' => $topic->description)); + + echo <<<HTML +$info +$body +HTML; + +} else { + // brief view + $subtitle = "$poster_text $date $replies_link <span class=\"groups-latest-reply\">$reply_text</span>"; + + $params = array( + 'entity' => $topic, + 'metadata' => $metadata, + 'subtitle' => $subtitle, + 'tags' => $tags, + 'content' => $excerpt, + ); + $params = $params + $vars; + $list_body = elgg_view('object/elements/summary', $params); + + echo elgg_view_image_block($poster_icon, $list_body); +} diff --git a/mod/groups/views/default/plugins/groups/settings.php b/mod/groups/views/default/plugins/groups/settings.php new file mode 100644 index 000000000..41ea146db --- /dev/null +++ b/mod/groups/views/default/plugins/groups/settings.php @@ -0,0 +1,40 @@ +<?php +/** + * Groups plugin settings + */ + +// set default value +if (!isset($vars['entity']->hidden_groups)) { + $vars['entity']->hidden_groups = 'no'; +} + +// set default value +if (!isset($vars['entity']->limited_groups)) { + $vars['entity']->limited_groups = 'no'; +} + +echo '<div>'; +echo elgg_echo('groups:allowhiddengroups'); +echo ' '; +echo elgg_view('input/dropdown', array( + 'name' => 'params[hidden_groups]', + 'options_values' => array( + 'no' => elgg_echo('option:no'), + 'yes' => elgg_echo('option:yes') + ), + 'value' => $vars['entity']->hidden_groups, +)); +echo '</div>'; + +echo '<div>'; +echo elgg_echo('groups:whocancreate'); +echo ' '; +echo elgg_view('input/dropdown', array( + 'name' => 'params[limited_groups]', + 'options_values' => array( + 'no' => elgg_echo('LOGGED_IN'), + 'yes' => elgg_echo('admin') + ), + 'value' => $vars['entity']->limited_groups, +)); +echo '</div>'; diff --git a/mod/groups/views/default/river/annotation/group_topic_post/reply.php b/mod/groups/views/default/river/annotation/group_topic_post/reply.php new file mode 100644 index 000000000..afc823bde --- /dev/null +++ b/mod/groups/views/default/river/annotation/group_topic_post/reply.php @@ -0,0 +1,12 @@ +<?php +/** + * Reply river view + */ +$object = $vars['item']->getObjectEntity(); +$reply = $vars['item']->getAnnotation(); +$excerpt = elgg_get_excerpt($reply->value); + +echo elgg_view('river/elements/layout', array( + 'item' => $vars['item'], + 'message' => $excerpt, +));
\ No newline at end of file diff --git a/mod/groups/views/default/river/group/create.php b/mod/groups/views/default/river/group/create.php new file mode 100644 index 000000000..ea42b5b00 --- /dev/null +++ b/mod/groups/views/default/river/group/create.php @@ -0,0 +1,13 @@ +<?php +/** + * Group creation river view. + */ + +$object = $vars['item']->getObjectEntity(); +$excerpt = strip_tags($object->description); +$excerpt = elgg_get_excerpt($excerpt); + +echo elgg_view('river/elements/layout', array( + 'item' => $vars['item'], + 'message' => $excerpt, +));
\ No newline at end of file diff --git a/mod/groups/views/default/river/object/groupforumtopic/create.php b/mod/groups/views/default/river/object/groupforumtopic/create.php new file mode 100644 index 000000000..e7d92bc08 --- /dev/null +++ b/mod/groups/views/default/river/object/groupforumtopic/create.php @@ -0,0 +1,22 @@ +<?php +/** + * Group forum topic create river view. + */ + +$object = $vars['item']->getObjectEntity(); +$excerpt = strip_tags($object->description); +$excerpt = elgg_get_excerpt($excerpt); + +$responses = ''; +if (elgg_is_logged_in() && $object->canAnnotate(0, 'group_topic_post')) { + // inline comment form + $form_vars = array('id' => "groups-reply-{$object->getGUID()}", 'class' => 'hidden'); + $body_vars = array('entity' => $object, 'inline' => true); + $responses = elgg_view_form('discussion/reply/save', $form_vars, $body_vars); +} + +echo elgg_view('river/elements/layout', array( + 'item' => $vars['item'], + 'message' => $excerpt, + 'responses' => $responses, +)); diff --git a/mod/groups/views/default/river/relationship/member/create.php b/mod/groups/views/default/river/relationship/member/create.php new file mode 100644 index 000000000..0afd87e4b --- /dev/null +++ b/mod/groups/views/default/river/relationship/member/create.php @@ -0,0 +1,8 @@ +<?php +/** + * Group join river view. + */ + +echo elgg_view('river/elements/layout', array( + 'item' => $vars['item'], +)); diff --git a/mod/groups/views/default/widgets/a_users_groups/content.php b/mod/groups/views/default/widgets/a_users_groups/content.php new file mode 100644 index 000000000..fe1a46e39 --- /dev/null +++ b/mod/groups/views/default/widgets/a_users_groups/content.php @@ -0,0 +1,33 @@ +<?php +/** + * Elgg file widget view + * + * @package ElggFile + */ + + +$num = $vars['entity']->num_display; + +$options = array( + 'type' => 'group', + 'relationship' => 'member', + 'relationship_guid' => $vars['entity']->owner_guid, + 'limit' => $num, + 'full_view' => FALSE, + 'pagination' => FALSE, +); +$content = elgg_list_entities_from_relationship($options); + +echo $content; + +if ($content) { + $url = "groups/member/" . elgg_get_page_owner_entity()->username; + $more_link = elgg_view('output/url', array( + 'href' => $url, + 'text' => elgg_echo('groups:more'), + 'is_trusted' => true, + )); + echo "<span class=\"elgg-widget-more\">$more_link</span>"; +} else { + echo elgg_echo('groups:none'); +} diff --git a/mod/groups/views/default/widgets/a_users_groups/edit.php b/mod/groups/views/default/widgets/a_users_groups/edit.php new file mode 100644 index 000000000..e49a996b7 --- /dev/null +++ b/mod/groups/views/default/widgets/a_users_groups/edit.php @@ -0,0 +1,25 @@ +<?php +/** + * Elgg group widget edit view + * + * @package ElggGroups + */ + + +// set default value +if (!isset($vars['entity']->num_display)) { + $vars['entity']->num_display = 4; +} + +$params = array( + 'name' => 'params[num_display]', + 'value' => $vars['entity']->num_display, + 'options' => array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20), +); +$dropdown = elgg_view('input/dropdown', $params); + +?> +<div> + <?php echo elgg_echo('groups:widget:num_display'); ?>: + <?php echo $dropdown; ?> +</div> |