setSection() public method

Set the section identifier
public setSection ( string $section ) : void
$section string The identifier of the section
return void
Esempio n. 1
0
/**
 * Add to the user hover menu
 */
function logbrowser_user_hover_menu($hook, $type, $return, $params)
{
    $user = $params['entity'];
    $url = "admin/overview/logbrowser?user_guid={$user->guid}";
    $item = new ElggMenuItem('logbrowser', elgg_echo('logbrowser:explore'), $url);
    $item->setSection('admin');
    $return[] = $item;
    return $return;
}
Esempio n. 2
0
function album_link_hover_menu($hook, $type, $return, $params)
{
    $user = $params['entity'];
    $url = elgg_get_site_url() . "photos/owner/" . $user->username;
    $item = new ElggMenuItem('album_link_hover', elgg_echo("album_link:album_link", array($user->name)), $url);
    $item->setSection('action');
    $return[] = $item;
    return $return;
}
Esempio n. 3
0
function donation_user_hover_menu($hook, $type, $return, $params)
{
    $user = $params['entity'];
    $url = "action/donation/add?guid={$user->guid}";
    $url = elgg_add_action_tokens_to_url($url);
    $item = new ElggMenuItem('donation', elgg_echo('donation:add'), $url);
    $item->setSection('admin');
    $return[] = $item;
    return $return;
}
Esempio n. 4
0
File: hooks.php Progetto: n8b/VMN
function hover_menu($hook, $type, $return, $params)
{
    $user = $params['entity'];
    if ($user->spam_throttle_suspension > time() && elgg_is_admin_logged_in()) {
        $url = "action/spam_throttle/unsuspend?guid={$user->guid}";
        $item = new \ElggMenuItem("spam_throttle_unsuspend", elgg_echo("spam_throttle:unsuspend"), $url);
        $item->setConfirmText(elgg_echo('spam_throttle:unsuspend:confirm'));
        $item->setSection('admin');
        $return[] = $item;
    }
    return $return;
}
/**
 * Add report user link to hover menu
 */
function reportedcontent_user_hover_menu($hook, $type, $return, $params)
{
    $user = $params['entity'];
    $profile_url = urlencode($user->getURL());
    $name = urlencode($user->name);
    $url = "reportedcontent/add?address={$profile_url}&title={$name}";
    if (elgg_is_logged_in() && elgg_get_logged_in_user_guid() != $user->guid) {
        $item = new ElggMenuItem('reportuser', elgg_echo('reportedcontent:user'), $url);
        $item->setSection('action');
        $return[] = $item;
    }
    return $return;
}
Esempio n. 6
0
/**
 * Add to the user hover menu
 */
function badges_user_hover_menu($hook, $type, $return, $params)
{
    $user = $params['entity'];
    $url = "admin/administer_utilities/elggx_badges?tab=assign&user_guid={$user->guid}";
    $item = new ElggMenuItem('badges', elgg_echo('badges:assign_badge'), $url);
    $item->setSection('admin');
    $return[] = $item;
    $url = "admin/administer_utilities/elggx_badges?tab=unassign&user_guid={$user->guid}";
    $item = new ElggMenuItem('badges', elgg_echo('badges:unassign_badge'), $url);
    $item->setSection('admin');
    $return[] = $item;
    return $return;
}
Esempio n. 7
0
/**
 * 
 * @param type $hook
 * @param type $type
 * @param type $returnvalue
 * @param type $params
 * @return ElggMenuItem
 */
