fixed pager
This commit is contained in:
		@@ -160,6 +160,8 @@ function materio_search_api_results_search(){
 | 
			
		||||
      : variable_get('defaultviewmode', 'full');
 | 
			
		||||
 | 
			
		||||
    $limit = variable_get($viewmode.'_limite', '10');
 | 
			
		||||
    // dsm($limit, "limit");
 | 
			
		||||
 | 
			
		||||
    $offset = pager_find_page() * $limit; //$page*$limit;//
 | 
			
		||||
    // dsm($offset, "offset");
 | 
			
		||||
 | 
			
		||||
@@ -314,16 +316,13 @@ function msa_solrquery_materiauxbreves($keys, $language, $user, $offset, $limit)
 | 
			
		||||
  # create items array with the good range
 | 
			
		||||
  $return['items'] = array();
 | 
			
		||||
 | 
			
		||||
  $i = 0;
 | 
			
		||||
  $o = -1;
 | 
			
		||||
  foreach ($return['results'] as $nid => $value) {
 | 
			
		||||
    if( $i < $offset )
 | 
			
		||||
      continue;
 | 
			
		||||
    $o++;
 | 
			
		||||
    if( $o < $offset ) continue;
 | 
			
		||||
    if ($o >= $offset+$limit) break;
 | 
			
		||||
 | 
			
		||||
    $return['items'][$nid] = node_load($nid);
 | 
			
		||||
 | 
			
		||||
    $i++;
 | 
			
		||||
    if ($i > $offset+$limit)
 | 
			
		||||
      break;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  # TODO:  cache the results with cache graceful : http://drupal.org/project/cache_graceful
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user