PHP 클래스 GridHandler, pkp-lib

상속: extends PKPHandler
파일 보기 프로젝트 열기: pkp/pkp-lib 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$_actions Grid actions. The first key represents the position of the action in the grid, the second key represents the action id.
$_columns The GridColumns of this grid.
$_data The grid's data source.
$_dataProvider GridDataProvider
$_emptyRowText empty row locale key
$_features The grid features.
$_footNote Grid foot note locale key
$_itemIterator The item iterator to be used for paging.
$_template The grid template.
$_title grid title locale key
$_urls The urls that will be used in JS handler.

공개 메소드들

메소드 설명
__construct ( $dataProvider = null ) Constructor.
addAction ( $action, $position = GRID_ACTION_POSITION_ABOVE ) Add an action.
addColumn ( $column ) Add a column.
authorize ( $request, &$args, $roleAssignments, $enforceRestrictedSite = true )
fetchCell ( &$args, $request ) : JSONMessage Render a cell and send it to the client
fetchGrid ( $args, $request ) : JSONMessage Render the entire grid controller and send it to the client.
fetchRow ( &$args, $request ) : JSONMessage Render a row and send it to the client. If the row no longer exists then inform the client.
fetchRows ( $args, $request ) : JSONMessage Fetch all grid rows from loaded data.
getActions ( $position = GRID_ACTION_POSITION_ABOVE ) : array Get all actions for a given position within the grid.
getColumn ( $columnId ) : GridColumn Retrieve a single column by id.
getColumns ( ) : array Get all columns.
getColumnsByFlag ( $flag ) : array Get columns by flag.
getColumnsCount ( $flag = null ) : integer Get columns number. If a flag is passed, the columns using it will not be counted.
getDataElementSequence ( &$gridDataElement ) : integer Override to return the data element sequence value.
getDataProvider ( ) : FilesGridDataProvider Get the data provider.
getEmptyRowText ( ) Get the no items locale key
getFeatures ( ) : array Get all grid attached features.
getFootNote ( ) : string Get the grid foot note.
getGridDataElements ( $request ) : array Get the grid data.
getGridRangeInfo ( $request, $rangeName, $contextData = null ) : DBResultRange Get grid range info.
getIsSubcomponent ( ) : boolean 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).
getItemIterator ( ) : ItemIterator Get the item iterator that represents this grid data.
getJSHandler ( ) : string Get the js handler for this component.
getPublishChangeEvents ( ) : array Get "publish data changed" event list.
getRequestArg ( $key ) : mixed Get a single grid request parameter.
getRequestArgs ( ) : array Get the grid request parameters. These are the parameters that uniquely identify the data within a grid.
getRequestedRow ( $request, $args ) : GridRow Tries to identify the data element in the grids data source that corresponds to the requested row id.
getSelectName ( ) : string Get the select parameter name to store the selected files.
getTemplate ( ) : string Get the grid template.
getTitle ( ) : string Get the grid title.
getUrls ( ) : array Return all grid urls that will be used in JS handler.
hasColumn ( $columnId ) : boolean Checks whether a column exists.
hasGridDataElements ( $request ) : boolean Check whether the grid has rows.
initialize ( $request, $args = null )
isDataElementSelected ( $gridDataElement ) : boolean Returns the current selection state of the grid data element.
renderRow ( $request, $row ) : string Render the passed row and return its markup.
saveSequence ( $args, $request ) : JSONMessage Hook oportunity for grid features to request a save items sequence operation. If no grid feature that implements the saveSequence hook is attached to this grid, this operation will only return the data changed event json message.
setDataElementSequence ( $request, $rowId, &$gridDataElement, $newSequence ) Override to set the data element new sequence.
setEmptyRowText ( $emptyRowText ) Set the no items locale key
setFootNote ( $footNote ) Set the grid foot note.
setGridDataElements ( $data ) Set the grid data.
setTemplate ( $template ) Set the grid template.
setTitle ( $title ) Set the grid title.
setUrls ( $request, $extraUrls = [] ) Define the urls that will be used in JS handler.

보호된 메소드들

