/** * Redirect to a given URL. * @param string $filename * @param View $view */ public function __construct($filename, View $view) { $quoted = sprintf('"%s"', addcslashes(basename($filename), '"\\')); header('Content-Description: File Transfer'); header('Content-Disposition: attachment; filename=' . $quoted); header('Content-Transfer-Encoding: binary'); header('Connection: Keep-Alive'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); $contents = $view->render(); $size = strlen($contents); header('Content-Length: ' . $size); echo $contents; }
/** * Return the view that contains the pagination. * * @return View */ public function getView() { if ($this->pages < 1) { $this->pages = 1; } if ($this->page < 1 || $this->page > $this->pages) { $this->page = 1; } $view = new View(__DIR__ . '/Pagination/View'); $view->setParams($this->getViewParams()); return $view; }