Changeset 2379 in ExiteCMS


Ignore:
Timestamp:
07/10/11 14:00:17 (11 months ago)
Author:
WanWizard
Message:

fixed submenu's not properly ordered in the link list

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/includes/menu_include.php

    r2375 r2379  
    9898 
    9999    // get all menu records for this panel and this parent 
    100     $result = dbquery("SELECT * FROM ".$db_prefix."site_links ".$where." ORDER BY link_order"); 
     100    $result = dbquery("SELECT * FROM ".$db_prefix."site_links ".$where." ORDER BY link_parent ASC, link_order ASC"); 
    101101    // process the results 
    102     $total = dbrows($result); 
    103     $current = 0; 
     102    $current = $start = count($linkinfo); 
    104103    while($data = dbarray($result)) { 
    105104        // only include records that the user is allowed to see (unless showall is specified) 
    106105        if ($no_sec || checkgroup($data['link_visibility'])) { 
    107106            // true if this is the first menu item 
    108             $data['menu_first'] = $current == 0 ? 1 : 0; 
     107            $data['menu_first'] = $current == $start ? 1 : 0; 
    109108            // for the first menu item, check if there's a menu_state cookie stored for this menu 
    110109            $data['div_state'] = -1; 
     
    133132            // get the name of the user group attached to this link 
    134133            $data['link_visibility_name'] = getgroupname($data['link_visibility'], '-1'); 
    135             $data['has_submenu'] = 0; 
     134            $data['has_submenu'] = false; 
    136135            $linkinfo[$current] = $data; 
    137136            $current++; 
     
    145144    } 
    146145 
    147     // set the flag of the last menu entry 
    148     isset($linkinfo[$current-1]) && $linkinfo[$current-1]['menu_last'] = 1; 
    149  
    150     return ($total == 0 ? 0 : 1); 
     146    // any entries found? 
     147    if ($current != $start) { 
     148        // set the flag of the last menu entry 
     149        $linkinfo[$current-1]['menu_last'] = 1; 
     150        return true; 
     151    } else { 
     152        return false; 
     153    } 
    151154} 
    152155?> 
Note: See TracChangeset for help on using the changeset viewer.