function user_hover_hook($hook, $type, $returnvalue, $params)
{
    $user = $params['entity'];
    $url = elgg_get_site_url() . "activity_tabs/user/{$user->username}";
    $item = new \ElggMenuItem('activity_tabs_user_activity', elgg_echo('activity_tabs'), $url);
    if ($type == 'menu:user_hover') {
        $item->setSection('action');
        $item->setLinkClass('activity-tabs-user-hover');
        $item->setPriority(200);
    }
    $returnvalue[] = $item;
    return $returnvalue;
}
Esempio n. 8
0
function hflts_user_hover_menu($hook, $type, $return, $params)
{
    $user = $params['entity'];
    //if (elgg_is_admin_logged_in() != $user->guid) supuestamente esto es para que no vea mi propia valoracion
    if (elgg_is_admin_logged_in()) {
        $url = "hflts/{$user->username}";
        $item = new \ElggMenuItem('hflts:user', elgg_echo('hflts:menuhover'), $url);
        $item->setSection('admin');
        //default + elgg_get_logged_in_user_guid() | admin + elgg_is_admin_logged_in
        //$item->setConfirmText(elgg_echo('confirm'));//saca un are you sure
        $return[] = $item;
    }
    return $return;
}
Esempio n. 9
0
function translation_editor_user_hover_menu($hook, $type, $return, $params)
{
    $user = $params['entity'];
    if (elgg_is_admin_logged_in() && !$user->isAdmin()) {
        // TODO: replace with a single toggle editor action?
        if (translation_editor_is_translation_editor($user->getGUID())) {
            $url = "action/translation_editor/unmake_translation_editor?user="******"translation_editor:action:unmake_translation_editor");
        } else {
            $url = "action/translation_editor/make_translation_editor?user="******"translation_editor:action:make_translation_editor");
        }
        $item = new ElggMenuItem('translation_editor', $title, $url);
        $item->setSection('admin');
        $item->setConfirmText(elgg_echo("question:areyousure"));
        $return[] = $item;
        return $return;
    }
}
Esempio n. 10
0
function event_manager_user_hover_menu($hook, $entity_type, $returnvalue, $params)
{
    $result = $returnvalue;
    $event = false;
    $guid = get_input("guid");
    if (!empty($guid) && ($entity = get_entity($guid))) {
        if ($entity->getSubtype() == Event::SUBTYPE) {
            $event = $entity;
        }
    }
    if ($event) {
        $user = elgg_extract("entity", $params);
        if ($user) {
            // kick from event
            $href = elgg_get_site_url() . 'action/event_manager/event/rsvp?guid=' . $event->getGUID() . '&user='******'&type=' . EVENT_MANAGER_RELATION_UNDO;
            $href = elgg_add_action_tokens_to_url($href);
            $item = new ElggMenuItem("event_manager_kick", elgg_echo("event_manager:event:relationship:kick"), $href);
            $item->setSection("action");
            $result[] = $item;
            $user_relationship = $event->getRelationshipByUser($user->getGUID());
            if ($user_relationship == EVENT_MANAGER_RELATION_ATTENDING_PENDING) {
                // resend confirmation
                $href = elgg_get_site_url() . 'action/event_manager/event/resend_confirmation?guid=' . $event->getGUID() . '&user='******'action/event_manager/attendees/move_to_attendees?guid=' . $event->getGUID() . '&user=' . $user->getGUID();
                $href = elgg_add_action_tokens_to_url($href);
                $item = new ElggMenuItem("event_manager_move_to_attendees", elgg_echo("event_manager:event:menu:user_hover:move_to_attendees"), $href);
                $item->setSection("action");
                $result[] = $item;
            }
        }
    }
    return $result;
}
Esempio n. 11
0
/**
 * Add to the user hover menu
 */
