PRADO Component Framework for PHP 5
  • Home
  • About
  • Testimonials
  • Demos
  • Download
  • Documentation
  • Forum
  • Development
  • Tutorials
  • Class Docs
  • API Manual
  • Wiki

Packages

  • None
  • System
    • Caching
    • Collections
    • Data
      • ActiveRecord
        • Relations
        • Scaffold
          • InputBuilder
      • Commom
        • Sqlite
      • Common
        • Mssql
        • Mysql
        • Oracle
        • Pgsql
        • Sqlite
      • DataGateway
      • SqlMap
        • Configuration
        • Statements
    • Exceptions
    • I18N
    • IO
    • Security
    • Util
    • Web
      • Javascripts
      • Services
      • UI
        • ActiveControls
        • WebControls
    • Xml
  • Wsat
    • pages
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo

Class TAccordion

Class 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 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:

  • setActiveViewIndex ActiveViewIndex - the zero-based integer index of the view in the view collection.
  • setActiveViewID ActiveViewID - the text ID of the visible view.
  • setActiveView ActiveView - the visible view instance.

If both setActiveViewIndex ActiveViewIndex and 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 setCssUrl CssUrl property. The following properties specify the CSS classes used for elements in a TAccordion:

  • setCssClass CssClass - the CSS class name for the outer-most div element (defaults to 'accordion');
  • setHeaderCssClass HeaderCssClass - the CSS class name for nonactive accordion div elements (defaults to 'accordion-header');
  • setActiveHeaderCssClass ActiveHeaderCssClass - the CSS class name for the active accordion div element (defaults to 'accordion-header-active');
  • 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 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 setViewHeight ViewHeight property. When a TAccordion is nested inside another, it's adviced to manually specify a setViewHeight ViewHeight for the internal TAccordion

To use TAccordion, write a template like following:

<com:TAccordion>
  <com:TAccordionView Caption="View 1">
    content for view 1
  </com:TAccordionView>
  <com:TAccordionView Caption="View 2">
    content for view 2
  </com:TAccordionView>
  <com:TAccordionView Caption="View 3">
    content for view 3
  </com:TAccordionView>
</com:TAccordion>
TComponent
Extended by TApplicationComponent
Extended by TControl implements IRenderable, IBindable
Extended by TWebControl implements IStyleable
Extended by TAccordion implements IPostBackDataHandler
Package: System\Web\UI\WebControls
Copyright: Copyright © 2005-2014 PradoSoft
License: http://www.pradosoft.com/license/
Author: Gabor Berczi, DevWorx Hungary <gabor.berczi@devworx.hu>
Since: 3.2
Located at Web/UI/WebControls/TAccordion.php
Methods summary
protected string
# getTagName( )

Returns

string
tag name for the control

Overrides

TWebControl::getTagName()
public
# addParsedObject( mixed $object )

Adds object parsed from template to the control. This method adds only TAccordionView objects into the getViews Views collection. All other objects are ignored.

Adds object parsed from template to the control. This method adds only TAccordionView objects into the getViews Views collection. All other objects are ignored.

Parameters

$object
mixed
object parsed from template

Overrides

TControl::addParsedObject()
public integer
# getActiveViewIndex( )

Returns the index of the active accordion view. Note, this property may not return the correct index. To ensure the correctness, call TAccordion::getActiveView() first.

Returns the index of the active accordion view. Note, this property may not return the correct index. To ensure the correctness, call TAccordion::getActiveView() first.

Returns

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).
public
# setActiveViewIndex( integer $value )

Parameters

$value
integer
the zero-based index of the current view in the view collection. -1 if no active view.

Throws

TInvalidDataValueException
if the view index is invalid
public string
# getActiveViewID( )

Returns the ID of the active accordion view. Note, this property may not return the correct ID. To ensure the correctness, call TAccordion::getActiveView() first.

