[7646] | 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', ADDINFO_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 | // Gestion des onglets |
---|
| 16 | if (!isset($_GET['tab'])) |
---|
| 17 | $page['tab'] = 'addinfo'; |
---|
| 18 | else |
---|
| 19 | $page['tab'] = $_GET['tab']; |
---|
| 20 | |
---|
| 21 | $tabsheet = new tabsheet(); |
---|
| 22 | $tabsheet->add('addinfo', |
---|
| 23 | l10n('addinfo_ajout'), |
---|
| 24 | $my_base_url.'&tab=addinfo'); |
---|
| 25 | $tabsheet->add('explication', |
---|
[7969] | 26 | l10n('addinfo_explication'), |
---|
[7646] | 27 | $my_base_url.'&tab=explication'); |
---|
| 28 | $tabsheet->select($page['tab']); |
---|
| 29 | $tabsheet->assign(); |
---|
| 30 | |
---|
| 31 | switch ($page['tab']) |
---|
| 32 | { |
---|
| 33 | // Onglet gestion de onglet addinfo |
---|
| 34 | case 'addinfo': |
---|
| 35 | |
---|
| 36 | //charge la liste des images |
---|
| 37 | $groups = array(); |
---|
| 38 | $query = ' |
---|
| 39 | select id,name |
---|
| 40 | FROM ' . IMAGES_TABLE . ' |
---|
| 41 | ORDER BY id ASC;'; |
---|
| 42 | $result = pwg_query($query); |
---|
| 43 | |
---|
| 44 | while ($row = mysql_fetch_array($result)) |
---|
| 45 | { |
---|
| 46 | $groups[$row['id']] = $row['id'].' : '.$row['name']; |
---|
| 47 | } |
---|
| 48 | |
---|
| 49 | $selected = 0; |
---|
| 50 | $options[] = l10n('addinfo_selecti3'); |
---|
| 51 | $options['a'] = '----------------------'; |
---|
| 52 | |
---|
| 53 | foreach($groups as $listid => $listid2) |
---|
| 54 | { |
---|
| 55 | $options[$listid] = $listid2; |
---|
| 56 | } |
---|
| 57 | $template->assign( |
---|
| 58 | 'addinfoo1', |
---|
| 59 | array( |
---|
| 60 | 'OPTIONS' => $options, |
---|
| 61 | 'SELECTED' => $selected |
---|
| 62 | )); |
---|
| 63 | |
---|
| 64 | //edit des imfos complèmentaire de l'image |
---|
| 65 | if (isset($_POST['submitchoiximg'])and is_numeric($_POST['addinfoimg']) and (!$_POST['addinfoimg'])==0 and !is_adviser()) |
---|
| 66 | { |
---|
| 67 | $lire=$_POST['addinfoimg']; |
---|
| 68 | $query = ' |
---|
| 69 | select id,name,path |
---|
| 70 | FROM ' . IMAGES_TABLE . ' |
---|
| 71 | WHERE id = \''.$lire.'\' |
---|
| 72 | ;'; |
---|
| 73 | $result = pwg_query($query); |
---|
| 74 | |
---|
| 75 | $row = mysql_fetch_array($result); |
---|
| 76 | $idimg=$row['id']; |
---|
| 77 | $chnameimg=$row['name']; |
---|
| 78 | $rootimg=$row['path']; |
---|
| 79 | |
---|
| 80 | $query = ' |
---|
| 81 | select id,info1,info2,info3 |
---|
| 82 | FROM ' . ADDINFO_TABLE . ' |
---|
| 83 | WHERE id = \''.$lire.'\' |
---|
| 84 | ;'; |
---|
| 85 | $result = pwg_query($query); |
---|
| 86 | $row = mysql_fetch_array($result); |
---|
| 87 | $idaddinfo=$row['id']; |
---|
| 88 | $info1=$row['info1']; |
---|
| 89 | $info2=$row['info2']; |
---|
| 90 | $info3=$row['info3']; |
---|
| 91 | |
---|
| 92 | $selected3 = 0; |
---|
| 93 | |
---|
| 94 | $template->assign( |
---|
| 95 | 'img_edit', |
---|
| 96 | array( |
---|
| 97 | 'RIMG' => $rootimg, |
---|
| 98 | 'VALUE' => $idimg, |
---|
| 99 | 'VALUEN' => $chnameimg, |
---|
[9260] | 100 | 'CONTENT' => htmlspecialchars($info1), |
---|
| 101 | 'CONTENT2' => htmlspecialchars($info2), |
---|
| 102 | 'CONTENT3' => htmlspecialchars($info3), |
---|
[7646] | 103 | 'SELECTED' => $selected3 |
---|
| 104 | )); |
---|
| 105 | } |
---|
| 106 | |
---|
| 107 | //insértion les information dans la table addinfo_picture |
---|
[9259] | 108 | if (isset($_POST['submitinsimgA']) and !is_adviser()) |
---|
[7646] | 109 | { |
---|
| 110 | $query = ' |
---|
| 111 | DELETE |
---|
| 112 | FROM ' . ADDINFO_TABLE . ' |
---|
| 113 | WHERE id = \''.$_POST['invisible'].'\' |
---|
| 114 | ;'; |
---|
| 115 | $result = pwg_query($query); |
---|
| 116 | $q = ' |
---|
| 117 | INSERT INTO ' . $prefixeTable . 'AddInfo_images(id,info1,info2,info3)VALUES ('.$_POST['invisible'].',"'.$_POST['inser'].'","'.$_POST['inser2'].'","'.$_POST['inser3'].'");'; |
---|
| 118 | pwg_query($q); |
---|
| 119 | } |
---|
| 120 | |
---|
| 121 | break; |
---|
| 122 | |
---|
| 123 | // Onglet en attente |
---|
| 124 | case 'explication': |
---|
| 125 | $explication = 'explication'; |
---|
| 126 | $template->assign( |
---|
| 127 | $explication, |
---|
| 128 | array( |
---|
| 129 | 'meta'=>l10n('meta_name'), |
---|
| 130 | )); |
---|
| 131 | |
---|
| 132 | break; |
---|
| 133 | |
---|
| 134 | } |
---|
| 135 | |
---|
| 136 | $template->set_filenames(array('plugin_admin_content' => dirname(__FILE__) . '/admin.tpl')); |
---|
| 137 | $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content'); |
---|
| 138 | ?> |
---|