Dotclear


Ignore:
Timestamp:
09/04/13 15:48:57 (12 years ago)
Author:
Dsls
Branch:
default
Message:

Improved lang combo, updated simpleMenu accordingly, see #1599

File:
1 edited

Legend:

Unmodified
Added
Removed
  • plugins/simpleMenu/index.php

    r1636 r1722  
    2323 
    2424# Liste des catégories 
    25 $categories_combo = array(); 
    2625$categories_label = array(); 
    27 try { 
    28      $rs = $core->blog->getCategories(array('post_type'=>'post')); 
    29      while ($rs->fetch()) { 
    30           $categories_combo[] = new formSelectOption( 
    31                str_repeat('  ',$rs->level-1).($rs->level-1 == 0 ? '' : '• ').html::escapeHTML($rs->cat_title), 
    32                $rs->cat_url 
    33           ); 
    34           $categories_label[$rs->cat_url] = html::escapeHTML($rs->cat_title); 
    35      } 
    36 } catch (Exception $e) { } 
    37  
     26$rs = $core->blog->getCategories(array('post_type'=>'post')); 
     27$categories_combo = dcAdminCombos::getCategoriesCombo($rs); 
     28unset($categories_combo[__('(No cat)')]); 
     29$rs->moveStart(); 
     30while ($rs->fetch()) { 
     31     $categories_label[$rs->cat_id] = html::escapeHTML($rs->cat_title); 
     32} 
    3833# Liste des langues utilisées 
    39 $langs_combo = array(); 
    40 try { 
    41      $rs = $core->blog->getLangs(array('order'=>'asc')); 
    42      if ($rs->count() > 1) 
    43      { 
    44           $all_langs = l10n::getISOcodes(0,1); 
    45           while ($rs->fetch()) { 
    46                $lang_name = isset($all_langs[$rs->post_lang]) ? $all_langs[$rs->post_lang] : $rs->post_lang; 
    47                $langs_combo[$lang_name] = $rs->post_lang; 
    48           } 
    49           unset($all_langs); 
    50      } 
    51      unset($rs); 
    52 } catch (Exception $e) { } 
     34$langs_combo = dcAdminCombos::getLangscombo( 
     35     $core->blog->getLangs(array('order'=>'asc')) 
     36); 
    5337 
    5438# Liste des mois d'archive 
    55 $months_combo = array(); 
    56 try { 
    57      $rs = $core->blog->getDates(array('type'=>'month')); 
    58      $months_combo[__('All months')] = '-'; 
    59      $first_year = $last_year = 0; 
    60      while ($rs->fetch()) { 
    61           $months_combo[dt::str('%B %Y',$rs->ts())] = $rs->year().$rs->month(); 
    62           if (($first_year == 0) || ($rs->year() < $first_year)) $first_year = $rs->year(); 
    63           if (($last_year == 0) || ($rs->year() > $last_year)) $last_year = $rs->year(); 
    64      } 
    65      unset($rs); 
    66 } catch (Exception $e) { } 
     39$rs = $core->blog->getDates(array('type'=>'month')); 
     40$months_combo = array_merge( 
     41     array(__('All months') => '-'), 
     42     dcAdmincombos::getDatesCombo($rs) 
     43); 
     44 
     45$first_year = $last_year = 0; 
     46while ($rs->fetch()) { 
     47     if (($first_year == 0) || ($rs->year() < $first_year)) $first_year = $rs->year(); 
     48     if (($last_year == 0) || ($rs->year() > $last_year)) $last_year = $rs->year(); 
     49} 
     50unset($rs); 
    6751 
    6852# Liste des pages -- Doit être pris en charge plus tard par le plugin ? 
     
    395379     dcPage::success(__('Menu items have been successfully updated.')); 
    396380} 
    397  
    398381if ($step) 
    399382{ 
Note: See TracChangeset for help on using the changeset viewer.

Sites map