Returns the ID of the active accordion view. Note, this property may not return the correct ID. To ensure the correctness, call TAccordion::getActiveView() first.

Returns

string
The ID of the active accordion view. Defaults to '', meaning not set.
public
# setActiveViewID( string $value )

Parameters

$value
string
The ID of the active accordion view.
public TAccordionView
# getActiveView( )

Returns the currently active view. This method will examin the ActiveViewID, ActiveViewIndex and Views collection to determine which view is currently active. It will update ActiveViewID and ActiveViewIndex accordingly.

Returns the currently active view. This method will examin the ActiveViewID, ActiveViewIndex and Views collection to determine which view is currently active. It will update ActiveViewID and ActiveViewIndex accordingly.

Returns

TAccordionView
the currently active view, null if no active view

Throws

TInvalidDataValueException
if the active view ID or index set previously is invalid
public
# setActiveView( TAccordionView $view )

Parameters

$view
TAccordionView
the view to be activated

Throws

TInvalidOperationException
if the view is not in the view collection
public string
# getCssUrl( )

Returns

string
URL for the CSS file including all relevant CSS class definitions. Defaults to ''.
public
# setCssUrl( string $value )

Parameters

$value
string
URL for the CSS file including all relevant CSS class definitions.
public string
# getCssClass( )

Returns

string
CSS class for the whole accordion control div.

Overrides

TWebControl::getCssClass()
public string
# getViewCssClass( )

Returns

string
CSS class for the currently displayed view div. Defaults to 'accordion-view'.
public
# setViewCssClass( string $value )

Parameters

$value
string
CSS class for the currently displayed view div.
public string
# getAnimationDuration( )

Returns

string
CSS class for the currently displayed view div. Defaults to 'accordion-view'.
public
# setAnimationDuration( string $value )

Parameters

$value
string
CSS class for the currently displayed view div.
public TStyle
# getViewStyle( )

Returns

TStyle
the style for all the view div
public string
# getHeaderCssClass( )

Returns

string
CSS class for view headers. Defaults to 'accordion-header'.
public
# setHeaderCssClass( string $value )

Parameters

$value
string
CSS class for view headers.
public TStyle
# getHeaderStyle( )

Returns

TStyle
the style for all the inactive header div
public string
# getActiveHeaderCssClass( )

Returns

string
Extra CSS class for the active header. Defaults to 'accordion-header-active'.
public
# setActiveHeaderCssClass( string $value )

Parameters

$value
string
Extra CSS class for the active header. Will be added to the normal header specified by HeaderCssClass.
public TStyle
# getActiveHeaderStyle( )

Returns

TStyle
the style for the active header div
public integer
# getViewHeight( )

Returns

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
public
# setViewHeight( integer $value )

Parameters

$value
integer
Maximum height for the accordion views. If any of the accordion's views' content is larger, those views will be made scrollable when activated
protected
# activateView( TAccordionView $view )

Activates the specified view. If there is any other view currently active, it will be deactivated.

Activates the specified view. If there is any other view currently active, it will be deactivated.

Parameters

$view
TAccordionView
the view to be activated. If null, all views will be deactivated.
public boolean
# loadPostData( string $key, array $values )

Loads user input data. This method is primarly used by framework developers.

Loads user input data. This method is primarly used by framework developers.

Parameters

$key
string
the key that can be used to retrieve data from the input data collection
$values
array
the input data collection

Returns

boolean
whether the data of the control has been changed

Implementation of

IPostBackDataHandler::loadPostData()
public
# raisePostDataChangedEvent( )

Raises postdata changed event. This method is required by IPostBackDataHandler interface. It is invoked by the framework when getActiveViewIndex ActiveViewIndex property is changed on postback. This method is primarly used by framework developers.

Raises postdata changed event. This method is required by IPostBackDataHandler interface. It is invoked by the framework when getActiveViewIndex ActiveViewIndex property is changed on postback. This method is primarly used by framework developers.

Implementation of

