当前位置: 首页>>代码示例>>PHP>>正文


PHP ElggMenuItem::setLinkClass方法代码示例

本文整理汇总了PHP中ElggMenuItem::setLinkClass方法的典型用法代码示例。如果您正苦于以下问题:PHP ElggMenuItem::setLinkClass方法的具体用法?PHP ElggMenuItem::setLinkClass怎么用?PHP ElggMenuItem::setLinkClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ElggMenuItem的用法示例。


在下文中一共展示了ElggMenuItem::setLinkClass方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: user_hover_hook

/**
 * 
 * @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;
}
开发者ID:smellems,项目名称:mt_activity_tabs,代码行数:21,代码来源:hooks.php

示例2: factory

 /**
  * ElggMenuItem factory method
  *
  * This static method creates an ElggMenuItem from an associative array.
  * Required keys are name, text, and href.
  *
  * @param array $options Option array of key value pairs
  *
  * @return ElggMenuItem or null on error
  */
 public static function factory($options)
 {
     if (!isset($options['name']) || !isset($options['text'])) {
         return null;
     }
     if (!isset($options['href'])) {
         $options['href'] = '';
     }
     $item = new ElggMenuItem($options['name'], $options['text'], $options['href']);
     unset($options['name']);
     unset($options['text']);
     unset($options['href']);
     // special catch in case someone uses context rather than contexts
     if (isset($options['context'])) {
         $options['contexts'] = $options['context'];
         unset($options['context']);
     }
     // make sure contexts is set correctly
     if (isset($options['contexts'])) {
         $item->setContext($options['contexts']);
         unset($options['contexts']);
     }
     if (isset($options['link_class'])) {
         $item->setLinkClass($options['link_class']);
         unset($options['link_class']);
     } elseif (isset($options['class'])) {
         elgg_deprecated_notice("ElggMenuItem::factory() does not accept 'class' key anymore, use 'link_class' instead", 1.9);
         $item->setLinkClass($options['class']);
         unset($options['class']);
     }
     if (isset($options['item_class'])) {
         $item->setItemClass($options['item_class']);
         unset($options['item_class']);
     }
     if (isset($options['data']) && is_array($options['data'])) {
         $item->setData($options['data']);
         unset($options['data']);
     }
     foreach ($options as $key => $value) {
         if (isset($item->data[$key])) {
             $item->data[$key] = $value;
         } else {
             $item->{$key} = $value;
         }
     }
     return $item;
 }
开发者ID:nooshin-mirzadeh,项目名称:web_2.0_benchmark,代码行数:57,代码来源:ElggMenuItem.php

示例3: factory

 /**
  * ElggMenuItem factory method
  *
  * This static method creates an ElggMenuItem from an associative array.
  * Required keys are name, text, and href.
  *
  * @param array $options Option array of key value pairs
  *
  * @return ElggMenuItem or NULL on error
  */
 public static function factory($options)
 {
     if (!isset($options['name']) || !isset($options['text'])) {
         return NULL;
     }
     if (!isset($options['href'])) {
         $options['href'] = '';
     }
     $item = new ElggMenuItem($options['name'], $options['text'], $options['href']);
     unset($options['name']);
     unset($options['text']);
     unset($options['href']);
     // special catch in case someone uses context rather than contexts
     if (isset($options['context'])) {
         $options['contexts'] = $options['context'];
         unset($options['context']);
     }
     // make sure contexts is set correctly
     if (isset($options['contexts'])) {
         $item->setContext($options['contexts']);
         unset($options['contexts']);
     }
     if (isset($options['link_class'])) {
         $item->setLinkClass($options['link_class']);
         unset($options['link_class']);
     }
     if (isset($options['item_class'])) {
         $item->setItemClass($options['item_class']);
         unset($options['item_class']);
     }
     if (isset($options['data']) && is_array($options['data'])) {
         $item->setData($options['data']);
         unset($options['data']);
     }
     foreach ($options as $key => $value) {
         if (isset($item->data[$key])) {
             $item->data[$key] = $value;
         } else {
             $item->{$key} = $value;
         }
     }
     return $item;
 }
开发者ID:duanhv,项目名称:mdg-social,代码行数:53,代码来源:ElggMenuItem.php

示例4: tu_spam_report_spammer_menu

/**
 * add 'not spammer' and 'delete' links to entity menuy of listed spammers
 * 
 * @param type $hook
 * @param type $type
 * @param type $return
 * @param type $params
 */
