PaginatorHelper Class Info:
- Class Declaration:
- class PaginatorHelper extends AppHelper
- File name:
- cake/libs/view/helpers/paginator.php
- Summary:
- Pagination Helper class for easy generation of pagination links. PaginationHelper encloses all methods needed when working with pagination.
- Class Inheritance
- package
- cake
- subpackage
- cake.cake.libs.view.helpers
Properties:
Show/Hide parent properties
| public | action | Current action. |
| public | argSeparator | URL argument separator character |
| public | base | Base URL |
| public | data | POST data for models |
| public | __defaultModel | Holds the default model for paged recordsets |
| public | helpers | Helper dependencies |
| public | here | URL to current action. |
| protected | _log | Log object |
| public | namedArgs | List of named arguments |
| public | options | Holds the default options for pagination links The values that may be specified are: - <i>$options['format']</i> Format of the counter. Supported formats are 'range' and 'pages' and custom (default). In the default mode the supplied string is parsed and constants are replaced by their actual values. Constants: %page%, %pages%, %current%, %count%, %start%, %end% . - <i>$options['separator']</i> The separator of the actual page and number of pages (default: ' of '). - <i>$options['url']</i> Url of the action. See Router::url() - <i>$options['url']['sort']</i> the key that the recordset is sorted. - <i>$options['url']['direction']</i> Direction of the sorting (default: 'asc'). - <i>$options['url']['page']</i> Page # to display. - <i>$options['model']</i> The name of the model. - <i>$options['escape']</i> Defines if the title field for the link should be escaped (default: true). - <i>$options['update']</i> DOM id of the element updated with the results of the AJAX call. If this key isn't specified Paginator will use plain HTML links. - <i>$options['indicator']</i> DOM id of the element that will be shown when doing AJAX requests. |
| public | params | Parameter array. |
| public | plugin | Plugin path |
| public | tags | Holds tag templates. |
| public | themeWeb | Theme name |
| public | validationErrors | Contains model validation errors of form post-backs |
| public | webroot | Webroot path |
Method Summary:
Show/Hide parent methods
addClass
topAdds the given class to the element options
- Parameters:
-
$options array optional array ( ) $class string optional NULL $key string optional 'class' - Method defined in class:
- Helper
- Method defined in file:
- cake/libs/view/helper.php on line 642
- return
- array
afterLayout
topAfter layout callback. Overridden in subclasses.
- Method defined in class:
- Helper
- Method defined in file:
- cake/libs/view/helper.php on line 683
afterRender
topAfter render callback. Overridden in subclasses.
- Method defined in class:
- Helper
- Method defined in file:
- cake/libs/view/helper.php on line 671
beforeLayout
topBefore layout callback. Overridden in subclasses.
- Method defined in class:
- Helper
- Method defined in file:
- cake/libs/view/helper.php on line 677
beforeRender
topBefore render callback. Overridden in subclasses.
- Method defined in class:
- Helper
- Method defined in file:
- cake/libs/view/helper.php on line 665
cakeError
topUsed to report user friendly errors.
If there is a file app/error.php or app/app_error.php this file will be loaded
error.php is the AppError class it should extend ErrorHandler class.
- Parameters:
-
$method string Method to be called in the error class (AppError or ErrorHandler classes) required (no default) $messages array Message that is to be displayed by the error class optional array ( ) - Method defined in class:
- Object
- Method defined in file:
- cake/libs/object.php on line 189
- return
- error message
- access
- public
call__
top- Parameters:
-
$method required (no default) $params required (no default) - Method defined in class:
- Helper
- Method defined in file:
- cake/libs/view/helper.php on line 142
clean
topUsed to remove harmful tags from content
- Parameters:
-
$output mixed required (no default) - Method defined in class:
- Helper
- Method defined in file:
- cake/libs/view/helper.php on line 214
- return
- cleaned content for output
- access
- public
__construct
topClass constructor, overridden in descendant classes.
- Method defined in class:
- Object
- Method defined in file:
- cake/libs/object.php on line 63
counter
topReturns a counter string for the paged result set
- Parameters:
-
$options mixed Options for the counter string. See #options for list of keys. optional array ( ) - Method defined in class:
- PaginatorHelper
- Method defined in file:
- cake/libs/view/helpers/paginator.php on line 393
- return
- string Counter string.
current
topGets the current page of the recordset for the given model
- Parameters:
-
$model string Optional model name. Uses the default if none is specified. optional NULL - Method defined in class:
- PaginatorHelper
- Method defined in file:
- cake/libs/view/helpers/paginator.php on line 119
- return
- string The current page number of the recordset.
defaultModel
topGets the default model of the paged sets
- Method defined in class:
- PaginatorHelper
- Method defined in file:
- cake/libs/view/helpers/paginator.php on line 377
- return
- string Model name or null if the pagination isn't initialized.
dispatchMethod
topCalls a method on this object with the given parameters. Provides an OO wrapper
for call_user_func_array, and improves performance by using straight method calls
in most cases.
- Parameters:
-
$method string Name of the method to call required (no default) $params array Parameter list to use when calling $method optional array ( ) - Method defined in class:
- Object
- Method defined in file:
- cake/libs/object.php on line 113
- return
- mixed Returns the result of the method call
- access
- public
domId
topGenerates a DOM ID for the selected element, if one is not set.
- Parameters:
-
$options mixed optional NULL $id string optional 'id' - Method defined in class:
- Helper
- Method defined in file:
- cake/libs/view/helper.php on line 483
- return
- mixed
field
topGets the currently-used model field of the rendering context.
- Method defined in class:
- Helper
- Method defined in file:
- cake/libs/view/helper.php on line 445
- return
- string
first
topReturns a first or set of numbers for the first pages
- Parameters:
-
$first mixed if string use as label for the link, if numeric print page numbers optional '<< first' $options mixed if string use as label for the link, if numeric print page numbers optional array ( ) - Method defined in class:
- PaginatorHelper
- Method defined in file:
- cake/libs/view/helpers/paginator.php on line 560
- return
- string numbers string.
get__
topDefault overload methods
- Parameters:
-
$name required (no default) - Method defined in class:
- Helper
- Method defined in file:
- cake/libs/view/helper.php on line 140
- access
- protected
hasNext
topReturns true if the given result set is not at the last page
- Parameters:
-
$model string Optional model name. Uses the default if none is specified. optional NULL - Method defined in class:
- PaginatorHelper
- Method defined in file:
- cake/libs/view/helpers/paginator.php on line 341
- return
- boolean True if the result set is not at the last page.
__hasPage
topProtected method
- Parameters:
-
$model required (no default) $page required (no default) - Method defined in class:
- PaginatorHelper
- Method defined in file:
- cake/libs/view/helpers/paginator.php on line 363
hasPage
topReturns true if the given result set has the page number given by $page
- Parameters:
-
$model string Optional model name. Uses the default if none is specified. optional NULL $page int The page number - if not set defaults to 1. optional 1 - Method defined in class:
- PaginatorHelper
- Method defined in file:
- cake/libs/view/helpers/paginator.php on line 351
- return
- boolean True if the given result set has the specified page number.
hasPrev
topReturns true if the given result set is not at the first page
- Parameters:
-
$model string Optional model name. Uses the default if none is specified. optional NULL - Method defined in class:
- PaginatorHelper
- Method defined in file:
- cake/libs/view/helpers/paginator.php on line 332
- return
- boolean True if the result set is not at the first page.
_initInputField
topSets the defaults for an input tag
- Parameters:
-
$field required (no default) $options array optional array ( ) - Method defined in class:
- Helper
- Method defined in file:
- cake/libs/view/helper.php on line 621
- return
- array
- access
- protected
last
topReturns a last or set of numbers for the last pages
- Parameters:
-
$last mixed if string use as label for the link, if numeric print page numbers optional 'last >>' $options mixed if string use as label for the link, if numeric print page numbers optional array ( ) - Method defined in class:
- PaginatorHelper
- Method defined in file:
- cake/libs/view/helpers/paginator.php on line 604
- return
- string numbers string.
link
topGenerates a plain or Ajax link with pagination parameters
- Parameters:
-
$title string Title for the link. required (no default) $url mixed Url for the action. See Router::url() optional array ( ) $options array Options for the link. See #options for list of keys. optional array ( ) - Method defined in class:
- PaginatorHelper
- Method defined in file:
- cake/libs/view/helpers/paginator.php on line 250
- return
- string A link with pagination parameters.
loadConfig
topParses tag templates into $this->tags.
- Parameters:
-
$name optional 'tags' - Method defined in class:
- Helper
- Method defined in file:
- cake/libs/view/helper.php on line 152
- return
- array merged tags from config/$name.php
log
topAPI for logging events.
- Parameters:
-
$msg string Log message required (no default) $type integer Error type constant. Defined in app/config/core.php. optional 2 - Method defined in class:
- Object
- Method defined in file:
- cake/libs/object.php on line 150
- return
- boolean Success of log write
- access
- public
model
topGets the currently-used model of the rendering context.
- Method defined in class:
- Helper
- Method defined in file:
- cake/libs/view/helper.php on line 423
- return
- string
modelID
topGets the ID of the currently-used model of the rendering context.
- Method defined in class:
- Helper
- Method defined in file:
- cake/libs/view/helper.php on line 436
- return
- mixed
__name
topGets the input field name for the current tag
- Parameters:
-
$options array optional array ( ) $field optional NULL $key string optional 'name' - Method defined in class:
- Helper
- Method defined in file:
- cake/libs/view/helper.php on line 510
- return
- array
next
topGenerates a "next" link for a set of paged records
- Parameters:
-
$title string Title for the link. Defaults to 'Next >>'. optional 'Next >>' $options mixed Options for pagination link. See #options for list of keys. optional array ( ) $disabledTitle string Title when the link is disabled. optional NULL $disabledOptions mixed Options for the disabled pagination link. See #options for list of keys. optional array ( ) - Method defined in class:
- PaginatorHelper
- Method defined in file:
- cake/libs/view/helpers/paginator.php on line 206
- return
- string A "next" link or or $disabledTitle text if the link is disabled.
numbers
topReturns a set of numbers for the paged result set
uses a modulus to decide how many numbers to show on each side of the current page (default: 8)
- Parameters:
-
$options mixed Options for the numbers, (before, after, model, modulus, separator) optional array ( ) - Method defined in class:
- PaginatorHelper
- Method defined in file:
- cake/libs/view/helpers/paginator.php on line 450
- return
- string numbers string.
Object
topA hack to support __construct() on PHP 4
Hint: descendant classes have no PHP4 class_name() constructors,
so this constructor gets called first and calls the top-layer __construct()
which (if present) should call parent::__construct()
- Method defined in class:
- Object
- Method defined in file:
- cake/libs/object.php on line 53
- return
- Object
options
topSets default options for all pagination links
is used as the DOM id element to update. See #options for list of keys.
- Parameters:
-
$options mixed Default options for pagination links. If a string is supplied - it optional array ( ) - Method defined in class:
- PaginatorHelper
- Method defined in file:
- cake/libs/view/helpers/paginator.php on line 90
output
topReturns a string generated by a helper method
This method can be overridden in subclasses to do generalized output post-processing
- Parameters:
-
$str string String to be output. required (no default) - Method defined in class:
- Helper
- Method defined in file:
- cake/libs/view/helper.php on line 658
- return
- string
overload
topOverload implementation. No need for implementation in PHP5.
- Method defined in class:
- Overloadable
- Method defined in file:
- cake/libs/overloadable_php5.php on line 39
- access
- public
__pagingLink
topProtected method for generating prev/next links
- Parameters:
-
$which required (no default) $title optional NULL $options optional array ( ) $disabledTitle optional NULL $disabledOptions optional array ( ) - Method defined in class:
- PaginatorHelper
- Method defined in file:
- cake/libs/view/helpers/paginator.php on line 299
params
topGets the current paging parameters from the resultset for the given model
- Parameters:
-
$model string Optional model name. Uses the default if none is specified. optional NULL - Method defined in class:
- PaginatorHelper
- Method defined in file:
- cake/libs/view/helpers/paginator.php on line 75
- return
- array The array of paging parameters for the paginated resultset.
_parseAttributes
topReturns a space-delimited string with items of the $options array. If a
key of $options array happens to be one of:
+ 'compact'
+ 'checked'
+ 'declare'
+ 'readonly'
+ 'disabled'
+ 'selected'
+ 'defer'
+ 'ismap'
+ 'nohref'
+ 'noshade'
+ 'nowrap'
+ 'multiple'
+ 'noresize'
And its value is one of:
+ 1
+ true
+ 'true'
Then the value will be reset to be identical with key's name.
If the value is not one of these 3, the parameter is not output.
- Parameters:
-
$options array Array of options. required (no default) $exclude array Array of options to be excluded. optional NULL $insertBefore string String to be inserted before options. optional ' ' $insertAfter string String to be inserted ater options. optional NULL - Method defined in class:
- Helper
- Method defined in file:
- cake/libs/view/helper.php on line 260
- return
- string
_persist
topChecks for a persistent class file, if found file is opened and true returned
If file is not found a file is created and false returned
If used in other locations of the model you should choose a unique name for the persistent file
There are many uses for this method, see manual for examples
- Parameters:
-
$name string name of the class to persist required (no default) $return required (no default) $object string the object to persist required (no default) $type optional NULL - Method defined in class:
- Object
- Method defined in file:
- cake/libs/object.php on line 219
- return
- boolean Success
- access
- protected
- todo
- add examples to manual
prev
topGenerates a "previous" link for a set of paged records
- Parameters:
-
$title string Title for the link. Defaults to '<< Previous'. optional '<< Previous' $options mixed Options for pagination link. See #options for list of keys. optional array ( ) $disabledTitle string Title when the link is disabled. optional NULL $disabledOptions mixed Options for the disabled pagination link. See #options for list of keys. optional array ( ) - Method defined in class:
- PaginatorHelper
- Method defined in file:
- cake/libs/view/helpers/paginator.php on line 194
- return
- string A "previous" link or $disabledTitle text if the link is disabled.
requestAction
topCalls a controller's method from any location.
- Parameters:
-
$url mixed String or array-based url. required (no default) $extra array if array includes the key "return" it sets the AutoRender to true. optional array ( ) - Method defined in class:
- Object
- Method defined in file:
- cake/libs/object.php on line 86
- return
- mixed Boolean true or false on success/failure, or contents of rendered action if 'return' is set in $extra.
- access
- public
_savePersistent
topYou should choose a unique name for the persistent file
There are many uses for this method, see manual for examples
- Parameters:
-
$name string name used for object to cache required (no default) $object object the object to persist required (no default) - Method defined in class:
- Object
- Method defined in file:
- cake/libs/object.php on line 247
- return
- boolean true on save, throws error if file can not be created
- access
- protected
_set
topAllows setting of multiple properties of the object in a single line of code.
- Parameters:
-
$properties array An associative array containing properties and corresponding values. optional array ( ) - Method defined in class:
- Object
- Method defined in file:
- cake/libs/object.php on line 169
- return
- void
- access
- protected
set__
top- Parameters:
-
$name required (no default) $value required (no default) - Method defined in class:
- Helper
- Method defined in file:
- cake/libs/view/helper.php on line 141
setEntity
topSets this helper's model and field properties to the dot-separated value-pair in $entity.
- Parameters:
-
$entity mixed A field name, like "ModelName.fieldName" or "ModelName.ID.fieldName" required (no default) $setScope boolean Sets the view scope to the model specified in $tagValue optional false - Method defined in class:
- Helper
- Method defined in file:
- cake/libs/view/helper.php on line 311
- return
- void
sort
topGenerates a sorting link
- Parameters:
-
$title string Title for the link. required (no default) $key string The name of the key that the recordset should be sorted. optional NULL $options array Options for sorting link. See #options for list of keys. optional array ( ) - Method defined in class:
- PaginatorHelper
- Method defined in file:
- cake/libs/view/helpers/paginator.php on line 218
- return
- string A link sorting default by 'asc'. If the resultset is sorted 'asc' by the specified key the returned link will sort by 'desc'.
sortDir
topGets the current direction the recordset is sorted
- Parameters:
-
$model string Optional model name. Uses the default if none is specified. optional NULL $options mixed Options for pagination links. See #options for list of keys. optional array ( ) - Method defined in class:
- PaginatorHelper
- Method defined in file:
- cake/libs/view/helpers/paginator.php on line 166
- return
- string The direction by which the recordset is being sorted, or null if the results are not currently sorted.
sortKey
topGets the current key by which the recordset is sorted
- Parameters:
-
$model string Optional model name. Uses the default if none is specified. optional NULL $options mixed Options for pagination links. See #options for list of keys. optional array ( ) - Method defined in class:
- PaginatorHelper
- Method defined in file:
- cake/libs/view/helpers/paginator.php on line 135
- return
- string The name of the key by which the recordset is being sorted, or null if the results are not currently sorted.
_stop
topStop execution of the current script
- Parameters:
-
$status optional 0 - Method defined in class:
- Object
- Method defined in file:
- cake/libs/object.php on line 139
- return
- void
- access
- public
tagIsInvalid
topReturns false if given FORM field has no errors. Otherwise it returns the constant set in the array Model->validationErrors.
- Parameters:
-
$model string Model name as string optional NULL $field string Fieldname as string optional NULL $modelID integer Unique index identifying this record within the form optional NULL - Method defined in class:
- Helper
- Method defined in file:
- cake/libs/view/helper.php on line 457
- return
- boolean True on errors.
toString
topObject-to-string conversion.
Each class can override this method as necessary.
- Method defined in class:
- Object
- Method defined in file:
- cake/libs/object.php on line 73
- return
- string The name of this class
- access
- public
url
topMerges passed URL options with current pagination state to generate a pagination URL.
- Parameters:
-
$options array Pagination/URL options array optional array ( ) $asArray boolean Pagination/URL options array optional false $model string Which model to paginate on optional NULL - Method defined in class:
- PaginatorHelper
- Method defined in file:
- cake/libs/view/helpers/paginator.php on line 277
- return
- mixed By default, returns a full pagination URL string for use in non-standard contexts (i.e. JavaScript)
value
topGets the data for the current tag
- Parameters:
-
$options array optional array ( ) $field optional NULL $key string optional 'value' - Method defined in class:
- Helper
- Method defined in file:
- cake/libs/view/helper.php on line 552
- return
- array
- access
- public
webroot
topChecks if a file exists when theme is used, if no file is found default location is returned
- Parameters:
-
$file string required (no default) - Method defined in class:
- Helper
- Method defined in file:
- cake/libs/view/helper.php on line 186
- return
- string $webPath web path to file.