예제 #1
0
	/**
	 * Prepare menu display.
	 *
	 * @return bool
	 */
	protected function before()
	{
		parent::before();

		$this->basemenu = $basemenu = KunenaRoute::getMenu();

		if (!$basemenu)
		{
			return false;
		}

		$parameters = new JRegistry;
		$template = KunenaFactory::getTemplate();
		$parameters->set('showAllChildren', $template->params->get('menu_showall', 0));
		$parameters->set('menutype', $basemenu->menutype);
		$parameters->set('startLevel', $basemenu->level + 1);
		$parameters->set('endLevel', $basemenu->level + $template->params->get('menu_levels', 1));

		$this->list = KunenaMenuHelper::getList($parameters);
		$this->menu = $this->app->getMenu();
		$this->active = $this->menu->getActive();
		$this->active_id = isset($this->active) ? $this->active->id : $this->menu->getDefault()->id;
		$this->path = isset($this->active) ? $this->active->tree : array();
		$this->showAll = $parameters->get('showAllChildren');
		$this->class_sfx = htmlspecialchars($parameters->get('pageclass_sfx'), ENT_COMPAT, 'UTF-8');

		return true;
	}
예제 #2
0
 function display()
 {
     $this->list = KunenaMenuHelper::getList($this->parameters);
     $this->app = JFactory::getApplication();
     $this->menu = $this->app->getMenu();
     $this->active = $this->menu->getActive();
     $this->active_id = isset($this->active) ? $this->active->id : $this->menu->getDefault()->id;
     $this->path = isset($this->active) ? $this->active->tree : array();
     $this->showAll = $this->parameters->get('showAllChildren');
     $this->class_sfx = htmlspecialchars($this->parameters->get('class_sfx'));
     if (count($this->list)) {
         require JModuleHelper::getLayoutPath('mod_kunenamenu', $this->parameters->get('layout', 'default'));
     }
 }
