Ignore:
Timestamp:
Oct 15, 2009, 10:51:07 PM (15 years ago)
Author:
LucMorizur
Message:

[Event Cats] Mainly add header & footer, add choose new/old code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/event_cats/admin/autolog_new.inc.php

    r4027 r4048  
    5757
    5858$ec_lists['duplicable_codes'] = array();
     59$t = array();
    5960
    6061foreach ($ec_lists['ec_table'] as $ec_entry) {
     
    6465    $ec_entry['forced'] == 'false'
    6566  ) {
    66     $ec_lists['duplicable_codes'][$ec_entry['code']] = $ec_entry['user_id'];
     67    $t[$ec_entry['id']] = $ec_entry['code'];
     68    $ec_lists['duplicable_codes'][$ec_entry['code']]['id'] =
     69     $ec_entry['id'];
     70    $ec_lists['duplicable_codes'][$ec_entry['code']]['user_id'] =
     71     $ec_entry['user_id'];
    6772  }
     73}
     74foreach ($t as $ec_id => $ec_code) {
     75  $ec_lists['duplicable_codes']['ids'][$ec_id] =
     76   $ec_lists['duplicable_codes'][$ec_code]['id'];
    6877}
    6978
    7079$ec_def_vals = array();
    7180
    72 $ec_def_vals['code'] = '';
    73 $ec_def_vals['user'] = '-1';
    74 $ec_def_vals['act1'] = 'create';
    75 $ec_def_vals['auto_code_dg_nb'] = read_ec_conf('auto_code_dg_nb');
     81$ec_default_action = 'create';
     82$ec_def_auto_code_dg_nb = read_ec_conf('auto_code_dg_nb');
    7683
    7784/*****************************************************************************
     
    8188if (isset($_POST['ec_act1']) and $_POST['ec_act1'] == 'duplicate_entry') {
    8289  if (isset($_POST['ec_entry_sel'])) {
    83     if (array_key_exists($_POST['ec_entry_sel'], $ec_lists['ec_table'])) {
    84       $ec_def_vals['code'] = $ec_lists['ec_table'][$_POST['ec_entry_sel']]['code'];
    85       $ec_def_vals['user'] = $ec_lists['ec_table'][$_POST['ec_entry_sel']]['user_id'];
    86       $ec_def_vals['act1'] = $_POST['ec_entry_sel'];
    87     }
    88     else {
    89       $page['errors'][] = 'Tentative de duplication d\'une entrée inexistante';
    90     }
     90    if (array_key_exists($_POST['ec_entry_sel'], $ec_lists['ec_table']))
     91     $ec_default_action = $_POST['ec_entry_sel'];
     92    else
     93     $page['errors'][] = 'Tentative de duplication d\'une entrée inexistante';
    9194  }
    9295  else {
     
    9598}
    9699
    97 
    98100/****************************************************************************/
    99 
    100101
    101102$template->assign('ec_ap_ok',$ec_ap_ok);
    102103$template->assign('ec_lists',$ec_lists);
    103 $template->assign('ec_def_vals',$ec_def_vals);
     104$template->assign('ec_hidden_when_no_code',
     105  (count($ec_lists['duplicable_codes']) == 0) ? 'style = "display:none;"' : ''
     106);
     107$template->assign('ec_hidden_when_no_user',
     108  (count($ec_lists['user_ids']) == 0) ? 'style = "display:none;"' : ''
     109);
     110$template->assign('ec_default_action',$ec_default_action);
     111$template->assign('ec_def_auto_code_dg_nb',$ec_def_auto_code_dg_nb);
    104112
    105113?>
Note: See TracChangeset for help on using the changeset viewer.