/** * * If an array is supplied, a link is created to a controller/action. If a string is * supplied, a file link is specified. * @param string | array $link * @param array $get */ protected function _link($link, array $get = array()) { return Staple_Link::get($link, $get); }
/** * Generate a relative link within the framework. * @param mixed $route * @param array $get * @return string */ public function link($route, array $get = array()) { return Staple_Link::get($route, $get); }
/** * This function is a temporary fix until the changes are completed to Staple_Route. * @param string $action * @deprecated */ public function displayPaging($action = NULL) { //Setup Link Variables $linkVars = array_merge($_GET, $this->pageVariables); //These two variables would be overridden anyway. if (array_key_exists('items', $linkVars)) { unset($linkVars['items']); } if (array_key_exists('page', $linkVars)) { unset($linkVars['page']); } //Set a default link action location if none is submitted. if ($action == NULL) { $action = Staple_Main::getRoute(); } $buffer = "<div class=\"staple_pager row\">\n<div class=\"staple_pager_pages small-12 medium-11 columns\">\n"; $pages = $this->getPages(); if (count($pages) > 1) { if ($this->getCurrentPage() == 1) { $buffer .= '<a class="button tiny secondary disabled"><i class="fa fa-angle-double-left"></i></a> <a class="button tiny secondary disabled"><i class="fa fa-angle-left"></i></a> '; } elseif ($this->getCurrentPage() > 1) { $buffer .= '<a class="button tiny" href="' . Staple_Link::get($action, array_merge($linkVars, array('page' => 1))) . '"><i class="fa fa-angle-double-left"></i></a> '; $buffer .= '<a class="button tiny" href="' . Staple_Link::get($action, array_merge($linkVars, array('page' => $this->getCurrentPage() - 1))) . '"><i class="fa fa-angle-left"></i></a> '; } if ($pages[0] != 1) { $buffer .= '... '; } foreach ($pages as $page) { if ($this->getCurrentPage() == $page) { $buffer .= '<span class="currentpage button tiny disabled">' . (int) $page . '</span> '; } else { $buffer .= '<a class="button tiny secondary" href="' . Staple_Link::get($action, array_merge($linkVars, array('page' => (int) $page))) . '">' . (int) $page . '</a> '; } } if ($pages[count($pages) - 1] != $this->getNumberOfPages()) { $buffer .= '... '; } if ($this->getCurrentPage() == $this->getNumberOfPages()) { $buffer .= '<a class="button tiny secondary disabled"><i class="fa fa-angle-right"></i></a> <a class="button tiny secondary disabled"><i class="fa fa-angle-double-right"></i></a>'; } else { $buffer .= '<a class="button tiny" href="' . Staple_Link::get($action, array_merge($linkVars, array('page' => $this->getCurrentPage() + 1))) . '"><i class="fa fa-angle-right"></i></a> '; $buffer .= '<a class="button tiny" href="' . Staple_Link::get($action, array_merge($linkVars, array('page' => $this->getNumberOfPages()))) . '"><i class="fa fa-angle-double-right"></i></a>'; } } else { $buffer .= '<a class="button tiny secondary disabled"><i class="fa fa-angle-double-left"></i></a> <a class="button tiny secondary disabled"><i class="fa fa-angle-left"></i></a> <a class="button tiny disabled">1</a> <a class="button tiny secondary disabled"><i class="fa fa-angle-right"></i></a> <a class="button tiny secondary disabled"><i class="fa fa-angle-double-right"></i></a>'; } $buffer .= "</div>\n"; if ($this->getDisplayItemAmountSelector() === true) { $buffer .= "<div class=\"staple_pager_items small-12 medium-1 columns\">\n"; $buffer .= '<select onChange="window.location=\'' . Staple_Link::get($action, array_merge($linkVars, array('page' => 1))) . "&items='+this.value\">\n"; foreach ($this->getItemAmountSelections() as $value) { $selected = ''; if ($this->getItemsPerPage() == $value) { $selected = ' selected'; } $buffer .= '<option value="' . $value . '"' . $selected . '>' . $value . "</option>\n"; } $buffer .= "</select>\n"; $buffer .= "</div>\n"; } $buffer .= "</div>\n"; return $buffer; }