check(5); include dirname(__FILE__).'/inc/connexion.php'; $err = ''; # Reord if (!empty($_POST['reord'])) { if ($blog->reordCats(false,true) === false) { $err = $blog->error(1); } else { header('Location: cat_list.php'); exit; } } # Delete if (!empty($_POST['delete']) && !empty($_POST['cat_ids'])) { $ids = $_POST['cat_ids']; $has_error = false; foreach ($ids as $id) { if ($blog->delCat((integer)$id) === false) { $has_error = true; } } if (!$has_error) { $msg = __('selected categories have been deleted'); } else { $msg = __('Cannot delete some categories'); } header('Location: cat_list.php&msg='.urlencode($msg)); exit; } # Classic ord if (isset($_POST['catOrd']) && is_array($_POST['catOrd'])) { if ($blog->ordCats($_POST['catOrd']) === false) { $err = $blog->error(1); } else { header('Location: cat_list.php'); exit; } } # DragNdrop if (!empty($_POST['dndSort'])) { $catOrd = array(); foreach (explode(';',$_POST['dndSort']) as $k => $v) { $catOrd[substr($v,3)] = $k; } if ($blog->ordCats($catOrd) === false) { $err = $blog->error(1); } else { header('Location: cat_list.php'); exit; } } $mySubMenu->addItem(''.__('New category').'','categorie.php','images/ico_new.png',false); openPage( __('Categories list'), jsHelpers::dragSort(). '' ); ?>

'.__('Error(s)').' :

'. $err.''; } $rsCat = $blog->getCat('','cat_ord'); if ($rsCat->isEmpty()) { echo '

'.__('No category yet').'

'; } else { echo '

'.__('Drag items to change their positions.').'

'; echo '
'; echo '
'; $has_deletable = false; while(!$rsCat->EOF()) { $cat_id = $rsCat->field('cat_id'); $cat_ord = $rsCat->field('cat_ord'); $cat_libelle = $rsCat->field('cat_libelle'); $cat_nb_post = (integer) $rsCat->field('nb_post'); echo '
'. '

'.form::checkbox('cat_ids[]',$cat_id,'','','',(boolean)$cat_nb_post).' '. $cat_libelle.''; if ($cat_nb_post > 0) { echo ' - '. (($cat_nb_post>1) ? sprintf(__('%d entries'),$cat_nb_post) : sprintf(__('%d entry'),$cat_nb_post)). ''; } else { $has_deletable = true; } echo '

'. '

'. form::field(array('catOrd['.$cat_id.']','catOrd'.$cat_id),3,3,$cat_ord).'

'. '
'; $rsCat->moveNext(); } echo '

'. '
'. '
'. '

'. dcNonce::form(). ' '. '

'; if ($has_deletable) { echo '

'. ''. '

'; } echo '
'. '
'; } ?>