Open Journal Systems  2.4.4
 All Classes Namespaces Functions Variables Groups Pages
GridHandler Class Reference
Inheritance diagram for GridHandler:
PKPHandler CategoryGridHandler ListbuilderHandler PKPCitationGridHandler PKPFilterGridHandler MultipleListsListbuilderHandler CitationGridHandler FilterGridHandler LookupFilterGridHandler ParserFilterGridHandler

Public Member Functions

 _addFeatures ($features)
 
 _fixColumnWidths ()
 
_getInitializedRowInstance (&$request, $elementId, &$element, $isModified=false)
 
 _renderCellInternally (&$request, &$row, &$column)
 
 _renderGridBodyPartsInternally (&$request)
 
 _renderRowsInternally (&$request, &$elements)
 
 addAction ($action, $position=GRID_ACTION_POSITION_ABOVE)
 
 addColumn (&$column)
 
 authorize (&$request, &$args, $roleAssignments)
 
 callFeaturesHook ($hookName, $args)
 
 doSpecificFetchGridActions ($args, &$request, &$templateMgr)
 
 fetchCell (&$args, &$request)
 
 fetchGrid ($args, &$request)
 
 fetchRow (&$args, &$request)
 
 getActions ($position=GRID_ACTION_POSITION_ABOVE)
 
getColumn ($columnId)
 
getColumns ()
 
getColumnsByFlag ($flag)
 
 getColumnsCount ($flag)
 
getDataElementFromRequest (&$request, &$elementId)
 
getDataProvider ()
 
 getEmptyRowText ()
 
 getFeatures ()
 
 getFilterForm ()
 
 getFilterSelectionData ($request)
 
 getFootNote ()
 
getGridDataElements ($request)
 
 getInstructions ()
 
 getIsSubcomponent ()
 
 getJSHandler ()
 
 getPublishChangeEvents ()
 
 getRangeInfo ($rangeName, $contextData=null)
 
 getRequestArg ($key)
 
 getRequestArgs ()
 
getRequestedRow ($request, $args)
 
 getRowDataElement ($request, $rowId)
 
 getRowDataElementSequence (&$gridDataElement)
 
getRowInstance ()
 
 getTemplate ()
 
 getTitle ()
 
 getUrls ()
 
 GridHandler ($dataProvider=null)
 
 hasColumn ($columnId)
 
 hasGridDataElements ($request)
 
 initFeatures (&$request, $args)
 
 initialize (&$request, $args=null)
 
loadData (&$request, $filter)
 
 noAutocompleteResults ()
 
 renderFilter ($request, $filterData=array())
 
 renderRowInternally (&$request, &$row)
 
 saveRowDataElementSequence (&$request, $rowId, &$gridDataElement, $newSequence)
 
 saveSequence ($args, &$request)
 
 setEmptyRowText ($emptyRowText)
 
 setFirstDataColumn ()
 
 setFootNote ($footNote)
 
 setGridDataElements (&$data)
 
 setInstructions ($instructions)
 
 setTemplate ($template)
 
 setTitle ($title)
 
 setUrls (&$request, $extraUrls=array())
 
- Public Member Functions inherited from PKPHandler
 addCheck (&$handlerValidator)
 
 addPolicy (&$authorizationPolicy, $addToTop=false)
 
 addRoleAssignment ($roleIds, $operations)
 
 authorize (&$request, &$args, $roleAssignments)
 
getAuthorizedContext ()
 
getAuthorizedContextObject ($assocType)
 
getDispatcher ()
 
 getId ()
 
 getLastAuthorizationMessage ()
 
 getLoginExemptions ()
 
getRangeInfo ($rangeName, $contextData=null)
 
 getRoleAssignment ($roleId)
 
 getRoleAssignments ()
 
 hashPageContext ($contextData=array())
 
 index ()
 
 initialize (&$request, $args=null)
 
 PKPHandler ()
 
 requireSSL ()
 
 setDispatcher (&$dispatcher)
 
 setId ($id)
 
 validate ($requiredContexts=null, $request=null)
 

Detailed Description

Class defining basic operations for handling HTML grids.

