Ignore:
Timestamp:
Nov 10, 2012, 9:10:01 PM (12 years ago)
Author:
mistic100
Message:

feature:2718 Add batch manager filters for photo dimensions, redesign with sliders

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/batch_manager.php

    r18758 r18988  
    101101      }
    102102    }
    103   }
    104  
    105   if (isset($_POST['filter_ratio_use']))
    106   {
    107     foreach (array('min','max') as $type)
    108     {
    109       if ( preg_match('#^[0-9\.,]+$#', $_POST['filter_ratio_'. $type ]) )
     103    foreach (array('min_ratio','max_ratio') as $type)
     104    {
     105      if ( preg_match('#^[0-9\.]+$#', $_POST['filter_dimension_'. $type ]) )
    110106      {
    111         $_SESSION['bulk_manager_filter']['ratio'][$type] = str_replace(',','.',$_POST['filter_ratio_'. $type ]);
     107        $_SESSION['bulk_manager_filter']['dimension'][$type] = $_POST['filter_dimension_'. $type ];
    112108      }
    113109    }
     
    350346}
    351347
    352 if (isset($_SESSION['bulk_manager_filter']['dimension']) or isset($_SESSION['bulk_manager_filter']['ratio']))
     348if (isset($_SESSION['bulk_manager_filter']['dimension']))
    353349{
    354350  $where_clauses = array();
     
    369365    $where_clause[] = 'height <= '.$_SESSION['bulk_manager_filter']['dimension']['max_height'];
    370366  }
    371   if (isset($_SESSION['bulk_manager_filter']['ratio']['min']))
    372   {
    373     $where_clause[] = 'width/height >= '.$_SESSION['bulk_manager_filter']['ratio']['min'];
    374   }
    375   if (isset($_SESSION['bulk_manager_filter']['ratio']['max']))
    376   {
    377     $where_clause[] = 'width/height <= '.$_SESSION['bulk_manager_filter']['ratio']['max'];
     367  if (isset($_SESSION['bulk_manager_filter']['dimension']['min_ratio']))
     368  {
     369    $where_clause[] = 'width/height >= '.$_SESSION['bulk_manager_filter']['dimension']['min_ratio'];
     370  }
     371  if (isset($_SESSION['bulk_manager_filter']['dimension']['max_ratio']))
     372  {
     373    $where_clause[] = 'width/height <= '.$_SESSION['bulk_manager_filter']['dimension']['max_ratio'];
    378374  }
    379375 
     
    444440
    445441// +-----------------------------------------------------------------------+
     442// |                              dimensions                               |
     443// +-----------------------------------------------------------------------+
     444$query = '
     445SELECT
     446    MIN(width) as min_width,
     447    MAX(width) as max_width,
     448    MIN(height) as min_height,
     449    MAX(height) as max_height,
     450    MIN(width/height) as min_ratio,
     451    MAX(width/height) as max_ratio
     452  FROM '.IMAGES_TABLE.'
     453;';
     454$dimensions['bounds'] = pwg_db_fetch_assoc(pwg_query($query));
     455$dimensions['bounds']['min_ratio'] = floor($dimensions['bounds']['min_ratio']*100)/100;
     456$dimensions['bounds']['max_ratio'] = ceil($dimensions['bounds']['max_ratio']*100)/100;
     457
     458foreach (array_keys($dimensions['bounds']) as $type)
     459{
     460  $dimensions['selected'][$type] = isset($_SESSION['bulk_manager_filter']['dimension'][$type]) ? $_SESSION['bulk_manager_filter']['dimension'][$type] : $dimensions['bounds'][$type];
     461}
     462$template->assign('dimensions', $dimensions);
     463
     464
     465// +-----------------------------------------------------------------------+
    446466// |                         open specific mode                            |
    447467// +-----------------------------------------------------------------------+
Note: See TracChangeset for help on using the changeset viewer.