set_filenames( array('plugin_admin_content' => ECARD_ROOT.'/admin/template/admin_manage.tpl', 'double_select' => 'double_select.tpl' ) ); // Switch on right side (=> ) if ( isset($_POST['falsify']) and !is_adviser() and isset($_POST['cat_true']) and count($_POST['cat_true']) > 0) { foreach ($_POST['cat_true'] as $cat) unset($me->my_config['cats'][array_search($cat,$me->my_config['cats'])]); $me->save_config(); } // Switch on left side ( <=) if ( isset($_POST['trueify']) and !is_adviser() and isset($_POST['cat_false']) and count($_POST['cat_false']) > 0) { $query = ' SELECT id, name, uppercats, global_rank FROM '.CATEGORIES_TABLE. ' WHERE id IN ("'.implode('","', $_POST['cat_false']).'");'; $result = pwg_query($query); $categories = array(); if (!empty($result)) { while ($row = mysql_fetch_assoc($result)) array_push($categories, $row); } usort($categories, 'global_rank_compare'); if (!empty($result)) { foreach ($categories as $cat) { array_push($me->my_config['cats'], $cat['id']); } } $me->save_config(); } if (isset($_POST['submit'])) { $me->my_config['allcats'] = isset($_POST['allcats']); $me->my_config['user_cat'] = isset($_POST['user_cat']); $me->my_config['recursive'] = isset($_POST['recursiv']); $me->my_config['groups'] = isset($_POST['groups']) ? array_map("mysql_escape_string", $_POST['groups']) : array(); $me->save_config(); array_push($page['infos'], l10n('ecard_admin_saveOK')); } // Groups selection $groups = get_all_groups(); if (!empty($groups)) { $template->assign('group_perm', array('GROUPSELECTION' => get_html_groups_selection($groups, 'groups', (isset($me->my_config['groups']) ? $me->my_config['groups'] : array())))); } // Test double select wall categories // Categories non prises en compte $query = ' SELECT id, name, uppercats, global_rank FROM '.CATEGORIES_TABLE. ' WHERE id not IN ("'.implode('","', $me->my_config['cats']).'");'; $result = pwg_query($query); $categories = array(); if (!empty($result)) { while ($row = mysql_fetch_assoc($result)) array_push($categories, $row); } usort($categories, 'global_rank_compare'); $tpl = array(); if (!empty($result)) { foreach ($categories as $cat) { $tpl[$cat['id']] = get_cat_display_name_cache($cat['uppercats'], null, false); } } $template->assign( 'category_option_false', $tpl); $template->assign( 'category_option_false_selected', array()); // Categories prises en compte $query = ' SELECT id, name, uppercats, global_rank FROM '.CATEGORIES_TABLE. ' WHERE id IN ("'.implode('","', $me->my_config['cats']).'");'; $result = pwg_query($query); $categories = array(); if (!empty($result)) { while ($row = mysql_fetch_assoc($result)) array_push($categories, $row); } usort($categories, 'global_rank_compare'); $tpl2 = array(); if (!empty($result)) { foreach ($categories as $cat) { $tpl2[$cat['id']] = get_cat_display_name_cache($cat['uppercats'], null, false); } } $template->assign( 'category_option_true', $tpl2); $template->assign( 'category_option_true_selected', array()); $template->assign('ECARD_ALLCATS', ($me->my_config['allcats'] ? 'checked="checked"' : '')); $template->assign('ECARD_USERCAT', ($me->my_config['user_cat'] ? 'checked="checked"' : '')); $template->assign('ECARD_RECURSIV', ($me->my_config['recursive'] ? 'checked="checked"' : '')); $template->assign(Array( 'F_ACTION' => '', 'L_CAT_OPTIONS_TRUE' => l10n('SelectedCat'), 'L_CAT_OPTIONS_FALSE' => l10n('NonSelectedCat'), )); $template->assign_var_from_handle('DOUBLE_SELECT', 'double_select'); $template->assign_var_from_handle( 'ADMIN_CONTENT', 'plugin_admin_content'); function get_html_groups_selection( $groups, $fieldname, $selecteds = array() ) { global $conf; if (count ($groups) == 0 ) { return ''; } $output = '