<ol class="boxMenu">
{foreach from=$menuItemNodeList item=menuItemNode}
<li class="{if $menuItemNode->isActiveNode()}active{/if}{if $menuItemNode->hasChildren()} boxMenuHasChildren{/if}">
- <a href="{$menuItemNode->getMenuItem()->getURL()}" class="boxMenuLink">
- <span class="boxMenuLinkTitle">{lang}{$menuItemNode->getMenuItem()->title}{/lang}</span>
- {if $menuItemNode->getMenuItem()->getOutstandingItems() > 0}
- <span class="boxMenuLinkOutstandingItems badge badgeUpdate">{#$menuItemNode->getMenuItem()->getOutstandingItems()}</span>
+ <a href="{$menuItemNode->getURL()}" class="boxMenuLink">
+ <span class="boxMenuLinkTitle">{lang}{$menuItemNode->title}{/lang}</span>
+ {if $menuItemNode->getOutstandingItems() > 0}
+ <span class="boxMenuLinkOutstandingItems badge badgeUpdate">{#$menuItemNode->getOutstandingItems()}</span>
{/if}
</a>
<ol class="menuOverlayItemList">*}
{foreach from=$__wcf->getBoxHandler()->getBoxes('mainMenu')[0]->getMenu()->getMenuItemNodeList() item=menuItemNode}
<li class="menuOverlayItem">
- {assign var=__outstandingItems value=$menuItemNode->getMenuItem()->getOutstandingItems()}
- <a href="{$menuItemNode->getMenuItem()->getURL()}" class="menuOverlayItemLink{if $__outstandingItems} menuOverlayItemBadge{/if}{if $menuItemNode->isActiveNode()} active{/if}">
- <span class="menuOverlayItemTitle">{lang}{$menuItemNode->getMenuItem()->title}{/lang}</span>
+ {assign var=__outstandingItems value=$menuItemNode->getOutstandingItems()}
+ <a href="{$menuItemNode->getURL()}" class="menuOverlayItemLink{if $__outstandingItems} menuOverlayItemBadge{/if}{if $menuItemNode->isActiveNode()} active{/if}">
+ <span class="menuOverlayItemTitle">{lang}{$menuItemNode->title}{/lang}</span>
{if $__outstandingItems}
<span class="badge badgeUpdate">{#$__outstandingItems}</span>
{/if}
<ul class="scrollableCheckboxList">
{foreach from=$pageNodeList item=pageNode}
<li{if $pageNode->getDepth() > 1} style="padding-left: {$pageNode->getDepth()*20-20}px"{/if}>
- <label><input type="checkbox" name="pageIDs[]" value="{@$pageNode->getPage()->pageID}"{if $pageNode->getPage()->pageID|in_array:$pageIDs} checked="checked"{/if} /> {$pageNode->getPage()->name}</label>
+ <label><input type="checkbox" name="pageIDs[]" value="{@$pageNode->pageID}"{if $pageNode->pageID|in_array:$pageIDs} checked="checked"{/if} /> {$pageNode->name}</label>
</li>
{/foreach}
</ul>
<option value="0">{lang}wcf.global.noSelection{/lang}</option>
{foreach from=$pageNodeList item=pageNode}
- <option value="{@$pageNode->getPage()->pageID}"{if $pageNode->getPage()->pageID == $linkPageID} selected="selected"{/if}>{if $pageNode->getDepth() > 1}{@" "|str_repeat:($pageNode->getDepth() - 1)}{/if}{$pageNode->getPage()->name}</option>
+ <option value="{@$pageNode->pageID}"{if $pageNode->pageID == $linkPageID} selected="selected"{/if}>{if $pageNode->getDepth() > 1}{@" "|str_repeat:($pageNode->getDepth() - 1)}{/if}{$pageNode->name}</option>
{/foreach}
</select>
{if $errorField == 'linkPageID'}
<dd>
<select name="pageIDs[]" id="pageIDs" multiple="multiple" size="20">
{foreach from=$pageNodeList item=pageNode}
- <option value="{@$pageNode->getPage()->pageID}"{if $pageNode->getPage()->pageID|in_array:$pageIDs} selected="selected"{/if}>{if $pageNode->getDepth() > 1}{@" "|str_repeat:($pageNode->getDepth() - 1)}{/if}{$pageNode->getPage()->name}</option>
+ <option value="{@$pageNode->pageID}"{if $pageNode->pageID|in_array:$pageIDs} selected="selected"{/if}>{if $pageNode->getDepth() > 1}{@" "|str_repeat:($pageNode->getDepth() - 1)}{/if}{$pageNode->name}</option>
{/foreach}
</select>
</dd>
<option value="0">{lang}wcf.global.noSelection{/lang}</option>
{foreach from=$menuItemNodeList item=menuItemNode}
- <option value="{@$menuItemNode->getMenuItem()->itemID}"{if $menuItemNode->getMenuItem()->itemID == $parentItemID} selected="selected"{/if}>{if $menuItemNode->getDepth() > 1}{@" "|str_repeat:($menuItemNode->getDepth() - 1)}{/if}{lang}{$menuItemNode->getMenuItem()->title}{/lang}</option>
+ <option value="{@$menuItemNode->itemID}"{if $menuItemNode->itemID == $parentItemID} selected="selected"{/if}>{if $menuItemNode->getDepth() > 1}{@" "|str_repeat:($menuItemNode->getDepth() - 1)}{/if}{lang}{$menuItemNode->title}{/lang}</option>
{/foreach}
</select>
{if $errorField == 'parentItemID'}
<option value="0">{lang}wcf.global.noSelection{/lang}</option>
{foreach from=$pageNodeList item=pageNode}
- <option value="{@$pageNode->getPage()->pageID}"{if $pageNode->getPage()->pageID == $pageID} selected="selected"{/if}>{if $pageNode->getDepth() > 1}{@" "|str_repeat:($pageNode->getDepth() - 1)}{/if}{$pageNode->getPage()->name}</option>
+ <option value="{@$pageNode->pageID}"{if $pageNode->pageID == $pageID} selected="selected"{/if}>{if $pageNode->getDepth() > 1}{@" "|str_repeat:($pageNode->getDepth() - 1)}{/if}{$pageNode->name}</option>
{/foreach}
</select>
{if $errorField == 'pageID'}
<ol class="sortableList" data-object-id="0">
{content}
{foreach from=$menuItemNodeList item=menuItemNode}
- <li class="sortableNode" data-object-id="{@$menuItemNode->getMenuItem()->itemID}">
+ <li class="sortableNode" data-object-id="{@$menuItemNode->itemID}">
<span class="sortableNodeLabel">
- <a href="{link controller='MenuItemEdit' id=$menuItemNode->getMenuItem()->itemID}{/link}">{lang}{$menuItemNode->getMenuItem()->title}{/lang}</a>
+ <a href="{link controller='MenuItemEdit' id=$menuItemNode->itemID}{/link}">{lang}{$menuItemNode->title}{/lang}</a>
<span class="statusDisplay sortableButtonContainer">
- {if $menuItemNode->getMenuItem()->canDisable()}
- <span class="icon icon16 fa-{if !$menuItemNode->getMenuItem()->isDisabled}check-{/if}square-o jsToggleButton jsTooltip pointer" title="{lang}wcf.global.button.{if $menuItemNode->getMenuItem()->isDisabled}enable{else}disable{/if}{/lang}" data-object-id="{@$menuItemNode->getMenuItem()->itemID}"></span>
+ {if $menuItemNode->canDisable()}
+ <span class="icon icon16 fa-{if !$menuItemNode->isDisabled}check-{/if}square-o jsToggleButton jsTooltip pointer" title="{lang}wcf.global.button.{if $menuItemNode->isDisabled}enable{else}disable{/if}{/lang}" data-object-id="{@$menuItemNode->itemID}"></span>
{else}
- <span class="icon icon16 fa-{if !$menuItemNode->getMenuItem()->isDisabled}check-{/if}square-o disabled" title="{lang}wcf.global.button.{if $menuItemNode->getMenuItem()->isDisabled}enable{else}disable{/if}{/lang}"></span>
+ <span class="icon icon16 fa-{if !$menuItemNode->isDisabled}check-{/if}square-o disabled" title="{lang}wcf.global.button.{if $menuItemNode->isDisabled}enable{else}disable{/if}{/lang}"></span>
{/if}
- <a href="{link controller='MenuItemEdit' id=$menuItemNode->getMenuItem()->itemID}{/link}" class="jsTooltip" title="{lang}wcf.global.button.edit{/lang}"><span class="icon icon16 fa-pencil"></span></a>
- {if $menuItemNode->getMenuItem()->canDelete()}
- <span class="icon icon16 fa-times jsDeleteButton jsTooltip pointer" title="{lang}wcf.global.button.delete{/lang}" data-object-id="{@$menuItemNode->getMenuItem()->itemID}" data-confirm-message="{lang menuItem=$menuItemNode->getMenuItem()}wcf.acp.menu.item.delete.confirmMessage{/lang}"></span>
+ <a href="{link controller='MenuItemEdit' id=$menuItemNode->itemID}{/link}" class="jsTooltip" title="{lang}wcf.global.button.edit{/lang}"><span class="icon icon16 fa-pencil"></span></a>
+ {if $menuItemNode->canDelete()}
+ <span class="icon icon16 fa-times jsDeleteButton jsTooltip pointer" title="{lang}wcf.global.button.delete{/lang}" data-object-id="{@$menuItemNode->itemID}" data-confirm-message="{lang menuItem=$menuItemNode->getMenuItem()}wcf.acp.menu.item.delete.confirmMessage{/lang}"></span>
{else}
<span class="icon icon16 fa-times disabled" title="{lang}wcf.global.button.delete{/lang}"></span>
{/if}
</span>
</span>
- <ol class="sortableList" data-object-id="{@$menuItemNode->getMenuItem()->itemID}">{if !$menuItemNode->hasChildren()}</ol></li>{/if}
+ <ol class="sortableList" data-object-id="{@$menuItemNode->itemID}">{if !$menuItemNode->hasChildren()}</ol></li>{/if}
{if !$menuItemNode->hasChildren() && $menuItemNode->isLastSibling()}
{@"</ol></li>"|str_repeat:$menuItemNode->getOpenParentNodes()}
<option value="0">{lang}wcf.acp.page.parentPageID.noParentPage{/lang}</option>
{foreach from=$pageNodeList item=pageNode}
- <option value="{@$pageNode->getPage()->pageID}"{if $pageNode->getPage()->pageID == $parentPageID} selected="selected"{/if}>{if $pageNode->getDepth() > 1}{@" "|str_repeat:($pageNode->getDepth() - 1)}{/if}{$pageNode->getPage()->name}</option>
+ <option value="{@$pageNode->pageID}"{if $pageNode->pageID == $parentPageID} selected="selected"{/if}>{if $pageNode->getDepth() > 1}{@" "|str_repeat:($pageNode->getDepth() - 1)}{/if}{$pageNode->name}</option>
{/foreach}
</select>
{if $errorField == 'parentPageID'}
<a href="{link forceFrontend=true}{/link}" class="dropdownToggle jsTooltip" title="{lang}wcf.global.jumpToPage{/lang}"><span class="icon icon32 fa-home"></span></a>
<ul class="dropdownMenu" data-dropdown-alignment-horizontal="right">
{foreach from=$__wcf->getFrontendMenu()->getMenuItemNodeList() item=_menuItem}
- {if !$_menuItem->getMenuItem()->parentItemID && $_menuItem->getMenuItem()->getPage()}
- <li><a href="{$_menuItem->getMenuItem()->getPage()->getLink()}">{$_menuItem->getMenuItem()->getPage()}</a></li>
+ {if !$_menuItem->parentItemID && $_menuItem->getPage()}
+ <li><a href="{$_menuItem->getPage()->getLink()}">{$_menuItem->getPage()}</a></li>
{/if}
{/foreach}
</ul>
</a>
<ol class="menuOverlayItemList">
{foreach from=$__wcf->getFrontendMenu()->getMenuItemNodeList() item=_menuItem}
- {if !$_menuItem->getMenuItem()->parentItemID && $_menuItem->getMenuItem()->getPage()}
- <li class="menuOverlayItem"><a href="{$_menuItem->getMenuItem()->getPage()->getLink()}" class="menuOverlayItemLink">{$_menuItem->getMenuItem()->getPage()}</a></li>
+ {if !$_menuItem->parentItemID && $_menuItem->getPage()}
+ <li class="menuOverlayItem"><a href="{$_menuItem->getPage()->getLink()}" class="menuOverlayItemLink">{$_menuItem->getPage()}</a></li>
{/if}
{/foreach}
</ol>
// fetch page handlers
foreach ($this->pageNodeList as $pageNode) {
- $handler = $pageNode->getPage()->getHandler();
+ $handler = $pageNode->getHandler();
if ($handler !== null) {
if ($handler instanceof ILookupPageHandler) {
- $this->pageHandlers[$pageNode->getPage()->pageID] = $pageNode->getPage()->requireObjectID;
+ $this->pageHandlers[$pageNode->pageID] = $pageNode->requireObjectID;
}
}
}
// fetch page handlers
foreach ($this->pageNodeList as $pageNode) {
- $handler = $pageNode->getPage()->getHandler();
+ $handler = $pageNode->getHandler();
if ($handler !== null) {
if ($handler instanceof ILookupPageHandler) {
- $this->pageHandlers[$pageNode->getPage()->pageID] = $pageNode->getPage()->requireObjectID;
+ $this->pageHandlers[$pageNode->pageID] = $pageNode->requireObjectID;
}
}
}
// fetch page handlers
foreach ($this->pageNodeList as $pageNode) {
- $handler = $pageNode->getPage()->getHandler();
+ $handler = $pageNode->getHandler();
if ($handler !== null) {
if ($handler instanceof ILookupPageHandler) {
- $this->pageHandlers[$pageNode->getPage()->pageID] = $pageNode->getPage()->requireObjectID;
+ $this->pageHandlers[$pageNode->pageID] = $pageNode->requireObjectID;
}
}
}
<?php
namespace wcf\data\menu\item;
+use wcf\data\DatabaseObjectDecorator;
/**
* Represents a menu item node element.
* @subpackage data.menu.item
* @category Community Framework
* @since 2.2
+ *
+ * @method MenuItem getDecoratedObject()
+ * @mixin MenuItem
*/
-class MenuItemNode implements \Countable, \RecursiveIterator {
+class MenuItemNode extends DatabaseObjectDecorator implements \Countable, \RecursiveIterator {
/**
* children of this node
* @var MenuItemNode[]
*/
protected $isActive = false;
- /**
- * menu item object
- * @var MenuItem
- */
- protected $menuItem;
-
/**
* parent node
* @var MenuItemNode
*/
private $position = 0;
+ /**
+ * @inheritDoc
+ */
+ protected static $baseClass = MenuItem::class;
+
/**
* Creates a new MenuItemNode object.
*
* @param integer $depth
*/
public function __construct($parentNode = null, MenuItem $menuItem = null, $depth = 0) {
+ if ($menuItem === null) {
+ $menuItem = new MenuItem(null, []);
+ }
+ parent::__construct($menuItem);
+
$this->parentNode = $parentNode;
- $this->menuItem = $menuItem;
$this->depth = $depth;
}
return $this->parentNode;
}
- /**
- * Returns the menu item object of this node.
- *
- * @return MenuItem
- */
- public function getMenuItem() {
- return $this->menuItem;
- }
-
/**
* Returns the number of children.
*
for ($i = 0, $length = count($itemIDs); $i < $length; $i++) {
/** @var MenuItemNode $node */
foreach ($nodeList as $node) {
- if ($node->getMenuItem()->itemID == $itemIDs[$i]) {
+ if ($node->itemID == $itemIDs[$i]) {
$node->setIsActive();
// only one effective item can be marked as active, use the first
<?php
namespace wcf\data\page;
+use wcf\data\DatabaseObjectDecorator;
/**
* Represents a page node element.
* @subpackage data.page
* @category Community Framework
* @since 2.2
+ *
+ * @method Page getDecoratedObject()
+ * @mixin Page
*/
-class PageNode implements \Countable, \RecursiveIterator {
+class PageNode extends DatabaseObjectDecorator implements \Countable, \RecursiveIterator {
/**
* parent node
* @var PageNode
* children of this node
* @var PageNode[]
*/
- protected $children = array();
-
- /**
- * page object
- * @var Page
- */
- protected $page = null;
+ protected $children = [];
/**
* node depth
*/
private $position = 0;
+ /**
+ * @inheritDoc
+ */
+ protected static $baseClass = Page::class;
+
/**
* Creates a new PageNode object.
*
* @param integer $depth
*/
public function __construct($parentNode = null, Page $page = null, $depth = 0) {
+ if ($page === null) {
+ $page = new Page(null, []);
+ }
+ parent::__construct($page);
+
$this->parentNode = $parentNode;
- $this->page = $page;
$this->depth = $depth;
}
return $this->parentNode;
}
- /**
- * Returns the page object of this node
- *
- * @return Page
- */
- public function getPage() {
- return $this->page;
- }
-
/**
* Returns the number of children.
*
$fieldElement = '<select name="'.$this->fieldName.'[]" id="'.$this->fieldName.'" multiple="multiple" size="10">';
/** @var PageNode $pageNode */
foreach ($pageNodes as $pageNode) {
- $fieldElement .= '<option value="'.$pageNode->getPage()->pageID.'">'.($pageNode->getDepth() > 1 ? str_repeat(" ", $pageNode->getDepth() - 1) : '').$pageNode->getPage()->name.'</option>';
+ $fieldElement .= '<option value="'.$pageNode->pageID.'">'.($pageNode->getDepth() > 1 ? str_repeat(" ", $pageNode->getDepth() - 1) : '').$pageNode->name.'</option>';
}
$fieldElement .= "</select>";