Ignore:
Timestamp:
Apr 9, 2016, 7:33:07 PM (8 years ago)
Author:
ddtddt
Message:

[extensions] - user_custom_fields - admin gest dee update data

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/user_custom_fields/admin.php

    r31541 r31542  
    3838  $tabsheet = new tabsheet();
    3939  $tabsheet->add('ucf', l10n('User custom fields'), UCF_ADMIN . '-define_custom');
     40  if (isset($_GET['ucfiduser'])) {
     41    $tabsheet->add('edit_user', l10n('User').' '.$_GET['ucfusername'], UCF_ADMIN . '-edit_user');
     42  }
    4043  $tabsheet->select($page['tab']);
    4144  $tabsheet->assign();
     
    4649        $template->assign(
    4750                'addinfotemplate', array(
    48                 'addinfo' => l10n('addinfo'),
     51                'toto' => l10n('toto'),
    4952        ));
    5053       
     
    8992                }else{
    9093                                    $items['UCFWORDING'] = trigger_change('AP_render_content',$user_custom_fields['wording']);
     94                                        $items['UCFWORDING2'] = $user_custom_fields['wording'];
    9195                                        $items['UCFOBLO'] = 1;
    9296                }       
     
    107111            mass_updates(UCF_TABLE, $fields, $data);
    108112
    109           $page['infos'][] = l10n('Properties manual order was saved');
     113          $page['infos'][] = l10n('Custom fields manual order was saved');
    110114          redirect($admin_base_url);
    111115        }
     
    199203            pwg_query($query);
    200204                }
    201         break;
     205  break;
     206  case 'edit_user':
     207    if (isset($_GET['ucfiduser']) and isset($_GET['ucfusername'])) {
     208      check_input_parameter('ucfiduser', $_GET, false, PATTERN_ID);
     209          $PAED = pwg_db_fetch_assoc(pwg_query("SELECT state FROM " . PLUGINS_TABLE . " WHERE id = 'ExtendedDescription';"));
     210                if($PAED['state'] == 'active'){
     211                  add_event_handler('AP_render_content', 'get_user_language_desc');
     212                  $template->assign('useED',1);
     213                }else{
     214                  $template->assign('useED',0);
     215                }
     216          $template->assign(
     217                'editusertemplate', array(
     218                'toto' => l10n('toto'),
     219          ));
     220          $tab_user_custom_fields_adminlist=tab_user_custom_fields_adminlist();
     221      $template->assign('UCF_USERNAME',$_GET['ucfusername']);
     222          $template->assign('UCF_USERID',$_GET['ucfiduser']);
     223          while ($info_users = pwg_db_fetch_assoc($tab_user_custom_fields_adminlist)) {
     224               
     225                $d=data_info_user($_GET['ucfiduser'],$info_users['id_ucf']);
     226                $row = pwg_db_fetch_assoc($d);
     227                $items = array(
     228                        'UCFID' => $info_users['id_ucf'],
     229                        'UCFWORDING' => trigger_change('AP_render_content', $info_users['wording']),
     230                        'UCFOBLIGATORY' => $info_users['obligatory'],
     231                        'UCFADMINONLY' => $info_users['adminonly'],
     232                        'UCFDATA' => $row['data'],
     233                );
     234                $template->append('tab_user_custom_fields_adminlist', $items);
     235          }
     236    }else{
     237        redirect(UCF_ADMIN . '-define_custom');
     238        }
     239       
     240  if (isset($_POST['submitUCFa'])) {
     241   foreach ($_POST['data'] AS $id_ucf => $data) {
     242        $q = 'SELECT 1 FROM ' . UCFD_TABLE . ' WHERE id_user=' . $_POST['invisibleUSERID'] . ' AND id_ucf=' . $id_ucf;
     243        $test = pwg_query($q);
     244        $row = pwg_db_fetch_assoc($test);
     245        if (count($row) > 0){
     246          if ($data != ''){
     247                $query = 'UPDATE ' . UCFD_TABLE . ' SET data="' . $data . '" WHERE id_user=' . $_POST['invisibleUSERID'] . ' AND id_ucf=' . $id_ucf;
     248                pwg_query($query);
     249          }else{
     250                $query = 'DELETE FROM ' . UCFD_TABLE . ' WHERE id_user=' . $_POST['invisibleUSERID'] . ' AND id_ucf=' . $id_ucf;
     251                pwg_query($query);
     252          }
     253        }else if ($data != ''){
     254                $query = 'INSERT ' . UCFD_TABLE . '(id_user,id_ucf,data) VALUES (' . $_POST['invisibleUSERID'] . ',' . $id_ucf . ',"' . $data . '");';
     255                pwg_query($query);
     256        }
     257   }
     258  $_SESSION['page_infos'] = array(l10n('Data custom fields update'));
     259  redirect(get_root_url().'admin.php?page=user_list');
     260  }
     261       
     262  break;
    202263 }
    203264
Note: See TracChangeset for help on using the changeset viewer.