function messages_user_hover_menu($hook, $type, $return, $params)
{
    $user = $params['entity'];
    if (elgg_is_logged_in() && elgg_get_logged_in_user_guid() != $user->guid) {
        $url = "messages/compose?send_to={$user->guid}";
        $item = new ElggMenuItem('send', elgg_echo('messages:sendmessage'), $url);
        $item->setSection('action');
        $return[] = $item;
    }
    return $return;
}
Esempio n. 12
0
function zhaohu_user_hover_menu($hook, $type, $return, $params)
{
    $entity = $params['entity'];
    if (elgg_instanceof($entity, 'user') && elgg_get_logged_in_user_guid() == $entity->guid) {
        $item = new ElggMenuItem('usersettings', elgg_echo('settings'), "settings/user/{$entity->username}");
        $item->setSection('action');
        $return[] = $item;
    }
    return $return;
}
Esempio n. 13
0
function event_calendar_handle_menu($event_guid)
{
    $event = get_entity($event_guid);
    $event_calendar_personal_manage = elgg_get_plugin_setting('personal_manage', 'event_calendar');
    if ($event_calendar_personal_manage == 'by_event' && $event->personal_manage == 'closed' || ($event_calendar_personal_manage == 'closed' || $event_calendar_personal_manage == 'no')) {
        $url = "event_calendar/review_requests/{$event_guid}";
        $item = new ElggMenuItem('event-calendar-0review_requests', elgg_echo('event_calendar:review_requests_menu_title'), $url);
        $item->setSection('event_calendar');
        elgg_register_menu_item('page', $item);
        //add_submenu_item(elgg_echo('event_calendar:review_requests_title'), $CONFIG->wwwroot . "pg/event_calendar/review_requests/".$event_id, '0eventcalendaradmin');
    }
    $event_calendar_add_users = elgg_get_plugin_setting('add_users', 'event_calendar');
    if ($event_calendar_add_users == 'yes') {
        $url = "event_calendar/manage_users/{$event_guid}";
        $item = new ElggMenuItem('event-calendar-1manage_users', elgg_echo('event_calendar:manage_users:breadcrumb'), $url);
        $item->setSection('event_calendar');
        elgg_register_menu_item('page', $item);
    }
}
Esempio n. 14
0
function elggchat_user_hover_menu($hook, $type, $return, $params)
{
    $user = $params['entity'];
    if (elgg_is_logged_in() && elgg_get_logged_in_user_guid() != $user->guid) {
        $allowed = false;
        $allow_contact_from = elgg_get_plugin_user_setting("allow_contact_from", $user->guid, "elggchat");
        if (!empty($allow_contact_from)) {
            if ($allow_contact_from == "all") {
                $allowed = true;
            } elseif ($allow_contact_from == "friends") {
                if ($user->isFriendsWith(elgg_get_logged_in_user_guid())) {
                    $allowed = true;
                }
            }
        } else {
            if ($user->isFriendsWith(elgg_get_logged_in_user_guid())) {
                // default: only friends allowed to invite to chat
                $allowed = true;
            } else {
                if (elgg_is_admin_logged_in()) {
                    // admins can always invite everyone for chatting
                    $allowed = true;
                }
            }
        }
        if ($allowed) {
            $url = "javascript:startSession(" . $user->guid . ");";
            $item = new ElggMenuItem('elggchat_hover', elgg_echo("elggchat:chat:profile:invite"), $url);
            $item->setSection('action');
            $return[] = $item;
        }
    }
    return $return;
}
Esempio n. 15
0
    // @todo when using index table, can include result counts on each of these.
    if (is_array($subtypes) && count($subtypes)) {
        foreach ($subtypes as $subtype) {
            if ($subtype === "page_top") {
                // skip this one as it is merged with page objects
                continue;
            }
            $label = "item:{$type}:{$subtype}";
            $count = "";
            if (array_key_exists($label, $search_result_counters)) {
                $count = " <span class='elgg-quiet'>[" . $search_result_counters[$label] . "]</span>";
            }
            $data = htmlspecialchars(http_build_query(array('q' => $query, 'entity_subtype' => $subtype, 'entity_type' => $type, 'owner_guid' => $owner_guid, 'container_guid' => $container_guid, 'search_type' => 'entities', 'friends' => $friends)));
            $url = elgg_get_site_url() . "search?{$data}";
            $menu_item = new ElggMenuItem($label, elgg_echo($label) . $count, $url);
            $menu_item->setSection($type);
            elgg_register_menu_item('page', $menu_item);
        }
    } else {
        $label = "item:{$type}";
        $count = "";
        if (array_key_exists($label, $search_result_counters)) {
            $count = " <span class='elgg-quiet'>[" . $search_result_counters[$label] . "]</span>";
        }
        $data = htmlspecialchars(http_build_query(array('q' => $query, 'entity_type' => $type, 'owner_guid' => $owner_guid, 'container_guid' => $container_guid, 'search_type' => 'entities', 'friends' => $friends)));
        $url = elgg_get_site_url() . "search?{$data}";
        $menu_item = new ElggMenuItem($label, elgg_echo($label) . $count, $url);
        elgg_register_menu_item('page', $menu_item);
    }
}
// add sidebar for custom searches
Esempio n. 16
0
File: users.php Progetto: riggo/Elgg
/**
 * Setup the default user hover menu
 * @access private
 */
