PHP Class Prado\Web\UI\WebControls\TAccordion

TAccordion displays an accordion control. Users can click on the view headers to switch among different accordion views. Each accordion view is an independent panel that can contain arbitrary content. A TAccordion control consists of one or several {@link TAccordionView} controls representing the possible accordion views. At any time, only one accordion view is visible (active), which is specified by any of the following properties: - {@link setActiveViewIndex ActiveViewIndex} - the zero-based integer index of the view in the view collection. - {@link setActiveViewID ActiveViewID} - the text ID of the visible view. - {@link setActiveView ActiveView} - the visible view instance. If both {@link setActiveViewIndex ActiveViewIndex} and {@link setActiveViewID ActiveViewID} are set, the latter takes precedence. TAccordion uses CSS to specify the appearance of the accordion headers and panel. By default, an embedded CSS file will be published which contains the default CSS for TTabPanel. You may also use your own CSS file by specifying the {@link setCssUrl CssUrl} property. The following properties specify the CSS classes used for elements in a TAccordion: - {@link setCssClass CssClass} - the CSS class name for the outer-most div element (defaults to 'accordion'); - {@link setHeaderCssClass HeaderCssClass} - the CSS class name for nonactive accordion div elements (defaults to 'accordion-header'); - {@link setActiveHeaderCssClass ActiveHeaderCssClass} - the CSS class name for the active accordion div element (defaults to 'accordion-header-active'); - {@link setViewCssClass ViewCssClass} - the CSS class for the div element enclosing view content (defaults to 'accordion-view'); When the user clicks on a view header, the switch between the old visible view and the clicked one is animated. You can use the {@link setAnimationDuration AnimationDuration} property to set the animation length in seconds; it defaults to 1 second, and when set to 0 it will produce an immediate switch with no animation. The TAccordion auto-sizes itself to the largest of all views, so it can encompass all of them without scrolling. If you want to specify a fixed height (in pixels), use the {@link setViewHeight ViewHeight} property. When a TAccordion is nested inside another, it's adviced to manually specify a {@link setViewHeight ViewHeight} for the internal TAccordion To use TAccordion, write a template like following: content for view 1 content for view 2 content for view 3
Since: 3.2
Author: Gabor Berczi, DevWorx Hungary ([email protected])
Inheritance: extends TWebControl, implements Prado\Web\UI\IPostBackDataHandler
Datei anzeigen Open project: pradosoft/prado

Public Methods

Method Description
addParsedObject ( $object ) Adds object parsed from template to the control.
getActiveHeaderCssClass ( ) : string
getActiveHeaderStyle ( ) : TStyle
getActiveView ( ) : TAccordionView Returns the currently active view.
getActiveViewID ( ) : string Returns the ID of the active accordion view.
getActiveViewIndex ( ) : integer Returns the index of the active accordion view.
getAnimationDuration ( ) : string
getCssClass ( ) : string
getCssUrl ( ) : string
getDataChanged ( ) : boolean Returns a value indicating whether postback has caused the control data change.
getHeaderCssClass ( ) : string
getHeaderStyle ( ) : TStyle
getViewCssClass ( ) : string
getViewHeight ( ) : integer
getViewStyle ( ) : TStyle
getViews ( ) : TAccordionViewCollection
loadPostData ( $key, $values ) : boolean Loads user input data.
onPreRender ( $param ) Registers CSS and JS.
raisePostDataChangedEvent ( ) Raises postdata changed event.
render ( $writer )
renderContents ( $writer ) Renders body contents of the accordion control.
setActiveHeaderCssClass ( $value )
setActiveView ( $view )
setActiveViewID ( $value )
setActiveViewIndex ( $value )
setAnimationDuration ( $value )
setCssUrl ( $value )
setHeaderCssClass ( $value )
setViewCssClass ( $value )
setViewHeight ( $value )

Protected Methods

Method Description
activateView ( $view ) Activates the specified view.
addAttributesToRender ( $writer ) Adds attributes to renderer.
createControlCollection ( ) : TAccordionViewCollection Creates a control collection object that is to be used to hold child controls
getClientClassName ( ) : string Gets the name of the javascript class responsible for performing postback for this control.
getClientOptions ( ) : array
getTagName ( ) : string
registerClientScript ( ) Registers the relevant JavaScript.
registerStyleSheet ( ) Registers the CSS relevant to the TAccordion.

Method Details

activateView() protected method

If there is any other view currently active, it will be deactivated.
protected activateView ( $view )

addAttributesToRender() protected method

Adds attributes to renderer.
protected addAttributesToRender ( $writer )

addParsedObject() public method

