Dotclear


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

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • admin/posts_actions.php

    r1345 r1389  
    247247     echo '<h2 class="page-title">'.__('Change category for entries').'</h2>'; 
    248248      
    249      # categories list 
    250249     # Getting categories 
    251      $categories_combo = array('&nbsp;' => ''); 
     250     $categories_combo = array(__('(No cat)') => ''); 
    252251     try { 
    253252          $categories = $core->blog->getCategories(array('post_type'=>'post')); 
    254           while ($categories->fetch()) { 
    255                $categories_combo[] = new formSelectOption( 
    256                     str_repeat('&nbsp;&nbsp;',$categories->level-1). 
    257                     ($categories->level-1 == 0 ? '' : '&bull; ').html::escapeHTML($categories->cat_title), 
    258                     $categories->cat_id 
    259                ); 
     253          if (!$categories->isEmpty()) { 
     254               $l = $categories->level; 
     255               $full_name = array($categories->cat_title); 
     256 
     257               while ($categories->fetch()) { 
     258                    if ($categories->level < $l) { 
     259                         $full_name = array(); 
     260                    } elseif ($categories->level == $l) { 
     261                         array_pop($full_name); 
     262                    } 
     263                    $full_name[] = html::escapeHTML($categories->cat_title); 
     264                    $categories_combo[implode(' / ',$full_name)] = $categories->cat_id; 
     265                    $l = $categories->level; 
     266               } 
    260267          } 
    261268     } catch (Exception $e) { } 
Note: See TracChangeset for help on using the changeset viewer.

Sites map