Definition at line 36 of file GridHandler.inc.php.

Member Function Documentation

GridHandler::_addFeatures (   $features)

Add grid features.

Parameters
$featuresarray

Definition at line 993 of file GridHandler.inc.php.

Referenced by initialize().

GridHandler::_fixColumnWidths ( )

Method that grabs all the existing columns and makes sure the column widths add to exactly 100 N.B. We do some extra column fetching because PHP makes copies of arrays with foreach.

Definition at line 960 of file GridHandler.inc.php.

References getColumn(), and getColumns().

Referenced by doSpecificFetchGridActions().

& GridHandler::_getInitializedRowInstance ( $request,
  $elementId,
$element,
  $isModified = false 
)

Instantiate a new row.

Parameters
$requestRequest
$elementIdstring
$elementmixed
$isModifiedboolean optional
Returns
GridRow

Definition at line 864 of file GridHandler.inc.php.

References callFeaturesHook(), PKPHandler\getId(), getRequestArgs(), and getRowInstance().

Referenced by _renderRowsInternally(), and getRequestedRow().

GridHandler::_renderCellInternally ( $request,
$row,
$column 
)

Method that renders a cell.

NB: You must have initialized the row before you call this method.

Parameters
$requestPKPRequest
$rowGridRow
$columnGridColumn
Returns
string the cell HTML

Definition at line 933 of file GridHandler.inc.php.

Referenced by fetchCell(), and renderRowInternally().

GridHandler::_renderGridBodyPartsInternally ( $request)

Method that renders tbodys to go in the grid main body.

Parameters
Request$request
Returns
array

Definition at line 884 of file GridHandler.inc.php.

References _renderRowsInternally(), and getGridDataElements().

Referenced by doSpecificFetchGridActions().

GridHandler::_renderRowsInternally ( $request,
$elements 
)

Cycle through the data and get generate the row HTML.

Parameters
$requestPKPRequest
$elementsarray The grid data elements to be rendered.
Returns
array of HTML Strings for Grid Rows.

Definition at line 906 of file GridHandler.inc.php.

References _getInitializedRowInstance(), and renderRowInternally().

Referenced by CategoryGridHandler\_renderCategoryInternally(), MultipleListsListbuilderHandler\_renderGridBodyPartsInternally(), and _renderGridBodyPartsInternally().

GridHandler::addAction (   $action,
  $position = GRID_ACTION_POSITION_ABOVE 
)

Add an action.

Parameters
$positionstring The position of the action.
$actionMixed a single action.

Definition at line 210 of file GridHandler.inc.php.

Referenced by ListbuilderHandler\initialize(), PKPCitationGridHandler\initialize(), and PKPFilterGridHandler\initialize().

GridHandler::addColumn ( $column)

Add a column.

Parameters
$columnmixed A single GridColumn instance.

Definition at line 279 of file GridHandler.inc.php.

Referenced by CategoryGridHandler\CategoryGridHandler(), PKPCitationGridHandler\initialize(), and PKPFilterGridHandler\initialize().

GridHandler::authorize ( $request,
$args,
  $roleAssignments 
)
GridHandler::callFeaturesHook (   $hookName,
  $args 
)

Call the passed hook in all attached features.

Parameters
$hookNamestring
$argsarray Arguments provided by this handler.

Definition at line 810 of file GridHandler.inc.php.

References getFeatures().

Referenced by CategoryGridHandler\_getInitializedCategoryRowInstance(), _getInitializedRowInstance(), fetchGrid(), initialize(), and saveSequence().

GridHandler::doSpecificFetchGridActions (   $args,
$request,
$templateMgr 
)

Override this method if your subclass needs to perform different actions than the ones implemented here. This method is called by GridHandler::fetchGrid()

Parameters
$argsarray
$requestRequest

Definition at line 771 of file GridHandler.inc.php.

References _fixColumnWidths(), and _renderGridBodyPartsInternally().

Referenced by fetchGrid().

GridHandler::fetchCell ( $args,
$request 
)

Render a cell and send it to the client

Parameters
$argsarray
$requestRequest
Returns
string the serialized cell JSON message