function tu_spam_report_spammer_menu($hook, $type, $return, $params)
{
    if (!elgg_instanceof($params['entity'], 'user') || elgg_get_context() != 'reported_spammers') {
        return $return;
    }
    // delete (requires new action due to it being deactivated)
    $href = elgg_add_action_tokens_to_url('action/reported_spam/delete?guid=' . $params['entity']->guid);
    $delete = new ElggMenuItem('delete', elgg_view_icon('delete'), $href);
    $delete->setLinkClass('elgg-requires-confirmation');
    // unspam - will unmark this as spam and reactivate it
    $href = elgg_add_action_tokens_to_url('action/reported_spam/notspammer?guid=' . $params['entity']->guid);
    $unspam = new ElggMenuItem('unspam', elgg_echo('tu_spam_report:notspammer'), $href);
    $unspam->setLinkClass('elgg-requires-confirmation');
    $metadata = elgg_get_metadata(array('guid' => $params['entity']->guid, 'metadata_name' => 'disable_reason', 'metadata_value' => 'content_marked_spam', 'limit' => false));
    $href = false;
    $reported = new ElggMenuItem('reported', elgg_echo('tu_spam_report:reported', array(date('m/d/Y', $metadata[0]->time_created))), $href);
    $return[] = $reported;
    $return[] = $unspam;
    $return[] = $delete;
    return $return;
}
开发者ID:ewinslow,项目名称:trusted_user_spam_report,代码行数:29,代码来源:hooks.php

示例5: elgg_user_hover_menu

/**
 * 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;
}
开发者ID:riggo,项目名称:Elgg,代码行数:70,代码来源:users.php

示例6: au_landing_title_menu

function au_landing_title_menu($hook, $type, $return, $params)
{
    if ($type != 'menu:title') {
        return $return;
    }
    if (elgg_get_context() != 'group_profile') {
        return $return;
    }
    $group = elgg_get_page_owner_entity();
    if ($group->canEdit() && elgg_is_active_plugin('group_tools')) {
        $item = new ElggMenuItem('mail', elgg_echo('group_tools:menu:mail'), 'groups/mail/' . $group->getGUID());
        $item->setLinkClass('elgg-button elgg-button-action');
        $return[] = $item;
    }
    return $return;
}
开发者ID:AU-Landing-Project,项目名称:au_landing,代码行数:16,代码来源:hooks.php

示例7: au_theme_titlemenu

function au_theme_titlemenu($h, $t, $r, $p)
{
    $threshold = elgg_get_plugin_setting('compact_title_button_threshold', 'au_theme');
    if (!$threshold) {
        $threshold = 1;
    }
    if ($t == 'menu:title' && count($r) > $threshold) {
        $count = 0;
        foreach ($r as $key => $button) {
            if ($button->inContext()) {
                $count++;
            }
        }
        if ($count <= $threshold) {
            return $r;
        }
        // add in our top level element 'Actions'
        // everything else gets added as a child of that
        $text = elgg_echo('au_theme:titledropdown') . '<span class="elgg-icon elgg-icon-round-plus"></span>';
        $item = new ElggMenuItem('action-dropdown', $text, '#');
        $item->setLinkClass('action-dropdown');
        foreach ($r as $key => $button) {
            if ($button->inContext()) {
                $item->addChild($button);
            }
        }
        return array($item);
    }
}
开发者ID:AU-Landing-Project,项目名称:au_theme,代码行数:29,代码来源:start.php

示例8: testAddLinkClassWithArray

 public function testAddLinkClassWithArray()
 {
     $item = new \ElggMenuItem('name', 'text', 'url');
     $item->setLinkClass('new-link');
     $item->addLinkClass(array('2nd-link'));
     $this->assertEquals('new-link 2nd-link', $item->getLinkClass());
 }
开发者ID:epsylon,项目名称:Hydra-dev,代码行数:7,代码来源:ElggMenuItemTest.php

示例9: ec_ical_pagesetup

function ec_ical_pagesetup()
{
    $use_titlemenu = get_input('ical_calendar_title_menu', false);
    if ($use_titlemenu && elgg_is_logged_in()) {
        $filter = get_input('ical_calendar_filter', false);
        $date = get_input('ical_date', false);
        $interval = get_input('ical_interval', false);
        $group_guid = get_input('ical_group_guid', false);
        $export_url = elgg_get_site_url() . 'event_calendar/ical/export?method=ical';
        $import_url = elgg_get_site_url() . 'event_calendar/ical/import?method=ical';
        $urlsuffix = '';
        if ($filter) {
            $urlsuffix .= "&filter={$filter}";
        }
        if ($date) {
            $urlsuffix .= "&date={$date}";
        }
        if ($interval) {
            $urlsuffix .= "&interval={$interval}";
        }
        if ($group_guid !== false) {
            $urlsuffix .= "&group_guid={$group_guid}";
        }
        $export = new ElggMenuItem('ical_export', elgg_echo('event_calendar:export'), $export_url . $urlsuffix);
        $export->setLinkClass('elgg-button elgg-button-action');
        $import = new ElggMenuItem('ical_import', elgg_echo('event_calendar:import'), $import_url . $urlsuffix);
        $import->setLinkClass('elgg-button elgg-button-action');
        elgg_register_menu_item('title', $export);
        elgg_register_menu_item('title', $import);
    }
}
开发者ID:iionly,项目名称:event_calendar,代码行数:31,代码来源:start.php

示例10: elgg_user_hover_menu

/**
 * 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;
}
开发者ID:nogsus,项目名称:Elgg,代码行数:61,代码来源:users.php


注:本文中的ElggMenuItem::setLinkClass方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。