function elgg_user_hover_menu($hook, $type, $return, $params)
{
    $user = $params['entity'];
    if (elgg_is_logged_in()) {
        if (elgg_get_logged_in_user_guid() != $user->guid) {
            if ($user->isFriend()) {
                $url = "action/friends/remove?friend={$user->guid}";
                $text = elgg_echo('friend:remove');
                $name = 'remove_friend';
            } else {
                $url = "action/friends/add?friend={$user->guid}";
                $text = elgg_echo('friend:add');
                $name = 'add_friend';
            }
            $url = elgg_add_action_tokens_to_url($url);
            $item = new ElggMenuItem($name, $text, $url);
            $item->setSection('action');
            $return[] = $item;
        } else {
            $url = "profile/{$user->username}/edit";
            $item = new ElggMenuItem('profile:edit', elgg_echo('profile:edit'), $url);
            $item->setSection('action');
            $return[] = $item;
            $url = "avatar/edit/{$user->username}";
            $item = new ElggMenuItem('avatar:edit', elgg_echo('avatar:edit'), $url);
            $item->setSection('action');
            $return[] = $item;
        }
    }
    // prevent admins from banning or deleting themselves
    if (elgg_get_logged_in_user_guid() == $user->guid) {
        return $return;
    }
    if (elgg_is_admin_logged_in()) {
        $actions = array();
        if (!$user->isBanned()) {
            $actions[] = 'ban';
        } else {
            $actions[] = 'unban';
        }
        $actions[] = 'delete';
        $actions[] = 'resetpassword';
        if (!$user->isAdmin()) {
            $actions[] = 'makeadmin';
        } else {
            $actions[] = 'removeadmin';
        }
        foreach ($actions as $action) {
            $url = "action/admin/user/{$action}?guid={$user->guid}";
            $url = elgg_add_action_tokens_to_url($url);
            $item = new ElggMenuItem($action, elgg_echo($action), $url);
            $item->setSection('admin');
            $item->setLinkClass('elgg-requires-confirmation');
            $return[] = $item;
        }
        $url = "profile/{$user->username}/edit";
        $item = new ElggMenuItem('profile:edit', elgg_echo('profile:edit'), $url);
        $item->setSection('admin');
        $return[] = $item;
        $url = "settings/user/{$user->username}";
        $item = new ElggMenuItem('settings:edit', elgg_echo('settings:edit'), $url);
        $item->setSection('admin');
        $return[] = $item;
    }
    return $return;
}
Esempio n. 17
0
/**
 * Setup the default user hover menu
 * @access private
 */
function elgg_user_hover_menu($hook, $type, $return, $params)
{
    $user = $params['entity'];
    /* @var \ElggUser $user */
    if (elgg_is_logged_in()) {
        if (elgg_get_logged_in_user_guid() == $user->guid) {
            $url = "profile/{$user->username}/edit";
            $item = new \ElggMenuItem('profile:edit', elgg_echo('profile:edit'), $url);
            $item->setSection('action');
            $return[] = $item;
            $url = "avatar/edit/{$user->username}";
            $item = new \ElggMenuItem('avatar:edit', elgg_echo('avatar:edit'), $url);
            $item->setSection('action');
            $return[] = $item;
        }
    }
    // prevent admins from banning or deleting themselves
    if (elgg_get_logged_in_user_guid() == $user->guid) {
        return $return;
    }
    if (elgg_is_admin_logged_in()) {
        $actions = array();
        if (!$user->isBanned()) {
            $actions[] = 'ban';
        } else {
            $actions[] = 'unban';
        }
        $actions[] = 'delete';
        $actions[] = 'resetpassword';
        if (!$user->isAdmin()) {
            $actions[] = 'makeadmin';
        } else {
            $actions[] = 'removeadmin';
        }
        foreach ($actions as $action) {
            $url = "action/admin/user/{$action}?guid={$user->guid}";
            $url = elgg_add_action_tokens_to_url($url);
            $item = new \ElggMenuItem($action, elgg_echo($action), $url);
            $item->setSection('admin');
            $item->setConfirmText(true);
            $return[] = $item;
        }
        $url = "profile/{$user->username}/edit";
        $item = new \ElggMenuItem('profile:edit', elgg_echo('profile:edit'), $url);
        $item->setSection('admin');
        $return[] = $item;
        $url = "avatar/edit/{$user->username}";
        $item = new \ElggMenuItem('avatar:edit', elgg_echo('avatar:edit'), $url);
        $item->setSection('admin');
        $return[] = $item;
        $url = "settings/user/{$user->username}";
        $item = new \ElggMenuItem('settings:edit', elgg_echo('settings:edit'), $url);
        $item->setSection('admin');
        $return[] = $item;
        $url = "activity/owner/{$user->username}";
        $item = new \ElggMenuItem('activity:owner', elgg_echo('activity:owner'), $url);
        $item->setSection('action');
        $return[] = $item;
    }
    return $return;
}
Esempio n. 18
0
/**
 * Add a menu item to block users to the user hover menu.
 *
 * @param type $hook
 * @param type $type
 * @param type $return
 * @param type $params
 * @return \ElggMenuItem
 */
