Ignore:
Timestamp:
Apr 5, 2014, 9:24:27 PM (10 years ago)
Author:
rvelices
Message:

bug 3069: add quick search as filter in batch manager

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/functions_search.inc.php

    r28080 r28087  
    11941194 * @return array
    11951195 */
    1196 function get_quick_search_results($q, $super_order_by, $images_where='')
     1196function get_quick_search_results($q, $options)
    11971197{
    11981198  global $conf;
     
    12551255  }
    12561256
     1257  $permissions = !isset($options['permissions']) ? true : $options['permissions'];
     1258
    12571259  $where_clauses = array();
    12581260  $where_clauses[]='i.id IN ('. implode(',', $ids) . ')';
    1259   if (!empty($images_where))
     1261  if (!empty($options['images_where'))
    12601262  {
    12611263    $where_clauses[]='('.$images_where.')';
    12621264  }
    1263   $where_clauses[] = get_sql_condition_FandF(
    1264       array
    1265         (
    1266           'forbidden_categories' => 'category_id',
    1267           'visible_categories' => 'category_id',
    1268           'visible_images' => 'i.id'
    1269         ),
    1270       null,true
    1271     );
     1265  if ($permissions)
     1266  {
     1267    $where_clauses[] = get_sql_condition_FandF(
     1268        array
     1269          (
     1270            'forbidden_categories' => 'category_id',
     1271            'visible_categories' => 'category_id',
     1272            'visible_images' => 'i.id'
     1273          ),
     1274        null,true
     1275      );
     1276  }
    12721277
    12731278  $query = '
    1274 SELECT DISTINCT(id)
    1275   FROM '.IMAGES_TABLE.' i
    1276     INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id = ic.image_id
     1279SELECT DISTINCT(id) FROM '.IMAGES_TABLE.' i';
     1280  if ($permissions)
     1281  {
     1282    $query .= '
     1283    INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id = ic.image_id';
     1284  }
     1285  $query .= '
    12771286  WHERE '.implode("\n AND ", $where_clauses)."\n".
    12781287  $conf['order_by'];
     
    13061315  else
    13071316  {
    1308     return get_quick_search_results($search['q'], $super_order_by, $images_where);
     1317    return get_quick_search_results($search['q'], array('super_order_by'=>$super_order_by, 'images_where'=>$images_where) );
    13091318  }
    13101319}
Note: See TracChangeset for help on using the changeset viewer.