Dotclear

Changeset 1775:fd4b24fb574d


Ignore:
Timestamp:
09/10/13 11:29:38 (12 years ago)
Author:
Dsls
Branch:
default
Message:

Much better this way, see #1564

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • admin/posts.php

    r1719 r1775  
    5353 
    5454     $categories_combo = array_merge( 
    55           array('-' => ''), 
    56           dcAdminCombos::getCategoriesCombo($categories) 
    57      ); 
    58      $categories_combo[__('(No cat)')] = 'NULL'; 
     55          array( 
     56               new formSelectOption('-',''), 
     57               new formSelectOption(__('(No cat)'),'NULL')),           
     58          dcAdminCombos::getCategoriesCombo($categories,false) 
     59     ); 
     60     $categories_values = array(); 
     61     foreach ($categories_combo as $cat) { 
     62          if (isset($cat->value)) { 
     63               $categories_values[$cat->value]=true; 
     64          } 
     65     } 
    5966      
    6067     $status_combo = array_merge( 
     
    161168 
    162169# - Categories filter 
    163 if ($cat_id !== '' && in_array($cat_id,$categories_combo)) { 
     170if ($cat_id !== '' && isset($categories_values[$cat_id])) { 
    164171     $params['cat_id'] = $cat_id; 
    165172     $show_filters = true; 
  • inc/admin/lib.admincombos.php

    r1774 r1775  
    3030     @return   <b>array</b> the combo box (form::combo -compatible format) 
    3131     */ 
    32      public static function getCategoriesCombo($categories) { 
    33           $categories_combo[__('(No cat)')] = ''; 
     32     public static function getCategoriesCombo($categories,$include_empty = true) { 
     33          $categories_combo = array(); 
     34          if ($include_empty) { 
     35               $categories_combo = array(new formSelectOption(__('(no cat)'),'')); 
     36          } 
    3437          while ($categories->fetch()) { 
    3538               $categories_combo[] = new formSelectOption ( 
Note: See TracChangeset for help on using the changeset viewer.

Sites map