메소드 설명
callFeaturesHook ( $hookName, $args ) Call the passed hook in all attached features.
doSpecificFetchGridActions ( $args, $request, $templateMgr ) Override this method if your subclass needs to perform different actions than the ones implemented here.
getDataElementFromRequest ( $request, &$elementId ) : object 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.
getFilterForm ( ) : Form | string Returns a Form object or the path name of a filter template.
getFilterSelectionData ( $request ) : array 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).
getRowDataElement ( $request, &$rowId ) : mixed Retrieve a single data element from the grid's data source corresponding to the given row id. If none is found then return null.
getRowInstance ( ) : GridRow Get a new instance of a grid row. May be overridden by subclasses if they want to provide a custom row definition.
getRowsSequence ( $request ) : array Return the sequence map of the current loaded grid items.
initFeatures ( $request, &$args ) : array Override to init grid features.
isFilterFormCollapsible ( ) : boolean Determine whether a filter form should be collapsible.
loadData ( $request, $filter ) : grid Implement this method to load data into the grid.
noAutocompleteResults ( ) : JSONMessage Returns a common 'no matches' result when subclasses find no results for AJAX autocomplete requests.
renderFilter ( $request, $filterData = [] ) : string Render the filter (a template or a Form).
renderGridBodyPartsInternally ( Request $request ) : array Method that renders tbodys to go in the grid main body.
renderRowInternally ( $request, $row ) : string Method that renders a single row.
renderRowsInternally ( $request, &$elements ) : array Cycle through the data and get generate the row HTML.
setFirstDataColumn ( ) Define the first column that will contain grid data.

비공개 메소드들

메소드 설명
_addFeatures ( $features ) Add grid features.
_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.
_getInitializedRowInstance ( $request, $elementId, &$element, $isModified = false ) : GridRow Instantiate a new row.
_renderCellInternally ( $request, $row, $column ) : string Method that renders a cell.

메소드 상세

__construct() 공개 메소드

Constructor.
public __construct ( $dataProvider = null )
$dataProvider GridDataProvider 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.

addAction() 공개 메소드

Add an action.
public addAction ( $action, $position = GRID_ACTION_POSITION_ABOVE )
$action Mixed a single action.
$position string The position of the action.

addColumn() 공개 메소드

Add a column.
public addColumn ( $column )
$column mixed A single GridColumn instance.

authorize() 공개 메소드

public authorize ( $request, &$args, $roleAssignments, $enforceRestrictedSite = true )

callFeaturesHook() 보호된 메소드

Call the passed hook in all attached features.
protected callFeaturesHook ( $hookName, $args )
$hookName string
$args array Arguments provided by this handler.

doSpecificFetchGridActions() 보호된 메소드

This method is called by GridHandler::fetchGrid()
protected doSpecificFetchGridActions ( $args, $request, $templateMgr )
$args array
$request Request

fetchCell() 공개 메소드

Render a cell and send it to the client
public fetchCell ( &$args, $request ) : JSONMessage
$args array
$request Request
리턴 JSONMessage JSON object

fetchGrid() 공개 메소드

Render the entire grid controller and send it to the client.
public fetchGrid ( $args, $request ) : JSONMessage
$args array
$request Request
리턴 JSONMessage JSON object

fetchRow() 공개 메소드

Render a row and send it to the client. If the row no longer exists then inform the client.
public fetchRow ( &$args, $request ) : JSONMessage
$args array
$request Request
리턴 JSONMessage JSON object.

fetchRows() 공개 메소드

Fetch all grid rows from loaded data.
public fetchRows ( $args, $request ) : JSONMessage
$args Array
$request Request
리턴 JSONMessage JSON object.

getActions() 공개 메소드

Get all actions for a given position within the grid.
public getActions ( $position = GRID_ACTION_POSITION_ABOVE ) : array
$position string The position of the actions.
리턴 array The LinkActions for the given position.

getColumn() 공개 메소드

Retrieve a single column by id.
public getColumn ( $columnId ) : GridColumn
$columnId
리턴 GridColumn

getColumns() 공개 메소드

Get all columns.
public getColumns ( ) : array
리턴 array An array of GridColumn instances.

getColumnsByFlag() 공개 메소드

Get columns by flag.
public getColumnsByFlag ( $flag ) : array
$flag string
리턴 array

getColumnsCount() 공개 메소드

Get columns number. If a flag is passed, the columns using it will not be counted.
public getColumnsCount ( $flag = null ) : integer
$flag optional string
리턴 integer

getDataElementFromRequest() 보호된 메소드

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.
protected getDataElementFromRequest ( $request, &$elementId ) : object
$request PKPRequest
$elementId int Reference to be filled with element ID (if one is to be used)
리턴 object

