Changeset 12629
- Timestamp:
- Nov 15, 2011, 12:48:37 PM (12 years ago)
- Location:
- branches/2.3
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.3/admin/batch_manager.php
r12259 r12629 72 72 { 73 73 $_SESSION['bulk_manager_filter']['tags'] = get_tag_ids($_POST['filter_tags'], false); 74 75 if (isset($_POST['tag_mode']) and in_array($_POST['tag_mode'], array('AND', 'OR'))) 76 { 77 $_SESSION['bulk_manager_filter']['tag_mode'] = $_POST['tag_mode']; 78 } 74 79 } 75 80 … … 298 303 if (!empty($_SESSION['bulk_manager_filter']['tags'])) 299 304 { 300 $query = ' 301 SELECT image_id 302 FROM '.IMAGE_TAG_TABLE. 303 'WHERE tag_id IN('.implode(',',$_SESSION['bulk_manager_filter']['tags']).') 304 GROUP BY image_id 305 HAVING COUNT(tag_id)='.count($_SESSION['bulk_manager_filter']['tags']); 306 array_push( 305 array_push( 307 306 $filter_sets, 308 get_image_ids_for_tags($_SESSION['bulk_manager_filter']['tags']) 309 ); 307 get_image_ids_for_tags( 308 $_SESSION['bulk_manager_filter']['tags'], 309 $_SESSION['bulk_manager_filter']['tag_mode'], 310 null, 311 null, 312 false // we don't apply permissions in administration screens 313 ) 314 ); 310 315 } 311 316 -
branches/2.3/admin/themes/default/template/batch_manager_global.tpl
r12476 r12629 481 481 <label><input type="checkbox" name="filter_category_recursive" {if isset($filter.category_recursive)}checked="checked"{/if}> {'include child albums'|@translate}</label> 482 482 </li> 483 <li id="filter_tags" {if !isset($filter.tags)}style="display:none"{/if}> 484 <a href="#" class="removeFilter" title="remove this filter"><span>[x]</span></a> 485 <input type="checkbox" name="filter_tags_use" class="useFilterCheckbox" {if isset($filter.tags)}checked="checked"{/if}> 486 {'Tags'|@translate} 487 <select id="tagsFilter" name="filter_tags"> 488 {foreach from=$filter_tags item=tag} 489 <option value="{$tag.id}">{$tag.name}</option> 490 {/foreach} 491 </select> 492 </li> 483 <li id="filter_tags" {if !isset($filter.tags)}style="display:none"{/if}> 484 <a href="#" class="removeFilter" title="remove this filter"><span>[x]</span></a> 485 <input type="checkbox" name="filter_tags_use" class="useFilterCheckbox" {if isset($filter.tags)}checked="checked"{/if}> 486 {'Tags'|@translate} 487 <select id="tagsFilter" name="filter_tags"> 488 {foreach from=$filter_tags item=tag} 489 <option value="{$tag.id}">{$tag.name}</option> 490 {/foreach} 491 </select> 492 <label><span><input type="radio" name="tag_mode" value="AND" {if !isset($filter.tag_mode) or $filter.tag_mode eq 'AND'}checked="checked"{/if}> {'All tags'|@translate}</span></label> 493 <label><span><input type="radio" name="tag_mode" value="OR" {if isset($filter.tag_mode) and $filter.tag_mode eq 'OR'}checked="checked"{/if}> {'Any tag'|@translate}</span></label> 494 </li> 493 495 <li id="filter_level" {if !isset($filter.level)}style="display:none"{/if}> 494 496 <a href="#" class="removeFilter" title="remove this filter"><span>[x]</span></a> -
branches/2.3/include/functions_tag.inc.php
r12118 r12629 167 167 * @return array 168 168 */ 169 function get_image_ids_for_tags($tag_ids, $mode='AND', $extra_images_where_sql='', $order_by='' )169 function get_image_ids_for_tags($tag_ids, $mode='AND', $extra_images_where_sql='', $order_by='', $use_permissions=true) 170 170 { 171 171 global $conf; … … 176 176 177 177 $query = 'SELECT id 178 FROM '.IMAGES_TABLE.' i 179 INNER JOIN '.IMAGE_CATEGORY_TABLE.' ic ON id=ic.image_id 178 FROM '.IMAGES_TABLE.' i '; 179 180 if ($use_permissions) 181 { 182 $query.= ' 183 INNER JOIN '.IMAGE_CATEGORY_TABLE.' ic ON id=ic.image_id'; 184 } 185 186 $query.= ' 180 187 INNER JOIN '.IMAGE_TAG_TABLE.' it ON id=it.image_id 181 WHERE tag_id IN ('.implode(',', $tag_ids).')' 182 .get_sql_condition_FandF 183 ( 184 array 185 ( 186 'forbidden_categories' => 'category_id', 187 'visible_categories' => 'category_id', 188 'visible_images' => 'id' 188 WHERE tag_id IN ('.implode(',', $tag_ids).')'; 189 190 if ($use_permissions) 191 { 192 $query.= get_sql_condition_FandF( 193 array( 194 'forbidden_categories' => 'category_id', 195 'visible_categories' => 'category_id', 196 'visible_images' => 'id' 189 197 ), 190 198 "\n AND" 191 ) 192 .(empty($extra_images_where_sql) ? '' : " \nAND (".$extra_images_where_sql.')') 193 .' 199 ); 200 } 201 202 $query.= (empty($extra_images_where_sql) ? '' : " \nAND (".$extra_images_where_sql.')').' 194 203 GROUP BY id'; 195 204
Note: See TracChangeset
for help on using the changeset viewer.