Esempio n. 1
0
/**
 * Setup group menus
 */
function pagesetup_groups()
{
    $page_owner = elgg_get_page_owner_entity();
    if (elgg_instanceof($page_owner, 'group')) {
        $group_maps = get_group_search_maps($page_owner);
        if (is_array($group_maps)) {
            foreach ($group_maps as $id => $gm) {
                $groupoption = "maps_{$id}_enable";
                if ($page_owner->{$groupoption} != 'no') {
                    elgg_register_menu_item('owner_block', array('name' => "maps:{$id}", 'text' => elgg_extract('title', $gm), 'href' => "maps/group/{$page_owner->guid}/{$id}"));
                }
            }
        }
    }
}
Esempio n. 2
0
<?php

namespace hypeJunction\Maps;

if ($group->maps_group_members_enable == "no") {
    return true;
}
$group = elgg_get_page_owner_entity();
$maps = get_group_search_maps($group);
if (!isset($maps['group_members'])) {
    return true;
}
elgg_push_context('widgets');
$params = $maps['group_members'];
$content = ElggMap::showMap($params);
elgg_pop_context();
echo elgg_view('groups/profile/module', array('title' => elgg_echo('maps:module:group_members'), 'content' => $content));
Esempio n. 3
0
/**
 * Handle map pages and markers
 *
 * @param array $page
 * @param string $handler
 * @return boolean
 */
function page_handler($page, $handler)
{
    elgg_push_breadcrumb(elgg_echo('maps'), 'maps');
    switch ($page[0]) {
        default:
        case 'search':
            $maps = get_site_search_maps();
            $ids = array_keys($maps);
            $id = elgg_extract(1, $page, $ids[0]);
            $map = elgg_extract($id, $maps, false);
            if (!$map) {
                return false;
            }
            $map['filter_context'] = 'search';
            $title = elgg_extract('title', $map, elgg_echo('maps:untitled'));
            elgg_push_breadcrumb($title);
            $filter = elgg_view("framework/maps/filters/site", $map);
            if (elgg_view_exists("framework/maps/search/{$id}/map")) {
                $content = elgg_view("framework/maps/search/{$id}/map", $map);
            } else {
                $content = elgg_view("framework/maps/search/_default/map", $map);
            }
            if (elgg_view_exists("framework/maps/search/{$id}/sidebar")) {
                $sidebar = elgg_view("framework/maps/search/{$id}/sidebar", $map);
            } else {
                $sidebar = elgg_view("framework/maps/search/_default/sidebar", $map);
            }
            break;
        case 'group':
            $group_guid = elgg_extract(1, $page);
            $group = get_entity($group_guid);
            if (!elgg_instanceof($group, 'group')) {
                return false;
            }
            $maps = get_group_search_maps($group);
            $ids = array_keys($maps);
            $id = elgg_extract(2, $page, $ids[0]);
            $map = elgg_extract($id, $maps, false);
            if (!$map) {
                return false;
            }
            $title = elgg_extract('title', $map, elgg_echo('maps:untitled'));
            elgg_push_breadcrumb($title);
            $filter = false;
            if (elgg_view_exists("framework/maps/search/{$id}/map")) {
                $content = elgg_view("framework/maps/search/{$id}/map", $map);
            } else {
                $content = elgg_view("framework/maps/search/_default/map", $map);
            }
            if (elgg_view_exists("framework/maps/search/{$id}/sidebar")) {
                $sidebar = elgg_view("framework/maps/search/{$id}/sidebar", $map);
            } else {
                $sidebar = elgg_view("framework/maps/search/_default/sidebar", $map);
            }
            break;
    }
    $layout = elgg_is_xhr() ? 'maps_ajax' : 'content';
    $pageshell = elgg_is_xhr() ? 'maps_ajax' : 'default';
    $layout_vars = array('title' => $title, 'content' => $content, 'filter' => $filter, 'sidebar' => $sidebar);
    $layout_vars = elgg_trigger_plugin_hook('layout', 'maps', array('segments' => $page, 'handler' => $handler), $layout_vars);
    if (empty($layout_vars['content'])) {
        return false;
    }
    $layout = elgg_view_layout($layout, $layout_vars);
    echo elgg_view_page($title, $layout, $pageshell);
    return true;
}