Changeset 11290 for extensions/SmartAlbums/init_cat_list.php
- Timestamp:
- Jun 10, 2011, 11:02:04 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/SmartAlbums/init_cat_list.php
r10980 r11290 4 4 * Add a link into categories list to regenerate associations 5 5 */ 6 6 $smart_count = 0; 7 7 8 function smart_cat_list() 8 9 { 9 global $template, $page ;10 global $template, $page, $smart_count; 10 11 include_once(SMART_PATH.'include/functions.inc.php'); 11 12 $self_url = get_root_url().'admin.php?page=cat_list'.(isset($_GET['parent_id']) ? '&parent_id='.$_GET['parent_id'] : null); … … 28 29 29 30 $result = pwg_query($query); 30 $ categories = array();31 $smart_cats = array(); 31 32 while ($cat = pwg_db_fetch_assoc($result)) 32 33 { 33 $ categories[$cat['id']] = trigger_event('render_category_name', $cat['name']);34 $smart_cats[$cat['id']] = trigger_event('render_category_name', $cat['name']); 34 35 } 36 37 $smart_count = count($smart_cats); 35 38 36 39 if (isset($_GET['smart_generate'])) … … 39 42 if ($_GET['smart_generate'] == 'all') 40 43 { 41 foreach ($ categories as $cat => $name)44 foreach ($smart_cats as $cat => $name) 42 45 { 43 46 $associated_images = smart_make_associations($cat); … … 54 57 array_push($page['infos'], l10n_args(get_l10n_args( 55 58 '%d photos associated to album «%s»', 56 array(count($associated_images), $ categories[$_GET['smart_generate']])59 array(count($associated_images), $smart_cats[$_GET['smart_generate']]) 57 60 ))); 58 61 } … … 63 66 // create regenerate link 64 67 $tpl_cat = array(); 65 foreach ($ categories as $cat => $name)68 foreach ($smart_cats as $cat => $name) 66 69 { 67 70 $tpl_cat[$cat] = $self_url.'&smart_generate='.$cat; … … 80 83 function smart_cat_list_prefilter($content, &$smarty) 81 84 { 82 $search[0] = '<ul class="categoryActions">'; 83 $replacement[0] = $search[0].' 85 global $smart_count; 86 87 $search[0] = '<ul class="categoryActions">'; 88 $replacement[0] = $search[0].' 84 89 {if isset($SMART_URL[$category.ID])} 85 90 <li><a href="{$SMART_URL[$category.ID]}" title="{\'regenerate photos list\'|@translate}"><img src="{$SMART_PATH}template/refresh.png" class="button" alt="{\'regenerate photos list\'|@translate}"></a></li> 86 91 {/if}'; 87 92 88 $search[1] = '</ul> 93 if ($smart_count > 0) 94 { 95 $search[1] = '</ul> 89 96 </form> 90 97 {/if}'; 91 $replacement[1] = $search[1].'98 $replacement[1] = $search[1].' 92 99 <form method="post" action="{$SMART_URL.all}"> 93 100 <input type="hidden" name="pwg_token" value="{$PWG_TOKEN}"> 94 101 <p><input class="submit" type="submit" value="{\'regenerate photos list of all SmartAlbums\'|@translate}"></p> 95 102 </form>'; 103 } 96 104 97 105 return str_replace($search, $replacement, $content);
Note: See TracChangeset
for help on using the changeset viewer.