--- mambo/branches/4.6/administrator/components/com_menus/admin.menus.php 2006/01/26 20:11:56 194 +++ mambo/branches/4.6/administrator/components/com_menus/admin.menus.php 2006/02/15 16:49:55 287 @@ -707,16 +707,12 @@ } function saveOrder( &$cid, $menutype ) { - global $database; - - $total = count( $cid ); $order = mosGetParam( $_POST, 'order', array(0) ); $row = new mosMenu( $database ); - $conditions = array(); - + $parents = array(); // update ordering values - for( $i=0; $i < $total; $i++ ) { - $row->load( $cid[$i] ); + foreach ($cid as $i=>$ciditem) { + $row->load( $ciditem ); if ($row->ordering != $order[$i]) { $row->ordering = $order[$i]; if (!$row->store()) { @@ -724,21 +720,12 @@ exit(); } // remember to updateOrder this group - $condition = "menutype = '$menutype' AND parent = '$row->parent' AND published >= 0"; - $found = false; - foreach ( $conditions as $cond ) - if ($cond[1]==$condition) { - $found = true; - break; - } // if - if (!$found) $conditions[] = array($row->id, $condition); - } // for - } // for - + $parents[$row->parent] = $row->id; + } + } // execute updateOrder for each group - foreach ( $conditions as $cond ) { - $row->load( $cond[0] ); - $row->updateOrder( $cond[1] ); + foreach ($parents as $parent=>$rowid) { + $row->updateOrder("menutype = '$menutype' AND parent = '$parent' AND published >= 0"); } // foreach $msg = T_('New ordering saved');