示例#1
0
 function levelShowDropdown($parent, $depth = 0, $default = 0, $ignore_ids = array())
 {
     $html = '';
     global $db;
     $nodes = $db->selectObjects('section', 'parent=' . $parent);
     $nodes = expSorter::sort(array('array' => $nodes, 'sortby' => 'rank', 'order' => 'ASC'));
     foreach ($nodes as $node) {
         if (($node->public == 1 || expPermissions::check('view', expCore::makeLocation('navigationmodule', '', $node->id))) && !in_array($node->id, $ignore_ids)) {
             $html .= '<option value="' . $node->id . '" ';
             if ($default == $node->id) {
                 $html .= 'selected';
             }
             $html .= '>';
             if ($node->active == 1) {
                 $html .= str_pad('', $depth * 3, '.', STR_PAD_LEFT) . $node->name;
             } else {
                 $html .= str_pad('', $depth * 3, '.', STR_PAD_LEFT) . '(' . $node->name . ')';
             }
             $html .= '</option>';
             $html .= navigationmodule::levelShowDropdown($node->id, $depth + 1, $default, $ignore_ids);
         }
     }
     return $html;
 }