Definition at line 519 of file GridHandler.inc.php.

References _renderCellInternally(), getColumn(), getRequestedRow(), hasColumn(), and setFirstDataColumn().

GridHandler::fetchGrid (   $args,
$request 
)

Render the entire grid controller and send it to the client.

Parameters
$argsarray
$requestRequest
Returns
string the serialized grid JSON message

Definition at line 454 of file GridHandler.inc.php.

References callFeaturesHook(), doSpecificFetchGridActions(), getColumns(), getFeatures(), getRequestArgs(), renderFilter(), setFirstDataColumn(), and setUrls().

Referenced by ListbuilderHandler\fetch().

GridHandler::fetchRow ( $args,
$request 
)

Render a row and send it to the client. If the row no longer exists then inform the client.

Parameters
$argsarray
$requestRequest
Returns
string the serialized row JSON message or a flag that indicates that the row has not been found.

Definition at line 494 of file GridHandler.inc.php.

References getRequestedRow(), renderRowInternally(), and setFirstDataColumn().

GridHandler::getActions (   $position = GRID_ACTION_POSITION_ABOVE)

Get all actions for a given position within the grid.

Parameters
$positionstring The position of the actions.
Returns
array The LinkActions for the given position.

Definition at line 200 of file GridHandler.inc.php.

& GridHandler::getColumn (   $columnId)

Retrieve a single column by id.

Parameters
$columnId
Returns
GridColumn

Definition at line 228 of file GridHandler.inc.php.

Referenced by _fixColumnWidths(), and fetchCell().

& GridHandler::getColumnsByFlag (   $flag)

Get columns by flag.

Parameters
$flagstring
Returns
array

Definition at line 238 of file GridHandler.inc.php.

References getColumns().

GridHandler::getColumnsCount (   $flag)

Get columns number. If a flag is passed, the columns using it will not be counted.

Parameters
$flagstring
Returns
int

Definition at line 255 of file GridHandler.inc.php.

References getColumns().

& GridHandler::getDataElementFromRequest ( $request,
$elementId 
)

Create a data element from a request. This is used to format new rows prior to their insertion or existing rows that have been edited but not saved.

Parameters
$requestPKPRequest
$elementIdint Reference to be filled with element ID (if one is to be used)
Returns
object

Definition at line 568 of file GridHandler.inc.php.

& GridHandler::getDataProvider ( )

Get the data provider.

Returns
FilesGridDataProvider

Definition at line 90 of file GridHandler.inc.php.

Referenced by authorize(), CategoryGridHandler\getCategoryData(), getRequestArgs(), and loadData().

GridHandler::getEmptyRowText ( )

Get the no items locale key

Definition at line 152 of file GridHandler.inc.php.

GridHandler::getFeatures ( )

Get all grid attached features.

Returns
array

Definition at line 393 of file GridHandler.inc.php.

Referenced by callFeaturesHook(), and fetchGrid().

GridHandler::getFilterForm ( )

Returns a Form object or the path name of a filter template.

Returns
Form|string

Definition at line 667 of file GridHandler.inc.php.

Referenced by renderFilter().

GridHandler::getFilterSelectionData (   $request)

Method that extracts the user's filter selection from the request either by instantiating the filter's Form object or by reading the request directly (if using a simple filter template only).

Parameters
$requestPKPRequest
Returns
array

Definition at line 678 of file GridHandler.inc.php.

Referenced by CategoryGridHandler\_renderCategoryInternally(), getGridDataElements(), and renderFilter().

GridHandler::getFootNote ( )

Get the grid foot note.

Returns
string locale key

Definition at line 183 of file GridHandler.inc.php.

GridHandler::getInstructions ( )

Get the grid instructions.

Returns
string locale key

Definition at line 167 of file GridHandler.inc.php.

GridHandler::getIsSubcomponent ( )

Override this method to return true if you want to use the grid within another component (e.g. to remove the title or change the layout accordingly).

Returns
boolean

Definition at line 385 of file GridHandler.inc.php.

GridHandler::getJSHandler ( )

Get the js handler for this component.

Returns
string

