Example #1
0
/**
 * Groups page handler
 *
 * URLs take the form of
 *  All groups:           groups/all
 *  User's owned groups:  groups/owner/<username>
 *  User's member groups: groups/member/<username>
 *  Group profile:        groups/profile/<guid>/<title>
 *  New group:            groups/add/<guid>
 *  Edit group:           groups/edit/<guid>
 *  Group invitations:    groups/invitations/<username>
 *  Invite to group:      groups/invite/<guid>
 *  Membership requests:  groups/requests/<guid>
 *  Group activity:       groups/activity/<guid>
 *  Group members:        groups/members/<guid>
 *
 * @param array $page Array of url segments for routing
 * @return bool
 */
function groups_page_handler($page)
{
    // forward old profile urls
    if (is_numeric($page[0])) {
        $group = get_entity($page[0]);
        if (elgg_instanceof($group, 'group', '', 'ElggGroup')) {
            system_message(elgg_echo('changebookmark'));
            forward($group->getURL());
        }
    }
    elgg_load_library('elgg:groups');
    if (!isset($page[0])) {
        $page[0] = 'all';
    }
    elgg_push_breadcrumb(elgg_echo('groups'), "groups/all");
    switch ($page[0]) {
        case 'all':
            groups_handle_all_page();
            break;
        case 'search':
            groups_search_page();
            break;
        case 'owner':
            groups_handle_owned_page();
            break;
        case 'member':
            set_input('username', $page[1]);
            groups_handle_mine_page();
            break;
        case 'invitations':
            set_input('username', $page[1]);
            groups_handle_invitations_page();
            break;
        case 'add':
            groups_handle_edit_page('add');
            break;
        case 'edit':
            groups_handle_edit_page('edit', $page[1]);
            break;
        case 'profile':
            groups_handle_profile_page($page[1]);
            break;
        case 'activity':
            groups_handle_activity_page($page[1]);
            break;
        case 'members':
            groups_handle_members_page($page[1]);
            break;
        case 'invite':
            groups_handle_invite_page($page[1]);
            break;
        case 'requests':
            groups_handle_requests_page($page[1]);
            break;
        default:
            return false;
    }
    return true;
}
Example #2
0
/**
 * Groups page handler
 *
 * URLs take the form of
 *  All groups:           groups/all
 *  User's owned groups:  groups/owner/<username>
 *  User's member groups: groups/member/<username>
 *  Group profile:        groups/profile/<guid>/<title>
 *  New group:            groups/add/<guid>
 *  Edit group:           groups/edit/<guid>
 *  Group invitations:    groups/invitations/<username>
 *  Invite to group:      groups/invite/<guid>
 *  Membership requests:  groups/requests/<guid>
 *  Group activity:       groups/activity/<guid>
 *  Group members:        groups/members/<guid>
 *
 * @param array $page Array of url segments for routing
 */
function groups_page_handler($page)
{
    elgg_load_library('elgg:groups');
    elgg_push_breadcrumb(elgg_echo('groups'), "groups/all");
    switch ($page[0]) {
        case 'all':
            groups_handle_all_page();
            break;
        case 'search':
            groups_search_page();
            break;
        case 'owner':
            groups_handle_owned_page();
            break;
        case 'member':
            set_input('username', $page[1]);
            groups_handle_mine_page();
            break;
        case 'invitations':
            set_input('username', $page[1]);
            groups_handle_invitations_page();
            break;
        case 'add':
            groups_handle_edit_page('add');
            break;
        case 'edit':
            groups_handle_edit_page('edit', $page[1]);
            break;
        case 'profile':
            groups_handle_profile_page($page[1]);
            break;
        case 'activity':
            groups_handle_activity_page($page[1]);
            break;
        case 'members':
            groups_handle_members_page($page[1]);
            break;
        case 'invite':
            groups_handle_invite_page($page[1]);
            break;
        case 'requests':
            groups_handle_requests_page($page[1]);
            break;
    }
}
Example #3
0
/**
 * Extends groups page handler
 *
 * URLs take the form of
 *  Local groups:         groups/local
 *  Working groups:       groups/working
 *  Add local group:      groups/local/add
 *  Edit local group:     groups/local/edit/<guid> 
 *  Add working group:    groups/working/add
 *  Edit working group:   groups/working/edit/<guid> 
 *
 */
