Changeset 28087 for trunk/include


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

Location:
trunk/include
Files:
2 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}
  • trunk/include/ws_functions/pwg.images.php

    r26461 r28087  
    295295 *    @option string key
    296296 */
    297 function ws_images_addComment($params, &$service)
     297function ws_images_addComment($params, $service)
    298298{
    299299  $query = '
     
    355355 *    @option int comments_per_page
    356356 */
    357 function ws_images_getInfo($params, &$service)
     357function ws_images_getInfo($params, $service)
    358358{
    359359  global $user, $conf;
     
    580580 *    @option float rate
    581581 */
    582 function ws_images_rate($params, &$service)
     582function ws_images_rate($params, $service)
    583583{
    584584  $query = '
     
    621621 *    @option string order (optional)
    622622 */
    623 function ws_images_search($params, &$service)
     623function ws_images_search($params, $service)
    624624{
    625625  include_once(PHPWG_ROOT_PATH .'include/functions_search.inc.php');
     
    639639  $search_result = get_quick_search_results(
    640640    $params['query'],
    641     $super_order_by,
    642     implode(' AND ', $where_clauses)
     641    array(
     642      'super_order_by' => $super_order_by,
     643      'images_where' => implode(' AND ', $where_clauses)
     644    )
    643645    );
    644646
     
    705707 *    @option int level
    706708 */
    707 function ws_images_setPrivacyLevel($params, &$service)
     709function ws_images_setPrivacyLevel($params, $service)
    708710{
    709711  global $conf;
     
    738740 *    @option int rank
    739741 */
    740 function ws_images_setRank($params, &$service)
     742function ws_images_setRank($params, $service)
    741743{
    742744  // does the image really exist?
     
    821823 *    @option int position
    822824 */
    823 function ws_images_add_chunk($params, &$service)
     825function ws_images_add_chunk($params, $service)
    824826{
    825827  global $conf;
     
    878880 *    @option string sum
    879881 */
    880 function ws_images_addFile($params, &$service)
     882function ws_images_addFile($params, $service)
    881883{
    882884  ws_logfile(__FUNCTION__.', input :  '.var_export($params, true));
     
    971973 *    @option int image_id (optional)
    972974 */
    973 function ws_images_add($params, &$service)
     975function ws_images_add($params, $service)
    974976{
    975977  global $conf, $user;
     
    11341136 *    @option int image_id (optional)
    11351137 */
    1136 function ws_images_addSimple($params, &$service)
     1138function ws_images_addSimple($params, $service)
    11371139{
    11381140  global $conf;
     
    12481250 *    @option string filename_list (optional)
    12491251 */
    1250 function ws_images_exist($params, &$service)
     1252function ws_images_exist($params, $service)
    12511253{
    12521254  ws_logfile(__FUNCTION__.' '.var_export($params, true));
     
    13211323 *    @option string file_sum
    13221324 */
    1323 function ws_images_checkFiles($params, &$service)
     1325function ws_images_checkFiles($params, $service)
    13241326{
    13251327  ws_logfile(__FUNCTION__.', input :  '.var_export($params, true));
     
    13931395 *    @option string multiple_value_mode
    13941396 */
    1395 function ws_images_setInfo($params, &$service)
     1397function ws_images_setInfo($params, $service)
    13961398{
    13971399  include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
     
    15291531 *    @option string pwg_token
    15301532 */
    1531 function ws_images_delete($params, &$service)
     1533function ws_images_delete($params, $service)
    15321534{
    15331535  if (get_pwg_token() != $params['pwg_token'])
     
    15661568 * @param mixed[] $params
    15671569 */
    1568 function ws_images_checkUpload($params, &$service)
     1570function ws_images_checkUpload($params, $service)
    15691571{
    15701572  include_once(PHPWG_ROOT_PATH.'admin/include/functions_upload.inc.php');
Note: See TracChangeset for help on using the changeset viewer.