Changeset 68 for trunk/admin/include


Ignore:
Timestamp:
Sep 7, 2003, 12:14:33 PM (21 years ago)
Author:
z0rglub
Message:

Virtual categories management

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/include/functions.php

    r61 r68  
    386386}
    387387
    388 function display_categories( $categories, $indent )
     388function display_categories( $categories, $indent,
     389                             $selected = -1, $forbidden = -1 )
    389390{
    390391  global $vtp,$sub;
    391392
    392393  foreach ( $categories as $category ) {
    393     $vtp->addSession( $sub, 'associate_cat' );
    394     $vtp->setVar( $sub, 'associate_cat.value',   $category['id'] );
    395     $content = $indent.'- '.$category['name'];
    396     $vtp->setVar( $sub, 'associate_cat.content', $content );
    397     $vtp->closeSession( $sub, 'associate_cat' );
    398     display_categories( $category['subcats'], $indent.str_repeat(' ',3) );
     394    if ( $category['id'] != $forbidden )
     395    {
     396      $vtp->addSession( $sub, 'associate_cat' );
     397      $vtp->setVar( $sub, 'associate_cat.value',   $category['id'] );
     398      $content = $indent.'- '.$category['name'];
     399      $vtp->setVar( $sub, 'associate_cat.content', $content );
     400      if ( $category['id'] == $selected )
     401        $vtp->setVar( $sub, 'associate_cat.selected', ' selected="selected"' );
     402      $vtp->closeSession( $sub, 'associate_cat' );
     403      display_categories( $category['subcats'], $indent.str_repeat(' ',3),
     404                          $selected, $forbidden );
     405    }
    399406  }
    400407}
Note: See TracChangeset for help on using the changeset viewer.