source: tags/build-Alligator02/services/recent.php @ 27601

Last change on this file since 27601 was 1677, checked in by rub, 17 years ago

Feature Issue ID 0000601: Filter all public pages with only recent elements

It's a finalized version.
Obsolete code of draft are removed.

You can filter categories and images with recent date period on your screen selection.
In the future, filter could be easy done on other type data (plugin?)

You can flat categories and sub-categories with a recent date period of your choice.

Next, perhaps, a panel to choice recent date for the 2 features.

On draft, there have problem with MySql 5, be careful!

Css problem not resolved:

  • Menu "Categories" is bad centered
  • Icon on dark too on the top
File size: 1.6 KB
Line 
1<?php
2
3$where = 
4  get_sql_condition_FandF
5    (
6      array
7        (
8          'forbidden_categories' => 'ic.category_id',
9          'visible_categories' => 'ic.category_id',
10          'visible_images' => 'i.id'
11        ),
12      ''
13    );
14$list = implode(',', $final);
15if ( $where !== '' and $list !== '' )
16{
17  $where .= ' AND ';
18}
19$where .= ( $list == '') ? '' :
20  'i.`id` IN ('. $list .')';
21$query='
22  SELECT DISTINCT (i.`id`),
23         i.`path` , i.`file` , i.`date_available` ,
24         i.`date_creation`, i.`tn_ext` , i.`name` ,
25         i.`filesize` , i.`storage_category_id` , i.`average_rate`,
26         i.`comment` , i.`author` , i.`hit` ,i.`width` ,
27         i.`height`
28     FROM `'.IMAGES_TABLE.'` AS i
29     INNER JOIN `'.IMAGE_CATEGORY_TABLE.'`
30           AS ic ON i.`id` = ic.`image_id`
31     WHERE '. $where .'
32';
33/* recent = Date_available desc order */
34$query .= ' ORDER BY i.`date_available` DESC, RAND() DESC ';
35$query .= ' LIMIT 0 , '. $limit .';';
36// echo $query . '<br />';
37$result = pwg_query( $query );
38
39$template->assign_vars(
40  array(
41    'TITLE' => 'recent',
42    )
43  );
44$template->assign_block_vars(
45  'row', array()
46    );
47$template->assign_block_vars(
48  'row.Normal',
49  array(
50    'WIDTH'=> 682,
51    'HEIGH'=> 682,
52    'URL'=> 'http://www.monsite.com/pwg/galleries/shared/cat/image.jpg',
53    )
54  );
55$template->assign_block_vars(
56  'row',
57  array(
58    'ID'=> 22,
59    'CAPTION'=> 'L\'image que je veux',
60    'DATE'=> '18/12/2006',
61    'COMMENT'=> 'Voila voili voilou ! Voila voili voilou !',
62    )
63  ); 
64?>
Note: See TracBrowser for help on using the repository browser.