Ignore:
Timestamp:
Dec 31, 2010, 4:06:36 PM (10 years ago)
Author:
plg
Message:

feature 2089: Batch Manager, switch from global to unit mode with tabs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/batch_manager.php

    r8408 r8413  
    3434
    3535include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
     36include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php');
    3637
    3738// +-----------------------------------------------------------------------+
     
    269270
    270271// +-----------------------------------------------------------------------+
     272// |                                 Tabs                                  |
     273// +-----------------------------------------------------------------------+
     274
     275$tabs = array(
     276  array(
     277    'code' => 'global',
     278    'label' => l10n('global mode'),
     279    ),
     280  array(
     281    'code' => 'unit',
     282    'label' => l10n('unit mode'),
     283    ),
     284  );
     285
     286$tab_codes = array_map(
     287  create_function('$a', 'return $a["code"];'),
     288  $tabs
     289  );
     290
     291if (isset($_GET['mode']) and in_array($_GET['mode'], $tab_codes))
     292{
     293  $page['tab'] = $_GET['mode'];
     294}
     295else
     296{
     297  $page['tab'] = $tabs[0]['code'];
     298}
     299
     300$tabsheet = new tabsheet();
     301foreach ($tabs as $tab)
     302{
     303  $tabsheet->add(
     304    $tab['code'],
     305    $tab['label'],
     306    get_root_url().'admin.php?page='.$_GET['page'].'&mode='.$tab['code']
     307    );
     308}
     309$tabsheet->select($page['tab']);
     310$tabsheet->assign();
     311
     312// +-----------------------------------------------------------------------+
    271313// |                         open specific mode                            |
    272314// +-----------------------------------------------------------------------+
    273315
    274 $_GET['mode'] = !empty($_GET['mode']) ? $_GET['mode'] : 'global';
    275 
    276 switch ($_GET['mode'])
    277 {
    278   case 'global' :
    279   {
    280     include(dirname(__FILE__).'/batch_manager_global.php');
    281     break;
    282   }
    283   case 'unit' :
    284   {
    285     include(PHPWG_ROOT_PATH.'admin/element_set_unit.php');
    286     break;
    287   }
    288 }
     316include(PHPWG_ROOT_PATH.'admin/batch_manager_'.$page['tab'].'.php');
    289317?>
Note: See TracChangeset for help on using the changeset viewer.