getDataElementSequence() 공개 메소드

Override to return the data element sequence value.
public getDataElementSequence ( &$gridDataElement ) : integer
$gridDataElement mixed
리턴 integer

getDataProvider() 공개 메소드

Get the data provider.
public getDataProvider ( ) : FilesGridDataProvider
리턴 FilesGridDataProvider

getEmptyRowText() 공개 메소드

Get the no items locale key
public getEmptyRowText ( )

getFeatures() 공개 메소드

Get all grid attached features.
public getFeatures ( ) : array
리턴 array

getFilterForm() 보호된 메소드

Returns a Form object or the path name of a filter template.
protected getFilterForm ( ) : Form | string
리턴 Form | string

getFilterSelectionData() 보호된 메소드

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).
protected getFilterSelectionData ( $request ) : array
$request PKPRequest
리턴 array

getFootNote() 공개 메소드

Get the grid foot note.
public getFootNote ( ) : string
리턴 string locale key

getGridDataElements() 공개 메소드

Get the grid data.
public getGridDataElements ( $request ) : array
$request PKPRequest
리턴 array

getGridRangeInfo() 공개 메소드

Get grid range info.
public getGridRangeInfo ( $request, $rangeName, $contextData = null ) : DBResultRange
$request PKPRequest
$rangeName string The grid id.
$contextData mixed
리턴 DBResultRange

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).
public getIsSubcomponent ( ) : boolean
리턴 boolean

getItemIterator() 공개 메소드

Should only be used for retriving paging data. See #6498.
public getItemIterator ( ) : ItemIterator
리턴 ItemIterator

getJSHandler() 공개 메소드

Get the js handler for this component.
public getJSHandler ( ) : string
리턴 string

getPublishChangeEvents() 공개 메소드

Get "publish data changed" event list.
public getPublishChangeEvents ( ) : array
리턴 array

getRequestArg() 공개 메소드

Get a single grid request parameter.
또한 보기: getRequestArgs()
public getRequestArg ( $key ) : mixed
$key string The name of the parameter to retrieve.
리턴 mixed

getRequestArgs() 공개 메소드

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.
public getRequestArgs ( ) : array
리턴 array

getRequestedRow() 공개 메소드

Raises a fatal error if such an element cannot be found.
public getRequestedRow ( $request, $args ) : GridRow
$request PKPRequest
$args array
리턴 GridRow the requested grid row, already configured with id and data or null if the row could not been found.

getRowDataElement() 보호된 메소드

Retrieve a single data element from the grid's data source corresponding to the given row id. If none is found then return null.
protected getRowDataElement ( $request, &$rowId ) : mixed
$rowId string The row ID; reference permits modification.
리턴 mixed

getRowInstance() 보호된 메소드

Get a new instance of a grid row. May be overridden by subclasses if they want to provide a custom row definition.
protected getRowInstance ( ) : GridRow
리턴 GridRow

getRowsSequence() 보호된 메소드

This is not the sequence value of the data represented by the row, it's just the mapping of the rows sequence, in the order that they are loaded. To handle grid items ordering, see OrderItemsFeature class.
protected getRowsSequence ( $request ) : array
$request PKPRequest
리턴 array

getSelectName() 공개 메소드

Get the select parameter name to store the selected files.
public getSelectName ( ) : string
리턴 string

getTemplate() 공개 메소드

Get the grid template.
public getTemplate ( ) : string
리턴 string

getTitle() 공개 메소드

Get the grid title.
public getTitle ( ) : string
리턴 string locale key

getUrls() 공개 메소드

Return all grid urls that will be used in JS handler.
public getUrls ( ) : array
리턴 array

hasColumn() 공개 메소드

Checks whether a column exists.
public hasColumn ( $columnId ) : boolean
$columnId
리턴 boolean

hasGridDataElements() 공개 메소드

Check whether the grid has rows.
public hasGridDataElements ( $request ) : boolean
리턴 boolean

initFeatures() 보호된 메소드

This method is called by GridHandler::initialize() method that use the returned array with the initialized features to add them to grid.
protected initFeatures ( $request, &$args ) : array
$request Request
$args array
리턴 array Array with initialized grid features objects.

initialize() 공개 메소드

또한 보기: PKPHandler::initialize()
public initialize ( $request, $args = null )
$request PKPRequest
$args array optional