function setup_hover_menu($hook, $type, $return, $params)
{
    $user = $params['entity'];
    if (!elgg_is_logged_in() || elgg_get_logged_in_user_guid() == $user->guid) {
        return $return;
    }
    $logged_in_user = elgg_get_logged_in_user_entity();
    if (elgg_in_context('profile') && !elgg_in_context('widgets')) {
        $class = 'elgg-button elgg-button-action';
    }
    if (is_blocked($user, $logged_in_user)) {
        $link = elgg_view('output/url', array('href' => 'action/block_users/unblock?blocked_user_guid=' . $user->getGUID(), 'text' => elgg_echo('block_users:unblock_user'), 'confirm' => true, 'class' => $class));
    } else {
        $link = elgg_view('output/url', array('href' => 'action/block_users/block?blocked_user_guid=' . $user->getGUID(), 'text' => elgg_echo('block_users:block_user'), 'confirm' => true, 'class' => $class));
    }
    $item = new \ElggMenuItem('block', $link, false);
    $item->setSection('action');
    $return[] = $item;
    return $return;
}
Esempio n. 19
0
function izap_unmark_spammer($hook, $type, $return, $params)
{
    $user = $params['entity'];
    if (elgg_instanceof($user, 'user')) {
        $item = new ElggMenuItem('unmark_spammer', elgg_echo('izap:bridge:unmark_spammer'), elgg_add_action_tokens_to_url(IzapBase::getFormAction('not_spammer', GLOBAL_IZAP_ELGG_BRIDGE) . '?guid=' . $user->guid));
        $item->setSection('admin');
        $return[] = $item;
    }
    return $return;
}
Esempio n. 20
0
<div class="elgg-module elgg-module-aside">
	<div class="elgg-head">
		<h3><?php 
echo elgg_echo('celebrations:list_monthly');
?>
</h3>
	</div>
	<div>
		<?php 
$filterid = $vars['filterid'];
for ($i = 1; $i <= 12; $i += 1) {
    $url = elgg_get_site_url() . "celebrations/celebrations/{$i}/{$filterid}";
    $item = new ElggMenuItem("celebrations_month_{$i}", elgg_echo("celebrations:month:{$i}"), $url);
    $item->setContext('celebrations');
    $item->setSection('a');
    $celebrations_monthly .= elgg_view('navigation/menu/elements/item', array('item' => $item));
}
echo "<ul>" . $celebrations_monthly . "</ul>";
?>
	</div>
</div>
Esempio n. 21
0
    elgg_register_menu_item('page', array('name' => elgg_echo("faq:ask"), 'text' => elgg_echo("faq:ask"), 'href' => elgg_get_site_url() . "faq/ask", 'section' => 'b', 'context' => 'faq'));
}
if (elgg_is_admin_logged_in()) {
    elgg_register_menu_item('page', array('name' => elgg_echo("faq:add"), 'text' => elgg_echo("faq:add"), 'href' => elgg_get_site_url() . "faq/add", 'section' => 'c', 'context' => 'faq'));
    elgg_register_menu_item('page', array('name' => elgg_echo("faq:asked", array(getUserQuestionsCount())), 'text' => elgg_echo("faq:asked", array(getUserQuestionsCount())), 'href' => elgg_get_site_url() . "faq/asked", 'section' => 'c', 'context' => 'faq'));
}
?>

<div class="elgg-module elgg-module-aside">
	<div class="elgg-head">
		<h3><?php 
echo elgg_echo('faq:sidebar:categories');
?>
</h3>
	</div>
	<div>
		<?php 
$cats = getCategories();
$category_links = '';
foreach ($cats as $id => $cat) {
    $url = "faq/list?categoryId=" . $id;
    $item = new ElggMenuItem($cat, $cat, $url);
    $item->setContext('faq');
    $item->setSection('d');
    $category_links .= elgg_view('navigation/menu/elements/item', array('item' => $item));
}
echo $category_links;
?>
	</div>
