Changeset 11290 for extensions/SmartAlbums
- Timestamp:
- Jun 10, 2011, 11:02:04 AM (13 years ago)
- Location:
- extensions/SmartAlbums
- Files:
-
- 10 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/SmartAlbums/include/count_images.php
r10980 r11290 10 10 include_once(SMART_PATH.'include/functions.inc.php'); 11 11 12 $filters = array(); 13 $limit_is_set = false; 14 foreach ($_POST['filters'] as $filter) 12 if (isset($_POST['filters'])) 15 13 { 16 if (($filter = smart_check_filter($filter)) != false) 14 $filters = array(); 15 $limit_is_set = false; 16 foreach ($_POST['filters'] as $filter) 17 17 { 18 array_push($filters, $filter); 18 if (($filter = smart_check_filter($filter)) != false) 19 { 20 array_push($filters, $filter); 21 } 19 22 } 23 24 $associated_images = smart_get_pictures($_POST['cat_id'], $filters); 25 } 26 else 27 { 28 $associated_images = array(); 20 29 } 21 30 22 $associated_images = smart_get_pictures($_POST['cat_id'], $filters);23 31 echo l10n_dec('%d photo', '%d photos', count($associated_images)); 24 32 -
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); -
extensions/SmartAlbums/main.inc.php
r10980 r11290 18 18 if (script_basename() == 'admin') 19 19 { 20 load_language('plugin.lang', SMART_PATH); 21 20 22 add_event_handler('loc_begin_cat_modify', 'smart_init_cat_modify'); 21 23 function smart_init_cat_modify() … … 33 35 } 34 36 35 36 37 ?>
Note: See TracChangeset
for help on using the changeset viewer.