isDataElementSelected() 공개 메소드

Returns the current selection state of the grid data element.
public isDataElementSelected ( $gridDataElement ) : boolean
$gridDataElement mixed
리턴 boolean

isFilterFormCollapsible() 보호된 메소드

Determine whether a filter form should be collapsible.
protected isFilterFormCollapsible ( ) : boolean
리턴 boolean

loadData() 보호된 메소드

Implement this method to load data into the grid.
protected loadData ( $request, $filter ) : grid
$request Request
$filter array 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.
리턴 grid data

noAutocompleteResults() 보호된 메소드

Returns a common 'no matches' result when subclasses find no results for AJAX autocomplete requests.
protected noAutocompleteResults ( ) : JSONMessage
리턴 JSONMessage JSON object

renderFilter() 보호된 메소드

Render the filter (a template or a Form).
protected renderFilter ( $request, $filterData = [] ) : string
$request PKPRequest
$filterData Array Data to be used by the filter template.
리턴 string

renderGridBodyPartsInternally() 보호된 메소드

Method that renders tbodys to go in the grid main body.
protected renderGridBodyPartsInternally ( Request $request ) : array
$request Request
리턴 array

renderRow() 공개 메소드

Render the passed row and return its markup.
public renderRow ( $request, $row ) : string
$request PKPRequest
$row GridRow
리턴 string

renderRowInternally() 보호된 메소드

NB: You must have initialized the row before you call this method.
protected renderRowInternally ( $request, $row ) : string
$request PKPRequest
$row GridRow
리턴 string the row HTML

renderRowsInternally() 보호된 메소드

Cycle through the data and get generate the row HTML.
protected renderRowsInternally ( $request, &$elements ) : array
$request PKPRequest
$elements array The grid data elements to be rendered.
리턴 array of HTML Strings for Grid Rows.

saveSequence() 공개 메소드

Hook oportunity for grid features to request a save items sequence operation. If no grid feature that implements the saveSequence hook is attached to this grid, this operation will only return the data changed event json message.
public saveSequence ( $args, $request ) : JSONMessage
$args array
$request Request
리턴 JSONMessage JSON object

setDataElementSequence() 공개 메소드

Override to set the data element new sequence.
public setDataElementSequence ( $request, $rowId, &$gridDataElement, $newSequence )
$request PKPRequest
$rowId int
$gridDataElement mixed
$newSequence int

setEmptyRowText() 공개 메소드

Set the no items locale key
public setEmptyRowText ( $emptyRowText )

setFirstDataColumn() 보호된 메소드

Override this method to define a different column than the first one.
protected setFirstDataColumn ( )

setFootNote() 공개 메소드

Set the grid foot note.
public setFootNote ( $footNote )
$footNote string locale key

setGridDataElements() 공개 메소드

Set the grid data.
public setGridDataElements ( $data )
$data mixed an array or ItemIterator with element data

setTemplate() 공개 메소드

Set the grid template.
public setTemplate ( $template )
$template string

setTitle() 공개 메소드

Set the grid title.
public setTitle ( $title )
$title string locale key

setUrls() 공개 메소드

Define the urls that will be used in JS handler.
public setUrls ( $request, $extraUrls = [] )
$request Request
$extraUrls array Optional extra urls.

프로퍼티 상세

$_actions 공개적으로 프로퍼티

Grid actions. The first key represents the position of the action in the grid, the second key represents the action id.
public $_actions

$_columns 공개적으로 프로퍼티

The GridColumns of this grid.
public $_columns

$_data 공개적으로 프로퍼티

The grid's data source.
public $_data

$_dataProvider 공개적으로 프로퍼티

public GridDataProvider $_dataProvider
리턴 GridDataProvider

$_emptyRowText 공개적으로 프로퍼티

empty row locale key
public $_emptyRowText

$_features 공개적으로 프로퍼티

The grid features.
public $_features

$_footNote 공개적으로 프로퍼티

Grid foot note locale key
public $_footNote

$_itemIterator 공개적으로 프로퍼티

The item iterator to be used for paging.
public $_itemIterator

$_template 공개적으로 프로퍼티

The grid template.
public $_template

$_title 공개적으로 프로퍼티

grid title locale key
public $_title

$_urls 공개적으로 프로퍼티

The urls that will be used in JS handler.
public $_urls