aboutsummaryrefslogtreecommitdiffstats
path: root/admin/element_set.php
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2008-09-24 01:27:49 +0000
committerrvelices <rv-github@modusoptimus.com>2008-09-24 01:27:49 +0000
commit351d3558b1fd069f39c4eb4c4d428522284afab7 (patch)
treef8193bcff04ecbeb538b9fc52d30ee46220181ff /admin/element_set.php
parent01f78a2febf84d2f502c115604f56668e869ae19 (diff)
- feature admin element set: recently posted images (nice if you forget add to caddie during synchro phase)
git-svn-id: http://piwigo.org/svn/trunk@2579 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'admin/element_set.php')
-rw-r--r--admin/element_set.php43
1 files changed, 26 insertions, 17 deletions
diff --git a/admin/element_set.php b/admin/element_set.php
index 5513a5e64..b68715808 100644
--- a/admin/element_set.php
+++ b/admin/element_set.php
@@ -24,9 +24,9 @@
/**
* Management of elements set. Elements can belong to a category or to the
* user caddie.
- *
+ *
*/
-
+
if (!defined('PHPWG_ROOT_PATH'))
{
die('Hacking attempt!');
@@ -102,7 +102,7 @@ DELETE
// To element_set_(global|unit).php, we must provide the elements id of the
// managed category in $page['cat_elements_id'] array.
-
+$page['cat_elements_id'] = array();
if (is_numeric($_GET['cat']))
{
$page['title'] =
@@ -111,7 +111,7 @@ if (is_numeric($_GET['cat']))
PHPWG_ROOT_PATH.'admin.php?page=cat_modify&amp;cat_id=',
false
);
-
+
$query = '
SELECT image_id
FROM '.IMAGE_CATEGORY_TABLE.'
@@ -122,7 +122,7 @@ SELECT image_id
else if ('caddie' == $_GET['cat'])
{
$page['title'] = l10n('caddie');
-
+
$query = '
SELECT element_id
FROM '.CADDIE_TABLE.'
@@ -133,7 +133,7 @@ SELECT element_id
else if ('not_linked' == $_GET['cat'])
{
$page['title'] = l10n('Elements_not_linked');
-
+
// we are searching elements not linked to any virtual category
$query = '
SELECT id
@@ -159,37 +159,46 @@ SELECT DISTINCT(image_id)
$page['cat_elements_id'] = array_diff($all_elements, $linked_to_virtual);
}
- else
- {
- $page['cat_elements_id'] = array();
- }
}
else if ('duplicates' == $_GET['cat'])
{
$page['title'] = l10n('Duplicates');
-
+
// we are searching related elements twice or more to physical categories
// 1 - Retrieve Files
$query = '
SELECT DISTINCT(file)
- FROM '.IMAGES_TABLE.'
- GROUP BY file
-HAVING COUNT(DISTINCT storage_category_id) > 1
-;';
+ FROM '.IMAGES_TABLE.'
+ GROUP BY file
+HAVING COUNT(DISTINCT storage_category_id) > 1
+;';
$duplicate_files = array_from_query($query, 'file');
$duplicate_files[]='Nofiles';
// 2 - Retrives related picture ids
$query = '
SELECT id, file
- FROM '.IMAGES_TABLE.'
+ FROM '.IMAGES_TABLE.'
WHERE file IN (\''.implode("','", $duplicate_files).'\')
ORDER BY file, id
;';
$page['cat_elements_id'] = array_from_query($query, 'id');
- $page['cat_elements_id'][] = 0;
}
+elseif ('recent'== $_GET['cat'])
+{
+ $page['title'] = l10n('recent_pics_cat');
+ $query = 'SELECT MAX(date_available) AS date
+ FROM '.IMAGES_TABLE;
+ if ($row=mysql_fetch_array( pwg_query($query) ) )
+ {
+ $query = 'SELECT id
+ FROM '.IMAGES_TABLE.'
+ WHERE date_available BETWEEN DATE_SUB("'.$row['date'].'", INTERVAL 1 DAY) AND "'.$row['date'].'"';
+ $page['cat_elements_id'] = array_from_query($query, 'id');
+ }
+}
+
// +-----------------------------------------------------------------------+
// | first element to display |
// +-----------------------------------------------------------------------+