Changeset 1970 for trunk/include/category_cats.inc.php
- Timestamp:
- Apr 22, 2007, 3:11:56 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/category_cats.inc.php
r1900 r1970 78 78 $result = pwg_query($query); 79 79 $categories = array(); 80 $category_ids = array(); 80 81 $image_ids = array(); 81 82 … … 147 148 array_push($image_ids, $image_id); 148 149 array_push($categories, $row); 150 array_push($category_ids, $row['id']); 149 151 } 150 152 unset($image_id); 153 } 154 155 if ($conf['display_fromto']) 156 { 157 $dates_of_category = array(); 158 if (count($category_ids) > 0) 159 { 160 $query = ' 161 SELECT 162 category_id, 163 MIN(date_creation) AS date_creation_min, 164 MAX(date_creation) AS date_creation_max 165 FROM '.IMAGE_CATEGORY_TABLE.' 166 INNER JOIN '.IMAGES_TABLE.' ON image_id = id 167 WHERE category_id IN ('.implode(',', $category_ids).') 168 GROUP BY category_id 169 ;'; 170 $result = pwg_query($query); 171 while ($row = mysql_fetch_array($result)) 172 { 173 $dates_of_category[ $row['category_id'] ] = array( 174 'from' => $row['date_creation_min'], 175 'to' => $row['date_creation_max'], 176 ); 177 } 178 // echo '<pre>'; print_r($dates_of_category); echo '</pre>'; 179 } 151 180 } 152 181 … … 222 251 ) 223 252 ); 253 254 if ($conf['display_fromto']) 255 { 256 if (isset($dates_of_category[ $category['id'] ])) 257 { 258 $from = $dates_of_category[ $category['id'] ]['from']; 259 $to = $dates_of_category[ $category['id'] ]['to']; 224 260 261 if (!empty($from)) 262 { 263 $info = ''; 264 265 if ($from == $to) 266 { 267 $info = format_date($from); 268 } 269 else 270 { 271 $info = sprintf( 272 l10n('from %s to %s'), 273 format_date($from), 274 format_date($to) 275 ); 276 } 277 278 $template->assign_block_vars( 279 'categories.category.dates', 280 array( 281 'INFO' => $info, 282 ) 283 ); 284 } 285 } 286 } 287 225 288 //plugins need to add/modify sth in this loop ? 226 289 trigger_action('loc_index_category_thumbnail',
Note: See TracChangeset
for help on using the changeset viewer.