本文整理汇总了PHP中JApplication::getMenu方法的典型用法代码示例。如果您正苦于以下问题:PHP JApplication::getMenu方法的具体用法?PHP JApplication::getMenu怎么用?PHP JApplication::getMenu使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JApplication
的用法示例。
在下文中一共展示了JApplication::getMenu方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _findItemId
protected static function _findItemId($needles)
{
// Prepare the reverse lookup array.
if (self::$lookup === null) {
self::$lookup = array();
$component =& JComponentHelper::getComponent('com_xmap');
$menus =& JApplication::getMenu('site', array());
$items = $menus->getItems('component_id', $component->id);
foreach ($items as &$item) {
if (isset($item->query) && isset($item->query['view'])) {
$view = $item->query['view'];
if (!isset(self::$lookup[$view])) {
self::$lookup[$view] = array();
}
if (isset($item->query['id'])) {
self::$lookup[$view][$item->query['id']] = $item->id;
}
}
}
}
$match = null;
foreach ($needles as $view => $id) {
if (isset(self::$lookup[$view])) {
if (isset(self::$lookup[$view][$id])) {
return self::$lookup[$view][$id];
}
}
}
return null;
}
示例2: getItemid
function getItemid($poll_id)
{
$component = JComponentHelper::getComponent('com_mijopolls');
$menus = JApplication::getMenu('site', array());
if (MijopollsHelper::is15()) {
$items = $menus->getItems('componentid', $component->id);
} else {
$items = $menus->getItems('component_id', $component->id);
}
$match = false;
$item_id = '';
if (isset($items)) {
foreach ($items as $item) {
if (@$item->query['view'] == 'poll' && @$item->query['id'] == $poll_id) {
$itemid = $item->id;
$match = true;
break;
}
}
}
if ($match) {
$item_id = '&Itemid=' . $itemid;
}
return $item_id;
}
示例3: getExistmenu
function getExistmenu()
{
$component =& JComponentHelper::getComponent('com_hotelguide');
$menus =& JApplication::getMenu('site', array());
$items = $menus->getItems('componentid', $component->id);
if (count($items) > 0) {
return true;
}
return false;
}
示例4: _findItem
function _findItem($needles)
{
$component =& JComponentHelper::getComponent('com_k2');
$menus =& JApplication::getMenu('site', array());
$items = $menus->getItems('componentid', $component->id);
$match = null;
foreach ($needles as $needle => $id) {
if (count($items)) {
foreach ($items as $item) {
if ($needle == 'user') {
if (@$item->query['task'] == $needle && @$item->query['id'] == $id) {
$match = $item;
break;
}
} else {
if ($needle == 'tag') {
if (@$item->query['task'] == $needle && @$item->query['tag'] == $id) {
$match = $item;
break;
}
} else {
if (@$item->query['view'] == $needle && @$item->query['id'] == $id) {
$match = $item;
break;
}
$menuparams = new JParameter($item->params);
$catids = $menuparams->get('categories');
if (is_array($catids)) {
foreach ($catids as $catid) {
if (@$item->query['view'] == $needle && @(int) $catid == $id) {
$match = $item;
break;
}
}
}
/*else{
if ( (@$item->query['view'] == $needle) && (!isset($item->query['task'])) && (@$item->query['view'] == 'itemlist') ) {
$match = $item;
}
}*/
}
}
}
}
if (isset($match)) {
break;
}
}
return $match;
}
示例5: getObjectLink
function getObjectLink($id)
{
$link = 'index.php?option=com_blog&view=comments&pid=' . $id;
require_once JPATH_SITE . DS . 'includes' . DS . 'application.php';
$component = JComponentHelper::getComponent('com_blog');
$menus = JApplication::getMenu('site');
$items = $menus->getItems('componentid', $component->id);
if (count($items)) {
$link .= "&Itemid=" . $items[0]->id;
}
$link = JRoute::_($link);
return $link;
}
示例6: getObjectLink
function getObjectLink($id)
{
require_once JPATH_ROOT . DS . 'components' . DS . 'com_communitypolls' . DS . 'router.php';
$query = 'SELECT a.id,' . ' CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(":", a.id, a.alias) ELSE a.id END as slug' . ' FROM #__jcp_polls AS a' . ' WHERE a.id = ' . $id;
$db = JFactory::getDBO();
$db->setQuery($query);
$row = $db->loadObject();
$menu = JApplication::getMenu('site');
$mnuitems = $menu->getItems('link', 'index.php?option=com_communitypolls&controller=polls');
$itemid = isset($mnuitems[0]) ? '&Itemid=' . $mnuitems[0]->id : '';
$link = JRoute::_('index.php?option=com_communitypolls&controller=polls&task=viewpoll&id=' . $row->slug . $itemid);
return $link;
}
示例7: getName
function getName()
{
$component =& JComponentHelper::getComponent('com_easybook');
$menus =& JApplication::getMenu('site', array());
$items = $menus->getItems('componentid', $component->id);
$match = null;
foreach ($items as $item) {
if (@$item->query['view'] == 'easybook') {
$match = $item->name;
break;
}
}
return $match;
}
示例8: getObjectLink
function getObjectLink($id)
{
$db = JFactory::getDBO();
$db->setQuery('SELECT alias FROM #__categories WHERE section = "com_weblinks" and id = ' . $id);
$alias = $db->loadResult();
$link = 'index.php?option=com_weblinks&view=category&id=' . $id . ':' . $alias;
require_once JPATH_SITE . DS . 'includes' . DS . 'application.php';
$component = JComponentHelper::getComponent('com_weblinks');
$menus = JApplication::getMenu('site');
$items = $menus->getItems('componentid', $component->id);
if (count($items)) {
$link .= "&Itemid=" . $items[0]->id;
}
$link = JRoute::_($link);
return $link;
}
示例9: _findItem
protected static function _findItem($needles)
{
$component = JComponentHelper::getComponent('com_ars');
$menus = JApplication::getMenu('site');
$items = $menus->getItems('componentid', $component->id);
$user = JFactory::getUser();
$access = (int) $user->get('aid');
foreach ($items as $item) {
if ($item->published == 1 && $item->access <= $access) {
if (isset($item->query) && isset($item->query['view'])) {
if ($item->query['view'] == 'release') {
$params = $item->params instanceof JRegistry ? $item->params : $menus->getParams($item->id);
if ($params->get('relid', 0) == $needles['release_id']) {
return $item->id;
}
}
}
}
}
foreach ($items as $item) {
if ($item->published == 1 && $item->access <= $access) {
if (isset($item->query) && isset($item->query['view'])) {
if ($item->query['view'] == 'category') {
$params = $item->params instanceof JRegistry ? $item->params : $menus->getParams($item->id);
print_r($params);
if ($params->get('catid', 0) == $needles['category_id']) {
return $item->id;
}
}
}
}
}
foreach ($items as $item) {
if ($item->published == 1 && $item->access <= $access) {
if (isset($item->query) && isset($item->query['view'])) {
if ($item->query['view'] == 'browse') {
return $item->id;
}
}
}
}
$active = $menus->getActive();
if ($active) {
return $active->id;
}
return false;
}
示例10: _findItem
private static function _findItem()
{
$component =& JComponentHelper::getComponent('com_helpdesk');
$menus = &JApplication::getMenu('site', array());
$items = $menus->getItems('componentid', $component->id);
$match = null;
foreach($items as $item) {
if ((@$item->query['view'] == 'helpdesk')) {
$match = $item->id;
break;
}
}
return $match;
}
示例11: _findItem
protected static function _findItem($product_id, $category_id)
{
$component = JComponentHelper::getComponent('com_redshop');
$menus = JApplication::getMenu('site');
$field = JCOMMENTS_JVERSION == '1.5' ? 'componentid' : 'component_id';
$items = $menus->getItems($field, $component->id);
$user = JFactory::getUser();
$access = (int) $user->get('aid');
$count = count($items);
if ($count == 1) {
return $items[0]->id;
} else {
if ($count > 1) {
foreach ($items as $item) {
if ($item->access <= $access) {
if (isset($item->query) && isset($item->query['view'])) {
if ($item->query['view'] == 'category' && isset($item->query['cid'])) {
if ($item->query['cid'] = $category_id) {
return $item->id;
}
}
}
}
}
$db = JFactory::getDBO();
$db->setQuery('SELECT category_id FROM #__redshop_product_category_xref WHERE product_id = ' . $product_id);
$categories = $db->loadResultArray();
foreach ($items as $item) {
if ($item->access <= $access) {
if (isset($item->query) && isset($item->query['view'])) {
if ($item->query['view'] == 'category' && isset($item->query['cid'])) {
if (in_array($item->query['cid'], $categories)) {
return $item->id;
}
}
}
}
}
}
}
$active = $menus->getActive();
if ($active) {
return $active->id;
}
return false;
}
示例12: _findItem
protected static function _findItem($needles)
{
$component = JComponentHelper::getComponent('com_docman');
$menus = JApplication::getMenu('site');
$items = $menus->getItems('componentid', $component->id);
$user = JFactory::getUser();
$access = (int) $user->get('aid');
foreach ($needles as $needle => $id) {
if (is_array($items)) {
foreach ($items as $item) {
if ($item->published == 1 && $item->access <= $access) {
return $item;
}
}
}
}
return false;
}
示例13: _findItem
function _findItem($needles)
{
$component =& JComponentHelper::getComponent('com_content');
$menus =& JApplication::getMenu('site', array());
$items = $menus->getItems('componentid', $component->id);
$match = null;
foreach ($needles as $needle => $id) {
foreach ($items as $item) {
if (@$item->query['view'] == $needle && @$item->query['id'] == $id) {
$match = $item;
break;
}
}
if (isset($match)) {
break;
}
}
return $match;
}
示例14: getObjectInfo
function getObjectInfo($id, $language = null)
{
$db = JFactory::getDBO();
$query = $db->getQuery(true);
$query->select('a.id, a.title, a.alias, a.created_by');
$query->from('#__jcp_polls AS a');
$query->where('a.id = ' . (int) $id);
$db->setQuery($query);
$row = $db->loadObject();
$info = new JCommentsObjectInfo();
if (!empty($row)) {
$row->slug = $row->alias ? $row->id . ':' . $row->alias : $row->id;
$items = JApplication::getMenu('site')->getItems('link', 'index.php?option=com_communitypolls&controller=polls');
$itemid = isset($items[0]) ? '&Itemid=' . $items[0]->id : '';
$info->title = $row->title;
$info->userid = $row->created_by;
$info->link = JRoute::_('index.php?option=com_communitypolls&controller=polls&task=viewpoll&id=' . $row->slug . $itemid);
}
return $info;
}
示例15: fetchElementOLD
function fetchElementOLD($name, $value, &$node, $control_name)
{
$options = array();
$menu =& JApplication::getMenu('site', $options);
$items = $menu->getMenu();
$items2 = $menu->getItems("component", "com_joomleague");
JArrayHelper::sortObjects($items2, "menutype");
foreach ($items2 as &$item) {
$item->title = $item->name . " (" . $item->menutype . " - " . $item->component . ")";
unset($item);
}
JArrayHelper::sortObjects($items, "menutype");
foreach ($items as &$item) {
if ($item->component != "com_joomleague") {
$item->title = $item->name . " (" . $item->menutype . " - " . $item->component . ")";
$items2[] = $item;
unset($item);
}
}
return JHTML::_('select.genericlist', $items2, '' . $control_name . '[' . $name . ']', '', 'id', 'title', $value, $control_name . $name);
}