Changeset 3708 for extensions/piclens/admin/piclenswallconfig.php
- Timestamp:
- Jul 30, 2009, 10:58:32 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/piclens/admin/piclenswallconfig.php
r3645 r3708 13 13 14 14 $template->set_filenames( 15 array('plugin_admin_content' => PICLENS_ROOT.'/admin/piclenswallconfig.tpl' 15 array('plugin_admin_content' => PICLENS_ROOT.'/admin/piclenswallconfig.tpl', 16 'double_select' => 'double_select.tpl' 16 17 ) ); 17 18 19 20 21 // Switch on right side (=> ) 22 if ( isset($_POST['falsify']) and !is_adviser() 23 and $_POST['from']=='wallcat' 24 and isset($_POST['cat_true']) and count($_POST['cat_true']) > 0) 25 { 26 foreach ($_POST['cat_true'] as $cat) 27 unset($me->my_config['piclens_wall_categories'][array_search($cat,$me->my_config['piclens_wall_categories'])]); 28 29 $me->save_config(); 30 31 } 32 // Switch on left side ( <=) 33 if ( isset($_POST['trueify']) and !is_adviser() 34 and $_POST['from']=='wallcat' 35 and isset($_POST['cat_false']) and count($_POST['cat_false']) > 0) 36 { 37 38 $query = ' 39 SELECT id, name, uppercats, global_rank 40 FROM '.CATEGORIES_TABLE. 41 ' WHERE id IN ("'.implode('","', $_POST['cat_false']).'");'; 42 43 $result = pwg_query($query); 44 $categories = array(); 45 if (!empty($result)) 46 { 47 while ($row = mysql_fetch_assoc($result)) 48 array_push($categories, $row); 49 } 50 usort($categories, 'global_rank_compare'); 51 52 if (!empty($result)) 53 { 54 foreach ($categories as $cat) 55 { 56 array_push($me->my_config['piclens_wall_categories'], $cat['id']); 57 } 58 } 59 60 $me->save_config(); 61 } 18 62 19 63 … … 22 66 $me->my_config['piclens_wall_title'] = $_POST['piclens_wall_title']; 23 67 $me->my_config['piclens_wall_height'] = $_POST['piclens_wall_height']; 24 $me->my_config['piclens_wall_categories'] = isset($_POST['categories']) ?25 array_map("mysql_escape_string", $_POST['categories']) :26 array();27 68 28 69 $me->my_config['piclens_wall_nav'] = isset($_POST['piclens_wall_nav']); … … 68 109 FROM '.CATEGORIES_TABLE.';'; 69 110 70 display_select_cat_wrapper($query, 71 $me->my_config['piclens_wall_categories'], 72 'categories', 73 true); 74 75 display_select_cat_wrapper($query, 111 display_select_cat_wrapper($query, 76 112 $me->my_config['piclens_wall_cat_nav_replace'], 77 113 'categories_nav', 78 114 true); 79 115 80 116 117 // Test double select wall categories 118 // Categories non prises en compte 119 $query = ' 120 SELECT id, name, uppercats, global_rank 121 FROM '.CATEGORIES_TABLE. 122 ' WHERE id not IN ("'.implode('","', $me->my_config['piclens_wall_categories']).'");'; 123 124 $result = pwg_query($query); 125 $categories = array(); 126 if (!empty($result)) 127 { 128 while ($row = mysql_fetch_assoc($result)) 129 array_push($categories, $row); 130 } 131 usort($categories, 'global_rank_compare'); 132 133 $tpl = array(); 134 if (!empty($result)) 135 { 136 foreach ($categories as $cat) 137 { 138 $tpl[$cat['id']] = get_cat_display_name_cache($cat['uppercats'], 139 null, 140 false); 141 142 } 143 } 144 $template->assign( 'category_option_false', $tpl); 145 $template->assign( 'category_option_false_selected', array()); 146 147 148 149 150 // Categories prises en compte 151 152 $query = ' 153 SELECT id, name, uppercats, global_rank 154 FROM '.CATEGORIES_TABLE. 155 ' WHERE id IN ("'.implode('","', $me->my_config['piclens_wall_categories']).'");'; 156 157 $result = pwg_query($query); 158 $categories = array(); 159 if (!empty($result)) 160 { 161 while ($row = mysql_fetch_assoc($result)) 162 array_push($categories, $row); 163 } 164 usort($categories, 'global_rank_compare'); 165 $tpl2 = array(); 166 if (!empty($result)) 167 { 168 foreach ($categories as $cat) 169 { 170 $tpl2[$cat['id']] = get_cat_display_name_cache($cat['uppercats'], 171 null, 172 false); 173 174 } 175 } 176 $template->assign( 'category_option_true', $tpl2); 177 $template->assign( 'category_option_true_selected', array()); 178 179 180 $template->assign(Array( 181 'F_ACTION' => '', 182 'L_CAT_OPTIONS_TRUE' => l10n('SelectedCat'), 183 'L_CAT_OPTIONS_FALSE' => l10n('NonSelectedCat'), 184 )); 81 185 82 186 … … 104 208 )); 105 209 210 $template->assign_var_from_handle('DOUBLE_SELECT', 'double_select'); 106 211 $template->assign_var_from_handle( 'ADMIN_CONTENT', 'plugin_admin_content'); 107 212
Note: See TracChangeset
for help on using the changeset viewer.