This method adds only {@link TAccordionView} objects into the {@link getViews Views} collection. All other objects are ignored.
public addParsedObject ( $object )

createControlCollection() protected method

Creates a control collection object that is to be used to hold child controls
protected createControlCollection ( ) : TAccordionViewCollection
return TAccordionViewCollection control collection

getActiveHeaderCssClass() public method

public getActiveHeaderCssClass ( ) : string
return string Extra CSS class for the active header. Defaults to 'accordion-header-active'.

getActiveHeaderStyle() public method

public getActiveHeaderStyle ( ) : TStyle
return TStyle the style for the active header div

getActiveView() public method

This method will examin the ActiveViewID, ActiveViewIndex and Views collection to determine which view is currently active. It will update ActiveViewID and ActiveViewIndex accordingly.
public getActiveView ( ) : TAccordionView
return TAccordionView the currently active view, null if no active view

getActiveViewID() public method

Note, this property may not return the correct ID. To ensure the correctness, call {@link getActiveView()} first.
public getActiveViewID ( ) : string
return string The ID of the active accordion view. Defaults to '', meaning not set.

getActiveViewIndex() public method

Note, this property may not return the correct index. To ensure the correctness, call {@link getActiveView()} first.
public getActiveViewIndex ( ) : integer
return integer the zero-based index of the active accordion view. If -1, it means no active accordion view. Default is 0 (the first view is active).

getAnimationDuration() public method

public getAnimationDuration ( ) : string
return string CSS class for the currently displayed view div. Defaults to 'accordion-view'.

getClientClassName() protected method

This method overrides the parent implementation.
protected getClientClassName ( ) : string
return string the javascript class name

getClientOptions() protected method

protected getClientOptions ( ) : array
return array the options for JavaScript

getCssClass() public method

public getCssClass ( ) : string
return string CSS class for the whole accordion control div.

getCssUrl() public method

public getCssUrl ( ) : string
return string URL for the CSS file including all relevant CSS class definitions. Defaults to ''.

getDataChanged() public method

This method is required by the \Prado\Web\UI\IPostBackDataHandler interface.
public getDataChanged ( ) : boolean
return boolean whether postback has caused the control data change. False if the page is not in postback mode.

getHeaderCssClass() public method

public getHeaderCssClass ( ) : string
return string CSS class for view headers. Defaults to 'accordion-header'.

getHeaderStyle() public method

public getHeaderStyle ( ) : TStyle
return TStyle the style for all the inactive header div

getTagName() protected method

protected getTagName ( ) : string
return string tag name for the control

getViewCssClass() public method

public getViewCssClass ( ) : string
return string CSS class for the currently displayed view div. Defaults to 'accordion-view'.

getViewHeight() public method

public getViewHeight ( ) : integer
return integer Maximum height for the accordion views. If non specified, the accordion will auto-sized to the largest of all views, so it can encompass all of them without scrolling

getViewStyle() public method

public getViewStyle ( ) : TStyle
return TStyle the style for all the view div

getViews() public method

public getViews ( ) : TAccordionViewCollection
return TAccordionViewCollection list of {@link TAccordionView} controls

loadPostData() public method

This method is primarly used by framework developers.
public loadPostData ( $key, $values ) : boolean
return boolean whether the data of the control has been changed

onPreRender() public method

This method is invoked right before the control rendering, if the control is visible.
public onPreRender ( $param )

raisePostDataChangedEvent() public method

This method is required by {@link \Prado\Web\UI\IPostBackDataHandler} interface. It is invoked by the framework when {@link getActiveViewIndex ActiveViewIndex} property is changed on postback. This method is primarly used by framework developers.

registerClientScript() protected method

Registers the relevant JavaScript.
protected registerClientScript ( )

registerStyleSheet() protected method

It will register the CSS file specified by {@link getCssUrl CssUrl}. If that is not set, it will use the default CSS.
protected registerStyleSheet ( )

render() public method

public render ( $writer )

renderContents() public method

Renders body contents of the accordion control.
public renderContents ( $writer )

setActiveHeaderCssClass() public method

public setActiveHeaderCssClass ( $value )

setActiveView() public method

public setActiveView ( $view )

setActiveViewID() public method

public setActiveViewID ( $value )

setActiveViewIndex() public method

public setActiveViewIndex ( $value )

setAnimationDuration() public method

public setAnimationDuration ( $value )

setCssUrl() public method

public setCssUrl ( $value )

setHeaderCssClass() public method

public setHeaderCssClass ( $value )

setViewCssClass() public method

public setViewCssClass ( $value )

setViewHeight() public method

public setViewHeight ( $value )