IPostBackDataHandler::raisePostDataChangedEvent()
public boolean
# getDataChanged( )

Returns a value indicating whether postback has caused the control data change. This method is required by the IPostBackDataHandler interface.

Returns a value indicating whether postback has caused the control data change. This method is required by the IPostBackDataHandler interface.

Returns

boolean
whether postback has caused the control data change. False if the page is not in postback mode.

Implementation of

IPostBackDataHandler::getDataChanged()
protected
# addAttributesToRender( THtmlWriter $writer )

Adds attributes to renderer.

Adds attributes to renderer.

Parameters

$writer
THtmlWriter
the renderer

Overrides

TWebControl::addAttributesToRender()
public
# onPreRender( mixed $param )

Registers CSS and JS. This method is invoked right before the control rendering, if the control is visible.

Registers CSS and JS. This method is invoked right before the control rendering, if the control is visible.

Parameters

$param
mixed
event parameter

Overrides

TWebControl::onPreRender()
protected
# registerStyleSheet( )

Registers the CSS relevant to the TAccordion. It will register the CSS file specified by getCssUrl CssUrl. If that is not set, it will use the default CSS.

Registers the CSS relevant to the TAccordion. It will register the CSS file specified by getCssUrl CssUrl. If that is not set, it will use the default CSS.

protected
# registerClientScript( )

Registers the relevant JavaScript.

Registers the relevant JavaScript.

protected string
# getClientClassName( )

Gets the name of the javascript class responsible for performing postback for this control. This method overrides the parent implementation.

Gets the name of the javascript class responsible for performing postback for this control. This method overrides the parent implementation.

Returns

string
the javascript class name
protected array
# getClientOptions( )

Returns

array
the options for JavaScript
protected TAccordionViewCollection
# createControlCollection( )

Creates a control collection object that is to be used to hold child controls

Creates a control collection object that is to be used to hold child controls

Returns

TAccordionViewCollection
control collection

Overrides

TControl::createControlCollection()
public TAccordionViewCollection
# getViews( )

Returns

TAccordionViewCollection
list of TAccordionView controls
public
# render( THtmlWriter $writer )

Renders the control. This method overrides the parent implementation by replacing it with the following sequence:

  • TWebControl::renderBeginTag()
  • TAccordion::renderContents()
  • TWebControl::renderEndTag()

Renders the control. This method overrides the parent implementation by replacing it with the following sequence:

  • TWebControl::renderBeginTag()
  • TAccordion::renderContents()
  • TWebControl::renderEndTag()

Parameters

$writer
THtmlWriter
the writer used for the rendering purpose

Overrides

TWebControl::render()
public
# renderContents( THtmlWriter $writer )

Renders body contents of the accordion control.

Renders body contents of the accordion control.

Parameters

$writer
THtmlWriter
the writer used for the rendering purpose.

Overrides

