[440] | 1 | <?php |
---|
| 2 | // +-----------------------------------------------------------------------+ |
---|
[593] | 3 | // | PhpWebGallery - a PHP based picture gallery | |
---|
| 4 | // | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net | |
---|
[675] | 5 | // | Copyright (C) 2003-2005 PhpWebGallery Team - http://phpwebgallery.net | |
---|
[440] | 6 | // +-----------------------------------------------------------------------+ |
---|
[593] | 7 | // | branch : BSF (Best So Far) |
---|
[440] | 8 | // | file : $RCSfile$ |
---|
| 9 | // | last update : $Date: 2005-03-26 22:35:07 +0000 (Sat, 26 Mar 2005) $ |
---|
| 10 | // | last modifier : $Author: plg $ |
---|
| 11 | // | revision : $Revision: 760 $ |
---|
| 12 | // +-----------------------------------------------------------------------+ |
---|
| 13 | // | This program is free software; you can redistribute it and/or modify | |
---|
| 14 | // | it under the terms of the GNU General Public License as published by | |
---|
| 15 | // | the Free Software Foundation | |
---|
| 16 | // | | |
---|
| 17 | // | This program is distributed in the hope that it will be useful, but | |
---|
| 18 | // | WITHOUT ANY WARRANTY; without even the implied warranty of | |
---|
| 19 | // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
---|
| 20 | // | General Public License for more details. | |
---|
| 21 | // | | |
---|
| 22 | // | You should have received a copy of the GNU General Public License | |
---|
| 23 | // | along with this program; if not, write to the Free Software | |
---|
| 24 | // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | |
---|
| 25 | // | USA. | |
---|
| 26 | // +-----------------------------------------------------------------------+ |
---|
| 27 | |
---|
| 28 | /** |
---|
| 29 | * This file is included by category.php to show thumbnails for recent_cats |
---|
| 30 | * category |
---|
| 31 | * |
---|
| 32 | */ |
---|
| 33 | |
---|
| 34 | // retrieving categories recently update, ie containing pictures added |
---|
| 35 | // recently. The calculated table field categories.date_last will be |
---|
| 36 | // easier to use |
---|
| 37 | $query = ' |
---|
[610] | 38 | SELECT c.id AS category_id,uppercats,representative_picture_id,path,file,tn_ext |
---|
| 39 | FROM '.CATEGORIES_TABLE.' AS c INNER JOIN '.IMAGES_TABLE.' AS i |
---|
| 40 | ON i.id = c.representative_picture_id |
---|
[440] | 41 | WHERE date_last > SUBDATE(CURRENT_DATE |
---|
[452] | 42 | ,INTERVAL '.$user['recent_period'].' DAY)'; |
---|
[440] | 43 | if ( $user['forbidden_categories'] != '' ) |
---|
| 44 | { |
---|
| 45 | $query.= ' |
---|
[664] | 46 | AND c.id NOT IN ('.$user['forbidden_categories'].')'; |
---|
[440] | 47 | } |
---|
| 48 | $query.= ' |
---|
| 49 | ;'; |
---|
[587] | 50 | $result = pwg_query( $query ); |
---|
[440] | 51 | |
---|
| 52 | // template thumbnail initialization |
---|
| 53 | if (mysql_num_rows($result) > 0) |
---|
| 54 | { |
---|
| 55 | $template->assign_block_vars('thumbnails', array()); |
---|
| 56 | // first line |
---|
| 57 | $template->assign_block_vars('thumbnails.line', array()); |
---|
| 58 | // current row displayed |
---|
| 59 | $row_number = 0; |
---|
| 60 | } |
---|
| 61 | |
---|
[642] | 62 | $old_level_separator = $conf['level_separator']; |
---|
| 63 | $conf['level_separator'] = '<br />'; |
---|
[440] | 64 | // for each category, we have to search a recent picture to display and |
---|
| 65 | // the name to display |
---|
| 66 | while ( $row = mysql_fetch_array( $result ) ) |
---|
| 67 | { |
---|
[705] | 68 | $name = get_cat_display_name_cache($row['uppercats'], '', false); |
---|
[440] | 69 | |
---|
[610] | 70 | $thumbnail_src = get_thumbnail_src($row['path'], @$row['tn_ext']); |
---|
[440] | 71 | |
---|
| 72 | $url_link = PHPWG_ROOT_PATH.'category.php?cat='.$row['category_id']; |
---|
| 73 | |
---|
| 74 | $template->assign_block_vars( |
---|
| 75 | 'thumbnails.line.thumbnail', |
---|
| 76 | array( |
---|
[579] | 77 | 'IMAGE' => $thumbnail_src, |
---|
[610] | 78 | 'IMAGE_ALT' => $row['file'], |
---|
[440] | 79 | 'IMAGE_TITLE' => $lang['hint_category'], |
---|
| 80 | |
---|
[610] | 81 | 'U_IMG_LINK' => add_session_id($url_link) |
---|
[440] | 82 | ) |
---|
| 83 | ); |
---|
| 84 | |
---|
[760] | 85 | $template->assign_block_vars( |
---|
| 86 | 'thumbnails.line.thumbnail.category_name', |
---|
| 87 | array( |
---|
| 88 | 'NAME' => $name |
---|
| 89 | ) |
---|
| 90 | ); |
---|
| 91 | |
---|
[440] | 92 | // create a new line ? |
---|
| 93 | if (++$row_number == $user['nb_image_line']) |
---|
| 94 | { |
---|
| 95 | $template->assign_block_vars('thumbnails.line', array()); |
---|
| 96 | $row_number = 0; |
---|
| 97 | } |
---|
| 98 | } |
---|
[642] | 99 | $conf['level_separator'] = $old_level_separator; |
---|
[440] | 100 | ?> |
---|