PHP Класс Prado\Web\UI\TTemplateControl

TTemplateControl is the base class for all controls that use templates. By default, a control template is assumed to be in a file under the same directory with the control class file. They have the same file name and different extension name. For template file, the extension name is ".tpl".
С версии: 3.0
Автор: Qiang Xue ([email protected])
Наследование: extends TCompositeControl
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
createChildControls ( ) Creates child controls.
getIsSourceTemplateControl ( ) : boolean
getMaster ( ) : TTemplateControl | null
getMasterClass ( ) : string
getTemplate ( ) : Prado\Web\UI\ITemplate | null Returns the template object associated with this control object.
getTemplateDirectory ( ) : string
injectContent ( $id, $content ) Injects all content controls (and their children) to the corresponding content placeholders.
registerContent ( $id, TContent $object ) Registers a content control.
registerContentPlaceHolder ( $id, TContentPlaceHolder $object ) Registers a content placeholder to this template control.
setMasterClass ( $value )
setTemplate ( $value ) Sets the parsed template.
tryToUpdateAR ( TActiveRecord $arObj, boolean $throwExceptions = false ) Function to try to update an AR object with data in view controls.
tryToUpdateView ( TActiveRecord $arObj, boolean $throwExceptions = false ) Function to update view controls with data in a given AR object.

Защищенные методы

Метод Описание
initRecursive ( $namingContainer = null ) Performs the OnInit step for the control and all its child controls.
loadTemplate ( ) : Prado\Web\UI\ITemplate Loads the template associated with this control class.

Описание методов

createChildControls() публичный Метод

This method is overridden to load and instantiate control template. This method should only be used by framework and control developers.
public createChildControls ( )

getIsSourceTemplateControl() публичный Метод

public getIsSourceTemplateControl ( ) : boolean
Результат boolean whether this control is a source template control. A source template control loads its template from external storage, such as file, db, rather than from within another template.

getMaster() публичный Метод

public getMaster ( ) : TTemplateControl | null
Результат TTemplateControl | null master control associated with this control, null if none

getMasterClass() публичный Метод

public getMasterClass ( ) : string
Результат string master class name (in namespace form)

getTemplate() публичный Метод

Returns the template object associated with this control object.
public getTemplate ( ) : Prado\Web\UI\ITemplate | null
Результат Prado\Web\UI\ITemplate | null the parsed template, null if none

getTemplateDirectory() публичный Метод

public getTemplateDirectory ( ) : string
Результат string the directory containing the template. Empty if no template available.

initRecursive() защищенный Метод

This method overrides the parent implementation by ensuring child controls are created first, and if master class is set, master will be applied. Only framework developers should use this method.
protected initRecursive ( $namingContainer = null )

injectContent() публичный Метод

This method should only be used by framework and control developers.
public injectContent ( $id, $content )

loadTemplate() защищенный Метод

Loads the template associated with this control class.
protected loadTemplate ( ) : Prado\Web\UI\ITemplate
Результат Prado\Web\UI\ITemplate the parsed template structure

registerContent() публичный Метод

Registers a content control.
public registerContent ( $id, TContent $object )
$object Prado\Web\UI\WebControls\TContent

registerContentPlaceHolder() публичный Метод

This method should only be used by framework and control developers.
public registerContentPlaceHolder ( $id, TContentPlaceHolder $object )
$object Prado\Web\UI\WebControls\TContentPlaceHolder

setMasterClass() публичный Метод

public setMasterClass ( $value )

setTemplate() публичный Метод

Note, the template will be applied to the whole control class. This method should only be used by framework and control developers.
public setTemplate ( $value )

tryToUpdateAR() публичный Метод

Function to try to update an AR object with data in view controls.
Автор: Daniel Sampedro ([email protected])
public tryToUpdateAR ( TActiveRecord $arObj, boolean $throwExceptions = false )
$arObj TActiveRecord
$throwExceptions boolean Wheter or not to throw exceptions

tryToUpdateView() публичный Метод

View controls and AR object need to have the same name in IDs and Attrs respectively.
Автор: Daniel Sampedro ([email protected])
public tryToUpdateView ( TActiveRecord $arObj, boolean $throwExceptions = false )
$arObj TActiveRecord
$throwExceptions boolean Wheter or not to throw exceptions