public static function getInstance() { if (self::$classInstance === null) { self::$classInstance = new self(); } return self::$classInstance; }
public function __construct() { parent::__construct(); $this->setPageTitle($this->text('toplink', 'index_page_title')); $this->setPageHeading($this->text('toplink', 'index_page_title')); $this->setPageHeadingIconClass('ow_ic_star'); $this->iconDir = BOL_AvatarService::getInstance()->getAvatarsDir(); OW::getNavigation()->activateMenuItem('admin_plugins', 'admin', 'sidebar_menu_plugins_installed'); $this->myService = TOPLINK_BOL_Service::getInstance(); }
public function collectItems(BASE_CLASS_ConsoleItemCollector $event) { $toplinks = TOPLINK_BOL_Service::getInstance()->getToplink(false); $prefericon = 1; if (!empty($toplinks)) { foreach ($toplinks as $toplink) { $eventContent = array(); if (empty($toplink->itemname)) { $eventContent['notitle'] = 1; } if (!empty($toplink->icon)) { $toplink->icon = preg_match('/^\\//', $toplink->icon) ? OW::getPluginManager()->getPlugin('base')->getUserFilesUrl() . 'avatars' . $toplink->icon : $toplink->icon; if (!empty($toplink->itemname)) { $label = "<span style=\"display:inline;padding-left:21px;background:url('" . $toplink->icon . "') no-repeat scroll left center transparent;\" >" . $toplink->itemname . "</span>"; } else { $label = "<span style=\"display:inline;padding-left:21px;width:21px;background:url('" . $toplink->icon . "') no-repeat scroll center center transparent;\" ></span>"; } } else { $toplink->icon = OW::getPluginManager()->getPlugin('toplink')->getStaticUrl() . 'images/no-title-16.png'; $label = $toplink->itemname; } /*-- check for children --*/ $toplinkchild = TOPLINK_BOL_Service::getInstance()->getTopLinkChildObjectByParentId($toplink->id); if (!empty($toplinkchild)) { $item = new BASE_CMP_ConsoleDropdownMenu($label, 'toplink'); $item->addClass('ow_toplink_' . mt_rand(100, 10000) . '_list'); foreach ($toplinkchild as $children) { $itemarr = array(); $itemarr['url'] = $children->url; $itemarr['label'] = $children->name; $item->addItem('xxxx', $itemarr); } } else { $item = new BASE_CMP_ConsoleItem(); $template = OW::getPluginManager()->getPlugin('toplink')->getCmpViewDir() . 'top_link_item.html'; $item->setTemplate($template); $eventContent['name'] = $toplink->itemname; $eventContent['icon'] = $toplink->icon; $eventContent['url'] = $toplink->url; $eventContent['target'] = $toplink->target; $item->setContent($eventContent); } $event->addItem($item, $toplink->order); /*-- check for children --*/ } } }
<?php $toplinks = TOPLINK_BOL_Service::getInstance()->getToplink(true); if (!empty($toplinks)) { foreach ($toplinks as $toplink) { TOPLINK_BOL_Service::getInstance()->removeToplink($toplink->id); } } $authorization = OW::getAuthorization(); $groupName = 'toplink'; $authorization->deleteGroup($groupName); $authorization->deleteAction($groupName, 'show_toplink');