diff options
author | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-03-03 17:53:05 +0000 |
---|---|---|
committer | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-03-03 17:53:05 +0000 |
commit | 4766f36a4d74924f21ff329c4318ce4e069ffa04 (patch) | |
tree | 969b84632f2a8b0db79788a8a6db8e41d63e5cb4 /mod/groups | |
parent | 57a217fd6b708844407486046a1faa23b46cac08 (diff) | |
download | elgg-4766f36a4d74924f21ff329c4318ce4e069ffa04.tar.gz elgg-4766f36a4d74924f21ff329c4318ce4e069ffa04.tar.bz2 |
Pulled in the interface changes.
git-svn-id: http://code.elgg.org/elgg/trunk@5257 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/groups')
89 files changed, 4557 insertions, 0 deletions
diff --git a/mod/groups/actions/addtogroup.php b/mod/groups/actions/addtogroup.php new file mode 100644 index 000000000..0b99ea917 --- /dev/null +++ b/mod/groups/actions/addtogroup.php @@ -0,0 +1,96 @@ +<?php + + /** + * Add a user to a group + * + * @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/ + */ + + // Load configuration + global $CONFIG; + + gatekeeper(); + + $logged_in_user = get_loggedin_user(); + + $user_guid = get_input('user_guid'); + if (!is_array($user_guid)) + $user_guid = array($user_guid); + $group_guid = get_input('group_guid'); + + if (sizeof($user_guid)) + { + foreach ($user_guid as $u_id) + { + $user = get_entity($u_id); + $group = get_entity($group_guid); + + if ( $user && $group) { + + //if (get_loggedin_userid() == $group->owner_guid) + if ($group->canEdit()) + { + + // If the group is open or the user has requested membership + if ( + (check_entity_relationship($user->guid, 'membership_request', $group->guid)) || + ($group->isPublicMembership()) + ) + { + + if (!$group->isMember($user)) + { + // Remove relationships + remove_entity_relationship($group->guid, 'invited', $user->guid); + remove_entity_relationship($user->guid, 'membership_request', $group->guid); + + //add_entity_relationship($user->guid, 'member', $group->guid); + $group->join($user); + + // send welcome email + notify_user($user->getGUID(), $group->owner_guid, + sprintf(elgg_echo('groups:welcome:subject'), $group->name), + sprintf(elgg_echo('groups:welcome:body'), $user->name, $logged_in_user->name, $group->name, $group->getURL()), + NULL); + + system_message(elgg_echo('groups:addedtogroup')); + } + else + register_error(elgg_echo("groups:cantjoin")); + } + else + { + if ($user->isFriend()) + { + + // Create relationship + add_entity_relationship($group->guid, 'invited', $user->guid); + + // Send email + $url = "{$CONFIG->url}pg/groups/invited?user_guid={$user->guid}&group_guid={$group->guid}"; + if (notify_user($user->getGUID(), $group->owner_guid, + sprintf(elgg_echo('groups:invite:subject'), $user->name, $group->name), + sprintf(elgg_echo('groups:invite:body'), $user->name, $logged_in_user->name, $group->name, $url), + NULL)) + system_message(elgg_echo("groups:userinvited")); + else + register_error(elgg_echo("groups:usernotinvited")); + + } + else + register_error(elgg_echo("groups:usernotinvited")); + } + } + else + register_error(elgg_echo("groups:notowner")); + } + } + } + + forward($_SERVER['HTTP_REFERER']); + +?> diff --git a/mod/groups/actions/delete.php b/mod/groups/actions/delete.php new file mode 100644 index 000000000..b4bc71838 --- /dev/null +++ b/mod/groups/actions/delete.php @@ -0,0 +1,19 @@ +<?php + global $CONFIG; + + $guid = (int)get_input('group_guid'); + $entity = get_entity($guid); + + if (($entity) && ($entity instanceof ElggGroup)) + { + if ($entity->delete()) + system_message(elgg_echo('group:deleted')); + else + register_error(elgg_echo('group:notdeleted')); + } + else + register_error(elgg_echo('group:notdeleted')); + + $url_name = $_SESSION['user']->username; + forward("{$vars['url']}pg/groups/member/{$url_name}"); +?>
\ No newline at end of file diff --git a/mod/groups/actions/edit.php b/mod/groups/actions/edit.php new file mode 100644 index 000000000..b6eb3eb71 --- /dev/null +++ b/mod/groups/actions/edit.php @@ -0,0 +1,153 @@ +<?php + /** + * Elgg groups plugin edit action. + * + * @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/ + */ + + // Load configuration + global $CONFIG; + + // Get group fields + $input = array(); + foreach($CONFIG->group as $shortname => $valuetype) { + $input[$shortname] = get_input($shortname); + if ($valuetype == 'tags') + $input[$shortname] = string_to_tag_array($input[$shortname]); + } + + $user_guid = get_input('user_guid'); + $user = NULL; + if (!$user_guid) $user = $_SESSION['user']; + else + $user = get_entity($user_guid); + + $group_guid = get_input('group_guid'); + + $group = new ElggGroup($group_guid); // load if present, if not create a new group + if (($group_guid) && (!$group->canEdit())) + { + register_error(elgg_echo("groups:cantedit")); + + forward($_SERVER['HTTP_REFERER']); + exit; + } + + // Assume we can edit or this is a new group + if (sizeof($input) > 0) + { + foreach($input as $shortname => $value) { + $group->$shortname = $value; + } + } + + // Validate create + if (!$group->name) + { + register_error(elgg_echo("groups:notitle")); + + forward($_SERVER['HTTP_REFERER']); + exit; + } + + // Group membership - should these be treated with same constants as access permissions? + switch (get_input('membership')) + { + case ACCESS_PUBLIC: + $group->membership = ACCESS_PUBLIC; + break; + default: + $group->membership = ACCESS_PRIVATE; + } + + // Set access - all groups are public from elgg's point of view, unless the override is in place + + if (get_plugin_setting('hidden_groups', 'groups') == 'yes') + { + $visibility = (int)get_input('vis','',false); + + $group->access_id = $visibility; + } + else + $group->access_id = ACCESS_PUBLIC; + + // Set group tool options + //$group->files_enable = get_input('files_enable', 'yes'); + //$group->pages_enable = get_input('pages_enable', 'yes'); + //$group->forum_enable = get_input('forum_enable', 'yes'); + + // Set group tool options + if (isset($CONFIG->group_tool_options)) { + foreach($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'; + } + $group->$group_option_toggle_name = get_input($group_option_toggle_name, $group_option_default_value); + } + } + + $group->save(); + + if (!$group->isMember($user)) + $group->join($user); // Creator always a member + + + // Now see if we have a file icon + if ((isset($_FILES['icon'])) && (substr_count($_FILES['icon']['type'],'image/'))) + { + $prefix = "groups/".$group->guid; + + $filehandler = new ElggFile(); + $filehandler->owner_guid = $group->owner_guid; + $filehandler->setFilename($prefix . ".jpg"); + $filehandler->open("write"); + $filehandler->write(get_uploaded_file('icon')); + $filehandler->close(); + + $thumbtiny = get_resized_image_from_existing_file($filehandler->getFilenameOnFilestore(),25,25, true); + $thumbsmall = get_resized_image_from_existing_file($filehandler->getFilenameOnFilestore(),40,40, true); + $thumbmedium = get_resized_image_from_existing_file($filehandler->getFilenameOnFilestore(),100,100, true); + $thumblarge = get_resized_image_from_existing_file($filehandler->getFilenameOnFilestore(),200,200, false); + if ($thumbtiny) { + + $thumb = new ElggFile(); + $thumb->owner_guid = $group->owner_guid; + $thumb->setMimeType('image/jpeg'); + + $thumb->setFilename($prefix."tiny.jpg"); + $thumb->open("write"); + $thumb->write($thumbtiny); + $thumb->close(); + + $thumb->setFilename($prefix."small.jpg"); + $thumb->open("write"); + $thumb->write($thumbsmall); + $thumb->close(); + + $thumb->setFilename($prefix."medium.jpg"); + $thumb->open("write"); + $thumb->write($thumbmedium); + $thumb->close(); + + $thumb->setFilename($prefix."large.jpg"); + $thumb->open("write"); + $thumb->write($thumblarge); + $thumb->close(); + + $group->icontime = time(); + } + } + + system_message(elgg_echo("groups:saved")); + + // Forward to the user's profile + forward($group->getUrl()); + exit; +?> diff --git a/mod/groups/actions/featured.php b/mod/groups/actions/featured.php new file mode 100644 index 000000000..2d16113df --- /dev/null +++ b/mod/groups/actions/featured.php @@ -0,0 +1,44 @@ +<?php + + /** + * Join a group action. + * + * @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/ + */ + + // Load configuration + global $CONFIG; + + admin_gatekeeper(); + + $group_guid = get_input('group_guid'); + $action = get_input('action'); + + $group = get_entity($group_guid); + + if($group){ + + //get the action, is it to feature or unfeature + if($action == "feature"){ + + $group->featured_group = "yes"; + system_message(elgg_echo('groups:featuredon')); + + } + + if($action == "unfeature"){ + + $group->featured_group = "no"; + system_message(elgg_echo('groups:unfeatured')); + + } + + } + + forward("pg/groups/world/"); + +?>
\ No newline at end of file diff --git a/mod/groups/actions/forums/addpost.php b/mod/groups/actions/forums/addpost.php new file mode 100644 index 000000000..c277b795d --- /dev/null +++ b/mod/groups/actions/forums/addpost.php @@ -0,0 +1,58 @@ +<?php + +/** + * Elgg groups: add post to a topic + * + * @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.org/ + */ + +// Make sure we're logged in and have a CSRF token +gatekeeper(); + +// Get input +$topic_guid = (int) get_input('topic_guid'); +$group_guid = (int) get_input('group_guid'); +$post = get_input('topic_post'); + + +// make sure we have text in the post +if (!$post) { + register_error(elgg_echo("grouppost:nopost")); + forward($_SERVER['HTTP_REFERER']); +} + + +// Check that user is a group member +$group = get_entity($group_guid); +$user = get_loggedin_user(); +if (!$group->isMember($user)) { + register_error(elgg_echo("groups:notmember")); + forward($_SERVER['HTTP_REFERER']); +} + + +// Let's see if we can get an form topic with the specified GUID, and that it's a group forum topic +$topic = get_entity($topic_guid); +if (!$topic || $topic->getSubtype() != "groupforumtopic") { + register_error(elgg_echo("grouptopic:notfound")); + forward($_SERVER['HTTP_REFERER']); +} + + +// add the post to the forum topic +$post_id = $topic->annotate('group_topic_post', $post, $topic->access_id, $user->guid); +if ($post_id == false) { + system_message(elgg_echo("groupspost:failure")); + forward($_SERVER['HTTP_REFERER']); +} + +// add to river +add_to_river('river/forum/create', 'create', $user->guid, $topic_guid, "", 0, $post_id); + +system_message(elgg_echo("groupspost:success")); + +forward($_SERVER['HTTP_REFERER']); diff --git a/mod/groups/actions/forums/addtopic.php b/mod/groups/actions/forums/addtopic.php new file mode 100644 index 000000000..740ea17aa --- /dev/null +++ b/mod/groups/actions/forums/addtopic.php @@ -0,0 +1,81 @@ +<?php + + /** + * Elgg groups plugin add topic action. + * + * @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/ + */ + + // Make sure we're logged in; forward to the front page if not + if (!isloggedin()) forward(); + + // Check the user is a group member + $group_entity = get_entity(get_input('group_guid')); + if (!$group_entity->isMember($vars['user'])) forward(); + + // Get input data + $title = get_input('topictitle'); + $message = get_input('topicmessage'); + $tags = get_input('topictags'); + $access = get_input('access_id'); + $group_guid = (int) get_input('group_guid'); + $user = $_SESSION['user']->getGUID(); // you need to be logged in to comment on a group forum + $status = get_input('status'); // sticky, resolved, closed + + // Convert string of tags into a preformatted array + $tagarray = string_to_tag_array($tags); + + // Make sure the title / message aren't blank + if (empty($title) || empty($message)) { + register_error(elgg_echo("grouptopic:blank")); + forward("pg/groups/forum/{$group_guid}/"); + + // Otherwise, save the topic + } else { + + // Initialise a new ElggObject + $grouptopic = new ElggObject(); + // Tell the system it's a group forum topic + $grouptopic->subtype = "groupforumtopic"; + // Set its owner to the current user + $grouptopic->owner_guid = $user; + // Set the group it belongs to + $grouptopic->container_guid = $group_guid; + // For now, set its access to public (we'll add an access dropdown shortly) + $grouptopic->access_id = $access; + // Set its title and description appropriately + $grouptopic->title = $title; + // Before we can set metadata, we need to save the topic + if (!$grouptopic->save()) { + register_error(elgg_echo("grouptopic:error")); + forward("pg/groups/forum/{$group_guid}/"); + } + // Now let's add tags. We can pass an array directly to the object property! Easy. + if (is_array($tagarray)) { + $grouptopic->tags = $tagarray; + } + // add metadata + $grouptopic->status = $status; // the current status i.e sticky, closed, resolved, open + + // now add the topic message as an annotation + $grouptopic->annotate('group_topic_post',$message,$access, $user); + + // add to river + add_to_river('river/forum/topic/create','create',$_SESSION['user']->guid,$grouptopic->guid); + + // Success message + system_message(elgg_echo("grouptopic:created")); + + // Forward to the group forum page + global $CONFIG; + $url = $CONFIG->wwwroot . "pg/groups/forum/{$group_guid}/"; + forward($url); + + } + +?> + diff --git a/mod/groups/actions/forums/deletepost.php b/mod/groups/actions/forums/deletepost.php new file mode 100644 index 000000000..4066b7456 --- /dev/null +++ b/mod/groups/actions/forums/deletepost.php @@ -0,0 +1,44 @@ +<?php + + /** + * Elgg Groups: delete topic comment action + * + * @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.org/ + */ + + // Ensure we're logged in + if (!isloggedin()) forward(); + + + // Make sure we can get the comment in question + $post_id = (int) get_input('post'); + $group_guid = (int) get_input('group'); + $topic_guid = (int) get_input('topic'); + + if ($post = get_annotation($post_id)) { + + //check that the user can edit as well as admin + if ($post->canEdit() || ($post->owner_guid == $_SESSION['user']->guid)) { + + //delete + $post->delete(); + //display confirmation message + system_message(elgg_echo("grouppost:deleted")); + + } + + } else { + $url = ""; + system_message(elgg_echo("grouppost:notdeleted")); + } + + // Forward to the group forum page + global $CONFIG; + $url = $CONFIG->wwwroot . "mod/groups/topicposts.php?topic={$topic_guid}&group_guid={$group_guid}"; + forward($url); + +?>
\ No newline at end of file diff --git a/mod/groups/actions/forums/deletetopic.php b/mod/groups/actions/forums/deletetopic.php new file mode 100644 index 000000000..1095fc44a --- /dev/null +++ b/mod/groups/actions/forums/deletetopic.php @@ -0,0 +1,45 @@ +<?php + + /** + * Elgg Groups: delete topic action + * + * @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.org/ + */ + + // Make sure we're logged in; forward to the front page if not + if (!isloggedin()) forward(); + + // Check the user is a group member + $group_entity = get_entity(get_input('group')); + if (!$group_entity->isMember($vars['user'])) forward(); + + // Get input data + $topic_guid = (int) get_input('topic'); + $group_guid = (int) get_input('group'); + + // Make sure we actually have permission to edit + $topic = get_entity($topic_guid); + if ($topic->getSubtype() == "groupforumtopic") { + + // Get owning user + // $owner = get_entity($topic->getOwner()); + // Delete it! + $rowsaffected = $topic->delete(); + if ($rowsaffected > 0) { + // Success message + system_message(elgg_echo("groupstopic:deleted")); + } else { + system_message(elgg_echo("groupstopic:notdeleted")); + } + // Forward to the group forum page + global $CONFIG; + $url = $CONFIG->wwwroot . "pg/groups/forum/{$group_guid}/"; + forward($url); + + } + +?>
\ No newline at end of file diff --git a/mod/groups/actions/forums/editpost.php b/mod/groups/actions/forums/editpost.php new file mode 100644 index 000000000..d30fad31f --- /dev/null +++ b/mod/groups/actions/forums/editpost.php @@ -0,0 +1,53 @@ +<?php + + /** + * Elgg groups plugin edit post action. + * + * @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/ + */ + + // Make sure we're logged in (send us to the front page if not) + if (!isloggedin()) forward(); + + // Check the user is a group member + $group_guid = get_input('group'); + $group_entity = get_entity($group_guid); + if (!$group_entity->isMember($vars['user'])) forward(); + + //get the required variables + $post = get_input("post"); + $field_num = get_input("field_num"); + $post_comment = get_input("postComment{$field_num}"); + $annotation = get_annotation($post); + $commentOwner = $annotation->owner_guid; + $access_id = $annotation->access_id; + $topic = get_input("topic"); + + if($annotation){ + + //can edit? Either the comment owner or admin can + if(groups_can_edit_discussion($annotation, page_owner_entity()->owner_guid)){ + + update_annotation($post, "group_topic_post", $post_comment, "",$commentOwner, $access_id); + system_message(elgg_echo("groups:forumpost:edited")); + + }else{ + system_message(elgg_echo("groups:forumpost:error")); + } + + }else{ + + system_message(elgg_echo("groups:forumpost:error")); + } + + // Forward to the group forum page + global $CONFIG; + $url = $CONFIG->wwwroot . "mod/groups/topicposts.php?topic={$topic}&group_guid={$group_guid}/"; + forward($url); + + +?>
\ No newline at end of file diff --git a/mod/groups/actions/forums/edittopic.php b/mod/groups/actions/forums/edittopic.php new file mode 100644 index 000000000..2898c31dc --- /dev/null +++ b/mod/groups/actions/forums/edittopic.php @@ -0,0 +1,87 @@ +<?php + + /** + * Elgg groups plugin edit topic action. + * + * @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/ + */ + + // Make sure we're logged in (send us to the front page if not) + if (!isloggedin()) forward(); + + // Check the user is a group member + $group_entity = get_entity(get_input('group_guid')); + if (!$group_entity->isMember($vars['user'])) forward(); + + + // Get input data + $title = get_input('topictitle'); + $message = get_input('topicmessage'); + $message_id = get_input('message_id'); + $tags = get_input('topictags'); + $topic_guid = get_input('topic'); + $access = get_input('access_id'); + $group_guid = get_input('group_guid'); + //$user = $_SESSION['user']->getGUID(); // you need to be logged in to comment on a group forum + $status = get_input('status'); // sticky, resolved, closed + + // Convert string of tags into a preformatted array + $tagarray = string_to_tag_array($tags); + + // Make sure we actually have permission to edit + $topic = get_entity($topic_guid); + if ($topic) + { + + $user = $topic->getOwner(); + + if ($topic->getSubtype() == "groupforumtopic") { + + // Convert string of tags into a preformatted array + $tagarray = string_to_tag_array($tags); + + // Make sure the title isn't blank + if (empty($title) || empty($message)) { + register_error(elgg_echo("groupstopic:blank")); + + // Otherwise, save the forum + } else { + + $topic->access_id = $access; + + // Set its title + $topic->title = $title; + + // if no tags are present, clear existing ones + if (is_array($tagarray)) { + $topic->tags = $tagarray; + } else $topic->clearMetadata('tags'); + + // edit metadata + $topic->status = $status; // the current status i.e sticky, closed, resolved + + // now let's edit the message annotation + update_annotation($message_id, "group_topic_post", $message, "",$user, $access); + + // save the changes + if (!$topic->save()) { + // register_error(elgg_echo("forumtopic:error")); + } + + // Success message + system_message(elgg_echo("groups:forumtopic:edited")); + + } + } + } + // Forward to the group forum page + global $CONFIG; + $url = $CONFIG->wwwroot . "pg/groups/forum/{$group_guid}/"; + forward($url); + +?> + diff --git a/mod/groups/actions/groupskillinvitation.php b/mod/groups/actions/groupskillinvitation.php new file mode 100644 index 000000000..78c920df0 --- /dev/null +++ b/mod/groups/actions/groupskillinvitation.php @@ -0,0 +1,32 @@ +<?php + /** + * Delete an invitation to join a closed group. + * + * @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/ + */ + + // Load configuration + global $CONFIG; + + gatekeeper(); + + $user_guid = get_input('user_guid', get_loggedin_userid()); + $group_guid = get_input('group_guid'); + + $user = get_entity($user_guid); + $group = get_entity($group_guid); + + // If join request made + if (check_entity_relationship($group->guid, 'invited', $user->guid)) + { + remove_entity_relationship($group->guid, 'invited', $user->guid); + system_message(elgg_echo("groups:joinrequestkilled")); + } + + forward($_SERVER['HTTP_REFERER']); + +?>
\ No newline at end of file diff --git a/mod/groups/actions/groupskillrequest.php b/mod/groups/actions/groupskillrequest.php new file mode 100644 index 000000000..03a318e4a --- /dev/null +++ b/mod/groups/actions/groupskillrequest.php @@ -0,0 +1,32 @@ +<?php + /** + * Delete a user request to join a closed group. + * + * @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/ + */ + + // Load configuration + global $CONFIG; + + gatekeeper(); + + $user_guid = get_input('user_guid', get_loggedin_userid()); + $group_guid = get_input('group_guid'); + + $user = get_entity($user_guid); + $group = get_entity($group_guid); + + // If join request made + if (check_entity_relationship($user->guid, 'membership_request', $group->guid)) + { + remove_entity_relationship($user->guid, 'membership_request', $group->guid); + system_message(elgg_echo("groups:joinrequestkilled")); + } + + forward($_SERVER['HTTP_REFERER']); + +?>
\ No newline at end of file diff --git a/mod/groups/actions/invite.php b/mod/groups/actions/invite.php new file mode 100644 index 000000000..d2fd75c28 --- /dev/null +++ b/mod/groups/actions/invite.php @@ -0,0 +1,69 @@ +<?php + +/** + * Invite a user to join a group + * + * @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/ + */ + +// Load configuration +global $CONFIG; + +gatekeeper(); + +$logged_in_user = get_loggedin_user(); + +$user_guid = get_input('user_guid'); +if (!is_array($user_guid)) + $user_guid = array($user_guid); +$group_guid = get_input('group_guid'); + +if (sizeof($user_guid)) +{ + foreach ($user_guid as $u_id) + { + $user = get_entity($u_id); + $group = get_entity($group_guid); + + if ( $user && $group) { + + if (get_loggedin_userid() == $group->owner_guid) + { + if (!check_entity_relationship($group->guid, 'invited', $user->guid)) + { + if ($user->isFriend()) + { + + // Create relationship + add_entity_relationship($group->guid, 'invited', $user->guid); + + // Send email + $url = "{$CONFIG->url}pg/groups/invitations/{$user->username}"; + if (notify_user($user->getGUID(), $group->owner_guid, + sprintf(elgg_echo('groups:invite:subject'), $user->name, $group->name), + sprintf(elgg_echo('groups:invite:body'), $user->name, $logged_in_user->name, $group->name, $url), + NULL)) + system_message(elgg_echo("groups:userinvited")); + else + register_error(elgg_echo("groups:usernotinvited")); + + } + else + register_error(elgg_echo("groups:usernotinvited")); + } + else + register_error(elgg_echo("groups:useralreadyinvited")); + } + else + register_error(elgg_echo("groups:notowner")); + } + } +} + +forward($_SERVER['HTTP_REFERER']); + +?> diff --git a/mod/groups/actions/join.php b/mod/groups/actions/join.php new file mode 100644 index 000000000..3947f8efc --- /dev/null +++ b/mod/groups/actions/join.php @@ -0,0 +1,65 @@ +<?php + /** + * Join a group action. + * + * @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/ + */ + + // Load configuration + global $CONFIG; + + gatekeeper(); + + $user_guid = get_input('user_guid', get_loggedin_userid()); + $group_guid = get_input('group_guid'); + + // @todo fix for #287 + // disable access to get entity. + $invitations = groups_get_invited_groups($user_guid, TRUE); + + if (in_array($group_guid, $invitations)) { + $ia = elgg_set_ignore_access(TRUE); + } + + $user = get_entity($user_guid); + $group = get_entity($group_guid); + + if (($user instanceof ElggUser) && ($group instanceof ElggGroup)) + { + if ($group->isPublicMembership()) + { + if ($group->join($user)) + { + system_message(elgg_echo("groups:joined")); + + // Remove any invite or join request flags + remove_entity_relationship($group->guid, 'invited', $user->guid); + remove_entity_relationship($user->guid, 'membership_request', $group->guid); + + // add to river + add_to_river('river/group/create','join',$user->guid,$group->guid); + + forward($group->getURL()); + exit; + } + else + register_error(elgg_echo("groups:cantjoin")); + } + else + { + // Closed group, request membership + system_message(elgg_echo('groups:privategroup')); + forward(elgg_add_action_tokens_to_url($CONFIG->url . "action/groups/joinrequest?user_guid=$user_guid&group_guid=$group_guid")); + exit; + } + } + else + register_error(elgg_echo("groups:cantjoin")); + + forward($_SERVER['HTTP_REFERER']); + exit; +?> diff --git a/mod/groups/actions/joinrequest.php b/mod/groups/actions/joinrequest.php new file mode 100644 index 000000000..51c400223 --- /dev/null +++ b/mod/groups/actions/joinrequest.php @@ -0,0 +1,84 @@ +<?php +/** + * User requests to join a closed group. + * + * @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/ + */ + +// Load configuration +global $CONFIG; + +gatekeeper(); + +$user_guid = get_input('user_guid', get_loggedin_userid()); +$group_guid = get_input('group_guid'); + + +// @todo fix for #287 +// disable access to get entity. +$invitations = groups_get_invited_groups($user_guid, TRUE); + +if (in_array($group_guid, $invitations)) { + $ia = elgg_set_ignore_access(TRUE); +} + + +$user = get_entity($user_guid); +$group = get_entity($group_guid); + +// If not a member of this group +if (($group) && ($user) && (!$group->isMember($user))) +{ + // If open group or invite exists + if ( + ($group->isPublicMembership()) || + (check_entity_relationship($group->guid, 'invited', $user->guid)) + ) + { + //$ia = elgg_set_ignore_access(TRUE); + if ($group->join($user)) + { + // Remove relationships + remove_entity_relationship($group->guid, 'invited', $user->guid); + remove_entity_relationship($user->guid, 'membership_request', $group->guid); + + // Group joined + system_message(elgg_echo('groups:joined')); + elgg_set_ignore_access($ia); + + forward($group->getURL()); + exit; + } + else { + elgg_set_ignore_access($ia); + system_message(elgg_echo('groups:cantjoin')); + } + } + else + { + // If join request not already made + if (!check_entity_relationship($user->guid, 'membership_request', $group->guid)) + { + // Add membership requested + add_entity_relationship($user->guid, 'membership_request', $group->guid); + + // Send email + $url = "{$CONFIG->url}mod/groups/membershipreq.php?group_guid={$group->guid}"; + if (notify_user($group->owner_guid, $user->getGUID(), + sprintf(elgg_echo('groups:request:subject'), $user->name, $group->name), + sprintf(elgg_echo('groups:request:body'), $group->getOwnerEntity()->name, $user->name, $group->name, $user->getURL(), $url), + NULL)) + system_message(elgg_echo("groups:joinrequestmade")); + else + register_error(elgg_echo("groups:joinrequestnotmade")); + } + else + system_message(elgg_echo("groups:joinrequestmade")); + } +} + +forward($_SERVER['HTTP_REFERER']);
\ No newline at end of file diff --git a/mod/groups/actions/leave.php b/mod/groups/actions/leave.php new file mode 100644 index 000000000..b68eb7607 --- /dev/null +++ b/mod/groups/actions/leave.php @@ -0,0 +1,43 @@ +<?php + /** + * Leave a group action. + * + * @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/ + */ + + // Load configuration + global $CONFIG; + + gatekeeper(); + + $user_guid = get_input('user_guid'); + $group_guid = get_input('group_guid'); + + $user = NULL; + if (!$user_guid) $user = $_SESSION['user']; + else + $user = get_entity($user_guid); + + $group = get_entity($group_guid); + + if (($user instanceof ElggUser) && ($group instanceof ElggGroup)) + { + if ($group->getOwner() != $_SESSION['guid']) { + if ($group->leave($user)) + system_message(elgg_echo("groups:left")); + else + register_error(elgg_echo("groups:cantleave")); + } else { + register_error(elgg_echo("groups:cantleave")); + } + } + else + register_error(elgg_echo("groups:cantleave")); + + forward($_SERVER['HTTP_REFERER']); + exit; +?>
\ No newline at end of file diff --git a/mod/groups/addtopic.php b/mod/groups/addtopic.php new file mode 100644 index 000000000..39ef62eec --- /dev/null +++ b/mod/groups/addtopic.php @@ -0,0 +1,29 @@ +<?php + + /** + * Elgg Groups add a forum topic 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/ + */ + + // Load Elgg engine + require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); + + gatekeeper(); + + $page_owner = set_page_owner((int) get_input('group_guid')); + + if (!(page_owner_entity() instanceof ElggGroup)) forward(); + + // sort the display + $area2 = elgg_view("forms/forums/addtopic"); + $body = elgg_view_layout('two_column_left_sidebar',$area1, $area2); + + // Display page + page_draw(elgg_echo('groups:addtopic'),$body); + +?>
\ No newline at end of file diff --git a/mod/groups/all.php b/mod/groups/all.php new file mode 100644 index 000000000..fd60ce90a --- /dev/null +++ b/mod/groups/all.php @@ -0,0 +1,71 @@ +<?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/ + */ + + require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); + + $limit = get_input("limit", 10); + $offset = get_input("offset", 0); + $tag = get_input("tag"); + $filter = get_input("filter"); + if(!$filter) + $filter = "active"; + + + // Get objects + $context = get_context(); + + set_context('search'); + if ($tag != "") + $objects = list_entities_from_metadata('tags',$tag,'group',"","", $limit, false); + else{ + switch($filter){ + case "newest": + $objects = elgg_list_entities(array('types' => 'group', 'owner_guid' => 0, 'limit' => $limit, 'full_view' => false)); + break; + case "pop": + $objects = list_entities_by_relationship_count('member', true, "", "", 0, $limit, false); + break; + case "active": + $objects = list_entities_from_annotations("object", "groupforumtopic", "group_topic_post", "", 40, 0, 0, false, true); + break; + case 'default': + $objects = elgg_list_entities(array('types' => 'group', 'limit' => $limit, 'full_view' => FALSE)); + break; + } + } + + //get a group count + $group_count = elgg_get_entities(array('types' => 'group', 'limit' => 10, 'count' => TRUE)); + + //find groups + $area1 = elgg_view("groups/find"); + + //menu options + $area1 .= elgg_view("groups/side_menu"); + + //featured groups + $featured_groups = elgg_get_entities_from_metadata(array('metadata_name' => 'featured_group', 'metadata_value' => 'yes', 'types' => 'group', 'limit' => 10)); + $area1 .= elgg_view("groups/featured", array("featured" => $featured_groups)); + + + set_context($context); + + $title = sprintf(elgg_echo("groups:all"),page_owner_entity()->name); + $area2 = elgg_view_title($title); + $area2 .= elgg_view('groups/contentwrapper', array('body' => elgg_view("groups/group_sort_menu", array("count" => $group_count, "filter" => $filter)) . $objects)); + $body = elgg_view_layout('sidebar_boxes',$area1, $area2); + + // Finally draw the page + page_draw($title, $body); + + + +?>
\ No newline at end of file diff --git a/mod/groups/discussions.php b/mod/groups/discussions.php new file mode 100644 index 000000000..64b73cd2b --- /dev/null +++ b/mod/groups/discussions.php @@ -0,0 +1,32 @@ +<?php + + /** + * Elgg all group forum discussions page + * This page will show all topic dicussions ordered by last comment, regardless of which group + * they are part of + * + * @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/ + */ + + // Load Elgg engine + require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); + + group_gatekeeper(); + + // Display them + $area2 = elgg_view_title(elgg_echo("groups:latestdiscussion")); + set_context('search'); + $area2 .= list_entities_from_annotations("object", "groupforumtopic", "group_topic_post", "", 40, 0, 0, false, true); + set_context('groups'); + + $body = elgg_view_layout("two_column_left_sidebar", '', $area2); + + // Display page + page_draw(elgg_echo('groups:latestdiscussion'),$body); + + +?>
\ No newline at end of file diff --git a/mod/groups/edit.php b/mod/groups/edit.php new file mode 100644 index 000000000..2e99b578c --- /dev/null +++ b/mod/groups/edit.php @@ -0,0 +1,33 @@ +<?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/ + */ + + require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); + gatekeeper(); + + $group_guid = get_input('group_guid'); + $group = get_entity($group_guid); + set_page_owner($group_guid); + + $title = elgg_echo("groups:edit"); + $body = elgg_view_title($title); + + if (($group) && ($group->canEdit())) + { + $body .= elgg_view("forms/groups/edit", array('entity' => $group)); + + } else { + $body .= elgg_view('groups/contentwrapper',array('body' => elgg_echo('groups:noaccess'))); + } + + $body = elgg_view_layout('two_column_left_sidebar', '', $body); + + page_draw($title, $body); +?>
\ No newline at end of file diff --git a/mod/groups/edittopic.php b/mod/groups/edittopic.php new file mode 100644 index 000000000..494c94ab9 --- /dev/null +++ b/mod/groups/edittopic.php @@ -0,0 +1,36 @@ +<?php + + /** + * Elgg Groups edit a forum topic 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/ + */ + + // Load Elgg engine + require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); + + gatekeeper(); + + get_input('group'); + $page_owner = set_page_owner((int)get_input('group')); + + // check the user is a member of the group + //if (!$page_owner->isMember($_SESSION['user'])) forward(); + + if (!(page_owner_entity() instanceof ElggGroup)) forward(); + + //get the topic + $topic = get_entity((int) get_input('topic')); + + // sort the display + $area2 = elgg_view("forms/forums/edittopic", array('entity' => $topic)); + $body = elgg_view_layout('two_column_left_sidebar', '', $area2); + + // Display page + page_draw(elgg_echo('groups:edittopic'),$body); + +?>
\ No newline at end of file diff --git a/mod/groups/forum.php b/mod/groups/forum.php new file mode 100644 index 000000000..91a592373 --- /dev/null +++ b/mod/groups/forum.php @@ -0,0 +1,35 @@ +<?php + /** + * Elgg groups forum + * + * @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/ + */ + + require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); + + set_page_owner((int)get_input('group_guid')); + if (!(page_owner_entity() instanceof ElggGroup)) forward(); + + group_gatekeeper(); + + //get any forum topics + //get any forum topics + $topics = list_entities_from_annotations("object", "groupforumtopic", "group_topic_post", "", 20, 0, get_input('group_guid'), false, false, false); + set_context('search'); + $area2 = elgg_view("forum/topics", array('topics' => $topics)); + set_context('groups'); + + $body = elgg_view_layout('two_column_left_sidebar',$area1, $area2); + + $title = elgg_echo('item:object:groupforumtopic'); + + // Finally draw the page + page_draw($title, $body); + + + +?>
\ No newline at end of file diff --git a/mod/groups/graphics/defaultlarge.gif b/mod/groups/graphics/defaultlarge.gif Binary files differnew file mode 100644 index 000000000..b0921b8d8 --- /dev/null +++ b/mod/groups/graphics/defaultlarge.gif diff --git a/mod/groups/graphics/defaultmedium.gif b/mod/groups/graphics/defaultmedium.gif Binary files differnew file mode 100644 index 000000000..ae230a3d7 --- /dev/null +++ b/mod/groups/graphics/defaultmedium.gif diff --git a/mod/groups/graphics/defaultsmall.gif b/mod/groups/graphics/defaultsmall.gif Binary files differnew file mode 100644 index 000000000..81d89110d --- /dev/null +++ b/mod/groups/graphics/defaultsmall.gif diff --git a/mod/groups/graphics/defaulttiny.gif b/mod/groups/graphics/defaulttiny.gif Binary files differnew file mode 100644 index 000000000..86dc96ae4 --- /dev/null +++ b/mod/groups/graphics/defaulttiny.gif diff --git a/mod/groups/graphics/icon.php b/mod/groups/graphics/icon.php new file mode 100644 index 000000000..8c596d53b --- /dev/null +++ b/mod/groups/graphics/icon.php @@ -0,0 +1,45 @@ +<?php + /** + * Icon 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/ + */ + + global $CONFIG; + require_once(dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php"); + + $group_guid = get_input('group_guid'); + $group = get_entity($group_guid); + + $size = strtolower(get_input('size')); + if (!in_array($size,array('large','medium','small','tiny','master','topbar'))) + $size = "medium"; + + $success = false; + + $filehandler = new ElggFile(); + $filehandler->owner_guid = $group->owner_guid; + $filehandler->setFilename("groups/" . $group->guid . $size . ".jpg"); + + $success = false; + if ($filehandler->open("read")) { + if ($contents = $filehandler->read($filehandler->size())) { + $success = true; + } + } + + if (!$success) { + $contents = @file_get_contents($CONFIG->pluginspath . "groups/graphics/default{$size}.jpg"); + } + + header("Content-type: image/jpeg"); + header('Expires: ' . date('r',time() + 864000)); + header("Pragma: public"); + header("Cache-Control: public"); + header("Content-Length: " . strlen($contents)); + echo $contents; +?>
\ No newline at end of file diff --git a/mod/groups/groupprofile.php b/mod/groups/groupprofile.php new file mode 100644 index 000000000..80cbd41ee --- /dev/null +++ b/mod/groups/groupprofile.php @@ -0,0 +1,60 @@ +<?php + /** + * Full group profile + * + * @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'); + set_context('groups'); + + global $autofeed; + $autofeed = true; + + $group = get_entity($group_guid); + if ($group) { + set_page_owner($group_guid); + + $title = $group->name; + + // Hide some items from closed groups when the user is not logged in. + $view_all = true; + + $groupaccess = group_gatekeeper(false); + if (!$groupaccess) + $view_all = false; + + + $area2 = elgg_view_title($title); + $area2 .= elgg_view('group/group', array('entity' => $group, 'user' => $_SESSION['user'], 'full' => true)); + + if ($view_all) { + //group profile 'items' - these are not real widgets, just contents to display + $area2 .= elgg_view('groups/profileitems',array('entity' => $group)); + + //group members + $area3 = elgg_view('groups/members',array('entity' => $group)); + } + else + { + $area2 .= elgg_view('groups/closedmembership', array('entity' => $group, 'user' => $_SESSION['user'], 'full' => true)); + + } + + $body = elgg_view_layout('two_column_left_sidebar', $area1, $area2, $area3); + } else { + $title = elgg_echo('groups:notfound'); + + $area2 = elgg_view_title($title); + $area2 .= elgg_view('groups/contentwrapper',array('body' => elgg_echo('groups:notfound:details'))); + + $body = elgg_view_layout('two_column_left_sidebar', "", $area2,""); + } + + // Finally draw the page + page_draw($title, $body); +?>
\ No newline at end of file diff --git a/mod/groups/index.php b/mod/groups/index.php new file mode 100644 index 000000000..b21d5962b --- /dev/null +++ b/mod/groups/index.php @@ -0,0 +1,31 @@ +<?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/ + */ + + require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); + + $limit = get_input("limit", 10); + $offset = get_input("offset", 0); + + $title = sprintf(elgg_echo("groups:owned"),page_owner_entity()->name); + + // Get objects + $area2 = elgg_view_title($title); + + set_context('search'); + $objects = elgg_list_entities(array('types' => 'group', 'owner_guid' => page_owner(), 'limit' => $limit, 'full_view' => FALSE)); + set_context('groups'); + + $area2 .= $objects; + $body = elgg_view_layout('two_column_left_sidebar',$area1, $area2); + + // Finally draw the page + page_draw($title, $body); +?>
\ No newline at end of file diff --git a/mod/groups/invitations.php b/mod/groups/invitations.php new file mode 100644 index 000000000..fa2156b35 --- /dev/null +++ b/mod/groups/invitations.php @@ -0,0 +1,33 @@ +<?php +/** + * Manage group invitation requests. + * + * @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/ + */ + +require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); +gatekeeper(); + +$user = get_loggedin_user(); + +$title = elgg_echo('groups:invitations'); + +$area2 = elgg_view_title($title); + +if ($user) { + // @todo temporary workaround for exts #287. + $invitations = groups_get_invited_groups($user->getGUID()); + + $area2 .= elgg_view('groups/invitationrequests',array('invitations' => $invitations)); + elgg_set_ignore_access($ia); +} else { + $area2 .= elgg_echo("groups:noaccess"); +} + +$body = elgg_view_layout('two_column_left_sidebar', '', $area2); + +page_draw($title, $body);
\ No newline at end of file diff --git a/mod/groups/invite.php b/mod/groups/invite.php new file mode 100644 index 000000000..3791b9b50 --- /dev/null +++ b/mod/groups/invite.php @@ -0,0 +1,34 @@ +<?php + /** + * Invite users to groups + * + * @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/ + */ + + require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); + gatekeeper(); + + $group_guid = (int) get_input('group_guid'); + $group = get_entity($group_guid); + set_page_owner($group_guid); + + $title = elgg_echo("groups:invite"); + + $area2 = elgg_view_title($title); + + if (($group) && ($group->canEdit())) + { + $area2 .= elgg_view("forms/groups/invite", array('entity' => $group)); + + } else { + $area2 .= elgg_echo("groups:noaccess"); + } + + $body = elgg_view_layout('two_column_left_sidebar', $area1, $area2); + + page_draw($title, $body); +?>
\ No newline at end of file diff --git a/mod/groups/languages/en.php b/mod/groups/languages/en.php new file mode 100644 index 000000000..6c0d8ef26 --- /dev/null +++ b/mod/groups/languages/en.php @@ -0,0 +1,228 @@ +<?php + /** + * Elgg groups plugin language pack + * + * @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/ + */ + + $english = array( + + /** + * Menu items and titles + */ + + 'groups' => "Groups", + 'groups:owned' => "Groups you own", + 'groups:yours' => "Your groups", + 'groups:user' => "%s's groups", + 'groups:all' => "All site groups", + 'groups:new' => "Create a new group", + 'groups:edit' => "Edit group", + 'groups:delete' => 'Delete group', + 'groups:membershiprequests' => 'Manage join requests', + 'groups:invitations' => 'Group invitations', + + 'groups:icon' => 'Group icon (leave blank to leave unchanged)', + 'groups:name' => 'Group name', + 'groups:username' => 'Group short name (displayed in URLs, alphanumeric characters only)', + 'groups:description' => 'Description', + 'groups:briefdescription' => 'Brief description', + 'groups:interests' => 'Tags', + 'groups:website' => 'Website', + 'groups:members' => 'Group members', + 'groups:membership' => "Group membership permissions", + 'groups:access' => "Access permissions", + 'groups:owner' => "Owner", + 'groups:widget:num_display' => 'Number of groups to display', + 'groups:widget:membership' => 'Group membership', + 'groups:widgets:description' => 'Display the groups you are a member of on your profile', + 'groups:noaccess' => 'No access to group', + 'groups:cantedit' => 'You can not edit this group', + 'groups:saved' => 'Group saved', + 'groups:featured' => 'Featured groups', + 'groups:makeunfeatured' => 'Unfeature', + 'groups:makefeatured' => 'Make featured', + 'groups:featuredon' => 'You have made this group a featured one.', + 'groups:unfeature' => 'You have removed this group from the featured list', + 'groups:joinrequest' => 'Request membership', + 'groups:join' => 'Join group', + 'groups:leave' => 'Leave group', + 'groups:invite' => 'Invite friends', + 'groups:inviteto' => "Invite friends to '%s'", + 'groups:nofriends' => "You have no friends left who have not been invited to this group.", + 'groups:viagroups' => "via groups", + 'groups:group' => "Group", + 'groups:search:tags' => "tag", + + 'groups:notfound' => "Group not found", + 'groups:notfound:details' => "The requested group either does not exist or you do not have access to it", + + 'groups:requests:none' => 'There are no outstanding membership requests at this time.', + + 'groups:invitations:none' => 'There are no oustanding invitations at this time.', + + 'item:object:groupforumtopic' => "Discussion topics", + + 'groupforumtopic:new' => "New discussion post", + + 'groups:count' => "groups created", + 'groups:open' => "open group", + 'groups:closed' => "closed group", + 'groups:member' => "members", + 'groups:searchtag' => "Search for groups by tag", + + + /* + * Access + */ + 'groups:access:private' => 'Closed - Users must be invited', + 'groups:access:public' => 'Open - Any user may join', + 'groups:closedgroup' => 'This group has a closed membership. To ask to be added, click the "request membership" menu link.', + 'groups:visibility' => 'Who can see this group?', + + /* + Group tools + */ + 'groups:enablepages' => 'Enable group pages', + 'groups:enableforum' => 'Enable group discussion', + 'groups:enablefiles' => 'Enable group files', + 'groups:yes' => 'yes', + 'groups:no' => 'no', + + 'group:created' => 'Created %s with %d posts', + 'groups:lastupdated' => 'Last updated %s by %s', + 'groups:pages' => 'Group pages', + 'groups:files' => 'Group files', + + /* + Group forum strings + */ + + 'group:replies' => 'Replies', + 'groups:forum' => 'Group discussion', + 'groups:addtopic' => 'Add a topic', + 'groups:forumlatest' => 'Latest discussion', + 'groups:latestdiscussion' => 'Latest discussion', + 'groups:newest' => 'Newest', + 'groups:popular' => 'Popular', + 'groupspost:success' => 'Your comment was succesfully posted', + 'groups:alldiscussion' => 'Latest discussion', + 'groups:edittopic' => 'Edit topic', + 'groups:topicmessage' => 'Topic message', + 'groups:topicstatus' => 'Topic status', + 'groups:reply' => 'Post a comment', + 'groups:topic' => 'Topic', + 'groups:posts' => 'Posts', + 'groups:lastperson' => 'Last person', + 'groups:when' => 'When', + 'grouptopic:notcreated' => 'No topics have been created.', + 'groups:topicopen' => 'Open', + 'groups:topicclosed' => 'Closed', + 'groups:topicresolved' => 'Resolved', + 'grouptopic:created' => 'Your topic was created.', + 'groupstopic:deleted' => 'The topic has been deleted.', + 'groups:topicsticky' => 'Sticky', + 'groups:topicisclosed' => 'This topic is closed.', + 'groups:topiccloseddesc' => 'This topic has now been closed and is not accepting new comments.', + 'grouptopic:error' => 'Your group topic could not be created. Please try again or contact a system administrator.', + 'groups:forumpost:edited' => "You have successfully edited the forum post.", + 'groups:forumpost:error' => "There was a problem editing the forum post.", + 'groups:privategroup' => 'This group is private, requesting membership.', + 'groups:notitle' => 'Groups must have a title', + 'groups:cantjoin' => 'Can not join group', + 'groups:cantleave' => 'Could not leave group', + 'groups:addedtogroup' => 'Successfully added the user to the group', + 'groups:joinrequestnotmade' => 'Could not request to join group', + 'groups:joinrequestmade' => 'Requested to join group', + 'groups:joined' => 'Successfully joined group!', + 'groups:left' => 'Successfully left group', + 'groups:notowner' => 'Sorry, you are not the owner of this group.', + 'groups:notmember' => 'Sorry, you are not a member of this group.', + 'groups:alreadymember' => 'You are already a member of this group!', + 'groups:userinvited' => 'User has been invited.', + 'groups:usernotinvited' => 'User could not be invited.', + 'groups:useralreadyinvited' => 'User has already been invited', + 'groups:updated' => "Last comment", + 'groups:invite:subject' => "%s you have been invited to join %s!", + 'groups:started' => "Started by", + 'groups:joinrequest:remove:check' => 'Are you sure you want to remove this join request?', + 'groups:invite:body' => "Hi %s, + +%s invited you to join the '%s' group, click below to confirm: + +%s", + + 'groups:welcome:subject' => "Welcome to the %s group!", + 'groups:welcome:body' => "Hi %s! + +You are now a member of the '%s' group! Click below to begin posting! + +%s", + + 'groups:request:subject' => "%s has requested to join %s", + 'groups:request:body' => "Hi %s, + +%s has requested to join the '%s' group, click below to view their profile: + +%s + +or click below to confirm request: + +%s", + + /* + Forum river items + */ + + 'groups:river:member' => 'is now a member of', + 'groupforum:river:updated' => '%s has updated', + 'groupforum:river:update' => 'this discussion topic', + 'groupforum:river:created' => '%s has created', + 'groupforum:river:create' => 'a new discussion topic titled', + 'groupforum:river:posted' => '%s has posted a new comment', + 'groupforum:river:annotate:create' => 'on this discussion topic', + 'groupforum:river:postedtopic' => '%s has started a new discussion topic titled', + 'groups:river:member' => '%s is now a member of', + 'groups:river:togroup' => 'to the group', + + 'groups:nowidgets' => 'No widgets have been defined for this group.', + + + 'groups:widgets:members:title' => 'Group members', + 'groups:widgets:members:description' => 'List the members of a group.', + 'groups:widgets:members:label:displaynum' => 'List the members of a group.', + 'groups:widgets:members:label:pleaseedit' => 'Please configure this widget.', + + 'groups:widgets:entities:title' => "Objects in group", + 'groups:widgets:entities:description' => "List the objects saved in this group", + 'groups:widgets:entities:label:displaynum' => 'List the objects of a group.', + 'groups:widgets:entities:label:pleaseedit' => 'Please configure this widget.', + + 'groups:forumtopic:edited' => 'Forum topic successfully edited.', + + 'groups:allowhiddengroups' => 'Do you want to allow private (invisible) groups?', + + /** + * Action messages + */ + 'group:deleted' => 'Group and group contents deleted', + 'group:notdeleted' => 'Group could not be deleted', + + 'grouppost:deleted' => 'Group posting successfully deleted', + 'grouppost:notdeleted' => 'Group posting could not be deleted', + 'groupstopic:deleted' => 'Topic deleted', + 'groupstopic:notdeleted' => 'Topic not deleted', + 'grouptopic:blank' => 'No topic', + 'grouptopic:notfound' => 'Could not find the topic', + 'grouppost:nopost' => 'Empty post', + 'groups:deletewarning' => "Are you sure you want to delete this group? There is no undo!", + + 'groups:joinrequestkilled' => 'The join request has been deleted.', + ); + + add_translation("en",$english); +?> diff --git a/mod/groups/manifest.xml b/mod/groups/manifest.xml new file mode 100644 index 000000000..e2c36f92f --- /dev/null +++ b/mod/groups/manifest.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<plugin_manifest> + <field key="author" value="Curverider ltd" /> + <field key="version" value="1.7" /> + <field key="description" value="Provides group support for elgg" /> + <field key="website" value="http://www.elgg.org/" /> + <field key="copyright" value="(C) Curverider 2008-2010" /> + <field key="licence" value="GNU Public License version 2" /> + <field key="elgg_version" value="2010030101" /> +</plugin_manifest> diff --git a/mod/groups/membership.php b/mod/groups/membership.php new file mode 100644 index 000000000..9226a56d5 --- /dev/null +++ b/mod/groups/membership.php @@ -0,0 +1,38 @@ +<?php + + /** + * Elgg groups 'member of' page + * + * @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/ + */ + + require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); + + gatekeeper(); + group_gatekeeper(); + + $limit = get_input("limit", 10); + $offset = get_input("offset", 0); + + if (page_owner() == $_SESSION['user']->guid) { + $title = elgg_echo("groups:yours"); + } else $title = sprintf(elgg_echo("groups:owned"),page_owner_entity()->name); + + // Get objects + $area2 = elgg_view_title($title); + + set_context('search'); + //$objects = list_entities("group", "", page_owner(), $limit, false); + $objects = list_entities_from_relationship('member',page_owner(),false,'group','',0, $limit,false, false); + set_context('groups'); + + $area2 .= $objects; + $body = elgg_view_layout('two_column_left_sidebar',$area1, $area2); + + // Finally draw the page + page_draw($title, $body); +?>
\ No newline at end of file diff --git a/mod/groups/membershipreq.php b/mod/groups/membershipreq.php new file mode 100644 index 000000000..368057711 --- /dev/null +++ b/mod/groups/membershipreq.php @@ -0,0 +1,36 @@ +<?php + /** + * Manage group invite requests. + * + * @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/ + */ + + require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); + gatekeeper(); + + $group_guid = (int) get_input('group_guid'); + $group = get_entity($group_guid); + set_page_owner($group_guid); + + $title = elgg_echo('groups:membershiprequests'); + + $area2 = elgg_view_title($title); + + if (($group) && ($group->canEdit())) + { + + $requests = elgg_get_entities_from_relationship(array('relationship' => 'membership_request', 'relationship_guid' => $group_guid, 'inverse_relationship' => TRUE, 'limit' => 9999)); + $area2 .= elgg_view('groups/membershiprequests',array('requests' => $requests, 'entity' => $group)); + + } else { + $area2 .= elgg_echo("groups:noaccess"); + } + + $body = elgg_view_layout('two_column_left_sidebar', $area1, $area2); + + page_draw($title, $body); +?>
\ No newline at end of file diff --git a/mod/groups/new.php b/mod/groups/new.php new file mode 100644 index 000000000..b2a24f80f --- /dev/null +++ b/mod/groups/new.php @@ -0,0 +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/ + */ + + gatekeeper(); + + // Render the file upload page + $title = elgg_echo("groups:new"); + $area2 = elgg_view_title($title); + $area2 .= elgg_view("forms/groups/edit"); + + $body = elgg_view_layout('two_column_left_sidebar', $area1, $area2); + + page_draw($title, $body); +?>
\ No newline at end of file diff --git a/mod/groups/start.php b/mod/groups/start.php new file mode 100644 index 000000000..b9dde5d10 --- /dev/null +++ b/mod/groups/start.php @@ -0,0 +1,613 @@ +<?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/ + */ + + /** + * Initialise the groups plugin. + * Register actions, set up menus + */ + function groups_init() + { + + global $CONFIG; + + // Set up the menu for logged in users + if (isloggedin()) + { + add_menu(elgg_echo('groups'), $CONFIG->wwwroot . "pg/groups/world/"); + //add_menu(elgg_echo('groups:alldiscussion'),$CONFIG->wwwroot."mod/groups/discussions.php"); + } + else + { + add_menu(elgg_echo('groups'), $CONFIG->wwwroot . "pg/groups/world/"); + } + + // Register a page handler, so we can have nice URLs + register_page_handler('groups','groups_page_handler'); + + // Register a URL handler for groups and forum topics + register_entity_url_handler('groups_url','group','all'); + register_entity_url_handler('groups_groupforumtopic_url','object','groupforumtopic'); + + // Register an icon handler for groups + register_page_handler('groupicon','groups_icon_handler'); + + // Register some actions + register_action("groups/edit",false, $CONFIG->pluginspath . "groups/actions/edit.php"); + register_action("groups/delete",false, $CONFIG->pluginspath . "groups/actions/delete.php"); + register_action("groups/join",false, $CONFIG->pluginspath . "groups/actions/join.php"); + register_action("groups/leave",false, $CONFIG->pluginspath . "groups/actions/leave.php"); + register_action("groups/joinrequest",false, $CONFIG->pluginspath . "groups/actions/joinrequest.php"); + register_action("groups/killrequest",false,$CONFIG->pluginspath . "groups/actions/groupskillrequest.php"); + register_action("groups/killinvitation",false,$CONFIG->pluginspath . "groups/actions/groupskillinvitation.php"); + register_action("groups/addtogroup",false, $CONFIG->pluginspath . "groups/actions/addtogroup.php"); + register_action("groups/invite",false, $CONFIG->pluginspath . "groups/actions/invite.php"); + + // Use group widgets + use_widgets('groups'); + + // Add a page owner handler + add_page_owner_handler('groups_page_owner_handler'); + + // Add some widgets + add_widget_type('a_users_groups',elgg_echo('groups:widget:membership'), elgg_echo('groups:widgets:description')); + + + //extend some views + elgg_extend_view('profile/icon','groups/icon'); + elgg_extend_view('css','groups/css'); + + // Access permissions + register_plugin_hook('access:collections:write', 'all', 'groups_write_acl_plugin_hook'); + //register_plugin_hook('access:collections:read', 'all', 'groups_read_acl_plugin_hook'); + + // Notification hooks + if (is_callable('register_notification_object')) + register_notification_object('object', 'groupforumtopic', elgg_echo('groupforumtopic:new')); + register_plugin_hook('object:notifications','object','group_object_notifications_intercept'); + + // Listen to notification events and supply a more useful message + register_plugin_hook('notify:entity:message', 'object', 'groupforumtopic_notify_message'); + + // add the forum tool option + add_group_tool_option('forum',elgg_echo('groups:enableforum'),true); + + // Now override icons + register_plugin_hook('entity:icon:url', 'group', 'groups_groupicon_hook'); + } + + /** + * Event handler for group forum posts + * + */ + function group_object_notifications($event, $object_type, $object) { + + static $flag; + if (!isset($flag)) $flag = 0; + + if (is_callable('object_notifications')) + if ($object instanceof ElggObject) { + if ($object->getSubtype() == 'groupforumtopic') { + //if ($object->countAnnotations('group_topic_post') > 0) { + if ($flag == 0) { + $flag = 1; + object_notifications($event, $object_type, $object); + } + //} + } + } + + } + + /** + * Intercepts the notification on group topic creation and prevents a notification from going out + * (because one will be sent on the annotation) + * + * @param unknown_type $hook + * @param unknown_type $entity_type + * @param unknown_type $returnvalue + * @param unknown_type $params + * @return unknown + */ + function group_object_notifications_intercept($hook, $entity_type, $returnvalue, $params) { + if (isset($params)) { + if ($params['event'] == 'create' && $params['object'] instanceof ElggObject) { + if ($params['object']->getSubtype() == 'groupforumtopic') { + return true; + } + } + } + return null; + } + + /** + * Returns a more meaningful message + * + * @param unknown_type $hook + * @param unknown_type $entity_type + * @param unknown_type $returnvalue + * @param unknown_type $params + */ + function groupforumtopic_notify_message($hook, $entity_type, $returnvalue, $params) + { + $entity = $params['entity']; + $to_entity = $params['to_entity']; + $method = $params['method']; + if (($entity instanceof ElggEntity) && ($entity->getSubtype() == 'groupforumtopic')) + { + + $descr = $entity->description; + $title = $entity->title; + global $CONFIG; + $url = $entity->getURL(); + + $msg = get_input('topicmessage'); + if (empty($msg)) $msg = get_input('topic_post'); + if (!empty($msg)) $msg = $msg . "\n\n"; else $msg = ''; + + $owner = get_entity($entity->container_guid); + if ($method == 'sms') { + return elgg_echo("groupforumtopic:new") . ': ' . $url . " ({$owner->name}: {$title})"; + } else { + return $_SESSION['user']->name . ' ' . elgg_echo("groups:viagroups") . ': ' . $title . "\n\n" . $msg . "\n\n" . $entity->getURL(); + } + + } + return null; + } + + /** + * This function loads a set of default fields into the profile, then triggers a hook letting other plugins to edit + * add and delete fields. + * + * Note: This is a secondary system:init call and is run at a super low priority to guarantee that it is called after all + * other plugins have initialised. + */ + function groups_fields_setup() + { + global $CONFIG; + + $profile_defaults = array( + + 'name' => 'text', + 'description' => 'longtext', + 'briefdescription' => 'text', + 'interests' => 'tags', + 'website' => 'url', + + ); + + $CONFIG->group = trigger_plugin_hook('profile:fields', 'group', NULL, $profile_defaults); + + // register any tag metadata names + foreach ($CONFIG->group as $name => $type) { + if ($type == 'tags') { + elgg_register_tag_metadata_name($name); + + // register a tag name translation + add_translation(get_current_language(), array("tag_names:$name" => elgg_echo("groups:$name"))); + } + } + } + + /** + * Sets up submenus for the groups system. Triggered on pagesetup. + * + */ + function groups_submenus() { + + global $CONFIG; + + // Get the page owner entity + $page_owner = page_owner_entity(); + + // Submenu items for all group pages + if ($page_owner instanceof ElggGroup && get_context() == 'groups') { + if (isloggedin()) { + if ($page_owner->canEdit()) { + add_submenu_item(elgg_echo('groups:edit'),$CONFIG->wwwroot . "mod/groups/edit.php?group_guid=" . $page_owner->getGUID(), '1groupsactions'); + add_submenu_item(elgg_echo('groups:invite'),$CONFIG->wwwroot . "mod/groups/invite.php?group_guid={$page_owner->getGUID()}", '1groupsactions'); + if (!$page_owner->isPublicMembership()) + add_submenu_item(elgg_echo('groups:membershiprequests'),$CONFIG->wwwroot . "mod/groups/membershipreq.php?group_guid={$page_owner->getGUID()}", '1groupsactions'); + } + if ($page_owner->isMember($_SESSION['user'])) { + if ($page_owner->getOwner() != $_SESSION['guid']) { + $url = elgg_add_action_tokens_to_url($CONFIG->wwwroot . "action/groups/leave?group_guid=" . $page_owner->getGUID()); + add_submenu_item(elgg_echo('groups:leave'), $url, '1groupsactions'); + } + } else { + if ($page_owner->isPublicMembership()) { + $url = elgg_add_action_tokens_to_url($CONFIG->wwwroot . "action/groups/join?group_guid={$page_owner->getGUID()}"); + add_submenu_item(elgg_echo('groups:join'), $url, '1groupsactions'); + } else { + $url = elgg_add_action_tokens_to_url($CONFIG->wwwroot . "action/groups/joinrequest?group_guid={$page_owner->getGUID()}"); + add_submenu_item(elgg_echo('groups:joinrequest'), $url, '1groupsactions'); + } + } + } + + if($page_owner->forum_enable != "no"){ + add_submenu_item(elgg_echo('groups:forum'),$CONFIG->wwwroot . "pg/groups/forum/{$page_owner->getGUID()}/", '1groupslinks'); + } + + } + + // Add submenu options + if (get_context() == 'groups' && !($page_owner instanceof ElggGroup)) { + if (isloggedin()) { + add_submenu_item(elgg_echo('groups:new'), $CONFIG->wwwroot."pg/groups/new/", '1groupslinks'); + add_submenu_item(elgg_echo('groups:owned'), $CONFIG->wwwroot . "pg/groups/owned/" . $_SESSION['user']->username, '1groupslinks'); + add_submenu_item(elgg_echo('groups:yours'), $CONFIG->wwwroot . "pg/groups/member/" . $_SESSION['user']->username, '1groupslinks'); + add_submenu_item(elgg_echo('groups:invitations'), $CONFIG->wwwroot . "pg/groups/invitations/" . $_SESSION['user']->username, '1groupslinks'); + } + add_submenu_item(elgg_echo('groups:all'), $CONFIG->wwwroot . "pg/groups/world/", '1groupslinks'); + } + + } + + /** + * Set a page owner handler. + * + */ + function groups_page_owner_handler() + { + $group_guid = get_input('group_guid'); + if ($group_guid) + { + $group = get_entity($group_guid); + if ($group instanceof ElggGroup) + return $group->owner_guid; + } + + return false; + } + + /** + * Group page handler + * + * @param array $page Array of page elements, forwarded by the page handling mechanism + */ + function groups_page_handler($page) + { + global $CONFIG; + + + if (isset($page[0])) + { + // See what context we're using + switch($page[0]) + { + case 'invitations': + include($CONFIG->pluginspath . "groups/invitations.php"); + $user_guid = get_loggedin_userid(); + + $invitations = elgg_get_entities_from_relationship(array( + 'relationship' => 'membership_request', + 'guid' => $user_guid + )); + + break; + + case "new" : + include($CONFIG->pluginspath . "groups/new.php"); + break; + case "world": + set_context('groups'); + set_page_owner(0); + include($CONFIG->pluginspath . "groups/all.php"); + break; + case "forum": + set_input('group_guid', $page[1]); + include($CONFIG->pluginspath . "groups/forum.php"); + break; + case "owned" : + // Owned by a user + if (isset($page[1])) + set_input('username',$page[1]); + + include($CONFIG->pluginspath . "groups/index.php"); + break; + case "member" : + // User is a member of + if (isset($page[1])) + set_input('username',$page[1]); + + include($CONFIG->pluginspath . "groups/membership.php"); + break; + default: + set_input('group_guid', $page[0]); + include($CONFIG->pluginspath . "groups/groupprofile.php"); + break; + } + } + + } + + /** + * Handle group icons. + * + * @param unknown_type $page + */ + function groups_icon_handler($page) { + + global $CONFIG; + + // The username should be the file we're getting + if (isset($page[0])) { + set_input('group_guid',$page[0]); + } + if (isset($page[1])) { + set_input('size',$page[1]); + } + // Include the standard profile index + include($CONFIG->pluginspath . "groups/graphics/icon.php"); + + } + + /** + * Populates the ->getUrl() method for group objects + * + * @param ElggEntity $entity File entity + * @return string File URL + */ + function groups_url($entity) { + + global $CONFIG; + + $title = friendly_title($entity->name); + + return $CONFIG->url . "pg/groups/{$entity->guid}/$title/"; + + } + + function groups_groupforumtopic_url($entity) { + + global $CONFIG; + return $CONFIG->url . 'mod/groups/topicposts.php?topic='. $entity->guid .'&group_guid=' . $entity->container_guid; + + } + + /** + * Groups created, so add users to access lists. + */ + function groups_create_event_listener($event, $object_type, $object) + { + //if (($event == 'create') && ($object_type == 'group') && ($object instanceof ElggGroup)) + //{ + $group_id = create_access_collection(elgg_echo('groups:group') . ": " . $object->name); + if ($group_id) + { + $object->group_acl = $group_id; + } + else + return false; + //} + + return true; + } + + /** + * Hook to listen to read access control requests and return all the groups you are a member of. + */ + function groups_read_acl_plugin_hook($hook, $entity_type, $returnvalue, $params) + { + //error_log("READ: " . var_export($returnvalue)); + $user = $_SESSION['user']; + if ($user) + { + // Not using this because of recursion. + // Joining a group automatically add user to ACL, + // So just see if they're a member of the ACL. + //$membership = get_users_membership($user->guid); + + $members = get_members_of_access_collection($group->group_acl); + print_r($members); + exit; + + if ($membership) + { + foreach ($membership as $group) + $returnvalue[$user->guid][$group->group_acl] = elgg_echo('groups:group') . ": " . $group->name; + return $returnvalue; + } + } + } + + /** + * Return the write access for the current group if the user has write access to it. + */ + function groups_write_acl_plugin_hook($hook, $entity_type, $returnvalue, $params) + { + $page_owner = page_owner_entity(); + // get all groups if logged in + if ($loggedin = get_loggedin_user()) { + $groups = elgg_get_entities_from_relationship(array('relationship' => 'member', 'relationship_guid' => $loggedin->getGUID(), 'inverse_relationship' => FALSE, 'limit' => 999)); + if (is_array($groups)) { + foreach ($groups as $group) { + $returnvalue[$group->group_acl] = elgg_echo('groups:group') . ': ' . $group->name; + } + } + } + + // This doesn't seem to do anything. + // There are no hooks to override container permissions for groups +// +// if ($page_owner instanceof ElggGroup) +// { +// if (can_write_to_container()) +// { +// $returnvalue[$page_owner->group_acl] = elgg_echo('groups:group') . ": " . $page_owner->name; +// } +// } + return $returnvalue; + } + + /** + * Groups deleted, so remove access lists. + */ + function groups_delete_event_listener($event, $object_type, $object) + { + delete_access_collection($object->group_acl); + + return true; + } + + /** + * Listens to a group join event and adds a user to the group's access control + * + */ + function groups_user_join_event_listener($event, $object_type, $object) { + + $group = $object['group']; + $user = $object['user']; + $acl = $group->group_acl; + + add_user_to_access_collection($user->guid, $acl); + + return true; + + } + + /** + * Listens to a group leave event and removes a user from the group's access control + * + */ + function groups_user_leave_event_listener($event, $object_type, $object) { + + $group = $object['group']; + $user = $object['user']; + $acl = $group->group_acl; + + remove_user_from_access_collection($user->guid, $acl); + + return true; + + } + + /** + * This hooks into the getIcon API and provides nice user icons for users where possible. + * + * @param unknown_type $hook + * @param unknown_type $entity_type + * @param unknown_type $returnvalue + * @param unknown_type $params + * @return unknown + */ + function groups_groupicon_hook($hook, $entity_type, $returnvalue, $params) + { + global $CONFIG; + + if ((!$returnvalue) && ($hook == 'entity:icon:url') && ($params['entity'] instanceof ElggGroup)) + { + $entity = $params['entity']; + $type = $entity->type; + $viewtype = $params['viewtype']; + $size = $params['size']; + + if ($icontime = $entity->icontime) { + $icontime = "{$icontime}"; + } else { + $icontime = "default"; + } + + $filehandler = new ElggFile(); + $filehandler->owner_guid = $entity->owner_guid; + $filehandler->setFilename("groups/" . $entity->guid . $size . ".jpg"); + + if ($filehandler->exists()) { + $url = $CONFIG->url . "pg/groupicon/{$entity->guid}/$size/$icontime.jpg"; + + return $url; + } + } + } + + /** + * A simple function to see who can edit a group discussion post + * @param the comment $entity + * @param user who owns the group $group_owner + * @return boolean + */ + function groups_can_edit_discussion($entity, $group_owner) + { + + //logged in user + $user = $_SESSION['user']->guid; + + if (($entity->owner_guid == $user) || $group_owner == $user || isadminloggedin()) { + return true; + }else{ + return false; + } + + } + + /** + * Overrides topic post getURL() value. + * + */ + function group_topicpost_url($annotation) { + if ($parent = get_entity($annotation->entity_guid)) { + global $CONFIG; + return $CONFIG->wwwroot . 'mod/groups/topicposts.php?topic='.$parent->guid.'&group_guid='.$parent->container_guid.'#' . $annotation->id; + } + } + + /** + * Grabs groups by invitations + * Have to override all access until there's a way override access to getter functions. + * + * @param $user_guid + * @return unknown_type + */ + function groups_get_invited_groups($user_guid, $return_guids = FALSE) { + $ia = elgg_set_ignore_access(TRUE); + $invitations = elgg_get_entities_from_relationship(array('relationship' => 'invited', 'relationship_guid' => $user_guid, 'inverse_relationship' => TRUE, 'limit' => 9999)); + elgg_set_ignore_access($ia); + + if ($return_guids) { + $guids = array(); + foreach ($invitations as $invitation) { + $guids[] = $invitation->getGUID(); + } + + return $guids; + } + + return $invitations; + } + + register_extender_url_handler('group_topicpost_url','annotation', 'group_topic_post'); + + // Register a handler for create groups + register_elgg_event_handler('create', 'group', 'groups_create_event_listener'); + + // Register a handler for delete groups + register_elgg_event_handler('delete', 'group', 'groups_delete_event_listener'); + + // Make sure the groups initialisation function is called on initialisation + register_elgg_event_handler('init','system','groups_init'); + register_elgg_event_handler('init','system','groups_fields_setup', 10000); // Ensure this runs after other plugins + register_elgg_event_handler('join','group','groups_user_join_event_listener'); + register_elgg_event_handler('leave','group','groups_user_leave_event_listener'); + register_elgg_event_handler('pagesetup','system','groups_submenus'); + register_elgg_event_handler('annotate','all','group_object_notifications'); + + // Register actions + global $CONFIG; + register_action("groups/addtopic",false,$CONFIG->pluginspath . "groups/actions/forums/addtopic.php"); + register_action("groups/deletetopic",false,$CONFIG->pluginspath . "groups/actions/forums/deletetopic.php"); + register_action("groups/addpost",false,$CONFIG->pluginspath . "groups/actions/forums/addpost.php"); + register_action("groups/edittopic",false,$CONFIG->pluginspath . "groups/actions/forums/edittopic.php"); + register_action("groups/deletepost",false,$CONFIG->pluginspath . "groups/actions/forums/deletepost.php"); + register_action("groups/featured",false,$CONFIG->pluginspath . "groups/actions/featured.php"); + register_action("groups/editpost",false,$CONFIG->pluginspath . "groups/actions/forums/editpost.php"); + +?> diff --git a/mod/groups/topicposts.php b/mod/groups/topicposts.php new file mode 100644 index 000000000..bd2d3b1ed --- /dev/null +++ b/mod/groups/topicposts.php @@ -0,0 +1,37 @@ +<?php + + /** + * Elgg Groups topic posts page + * + * @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/ + */ + + // Load Elgg engine + require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); + + // We now have RSS on topics + global $autofeed; + $autofeed = true; + + //get_input('group_guid'); + set_page_owner(get_input('group_guid')); + if (!(page_owner_entity() instanceof ElggGroup)) forward(); + + group_gatekeeper(); + + // get the entity from id + $topic = get_entity(get_input('topic')); + if (!$topic) forward(); + + // Display them + $area2 = elgg_view("forum/viewposts", array('entity' => $topic)); + $body = elgg_view_layout("two_column_left_sidebar", '' , $area2); + + // Display page + page_draw($topic->title,$body); + +?>
\ No newline at end of file diff --git a/mod/groups/views/default/forms/forums/addpost.php b/mod/groups/views/default/forms/forums/addpost.php new file mode 100644 index 000000000..004638f33 --- /dev/null +++ b/mod/groups/views/default/forms/forums/addpost.php @@ -0,0 +1,40 @@ +<?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"> + <p class="longtext_editarea"> + <label><?php echo elgg_echo("groups:reply"); ?><br /> + <?php + + echo elgg_view("input/longtext",array( + "internalname" => "topic_post", + "value" => $body, + )); + ?> + </label> + </p> + <p> + <!-- 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 save button --> + <input type="submit" class="submit_button" value="<?php echo elgg_echo('save'); ?>" /> + </p> + + </form>
\ No newline at end of file diff --git a/mod/groups/views/default/forms/forums/addtopic.php b/mod/groups/views/default/forms/forums/addtopic.php new file mode 100644 index 000000000..d002b110a --- /dev/null +++ b/mod/groups/views/default/forms/forums/addtopic.php @@ -0,0 +1,101 @@ +<?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 the title + echo elgg_view_title(elgg_echo("groups:addtopic")); + +?> +<div class="contentWrapper"> + <!-- display the input form --> + <form action="<?php echo $vars['url']; ?>action/<?php echo $action; ?>" 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" => $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('save'); ?>" /> + </p> + + </form> +</div> diff --git a/mod/groups/views/default/forms/forums/edittopic.php b/mod/groups/views/default/forms/forums/edittopic.php new file mode 100644 index 000000000..b88dfd866 --- /dev/null +++ b/mod/groups/views/default/forms/forums/edittopic.php @@ -0,0 +1,109 @@ +<?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 new file mode 100644 index 000000000..1c5cb9b6e --- /dev/null +++ b/mod/groups/views/default/forms/groups/edit.php @@ -0,0 +1,162 @@ +<?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; + } + +?> +<div class="contentWrapper"> +<form action="<?php echo $vars['url']; ?>action/groups/edit" enctype="multipart/form-data" method="post"> + + <?php echo elgg_view('input/securitytoken'); ?> + + <p> + <label><?php echo elgg_echo("groups:icon"); ?><br /> + <?php + + echo elgg_view("input/file",array('internalname' => 'icon')); + + ?> + </label> + </p> +<?php + + //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> + +<?php + + } + +?> + + <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> + + <?php + + if (get_plugin_setting('hidden_groups', 'groups') == 'yes') + { +?> + + <p> + <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)); + + + ?> + </label> + </p> + +<?php + } + + ?> + + <?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> + <?php + } + } + ?> + <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> + +</form> +</div> + +<div class="contentWrapper"> +<div id="delete_group_option"> + <form action="<?php echo $vars['url'] . "action/groups/delete"; ?>"> + <?php + echo elgg_view('input/securitytoken'); + if ($vars['entity']) + { + $warning = elgg_echo("groups:deletewarning"); + ?> + <input type="hidden" name="group_guid" value="<?php echo $vars['entity']->getGUID(); ?>" /> + <input type="submit" name="delete" value="<?php echo elgg_echo('groups:delete'); ?>" onclick="javascript:return confirm('<?php echo $warning; ?>')"/><?php + } + ?> + </form> +</div><div class="clearfloat"></div> +</div> + + + diff --git a/mod/groups/views/default/forms/groups/invite.php b/mod/groups/views/default/forms/groups/invite.php new file mode 100644 index 000000000..ebe184c53 --- /dev/null +++ b/mod/groups/views/default/forms/groups/invite.php @@ -0,0 +1,34 @@ +<?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/ + */ + + $group = $vars['entity']; + $owner = get_entity($vars['entity']->owner_guid); + $forward_url = $group->getURL(); + + +?> +<div class="contentWrapper"> +<form action="<?php echo $vars['url']; ?>action/groups/invite" method="post"> + + <?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> +</div> diff --git a/mod/groups/views/default/forum/topicposts.php b/mod/groups/views/default/forum/topicposts.php new file mode 100644 index 000000000..20a545eec --- /dev/null +++ b/mod/groups/views/default/forum/topicposts.php @@ -0,0 +1,106 @@ +<?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="topic_post"><!-- start the topic_post --> + + <table width="100%"> + <tr> + <td> + <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=\"post_icon\">" . elgg_view("profile/icon",array('entity' => $post_owner, 'size' => 'small')) . "</div>"; + + //display the user name + echo "<p><b>" . $post_owner->name . "</b><br />"; + + } else { + echo "<div class=\"post_icon\"><img src=\"" . elgg_view('icon/user/default/small') . "\" /></div>"; + echo "<p><b>" . elgg_echo('profile:deleteduser') . "</b><br />"; + } + + //display the date of the comment + echo "<small>" . friendly_time($vars['entity']->time_created) . "</small></p>"; + ?> + </td> + <td width="70%"> + <?php + //display the actual message posted + echo parse_urls(elgg_view("output/longtext",array("value" => $vars['entity']->value))); + ?> + </td> + </tr> + </table> + <?php + + //if the comment owner is looking at it, or admin, or group owner they can edit + if (groups_can_edit_discussion($vars['entity'], page_owner_entity()->owner_guid)) { + ?> + <p class="topic-post-menu"> + <?php + + echo 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'), + )); + + //display an edit link that will open up an edit area + echo " <a class=\"collapsibleboxlink\">".elgg_echo('edit')."</a>"; + echo "<div class=\"collapsible_box\">"; + //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 + + <div class='edit_forum_comments'> + <p class='longtext_editarea'> + $text_textarea + </p> + $post + $topic + $group + $field + <p> + $submit_input + </p> + + </div> + +EOT; + +?> + + <?php + echo elgg_view('input/form', array('action' => "{$vars['url']}action/groups/editpost", 'body' => $form_body, 'internalid' => 'editforumpostForm')); + ?> + </div> + </p> + + <?php + } + ?> + + </div><!-- end the topic_post -->
\ No newline at end of file diff --git a/mod/groups/views/default/forum/topics.php b/mod/groups/views/default/forum/topics.php new file mode 100644 index 000000000..c4cd9becf --- /dev/null +++ b/mod/groups/views/default/forum/topics.php @@ -0,0 +1,33 @@ +<?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_area_group_title"><h2><?php echo elgg_echo("groups:forum"); ?></h2></div> + +<?php + //only show the add link if the user is a member + if(page_owner_entity()->isMember($vars['user'])){ + +?> + <!-- display the add a topic link --> + <div class="add_topic"><a href="<?php echo $vars['url']; ?>mod/groups/addtopic.php?group_guid=<?php echo get_input('group_guid'); ?>" class="add_topic_button"><?php echo elgg_echo("groups:addtopic"); ?></a></div> + +<?php + } +?> +<?php + if($vars['topics']) + echo $vars['topics']; + else + echo "<div class='contentWrapper'>". elgg_echo("grouptopic:notcreated") . "</div>"; + +?>
\ No newline at end of file diff --git a/mod/groups/views/default/forum/viewposts.php b/mod/groups/views/default/forum/viewposts.php new file mode 100644 index 000000000..e7e194691 --- /dev/null +++ b/mod/groups/views/default/forum/viewposts.php @@ -0,0 +1,58 @@ +<?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/ + */ + +?> + +<div id="topic_posts"><!-- open the topic_posts div --> +<div id="pages_breadcrumbs"><b><a href="<?php echo $vars['url']; ?>pg/groups/forum/<?php echo $vars['entity']->container_guid; ?>/"><?php echo elgg_echo("groups:forum"); ?></a></b> > <?php echo $vars['entity']->title; ?></div> + +<?php + //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 --> + <div id="content_area_group_title"><h2><?php echo $vars['entity']->title; ?></h2></div> +<?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 { + } + +?> +</div>
\ No newline at end of file diff --git a/mod/groups/views/default/group/group.php b/mod/groups/views/default/group/group.php new file mode 100644 index 000000000..96f70d36a --- /dev/null +++ b/mod/groups/views/default/group/group.php @@ -0,0 +1,21 @@ +<?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 { + if (get_input('search_viewtype') == "gallery") { + echo elgg_view('groups/groupgallery',$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 new file mode 100644 index 000000000..34e4169eb --- /dev/null +++ b/mod/groups/views/default/groups/closedmembership.php @@ -0,0 +1,15 @@ +<?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/ + */ + +?> +<div id="groups_closed_membership"> + <p><?php echo elgg_echo('groups:closedgroup'); ?></p> +</div>
\ No newline at end of file diff --git a/mod/groups/views/default/groups/contentwrapper.php b/mod/groups/views/default/groups/contentwrapper.php new file mode 100644 index 000000000..e11d3d09a --- /dev/null +++ b/mod/groups/views/default/groups/contentwrapper.php @@ -0,0 +1,5 @@ +<div class='contentWrapper groups'><?php + + echo $vars['body']; + +?></div>
\ No newline at end of file diff --git a/mod/groups/views/default/groups/css.php b/mod/groups/views/default/groups/css.php new file mode 100644 index 000000000..bc8d2bfc0 --- /dev/null +++ b/mod/groups/views/default/groups/css.php @@ -0,0 +1,401 @@ +<?php + + /** + * 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/ + */ + +?> + +#content_area_group_title h2 { + color:#0054A7; + font-size:1.35em; + line-height:1.2em; + margin:0 0 0 8px; + padding:5px; +} +#topic_posts #content_area_group_title h2 { + margin:0 0 0 0; +} + +#two_column_left_sidebar_maincontent #owner_block_content { + margin:0 0 10px 0 !important; +} + +#groups_info_column_left { + width:435px; + margin-left:230px; + margin-right:10px; +} + +#groups_info_column_left .odd { + background:#E9E9E9; + -webkit-border-radius: 5px; + -moz-border-radius: 5px; +} +#groups_info_column_left .even { + background:#E9E9E9; + -webkit-border-radius: 5px; + -moz-border-radius: 5px; +} +#groups_info_column_left p { + margin:0 0 7px 0; + padding:2px 4px; +} + +#groups_info_column_right { + float:left; + width:230px; + margin:0 0 0 10px; +} +#groups_info_wide p { + text-align: right; + padding-right:10px; +} +#group_stats { + width:190px; + background: #e9e9e9; + padding:5px; + margin:10px 0 20px 0; + -webkit-border-radius: 5px; + -moz-border-radius: 5px; +} +#group_stats p { + margin:0; +} +#group_members { + margin:10px; + -webkit-border-radius: 8px; + -moz-border-radius: 8px; + background: white; +} + +#right_column { + clear:left; + float:right; + width:340px; + margin:0 10px 0 0; +} +#left_column { + width:340px; + float:left; + margin:0 10px 0 10px; + +} +/* IE 6 fixes */ +* html #left_column { + margin:0 0 0 5px; +} +* html #right_column { + margin:0 5px 0 0; +} + +#group_members h2, +#right_column h2, +#left_column h2, +#fullcolumn h2 { + margin:0 0 10px 0; + padding:5px; + color:#0054A7; + font-size:1.25em; + line-height:1.2em; +} +#fullcolumn .contentWrapper { + margin:0 10px 20px 10px; + padding:0 0 5px; +} + +.member_icon { + margin:0 0 6px 6px; + float:left; +} + +/* IE6 */ +* html #topic_post_tbl { width:676px !important;} + +/* all browsers - force tinyMCE on edit comments to be full-width */ +.edit_forum_comments .defaultSkin table.mceLayout { + width: 636px !important; +} + +/* topics overview page */ +#forum_topics { + padding:10px; + margin:0 10px 0 10px; + background:white; + -webkit-border-radius: 8px; + -moz-border-radius: 8px; +} +/* topics individual view page */ +#topic_posts { + margin:0 10px 5px 10px; +} +#topic_posts #pages_breadcrumbs { + margin:2px 0 0 0px; +} +#topic_posts form { + padding:10px; + margin:30px 0 0 0; + background:white; + -webkit-border-radius: 8px; + -moz-border-radius: 8px; +} +.topic_post { + padding:10px; + margin:0 0 5px 0; + background:white; + -webkit-border-radius: 8px; + -moz-border-radius: 8px; +} +.topic_post .post_icon { + float:left; + margin:0 8px 4px 0; +} +.topic_post h2 { + margin-bottom:20px; +} +.topic_post p.topic-post-menu { + margin:0; +} +.topic_post p.topic-post-menu a.collapsibleboxlink { + padding-left:10px; +} +.topic_post table, .topic_post td { + border:none; +} + +/* group latest discussions widget */ +#latest_discussion_widget { + margin:0 0 20px 0; + background:white; + -webkit-border-radius: 8px; + -moz-border-radius: 8px; +} +/* group files widget */ +#filerepo_widget_layout { + margin:0 0 20px 0; + padding: 0 0 5px 0; + background:white; + -webkit-border-radius: 8px; + -moz-border-radius: 8px; +} +/* group pages widget */ +#group_pages_widget { + margin:0 0 20px 0; + padding: 0 0 5px 0; + background:white; + -webkit-border-radius: 8px; + -moz-border-radius: 8px; +} +#group_pages_widget .search_listing { + border: 2px solid #cccccc; +} +#right_column .filerepo_widget_singleitem { + background: #dedede !important; + margin:0 10px 5px 10px; +} +#left_column .filerepo_widget_singleitem { + background: #dedede !important; + margin:0 10px 5px 10px; +} +.forum_latest { + margin:0 10px 5px 10px; + background: #dedede; + padding:5px; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; +} +.forum_latest:hover { + +} +.forum_latest .topic_owner_icon { + float:left; +} +.forum_latest .topic_title { + margin-left:35px; +} +.forum_latest .topic_title p { + line-height: 1.0em; + padding:0; + margin:0; + font-weight: bold; +} +.forum_latest p.topic_replies { + padding:3px 0 0 0; + margin:0; + color:#666666; +} +.add_topic { + -webkit-border-radius: 8px; + -moz-border-radius: 8px; + background:white; + margin:5px 10px; + padding:10px 10px 10px 6px; +} + +a.add_topic_button { + font: 12px/100% Arial, Helvetica, sans-serif; + font-weight: bold; + color: white; + background:#4690d6; + border:none; + -webkit-border-radius: 5px; + -moz-border-radius: 5px; + width: auto; + height: auto; + padding: 3px 6px 3px 6px; + margin:0; + cursor: pointer; +} +a.add_topic_button:hover { + background: #0054a7; + color:white; + text-decoration: none; +} + + + +/* latest discussion listing */ +.latest_discussion_info { + float:right; + width:300px; + text-align: right; + margin-left: 10px; +} +.groups .search_listing br { + height:0; + line-height:0; +} +span.timestamp { + color:#666666; + font-size: 90%; +} +.latest_discussion_info .timestamp { + font-size: 0.85em; +} +/* new groups page */ +.groups .search_listing { + border:2px solid #cccccc; + margin:0 0 5px 0; +} +.groups .search_listing:hover { + background:#dedede; +} +.groups .group_count { + font-weight: bold; + color: #666666; + margin:0 0 5px 4px; +} +.groups .search_listing_info { + color:#666666; +} +.groupdetails { + float:right; +} +.groupdetails p { + margin:0; + padding:0; + line-height: 1.1em; + text-align: right; +} +#groups_closed_membership { + margin:0 10px 20px 10px; + padding: 3px 5px 5px 5px; + background:#bbdaf7; + -webkit-border-radius: 8px; + -moz-border-radius: 8px; +} +#groups_closed_membership p { + margin:0; +} + +/* groups membership widget */ +.groupmembershipwidget .contentWrapper { + margin:0 10px 5px 10px; +} +.groupmembershipwidget .contentWrapper .groupicon { + float:left; + margin:0 10px 0 0; +} +.groupmembershipwidget .search_listing_info p { + color: #666666; +} +.groupmembershipwidget .search_listing_info span { + font-weight: bold; +} + +/* groups sidebar */ +.featuredgroups .contentWrapper { + margin:0 0 10px 0; +} +.featuredgroups .contentWrapper .groupicon { + float:left; + margin:0 10px 0 0; +} +.featuredgroups .contentWrapper p { + margin: 0; + line-height: 1.2em; + color:#666666; +} +.featuredgroups .contentWrapper span { + font-weight: bold; +} +#groupssearchform { + border-bottom: 1px solid #cccccc; + margin-bottom: 10px; +} +#groupssearchform input[type="submit"] { + padding:2px; + height:auto; + margin:4px 0 5px 0; +} +.sidebarBox #owner_block_submenu { + margin:5px 0 0 0; +} + +/* delete post */ +.delete_discussion { + +} +.delete_discussion a { + display:block; + float:right; + cursor: pointer; + width:14px; + height:14px; + margin:0; + background: url("<?php echo $vars['url']; ?>_graphics/icon_customise_remove.png") no-repeat 0 0; +} +.delete_discussion a:hover { + background-position: 0 -16px; + text-decoration: none; +} +/* IE6 */ +* html .delete_discussion a { font-size: 1px; } +/* IE7 */ +*:first-child+html .delete_discussion a { font-size: 1px; } + +/* delete group button */ +#delete_group_option input[type="submit"] { + background:#dedede; + border-color:#dedede; + color:#333333; + margin:0; + float:right; + clear:both; +} +#delete_group_option input[type="submit"]:hover { + background:red; + border-color:red; + color:white; +} + +#groupsearchform .search_input { + width:176px; +} + diff --git a/mod/groups/views/default/groups/featured.php b/mod/groups/views/default/groups/featured.php new file mode 100644 index 000000000..6e85bf5d8 --- /dev/null +++ b/mod/groups/views/default/groups/featured.php @@ -0,0 +1,29 @@ +<?php + + /** + * This view will display featured groups - these are set by admin + **/ + + +?> +<div class="sidebarBox featuredgroups"> +<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' => 'small', + ) + ); + + echo "<div class=\"contentWrapper\">" . $icon . " <p><span>" . $group->name . "</span><br />"; + echo $group->briefdescription . "</p><div class=\"clearfloat\"></div></div>"; + + } + } +?> +</div>
\ No newline at end of file diff --git a/mod/groups/views/default/groups/find.php b/mod/groups/views/default/groups/find.php new file mode 100644 index 000000000..671d618bc --- /dev/null +++ b/mod/groups/views/default/groups/find.php @@ -0,0 +1,20 @@ +<?php + + /** + * A simple group search by tag view + **/ + +$tag_string = elgg_echo('groups:search:tags'); + +?> +<div class="sidebarBox"> +<h3><?php echo elgg_echo('groups:searchtag'); ?></h3> +<form id="groupsearchform" action="<?php echo $vars['url']; ?>pg/search/" 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="hidden" name="entity_type" value="group" /> + <input type="hidden" name="subtype" value="" /> + <input type="hidden" name="tagtype" value="" /> + <input type="hidden" name="owner_guid" value="0" /> + <input type="submit" value="<?php echo elgg_echo('go'); ?>" /> +</form> +</div>
\ 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 new file mode 100644 index 000000000..6baa8a575 --- /dev/null +++ b/mod/groups/views/default/groups/forum_latest.php @@ -0,0 +1,38 @@ +<?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'){ + +?> + +<div class="contentWrapper"> +<h2><?php echo elgg_echo('groups:latestdiscussion'); ?></h2> +<?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=\"forum_latest\">"; + echo "<div class=\"topic_owner_icon\">" . elgg_view('profile/icon',array('entity' => $f->getOwnerEntity(), 'size' => 'tiny', 'override' => true)) . "</div>"; + echo "<div class=\"topic_title\"><p><a href=\"{$vars['url']}mod/groups/topicposts.php?topic={$f->guid}&group_guid={$vars['entity']->guid}\">" . $f->title . "</a></p> <p class=\"topic_replies\"><small>".elgg_echo('groups:posts').": " . $count_annotations . "</small></p></div>"; + + echo "</div>"; + + } + } else { + echo "<div class=\"forum_latest\">"; + echo elgg_echo("grouptopic:notcreated"); + echo "</div>"; + } +?> +<div class="clearfloat" /></div> +</div> +<?php + }//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 new file mode 100644 index 000000000..7314507e0 --- /dev/null +++ b/mod/groups/views/default/groups/group_sort_menu.php @@ -0,0 +1,28 @@ +<?php + + /** + * 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/"; + +?> +<div id="elgg_horizontal_tabbed_nav"> +<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> +<div class="group_count"> + <?php + echo $num_groups . " " . elgg_echo("groups:count"); + ?> +</div>
\ No newline at end of file diff --git a/mod/groups/views/default/groups/groupgallery.php b/mod/groups/views/default/groups/groupgallery.php new file mode 100644 index 000000000..7122dc098 --- /dev/null +++ b/mod/groups/views/default/groups/groupgallery.php @@ -0,0 +1,25 @@ +<?php + /** + * Elgg groups plugin gallery view + * + * @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/ + */ + + $icon = elgg_view( + "groups/icon", array( + 'entity' => $vars['entity'], + 'size' => 'large', + ) + ); + + $info .= "<p><b><a href=\"" . $vars['entity']->getUrl() . "\">" . $vars['entity']->name . "</a></b></p>"; + + // num users, last activity, owner etc + + + echo elgg_view('search/gallery_listing',array('icon' => $icon, 'info' => $info)); +?>
\ No newline at end of file diff --git a/mod/groups/views/default/groups/grouplisting.php b/mod/groups/views/default/groups/grouplisting.php new file mode 100644 index 000000000..d25eaff56 --- /dev/null +++ b/mod/groups/views/default/groups/grouplisting.php @@ -0,0 +1,49 @@ +<?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' => 'small', + ) + ); + + //get the membership type + $membership = $vars['entity']->membership; + if($membership == 2) + $mem = elgg_echo("groups:open"); + else + $mem = elgg_echo("groups:closed"); + + //for admins display the feature or unfeature option + 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"); + } + + $info .= "<div class=\"groupdetails\"><p>" . $mem . " / <b>" . get_group_members($vars['entity']->guid, 10, 0, 0, true) ."</b> " . elgg_echo("groups:member") . "</p>"; + //if admin, show make featured option + if(isadminloggedin()) + $info .= "<p><a href=\"{$url}\">{$wording}</a></p>"; + $info .= "</div>"; + $info .= "<p><b><a href=\"" . $vars['entity']->getUrl() . "\">" . $vars['entity']->name . "</a></b></p>"; + $info .= "<p class=\"owner_timestamp\">" . $vars['entity']->briefdescription . "</p>"; + + // num users, last activity, owner etc + + echo elgg_view_listing($icon, $info); + +?> diff --git a/mod/groups/views/default/groups/groupprofile.php b/mod/groups/views/default/groups/groupprofile.php new file mode 100644 index 000000000..1c989c9a8 --- /dev/null +++ b/mod/groups/views/default/groups/groupprofile.php @@ -0,0 +1,102 @@ +<?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/ + */ + + if ($vars['full'] == true) { + $iconsize = "large"; + } else { + $iconsize = "medium"; + } + +?> + +<div id="groups_info_column_right"><!-- start of groups_info_column_right --> + <div id="groups_icon_wrapper"><!-- start of groups_icon_wrapper --> + + <?php + echo elgg_view( + "groups/icon", array( + 'entity' => $vars['entity'], + //'align' => "left", + 'size' => $iconsize, + ) + ); + ?> + + </div><!-- end of groups_icon_wrapper --> + <div id="group_stats"><!-- start of 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><!-- end of group_stats --> +</div><!-- end of groups_info_column_right --> + +<div id="groups_info_column_left"><!-- start of groups_info_column_left --> + <?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><!-- end of groups_info_column_left --> + +<div id="groups_info_wide"> + + <p class="groups_info_edit_buttons"> + +<?php + if ($vars['entity']->canEdit()) + { + +?> + + <a href="<?php echo $vars['url']; ?>mod/groups/edit.php?group_guid=<?php echo $vars['entity']->getGUID(); ?>"><?php echo elgg_echo("edit"); ?></a> + + +<?php + + } + +?> + + </p> +</div> +<div class="clearfloat"></div>
\ No newline at end of file diff --git a/mod/groups/views/default/groups/icon.php b/mod/groups/views/default/groups/icon.php new file mode 100644 index 000000000..7390200d9 --- /dev/null +++ b/mod/groups/views/default/groups/icon.php @@ -0,0 +1,48 @@ +<?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'] = "medium"; + + // 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="groupicon"> +<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 new file mode 100644 index 000000000..fbbbafb22 --- /dev/null +++ b/mod/groups/views/default/groups/invitationrequests.php @@ -0,0 +1,44 @@ +<div class="contentWrapper"> + +<?php + + if (!empty($vars['invitations']) && is_array($vars['invitations'])) { + $user = get_loggedin_user(); + foreach($vars['invitations'] as $group) + if ($group instanceof ElggGroup) { + +?> + <div class="reportedcontent_content active_report"> + <div class="groups_membershiprequest_buttons"> + <?php + echo "<div class=\"member_icon\"><a href=\"" . $group->getURL() . "\">"; + echo elgg_view("profile/icon", array( + 'entity' => $group, + 'size' => 'small', + 'override' => 'true' + )); + echo "</a></div>{$group->name}<br />"; + + echo str_replace('<a', '<a class="delete_report_button" ', elgg_view('output/confirmlink',array( + 'href' => $vars['url'] . "action/groups/killinvitation?user_guid={$user->getGUID()}&group_guid={$group->getGUID()}", + 'confirm' => elgg_echo('groups:joinrequest:remove:check'), + 'text' => elgg_echo('delete'), + ))); + $url = elgg_add_action_tokens_to_url("{$vars['url']}action/groups/join?user_guid={$user->guid}&group_guid={$group->guid}"); + ?> + <a href="<?php echo $url; ?>" class="archive_report_button"><?php echo elgg_echo('accept'); ?></a> + <br /><br /> + </div> + </div> +<?php + + } + + } else { + + echo "<p>" . elgg_echo('groups:invitations:none') . "</p>"; + + } + +?> +</div> diff --git a/mod/groups/views/default/groups/members.php b/mod/groups/views/default/groups/members.php new file mode 100644 index 000000000..66f2604c0 --- /dev/null +++ b/mod/groups/views/default/groups/members.php @@ -0,0 +1,30 @@ +<?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"> +<h2><?php echo elgg_echo("groups:members"); ?></h2> + +<?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 class="clearfloat" /></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 new file mode 100644 index 000000000..9ac37990a --- /dev/null +++ b/mod/groups/views/default/groups/membershiprequests.php @@ -0,0 +1,44 @@ +<div class="contentWrapper"> + +<?php + + if (!empty($vars['requests']) && is_array($vars['requests'])) { + + foreach($vars['requests'] as $request) + if ($request instanceof ElggUser) { + +?> + <div class="reportedcontent_content active_report"> + <div class="groups_membershiprequest_buttons"> + <?php + echo "<div class=\"member_icon\"><a href=\"" . $request->getURL() . "\">"; + echo elgg_view("profile/icon", array( + 'entity' => $request, + 'size' => 'small', + 'override' => 'true' + )); + echo "</a></div>{$request->name}<br />"; + + echo str_replace('<a', '<a class="delete_report_button" ', 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'), + ))); + $url = elgg_add_action_tokens_to_url("{$vars['url']}action/groups/addtogroup?user_guid={$request->guid}&group_guid={$vars['entity']->guid}"); + ?> + <a href="<?php echo $url; ?>" class="archive_report_button"><?php echo elgg_echo('accept'); ?></a> + <br /><br /> + </div> + </div> +<?php + + } + + } else { + + echo "<p>" . elgg_echo('groups:requests:none') . "</p>"; + + } + +?> +</div> diff --git a/mod/groups/views/default/groups/profileitems.php b/mod/groups/views/default/groups/profileitems.php new file mode 100644 index 000000000..7309c8a71 --- /dev/null +++ b/mod/groups/views/default/groups/profileitems.php @@ -0,0 +1,28 @@ +<?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=\"clearfloat\"></div><div id=\"fullcolumn\">"; + echo elgg_view("groups/forum_latest",array('entity' => $vars['entity'])); + echo "</div>"; + + //right column + echo "<div id=\"right_column\">"; + echo elgg_view("groups/right_column",array('entity' => $vars['entity'])); + echo "</div>"; + + //left column + echo "<div id=\"left_column\">"; + 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 new file mode 100644 index 000000000..7de921ed0 --- /dev/null +++ b/mod/groups/views/default/groups/side_menu.php @@ -0,0 +1,10 @@ +<div class="sidebarBox"> +<div id="owner_block_submenu"><ul> +<?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>"; + echo "<li><a href=\"{$vars['url']}pg/groups/new/\">". elgg_echo('groups:new') ."</a></li>"; + } +?> +</ul></div></div>
\ 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 new file mode 100644 index 000000000..a9d69a691 --- /dev/null +++ b/mod/groups/views/default/icon/group/default/large.php @@ -0,0 +1,3 @@ +<?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 new file mode 100644 index 000000000..47cf328b8 --- /dev/null +++ b/mod/groups/views/default/icon/group/default/medium.php @@ -0,0 +1,3 @@ +<?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 new file mode 100644 index 000000000..b052c1cc3 --- /dev/null +++ b/mod/groups/views/default/icon/group/default/small.php @@ -0,0 +1,3 @@ +<?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 new file mode 100644 index 000000000..1023d06e2 --- /dev/null +++ b/mod/groups/views/default/icon/group/default/tiny.php @@ -0,0 +1,3 @@ +<?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 new file mode 100644 index 000000000..1dd57c859 --- /dev/null +++ b/mod/groups/views/default/object/groupforumtopic.php @@ -0,0 +1,77 @@ +<?php + + /** + * 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"){ + + $info = "<p class=\"latest_discussion_info\">" . sprintf(elgg_echo('group:created'), $forum_created, $counter) . "<br /><span class=\"timestamp\">"; + if (($last_time) && ($u)) $info.= sprintf(elgg_echo('groups:lastupdated'), friendly_time($last_time), " <a href=\"" . $u->getURL() . "\">" . $u->name . "</a>"); + $info .= '</span></p>'; + //get the group avatar + $icon = elgg_view("profile/icon",array('entity' => $group, 'size' => 'small')); + //get the group and topic title + if ($group instanceof ElggGroup) + $info .= "<p>" . elgg_echo('group') . ": <a href=\"{$group->getURL()}\">".htmlentities($group->name, ENT_QUOTES, 'UTF-8') ."</a></p>"; + + $info .= "<p>" . elgg_echo('topic') . ": <a href=\"{$vars['url']}mod/groups/topicposts.php?topic={$vars['entity']->guid}&group_guid={$group->guid}\">{$title}</a></p>"; + //get the forum description + //$info .= $description; + + }else{ + + $info = "<span class=\"latest_discussion_info\"><span class=\"timestamp\">" . sprintf(elgg_echo('group:created'), $forum_created, $counter) . "</span>"; + if (($last_time) && ($u)) $info.= "<br /><span class='timestamp'>" . elgg_echo('groups:updated') . " " . friendly_time($last_time) . " by <a href=\"" . $u->getURL() . "\">" . $u->name . "</a></span>"; + + if (groups_can_edit_discussion($vars['entity'], page_owner_entity()->owner_guid)) { + + // display the delete link to those allowed to delete + $info .= "<br /><span class=\"delete_discussion\">" . 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'), + )) . "</span>"; + + } + + $info .= "</span>"; + + //get the user avatar + $icon = elgg_view("profile/icon",array('entity' => $topic_owner, 'size' => 'small')); + $info .= "<p>" . 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>"; + $info .= "<div class='clearfloat'></div>"; + + } + + //display + echo elgg_view_listing($icon, $info); + +?>
\ 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 new file mode 100644 index 000000000..fb6cd707c --- /dev/null +++ b/mod/groups/views/default/river/forum/create.php @@ -0,0 +1,27 @@ +<?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 new file mode 100644 index 000000000..f4c4aadfd --- /dev/null +++ b/mod/groups/views/default/river/forum/topic/create.php @@ -0,0 +1,27 @@ +<?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 new file mode 100644 index 000000000..e96bb9b34 --- /dev/null +++ b/mod/groups/views/default/river/group/create.php @@ -0,0 +1,13 @@ +<?php + + $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>"; + +?> + +<?php echo $string; ?>
\ 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 new file mode 100644 index 000000000..94903fd66 --- /dev/null +++ b/mod/groups/views/default/river/object/group/create.php @@ -0,0 +1,13 @@ +<?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 new file mode 100644 index 000000000..c6aa1e5ab --- /dev/null +++ b/mod/groups/views/default/river/object/groupforumtopic/annotate.php @@ -0,0 +1,14 @@ +<?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 new file mode 100644 index 000000000..7c7d89bad --- /dev/null +++ b/mod/groups/views/default/river/object/groupforumtopic/create.php @@ -0,0 +1,14 @@ +<?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: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>"; + +?> + +<?php echo $string; ?>
\ No newline at end of file diff --git a/mod/groups/views/default/river/object/groupforumtopic/update.php b/mod/groups/views/default/river/object/groupforumtopic/update.php new file mode 100644 index 000000000..d13c2b61f --- /dev/null +++ b/mod/groups/views/default/river/object/groupforumtopic/update.php @@ -0,0 +1,13 @@ +<?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 new file mode 100644 index 000000000..e5e318ce0 --- /dev/null +++ b/mod/groups/views/default/river/relationship/member/create.php @@ -0,0 +1,40 @@ +<?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/ + */ + + $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 diff --git a/mod/groups/views/default/settings/groups/edit.php b/mod/groups/views/default/settings/groups/edit.php new file mode 100644 index 000000000..311e58dee --- /dev/null +++ b/mod/groups/views/default/settings/groups/edit.php @@ -0,0 +1,18 @@ +<?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 new file mode 100644 index 000000000..5c3d6b316 --- /dev/null +++ b/mod/groups/views/default/sharing/invite.php @@ -0,0 +1,41 @@ +<?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/edit.php b/mod/groups/views/default/widgets/a_users_groups/edit.php new file mode 100644 index 000000000..fa47cdd62 --- /dev/null +++ b/mod/groups/views/default/widgets/a_users_groups/edit.php @@ -0,0 +1,14 @@ +<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 diff --git a/mod/groups/views/default/widgets/a_users_groups/view.php b/mod/groups/views/default/widgets/a_users_groups/view.php new file mode 100644 index 000000000..3328a8778 --- /dev/null +++ b/mod/groups/views/default/widgets/a_users_groups/view.php @@ -0,0 +1,42 @@ +<?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 new file mode 100644 index 000000000..dbf82b2ec --- /dev/null +++ b/mod/groups/views/default/widgets/group_entities_widget/edit.php @@ -0,0 +1,23 @@ +<?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 new file mode 100644 index 000000000..edba53cb5 --- /dev/null +++ b/mod/groups/views/default/widgets/group_entities_widget/view.php @@ -0,0 +1,35 @@ +<?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 new file mode 100644 index 000000000..6d385c204 --- /dev/null +++ b/mod/groups/views/default/widgets/group_members_widget/edit.php @@ -0,0 +1,23 @@ +<?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 new file mode 100644 index 000000000..502affd12 --- /dev/null +++ b/mod/groups/views/default/widgets/group_members_widget/view.php @@ -0,0 +1,35 @@ +<?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 diff --git a/mod/groups/views/rss/forum/topicposts.php b/mod/groups/views/rss/forum/topicposts.php new file mode 100644 index 000000000..15c5adc7f --- /dev/null +++ b/mod/groups/views/rss/forum/topicposts.php @@ -0,0 +1,3 @@ +<?php + +?>
\ No newline at end of file diff --git a/mod/groups/views/rss/forum/topics.php b/mod/groups/views/rss/forum/topics.php new file mode 100644 index 000000000..6f3ca34f1 --- /dev/null +++ b/mod/groups/views/rss/forum/topics.php @@ -0,0 +1,14 @@ +<?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/ + */ + + // If there are any topics to view, view them + echo $vars['topics']; +?>
\ No newline at end of file diff --git a/mod/groups/views/rss/forum/viewposts.php b/mod/groups/views/rss/forum/viewposts.php new file mode 100644 index 000000000..464ca1a7b --- /dev/null +++ b/mod/groups/views/rss/forum/viewposts.php @@ -0,0 +1,26 @@ +<?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/ + */ + + //display follow up comments + $count = $vars['entity']->countAnnotations('group_topic_post'); + $offset = (int) get_input('offset',0); + + foreach($vars['entity']->getAnnotations('group_topic_post', 50, $offset, "asc") as $post) { + + $post->title = ''; + $post->description = $post->value; + echo elgg_view('object/default', array('entity' => $post)); + // echo elgg_view("forum/topicposts",array('entity' => $post)); + + } + +?>
\ No newline at end of file diff --git a/mod/groups/views/rss/groups/contentwrapper.php b/mod/groups/views/rss/groups/contentwrapper.php new file mode 100644 index 000000000..15397d552 --- /dev/null +++ b/mod/groups/views/rss/groups/contentwrapper.php @@ -0,0 +1,5 @@ +<?php + + echo $vars['body']; + +?>
\ No newline at end of file diff --git a/mod/groups/views/rss/groups/profileitems.php b/mod/groups/views/rss/groups/profileitems.php new file mode 100644 index 000000000..bae449a4c --- /dev/null +++ b/mod/groups/views/rss/groups/profileitems.php @@ -0,0 +1,20 @@ +<?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/ + */ + + //right column + if ($forae = elgg_get_entities(array('types' => 'object', 'owner_guid' => $vars['entity']->guid))) { + //if ($forae = get_entities_from_annotations("object", "groupforumtopic", "group_topic_post", "", 0, $vars['entity']->guid, 20, 0, "desc", false)) { + foreach($forae as $forum) + echo elgg_view_entity($forum); + } + +?>
\ No newline at end of file |