function gvgroups_route_groups_handler($hook, $type, $return_value, $params)
{
    elgg_load_library('elgg:groups');
    /**
     * $return_value contains:
     * $return_value['handler'] => requested handler
     * $return_value['segments'] => url parts ($page)
     */
    $result = $return_value;
    if (!empty($return_value) && is_array($return_value)) {
        $page = $return_value['segments'];
        switch ($page[0]) {
            case 'all':
                // remove this url to avoid normal group access
                forward(REFERER);
                $result = false;
                break;
            case 'add':
                // remove this url to avoid normal group creation
                forward(REFERER);
                $result = false;
                break;
            case 'profile':
                $group = get_entity($page[1]);
                elgg_pop_breadcrumb();
                if ($group instanceof ElggGroup) {
                    if ($group->grouptype == 'local') {
                        elgg_push_breadcrumb(elgg_echo('gvgroups:localgroups'), "groups/local");
                    } else {
                        elgg_push_breadcrumb(elgg_echo('gvgroups:workinggroups'), "groups/working");
                    }
                    groups_handle_profile_page($page[1]);
                }
                $result = false;
                break;
            case 'edit':
                groups_handle_edit_page('edit', 'default', $page[1]);
                $result = false;
                break;
            case 'local':
                if ($page[1] == 'add') {
                    groups_handle_add_local_page($page[2]);
                } elseif ($page[1] == 'edit') {
                    groups_handle_edit_page('edit', $page[0], $page[2]);
                } else {
                    groups_handle_all_page($page[0]);
                }
                $result = false;
                break;
            case 'working':
                if ($page[1] == 'add') {
                    groups_handle_edit_page('add', $page[0]);
                } elseif ($page[1] == 'edit') {
                    groups_handle_edit_page('edit', $page[0], $page[2]);
                } else {
                    groups_handle_all_page($page[0]);
                }
                $result = false;
                break;
        }
    }
    return $result;
}
Example #4
0
/**
 * Groups page handler
 *
 * URLs take the form of
 *  All groups:           groups/all
 *  User's owned groups:  groups/owner/<username>
 *  User's member groups: groups/member/<username>
 *  Group profile:        groups/profile/<guid>/<title>
 *  New group:            groups/add/<guid>
 *  Edit group:           groups/edit/<guid>
 *  Group invitations:    groups/invitations/<username>
 *  Invite to group:      groups/invite/<guid>
 *  Membership requests:  groups/requests/<guid>
 *  Group activity:       groups/activity/<guid>
 *  Group members:        groups/members/<guid>
 *
 * @param array $page Array of url segments for routing
 * @return bool
 */
function groups_page_handler($page)
{
    elgg_load_library('elgg:groups');
    if (!isset($page[0])) {
        $page[0] = 'all';
    }
    elgg_push_breadcrumb(elgg_echo('groups'), "groups/all");
    switch ($page[0]) {
        case 'all':
            groups_handle_all_page();
            break;
        case 'search':
            groups_search_page();
            break;
        case 'owner':
            groups_handle_owned_page();
            break;
        case 'member':
            set_input('username', $page[1]);
            groups_handle_mine_page();
            break;
        case 'invitations':
            set_input('username', $page[1]);
            groups_handle_invitations_page();
            break;
        case 'add':
            groups_handle_edit_page('add');
            break;
        case 'edit':
            groups_handle_edit_page('edit', $page[1]);
            break;
        case 'manage':
            /* custom */
            groups_handle_manage_page('manage', $page[1]);
            break;
        case 'groupbalance':
            groups_handle_groupbalance_page('groupbalance', $page[1]);
            break;
            /* custom */
        /* custom */
        case 'profile':
            groups_handle_profile_page($page[1]);
            break;
        case 'activity':
            groups_handle_activity_page($page[1]);
            break;
        case 'members':
            groups_handle_members_page($page[1]);
            break;
        case 'invite':
            groups_handle_invite_page($page[1]);
            break;
        case 'requests':
            groups_handle_requests_page($page[1]);
            break;
        default:
            return false;
    }
    return true;
}
Example #5
0
/**
 * Groups page handler
 *
 * URLs take the form of
 *  All groups:           groups/all
 *  User's owned groups:  groups/owner/<username>
 *  User's member groups: groups/member/<username>
 *  Group profile:        groups/profile/<guid>/<title>
 *  New group:            groups/add/<guid>
 *  Edit group:           groups/edit/<guid>
 *  Group invitations:    groups/invitations/<username>
 *  Invite to group:      groups/invite/<guid>
 *  Membership requests:  groups/requests/<guid>
 *  Group activity:       groups/activity/<guid>
 *  Group members:        groups/members/<guid>
 *
 * @param array $page Array of url segments for routing
 * @return bool
 */
function groups_page_handler($page)
{
    // forward old profile urls
    if (is_numeric($page[0])) {
        $group = get_entity($page[0]);
        if (elgg_instanceof($group, 'group', '', 'ElggGroup')) {
            system_message(elgg_echo('changebookmark'));
            forward($group->getURL());
        }
    }
    elgg_load_library('elgg:groups');
    if (!isset($page[0])) {
        $page[0] = 'all';
    }
    elgg_push_breadcrumb(elgg_echo('groups'), "groups/all");
    switch ($page[0]) {
        case 'add':
            groups_handle_edit_page('add');
            break;
        case 'edit':
            groups_handle_edit_page('edit', $page[1]);
            break;
        case 'profile':
            groups_handle_profile_page($page[1]);
            break;
        default:
            return false;
    }
    return true;
}