Bug #11007 » fluid-paginate-offset.patch

Georg Ringer, 2010-11-22 13:32

View differences:

Classes/ViewHelpers/Widget/Controller/PaginateController.php (working copy)
51 51
	public function initializeAction() {
52 52
		$this->objects = $this->widgetConfiguration['objects'];
53 53
		$this->configuration = t3lib_div::array_merge_recursive_overrule($this->configuration, $this->widgetConfiguration['configuration'], TRUE);
54
		$this->numberOfPages = ceil(count($this->objects) / (integer)$this->configuration['itemsPerPage']);
54
		$query = $this->objects->getQuery();
55
		$this->numberOfPages = ceil((count($this->objects)-$query->getOffset()) / (integer)$this->configuration['itemsPerPage']);
55 56
	}
56 57

  
57 58
	/**
......
72 73
		$query = $this->objects->getQuery();
73 74
		$query->setLimit($itemsPerPage);
74 75
		if ($this->currentPage > 1) {
75
			$query->setOffset((integer)($itemsPerPage * ($this->currentPage - 1)));
76
			$query->setOffset($query->getOffset() + ($itemsPerPage * ($this->currentPage - 1)));
76 77
		}
77 78
		$modifiedObjects = $query->execute();
78 79

  
(1-1/2)