TWebControl::renderContents()
Methods inherited from TWebControl
clearStyle(), copyBaseAttributes(), createStyle(), getAccessKey(), getBackColor(), getBorderColor(), getBorderStyle(), getBorderWidth(), getDecorator(), getDisplay(), getEnsureId(), getFont(), getForeColor(), getHasStyle(), getHeight(), getStyle(), getTabIndex(), getToolTip(), getWidth(), renderBeginTag(), renderEndTag(), setAccessKey(), setBackColor(), setBorderColor(), setBorderStyle(), setBorderWidth(), setCssClass(), setDisplay(), setEnsureId(), setForeColor(), setHeight(), setStyle(), setTabIndex(), setToolTip(), setWidth()
Methods inherited from TControl
__construct(), __get(), addToPostDataLoader(), addedControl(), applyStyleSheetSkin(), autoBindProperty(), autoDataBindProperties(), bindProperty(), broadcastEvent(), bubbleEvent(), clearChildState(), clearControlState(), clearNamingContainer(), clearViewState(), convertUniqueIdToClientId(), createChildControls(), dataBind(), dataBindChildren(), dataBindProperties(), ensureChildControls(), findControl(), findControlsByID(), findControlsByType(), focus(), getAdapter(), getAllowChildControls(), getAttribute(), getAttributes(), getChildControlsCreated(), getClientID(), getControlStage(), getControlState(), getControls(), getCustomData(), getEnableTheming(), getEnableViewState(), getEnabled(), getHasAdapter(), getHasAttributes(), getHasChildInitialized(), getHasControls(), getHasInitialized(), getHasLoaded(), getHasLoadedPostData(), getHasPreRendered(), getID(), getIsSkinApplied(), getNamingContainer(), getPage(), getParent(), getRegisteredObject(), getSkinID(), getSourceTemplateControl(), getTemplateControl(), getUniqueID(), getViewState(), getVisible(), hasAttribute(), initRecursive(), isDescendentOf(), isObjectRegistered(), loadRecursive(), loadState(), loadStateRecursive(), onDataBinding(), onInit(), onLoad(), onUnload(), preRenderRecursive(), raiseBubbleEvent(), registerObject(), removeAttribute(), removedControl(), renderChildren(), renderControl(), saveState(), saveStateRecursive(), setAdapter(), setAttribute(), setChildControlsCreated(), setControlStage(), setControlState(), setCustomData(), setEnableTheming(), setEnableViewState(), setEnabled(), setID(), setPage(), setSkinID(), setTemplateControl(), setViewState(), setVisible(), trackViewState(), traverseChildControls(), unbindProperty(), unloadRecursive(), unregisterObject()
Methods inherited from TApplicationComponent
getApplication(), getRequest(), getResponse(), getService(), getSession(), getUser(), publishAsset(), publishFilePath()
Methods inherited from TComponent
__call(), __destruct(), __isset(), __set(), __sleep(), __unset(), __wakeup(), asa(), attachBehavior(), attachBehaviors(), attachClassBehavior(), attachEventHandler(), canGetProperty(), canSetProperty(), clearBehaviors(), createdOnTemplate(), detachBehavior(), detachBehaviors(), detachClassBehavior(), detachEventHandler(), disableBehavior(), disableBehaviors(), enableBehavior(), enableBehaviors(), evaluateExpression(), evaluateStatements(), fxAttachClassBehavior(), fxDetachClassBehavior(), getAutoGlobalListen(), getBehaviorsEnabled(), getClassHierarchy(), getEventHandlers(), getListeningToGlobalEvents(), getSubProperty(), hasEvent(), hasEventHandler(), hasProperty(), isa(), listen(), raiseEvent(), setSubProperty(), unlisten()
Constants inherited from TControl
AUTOMATIC_ID_PREFIX, CLIENT_ID_SEPARATOR, CS_CHILD_INITIALIZED, CS_CONSTRUCTED, CS_INITIALIZED, CS_LOADED, CS_PRERENDERED, CS_STATE_LOADED, ID_FORMAT, ID_SEPARATOR, IS_CHILD_CREATED, IS_CREATING_CHILD, IS_DISABLE_THEMING, IS_DISABLE_VIEWSTATE, IS_ID_SET, IS_SKIN_APPLIED, IS_STYLESHEET_APPLIED, RF_ADAPTER, RF_AUTO_BINDINGS, RF_CHILD_STATE, RF_CONTROLS, RF_CONTROLSTATE, RF_DATA_BINDINGS, RF_EVENTS, RF_NAMED_CONTROLS, RF_NAMED_CONTROLS_ID, RF_NAMED_OBJECTS, RF_SKIN_ID
Constants inherited from TComponent
GLOBAL_RAISE_EVENT_LISTENER
Properties inherited from TWebControl
$_decorator
Terms of Service | Contact Us
PRADO v3.2.4 API Manual API documentation generated by ApiGen 2.8.0
Copyright © 2006-2014 by the PRADO Group.
Powered by PRADO