</div>
Esempio n. 22
0
/**
 * Setup the default user hover menu
 * @access private
 */
function elgg_user_hover_menu($hook, $type, $return, $params)
{
    $user = $params['entity'];
    if (elgg_is_logged_in()) {
        if (elgg_get_logged_in_user_guid() != $user->guid) {
            $isFriend = $user->isFriend();
            // Always emit both to make it super easy to toggle with ajax
            $return[] = ElggMenuItem::factory(array('name' => 'remove_friend', 'href' => elgg_add_action_tokens_to_url("action/friends/remove?friend={$user->guid}"), 'text' => elgg_echo('friend:remove'), 'section' => 'action', 'item_class' => $isFriend ? '' : 'hidden'));
            $return[] = ElggMenuItem::factory(array('name' => 'add_friend', 'href' => elgg_add_action_tokens_to_url("action/friends/add?friend={$user->guid}"), 'text' => elgg_echo('friend:add'), 'section' => 'action', 'item_class' => $isFriend ? 'hidden' : ''));
        } else {
            $url = "profile/{$user->username}/edit";
            $item = new ElggMenuItem('profile:edit', elgg_echo('profile:edit'), $url);
            $item->setSection('action');
            $return[] = $item;
            $url = "avatar/edit/{$user->username}";
            $item = new ElggMenuItem('avatar:edit', elgg_echo('avatar:edit'), $url);
            $item->setSection('action');
            $return[] = $item;
        }
    }
    // prevent admins from banning or deleting themselves
    if (elgg_get_logged_in_user_guid() == $user->guid) {
        return $return;
    }
    if (elgg_is_admin_logged_in()) {
        $actions = array();
        if (!$user->isBanned()) {
            $actions[] = 'ban';
        } else {
            $actions[] = 'unban';
        }
        $actions[] = 'delete';
        $actions[] = 'resetpassword';
        if (!$user->isAdmin()) {
            $actions[] = 'makeadmin';
        } else {
            $actions[] = 'removeadmin';
        }
        foreach ($actions as $action) {
            $url = "action/admin/user/{$action}?guid={$user->guid}";
            $url = elgg_add_action_tokens_to_url($url);
            $item = new ElggMenuItem($action, elgg_echo($action), $url);
            $item->setSection('admin');
            $item->setLinkClass('elgg-requires-confirmation');
            $return[] = $item;
        }
        $url = "profile/{$user->username}/edit";
        $item = new ElggMenuItem('profile:edit', elgg_echo('profile:edit'), $url);
        $item->setSection('admin');
        $return[] = $item;
        $url = "settings/user/{$user->username}";
        $item = new ElggMenuItem('settings:edit', elgg_echo('settings:edit'), $url);
        $item->setSection('admin');
        $return[] = $item;
    }
    return $return;
}
Esempio n. 23
0
function gvtheme_custom_topbarmenu_setup($hook, $type, $values)
{
    if (elgg_is_logged_in()) {
        $user = elgg_get_logged_in_user_entity();
        /* the profile item becomes a dropdown menu */
        foreach ($values as $key => $item) {
            if ($item->getName() == 'profile') {
                $values[$key]->setText("<span class=\"elgg-icon elgg-icon-users \"/>" . $values[$key]->getText() . "</span>" . $user->name);
                $profileItem = $values[$key];
            }
        }
        if (isset($profileItem)) {
            foreach ($values as $key => $item) {
                if ($item->getName() == 'administration') {
                    $item->setText(elgg_echo('admin'));
                    $item->setItemClass('gvtheme-profile-child-menu');
                    $profileItem->addChild($item);
                } elseif ($item->getName() == 'usersettings') {
                    $item->setText(elgg_echo('settings:user'));
                    $item->setItemClass('gvtheme-profile-child-menu');
                    $profileItem->addChild($item);
                } elseif ($item->getName() == 'logout') {
                    $item->setItemClass('gvtheme-profile-child-menu');
                    $profileItem->addChild($item);
                } else {
                    // add labels to topbar icons
                    if ($item->getName() == 'messages') {
                        $item->setText($item->getText() . elgg_echo('gvtheme:mymessages'));
                        $item->setSection('alt');
                    }
                    if ($item->getName() == 'friends') {
                        $item->setText($item->getText() . elgg_echo('gvtheme:myfriends'));
                        $item->setSection('alt');
                    }
                    $return[] = $item;
                }
            }
        }
        // add "my profile" menu item
        $myprofileitem = new ElggMenuItem('myprofile', elgg_echo('gvtheme:myprofile'), "profile/" . $user->username);
        $myprofileitem->setSection('alt');
        $return[] = $myprofileitem;
        $return[] = $profileItem;
    } else {
        $return = $value;
    }
    return $return;
}
Esempio n. 24
0
/**
 * Add a menu item to for crushes
 *
 * @param type $hook
 * @param type $type
 * @param type $return
 * @param type $params
 * @return \ElggMenuItem
 */
