- Timestamp:
- Feb 15, 2007, 1:10:41 AM (18 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/category_cats.inc.php
r1722 r1820 182 182 if ($conf['subcatify']) 183 183 { 184 $template->set_filenames( 185 array( 186 'mainpage_categories' => 'mainpage_categories.tpl', 187 ) 188 ); 184 $template->set_filename('mainpage_categories', 'mainpage_categories.tpl'); 189 185 190 186 foreach ($categories as $category) … … 232 228 else 233 229 { 234 $template->set_filename s( array( 'thumbnails' => 'thumbnails.tpl',));230 $template->set_filename( 'thumbnails', 'thumbnails.tpl'); 235 231 // first line 236 232 $template->assign_block_vars('thumbnails.line', array()); … … 296 292 } 297 293 298 $template->assign_var_from_handle('THUMBNAILS', 'thumbnails'); 294 $template->assign_var_from_handle('CATEGORIES', 'thumbnails'); 295 unset( $template->_tpldata['thumbnails.'] );//maybe write a func for that 299 296 } 300 297 } -
trunk/include/functions_calendar.inc.php
r1759 r1820 198 198 if (script_basename() != 'picture') // basename without file extention 199 199 { 200 $template->assign_block_vars('calendar', array());201 202 200 if ($calendar->generate_category_content()) 203 201 { 204 unset( 205 $page['thumbnails_include'], 206 $page['items'] 207 ); 208 202 $page['items'] = array(); 209 203 $must_show_list = false; 210 204 } 211 205 212 $template->assign_block_vars( 'calendar.views', array() );213 206 foreach ($styles as $style => $style_data) 214 207 { … … 261 254 .$fields[$page['chronology_field']]['label'].'</a>'; 262 255 $calendar_title.= $calendar->get_display_name(); 263 //this should be an assign_block_vars, but I need to assign 'calendar' 264 //above and at that point I don't have the title yet. 265 $template->_tpldata['calendar.'][0]['TITLE'] = $calendar_title; 256 $template->merge_block_vars('calendar', 257 array( 258 'TITLE' => $calendar_title 259 ) 260 ); 266 261 } // end category calling 267 262 … … 294 289 '.$order_by; 295 290 } 296 297 291 $page['items'] = array_from_query($query, 'id'); 298 $page['thumbnails_include'] = 'include/category_default.inc.php';299 292 } 300 293 pwg_debug('end initialize_calendar'); -
trunk/include/section_init.inc.php
r1814 r1820 34 34 * - $page['items']: ordered list of items to display 35 35 * 36 * - $page['cat_nb_images']: number of items in the section (should be equal37 * to count($page['items']))38 *39 * - $page['thumbnails_include']: include page managing thumbnails to40 * display41 36 */ 42 37 … … 51 46 // 'action' => 'fill_caddie' 52 47 // ); 48 49 $page['items'] = array(); 53 50 54 51 // some ISPs set PATH_INFO to empty string or to SCRIPT_FILENAME while in the … … 365 362 'forbidden_categories' => 'category_id', 366 363 'visible_categories' => 'category_id', 367 'visible_images' => 'i mage_id'364 'visible_images' => 'id' 368 365 ), 369 366 'AND' … … 396 393 'title' => 397 394 get_cat_display_name($result['name'], '', false), 398 'thumbnails_include' =>399 (($result['nb_images'] > 0) or (isset($page['flat'])))400 ? 'include/category_default.inc.php'401 : 'include/category_cats.inc.php'402 395 ) 403 396 ); … … 406 399 { 407 400 $page['title'] = $lang['no_category']; 408 $page['thumbnails_include'] =409 (isset($page['flat']))410 ? 'include/category_default.inc.php'411 : 'include/category_cats.inc.php';412 401 } 413 402 … … 427 416 428 417 if (isset($page['flat'])) 429 { 430 // flat recent categories mode 431 $query = ' 432 SELECT 433 DISTINCT(ic.image_id) 434 FROM '.IMAGES_TABLE.' AS i 435 INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON i.id = ic.image_id 436 INNER JOIN '.CATEGORIES_TABLE.' AS c ON ic.category_id = c.id 437 WHERE 438 '.(isset($page['category']) ? ' 439 uppercats REGEXP \'(^|,)'.$page['category'].'(,|$)\'' : '1=1' ).' 440 '.$forbidden.' 441 ;'; 442 443 $where_sql = array_from_query($query, 'image_id'); 444 if (!empty($where_sql)) 418 {// flat categories mode 419 if ( isset($page['category']) ) 445 420 { 446 $where_sql = 'image_id in ('.implode(',', $where_sql).')'; 421 $subcat_ids = get_subcat_ids( array($page['category']) ); 422 $where_sql = 'category_id IN ('.implode(',',$subcat_ids).')'; 447 423 } 424 else 425 { 426 $where_sql = '1=1'; 427 } 448 428 } 449 429 else 450 { 451 // Normal mode 430 {// Normal mode 452 431 $where_sql = 'category_id = '.$page['category']; 453 432 } 454 433 455 if (!empty($where_sql)) 456 { 457 // Main query 458 $query = ' 434 // Main query 435 $query = ' 459 436 SELECT DISTINCT(image_id) 460 437 FROM '.IMAGE_CATEGORY_TABLE.' … … 466 443 ;'; 467 444 468 $page['items'] = array_from_query($query, 'image_id'); 469 } 470 else 471 { 472 $page['items'] = array(); 473 } 445 $page['items'] = array_from_query($query, 'image_id'); 474 446 } //otherwise the calendar will requery all subitems 475 447 } … … 514 486 'title' => $title, 515 487 'items' => array_values($items), 516 'thumbnails_include' => 'include/category_default.inc.php',517 488 ) 518 489 ); … … 547 518 array( 548 519 'title' => $lang['search_result'], 549 'thumbnails_include' => 'include/category_default.inc.php',550 520 ) 551 521 ); … … 579 549 'title' => $lang['favorites'], 580 550 'items' => array_from_query($query, 'image_id'), 581 'thumbnails_include' => 'include/category_default.inc.php',582 551 ) 583 552 ); … … 604 573 .$lang['recent_pics_cat'].'</a>', 605 574 'items' => array_from_query($query, 'id'), 606 'thumbnails_include' => 'include/category_default.inc.php',607 575 ) 608 576 ); … … 617 585 array( 618 586 'title' => $lang['recent_cats_cat'], 619 'thumbnails_include' => 'include/category_cats.inc.php',620 587 ) 621 588 ); … … 644 611 .$conf['top_number'].' '.$lang['most_visited_cat'].'</a>', 645 612 'items' => array_from_query($query, 'id'), 646 'thumbnails_include' => 'include/category_default.inc.php',647 613 ) 648 614 ); … … 671 637 .$conf['top_number'].' '.$lang['best_rated_cat'].'</a>', 672 638 'items' => array_from_query($query, 'id'), 673 'thumbnails_include' => 'include/category_default.inc.php',674 639 ) 675 640 ); … … 695 660 .$lang['random_cat'].'</a>', 696 661 'items' => array_from_query($query, 'id'), 697 'thumbnails_include' => 'include/category_default.inc.php',698 662 ) 699 663 ); … … 710 674 initialize_calendar(); 711 675 } 712 713 $page['cat_nb_images'] = isset($page['items']) ? count($page['items']) : 0;714 676 715 677 if (script_basename() == 'picture' -
trunk/include/ws_functions.inc.php
r1816 r1820 406 406 function ws_categories_getList($params, &$service) 407 407 { 408 global $user ;408 global $user,$conf; 409 409 410 410 $where = array(); 411 $where[]= 'user_id='.$user['id']; 412 if ($params['cat_id']>0) 411 412 if (!$params['recursive']) 413 { 414 if ($params['cat_id']>0) 415 $where[] = '(id_uppercat='.(int)($params['cat_id']).' 416 OR id='.(int)($params['cat_id']).')'; 417 else 418 $where[] = 'id_uppercat IS NULL'; 419 } 420 else if ($params['cat_id']>0) 413 421 { 414 422 $where[] = 'uppercats REGEXP \'(^|,)'. … … 417 425 } 418 426 419 if (!$params['recursive'])420 {421 if ($params['cat_id']>0)422 $where[] = 'id_uppercat='.(int)($params['cat_id']);423 else424 $where[] = 'id_uppercat IS NULL';425 }426 427 427 if ($params['public']) 428 428 { 429 429 $where[] = 'status = "public"'; 430 430 $where[] = 'visible = "true"'; 431 $where[]= 'user_id='.$conf['guest_id']; 431 432 } 432 433 else 433 434 { 434 435 $where[] = 'id NOT IN ('.$user['forbidden_categories'].')'; 436 $where[]= 'user_id='.$user['id']; 435 437 } 436 438 -
trunk/index.php
r1815 r1820 69 69 } 70 70 71 if (isset($page['cat_nb_images']) 72 and $page['cat_nb_images'] > $user['nb_image_page']) 71 if ( count($page['items']) > $user['nb_image_page']) 73 72 { 74 73 $page['navigation_bar'] = create_navigation_bar( 75 74 duplicate_index_url(array(), array('start')), 76 $page['cat_nb_images'],75 count($page['items']), 77 76 $page['start'], 78 77 $user['nb_image_page'], … … 102 101 //-------------------------------------------------------------- category title 103 102 $template_title = $page['title']; 104 if ( isset($page['cat_nb_images']) and $page['cat_nb_images']> 0)105 { 106 $template_title.= ' ['. $page['cat_nb_images'].']';103 if ( count($page['items']) > 0) 104 { 105 $template_title.= ' ['.count($page['items']).']'; 107 106 } 108 107 … … 242 241 243 242 //------------------------------------------------------ main part : thumbnails 244 if (isset($page['thumbnails_include'])) 245 { 246 include(PHPWG_ROOT_PATH.$page['thumbnails_include']); 243 if ( 0==$page['start'] 244 and !isset($page['flat']) 245 and !isset($page['chronology_field']) 246 and ('recent_cats'==$page['section'] or 'categories'==$page['section']) 247 ) 248 { 249 include(PHPWG_ROOT_PATH.'include/category_cats.inc.php'); 250 } 251 if ( !empty($page['items']) ) 252 { 253 include(PHPWG_ROOT_PATH.'include/category_default.inc.php'); 247 254 } 248 255 //------------------------------------------------------- category informations … … 259 266 } 260 267 261 if ( isset($page['cat_nb_images']) and $page['cat_nb_images']> 0268 if ( count($page['items']) > 0 262 269 and $page['section'] != 'most_visited' 263 270 and $page['section'] != 'best_rated') -
trunk/picture.php
r1793 r1820 454 454 455 455 $title = $picture['current']['name']; 456 $title_nb = ($page['current_rank'] + 1).'/'. $page['cat_nb_images'];456 $title_nb = ($page['current_rank'] + 1).'/'.count($page['items']); 457 457 458 458 // metadata -
trunk/template/yoga/index.tpl
r1800 r1820 82 82 83 83 {MONTH_CALENDAR} 84 {CATEGORIES} 84 85 {THUMBNAILS} 85 {CATEGORIES}86 86 87 87 <!-- BEGIN cat_infos -->
Note: See TracChangeset
for help on using the changeset viewer.