Dotclear

Changeset 1391:4c5e04fe40b9 for admin


Ignore:
Timestamp:
08/15/13 19:30:05 (12 years ago)
Author:
Denis Jean-Christian <contact@…>
Branch:
2.5
Message:

Enhance categories combo and other fix, step 3, addresses #1424

File:
1 edited

Legend:

Unmodified
Added
Removed
  • admin/index.php

    r1247 r1391  
    304304     if ($core->auth->check('usage,contentadmin',$core->blog->id)) 
    305305     { 
    306           $categories_combo = array('&nbsp;' => ''); 
     306          # Getting categories 
     307          $categories_combo = array(__('(No cat)') => ''); 
    307308          try { 
    308309               $categories = $core->blog->getCategories(array('post_type'=>'post')); 
    309                while ($categories->fetch()) { 
    310                     $categories_combo[] = new formSelectOption( 
    311                          str_repeat('&nbsp;&nbsp;',$categories->level-1). 
    312                          ($categories->level-1 == 0 ? '' : '&bull; ').html::escapeHTML($categories->cat_title), 
    313                          $categories->cat_id 
    314                     ); 
     310               if (!$categories->isEmpty()) { 
     311                    $l = $categories->level; 
     312                    $full_name = array($categories->cat_title); 
     313 
     314                    while ($categories->fetch()) { 
     315                         if ($categories->level < $l) { 
     316                              $full_name = array(); 
     317                         } elseif ($categories->level == $l) { 
     318                              array_pop($full_name); 
     319                         } 
     320                         $full_name[] = html::escapeHTML($categories->cat_title); 
     321                         $categories_combo[implode(' / ',$full_name)] = $categories->cat_id; 
     322                         $l = $categories->level; 
     323                    } 
    315324               } 
    316325          } catch (Exception $e) { } 
    317       
     326           
    318327          echo 
    319328          '<div id="quick">'. 
Note: See TracChangeset for help on using the changeset viewer.

Sites map