[5824] | 1 | <?php |
---|
| 2 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
| 3 | global $template, $conf, $user; |
---|
| 4 | include_once(PHPWG_ROOT_PATH .'admin/include/tabsheet.class.php'); |
---|
| 5 | load_language('plugin.lang', HIT_PATH); |
---|
| 6 | $my_base_url = get_admin_plugin_menu_link(__FILE__); |
---|
| 7 | |
---|
| 8 | // +-----------------------------------------------------------------------+ |
---|
| 9 | // | Check Access and exit when user status is not ok | |
---|
| 10 | // +-----------------------------------------------------------------------+ |
---|
| 11 | check_status(ACCESS_ADMINISTRATOR); |
---|
| 12 | |
---|
| 13 | //-------------------------------------------------------- sections definitions |
---|
| 14 | |
---|
| 15 | |
---|
| 16 | |
---|
| 17 | // Gestion des onglets |
---|
| 18 | if (!isset($_GET['tab'])) |
---|
| 19 | $page['tab'] = 'all'; |
---|
| 20 | else |
---|
| 21 | $page['tab'] = $_GET['tab']; |
---|
| 22 | |
---|
| 23 | $tabsheet = new tabsheet(); |
---|
| 24 | $tabsheet->add('all', |
---|
| 25 | l10n('hit_onglet_all'), |
---|
| 26 | $my_base_url.'&tab=all'); |
---|
| 27 | $tabsheet->add('photo', |
---|
| 28 | l10n('hit_onglet_photo'), |
---|
| 29 | $my_base_url.'&tab=photo'); |
---|
| 30 | $tabsheet->add('categorie', |
---|
| 31 | l10n('hit_onglet_categorie'), |
---|
| 32 | $my_base_url.'&tab=categorie'); |
---|
| 33 | |
---|
| 34 | $tabsheet->select($page['tab']); |
---|
| 35 | $tabsheet->assign(); |
---|
| 36 | |
---|
| 37 | // Onglet gestion par photo |
---|
| 38 | switch ($page['tab']) |
---|
| 39 | { |
---|
| 40 | case 'all': |
---|
| 41 | |
---|
| 42 | $template->assign( |
---|
| 43 | 'gestion', |
---|
| 44 | array( |
---|
| 45 | |
---|
| 46 | )); |
---|
| 47 | |
---|
| 48 | //purge photo |
---|
| 49 | if (isset($_POST['submitchoixall']) and !is_adviser()) |
---|
| 50 | { |
---|
| 51 | $query = ' |
---|
| 52 | UPDATE ' . IMAGES_TABLE . ' |
---|
| 53 | SET hit= \'0\' |
---|
| 54 | ;'; |
---|
| 55 | $result = pwg_query($query); |
---|
| 56 | |
---|
| 57 | } |
---|
| 58 | |
---|
| 59 | break; |
---|
| 60 | |
---|
| 61 | case 'photo': |
---|
| 62 | |
---|
| 63 | //charge la liste des photos |
---|
| 64 | $groups = array(); |
---|
| 65 | $query = ' |
---|
| 66 | select id,name |
---|
| 67 | FROM ' . IMAGES_TABLE . ' |
---|
| 68 | ORDER BY id ASC;'; |
---|
| 69 | $result = pwg_query($query); |
---|
| 70 | |
---|
| 71 | while ($row = mysql_fetch_array($result)) |
---|
| 72 | { |
---|
| 73 | $groups[$row['id']] = $row['id'].' : '.$row['name']; |
---|
| 74 | } |
---|
| 75 | |
---|
| 76 | $selected = 0; |
---|
| 77 | $options[] = l10n('hit_select_photo'); |
---|
| 78 | $options['a'] = '----------------------'; |
---|
| 79 | |
---|
| 80 | foreach($groups as $listid => $listid2) |
---|
| 81 | { |
---|
| 82 | $options[$listid] = $listid2; |
---|
| 83 | } |
---|
| 84 | $template->assign( |
---|
| 85 | 'gestionA', |
---|
| 86 | array( |
---|
| 87 | 'OPTIONS' => $options, |
---|
| 88 | 'SELECTED' => $selected |
---|
| 89 | )); |
---|
| 90 | |
---|
| 91 | //purge photo |
---|
| 92 | if (isset($_POST['submitchoixphoto']) and is_numeric($_POST['delhitphoto'])and (!$_POST['delhitphoto'])==0 and !is_adviser()) |
---|
| 93 | { |
---|
| 94 | $lire=$_POST['delhitphoto']; |
---|
| 95 | $query = ' |
---|
| 96 | UPDATE ' . IMAGES_TABLE . ' |
---|
| 97 | SET hit= \'0\' |
---|
| 98 | WHERE id = \''.$lire.'\' |
---|
| 99 | ;'; |
---|
| 100 | $result = pwg_query($query); |
---|
| 101 | |
---|
| 102 | } |
---|
| 103 | |
---|
| 104 | break; |
---|
| 105 | |
---|
| 106 | // Onglet gestion des meta categorie |
---|
| 107 | case 'categorie': |
---|
| 108 | |
---|
| 109 | //charge la liste des catégories |
---|
| 110 | $groups = array(); |
---|
| 111 | $query = ' |
---|
| 112 | select id,name |
---|
| 113 | FROM ' . CATEGORIES_TABLE . ' |
---|
| 114 | ORDER BY id ASC;'; |
---|
| 115 | $result = pwg_query($query); |
---|
| 116 | |
---|
| 117 | while ($row = mysql_fetch_array($result)) |
---|
| 118 | { |
---|
| 119 | $groups[$row['id']] = $row['id'].' : '.$row['name']; |
---|
| 120 | } |
---|
| 121 | |
---|
| 122 | $selected = 0; |
---|
| 123 | $options[] = l10n('hit_select_cat'); |
---|
| 124 | $options['a'] = '----------------------'; |
---|
| 125 | |
---|
| 126 | foreach($groups as $listid => $listid2) |
---|
| 127 | { |
---|
| 128 | $options[$listid] = $listid2; |
---|
| 129 | } |
---|
| 130 | $template->assign( |
---|
| 131 | 'gestionB', |
---|
| 132 | array( |
---|
| 133 | 'OPTIONS' => $options, |
---|
| 134 | 'SELECTED' => $selected |
---|
| 135 | )); |
---|
| 136 | |
---|
| 137 | |
---|
| 138 | //purge categorie |
---|
| 139 | if (isset($_POST['submitchoixcat']) and is_numeric($_POST['delhitcat'])and (!$_POST['delhitcat'])==0 and !is_adviser()) |
---|
| 140 | { |
---|
| 141 | $lire=$_POST['delhitcat']; |
---|
| 142 | $query = ' |
---|
| 143 | UPDATE ' . IMAGES_TABLE . ' |
---|
| 144 | SET hit= \'0\' |
---|
| 145 | WHERE storage_category_id = \''.$lire.'\' |
---|
| 146 | ;'; |
---|
| 147 | $result = pwg_query($query); |
---|
| 148 | |
---|
| 149 | } |
---|
| 150 | |
---|
| 151 | break; |
---|
| 152 | |
---|
| 153 | } |
---|
| 154 | |
---|
| 155 | $template->set_filenames(array('plugin_admin_content' => dirname(__FILE__) . '/admin.tpl')); |
---|
| 156 | $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content'); |
---|
| 157 | ?> |
---|