本文整理汇总了PHP中MenuItem::getItems方法的典型用法代码示例。如果您正苦于以下问题:PHP MenuItem::getItems方法的具体用法?PHP MenuItem::getItems怎么用?PHP MenuItem::getItems使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MenuItem
的用法示例。
在下文中一共展示了MenuItem::getItems方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dispMenu
function dispMenu($intSectionNum)
{
global $MAIN_ROOT, $LOGGED_IN, $mysqli, $shoutBoxPostLink, $shoutBoxDeleteLink, $shoutBoxEditLink, $arrShoutBoxIDs, $websiteInfo, $arrLoginInfo;
echo "<div id='menuSection_" . $intSectionNum . "'>";
$menuCatObj = new MenuCategory($mysqli);
$menuItemObj = new MenuItem($mysqli);
$customPageObj = new Basic($mysqli, "custompages", "custompage_id");
$customFormObj = new CustomForm($mysqli);
$downloadCatObj = new Basic($mysqli, "downloadcategory", "downloadcategory_id");
$memberObj = new Member($mysqli);
$pollObj = new Poll($mysqli);
if ($LOGGED_IN) {
$intMenuAccessType = 1;
} else {
$intMenuAccessType = 2;
}
$arrMenuCategories = $menuCatObj->getCategories($intSectionNum, $intMenuAccessType);
foreach ($arrMenuCategories as $menuCatID) {
$menuCatObj->select($menuCatID);
$menuCatInfo = $menuCatObj->get_info();
$arrMenuItems = $menuItemObj->getItems($menuCatInfo['menucategory_id'], $intMenuAccessType);
if ($menuCatInfo['headertype'] == "image") {
echo "<img src='" . $MAIN_ROOT . $menuCatInfo['headercode'] . "' class='menuHeaderImg'><br>";
} else {
$menuCatInfo['headercode'] = str_replace("[MAIN_ROOT]", $MAIN_ROOT, $menuCatInfo['headercode']);
$menuCatInfo['headercode'] = str_replace("[MEMBER_ID]", $arrLoginInfo['memberID'], $menuCatInfo['headercode']);
$menuCatInfo['headercode'] = str_replace("[MEMBERUSERNAME]", $arrLoginInfo['memberUsername'], $menuCatInfo['headercode']);
$menuCatInfo['headercode'] = str_replace("[MEMBERRANK]", $arrLoginInfo['memberRank'], $menuCatInfo['headercode']);
$menuCatInfo['headercode'] = str_replace("[PMLINK]", $arrLoginInfo['pmLink'], $menuCatInfo['headercode']);
echo $menuCatInfo['headercode'];
}
foreach ($arrMenuItems as $menuItemID) {
$menuItemObj->select($menuItemID);
$menuItemInfo = $menuItemObj->get_info();
$menuItemInfo['itemtype'] = $menuItemInfo['itemtype'] == "customcode" || $menuItemInfo['itemtype'] == "customformat" ? "customblock" : $menuItemInfo['itemtype'];
switch ($menuItemInfo['itemtype']) {
case "link":
$menuItemObj->objLink->select($menuItemInfo['itemtype_id']);
$menuLinkInfo = $menuItemObj->objLink->get_info();
$checkURL = parse_url($menuLinkInfo['link']);
if (!isset($checkURL['scheme']) || ($checkURL['scheme'] = "")) {
$menuLinkInfo['link'] = $MAIN_ROOT . $menuLinkInfo['link'];
}
echo "<div style='text-align: " . $menuLinkInfo['textalign'] . "'> " . $menuLinkInfo['prefix'] . "<a href='" . $menuLinkInfo['link'] . "' target='" . $menuLinkInfo['linktarget'] . "'>" . $menuItemInfo['name'] . "</a></div>";
break;
case "top-players":
$dispTopPlayers = unserialize(SPECIAL_MENU_ITEM);
echo $dispTopPlayers['top-players'];
break;
case "customform":
$menuItemObj->objCustomPage->select($menuItemInfo['itemtype_id']);
$menuCustomFormInfo = $menuItemObj->objCustomPage->get_info();
$customFormObj->select($menuCustomFormInfo['custompage_id']);
echo "<div style='text-align: " . $menuCustomFormInfo['textalign'] . "'> " . $menuCustomFormInfo['prefix'] . "<a href='" . $MAIN_ROOT . "customform.php?pID=" . $menuCustomFormInfo['custompage_id'] . "' target='" . $menuCustomFormInfo['linktarget'] . "'>" . $customFormObj->get_info_filtered("name") . "</a></div>";
break;
case "custompage":
$menuItemObj->objCustomPage->select($menuItemInfo['itemtype_id']);
$menuCustomPageInfo = $menuItemObj->objCustomPage->get_info();
$customPageObj->select($menuCustomPageInfo['custompage_id']);
echo "<div style='text-align: " . $menuCustomPageInfo['textalign'] . "'> " . $menuCustomPageInfo['prefix'] . "<a href='" . $MAIN_ROOT . "custompage.php?pID=" . $menuCustomPageInfo['custompage_id'] . "' target='" . $menuCustomPageInfo['linktarget'] . "'>" . $customPageObj->get_info_filtered("pagename") . "</a></div>";
break;
case "downloads":
$menuItemObj->objCustomPage->select($menuItemInfo['itemtype_id']);
$menuDownloadLinkInfo = $menuItemObj->objCustomPage->get_info();
$downloadCatObj->select($menuDownloadLinkInfo['custompage_id']);
echo "<div style='text-align: " . $menuDownloadLinkInfo['textalign'] . "'> " . $menuDownloadLinkInfo['prefix'] . "<a href='" . $MAIN_ROOT . "downloads/index.php?catID=" . $menuDownloadLinkInfo['custompage_id'] . "' target='" . $menuDownloadLinkInfo['linktarget'] . "'>" . $downloadCatObj->get_info_filtered("name") . "</a></div>";
break;
case "customblock":
$menuItemObj->objCustomBlock->select($menuItemInfo['itemtype_id']);
$menuCustomBlockInfo = $menuItemObj->objCustomBlock->get_info();
$menuCustomBlockInfo['code'] = str_replace("[MAIN_ROOT]", $MAIN_ROOT, $menuCustomBlockInfo['code']);
$menuCustomBlockInfo['code'] = str_replace("[MEMBER_ID]", $arrLoginInfo['memberID'], $menuCustomBlockInfo['code']);
$menuCustomBlockInfo['code'] = str_replace("[MEMBERUSERNAME]", $arrLoginInfo['memberUsername'], $menuCustomBlockInfo['code']);
$menuCustomBlockInfo['code'] = str_replace("[MEMBERRANK]", $arrLoginInfo['memberRank'], $menuCustomBlockInfo['code']);
$menuCustomBlockInfo['code'] = str_replace("[PMLINK]", $arrLoginInfo['pmLink'], $menuCustomBlockInfo['code']);
echo $menuCustomBlockInfo['code'];
break;
case "image":
$menuItemObj->objImage->select($menuItemInfo['itemtype_id']);
$menuImageInfo = $menuItemObj->objImage->get_info();
$checkURL = parse_url($menuItemInfo['imageurl']);
if (!isset($checkURL['scheme']) || ($checkURL['scheme'] = "")) {
$menuImageInfo['imageurl'] = $MAIN_ROOT . $menuImageInfo['imageurl'];
}
$dispSetWidth = "";
if ($menuImageInfo['width'] != 0) {
$dispSetWidth = "width: " . $menuImageInfo['width'] . "px; ";
}
$dispSetHeight = "";
if ($menuImageInfo['height'] != 0) {
$dispSetHeight = "height: " . $menuImageInfo['height'] . "px; ";
}
echo "<div style='text-align: " . $menuImageInfo['imagealign'] . "; margin-top: 15px; margin-bottom: 15px'>";
if ($menuImageInfo['link'] != "") {
$checkURL = parse_url($menuImageInfo['link']);
if (!isset($checkURL['scheme']) || ($checkURL['scheme'] = "")) {
$menuImageInfo['link'] = $MAIN_ROOT . $menuImageInfo['link'];
}
echo "<a href='" . $menuImageInfo['link'] . "' target='" . $menuImageInfo['linktarget'] . "'><img src='" . $menuImageInfo['imageurl'] . "' style='" . $dispSetWidth . $dispSetHeight . "' title='" . $menuItemInfo['name'] . "'></a>";
} else {
//.........这里部分代码省略.........
示例2: testGetItems
/**
* @covers MenuItem::getItems
* @covers MenuItem::__construct
* @covers MenuItem::getXmlElementAttributes
*/
public function testGetItems()
{
$actual = $this->menuItem->getItems();
$this->assertContainsOnly('MenuItem', $actual);
}