Definition at line 555 of file GridHandler.inc.php.

GridHandler::getPublishChangeEvents ( )

Get "publish data changed" event list.

Returns
array

Definition at line 401 of file GridHandler.inc.php.

GridHandler::getRangeInfo (   $rangeName,
  $contextData = null 
)

FIXME: temporary shadow method of parent to disable paging on all grids.

See Also
PKPHandler::getRangeInfo()

Definition at line 576 of file GridHandler.inc.php.

GridHandler::getRequestArg (   $key)

Get a single grid request parameter.

See Also
getRequestArgs()
Parameters
$keystring The name of the parameter to retrieve.
Returns
mixed

Definition at line 127 of file GridHandler.inc.php.

References getRequestArgs().

Referenced by CategoryGridHandler\renderRowInternally().

GridHandler::getRequestArgs ( )

Get the grid request parameters. These are the parameters that uniquely identify the data within a grid.

NB: You should make sure to authorize and/or validate parameters before you publish them through this interface. Callers will assume that data accessed through this method will not have to be sanitized.

The default implementation tries to retrieve request parameters from a data provider if there is one.

Returns
array

Definition at line 111 of file GridHandler.inc.php.

References getDataProvider().

Referenced by _getInitializedRowInstance(), fetchGrid(), and getRequestArg().

& GridHandler::getRequestedRow (   $request,
  $args 
)

Tries to identify the data element in the grids data source that corresponds to the requested row id. Raises a fatal error if such an element cannot be found.

Parameters
$requestPKPRequest
$argsarray
Returns
GridRow the requested grid row, already configured with id and data or null if the row could not been found.

Definition at line 593 of file GridHandler.inc.php.

References _getInitializedRowInstance(), and getRowDataElement().

Referenced by fetchCell(), and fetchRow().

GridHandler::getRowDataElement (   $request,
  $rowId 
)

Retrieve a single data element from the grid's data source corresponding to the given row id. If none is found then return null.

Parameters
$rowId
Returns
mixed

Definition at line 635 of file GridHandler.inc.php.

References getGridDataElements().

Referenced by PKPCitationGridHandler\getCitationFromArgs(), PKPFilterGridHandler\getFilterFromArgs(), and getRequestedRow().

GridHandler::getRowDataElementSequence ( $gridDataElement)

Get the row data element sequence value.

Parameters
$gridDataElementmixed
Returns
int

Definition at line 751 of file GridHandler.inc.php.

& GridHandler::getRowInstance ( )

Get a new instance of a grid row. May be overridden by subclasses if they want to provide a custom row definition.

Returns
GridRow

Definition at line 545 of file GridHandler.inc.php.

Referenced by _getInitializedRowInstance().

GridHandler::getTemplate ( )

Get the grid template.

Returns
string

Definition at line 338 of file GridHandler.inc.php.

References setTemplate().

GridHandler::getTitle ( )

Get the grid title.

Returns
string locale key

Definition at line 137 of file GridHandler.inc.php.

Referenced by PKPFilterGridHandler\editFilter(), and PKPFilterGridHandler\updateFilter().

GridHandler::getUrls ( )

Return all grid urls that will be used in JS handler.

Returns
array

Definition at line 359 of file GridHandler.inc.php.

GridHandler::GridHandler (   $dataProvider = null)

Constructor.

Parameters
$dataProviderGridDataProvider An optional data provider for the grid. If no data provider is given then the grid assumes that child classes will override default method implementations.

Definition at line 77 of file GridHandler.inc.php.

GridHandler::hasColumn (   $columnId)

Checks whether a column exists.

Parameters
$columnId
Returns
boolean

Definition at line 271 of file GridHandler.inc.php.

Referenced by fetchCell().

GridHandler::hasGridDataElements (   $request)

Check whether the grid has rows.

Returns
boolean

Definition at line 310 of file GridHandler.inc.php.

References getGridDataElements().

GridHandler::initFeatures ( $request,
  $args 
)

Override to init grid features. This method is called by GridHandler::initialize() method that use the returned array with the initialized features to add them to grid.

