diff options
22 files changed, 902 insertions, 0 deletions
diff --git a/mod/groups/actions/addtogroup.php b/mod/groups/actions/addtogroup.php new file mode 100644 index 000000000..db697d573 --- /dev/null +++ b/mod/groups/actions/addtogroup.php @@ -0,0 +1,79 @@ +<?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 Marcus Povey + * @copyright Curverider Ltd 2008 + * @link http://elgg.com/ + */ + + // Load configuration + global $CONFIG; + + gatekeeper(); + + $user_guid = get_input('user_guid'); + $group_guid = get_input('group_guid'); + + $user = get_entity($user_guid); + $group = get_entity($group); + + if ($_SESSION['user']->getGUID() == $group->getGUID()) + { + $requests = $user->group_join_request; + if ($requests) + { + foreach ($requests as $request) + { + if ($request == $group->getGUID()) + { + // User has requested to join this group previously, so we can safely add them + + // add them + if ($group->join($user)) + { + + // send welcome email + notify_user($user->getGUID(), "", + sprintf(elgg_echo('groups:welcome:subject'), $group->title), + sprintf(elgg_echo('groups:welcome:body'), $user->name, $group->title, $group->getURL()), + NULL, "email"); + + system_message(elgg_echo('groups:addedtogroup')); + + } + else + system_message(elgg_echo("groups:cantjoin")); + + forward($_SERVER['HTTP_REFERER']); + exit; + } + } + + // Not found in request array, so send an invite and set invite flag + + // Set invite flag + if (!$user->setMetaData('group_invite', $group->getGUID(), "", true)) + system_message(elgg_echo("groups:usernotinvited")); + else + { + // Send email + if (notify_user($user->getGUID(), "", + sprintf(elgg_echo('groups:invite:subject'), $user->name, $group->title), + sprintf(elgg_echo('groups:invite:body'), $user->name, $group->title, "http://{$CONFIG->url}action/groups/join?user_guid={$user->guid}&group_guid={$group->guid}"), + NULL, "email")) + system_message(elgg_echo("groups:userinvited")); + else + system_message(elgg_echo("groups:usernotinvited")); + } + } + } + else + system_message(elgg_echo("groups:notowner")); + + forward($_SERVER['HTTP_REFERER']); + exit; +?>
\ 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..4e9cdf99e --- /dev/null +++ b/mod/groups/actions/edit.php @@ -0,0 +1,60 @@ +<?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 Marcus Povey + * @copyright Curverider Ltd 2008 + * @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())) + { + system_message(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; + } + } + + // Get access + $group->access_id = get_input('access_id', 0); + + $group->save(); + + $group->join($user); // Creator always a member + + system_message(elgg_echo("groups:saved")); + + // Forward to the user's profile + forward($group->getUrl()); + exit; +?>
\ No newline at end of file diff --git a/mod/groups/actions/join.php b/mod/groups/actions/join.php new file mode 100644 index 000000000..77d2e3021 --- /dev/null +++ b/mod/groups/actions/join.php @@ -0,0 +1,54 @@ +<?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 Marcus Povey + * @copyright Curverider Ltd 2008 + * @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->access_id == 2) + { + if ($group->join($user)) + { + system_message(elgg_echo("groups:joined")); + + forward($group->getURL()); + exit; + } + else + system_message(elgg_echo("groups:cantjoin")); + } + else + { + // Closed group, request membership + system_message(elgg_echo('groups:privategroup')); + forward($CONFIG->url . "actions/groups/joinrequest?user_guid=$user_guid&group_guid=$group_guid"); + exit; + } + } + else + system_message(elgg_echo("groups:cantjoin")); + + forward($_SERVER['HTTP_REFERER']); + exit; +?>
\ No newline at end of file diff --git a/mod/groups/actions/joinrequest.php b/mod/groups/actions/joinrequest.php new file mode 100644 index 000000000..6288e0e76 --- /dev/null +++ b/mod/groups/actions/joinrequest.php @@ -0,0 +1,73 @@ +<?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 Marcus Povey + * @copyright Curverider Ltd 2008 + * @link http://elgg.com/ + */ + + // Load configuration + global $CONFIG; + + gatekeeper(); + + $user_guid = get_input('user_guid'); + $group_guid = get_input('group_guid'); + + $user = get_entity($user_guid); + $group = get_entity($group); + + if (!$group->isMember($user)) + { + $invites = $user->group_invite; + + if ($invites) + { + foreach ($invites as $invite) + { + if ($invite = $group->getGUID()) + { + if ($group->join($user)) + { + system_message(elgg_echo('groups:joined')); + + forward($group->getURL()); + exit; + } + else + system_message(elgg_echo('groups:cantjoin')); + + forward($_SERVER['HTTP_REFERER']); + exit; + } + + } + + // else email membership requiest + // set flag + + if (!$user->setMetaData('group_join_request', $group->getGUID(), "", true)) + system_message(elgg_echo("groups:joinrequestnotmade")); + else + { + // Send email + if (notify_user($group->owner_guid, "", + sprintf(elgg_echo('groups:request:subject'), $user->name, $group->title), + sprintf(elgg_echo('groups:request:body'), $group->getOwner()->name, $user->name, $group->title, $user->getURL(), "http://{$CONFIG->url}action/groups/addtogroup?user_guid={$user->guid}&group_guid={$group->guid}"), + NULL, "email")) + system_message(elgg_echo("groups:joinrequestmade")); + else + system_message(elgg_echo("groups:joinrequestnotmade")); + } + } + + } + else + system_message(elgg_echo('groups:alreadymember')); + + forward($_SERVER['HTTP_REFERER']); + exit; +?>
\ 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..87f976b3e --- /dev/null +++ b/mod/groups/actions/leave.php @@ -0,0 +1,39 @@ +<?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 Marcus Povey + * @copyright Curverider Ltd 2008 + * @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->leave($user)) + system_message(elgg_echo("groups:left")); + else + system_message(elgg_echo("groups:cantleave")); + } + else + system_message(elgg_echo("groups:cantleave")); + + forward($_SERVER['HTTP_REFERER']); + exit; +?>
\ No newline at end of file diff --git a/mod/groups/all.php b/mod/groups/all.php new file mode 100644 index 000000000..53d617e42 --- /dev/null +++ b/mod/groups/all.php @@ -0,0 +1,37 @@ +<?php + /** + * Elgg groups plugin + * + * @package ElggGroups + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Marcus Povey + * @copyright Curverider Ltd 2008 + * @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"); + + + // Get objects + $context = get_context(); + + set_context('search'); + if ($tag != "") + $objects = list_entities_from_metadata('tags',$tag,'group',"","", $limit, false); + else + $objects = list_entities('group',"", 0, $limit, false); + + set_context($context); + + $body = elgg_view_layout('one_column',$objects); + + // Finally draw the page + page_draw(sprintf(elgg_echo("groups:all"),page_owner_entity()->name), $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..dcd6db98d --- /dev/null +++ b/mod/groups/edit.php @@ -0,0 +1,27 @@ +<?php + /** + * Elgg groups plugin + * + * @package ElggGroups + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Marcus Povey + * @copyright Curverider Ltd 2008 + * @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); + + if (($group) && ($group->canEdit())) + { + $body = elgg_view_layout('one_column', elgg_view("forms/groups/edit", array('entity' => $group))); + + } else { + $area1 = elgg_echo("groups:noaccess"); + } + + page_draw(elgg_echo("groups:new"), $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..850fd4c3b --- /dev/null +++ b/mod/groups/index.php @@ -0,0 +1,28 @@ +<?php + /** + * Elgg groups plugin + * + * @package ElggGroups + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Marcus Povey + * @copyright Curverider Ltd 2008 + * @link http://elgg.com/ + */ + + require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); + + $limit = get_input("limit", 10); + $offset = get_input("offset", 0); + + // Get objects + $context = get_context(); + + set_context('search'); + $objects = list_entities("group", "", page_owner(), $limit, false); + set_context($context); + + $body = elgg_view_layout('one_column',$objects); + + // Finally draw the page + page_draw(sprintf(elgg_echo("groups:yours"),page_owner_entity()->name), $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..469f70717 --- /dev/null +++ b/mod/groups/languages/en.php @@ -0,0 +1,81 @@ +<?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 Marcus Povey + * @copyright Curverider Ltd 2008 + * @link http://elgg.com/ + */ + + $english = array( + + /** + * Menu items and titles + */ + + 'groups' => "Groups", + 'groups:yours' => "Your groups", + 'groups:user' => "%s's groups", + 'groups:all' => "All groups", + 'groups:new' => "Create a new group", + 'groups:edit' => "Edit a group", + + 'groups:title' => 'Group title', + 'groups:description' => 'Description', + 'groups:interests' => 'Interests', + 'groups:website' => 'Website', + 'groups:membership' => "Membership", + + 'groups:noaccess' => 'No access to group', + 'groups:cantedit' => 'You can not edit this group', + 'groups:saved' => 'Group saved', + + 'groups:joinrequest' => 'Request membership', + 'groups:join' => 'Join group', + 'groups:leave' => 'Leave group', + + + 'groups:privategroup' => 'This group is private, requesting membership.', + 'groups:cantjoin' => 'Can not join group', + 'groups:cantleave' => 'Could not leave group', + 'groups:addedtogroup' => 'Successfully added the user to the group', + 'groups:joinrequestnotmade' => 'Join request could not be made', + 'groups:joinrequestmade' => 'Request to join group successfully made', + 'groups:joined' => 'Successfully joined group!', + 'groups:left' => 'Successfully left group', + 'groups:notowner' => 'Sorry, you are not the owner 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:invite:subject' => '%s you have been invited to join \'%s\'!', + 'groups:invite:body' => 'Hi %s, + +You have been invited 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', + + ); + + add_translation("en",$english); +?>
\ No newline at end of file diff --git a/mod/groups/manifest.xml b/mod/groups/manifest.xml new file mode 100644 index 000000000..7b1fe8b87 --- /dev/null +++ b/mod/groups/manifest.xml @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="UTF-8"?> +<plugin_manifest> + <field key="author" value="Marcus Povey" /> + <field key="version" value="1.0" /> + <field key="description" value="Provides group support for elgg" /> + <field key="website" value="http://www.elgg.org/" /> + <field key="copyright" value="(C) Curverider 2008" /> + <field key="licence" value="GNU Public License version 2" /> +</plugin_manifest>
\ No newline at end of file diff --git a/mod/groups/new.php b/mod/groups/new.php new file mode 100644 index 000000000..d031fc3e8 --- /dev/null +++ b/mod/groups/new.php @@ -0,0 +1,19 @@ +<?php + /** + * Elgg groups plugin + * + * @package ElggGroups + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Marcus Povey + * @copyright Curverider Ltd 2008 + * @link http://elgg.com/ + */ + + gatekeeper(); + + // Render the file upload page + + $body = elgg_view_layout('one_column', elgg_view("forms/groups/edit")); + + page_draw(elgg_echo("groups:new"), $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..b6c177a7d --- /dev/null +++ b/mod/groups/start.php @@ -0,0 +1,124 @@ +<?php + /** + * Elgg groups plugin + * + * @package ElggGroups + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Marcus Povey + * @copyright Curverider Ltd 2008 + * @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/" . $_SESSION['user']->username,array( + menu_item(elgg_echo('groups:new'), $CONFIG->wwwroot."pg/groups/" . $_SESSION['user']->username . "/new/"), + menu_item(elgg_echo('groups:yours'), $CONFIG->wwwroot . "pg/groups/" . $_SESSION['user']->username), + menu_item(elgg_echo('groups:all'), $CONFIG->wwwroot . "pg/groups/" . $_SESSION['user']->username . "/world/"), + ),'groups'); + } + else + { + add_menu(elgg_echo('groups'), $CONFIG->wwwroot . "mod/groups/",array( + menu_item(elgg_echo('groups:all'),$CONFIG->wwwroot."mod/groups/all.php"), + )); + } + + // Register a page handler, so we can have nice URLs + register_page_handler('groups','groups_page_handler'); + + // Register a URL handler for groups + register_entity_url_handler('groups_url','group','all'); + + // Register an icon handler for groups + register_page_handler('icon','groups_icon_handler'); + + // Register some actions + register_action("groups/edit",false, $CONFIG->pluginspath . "groups/actions/edit.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/adduser",false, $CONFIG->pluginspath . "groups/actions/adduser.php"); + + + // For now, we'll hard code the groups profile items as follows: + // TODO make this user configurable + + // Language short codes must be of the form "groups:key" + // where key is the array key below + $CONFIG->group = array( + + 'title' => 'text', + 'description' => 'longtext', + //'location' => 'tags', + 'interests' => 'tags', + //'skills' => 'tags', + //'contactemail' => 'email', + //'phone' => 'text', + //'mobile' => 'text', + 'website' => 'url', + + ); + } + + /** + * Group page handler + * + * @param array $page Array of page elements, forwarded by the page handling mechanism + */ + function groups_page_handler($page) + { + global $CONFIG; + + // The username should be the file we're getting + if (isset($page[0])) { + set_input('username',$page[0]); + } + + if (isset($page[1])) + { + switch($page[1]) + { + case "new": + include($CONFIG->pluginspath . "groups/new.php"); + break; + case "world": + include($CONFIG->pluginspath . "groups/all.php"); + break; + } + } + else + { + // Include the standard profile index + include($CONFIG->pluginspath . "groups/index.php"); + } + + } + + /** + * Populates the ->getUrl() method for group objects + * + * @param ElggEntity $entity File entity + * @return string File URL + */ + function groups_url($entity) { + + global $CONFIG; + + return $CONFIG->url . "pg/view/" . $entity->getGUID() . "/"; + + } + + // Make sure the groups initialisation function is called on initialisation + register_elgg_event_handler('init','system','groups_init'); +?>
\ No newline at end of file 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..7a3a9c353 --- /dev/null +++ b/mod/groups/views/default/forms/groups/edit.php @@ -0,0 +1,56 @@ +<?php + /** + * Elgg groups plugin + * + * @package ElggGroups + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Marcus Povey + * @copyright Curverider Ltd 2008 + * @link http://elgg.com/ + */ +?> +<form action="<?php echo $vars['url']; ?>action/groups/edit" method="post"> + +<?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' => 'access_id','value' => $access_id, 'options' => array( 0 => 'Private', 2=>'Public'))); ?> + </label> + </p> + + <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>
\ 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..c1f6d282f --- /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 Marcus Povey + * @copyright Curverider Ltd 2008 + * @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/groupgallery.php b/mod/groups/views/default/groups/groupgallery.php new file mode 100644 index 000000000..14ca2f95f --- /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 Marcus Povey + * @copyright Curverider Ltd 2008 + * @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']->title . "</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..1c86f2279 --- /dev/null +++ b/mod/groups/views/default/groups/grouplisting.php @@ -0,0 +1,27 @@ +<?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 Marcus Povey + * @copyright Curverider Ltd 2008 + * @link http://elgg.com/ + * + * @uses $vars['entity'] The user entity + */ + + $icon = elgg_view( + "groups/icon", array( + 'entity' => $vars['entity'], + 'size' => 'small', + ) + ); + + $info .= "<p><b><a href=\"" . $vars['entity']->getUrl() . "\">" . $vars['entity']->title . "</a></b></p>"; + + // num users, last activity, owner etc + + echo elgg_view_listing($icon, $info); + +?>
\ No newline at end of file diff --git a/mod/groups/views/default/groups/groupprofile.php b/mod/groups/views/default/groups/groupprofile.php new file mode 100644 index 000000000..bf0945c63 --- /dev/null +++ b/mod/groups/views/default/groups/groupprofile.php @@ -0,0 +1,22 @@ +<?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 Marcus Povey + * @copyright Curverider Ltd 2008 + * @link http://elgg.com/ + */ + + if ($vars['full'] == true) { + $iconsize = "large"; + } else { + $iconsize = "medium"; + } + + + + + // join / leave (if can join & leave) +?>
\ 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..0a3ce74a4 --- /dev/null +++ b/mod/groups/views/default/groups/icon.php @@ -0,0 +1,68 @@ +<?php + + /** + * Elgg group icon + * + * @package ElggGroups + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Marcus Povey + * @copyright Curverider Ltd 2008 + * @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']; + + // 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"; + } + + $name = htmlentities($vars['entity']->title); + + + + $username = $vars['entity']->username; // TODO : How do i do an icon when we have no username? +?> + +<div class="groupicon"> +<div class="avatar_menu_button"><img src="<?php echo $vars['url']; ?>_graphics/avatar_menu_arrow.gif" width="15" height="15" class="arrow" /></div> + + <div class="sub_menu"> + <a href="<?php echo $vars['entity']->getURL(); ?>"><h3><?php echo $vars['entity']->title; ?></h3></a> + <?php + if (isloggedin()) { + $actions = elgg_view('groups/menu/actions',$vars); + if (!empty($actions)) { + + echo "<div class=\"item_line\">{$actions}</div>"; + + } + if ($vars['entity']->owner_guid == $vars['user']->getGUID()) { + echo elgg_view('groups/menu/ownerlinks',$vars); + } else { + echo elgg_view('groups/menu/links',$vars); + } + } else { + echo elgg_view('groups/menu/links',$vars); + } + + ?> + + </div> + <a href="<?php echo $vars['entity']->getURL(); ?>" class="icon" ><img src="<?php echo $vars['url']; ?>pg/icon/<?php echo $username; ?>/<?php echo $vars['size']; ?>/<?php echo $icontime; ?>.jpg" border="0" <?php echo $align; ?> title="<?php echo $name; ?>" <?php echo $vars['js']; ?> /></a> +</div>
\ No newline at end of file diff --git a/mod/groups/views/default/groups/menu/actions.php b/mod/groups/views/default/groups/menu/actions.php new file mode 100644 index 000000000..21101ddb8 --- /dev/null +++ b/mod/groups/views/default/groups/menu/actions.php @@ -0,0 +1,44 @@ +<?php + /** + * Elgg group actions + * + * @package ElggGroups + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Marcus Povey + * @copyright Curverider Ltd 2008 + * @link http://elgg.com/ + */ + + if (isloggedin()) { + + if ($vars['entity']->isMember($_SESSION['user'])) + { +?> + <p><a href="<?php echo $vars['url']; ?>action/groups/leave?group_guid=<?php echo $vars['entity']->getGUID(); ?>"><?php echo elgg_echo("groups:leave"); ?></a></p> +<?php + } + else + { + if ($vars['entity']->access_id == 2) + { +?> + <p><a href="<?php echo $vars['url']; ?>action/groups/join?group_guid=<?php echo $vars['entity']->getGUID(); ?>"><?php echo elgg_echo("groups:join"); ?></a></p> +<?php + } + else + { +?> + <p><a href="<?php echo $vars['url']; ?>action/groups/joinrequest?group_guid=<?php echo $vars['entity']->getGUID(); ?>"><?php echo elgg_echo("groups:joinrequest"); ?></a></p> +<?php + } + } + + // edit + if ($_SESSION['user']->getGUID() == $vars['entity']->owner_guid) + { + ?> + <p><a href="<?php echo $vars['url']; ?>mod/groups/edit.php?group_guid=<?php echo $vars['entity']->getGUID(); ?>"><?php echo elgg_echo("edit"); ?></a></p> + <?php + } + } +?>
\ No newline at end of file diff --git a/mod/groups/views/default/groups/menu/adminlinks.php b/mod/groups/views/default/groups/menu/adminlinks.php new file mode 100644 index 000000000..15c5adc7f --- /dev/null +++ b/mod/groups/views/default/groups/menu/adminlinks.php @@ -0,0 +1,3 @@ +<?php + +?>
\ No newline at end of file diff --git a/mod/groups/views/default/groups/menu/links.php b/mod/groups/views/default/groups/menu/links.php new file mode 100644 index 000000000..15c5adc7f --- /dev/null +++ b/mod/groups/views/default/groups/menu/links.php @@ -0,0 +1,3 @@ +<?php + +?>
\ No newline at end of file diff --git a/mod/groups/views/default/groups/menu/ownerlinks.php b/mod/groups/views/default/groups/menu/ownerlinks.php new file mode 100644 index 000000000..15c5adc7f --- /dev/null +++ b/mod/groups/views/default/groups/menu/ownerlinks.php @@ -0,0 +1,3 @@ +<?php + +?>
\ No newline at end of file |