Show
Ignore:
Timestamp:
09/24/08 03:27:49 (5 years ago)
Author:
rvelices
Message:

- feature admin element set: recently posted images (nice if you forget add to caddie during synchro phase)

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/admin/element_set.php

    r2299 r2579  
    2525 * Management of elements set. Elements can belong to a category or to the 
    2626 * user caddie. 
    27  *  
     27 * 
    2828 */ 
    29   
     29 
    3030if (!defined('PHPWG_ROOT_PATH')) 
    3131{ 
     
    103103// To element_set_(global|unit).php, we must provide the elements id of the 
    104104// managed category in $page['cat_elements_id'] array. 
    105  
     105$page['cat_elements_id'] = array(); 
    106106if (is_numeric($_GET['cat'])) 
    107107{ 
     
    112112      false 
    113113      ); 
    114    
     114 
    115115  $query = ' 
    116116SELECT image_id 
     
    123123{ 
    124124  $page['title'] = l10n('caddie'); 
    125    
     125 
    126126  $query = ' 
    127127SELECT element_id 
     
    134134{ 
    135135  $page['title'] = l10n('Elements_not_linked'); 
    136    
     136 
    137137  // we are searching elements not linked to any virtual category 
    138138  $query = ' 
     
    160160    $page['cat_elements_id'] = array_diff($all_elements, $linked_to_virtual); 
    161161  } 
    162   else 
    163   { 
    164     $page['cat_elements_id'] = array(); 
    165   } 
    166162} 
    167163else if ('duplicates' == $_GET['cat']) 
    168164{ 
    169165  $page['title'] = l10n('Duplicates'); 
    170    
     166 
    171167  // we are searching related elements twice or more to physical categories 
    172168  // 1 - Retrieve Files 
    173169  $query = ' 
    174170SELECT DISTINCT(file) 
    175   FROM '.IMAGES_TABLE.'  
    176  GROUP BY file  
    177 HAVING COUNT(DISTINCT storage_category_id) > 1  
    178 ;';   
     171  FROM '.IMAGES_TABLE.' 
     172 GROUP BY file 
     173HAVING COUNT(DISTINCT storage_category_id) > 1 
     174;'; 
    179175 
    180176  $duplicate_files = array_from_query($query, 'file'); 
     
    183179  $query = ' 
    184180SELECT id, file 
    185   FROM '.IMAGES_TABLE.'  
     181  FROM '.IMAGES_TABLE.' 
    186182WHERE file IN (\''.implode("','", $duplicate_files).'\') 
    187183ORDER BY file, id 
     
    189185 
    190186  $page['cat_elements_id'] = array_from_query($query, 'id'); 
    191   $page['cat_elements_id'][] = 0; 
    192 } 
     187} 
     188elseif ('recent'== $_GET['cat']) 
     189{ 
     190  $page['title'] = l10n('recent_pics_cat'); 
     191  $query = 'SELECT MAX(date_available) AS date 
     192  FROM '.IMAGES_TABLE; 
     193  if ($row=mysql_fetch_array( pwg_query($query) ) ) 
     194  { 
     195    $query = 'SELECT id 
     196  FROM '.IMAGES_TABLE.' 
     197  WHERE date_available BETWEEN DATE_SUB("'.$row['date'].'", INTERVAL 1 DAY) AND "'.$row['date'].'"'; 
     198    $page['cat_elements_id'] = array_from_query($query, 'id'); 
     199  } 
     200} 
     201 
    193202// +-----------------------------------------------------------------------+ 
    194203// |                       first element to display                        |