diff --git a/Makefile b/Makefile index 6520f74..43d1e44 100644 --- a/Makefile +++ b/Makefile @@ -64,7 +64,7 @@ else endif docs: documentation -documentation: phpdoc apigen +documentation: phpdoc phpdoc: # Using PHPDocumentor which wirks with phpdocx.dist.xml @@ -72,7 +72,7 @@ phpdoc: apigen: # Using ApiGen which works with apigen.neon file for configuration - apigen + apigen generate code: php phptidy/phptidy.php replace diff --git a/admin/account.php b/admin/account.php index ab72aab..59a7ca9 100644 --- a/admin/account.php +++ b/admin/account.php @@ -1,4 +1,6 @@ slug = $slug; - $this->title = $title; - $this->link = $link; - $this->sub_menus = $sub_menus; - $this->icon = $icon; - $this->enabled = $enabled; - $this->disabled_message = $disabled_message; - } - - /** - * Renders menu item in HTML - * - * Implementations should render their own tags and call submenu's - * renderChildren() function where supported - */ - abstract public function render(); - - /** - * Renders children elements - */ - public function renderChildren() { - foreach ($this->sub_menus as $menu) { - $menu->render(); - } - } - - /** - * Sets currently active menu elements based on a slug - * - * @param string $active_slug Slug of active menu element - * - * @return boolean Returns true if child is active so parent can also set itself to active state - */ - public function setActive($active_slug) { - if ($this->matchSlug($active_slug)) { - $this->active = true; - - return true; - } else if (is_array($this->sub_menus)) { - foreach ($this->sub_menus as $menu) { - $this->active = $menu->setActive($active_slug); - - if ($this->active) { - return true; - } - } - } - - return false; - } - - /** - * Compares passed slug to this menu element's slug - * - * Primarily to be overriden in the root element that is not supposed to be matched - * - * @param string $slug Slug to match - * - * @return boolean Returns true if slugs match - */ - public function matchSlug($slug) { - return $this->slug == $slug; - } - - /** - * Renders top navigation bar element for this menu item - */ - public function renderTopNav() { - - } - - /** - * Renders breadcrumbs for the node - * - * @param string $extra Extra string to attach to the end of breadcrumbs - */ - abstract public function renderBreadCrumbs($extra = null); - - /** - * Renders portion of page title for this menu element - * - * @param string $extra Extra item to be appended at the end - */ - public function renderTitle($extra = null) { - if ($this->active) { - echo self::$titleSeparator . $this->title; - } - - if (!is_null($this->sub_menus) && is_array($this->sub_menus) && count($this->sub_menus) > 0) { - foreach ($this->sub_menus as $menu) { - $menu->renderTitle($extra); - } - } - } - -} - -/** - * Root element for admin UI menus - * - * @package StartupAPI - * @subpackage Admin - */ -class AdminMenu extends MenuElement { - - /** - * Creates a root element for admin menu, accepts only array of subelements - * - * @param MenuElement[] $sub_menus - */ - public function __construct($sub_menus = null) { - parent::__construct('admin', 'Admin', null, $sub_menus); - } - - public function render() { - ?>sub_menus as $menu) { - ?>