diff options
Diffstat (limited to 'mod/groups')
-rw-r--r-- | mod/groups/groupprofile.php | 24 | ||||
-rw-r--r-- | mod/groups/start.php | 46 | ||||
-rw-r--r-- | mod/groups/views/default/groups/grouplinks.php | 29 | ||||
-rw-r--r-- | mod/groups/views/default/groups/groupprofile.php | 106 | ||||
-rw-r--r-- | mod/groups/views/default/groups/menu/actions.php | 8 | ||||
-rw-r--r-- | mod/groups/views/default/groups/menu/ownerlinks.php | 17 |
6 files changed, 202 insertions, 28 deletions
diff --git a/mod/groups/groupprofile.php b/mod/groups/groupprofile.php new file mode 100644 index 000000000..9d354ef0d --- /dev/null +++ b/mod/groups/groupprofile.php @@ -0,0 +1,24 @@ +<?php + /** + * Full group profile + * + * @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/ + */ + + $group_guid = get_input('group_guid'); + + $group = get_entity($group_guid); + + + $body = elgg_view('group/group', array('entity' => $group, 'user' => $_SESSION['user'], 'full' => true)); + + + // TODO: Add widgets etc + + // Finally draw the page + page_draw($group->name, elgg_view_layout('one_column', $body)); +?>
\ No newline at end of file diff --git a/mod/groups/start.php b/mod/groups/start.php index b6b49b32c..f577b096c 100644 --- a/mod/groups/start.php +++ b/mod/groups/start.php @@ -21,9 +21,9 @@ 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/"), + menu_item(elgg_echo('groups:new'), $CONFIG->wwwroot."pg/groups/new/"), + menu_item(elgg_echo('groups:yours'), $CONFIG->wwwroot . "pg/groups/owned/" . $_SESSION['user']->username), + menu_item(elgg_echo('groups:all'), $CONFIG->wwwroot . "pg/groups/world/"), ),'groups'); } else @@ -50,6 +50,8 @@ register_action("groups/addtogroup",false, $CONFIG->pluginspath . "groups/actions/addtogroup.php"); + // Use group widgets + use_widgets('groups'); // For now, we'll hard code the groups profile items as follows: // TODO make this user configurable @@ -80,27 +82,31 @@ { global $CONFIG; - // The username should be the file we're getting - if (isset($page[0])) { - set_input('username',$page[0]); - } - if (isset($page[1])) + if (isset($page[0])) { - switch($page[1]) - { - case "new": - include($CONFIG->pluginspath . "groups/new.php"); + // See what context we're using + switch($page[0]) + { + 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"); + case "owned" : + // Owned by a user + if (isset($page[1])) + set_input('username',$page[1]); + + include($CONFIG->pluginspath . "groups/index.php"); + break; + + default: + set_input('group_guid', $page[0]); + include($CONFIG->pluginspath . "groups/groupprofile.php"); + break; + } } } @@ -115,7 +121,9 @@ global $CONFIG; - return $CONFIG->url . "pg/view/" . $entity->getGUID() . "/"; + $title = friendly_title($entity->title); + + return $CONFIG->url . "pg/groups/{$entity->guid}/$title/"; } diff --git a/mod/groups/views/default/groups/grouplinks.php b/mod/groups/views/default/groups/grouplinks.php new file mode 100644 index 000000000..0397cec08 --- /dev/null +++ b/mod/groups/views/default/groups/grouplinks.php @@ -0,0 +1,29 @@ +<?php + /** + * Group links + * + * @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/ + */ + + //check to see if the user is looking at their own profile + if($_SESSION['user']->guid == $vars['entity']->owner_guid){ + + echo "<div id=\"profile_menu_wrapper\">"; //start the wrapper div + echo elgg_view("groups/menu/actions",$vars); + echo elgg_view("groups/menu/ownerlinks",$vars); + echo "</div>"; //close wrapper div + + } else { + + echo "<div id=\"profile_menu_wrapper\">"; //start the wrapper div + echo elgg_view("groups/menu/actions",$vars); //grab action links such as make friend + echo elgg_view("groups/menu/links",$vars); //passive links to items such as user blog etc + echo "</div>"; //close wrapper div + + } + +?>
\ No newline at end of file diff --git a/mod/groups/views/default/groups/groupprofile.php b/mod/groups/views/default/groups/groupprofile.php index bf0945c63..6eb403bb5 100644 --- a/mod/groups/views/default/groups/groupprofile.php +++ b/mod/groups/views/default/groups/groupprofile.php @@ -15,8 +15,110 @@ $iconsize = "medium"; } +?> +<table> + <tr> + <td> + + <div id="groups_info_column_left"> + <div id="groups_icon_wrapper"> + + <?php + echo elgg_view( + "groups/icon", array( + 'entity' => $vars['entity'], + //'align' => "left", + 'size' => $iconsize, + ) + ); + + // display relevant links + echo elgg_view("groups/grouplinks", array("entity" => $vars['entity'])); + ?> + + </div> + </div> + + </td> + + <td> + <div id="groups_info_column_right"> + + <?php + echo "<h2><a href=\"" . $vars['entity']->getURL() . "\">" . $vars['entity']->title . "</a></h2> <br />"; + + ?> + + <?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 != "title") { + $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>"; + + echo elgg_view("output/{$valtype}",array('value' => $vars['entity']->$shortname)); + + echo "</p>"; + } + } + } + } + + + ?> + + <div id="groups_owner"> + <?php + + echo "<b>" . elgg_echo("groups:owner") . "</b>"; + + echo elgg_view( + "profile/icon", array( + 'entity' => get_entity($vars['entity']->owner_guid), + //'align' => "left", + 'size' => 'small', + ) + ); + + ?> + </div> + </div> + </td> + </tr> +</table> + +<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 + + } +?> - // join / leave (if can join & leave) -?>
\ No newline at end of file + </p> +</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 index 21101ddb8..2c686fd95 100644 --- a/mod/groups/views/default/groups/menu/actions.php +++ b/mod/groups/views/default/groups/menu/actions.php @@ -33,12 +33,6 @@ } } - // 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/ownerlinks.php b/mod/groups/views/default/groups/menu/ownerlinks.php index 15c5adc7f..aaa575bec 100644 --- a/mod/groups/views/default/groups/menu/ownerlinks.php +++ b/mod/groups/views/default/groups/menu/ownerlinks.php @@ -1,3 +1,20 @@ <?php + /** + * Owner links + * + * @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/ + */ + + // edit + if (($_SESSION['user']->getGUID() == $vars['entity']->owner_guid) && ($vars['full'])) + { + ?> + <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 |