diff options
Diffstat (limited to 'mod/groups/views/default')
70 files changed, 1268 insertions, 1567 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/forums/addpost.php b/mod/groups/views/default/forms/forums/addpost.php deleted file mode 100644 index 3ad3de0ff..000000000 --- a/mod/groups/views/default/forms/forums/addpost.php +++ /dev/null @@ -1,34 +0,0 @@ -<?php - - /** - * Elgg group forum post edit/add page - * - * @package ElggGroups - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider <info@elgg.com> - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - * - * @uses $vars['entity'] Optionally, the post to edit - */ - -?> -<form action="<?php echo $vars['url']; ?>action/groups/addpost" method="post" class="margin_top"> - <label><?php echo elgg_echo("groups:reply"); ?><br /> - <?php - - echo elgg_view("input/longtext",array( - "internalname" => "topic_post", - "value" => $body, - )); - ?> - </label> - - <!-- pass across the topic guid --> - <input type="hidden" name="topic_guid" value="<?php echo $vars['entity']->guid; ?>" /> - <input type="hidden" name="group_guid" value="<?php echo $vars['entity']->container_guid; ?>" /> - - <?php echo elgg_view('input/securitytoken'); ?> - <!-- display the post button --> - <input type="submit" class="submit_button" value="<?php echo elgg_echo('post'); ?>" /> -</form> diff --git a/mod/groups/views/default/forms/forums/addtopic.php b/mod/groups/views/default/forms/forums/addtopic.php deleted file mode 100644 index 9dd70d7a8..000000000 --- a/mod/groups/views/default/forms/forums/addtopic.php +++ /dev/null @@ -1,105 +0,0 @@ -<?php -/** - * Elgg Groups topic edit/add page - * - * @package ElggGroups - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider <info@elgg.com> - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - * - * @uses $vars['object'] Optionally, the topic to edit - */ - - // Set title, form destination - $title = elgg_echo("groups:addtopic"); - $action = "groups/addtopic"; - $tags = ""; - $title = ""; - $message = ""; - $message_id = ""; - $status = ""; - $access_id = ACCESS_DEFAULT; - - // get the group guid - $group_guid = (int) get_input('group_guid'); - - // set breadcrumbs - elgg_push_breadcrumb('', 'Parent Group Name'); - elgg_push_breadcrumb(elgg_echo('item:object:groupforumtopic'), ''); - elgg_push_breadcrumb(elgg_echo("groups:addtopic")); - - echo elgg_view('navigation/breadcrumbs'); - - // set the title - echo elgg_view_title(elgg_echo("groups:addtopic")); - -?> -<!-- display the input form --> -<form action="<?php echo $vars['url']; ?>action/<?php echo $action; ?>" method="post" class="margin_top"> -<?php echo elgg_view('input/securitytoken'); ?> - - <p> - <label><?php echo elgg_echo("title"); ?><br /> - <?php - //display the topic title input - echo elgg_view("input/text", array( - "internalname" => "topictitle", - "value" => $title, - )); - ?> - </label> - </p> - - <!-- display the tag input --> - <p> - <label><?php echo elgg_echo("tags"); ?><br /> - <?php - - echo elgg_view("input/tags", array( - "internalname" => "topictags", - "value" => $tags, - )); - - ?> - </label> - </p> - - <!-- topic message input --> - <p class="longtext_editarea"> - <label><?php echo elgg_echo("groups:topicmessage"); ?><br /> - <?php - - echo elgg_view("input/longtext",array( - "internalname" => "topicmessage", - "value" => $message, - )); - ?> - </label> - </p> - - <!-- set the topic status --> - <p> - <label><?php echo elgg_echo("groups:topicstatus"); ?><br /> - <select name="status"> - <option value="open" <?php if($status == "") echo "SELECTED";?>><?php echo elgg_echo('groups:topicopen'); ?></option> - <option value="closed" <?php if($status == "closed") echo "SELECTED";?>><?php echo elgg_echo('groups:topicclosed'); ?></option> - </select> - </label> - </p> - - <!-- access --> - <p> - <label> - <?php echo elgg_echo('access'); ?><br /> - <?php echo elgg_view('input/access', array('internalname' => 'access_id','value' => $access_id)); ?> - </label> - </p> - - <!-- required hidden info and submit button --> - <p> - <input type="hidden" name="group_guid" value="<?php echo $group_guid; ?>" /> - <input type="submit" class="submit_button" value="<?php echo elgg_echo('post'); ?>" /> - </p> - -</form> diff --git a/mod/groups/views/default/forms/forums/edittopic.php b/mod/groups/views/default/forms/forums/edittopic.php deleted file mode 100644 index b88dfd866..000000000 --- a/mod/groups/views/default/forms/forums/edittopic.php +++ /dev/null @@ -1,109 +0,0 @@ -<?php - - /** - * Elgg Groups topic edit/add page - * - * @package ElggGroups - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider <info@elgg.com> - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - * - * @uses $vars['entity'] Optionally, the topic to edit - */ - - //users can edit the access and status for now - $access_id = $vars['entity']->access_id; - $status = $vars['entity']->status; - $tags = $vars['entity']->tags; - $title = $vars['entity']->title; - $message = $vars['entity']->getAnnotations('group_topic_post', 1, 0, "asc"); - - foreach($message as $mes){ - $messsage_content = $mes->value; - $message_id = $mes->id; - } - - // get the group GUID - $group_guid = get_input("group"); - - // topic guid - $topic_guid = $vars['entity']->guid; - - // set the title - echo elgg_view_title(elgg_echo("groups:edittopic")); - -?> - -<!-- display the input form --> - <form action="<?php echo $vars['url']; ?>action/groups/edittopic" method="post"> - <?php echo elgg_view('input/securitytoken'); ?> - - <p> - <label><?php echo elgg_echo("title"); ?><br /> - <?php - //display the topic title input - echo elgg_view("input/text", array( - "internalname" => "topictitle", - "value" => $title, - )); - ?> - </label> - </p> - - <!-- display the tag input --> - <p> - <label><?php echo elgg_echo("tags"); ?><br /> - <?php - - echo elgg_view("input/tags", array( - "internalname" => "topictags", - "value" => $tags, - )); - - ?> - </label> - </p> - - <!-- topic message input --> - <p class="longtext_editarea"> - <label><?php echo elgg_echo("groups:topicmessage"); ?><br /> - <?php - - echo elgg_view("input/longtext",array( - "internalname" => "topicmessage", - "value" => $messsage_content, - )); - ?> - </label> - </p> - - <!-- set the topic status --> - <p> - <label><?php echo elgg_echo("groups:topicstatus"); ?><br /> - <select name="status"> - <option value="open" <?php if($status == "") echo "SELECTED";?>><?php echo elgg_echo('groups:topicopen'); ?></option> - <option value="sticky" <?php if($status == "sticky") echo "SELECTED";?>><?php echo elgg_echo('groups:topicsticky'); ?></option> - <option value="resolved" <?php if($status == "resolved") echo "SELECTED";?>><?php echo elgg_echo('groups:topicresolved'); ?></option> - <option value="closed" <?php if($status == "closed") echo "SELECTED";?>><?php echo elgg_echo('groups:topicclosed'); ?></option> - </select> - </label> - </p> - - <!-- access --> - <p> - <label> - <?php echo elgg_echo('access'); ?><br /> - <?php echo elgg_view('input/access', array('internalname' => 'access_id','value' => $access_id)); ?> - </label> - </p> - - <!-- required hidden info and submit button --> - <p> - <input type="hidden" name="group_guid" value="<?php echo $group_guid; ?>" /> - <input type="hidden" name="topic" value="<?php echo $topic_guid; ?>" /> - <input type="hidden" name="message_id" value="<?php echo $message_id; ?>" /> - <input type="submit" class="submit_button" value="<?php echo elgg_echo('save'); ?>" /> - </p> - - </form> diff --git a/mod/groups/views/default/forms/groups/edit.php b/mod/groups/views/default/forms/groups/edit.php index 3712add82..e2dc5455a 100644 --- a/mod/groups/views/default/forms/groups/edit.php +++ b/mod/groups/views/default/forms/groups/edit.php @@ -1,159 +1,178 @@ <?php - /** - * Elgg groups plugin - * - * @package ElggGroups - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider Ltd - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - */ - - // new groups default to open membership - if (isset($vars['entity'])) { - $membership = $vars['entity']->membership; - } else { - $membership = ACCESS_PUBLIC; - } - -?> -<form action="<?php echo $vars['url']; ?>action/groups/edit" enctype="multipart/form-data" method="post" class="margin_top"> - - <?php echo elgg_view('input/securitytoken'); ?> +/** + * Group edit form + * + * @package ElggGroups + */ - <p> - <label><?php echo elgg_echo("groups:icon"); ?><br /> - <?php - - echo elgg_view("input/file",array('internalname' => 'icon')); - - ?> - </label> - </p> -<?php +// only extract these elements. +$name = $membership = $vis = $entity = null; +extract($vars, EXTR_IF_EXISTS); - //var_export($vars['profile']); - if (is_array($vars['config']->group) && sizeof($vars['config']->group) > 0) - foreach($vars['config']->group as $shortname => $valtype) { - ?> - - <p> - <label> - <?php echo elgg_echo("groups:{$shortname}") ?><br /> - <?php echo elgg_view("input/{$valtype}",array( - 'internalname' => $shortname, - 'value' => $vars['entity']->$shortname, - )); ?> - </label> - </p> - +<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>'; + } +} ?> - <p> - <label> - <?php echo elgg_echo('groups:membership'); ?><br /> - <?php echo elgg_view('input/access', array('internalname' => 'membership','value' => $membership, 'options' => array( ACCESS_PRIVATE => elgg_echo('groups:access:private'), ACCESS_PUBLIC => elgg_echo('groups:access:public')))); ?> - </label> - </p> +<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 +<?php - if (get_plugin_setting('hidden_groups', 'groups') == 'yes') - { +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") + ); ?> - <p> - <label> +<div> + <label> <?php echo elgg_echo('groups:visibility'); ?><br /> - <?php - - $this_owner = $vars['entity']->owner_guid; - if (!$this_owner) $this_owner = get_loggedin_userid(); - - $access = array(ACCESS_FRIENDS => elgg_echo("access:friends:label"), 1 => elgg_echo("LOGGED_IN"), 2 => elgg_echo("PUBLIC")); - $collections = get_user_access_collections($this_owner); - if (is_array($collections)) - { - foreach ($collections as $c) - $access[$c->id] = $c->name; - } - - echo elgg_view('input/access', array('internalname' => 'vis', 'value' => ($vars['entity']->access_id ? $vars['entity']->access_id : ACCESS_PUBLIC), 'options' => $access)); - - + <?php echo elgg_view('input/access', array( + 'name' => 'vis', + 'value' => $vis, + 'options_values' => $access_options, + )); ?> - </label> - </p> + </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())) { + $members = array(); + + $options = array( + 'relationship' => 'member', + 'relationship_guid' => $vars['entity']->getGUID(), + 'inverse_relationship' => true, + 'type' => 'user', + 'limit' => 0, + ); + + $batch = new ElggBatch('elgg_get_entities_from_relationship', $options); + foreach ($batch as $member) { + $members[$member->guid] = "$member->name (@$member->username)"; } - - ?> - - <?php - if (isset($vars['config']->group_tool_options)) { - foreach($vars['config']->group_tool_options as $group_option) { - $group_option_toggle_name = $group_option->name."_enable"; - if ($group_option->default_on) { - $group_option_default_value = 'yes'; - } else { - $group_option_default_value = 'no'; - } -?> - <p> - <label> - <?php echo $group_option->label; ?><br /> - <?php - - echo elgg_view("input/radio",array( - "internalname" => $group_option_toggle_name, - "value" => $vars['entity']->$group_option_toggle_name ? $vars['entity']->$group_option_toggle_name : $group_option_default_value, - 'options' => array( - elgg_echo('groups:yes') => 'yes', - elgg_echo('groups:no') => 'no', - ), - )); - ?> - </label> - </p> +?> + +<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>'; } ?> - <p> - <?php - if ($vars['entity']) { - ?><input type="hidden" name="group_guid" value="<?php echo $vars['entity']->getGUID(); ?>" /><?php - } - ?> - <input type="hidden" name="user_guid" value="<?php echo page_owner_entity()->guid; ?>" /> - <input type="submit" class="submit_button" value="<?php echo elgg_echo("save"); ?>" /> - - </p> +</div> -</form> +<?php +} -<?php -if ($vars['entity']) { -?> -<div class="delete_group"> - <form action="<?php echo $vars['url'] . "action/groups/delete"; ?>"> - <?php - echo elgg_view('input/securitytoken'); - $warning = elgg_echo("groups:deletewarning"); - ?> - <input type="hidden" name="group_guid" value="<?php echo $vars['entity']->getGUID(); ?>" /> - <input type="submit" class="action_button disabled" name="delete" value="<?php echo elgg_echo('groups:delete'); ?>" onclick="javascript:return confirm('<?php echo $warning; ?>')"/><?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', + ), + )); ?> - </form> </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 index e5042aa4e..ef3131782 100644 --- a/mod/groups/views/default/forms/groups/invite.php +++ b/mod/groups/views/default/forms/groups/invite.php @@ -1,32 +1,22 @@ <?php - /** - * Elgg groups plugin - * - * @package ElggGroups - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider Ltd - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - */ +/** + * Elgg groups invite form + * + * @package ElggGroups + */ - $group = $vars['entity']; - $owner = get_entity($vars['entity']->owner_guid); - $forward_url = $group->getURL(); - - -?> -<form action="<?php echo $vars['url']; ?>action/groups/invite" method="post" class="margin_top"> +$group = $vars['entity']; +$owner = $group->getOwnerEntity(); +$forward_url = $group->getURL(); +$friends = elgg_get_logged_in_user_entity()->getFriends('', 0); - <?php - echo elgg_view('input/securitytoken'); - - if ($friends = get_entities_from_relationship('friend',$_SESSION['guid'],false,'user','',0,'',9999)) { - echo elgg_view('friends/picker',array('entities' => $friends, 'internalname' => 'user_guid', 'highlight' => 'all')); - } - // echo elgg_view('sharing/invite',array('shares' => $shares, 'owner' => $owner, 'group' => $group)); - - ?> - <input type="hidden" name="forward_url" value="<?php echo $forward_url; ?>" /> - <input type="hidden" name="group_guid" value="<?php echo $group->guid; ?>" /> - <input type="submit" value="<?php echo elgg_echo('invite'); ?>" /> -</form> +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/forum/topicposts.php b/mod/groups/views/default/forum/topicposts.php deleted file mode 100644 index 29ce21358..000000000 --- a/mod/groups/views/default/forum/topicposts.php +++ /dev/null @@ -1,78 +0,0 @@ -<?php - - /** - * Elgg Topic individual post view. This is all the follow up posts on a particular topic - * - * @package ElggGroups - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider Ltd <info@elgg.com> - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - * - * @uses $vars['entity'] The posted comment to view - */ - - -?> - -<div class="entity_listing topic clearfloat"> -<a name="<?php echo $vars['entity']->id; ?>"></a> - <?php - // get infomation about the owner of the comment - if ($post_owner = get_user($vars['entity']->owner_guid)) { - // display the user icon - echo "<div class='entity_listing_icon'>" . elgg_view("profile/icon",array('entity' => $post_owner, 'size' => 'tiny')) . "</div>"; - // display the user name - echo "<div class='entity_listing_info'>"; - // if comment owner, group owner, or site admin - display edit and delete options - if (groups_can_edit_discussion($vars['entity'], page_owner_entity()->owner_guid)) { - echo "<div class='entity_metadata'>"; - echo "<span class='delete_button'>".elgg_view("output/confirmlink",array( - 'href' => $vars['url'] . "action/groups/deletepost?post=" . $vars['entity']->id . "&topic=" . get_input('topic') . "&group=" . get_input('group_guid'), - 'text' => elgg_echo('delete'), - 'confirm' => elgg_echo('deleteconfirm') - ))."</span>"; - echo "<a class='link' onclick=\"elgg_slide_toggle(this,'.topic','.edit_comment');\">".elgg_echo('edit')."</a>"; - echo "</div>"; - - } - - echo "<p class='entity_title'>" . $post_owner->name . "</p>"; - } else { - echo "<div class='entity_listing_icon'><img src=\"" . elgg_view('icon/user/default/tiny') . "\" /></div>"; - echo "<div class='entity_listing_info'><p class='entity_title'>" . elgg_echo('profile:deleteduser') . "</p>"; - } - - //display the date of the comment - echo "<p class='entity_subtext'>" . friendly_time($vars['entity']->time_created) . "</p>"; - - //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'))); - - $form_body = <<<EOT - - <p class='longtext_editarea'>$text_textarea</p> - $post - $topic - $group - $field - $submit_input -EOT; - echo "<div class='edit_comment margin_top hidden'>"; - echo elgg_view('input/form', array('action' => "{$vars['url']}action/groups/editpost", 'body' => $form_body, 'internalid' => 'editforumpostForm')); - echo "</div>"; - } - echo "</div>"; // close entity_listing_info -?> - -</div>
\ No newline at end of file diff --git a/mod/groups/views/default/forum/topics.php b/mod/groups/views/default/forum/topics.php deleted file mode 100644 index 821e398e1..000000000 --- a/mod/groups/views/default/forum/topics.php +++ /dev/null @@ -1,33 +0,0 @@ -<?php - /** - * Elgg groups plugin - * - * @package ElggGroups - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - */ - -?> -<div id="content_header" class="clearfloat"> - <div class="content_header_title"> - <h2><?php echo elgg_echo("groups:forum"); ?></h2> - </div> - <?php // only show the add topic button if the user is a member - if(page_owner_entity()->isMember($vars['user'])) { - ?> - <div class="content_header_options"> - <a class="action_button" href="<?php echo $vars['url']; ?>mod/groups/addtopic.php?group_guid=<?php echo get_input('group_guid'); ?>"><?php echo elgg_echo("groups:addtopic"); ?></a> - </div> - <?php - } - ?> -</div> -<?php - if($vars['topics']) - echo $vars['topics']; - else - echo "<p class='margin_top'>". elgg_echo("grouptopic:notcreated") . "</p>"; - -?>
\ No newline at end of file diff --git a/mod/groups/views/default/forum/viewposts.php b/mod/groups/views/default/forum/viewposts.php deleted file mode 100644 index 02ed06b62..000000000 --- a/mod/groups/views/default/forum/viewposts.php +++ /dev/null @@ -1,57 +0,0 @@ -<?php - - /** - * Elgg groups plugin display topic posts - * - * @package ElggGroups - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - */ - - elgg_push_breadcrumb('', 'Parent Group Name'); - elgg_push_breadcrumb(elgg_echo('item:object:groupforumtopic'), ''); - 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, - )); - -?> -<!-- grab the topic title --> -<h2><?php echo $vars['entity']->title; ?></h2> -<?php - - foreach($vars['entity']->getAnnotations('group_topic_post', 50, $offset, "asc") as $post) { - - echo elgg_view("forum/topicposts",array('entity' => $post)); - - } - - // check to find out the status of the topic and act - if($vars['entity']->status != "closed" && page_owner_entity()->isMember($vars['user'])){ - - //display the add comment form, this will appear after all the existing comments - echo elgg_view("forms/forums/addpost", array('entity' => $vars['entity'])); - - } elseif($vars['entity']->status == "closed") { - - //this topic has been closed by the owner - echo "<h2>" . elgg_echo("groups:topicisclosed") . "</h2>"; - echo "<p>" . elgg_echo("groups:topiccloseddesc") . "</p>"; - - } else { - } - -?> 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/group/group.php b/mod/groups/views/default/group/group.php deleted file mode 100644 index e250a247b..000000000 --- a/mod/groups/views/default/group/group.php +++ /dev/null @@ -1,17 +0,0 @@ -<?php -/** - * Elgg groups profile display - * - * @package ElggGroups - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider Ltd - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - */ - -if ($vars['full']) { - echo elgg_view("groups/groupprofile",$vars); -} else { - echo elgg_view("groups/grouplisting",$vars); -} -?>
\ No newline at end of file diff --git a/mod/groups/views/default/groups/closedmembership.php b/mod/groups/views/default/groups/closedmembership.php deleted file mode 100644 index e714602f1..000000000 --- a/mod/groups/views/default/groups/closedmembership.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php - /** - * Elgg groups plugin full profile view (for a closed group you haven't joined). - * - * @package ElggGroups - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - */ - -?> -<p class="margin_top"><?php echo elgg_echo('groups:closedgroup'); ?></p> diff --git a/mod/groups/views/default/groups/css.php b/mod/groups/views/default/groups/css.php index d4fac1b22..32dd2b74d 100644 --- a/mod/groups/views/default/groups/css.php +++ b/mod/groups/views/default/groups/css.php @@ -3,121 +3,74 @@ * Elgg Groups css * * @package groups - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider Ltd <info@elgg.com> - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ */ ?> -/* group listings */ -.group_count { - float:right; +.groups-profile > .elgg-image { + margin-right: 10px; } -.group_listings { - /* wraps group lists on - latest discussion, newest, popular */ -} -.entity_subtext.groups { - float:right; - width:300px; - text-align: right; - margin-left: 10px; -} -.entity_listing.topic:hover { - background-color: white; -} - - -/* group invitations */ -.group_invitations a.action_button, -.group_invitations a.submit_button { - float:right; - margin:0 0 0 14px; -} - - -/* GROUPS SIDEBAR ELEMENTS */ -#groupsearchform .search_input { - width:196px; -} -.featured_group { - margin-bottom:15px; -} -.featured_group .usericon { - float:left; - margin-right:10px; -} -.featured_group p.entity_title { - margin-bottom:0; -} -.member_icon { - margin:6px 6px 0 0; - float:left; -} - - -/* GROUP PROFILE PAGE (a groups homepage) */ -.group_profile_column { - float:left; - margin-top:10px; -} -.group_profile_column.icon { - width:200px; -} -.group_profile_column.info { - width:510px; - margin-left:20px; -} -.group_profile_icon { - width:200px; - height:200px; -} -.group_stats { +.groups-stats { background: #eeeeee; - padding:5px; - margin-top:10px; - -webkit-border-radius: 5px; + padding: 5px; + margin-top: 10px; + + -webkit-border-radius: 5px; -moz-border-radius: 5px; + border-radius: 5px; } -.group_stats p { - margin:0; -} -.group_profile_column .odd, -.group_profile_column .even { - background:#f4f4f4; - -webkit-border-radius: 4px; + +.groups-profile-fields .odd, +.groups-profile-fields .even { + background: #f4f4f4; + + -webkit-border-radius: 4px; -moz-border-radius: 4px; - padding:2px 4px; - margin:0 0 7px; + border-radius: 4px; + + padding: 2px 4px; + margin-bottom: 7px; } -.group_profile.forum_latest { - margin-top:20px; + +.groups-profile-fields .elgg-output { + margin: 0; } -.group_profile.forum_latest h3 { - border-bottom:1px solid #CCCCCC; - padding-bottom:5px; + +#groups-tools > li { + width: 48%; + min-height: 200px; + margin-bottom: 40px; } -.group_profile_column.right { - float:right; - width:350px; - margin-top:20px; + +#groups-tools > li:nth-child(odd) { + margin-right: 4%; } -.group_profile_column.left { - width:350px; - float:left; - margin-top:20px; + +.groups-widget-viewall { + float: right; + font-size: 85%; } -/* edit group page */ -.delete_group { + +.groups-latest-reply { float: right; - margin-top:-44px; } -/* Group forum */ +.elgg-menu-groups-my-status li a { + display: block; -/* all browsers - force tinyMCE on edit forum posts to be full-width */ -.edit_comment .defaultSkin table.mceLayout { - width: 694px !important; -} + -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/featured.php b/mod/groups/views/default/groups/featured.php deleted file mode 100644 index e811642f8..000000000 --- a/mod/groups/views/default/groups/featured.php +++ /dev/null @@ -1,25 +0,0 @@ -<?php - - /** - * This view will display featured groups - these are set by admin - **/ - - -?> -<h3><?php echo elgg_echo("groups:featured"); ?></h3> - -<?php - if($vars['featured']){ - - foreach($vars['featured'] as $group){ - $icon = elgg_view( - "groups/icon", array( - 'entity' => $group, - 'size' => 'tiny', - )); - - echo "<div class='featured_group'>".$icon."<p class='entity_title clearfloat'><a href=\"" . $group->getUrl() . "\">" . $group->name . "</a></p>"; - echo "<p class='entity_subtext'>" . $group->briefdescription . "</p></div>"; - } - } -?> diff --git a/mod/groups/views/default/groups/find.php b/mod/groups/views/default/groups/find.php deleted file mode 100644 index 534469052..000000000 --- a/mod/groups/views/default/groups/find.php +++ /dev/null @@ -1,14 +0,0 @@ -<?php - - /** - * A simple group search by tag view - **/ - -$tag_string = elgg_echo('groups:search:tags'); - -?> -<h3><?php echo elgg_echo('groups:searchtag'); ?></h3> -<form id="groupsearchform" action="<?php echo $vars['url']; ?>pg/groups/world/" method="get"> - <input type="text" name="tag" value="<?php echo $tag_string; ?>" onclick="if (this.value=='<?php echo $tag_string; ?>') { this.value='' }" class="search_input" /> - <input type="submit" value="<?php echo elgg_echo('go'); ?>" /> -</form>
\ 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 deleted file mode 100644 index d00dc4443..000000000 --- a/mod/groups/views/default/groups/forum_latest.php +++ /dev/null @@ -1,30 +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'){ -?> -<h3><?php echo elgg_echo('groups:latestdiscussion'); ?></h3> -<?php - - $forum = elgg_get_entities_from_annotations(array('types' => 'object', 'subtypes' => 'groupforumtopic', 'annotation_names' => 'group_topic_post', 'container_guid' => $vars['entity']->guid, 'limit' => 4, 'order_by' => 'maxtime desc')); - - if($forum){ - foreach($forum as $f){ - - $count_annotations = $f->countAnnotations("group_topic_post"); - - echo "<div class='entity_listing clearfloat'>"; - echo "<div class='entity_listing_icon'>" . elgg_view('profile/icon',array('entity' => $f->getOwnerEntity(), 'size' => 'tiny', 'override' => true)) . "</div>"; - echo "<div class='entity_listing_info'><p class='entity_title'><a href=\"{$vars['url']}mod/groups/topicposts.php?topic={$f->guid}&group_guid={$vars['entity']->guid}\">" . $f->title . "</a></p>"; - echo "<p class='entity_subtext'>".elgg_echo('groups:posts').": " . $count_annotations . "</p></div>"; - echo "</div>"; - - } - } 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/group_sort_menu.php b/mod/groups/views/default/groups/group_sort_menu.php index 66569ba1e..f5631a31f 100644 --- a/mod/groups/views/default/groups/group_sort_menu.php +++ b/mod/groups/views/default/groups/group_sort_menu.php @@ -1,24 +1,36 @@ <?php +/** + * All groups listing page navigation + * + * @uses $vars['selected'] Name of the tab that has been selected + */ - /** - * A simple view to provide the user with group filters and the number of group on the site - **/ - - $num_groups = $vars['count']; - if(!$num_groups) - $num_groups = 0; - - $filter = $vars['filter']; - - //url - $url = $vars['url'] . "pg/groups/world/"; +$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, + ), +); -?> -<div class="elgg_horizontal_tabbed_nav margin_top"> -<div class="group_count"><?php echo $num_groups . " " . elgg_echo("groups:count"); ?></div> -<ul> - <li <?php if($filter == "active") echo "class='selected'"; ?>><a href="<?php echo $url; ?>?filter=active"><?php echo elgg_echo('groups:latestdiscussion'); ?></a></li> - <li <?php if($filter == "newest") echo "class='selected'"; ?>><a href="<?php echo $url; ?>?filter=newest"><?php echo elgg_echo('groups:newest'); ?></a></li> - <li <?php if($filter == "pop") echo "class='selected'"; ?>><a href="<?php echo $url; ?>?filter=pop"><?php echo elgg_echo('groups:popular'); ?></a></li> -</ul> -</div> +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/grouplisting.php b/mod/groups/views/default/groups/grouplisting.php deleted file mode 100644 index 2b6887736..000000000 --- a/mod/groups/views/default/groups/grouplisting.php +++ /dev/null @@ -1,49 +0,0 @@ -<?php -/** - * Elgg user display (small) - * - * @package ElggGroups - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider Ltd - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - * - * @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 == 2) { - $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($vars['url'] . "action/groups/featured?group_guid=" . $vars['entity']->guid . "&action=unfeature"); - $wording = elgg_echo("groups:makeunfeatured"); - }else{ - $url = elgg_add_action_tokens_to_url($vars['url'] . "action/groups/featured?group_guid=" . $vars['entity']->guid . "&action=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_listing($icon, $info); - -?> diff --git a/mod/groups/views/default/groups/groupprofile.php b/mod/groups/views/default/groups/groupprofile.php deleted file mode 100644 index 5232e9a6f..000000000 --- a/mod/groups/views/default/groups/groupprofile.php +++ /dev/null @@ -1,85 +0,0 @@ -<?php -/** - * Elgg groups plugin full profile view. - * - * @package ElggGroups - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - */ -?> -<div id="content_header" class="clearfloat"> - <div class="content_header_title"> - <h2><?php echo $vars['entity']->name; ?></h2> - </div> - <?php - if ($vars['entity']->canEdit()) { - ?> - <div class="content_header_options"> - <a class="action_button" href="<?php echo $vars['url']; ?>mod/groups/edit.php?group_guid=<?php echo $vars['entity']->getGUID(); ?>"><?php echo elgg_echo("groups:edit"); ?></a> - </div> - <?php - } - ?> -</div> - -<div class="group_profile clearfloat"> - <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 echo elgg_echo('groups:members') . ": " . get_entities_from_relationship('member', $vars['entity']->guid, true, 'user', '', 0, '', 9999, 0, true); ?></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/icon.php b/mod/groups/views/default/groups/icon.php deleted file mode 100644 index e839e0f9b..000000000 --- a/mod/groups/views/default/groups/icon.php +++ /dev/null @@ -1,48 +0,0 @@ -<?php - - /** - * Elgg group icon - * - * @package ElggGroups - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider Ltd - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - * - * @uses $vars['entity'] The user entity. If none specified, the current user is assumed. - * @uses $vars['size'] The size - small, medium or large. If none specified, medium is assumed. - */ - - $group = $vars['entity']; - - if ($group instanceof ElggGroup) { - - // Get size - if (!in_array($vars['size'],array('small','medium','large','tiny','master','topbar'))) - $vars['size'] = "tiny"; - - // Get any align and js - if (!empty($vars['align'])) { - $align = " align=\"{$vars['align']}\" "; - } else { - $align = ""; - } - - if ($icontime = $vars['entity']->icontime) { - $icontime = "{$icontime}"; - } else { - $icontime = "default"; - } - - -?> - -<div class="usericon"> -<a href="<?php echo $vars['entity']->getURL(); ?>" class="icon" ><img src="<?php echo $vars['entity']->getIcon($vars['size']); ?>" border="0" <?php echo $align; ?> title="<?php echo $name; ?>" <?php echo $vars['js']; ?> /></a> -</div> - -<?php - - } - -?>
\ No newline at end of file diff --git a/mod/groups/views/default/groups/invitationrequests.php b/mod/groups/views/default/groups/invitationrequests.php index 135bf1940..94dbdf1f2 100644 --- a/mod/groups/views/default/groups/invitationrequests.php +++ b/mod/groups/views/default/groups/invitationrequests.php @@ -1,40 +1,51 @@ <?php +/** + * A user's group invitations + * + * @uses $vars['invitations'] Array of ElggGroups + */ if (!empty($vars['invitations']) && is_array($vars['invitations'])) { - $user = get_loggedin_user(); - foreach($vars['invitations'] as $group) + $user = elgg_get_logged_in_user_entity(); + echo '<ul class="elgg-list">'; + foreach ($vars['invitations'] as $group) { if ($group instanceof ElggGroup) { - - ?> - <div class="entity_listing group_invitations clearfloat"> - <?php - echo "<div class='entity_listing_icon'>"; - echo elgg_view("profile/icon", array( - 'entity' => $group, - 'size' => 'tiny', - 'override' => 'true' - ))."</div>"; + $icon = elgg_view_entity_icon($group, 'tiny', array('use_hover' => 'true')); - $url = elgg_add_action_tokens_to_url("{$vars['url']}action/groups/join?user_guid={$user->guid}&group_guid={$group->guid}"); - ?> - <div class="entity_listing_info"> - <a href="<?php echo $url; ?>" class="submit_button"><?php echo elgg_echo('accept'); ?></a> - <?php - echo str_replace('<a', '<a class="action_button disabled" ', elgg_view('output/confirmlink',array( - 'href' => $vars['url'] . "action/groups/killinvitation?user_guid={$user->getGUID()}&group_guid={$group->getGUID()}", + $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'), - ))); - - echo "<p class='entity_title'><a href=\"" . $group->getUrl() . "\">" . $group->name . "</a></p>"; - echo "<p class='entity_subtext'>" . $group->briefdescription . "</p>"; + 'class' => 'elgg-button elgg-button-delete mlm', + )); - ?> - </div></div> - <?php - } + $body = <<<HTML +<h4>$group_title</h4> +<p class="elgg-subtext">$group->briefdescription</p> +HTML; + $alt = $accept_button . $delete_button; - } else { - echo "<p class='margin_top'>" . elgg_echo('groups:invitations:none') . "</p>"; + 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>"; } -?>
\ No newline at end of file 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/members.php b/mod/groups/views/default/groups/members.php deleted file mode 100644 index fe6f38dd3..000000000 --- a/mod/groups/views/default/groups/members.php +++ /dev/null @@ -1,25 +0,0 @@ -<?php - /** - * Elgg groups items view. - * This is the messageboard, members, pages and latest forums posts. Each plugin will extend the views - * - * @package ElggGroups - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - */ - - //var_export($vars['entity']); -?> - -<div id="group_members" class="clearfloat"> -<h3><?php echo elgg_echo("groups:members"); ?></h3> - -<?php - $members = $vars['entity']->getMembers(10); - foreach($members as $mem){ - echo "<div class='member_icon'><a href=\"".$mem->getURL()."\">" . elgg_view("profile/icon",array('entity' => $mem, 'size' => 'tiny', 'override' => 'true')) . "</a></div>"; - } -?> -</div>
\ No newline at end of file diff --git a/mod/groups/views/default/groups/membershiprequests.php b/mod/groups/views/default/groups/membershiprequests.php index b08e521cf..2bac0e32b 100644 --- a/mod/groups/views/default/groups/membershiprequests.php +++ b/mod/groups/views/default/groups/membershiprequests.php @@ -1,40 +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'])) { +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')); - foreach($vars['requests'] as $request) - if ($request instanceof ElggUser) { - - ?> - <div class="entity_listing group_invitations clearfloat"> - <?php - echo "<div class='entity_listing_icon'>"; - echo elgg_view("profile/icon", array( - 'entity' => $request, - 'size' => 'small', - 'override' => 'true' - )); - echo "</div>"; - - $url = elgg_add_action_tokens_to_url("{$vars['url']}action/groups/addtogroup?user_guid={$request->guid}&group_guid={$vars['entity']->guid}"); - ?> - <div class="entity_listing_info"> - <a href="<?php echo $url; ?>" class="submit_button"><?php echo elgg_echo('accept'); ?></a> - <?php - echo str_replace('<a', '<a class="action_button disabled" ', elgg_view('output/confirmlink',array( - 'href' => $vars['url'] . 'action/groups/killrequest?user_guid='.$request->guid.'&group_guid=' . $vars['entity']->guid, - 'confirm' => elgg_echo('groups:joinrequest:remove:check'), - 'text' => elgg_echo('delete'), - ))); - echo "<p class='entity_title'><a href=\"" . $request->getUrl() . "\">" . $request->name . "</a></p>"; - echo "<p class='entity_subtext'>" . $request->briefdescription . "</p>"; - ?> - </div> - </div> - <?php - } - } else { - echo "<p>" . elgg_echo('groups:requests:none') . "</p>"; - } + $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', + )); -?>
\ No newline at end of file + $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..3f7496871 --- /dev/null +++ b/mod/groups/views/default/groups/profile/summary.php @@ -0,0 +1,64 @@ +<?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 + // we don't force icons to be square so don't set width/height + echo elgg_view_entity_icon($group, 'large', array( + 'href' => '', + 'width' => '', + 'height' => '', + )); + ?> + </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/profileitems.php b/mod/groups/views/default/groups/profileitems.php deleted file mode 100644 index 2050ae941..000000000 --- a/mod/groups/views/default/groups/profileitems.php +++ /dev/null @@ -1,28 +0,0 @@ -<?php - /** - * Elgg groups items view. - * This is the messageboard, members, pages and latest forums posts. Each plugin will extend the views - * - * @package ElggGroups - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - */ - - //forum - echo "<div class='group_profile forum_latest clearfloat'>"; - echo elgg_view("groups/forum_latest",array('entity' => $vars['entity'])); - echo "</div>"; - - //right column - echo "<div class='group_profile_column right'>"; - echo elgg_view("groups/right_column",array('entity' => $vars['entity'])); - echo "</div>"; - - //left column - echo "<div class='group_profile_column left'>"; - echo elgg_view("groups/left_column",array('entity' => $vars['entity'])); - echo "</div>"; - -?>
\ No newline at end of file diff --git a/mod/groups/views/default/groups/side_menu.php b/mod/groups/views/default/groups/side_menu.php deleted file mode 100644 index a86cd8adb..000000000 --- a/mod/groups/views/default/groups/side_menu.php +++ /dev/null @@ -1,8 +0,0 @@ -<ul class="submenu page_navigation"> -<?php - if(isloggedin()){ - echo "<li><a href=\"{$vars['url']}pg/groups/member/{$_SESSION['user']->username}\">". elgg_echo('groups:yours') ."</a></li>"; - echo "<li><a href=\"{$vars['url']}pg/groups/invitations/{$_SESSION['user']->username}\">". elgg_echo('groups:invitations') ."</a></li>"; - } -?> -</ul>
\ No newline at end of file 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..f3f8f8d2d --- /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', + 'type' => '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..1199a0c34 --- /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, + 'type' => '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..1e4e84b80 --- /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; +} + +// 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') && $is_member) { + 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/icon/group/default/large.php b/mod/groups/views/default/icon/group/default/large.php deleted file mode 100644 index a9d69a691..000000000 --- a/mod/groups/views/default/icon/group/default/large.php +++ /dev/null @@ -1,3 +0,0 @@ -<?php - echo $vars['url'] . "mod/groups/graphics/defaultlarge.gif"; -?>
\ No newline at end of file diff --git a/mod/groups/views/default/icon/group/default/medium.php b/mod/groups/views/default/icon/group/default/medium.php deleted file mode 100644 index 47cf328b8..000000000 --- a/mod/groups/views/default/icon/group/default/medium.php +++ /dev/null @@ -1,3 +0,0 @@ -<?php - echo $vars['url'] . "mod/groups/graphics/defaultmedium.gif"; -?>
\ No newline at end of file diff --git a/mod/groups/views/default/icon/group/default/small.php b/mod/groups/views/default/icon/group/default/small.php deleted file mode 100644 index b052c1cc3..000000000 --- a/mod/groups/views/default/icon/group/default/small.php +++ /dev/null @@ -1,3 +0,0 @@ -<?php - echo $vars['url'] . "mod/groups/graphics/defaultsmall.gif"; -?>
\ No newline at end of file diff --git a/mod/groups/views/default/icon/group/default/tiny.php b/mod/groups/views/default/icon/group/default/tiny.php deleted file mode 100644 index 1023d06e2..000000000 --- a/mod/groups/views/default/icon/group/default/tiny.php +++ /dev/null @@ -1,3 +0,0 @@ -<?php - echo $vars['url'] . "mod/groups/graphics/defaulttiny.gif"; -?>
\ 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 5fb1dad0b..e6988d16e 100644 --- a/mod/groups/views/default/object/groupforumtopic.php +++ b/mod/groups/views/default/object/groupforumtopic.php @@ -1,71 +1,101 @@ <?php +/** + * Forum topic entity view + * + * @package ElggGroups +*/ - /** - * Elgg Groups latest discussion listing - * - * @package ElggGroups - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider <info@elgg.com> - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - */ - - //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; - } - } - - $u = get_user($last_user); - - //select the correct output depending on where you are - if(get_context() == "search"){ +$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)); - $info = "<p class='entity_subtext groups'>" . sprintf(elgg_echo('group:created'), $forum_created, $counter) . "<br />"; - if (($last_time) && ($u)) $info.= sprintf(elgg_echo('groups:lastupdated'), friendly_time($last_time), " <a href=\"" . $u->getURL() . "\">" . $u->name . "</a>"); - $info .= '</p>'; - //get the group avatar - $icon = elgg_view("profile/icon",array('entity' => $group, 'size' => 'tiny')); - //get the group and topic title - if ($group instanceof ElggGroup) { - $info .= "<p class='entity_title'>" . elgg_echo('group') . ": <a href=\"{$group->getURL()}\">".htmlentities($group->name, ENT_QUOTES, 'UTF-8') ."</a></p>"; - } - $info .= "<p class='entity_subtext'>" . elgg_echo('topic') . ": <a href=\"{$vars['url']}mod/groups/topicposts.php?topic={$vars['entity']->guid}&group_guid={$group->guid}\">{$title}</a></p>"; - - }else{ - - $info = "<p class='entity_subtext groups'>" . sprintf(elgg_echo('group:created'), $forum_created, $counter) . "</p>"; - $info .= "<p class='entity_title'>" . elgg_echo('groups:started') . " " . $topic_owner->name . ": <a href=\"{$vars['url']}mod/groups/topicposts.php?topic={$vars['entity']->guid}&group_guid={$group->guid}\">{$title}</a></p>"; - - if (groups_can_edit_discussion($vars['entity'], page_owner_entity()->owner_guid)) { - // display the delete link to those allowed to delete - $info .= "<div class='delete_button'>" . elgg_view("output/confirmlink", array( - 'href' => $vars['url'] . "action/groups/deletetopic?topic=" . $vars['entity']->guid . "&group=" . $vars['entity']->container_guid, - 'text' => " ", - 'confirm' => elgg_echo('deleteconfirm'), - )) . "</div>"; - - } - - if (($last_time) && ($u)) { - $info.= "<p class='entity_subtext'>" . elgg_echo('groups:updated') . " " . friendly_time($last_time) . " by <a href=\"" . $u->getURL() . "\">" . $u->name . "</a></p>"; - } - //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 + $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, + 'class' => 'clearfix', + )); + + 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/forum/create.php b/mod/groups/views/default/river/forum/create.php deleted file mode 100644 index fb6cd707c..000000000 --- a/mod/groups/views/default/river/forum/create.php +++ /dev/null @@ -1,27 +0,0 @@ -<?php - - $performed_by = get_entity($vars['item']->subject_guid); // $statement->getSubject(); - $object = get_entity($vars['item']->object_guid); - //$url = $object->getURL(); - $forumtopic = $object->guid; - $group_guid = $object->container_guid; - //grab the annotation, if one exists - if($vars['item']->annotation_id != 0) - $comment = get_annotation($vars['item']->annotation_id)->value; - $contents = strip_tags($contents);//this is so we don't get large images etc in the activity river - $url = $vars['url'] . "mod/groups/topicposts.php?topic=" . $forumtopic . "&group_guid=" . $group_guid; - $url_user = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>"; - $string = sprintf(elgg_echo("groupforum:river:posted"),$url_user) . " "; - $string .= elgg_echo("groupforum:river:annotate:create") . " | <a href=\"" . $url . "\">" . $object->title . "</a>"; - $string .= "<div class=\"river_content_display\">"; - if($comment){ - $contents = strip_tags($comment);//this is so we don't get large images etc in the activity river - if(strlen($contents) > 200) - $string .= substr($contents, 0, strpos($contents, ' ', 200)) . "..."; - else - $string .= $contents; - } - $string .= "</div>"; -?> - -<?php echo $string; ?>
\ 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 deleted file mode 100644 index f4c4aadfd..000000000 --- a/mod/groups/views/default/river/forum/topic/create.php +++ /dev/null @@ -1,27 +0,0 @@ -<?php - - $performed_by = get_entity($vars['item']->subject_guid); // $statement->getSubject(); - $object = get_entity($vars['item']->object_guid); - //$url = $object->getURL(); - $forumtopic = $object->guid; - $group_guid = $object->container_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; - } - $contents = strip_tags($contents);//this is so we don't get large images etc in the activity river - $url_user = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>"; - $string = sprintf(elgg_echo("groupforum:river:postedtopic"),$url_user) . ": "; - $string .= "<a href=\"" . $url . "\">" . $object->title . "</a>"; - $string .= "<div class=\"river_content_display\">"; - if(strlen($contents) > 200) { - $string .= substr($contents, 0, strpos($contents, ' ', 200)) . "..."; - }else{ - $string .= $contents; - } - $string .= "</div>"; - -?> - -<?php echo $string; ?>
\ 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 index e96bb9b34..ea42b5b00 100644 --- a/mod/groups/views/default/river/group/create.php +++ b/mod/groups/views/default/river/group/create.php @@ -1,13 +1,13 @@ <?php +/** + * Group creation river view. + */ - $performed_by = get_entity($vars['item']->subject_guid); // $statement->getSubject(); - $object = get_entity($vars['item']->object_guid); - $objecturl = $object->getURL(); - - $url = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>"; - $string = sprintf(elgg_echo("groups:river:member"),$url) . " "; - $string .= " <a href=\"" . $object->getURL() . "\">" . $object->name . "</a>"; - -?> +$object = $vars['item']->getObjectEntity(); +$excerpt = strip_tags($object->description); +$excerpt = elgg_get_excerpt($excerpt); -<?php echo $string; ?>
\ No newline at end of file +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/group/create.php b/mod/groups/views/default/river/object/group/create.php deleted file mode 100644 index 94903fd66..000000000 --- a/mod/groups/views/default/river/object/group/create.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php - - $statement = $vars['statement']; - $performed_by = $statement->getSubject(); - $object = $statement->getObject(); - - $url = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>"; - $string = sprintf(elgg_echo("group:river:created"),$url) . " "; - $string .= "<a href=\"" . $object->getURL() . "\">" . elgg_echo("group:river:create") . "</a>"; - -?> - -<?php echo $string; ?>
\ No newline at end of file diff --git a/mod/groups/views/default/river/object/groupforumtopic/annotate.php b/mod/groups/views/default/river/object/groupforumtopic/annotate.php deleted file mode 100644 index c6aa1e5ab..000000000 --- a/mod/groups/views/default/river/object/groupforumtopic/annotate.php +++ /dev/null @@ -1,14 +0,0 @@ -<?php - - $statement = $vars['statement']; - $performed_by = $statement->getSubject(); - $object = $statement->getObject(); - - $url = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>"; - $string = sprintf(elgg_echo("groupforum:river:posted"),$url) . " "; - $string .= elgg_echo("groupforum:river:annotate:create") . " | <a href=\"" . $object->getURL() . "\">" . $object->title . "</a>"; - //$string .= "<div class=\"river_content\">Title: " . $object->title . "</div>"; - -?> - -<?php echo $string; ?>
\ 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 index 7c7d89bad..e7d92bc08 100644 --- a/mod/groups/views/default/river/object/groupforumtopic/create.php +++ b/mod/groups/views/default/river/object/groupforumtopic/create.php @@ -1,14 +1,22 @@ <?php +/** + * Group forum topic create river view. + */ - $statement = $vars['statement']; - $performed_by = $statement->getSubject(); - $object = $statement->getObject(); - - $url = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>"; - $string = sprintf(elgg_echo("groupforum:river:created"),$url) . " "; - $string .= elgg_echo("groupforum:river:create") . " | <a href=\"" . $object->getURL() . "\">" . $object->title . "</a>"; - //$string .= "<div class=\"river_content\">Discussion topic: " . $object->title . "</div>"; +$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); +} -<?php echo $string; ?>
\ No newline at end of file +echo elgg_view('river/elements/layout', array( + 'item' => $vars['item'], + 'message' => $excerpt, + 'responses' => $responses, +)); diff --git a/mod/groups/views/default/river/object/groupforumtopic/update.php b/mod/groups/views/default/river/object/groupforumtopic/update.php deleted file mode 100644 index d13c2b61f..000000000 --- a/mod/groups/views/default/river/object/groupforumtopic/update.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php - - $statement = $vars['statement']; - $performed_by = $statement->getSubject(); - $object = $statement->getObject(); - - $url = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>"; - $string = sprintf(elgg_echo("groupforum:river:updated"),$url) . " "; - $string .= elgg_echo("groupforum:river:update") . " | <a href=\"" . $object->getURL() . "\">" . $object->title . "</a>"; - -?> - -<?php echo $string; ?>
\ No newline at end of file diff --git a/mod/groups/views/default/river/relationship/member/create.php b/mod/groups/views/default/river/relationship/member/create.php index e5e318ce0..0afd87e4b 100644 --- a/mod/groups/views/default/river/relationship/member/create.php +++ b/mod/groups/views/default/river/relationship/member/create.php @@ -1,40 +1,8 @@ <?php - /** - * Elgg relationship create event for groups - * Display something in the river when a group is joined - * - * @package ElggGroups - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider Ltd - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - */ +/** + * Group join river view. + */ - $statement = $vars['statement']; - - $performed_by = $statement->getSubject(); - $event = $statement->getEvent(); - $object = $statement->getObject(); - - if (is_array($object)) - { - switch ($object['relationship']) - { - // Friending - case 'member' : - $user = $object['subject']; - $group = $object['object']; - - if (($user instanceof ElggUser) && ($group instanceof ElggGroup)) - { - echo "<a href=\"{$user->getURL()}\">{$user->name}</a> "; - echo elgg_echo("groups:river:member"); - echo " '<a href=\"{$group->getURL()}\">{$group->name}</a>'"; - } - - break; - } - } - - -?>
\ No newline at end of file +echo elgg_view('river/elements/layout', array( + 'item' => $vars['item'], +)); diff --git a/mod/groups/views/default/settings/groups/edit.php b/mod/groups/views/default/settings/groups/edit.php deleted file mode 100644 index 311e58dee..000000000 --- a/mod/groups/views/default/settings/groups/edit.php +++ /dev/null @@ -1,18 +0,0 @@ -<?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 diff --git a/mod/groups/views/default/sharing/invite.php b/mod/groups/views/default/sharing/invite.php deleted file mode 100644 index 5c3d6b316..000000000 --- a/mod/groups/views/default/sharing/invite.php +++ /dev/null @@ -1,41 +0,0 @@ -<?php - /** - * Elgg groups plugin - * - * @package ElggGroups - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider Ltd - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - */ - - $owner = $vars['owner']; - $group = $vars['group']; - - if ($friends = get_entities_from_relationship('friend',$owner->getGUID(),false,'user','')) { - - foreach($friends as $friend) { - - if (!$group->isMember($friend)) - { - $label = elgg_view("profile/icon",array('entity' => $friend, 'size' => 'tiny')); - $label .= "{$friend->name}"; - $options[$label] = $friend->getGUID(); - } - } - - if ($options) - { - echo elgg_view('input/checkboxes',array( - - 'internalname' => 'user_guid', - 'options' => $options, - - )); - } - else - { - echo elgg_echo('groups:nofriends'); - } - } -?>
\ No newline at end of file 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 index fa47cdd62..e49a996b7 100644 --- a/mod/groups/views/default/widgets/a_users_groups/edit.php +++ b/mod/groups/views/default/widgets/a_users_groups/edit.php @@ -1,14 +1,25 @@ -<p> - <?php echo elgg_echo("groups:widget:num_display"); ?>: - <select name="params[num_display]"> - <option value="1" <?php if($vars['entity']->num_display == 1) echo "SELECTED"; ?>>1</option> - <option value="2" <?php if($vars['entity']->num_display == 2) echo "SELECTED"; ?>>2</option> - <option value="3" <?php if($vars['entity']->num_display == 3) echo "SELECTED"; ?>>3</option> - <option value="4" <?php if($vars['entity']->num_display == 4) echo "SELECTED"; ?>>4</option> - <option value="5" <?php if($vars['entity']->num_display == 5) echo "SELECTED"; ?>>5</option> - <option value="6" <?php if($vars['entity']->num_display == 6) echo "SELECTED"; ?>>6</option> - <option value="7" <?php if($vars['entity']->num_display == 7) echo "SELECTED"; ?>>7</option> - <option value="8" <?php if($vars['entity']->num_display == 8) echo "SELECTED"; ?>>8</option> - <option value="9" <?php if($vars['entity']->num_display == 9) echo "SELECTED"; ?>>9</option> - </select> -</p>
\ No newline at end of file +<?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> diff --git a/mod/groups/views/default/widgets/a_users_groups/view.php b/mod/groups/views/default/widgets/a_users_groups/view.php deleted file mode 100644 index 3328a8778..000000000 --- a/mod/groups/views/default/widgets/a_users_groups/view.php +++ /dev/null @@ -1,42 +0,0 @@ -<?php - - /** - * Group profile widget - this displays a users groups on their profile - **/ - - //the number of groups to display - $number = (int) $vars['entity']->num_display; - if (!$number) - $number = 4; - - //the page owner - $owner = $vars['entity']->owner_guid; - - //$groups = get_users_membership($owner); - //$groups = list_entities_from_relationship('member',$owner,false,'group','',0,$number,false,false,false); - $groups = get_entities_from_relationship('member', $owner, false, "group", "", 0, "", $number, 0, false, 0); - - - if($groups){ - - echo "<div class=\"groupmembershipwidget\">"; - - foreach($groups as $group){ - $icon = elgg_view( - "groups/icon", array( - 'entity' => $group, - 'size' => 'small', - ) - ); - - echo "<div class=\"contentWrapper\">" . $icon . " <div class='search_listing_info'><p><span>" . $group->name . "</span><br />"; - echo $group->briefdescription . "</p></div><div class=\"clearfloat\"></div></div>"; - - } - echo "</div>"; - } - - - // echo $groups; - -?>
\ No newline at end of file diff --git a/mod/groups/views/default/widgets/group_entities_widget/edit.php b/mod/groups/views/default/widgets/group_entities_widget/edit.php deleted file mode 100644 index dbf82b2ec..000000000 --- a/mod/groups/views/default/widgets/group_entities_widget/edit.php +++ /dev/null @@ -1,23 +0,0 @@ -<?php - /** - * Edit the widget - * - * @package ElggGroups - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider Ltd - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - */ -?> -<p> - <?php echo elgg_echo('groups:widgets:entities:label:displaynum'); ?> - - <select name="params[limit]"> - <option value="5" <?php if ($vars['entity']->limit == 5) echo " selected=\"yes\" "; ?>>5</option> - <option value="8" <?php if ((!$vars['entity']->limit) || ($vars['entity']->limit == 8)) echo " selected=\"yes\" "; ?>>8</option> - <option value="12" <?php if ($vars['entity']->limit == 12) echo " selected=\"yes\" "; ?>>12</option> - <option value="15" <?php if ($vars['entity']->limit == 15) echo " selected=\"yes\" "; ?>>15</option> - </select> - - <input type="hidden" name="params[group_guid]" value="<?php echo get_input('group_guid'); ?>" /> -</p>
\ No newline at end of file diff --git a/mod/groups/views/default/widgets/group_entities_widget/view.php b/mod/groups/views/default/widgets/group_entities_widget/view.php deleted file mode 100644 index edba53cb5..000000000 --- a/mod/groups/views/default/widgets/group_entities_widget/view.php +++ /dev/null @@ -1,35 +0,0 @@ -<?php - /** - * View the widget - * - * @package ElggGroups - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider Ltd - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - */ - - $group_guid = get_input('group_guid'); - $limit = get_input('limit', 8); - $offset = 0; - - if ($vars['entity']->limit) - $limit = $vars['entity']->limit; - - $group_guid = $vars['entity']->group_guid; - - if ($group_guid) - { - $group = get_entity($group_guid); - $members = $group->getMembers($limit, $offset); - $count = $group->getMembers($limit, $offset, true); - - $result = list_entities_groups("", 0, $group_guid, $limit); - } - else - { - $result = elgg_echo('groups:widgets:entities:label:pleaseedit'); - } - - echo $result; -?>
\ No newline at end of file diff --git a/mod/groups/views/default/widgets/group_members_widget/edit.php b/mod/groups/views/default/widgets/group_members_widget/edit.php deleted file mode 100644 index 6d385c204..000000000 --- a/mod/groups/views/default/widgets/group_members_widget/edit.php +++ /dev/null @@ -1,23 +0,0 @@ -<?php - /** - * Edit the widget - * - * @package ElggGroups - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider Ltd - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - */ -?> -<p> - <?php echo elgg_echo('groups:widgets:members:label:displaynum'); ?> - - <select name="params[limit]"> - <option value="5" <?php if ($vars['entity']->limit == 5) echo " selected=\"yes\" "; ?>>5</option> - <option value="8" <?php if ((!$vars['entity']->limit) || ($vars['entity']->limit == 8)) echo " selected=\"yes\" "; ?>>8</option> - <option value="12" <?php if ($vars['entity']->limit == 12) echo " selected=\"yes\" "; ?>>12</option> - <option value="15" <?php if ($vars['entity']->limit == 15) echo " selected=\"yes\" "; ?>>15</option> - </select> - - <input type="hidden" name="params[group_guid]" value="<?php echo get_input('group_guid'); ?>" /> -</p>
\ No newline at end of file diff --git a/mod/groups/views/default/widgets/group_members_widget/view.php b/mod/groups/views/default/widgets/group_members_widget/view.php deleted file mode 100644 index 502affd12..000000000 --- a/mod/groups/views/default/widgets/group_members_widget/view.php +++ /dev/null @@ -1,35 +0,0 @@ -<?php - /** - * View the widget - * - * @package ElggGroups - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider Ltd - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - */ - - $group_guid = get_input('group_guid'); - $limit = get_input('limit', 8); - $offset = 0; - - if ($vars['entity']->limit) - $limit = $vars['entity']->limit; - - $group_guid = $vars['entity']->group_guid; - - if ($group_guid) - { - $group = get_entity($group_guid); - $members = $group->getMembers($limit, $offset); - $count = $group->getMembers($limit, $offset, true); - - $result = elgg_view_entity_list($members, $count, $offset, $limit, false, false, false); - } - else - { - $result = elgg_echo('groups:widgets:members:label:pleaseedit'); - } - - echo $result; -?>
\ No newline at end of file |
