/** * Initialize the content, to hold the paging preferences for the given * table name in the current page. * This will attempt to retreive the paging info preferences from the session * and from the Request. If the Request overrode the Session, the preferences * will be set back into the session. * * @param Context $ctx * @param String $tableName */ private function init($ctx, $tableName) { // Initialize the main area for the paging preferences on the session. if (!isset($_SESSION['tablePagingPrefs'])) { $_SESSION['tablePagingPrefs'] = array(); } $key = Application::getPathInfo() . ':' . $tableName; // Initialize this table's preferences area on the session if (!isset($_SESSION['tablePagingPrefs'][$key])) { $_SESSION['tablePagingPrefs'][$key] = array(); } $sessionTablePrefs = $_SESSION['tablePagingPrefs'][$key]; $this->setDefaults($sessionTablePrefs); $requestPrefs = $this->getPrefsFromRequest($ctx); // Override session vals with Request vals, and set local fields. // Then store session (if there were any changes) if ($this->overrideIfSet($sessionTablePrefs, $requestPrefs)) { // Update session $this->updateSession($key, $sessionTablePrefs); } $this->setFields($sessionTablePrefs); }
/** * @return Href */ public static function current() { $pathInfo = '/' . Application::getPathInfo(); $href = self::from_url($pathInfo); return $href; }