예제 #3
0
 /**
  * Create a Joomla menu for the main
  * navigation tab and publish it in the Kunena module position kunena_menu.
  * In addition it checks if there is a link to Kunena in any of the menus
  * and if not, adds a forum link in the mainmenu.
  */
 function createMenu()
 {
     $menu = array('name' => JText::_('COM_KUNENA_MENU_ITEM_FORUM'), 'alias' => KunenaRoute::stringURLSafe(JText::_('COM_KUNENA_MENU_FORUM_ALIAS'), 'forum'), 'link' => 'index.php?option=com_kunena&view=home', 'access' => 0, 'params' => array('catids' => 0));
     $submenu = array('index' => array('name' => JText::_('COM_KUNENA_MENU_ITEM_INDEX'), 'alias' => KunenaRoute::stringURLSafe(JText::_('COM_KUNENA_MENU_INDEX_ALIAS'), 'index'), 'link' => 'index.php?option=com_kunena&view=category&layout=list', 'access' => 0, 'default' => 'categories', 'params' => array()), 'recent' => array('name' => JText::_('COM_KUNENA_MENU_ITEM_RECENT'), 'alias' => KunenaRoute::stringURLSafe(JText::_('COM_KUNENA_MENU_RECENT_ALIAS'), 'recent'), 'link' => 'index.php?option=com_kunena&view=topics&mode=replies', 'access' => 0, 'default' => 'recent', 'params' => array('topics_catselection' => 1, 'topics_categories' => 0, 'topics_time' => 720)), 'newtopic' => array('name' => JText::_('COM_KUNENA_MENU_ITEM_NEWTOPIC'), 'alias' => KunenaRoute::stringURLSafe(JText::_('COM_KUNENA_MENU_NEWTOPIC_ALIAS'), 'newtopic'), 'link' => 'index.php?option=com_kunena&view=topic&layout=create', 'access' => 1, 'params' => array()), 'noreplies' => array('name' => JText::_('COM_KUNENA_MENU_ITEM_NOREPLIES'), 'alias' => KunenaRoute::stringURLSafe(JText::_('COM_KUNENA_MENU_NOREPLIES_ALIAS'), 'noreplies'), 'link' => 'index.php?option=com_kunena&view=topics&mode=noreplies', 'access' => 1, 'params' => array('topics_catselection' => 1, 'topics_categories' => 0, 'topics_time' => -1)), 'mylatest' => array('name' => JText::_('COM_KUNENA_MENU_ITEM_MYLATEST'), 'alias' => KunenaRoute::stringURLSafe(JText::_('COM_KUNENA_MENU_MYLATEST_ALIAS'), 'mylatest'), 'link' => 'index.php?option=com_kunena&view=topics&layout=user&mode=default', 'access' => 1, 'default' => 'my', 'params' => array('topics_catselection' => 1, 'topics_categories' => 0, 'topics_time' => -1)), 'profile' => array('name' => JText::_('COM_KUNENA_MENU_ITEM_PROFILE'), 'alias' => KunenaRoute::stringURLSafe(JText::_('COM_KUNENA_MENU_PROFILE_ALIAS'), 'profile'), 'link' => 'index.php?option=com_kunena&view=user', 'access' => 1, 'params' => array('integration' => 1)), 'help' => array('name' => JText::_('COM_KUNENA_MENU_ITEM_HELP'), 'alias' => KunenaRoute::stringURLSafe(JText::_('COM_KUNENA_MENU_HELP_ALIAS'), 'help'), 'link' => 'index.php?option=com_kunena&view=misc', 'access' => 2, 'params' => array('body' => JText::_('COM_KUNENA_MENU_HELP_BODY'), 'body_format' => 'bbcode')), 'search' => array('name' => JText::_('COM_KUNENA_MENU_ITEM_SEARCH'), 'alias' => KunenaRoute::stringURLSafe(JText::_('COM_KUNENA_MENU_SEARCH_ALIAS'), 'search'), 'link' => 'index.php?option=com_kunena&view=search', 'access' => 0, 'params' => array()));
     $lang = JFactory::getLanguage();
     $debug = $lang->setDebug(false);
     if (version_compare(JVERSION, '1.6', '>')) {
         // Joomla 1.6+
         $this->createMenuJ25($menu, $submenu);
     } else {
         // Joomla 1.5
         $this->createMenuJ15($menu, $submenu);
     }
     KunenaMenuHelper::cleanCache();
     $lang->setDebug($debug);
 }
예제 #4
0
파일: fix.php 프로젝트: Ruud68/Kunena-Forum
 /**
  * @param $itemid
  *
  * @return boolean
  */
 public static function delete($itemid)
 {
     // Only delete Kunena menu items
     if (!isset(self::$items[$itemid])) {
         return false;
     }
     $table = JTable::getInstance('menu');
     $result = $table->delete($itemid);
     KunenaMenuHelper::cleanCache();
     return $result;
 }
예제 #5
0
	/**
	 * Clear Joomla menu cache.
	 */
	public static function clearMenu()
	{
		KunenaMenuHelper::cleanCache();
	}
예제 #6
0
	function getMenu()
	{
		$basemenu = KunenaRoute::getMenu();

		if (!$basemenu)
		{
			return ' ';
		}

		$this->parameters = new JRegistry();
		$this->parameters->set('showAllChildren', $this->ktemplate->params->get('menu_showall', 0));
		$this->parameters->set('menutype', $basemenu->menutype);
		$this->parameters->set('startLevel', $basemenu->level + 1);
		$this->parameters->set('endLevel', $basemenu->level + $this->ktemplate->params->get('menu_levels', 1));

		$this->list      = KunenaMenuHelper::getList($this->parameters);
		$this->menu      = $this->app->getMenu();
		$this->active    = $this->menu->getActive();
		$this->active_id = isset($this->active) ? $this->active->id : $this->menu->getDefault()->id;
		$this->path      = isset($this->active) ? $this->active->tree : array();
		$this->showAll   = $this->parameters->get('showAllChildren');
		$this->class_sfx = htmlspecialchars($this->parameters->get('pageclass_sfx'), ENT_COMPAT, 'UTF-8');

		return count($this->list) ? $this->loadTemplateFile('menu') : '';
	}