<?php
/*
Copyright (C) 2008 by oscim   Project lossim  [ 15.09.2009, 09:17:59] @oscim
// kate: replace-trailing-space-save true; space-indent on; indent-width 2; mixedindent off; indent-mode cstyle; word-wrap-marker-color #41C2A4
ENCODE UTF-8
*/
/**
  Tableau de bord
*/
  error_reporting(E_ALL);

//! ACTION
 $action=(isset($post['action']) ) ?$post['action'] : 'list';


  $p="<p>%1\$s</p>";
  $link_retour='<a  class="button exe" href="'._FILENAME_RUBRIQUES.'" alt="'.RETOUR.'" onclick=" montre(\'onload\');" >'.RETOUR.'</a>';
  $link_add_rub='<a  class="button exe" href="'._FILENAME_RUBRIQUES.'?action=add"  >'.ADD_RUB.'</a>';
  //! obj
    $cstr->_add_class('db_rubrique',_BO_CLASS .'class.db_rubrique.php');
    $cstr->_add_class('view_rub',_BO_CLASS .'class.view_rub.php');


 switch($action){
  case 'up':
    $cstr->_call('view_rub','prepa_cat',$post);
    redirect(_FILENAME_RUBRIQUES);
  break;

  case 'add':
    $array[]['text']=$cstr->_call('view_rub','draw_form_edit','','add');

    $array_right[]['text']='<p style="text-align:center"><a class="button exe" href="'._FILENAME_RUBRIQUES.'">'.HISTORY_BACK.'</a></p>';
  break;
  case 'edit':
    $array[]['text']=$cstr->_call('view_rub','draw_form_edit',$post['cat']);

    $array_right[]['text']='<p style="text-align:center"><a class="button exe" href="'._FILENAME_RUBRIQUES.'">'.HISTORY_BACK.'</a></p>';
  break;
  case 'del':
    $cstr->_call('view_rub','del_cat', $post['cat']);
    redirect(_FILENAME_RUBRIQUES);
  break;

  default:
    $array[]['text']=$cstr->_call('view_rub','draw_list');
//     $cstr->_call('db_rubrique','debugg');
//     $cstr->_call('view_rub','debugg');

    $array_right[]['text']='<h3>'.ADD_RUB.'</h3>';
    $array_right[]['text']='<p style="text-align:center">'.$link_add_rub.'</p>';
 }

 /**
  Colonne droite
 */
  if (isset($_GET['conf'])){
    switch($_GET['conf']){

      case 'menu':
        if ($_GET['mode']=='add') $array[]['text']=  NewFct('add_menu_primaire',$_POST['menu_key'],$_POST,TBL_MODULE_MENU_INC).$link_retour;
        elseif ($_GET['mode']=='mod') $array[]['text']=  NewFct('edit_entree_menu',$_POST['menu_key'],TBL_MODULE_MENU_INC,_FILENAME_RUBRIQUES,"conf=menu&amp;mode=up").$link_retour;
        elseif ($_GET['mode']=='desa') {
                if (isset($_GET['confirm'])) $array[]['text']=  NewFct('on_off_entree_menu',$_POST['menu_key'],'false',TBL_MODULE_MENU_INC).$link_retour;
                else tep_page_confirm('rubriques.php','conf=menu&amp;mode=desa&amp;confirm=supp',CONFIRM_DESACTIV_MENU,$_POST,'');
        }
        elseif ($_GET['mode']=='activ') {
                if (isset($_GET['confirm'])) print NewFct('on_off_entree_menu',$_POST['menu_key'],'true',TBL_MODULE_MENU_INC).$link_retour;
                else tep_page_confirm('rubriques.php','conf=menu&amp;mode=activ&amp;confirm=supp',CONFIRM_ACTIV_MENU,$_POST,'');
        }
        elseif ($_GET['mode']=='up') {
                if (tep_not_null($_POST['menu_key'])) print  NewFct('up_entree_menu',$_POST['menu_key'],$_POST,TBL_MODULE_MENU_INC);
                $array[]['text']=  $link_retour;
        }elseif ($_GET['mode']=='supp')print supp_menu_primaire($_POST['rubrique']).$link_retour;

      break;
    }
  }

  array_push($js_lib, "add_click_onload"); array_push($function_js_init, "add_click_onload('menu','');");





?>