function setup_hover_menu($hook, $type, $return, $params)
{
    $user = $params['entity'];
    if (!elgg_is_logged_in() || elgg_get_logged_in_user_guid() == $user->guid) {
        return $return;
    }
    $logged_in_user = elgg_get_logged_in_user_entity();
    if (elgg_in_context('profile') && !elgg_in_context('widgets')) {
        $class = 'elgg-button elgg-button-action';
    }
    if (!check_entity_relationship($logged_in_user->getGUID(), 'crushing_on', $user->getGUID())) {
        $link = elgg_view('output/url', array('href' => 'action/crushes/add?crushing_on_guid=' . $user->getGUID(), 'text' => elgg_echo('crushes:add_crush'), 'confirm' => true, 'class' => $class));
    } else {
        $link = elgg_view('output/url', array('href' => 'action/crushes/remove?crushing_on_guid=' . $user->getGUID(), 'text' => elgg_echo('crushes:remove_crush'), 'class' => $class, 'confirm' => true));
    }
    $item = new \ElggMenuItem('crushes', $link, false);
    $item->setSection('action');
    $return[] = $item;
    return $return;
}
Esempio n. 25
0
function event_poll_handle_event_poll_add_items($group_guid = 0)
{
    if ($group_guid) {
        $url_schedule_event = "event_calendar/schedule/{$group_guid}";
    } else {
        $url_schedule_event = "event_calendar/schedule";
    }
    $item = new ElggMenuItem('event-calendar-1schedule', elgg_echo('event_calendar:schedule_event'), $url_schedule_event);
    $item->setSection('event_poll');
    elgg_register_menu_item('page', $item);
}
Esempio n. 26
0
/**
 * entrada de menu para el usuario solo cuando esta en el viaje
 */
function evaluationcontent_user_hover_menu($hook, $type, $return, $params)
{
    $user = $params['entity'];
    $trip = elgg_get_page_owner_entity();
    // Check for valid trip
    if (!elgg_instanceof($trip, 'group')) {
        return $return;
    }
    $tripinfo = urlencode($trip->getGUID());
    //or give a valid one $tripinfo = urlencode(309);
    $profile_url = urlencode($user->getURL());
    $name = urlencode($user->name);
    $uid = urlencode($user->guid);
    //desconozco por qué motivo despues de este texto se añade ?url=<group_profile> que dificulta leer los valores
    $url = "trip_companions/add?profile={$profile_url}&name={$name}&trip={$tripinfo}&uid={$uid}&null";
    if (elgg_is_logged_in() && elgg_get_logged_in_user_guid() != $user->guid) {
        elgg_load_library('elgg:trip_companions');
        if (check_valid_asessment(elgg_get_logged_in_user_guid(), $user->guid, $tripinfo)) {
            //all menu items have a class based on their name -- elgg-menu-item-$name
            $item = new ElggMenuItem('evaluation-content', elgg_echo('evaluationcontent:user'), $url);
            $item->setSection('action');
            $item->addLinkClass('elgg-lightbox');
            $return[] = $item;
        }
    }
    return $return;
}
Esempio n. 27
0
/**
 * Add to the user hover menu
 */
function gifts_user_hover_menu($hook, $type, $return, $params)
{
    $user = $params['entity'];
    if (elgg_is_logged_in() && elgg_get_logged_in_user_guid() != $user->guid) {
        $url = "gifts/" . elgg_get_logged_in_user_entity()->username . "/sendgift?send_to={$user->guid}";
        $item = new ElggMenuItem('gifts', elgg_echo("gifts:send"), $url);
        $item->setSection('action');
        $return[] = $item;
    }
    return $return;
}