Changeset 27264


Ignore:
Timestamp:
02/08/14 10:38:41 (5 years ago)
Author:
mistic100
Message:

fix thumbnails pagination, add collections pagination

Location:
extensions/UserCollections/include
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • extensions/UserCollections/include/collections.inc.php

    r26854 r27264  
    2323 
    2424  $template->set_filename('uc_page', realpath(USER_COLLEC_PATH.'template/collections_list.tpl')); 
     25 
     26  $self_url = USER_COLLEC_PUBLIC . 'list'; 
    2527 
    2628  // actions 
  • extensions/UserCollections/include/display_collections.inc.php

    r26854 r27264  
    2929$categories = hash_from_query($query, 'id'); 
    3030 
    31 $template->assign('COLLECTIONS_COUNT', count($categories)); 
     31 
     32// pagination 
     33$page['startcat'] = isset($_GET['startcat']) ? $_GET['startcat'] : 0; 
     34$page['total_categories'] = count($categories); 
     35 
     36$template->assign('COLLECTIONS_COUNT', $page['total_categories']); 
     37 
     38$categories = array_slice( 
     39  $categories, 
     40  $page['startcat'], 
     41  $conf['nb_categories_page'] 
     42  ); 
    3243 
    3344 
    3445// order menu 
    35 if (count($categories)) 
     46if ($page['total_categories']) 
    3647{ 
    3748  $url = add_url_params(USER_COLLEC_PUBLIC, array('uc_collection_order' => '')); 
     
    5566 
    5667// collections details 
    57 if (count($categories)) 
     68if ($page['total_categories']) 
    5869{ 
     70  $categories_id = array_map(create_function('$c', 'return $c["id"];'), $categories); 
     71 
    5972  $query = ' 
    6073SELECT * FROM ( 
     
    6578    INNER JOIN '.COLLECTION_IMAGES_TABLE.' AS ci 
    6679      ON i.id = ci.image_id 
    67     WHERE col_id IN('.implode(',', array_keys($categories)).') 
     80    WHERE col_id IN('.implode(',', $categories_id).') 
    6881    ORDER BY ci.add_date DESC 
    6982  ) AS t 
     
    115128    )); 
    116129 
     130  // navigation bar 
     131  $page['cats_navigation_bar'] = array(); 
     132  if ($page['total_categories'] > $conf['nb_categories_page']) 
     133  { 
     134    $page['cats_navigation_bar'] = create_navigation_bar( 
     135      $self_url, 
     136      $page['total_categories'], 
     137      $page['startcat'], 
     138      $conf['nb_categories_page'], 
     139      false, 'startcat' 
     140      ); 
     141 
     142    $template->assign('cats_navbar', $page['cats_navigation_bar'] ); 
     143  } 
     144 
    117145  $template->set_filename('index_category_thumbnails', 'mainpage_categories.tpl'); 
    118146  $template->assign_var_from_handle('CATEGORIES', 'index_category_thumbnails'); 
  • extensions/UserCollections/include/display_thumbnails.inc.php

    r25678 r27264  
    7474    false 
    7575    ); 
    76   $template->assign('navbar', $page['navigation_bar']); 
     76 
     77  $template->assign('thumb_navbar', $page['navigation_bar']); 
    7778} 
    7879 
Note: See TracChangeset for help on using the changeset viewer.