Changeset 31542 for extensions/user_custom_fields/admin.php
- Timestamp:
- Apr 9, 2016, 7:33:07 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/user_custom_fields/admin.php
r31541 r31542 38 38 $tabsheet = new tabsheet(); 39 39 $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 } 40 43 $tabsheet->select($page['tab']); 41 44 $tabsheet->assign(); … … 46 49 $template->assign( 47 50 'addinfotemplate', array( 48 ' addinfo' => l10n('addinfo'),51 'toto' => l10n('toto'), 49 52 )); 50 53 … … 89 92 }else{ 90 93 $items['UCFWORDING'] = trigger_change('AP_render_content',$user_custom_fields['wording']); 94 $items['UCFWORDING2'] = $user_custom_fields['wording']; 91 95 $items['UCFOBLO'] = 1; 92 96 } … … 107 111 mass_updates(UCF_TABLE, $fields, $data); 108 112 109 $page['infos'][] = l10n(' Properties manual order was saved');113 $page['infos'][] = l10n('Custom fields manual order was saved'); 110 114 redirect($admin_base_url); 111 115 } … … 199 203 pwg_query($query); 200 204 } 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; 202 263 } 203 264
Note: See TracChangeset
for help on using the changeset viewer.