Quellcode durchsuchen

- Bug fix: make GetMenuIndexByTitle work !

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@492 a333f486-631f-4898-b8df-5754b55c2be0
dflaven vor 15 Jahren
Ursprung
Commit
6196a6e7ae
1 geänderte Dateien mit 6 neuen und 1 gelöschten Zeilen
  1. 6 1
      application/menunode.class.inc.php

+ 6 - 1
application/menunode.class.inc.php

@@ -70,6 +70,10 @@ class ApplicationMenu
 	 */
 	static public function InsertMenu(MenuNode $oMenuNode, $iParentIndex = -1, $fRank)
 	{
+		$index = self::GetMenuIndexByTitle($oMenuNode->GetRawTitle());
+		if ($index == -1)
+		{
+			// The menu does not already exist, insert it
 		$index = count(self::$aMenusIndex);
 		self::$aMenusIndex[$index] = array( 'node' => $oMenuNode, 'children' => array());
 		if ($iParentIndex == -1)
@@ -80,6 +84,7 @@ class ApplicationMenu
 		{
 			self::$aMenusIndex[$iParentIndex]['children'][] = array ('rank' => $fRank, 'index' => $index);
 		}
+		}
 		return $index;
 	}
 	
@@ -187,7 +192,7 @@ class ApplicationMenu
 		{
 			if ($aMenu['node']->GetRawTitle() == $sTitle)
 			{
-				$id = $aMenu['node']->GetIndex();
+				$index = $aMenu['node']->GetIndex();
 				break;
 			}
 		}