Parameters
$requestRequest
$argsarray
Returns
array Array with initialized grid features objects.

Definition at line 801 of file GridHandler.inc.php.

Referenced by initialize().

GridHandler::initialize ( $request,
  $args = null 
)
& GridHandler::loadData ( $request,
  $filter 
)

Implement this method to load data into the grid.

Parameters
$requestRequest
$filterarray An associative array with filter data as returned by getFilterSelectionData(). If no filter has been selected by the user then the array will be empty.
Returns
null

Definition at line 652 of file GridHandler.inc.php.

References getDataProvider().

Referenced by getGridDataElements().

GridHandler::noAutocompleteResults ( )

Returns a common 'no matches' result when subclasses find no results for AJAX autocomplete requests.

Returns
string Serialized JSON object

Definition at line 727 of file GridHandler.inc.php.

GridHandler::renderFilter (   $request,
  $filterData = array() 
)

Render the filter (a template or a Form).

Parameters
$requestPKPRequest
$filterDataArray Data to be used by the filter template.
Returns
string

Definition at line 688 of file GridHandler.inc.php.

References getFilterForm(), and getFilterSelectionData().

Referenced by fetchGrid().

GridHandler::renderRowInternally ( $request,
$row 
)

Method that renders a single row.

NB: You must have initialized the row before you call this method.

Parameters
$requestPKPRequest
$rowGridRow
Returns
string the row HTML

Definition at line 833 of file GridHandler.inc.php.

References _renderCellInternally(), and getColumns().

Referenced by _renderRowsInternally(), fetchRow(), PKPCitationGridHandler\updateCitation(), and PKPFilterGridHandler\updateFilter().

GridHandler::saveRowDataElementSequence ( $request,
  $rowId,
$gridDataElement,
  $newSequence 
)

Operation to save the row data element new sequence.

Parameters
$gridDataElementmixed
$newSequenceint

Definition at line 760 of file GridHandler.inc.php.

GridHandler::saveSequence (   $args,
$request 
)

Save all data elements new sequence.

Parameters
$argsarray
$requestRequest

Definition at line 740 of file GridHandler.inc.php.

References callFeaturesHook(), and DAO\getDataChangedEvent().

GridHandler::setEmptyRowText (   $emptyRowText)

Set the no items locale key

Definition at line 159 of file GridHandler.inc.php.

GridHandler::setFirstDataColumn ( )

Define the first column that will contain grid data.

Override this method to define a different column than the first one.

Definition at line 786 of file GridHandler.inc.php.

References getColumns().

Referenced by fetchCell(), fetchGrid(), and fetchRow().

GridHandler::setFootNote (   $footNote)

Set the grid foot note.

Parameters
$footNotestring locale key

Definition at line 191 of file GridHandler.inc.php.

GridHandler::setGridDataElements ( $data)

Set the grid data.

Parameters
$datamixed an array or ItemIterator with element data

Definition at line 320 of file GridHandler.inc.php.

Referenced by getGridDataElements(), PKPCitationGridHandler\initialize(), and PKPFilterGridHandler\initialize().

GridHandler::setInstructions (   $instructions)

Set the grid instructions.

Parameters
$instructionsstring locale key

Definition at line 175 of file GridHandler.inc.php.

GridHandler::setTemplate (   $template)

Set the grid template.

Parameters
$templatestring

Definition at line 350 of file GridHandler.inc.php.

Referenced by MultipleListsListbuilderHandler\getTemplate(), ListbuilderHandler\getTemplate(), and getTemplate().

GridHandler::setTitle (   $title)

Set the grid title.

Parameters
$titlestring locale key

Definition at line 145 of file GridHandler.inc.php.

Referenced by LookupFilterGridHandler\initialize(), ParserFilterGridHandler\initialize(), and PKPCitationGridHandler\initialize().

GridHandler::setUrls ( $request,
  $extraUrls = array() 
)

Define the urls that will be used in JS handler.

Parameters
$requestRequest
$extraUrlsarray Optional extra urls.

Definition at line 369 of file GridHandler.inc.php.

Referenced by fetchGrid().


The documentation for this class was generated from the following file: