Changeset 19968 for extensions/Piwecard/admin
- Timestamp:
- Jan 8, 2013, 12:32:56 AM (12 years ago)
- Location:
- extensions/Piwecard/admin
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/Piwecard/admin/admin_consult.php
r19956 r19968 36 36 $result = pwg_query($query); 37 37 38 while($file = mysql_fetch_assoc($result)) {38 while($file = pwg_db_fetch_assoc($result)) { 39 39 $ecard_url = embellish_url(get_absolute_root_url() . './index.php?/ecard/'.$file['id']); 40 40 -
extensions/Piwecard/admin/admin_manage.php
r19956 r19968 4 4 global $template, $page; 5 5 6 $ me= get_plugin_data($plugin_id);6 $piwecard = get_plugin_data($plugin_id); 7 7 8 $template->set_filenames( 9 array('plugin_admin_content'=> ECARD_ROOT.'/admin/template/admin_manage.tpl',10 'double_select'=> 'double_select.tpl'11 ));8 $template->set_filenames(array( 9 'plugin_admin_content' => ECARD_ROOT.'/admin/template/admin_manage.tpl', 10 'double_select' => 'double_select.tpl' 11 )); 12 12 13 // Switch on right side (=>) 14 if (isset($_POST['falsify']) and isset($_POST['cat_true']) and count($_POST['cat_true']) > 0) { 15 foreach ($_POST['cat_true'] as $cat) 16 unset($piwecard->my_config['cats'][array_search($cat, $piwecard->my_config['cats'])]); 17 $piwecard->save_config(); 18 } 13 19 14 15 16 // Switch on right side (=> ) 17 if ( isset($_POST['falsify']) and !is_adviser() 18 and isset($_POST['cat_true']) and count($_POST['cat_true']) > 0) 19 { 20 foreach ($_POST['cat_true'] as $cat) 21 unset($me->my_config['cats'][array_search($cat,$me->my_config['cats'])]); 22 23 $me->save_config(); 24 25 } 26 // Switch on left side ( <=) 27 if ( isset($_POST['trueify']) and !is_adviser() 28 and isset($_POST['cat_false']) and count($_POST['cat_false']) > 0) 29 { 30 31 $query = ' 32 SELECT id, name, uppercats, global_rank 33 FROM '.CATEGORIES_TABLE. 34 ' WHERE id IN ("'.implode('","', $_POST['cat_false']).'");'; 35 20 // Switch on left side (<=) 21 if (isset($_POST['trueify']) and isset($_POST['cat_false']) and count($_POST['cat_false']) > 0) { 22 $query = 'SELECT id, name, uppercats, global_rank FROM '.CATEGORIES_TABLE.' WHERE id IN ("'.implode('","', $_POST['cat_false']).'");'; 36 23 $result = pwg_query($query); 37 24 $categories = array(); 38 if (!empty($result)) 39 {40 while ($row = mysql_fetch_assoc($result))25 26 if (!empty($result)) { 27 while ($row = pwg_db_fetch_assoc($result)) 41 28 array_push($categories, $row); 42 29 } 43 30 usort($categories, 'global_rank_compare'); 44 31 45 if (!empty($result)) 46 { 47 foreach ($categories as $cat) 48 { 49 array_push($me->my_config['cats'], $cat['id']); 32 if (!empty($result)) { 33 foreach ($categories as $cat) { 34 array_push($piwecard->my_config['cats'], $cat['id']); 50 35 } 51 36 } 52 53 $me->save_config(); 37 $piwecard->save_config(); 54 38 } 55 56 39 57 40 if (isset($_POST['submit'])) { 58 59 $me->my_config['allcats'] = isset($_POST['allcats']); 60 $me->my_config['user_cat'] = isset($_POST['user_cat']); 61 $me->my_config['recursive'] = isset($_POST['recursiv']); 62 $me->my_config['groups'] = isset($_POST['groups']) ? 63 array_map("mysql_escape_string", $_POST['groups']) : 64 array(); 65 66 $me->save_config(); 41 $piwecard->my_config['allcats'] = isset($_POST['allcats']); 42 $piwecard->my_config['user_cat'] = isset($_POST['user_cat']); 43 $piwecard->my_config['recursive'] = isset($_POST['recursiv']); 44 if ($piwecard->my_config['groups'] = isset($_POST['groups'])) 45 array_map("mysql_escape_string", $_POST['groups']); 46 else 47 array(); 48 $piwecard->save_config(); 67 49 array_push($page['infos'], l10n('ecard_admin_saveOK')); 68 69 50 } 70 71 72 51 73 52 // Groups selection 74 53 $groups = get_all_groups(); 75 if (!empty($groups)) 76 { 77 $template->assign('group_perm', array('GROUPSELECTION' => get_html_groups_selection($groups, 'groups', (isset($me->my_config['groups']) ? $me->my_config['groups'] : array())))); 78 54 if (!empty($groups)) { 55 $template->assign('group_perm', array('GROUPSELECTION' => get_html_groups_selection($groups, 'groups', (isset($piwecard->my_config['groups']) ? $piwecard->my_config['groups'] : array())))); 79 56 } 80 81 82 57 83 58 // Test double select wall categories 84 59 // Categories non prises en compte 85 $query = ' 86 SELECT id, name, uppercats, global_rank 87 FROM '.CATEGORIES_TABLE. 88 ' WHERE id not IN ("'.implode('","', $me->my_config['cats']).'");'; 89 90 $result = pwg_query($query); 91 $categories = array(); 92 if (!empty($result)) 93 { 94 while ($row = mysql_fetch_assoc($result)) 60 $query = 'SELECT id, name, uppercats, global_rank FROM '.CATEGORIES_TABLE.' WHERE id not IN ("'.implode('","', $piwecard->my_config['cats']).'");'; 61 $result = pwg_query($query); 62 $categories = array(); 63 if (!empty($result)) { 64 while ($row = pwg_db_fetch_assoc($result)) 95 65 array_push($categories, $row); 96 66 } … … 98 68 99 69 $tpl = array(); 100 if (!empty($result)) 101 { 102 foreach ($categories as $cat) 103 { 104 $tpl[$cat['id']] = get_cat_display_name_cache($cat['uppercats'], 105 null, 106 false); 107 70 if (!empty($result)) { 71 foreach ($categories as $cat) { 72 $tpl[$cat['id']] = get_cat_display_name_cache($cat['uppercats'], null, false); 108 73 } 109 74 } … … 111 76 $template->assign( 'category_option_false_selected', array()); 112 77 113 114 115 116 78 // Categories prises en compte 117 118 $query = ' 119 SELECT id, name, uppercats, global_rank 120 FROM '.CATEGORIES_TABLE. 121 ' WHERE id IN ("'.implode('","', $me->my_config['cats']).'");'; 122 79 $query = 'SELECT id, name, uppercats, global_rank FROM '.CATEGORIES_TABLE.' WHERE id IN ("'.implode('","', $piwecard->my_config['cats']).'");'; 123 80 $result = pwg_query($query); 124 81 $categories = array(); 125 82 if (!empty($result)) 126 83 { 127 while ($row = mysql_fetch_assoc($result))84 while ($row = pwg_db_fetch_assoc($result)) 128 85 array_push($categories, $row); 129 86 } 130 87 usort($categories, 'global_rank_compare'); 131 88 $tpl2 = array(); 132 if (!empty($result)) 133 { 134 foreach ($categories as $cat) 135 { 136 $tpl2[$cat['id']] = get_cat_display_name_cache($cat['uppercats'], 137 null, 138 false); 139 89 if (!empty($result)) { 90 foreach ($categories as $cat) { 91 $tpl2[$cat['id']] = get_cat_display_name_cache($cat['uppercats'], null, false); 140 92 } 141 93 } … … 143 95 $template->assign( 'category_option_true_selected', array()); 144 96 145 $template->assign('ECARD_ALLCATS', ($me->my_config['allcats'] ? 'checked="checked"' : '')); 146 $template->assign('ECARD_USERCAT', ($me->my_config['user_cat'] ? 'checked="checked"' : '')); 147 $template->assign('ECARD_RECURSIV', ($me->my_config['recursive'] ? 'checked="checked"' : '')); 148 97 $template->assign('ECARD_ALLCATS', ($piwecard->my_config['allcats'] ? 'checked="checked"' : '')); 98 $template->assign('ECARD_USERCAT', ($piwecard->my_config['user_cat'] ? 'checked="checked"' : '')); 99 $template->assign('ECARD_RECURSIV', ($piwecard->my_config['recursive'] ? 'checked="checked"' : '')); 149 100 150 101 $template->assign(Array( … … 154 105 )); 155 106 156 157 158 107 $template->assign_var_from_handle('DOUBLE_SELECT', 'double_select'); 159 108 $template->assign_var_from_handle( 'ADMIN_CONTENT', 'plugin_admin_content'); 160 109 110 function get_html_groups_selection($groups, $fieldname, $selecteds = array()) { 111 global $conf; 112 113 if (count ($groups) == 0) { 114 return ''; 115 } 116 117 $output = '<div id="'.$fieldname.'">'; 118 $id = 1; 119 120 foreach ($groups as $group) { 121 $output.= '<input type="checkbox" name="'.$fieldname.'[]" id="group_'.$id++.'" value="'.$group['id'].'"'; 161 122 123 if (in_array($group['id'], $selecteds)) { 124 $output.= ' checked="checked"'; 125 } 162 126 163 function get_html_groups_selection( 164 $groups, 165 $fieldname, 166 $selecteds = array() 167 ) 168 { 169 global $conf; 170 if (count ($groups) == 0 ) 171 { 172 return ''; 173 } 174 $output = '<div id="'.$fieldname.'">'; 175 $id = 1; 176 foreach ($groups as $group) 177 { 178 $output.= 127 $output.= '><label> '. $group['name'].'</label>\n'; 128 } 129 $output.= '</div>'; 179 130 180 '<input type="checkbox" name="'.$fieldname.'[]"' 181 .' id="group_'.$id++.'"' 182 .' value="'.$group['id'].'"' 183 ; 184 185 if (in_array($group['id'], $selecteds)) 186 { 187 $output.= ' checked="checked"'; 188 } 189 190 $output.= 191 '><label>' 192 .' '. $group['name'] 193 .'</label>' 194 ."\n" 195 ; 196 } 197 $output.= '</div>'; 198 199 return $output; 131 return $output; 200 132 } 201 133 134 function get_all_groups() { 135 $query = 'SELECT id, name FROM '.GROUPS_TABLE.' ORDER BY name ASC;'; 136 $result = pwg_query($query); 202 137 138 $groups = array(); 139 while ($row = pwg_db_fetch_assoc($result)) { 140 array_push($groups, $row); 141 } 142 uasort($groups, 'name_compare'); 203 143 204 function get_all_groups() 205 { 206 $query = ' 207 SELECT id, name 208 FROM '.GROUPS_TABLE.' 209 ORDER BY name ASC 210 ;'; 211 $result = pwg_query($query); 212 213 $groups = array(); 214 while ($row = mysql_fetch_assoc($result)) 215 { 216 array_push($groups, $row); 217 } 218 219 uasort($groups, 'name_compare'); 220 return $groups; 144 return $groups; 221 145 } 222 223 224 146 ?> -
extensions/Piwecard/admin/template/admin_manage.tpl
r19926 r19968 1 {footer_script} 2 {literal} 3 $(document).ready(function(){ 4 if ($("#ecard_selected_cats").attr('checked') == "checked") { 5 $("#ecard_selected_cats_options").css("display","block"); 6 } else { 7 $("#ecard_selected_cats_options").css("display","none"); 8 } 9 10 $("#ECardAdminManage").click(function(){ 11 if ($("#ecard_selected_cats").attr('checked') == "checked") { 12 $("#ecard_selected_cats_options").show("fast"); 13 } else { 14 $("#ecard_selected_cats_options").hide("fast"); 15 } 16 }); 17 }); 18 {/literal} 19 {/footer_script} 20 1 21 <div class="titrePage"> 2 <h2>{$ECARD_VERSION}</h2>22 <h2>{'ecard'|@translate}</h2> 3 23 </div> 4 24 <form method="post" action="" class="properties" ENCTYPE="multipart/form-data"> 5 <fieldset> 6 <legend>{'ecard_manage'|@translate}</legend> 7 <table> 8 <tr><td colspan="2"><br></td></tr> 9 <TR> 10 <TD colspan="2"> 11 <b><u>{'ecard_manage'|@translate} 1 :</u></b> <input type="checkbox" name="user_cat" {$ECARD_USERCAT}/> {'ecard_active_user_cat'|@translate} 12 <br/> 13 </TD> 14 </TR> 15 <TR> 16 <TD colspan="2"> 17 <b><u>{'ecard_manage'|@translate} 2 :</u></b> <input type="checkbox" name="allcats" {$ECARD_ALLCATS}/> {'ecard_active_all_cats'|@translate} 18 <br/> 19 </TD> 20 </TR> 21 <TD colspan="2"> 22 <b><u>{'ecard_manage'|@translate} 3 :</u></b> {'ecard_active_spec_cats'|@translate} 23 <br/> 24 </TD> 25 </TR> 26 <TR> 27 <TD colspan="2"> 28 <table> 29 <tr> 30 <td colspan ="2"> 31 {'option'|@translate} : <input type="checkbox" name="recursiv" {$ECARD_RECURSIV}/> {'ecard_recursiv'|@translate} 32 <br/> 33 </TD> 34 </TR> 35 <TR> 36 <TD colspan="2"><br> 37 <td> 38 </tr> 39 <TR > 40 <td align="left" colspan="2"> 41 <div id="cat_select0"> 42 {'option'|@translate} : <b>{'ecard_cat'|@translate} </b> 43 </div> 44 </td> 45 </tr> 46 <tr> 47 <td class="categoryList1" colspan="2"> 48 <div id="cat_select"> 25 <fieldset> 26 <legend>{'ecard_manage'|@translate}</legend> 27 <div id="ECardAdminManage"> 28 <div> 29 <input type="radio" name="ecard_manage" id="ecard_user_cats" value="ecard_user_cats" {$ecard.user_cats} /><label for="ecard_user_cats">{'ecard_active_user_cat'|@translate}</label><br /> 30 </div> 31 <div> 32 <input type="radio" name="ecard_manage" id="ecard_all_cats" value="ecard_all_cats" {$ecard.all_cats} /><label for="ecard_all_cats">{'ecard_active_all_cats'|@translate}</label><br /> 33 </div> 34 <div> 35 <input type="radio" name="ecard_manage" id="ecard_selected_cats" value="ecard_selected_cats" {$ecard.selected_cats}><label for="ecard_selected_cats">{'ecard_active_spec_cats'|@translate}</label><br /> 36 <div id="ecard_selected_cats_options"> 37 <input type="checkbox" name="ecard_selected_cats_recursive" id="ecard_selected_cats_recursive" {$ecard.selected_cats_recursive} /><label for="ecard_selected_cats_recursive">{'ecard_recursive'|@translate}</label><br /> 38 <div id="ecard_cat_select"> 49 39 {$DOUBLE_SELECT} 50 40 </div> 51 </td> 52 </tr> 53 </table> 54 </td> 55 </tr> 56 57 </table> 58 59 60 <br/> 61 </fieldset> 62 63 <p><input type="submit" name="submit" value="{'ecard_admin_submit'|@translate}" /></p> 64 41 </div> 42 </div> 43 <div> 44 <input type="submit" name="submit" value="{'Submit'|@translate}" /> 45 </div> 46 </div> 47 </fieldset> 65 48 </form> -
extensions/Piwecard/admin/template/admin_params.tpl
r19926 r19968 1 1 <div class="titrePage"> 2 <h2>{$ ECARD_VERSION}</h2>2 <h2>{$ecard}</h2> 3 3 </div> 4 4 <form method="post" action="" ENCTYPE="multipart/form-data"> 5 <div id="ECardAdminParams"> 6 <fieldset> 7 <legend>{'ecard_config'|@translate}</legend> 8 <div> 9 {'ecard_activ_nb'|@translate} 10 <select id="ecard_activ" name="ecard_activ"> 11 {foreach from=$ECARD_ACTIV item=ECARD_ACTIV} 12 <option value="{$ECARD_ACTIV.ID}" {$ECARD_ACTIV.SELECTED}>{$ECARD_ACTIV.NAME}</option> 13 {/foreach} 14 </select> 15 </div> 16 <div> 17 <input type="checkbox" name="ecard_sendcopy" {$ECARD_SENDCOPY}/> {'ecard_send_copy'|@translate} 18 </div> 19 <div> 20 <input type="checkbox" name="ecard_modifexpmail" {$ECARD_MODIFEXPMAIL}/> {'ecard_nomodif_expmail'|@translate} 21 </div> 22 <div> 23 <input type="checkbox" name="ecard_sendhtml" {$ECARD_SENDHTML}/> {'ecard_send_HTML'|@translate} 24 </div> 25 <div> 26 <input type="checkbox" name="ecard_showinfos" {$ECARD_SHOWINFOS}/> {'ecard_show_infos'|@translate} 27 </div> 28 <div> 29 {'ecard_admin_nb_page'|@translate} 30 <select id="ecard_nb_page" name="ecard_nb_page"> 31 {foreach from=$ECARD_NB_PAGE item=ECARD_NB_PAGE} 32 <option value="{$ECARD_NB_PAGE.ID}" {$ECARD_NB_PAGE.SELECTED}>{$ECARD_NB_PAGE.NAME}</option> 33 {/foreach} 34 </select> 35 </div> 36 <div> 37 {'ecard_default_mail'|@translate} 38 <input type="text" maxlength="50" size="50" name="defaultmail" id="defaultmail" value="{$ECARD_DEFAULT_MAIL}" /> 39 </div> 40 </fieldset> 5 41 6 <fieldset> 7 <legend>{'ecard_config'|@translate}</legend> 8 <ul> 9 <li> 10 {'ecard_activ_nb'|@translate} 11 <select id="ecard_activ" name="ecard_activ"> 12 {foreach from=$ECARD_ACTIV item=ECARD_ACTIV} 13 <option value="{$ECARD_ACTIV.ID}" {$ECARD_ACTIV.SELECTED}>{$ECARD_ACTIV.NAME}</option> 14 {/foreach} 15 </select> 16 </li> 17 <li> 18 <input type="checkbox" name="ecard_sendcopy" {$ECARD_SENDCOPY}/> {'ecard_send_copy'|@translate} 19 <br/> 20 </li> 21 <li> 22 <input type="checkbox" name="ecard_modifexpmail" {$ECARD_MODIFEXPMAIL}/> {'ecard_nomodif_expmail'|@translate} 23 <br/> 24 </li> 25 <li> 26 <input type="checkbox" name="ecard_sendhtml" {$ECARD_SENDHTML}/> {'ecard_send_HTML'|@translate} 27 <br/> 28 </li> 29 <li> 30 <input type="checkbox" name="ecard_showinfos" {$ECARD_SHOWINFOS}/> {'ecard_show_infos'|@translate} 31 <br/> 32 </li> 33 <li> 34 {'ecard_admin_nb_page'|@translate} 35 <select id="ecard_nb_page" name="ecard_nb_page"> 36 {foreach from=$ECARD_NB_PAGE item=ECARD_NB_PAGE} 37 <option value="{$ECARD_NB_PAGE.ID}" {$ECARD_NB_PAGE.SELECTED}>{$ECARD_NB_PAGE.NAME}</option> 38 {/foreach} 39 </select> 40 </li> 41 <li> 42 {'ecard_default_mail'|@translate} <input type="text" maxlength="50" size="50" name="defaultmail" id="defaultmail" value="{$ECARD_DEFAULT_MAIL}" /> 42 <fieldset> 43 <legend>{'ecard_mail_config'|@translate}</legend> 44 </br> 45 <ul> 46 <li> 47 <span class="property"> 48 <label for="ecard_subject_link">{'ecard_subject_link'|@translate}</label> 49 </span> 50 <input type="text" maxlength="255" size="50" name="ecard_subject_link" id="ecard_subject_link" value="{$ECARD_SUBJECT_LINK}" /> 51 </li> 52 <li> 43 53 44 </li> 45 </ul> 54 <span class="property"> 55 <label for="page_banner">{'ecard_message_link'|@translate}</label> 56 </span> 57 <textarea name="ecard_message_link" id="ecard_message_link" rows="10" cols="50" style="width:100%; height: 150px;">{$ECARD_MESSAGE_LINK}</textarea> 58 </li> 59 <li> 46 60 47 </fieldset> 48 49 <fieldset> 50 <legend>{'ecard_mail_config'|@translate}</legend> 51 </br> 52 <ul> 53 <li> 54 <span class="property"> 55 <label for="ecard_subject_link">{'ecard_subject_link'|@translate}</label> 56 </span> 57 <input type="text" maxlength="255" size="50" name="ecard_subject_link" id="ecard_subject_link" value="{$ECARD_SUBJECT_LINK}" /> 58 </li> 59 <li> 60 61 <span class="property"> 62 <label for="page_banner">{'ecard_message_link'|@translate}</label> 63 </span> 64 <textarea name="ecard_message_link" id="ecard_message_link" rows="10" cols="50" style="width:100%; height: 150px;">{$ECARD_MESSAGE_LINK}</textarea> 65 </li> 66 <li> 67 68 <span class="property"> 69 <label for="page_banner">{'ecard_message_html'|@translate}</label> 70 </span> 71 <textarea name="ecard_message_html" id="ecard_message_html" rows="10" cols="50" style="width:100%; height: 200px;">{$ECARD_MESSAGE_HTML}</textarea> 72 </li> 73 <p><div align="left"> 74 <small>{'ecard_parameters'|@translate}<small> 75 </div></p> 76 </ul> 77 78 </fieldset> 79 80 <p><input type="submit" name="submit" value="{'ecard_admin_submit'|@translate}" /></p> 81 61 <span class="property"> 62 <label for="page_banner">{'ecard_message_html'|@translate}</label> 63 </span> 64 <textarea name="ecard_message_html" id="ecard_message_html" rows="10" cols="50" style="width:100%; height: 200px;">{$ECARD_MESSAGE_HTML}</textarea> 65 </li> 66 <p><div align="left"> 67 <small>{'ecard_parameters'|@translate}<small> 68 </div></p> 69 </ul> 70 71 </fieldset> 72 <div> 73 <input type="submit" name="submit" value="{'Submit'|@translate}" /> 74 </div> 75 </div> 82 76 </form>
Note: See TracChangeset
for help on using the changeset viewer.