add('IDS', l10n('ids_tab1'), $my_base_url.'&tab=IDS'); $tabsheet->select($page['tab']); $tabsheet->assign(); switch ($page['tab']) { // tab switch case 'IDS': $groups = array(); $query = ' select id,name FROM ' . IMAGES_TABLE . ' ORDER BY id ASC;'; $result = pwg_query($query); while ($row = mysql_fetch_array($result)) { $groups[$row['id']] = $row['id'].' : '.$row['name']; } $selected = 0; $options[] = l10n('ids_select'); $options['a'] = '----------------------'; foreach($groups as $listid => $listid2) { $options[$listid] = $listid2; } $template->assign( 'gestion', array( 'OPTIONS' => $options, 'SELECTED' => $selected )); //action if (isset($_POST['IDS'])and is_numeric($_POST['IDS1']) and (!$_POST['IDS1'])==0 and is_numeric($_POST['IDS2']) and (!$_POST['IDS2'])==0) { $query = ' select id FROM ' . IMAGES_TABLE . ' ORDER BY id DESC;'; $result = pwg_query($query); $row = mysql_fetch_array($result); $tempoids=$row['id']+1000; $query = ' UPDATE ' . IMAGES_TABLE . ' SET id= \''.$tempoids.'\' WHERE id = \''.$_POST['IDS1'].'\' ;'; $result = pwg_query($query); $query = ' UPDATE ' . IMAGES_TABLE . ' SET id= \''.$_POST['IDS1'].'\' WHERE id = \''.$_POST['IDS2'].'\' ;'; $result = pwg_query($query); $query = ' UPDATE ' . IMAGES_TABLE . ' SET id= \''.$_POST['IDS2'].'\' WHERE id = \''.$tempoids.'\' ;'; $result = pwg_query($query); $groups = array(); $query = ' select id,name FROM ' . IMAGES_TABLE . ' ORDER BY id ASC;'; $result = pwg_query($query); while ($row = mysql_fetch_array($result)) { $groups[$row['id']] = $row['id'].' : '.$row['name']; } $selected = 0; $options[] = l10n('ids_select'); $options['a'] = '----------------------'; foreach($groups as $listid => $listid2) { $options[$listid] = $listid2; } $template->assign( 'gestion', array( 'OPTIONS' => $options, 'SELECTED' => $selected )); array_push( $page['infos'], l10n('ids_ok') ); } break; } $template->set_filenames(array('plugin_admin_content' => dirname(__FILE__) . '/admin.tpl')); $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content'); ?>