Class: Pager

Pager is a list paging package (ie. "<< Previous Page | 1 | 2 | 3 | Next Page >>").
It is very easy to use, and also includes numerous convenience templates that can
be built off of or used directly so that very little code or markup is needed.



Properties


$template

  • Access: public

The template to use to generate the menu item.


$fill

  • Access: public

The object or associative array to use to fill the template with upon
calling render().


$span

  • Access: public

The span of this cell. Set to -1 and the cell will disappear. Use
$this->attrs['colspan'] or ['rowspan'] to set these properties in the
corresponding HTML <td> tag.


$attrs = array ()

  • Access: public

Contains all HTML <td> properties for the current object.


$default

  • Access: public

$default is an optional default value to place in cells whose
templates result in no output.


$type = 'db'


$collection


$limit


$fields


$total = 0


$list = false


$remember = array ()


$skipHeaders = array ()


$header = ''


$footer = ''


$editUrl = false


$addUrl = false


$deleteUrl = false


$error

  • Access: public

Contains the most recent error message if an error has occurred,
false otherwise.


$name

  • Access: public

The name of the menu.


$xpos

  • Access: public

The distance from the left edge of the browser window to display
the menu in collapsible display mode. Default is 0.


$ypos

  • Access: public

The distance from the top edge of the browser window to display
the menu in collapsible display mode. Default is 0.


$menuWidth

  • Access: public

The width of the drop menu this item is a part of. Used for
inheriting to a child menu.


$lineHeight

  • Access: public

The height of this item and each item in its parent drop menu.
Used for inheriting to a child menu.


$itemTemplate

  • Access: public

The template used to draw each drop menu item.


$direction = 'right'

  • Access: public

The direction of the drop menu this item is a part of. Used for
inheriting to a child menu.


$items = array ()

  • Access: public

An array of DropMenuItem objects


$extraMouseOver = ''

  • Access: public

Optional extra JavaScript to call when the item is in focus.


$extraMouseOut = ''

  • Access: public

Optional extra JavaScript to call when the item loses focus.


$text

  • Access: public

The text of the menu item.


$link

  • Access: public

The URL to link this item to.


$menu_tpl

  • Access: public

The menu template to use to generate child drop menus.


$child

  • Access: public

The child DropMenu object of this item.


$mouseover

  • Access: private

The private mouseover data detailing this item's behaviour.


$matrix = array ()

  • Access: public

Contains the grid.


$table

  • Access: public

The name of the database table (if any) that this menu is being
pulled from.


$row = array ()

  • Access: public

Contains all HTML <tr> properties for the current object.


$cell = array ()

  • Access: public

Contains all HTML <td> properties for the current object,
if this layout is not the top-level layout object.


$tree

  • Access: public

Contains a multi-dimensional array of MenuItem objects.


$idcolumn

  • Access: public

The name of the column in the database table that contains the
primary key values.


$showcolumn

  • Access: public

The name of the column in the database table that is to be
displayed.


$refcolumn

  • Access: public

The name of the column in the database table that makes a
self-reference to the primary key, or id, column.


$listcolumn

  • Access: public

The name of the column in the database table that says
whether or not to display each record as an item.


$sortcolumn

  • Access: public

The field to sort by, in case of a sort field. A sort field outweighs
the default sorting alphabetically.


$sortorder

  • Access: public

The sort order, either 'ASC' (ascending) or 'DESC' (descending).


$sitelliteAllowed

  • Access: public

Specifies whether or not to use the global $sitellite object
(from the Sitellite CMS-only package saf.App.Conf.Sitellite) to add
automatic permission limits on the database query. For more information,
see saf.App.Conf.Sitellite in DocReader.


$cache = false


$cacheLocation = 'cache/.menu'


$closedPic

  • Access: public

The path to the image to use for the'"closed' graphic in the
collapsible display mode. Defaults to '/pix/false.gif'.


$openedPic

  • Access: public

The path to the image to use for the'"opened' graphic in the
collapsible display mode. Defaults to '/pix/true.gif'.


$hideValue

  • Access: public

The value that the database column in $listcolumn is supposed
to contain when a field is not to be shown. Defaults to 'no'.


$colours

  • Access: public

An array of background colours for this item, which is the
same as the $colours property of saf.GUI.Menu.


$jsDir

  • Access: public

The directory to find the JavaScript for the collapsible view
in. Default is '/js'.


$includedJs

  • Access: public

Remembers whether or not the JavaScript for the collapsible
display mode has been included yet or not.


$initFunc

  • Access: public

The name of the JavaScript init() function for this menu.
Different menus on the same page need separate init() functions.
The default is 'saf_xbinit_' plus the name of the database table
linked to this menu.


$id

  • Access: public

The (usually) unique id of this item.


$title

  • Access: public

The title of this item.


$parent

  • Access: public

A reference to the parent of this item, or false if there
is no parent.


$children

  • Access: public

An array of child items.


$url

URL prefix for pager links.

Return to Top



Methods


Pager ($offset = 0, $limit = 20, $total = 0, $maxPages = 5)

Constructor method.



_translate ()


getInfo ()

  • Return: array hash

Calculates the pager info and returns it as an associative array.
Also stores it internally as properties of the object, for use
in the included simple templates.


update ()

  • Return: array hash

Alias for getInfo().


getPages ($max = true)

  • Return: array

Creates a two-dimensional array of pages to be displayed. The inner
arrays contain the following keys:

- page (page number)
- offset (offset of this page)
- separator (boolean, whether to display a separator next to this page or not)
- current (boolean, whether this is the currently active page)


query ($sql, $bind = false)

  • Return: array of objects

Returns a database query's results, limited by Pager's current
$limit and $offset settings. Also sets the $total property
and calls getInfo().


setData (&$data)

This method allows you to set external data instead of using the
query() method. Note that you must set $total and call update()
yourself after calling this method.


_uenc ($list)

  • Access: private
  • Return: array

urlencode()'s each value in an array and returns the array.


setUrl ($url)

Special setter for the $url property. Accepts a variable number
of arguments, the first of which is the format string (the URL
itself with %s as placeholders for values). The arguments to
pass to the format string (uses vsprintf() to do so) can be
specified in one of three ways:
- by passing an array as the 2nd parameter
- by passing an object as the 2nd parameter (which is then cast
into an array for you)
- by passing an arbitrary number of additional parameters
separately.

The benefit here is that the arguments are sent through the
urlencode() function before being inserted into the URL string,
which adds some extra semi-automatic security pour tous.

Return to Top

Copyright © 2008 Sitellite CMS Project

Powered by Sitellite 5.0 Content Management System