VihvLCC  3.0.0
Control Class Reference
Inheritance diagram for Control:
Collaboration diagram for Control:

Public Member Functions

 __construct ()
 
 setEventManager (EventManager $eventManager)
 
 getEventManager ()
 
 enable ()
 
 disable ()
 
 isEnabled ()
 
 getRootTag ()
 
 getResourceId ()
 
 getAttributes ()
 
 getXmlAttributes ()
 
 getTemplate ()
 
 warningHandler ($code, $message)
 
 setTheme (ITheme $theme)
 
 getTheme ()
 
 getXSLT ()
 
 getHtml ($format= 'html')
 
 getXml ()
 
 setData (Array $data)
 
 pushData ($key, $value)
 
 pushBoolData ($key, $value)
 
 getData ()
 
 setParent (Container $Container)
 
 getParent ()
 
 __call ($EventName, $Args)
 
 setEvent ($Name, $Handler)
 
 provide ($EventName)
 
 goBack ()
 
 onGetEvent ($Sender, $Input)
 
 onPostEvent ($Sender, $Input)
 
 onCreateEvent ($sender)
 
 onParkedEvent ($sender)
 
 onRootTemplateLoadEvent ($Sender, $DOM)
 
 onDisplayEvent ($Sender)
 
 onEnableEvent ($sender)
 
 onDisableEvent ($Sender)
 
 onDefaultPageEvent ($Sender)
 
 onBeforeDisplayEvent ($Sender)
 
 onParented ()
 
 onParentedEvent ()
 
- Public Member Functions inherited from IControl
 GetHtml ()
 
 GetXml ()
 
 Provide ($Name)
 
 SetParent ($Container)
 
 OnGetEvent ($Input, $Sender)
 
 OnPostEvent ($Input, $Sender)
 
 SetEvent ($Name, $Handler)
 

Data Fields

 $Data
 

Detailed Description

base class for all controls control abstracts functional part of aplication

Constructor & Destructor Documentation

__construct ( )

create object and declare basic events, then runs onCreate event

Member Function Documentation

__call (   $EventName,
  $Args 
)

call event handler

  • checks if user is allowed to perform the action via ACL
  • checks if control provide event hander for the action
Parameters
string$EventName
any$Args
Returns
any what event handler returns
Exceptions
EControlEventNotFound
disable ( )

disable this control, then run onDisable event

enable ( )

enable this control, then run onEnable event

getAttributes ( )

override this to add attributes to root xml tag

Returns
array attributes for root xml tag (used by getXml), key=>value
getData ( )

get output data as array

Returns
Array associative array of data to be displayed
getEventManager ( )
getHtml (   $format = 'html')
Parameters
$formatcan be 'html' or 'xml', dafault if 'html'
Returns
xslt output
getParent ( )
Returns
parent control
getResourceId ( )
Returns
string resourceId used by ACL system, you can allow/deny/drop usage of the resource
getRootTag ( )
Returns
string root tag for GetXml
getTemplate ( )

call theme to get xslt template filename, you can override it for each control if tou do not want to use themes

Returns
filename (with path) to XSLT template needed for this control
getTheme ( )
Returns
ITheme theme to be used by this control, if no theme set - it will return parent control theme
getXml ( )

serialize control data as xml

Returns
string
getXmlAttributes ( )
Returns
string xml attributes as string
getXSLT ( )
Returns
XSLT template for this control
Exceptions
ETemplateParseError
goBack ( )

redirect to THE SAME page but only with GET method, this almost be the page with form you submit, should be used in OnPostEvent or Events raised by OnPostEvent

isEnabled ( )
Returns
bool true if enabled
onBeforeDisplayEvent (   $Sender)

to be overriden by child class default handler for onBeforeDisplay the last event before page rendering

Parameters
\vihv\Control$Senderobject which provide this event handler, in most cases $sender is equal to $this, unless several different controls use the same event handler
onCreateEvent (   $sender)

to be overriden by clind class this event raised right after constructor

Parameters
\vihv\Control$Senderobject which provide this event handler, in most cases $sender is equal to $this, unless several different controls use the same event handler

Implements IControl.

onDefaultPageEvent (   $Sender)
Deprecated:
since version 2.0.0 to be overriden by child class default handler for onDefaultPageEvent
Parameters
\vihv\Control$Senderobject which provide this event handler, in most cases $sender is equal to $this, unless several different controls use the same event handler
onDisableEvent (   $Sender)

to be overriden by child class default handler for onDisable event

Parameters
\vihv\Control$Senderobject which provide this event handler, in most cases $sender is equal to $this, unless several different controls use the same event handler
onDisplayEvent (   $Sender)

to be overriden by child class default handler for onDisplay event

Parameters
\vihv\Control$Senderobject which provide this event handler, in most cases $sender is equal to $this, unless several different controls use the same event handler
onEnableEvent (   $sender)

to be overriden by child class default handler for onEnable event good place to collect data from models and push it with Control::pushData to view lavel

Parameters
\vihv\Control$Senderobject which provide this event handler, in most cases $sender is equal to $this, unless several different controls use the same event handler
onGetEvent (   $Sender,
  $Input 
)

to be overriden by child class this is default (does nothing) event handler, you can set it to be any function, even from another class

Parameters
$Input- same as global $_GET, but after passing validation, should be safe for interaction with database
$Sender- as for $this wont work if handler will be defined outside control, use $Sender instead. $Sender points to the control. Common usage - modify $Sender->Data
onParented ( )

call onParented event without using ACL (because ALC is unavailable at that moment), but same coding style, do mot call this manually

onParentedEvent ( )

default handler for onParented event

onParkedEvent (   $sender)

to be overriden by child class default event handler for onParked, onParked is rising when eventManager park this control (set it as listener, see EventManager::park, EventManager::parkMany)

Parameters
\vihv\Control$Senderobject which provide this event handler, in most cases $sender is equal to $this, unless several different controls use the same event handler
onPostEvent (   $Sender,
  $Input 
)

to be overriden by child class

Parameters
\vihv\Control$Senderobject which provide this event handler, in most cases $sender is equal to $this, unless several different controls use the same event handler
onRootTemplateLoadEvent (   $Sender,
  $DOM 
)

to be overriden by child class default handler for onRootTemplateLoad event

Parameters
\vihv\Control$Senderobject which provide this event handler, in most cases $sender is equal to $this, unless several different controls use the same event handler
\DomDocument$DOM
provide (   $EventName)
Parameters
string$EventName
Returns
boolean true if this control provide event handler for the event with specified name
pushBoolData (   $key,
  $value 
)

add bool element to control's data, data will be serialized as xml and sent to view level, if value is false - nothing will be added

Parameters
string$key
bool$value
Exceptions
EControlPushBool
pushData (   $key,
  $value 
)

add element to control's data, data will be serialized as xml and sent to view level

Parameters
string$key
any$value
setData ( Array  $data)

set output data

Parameters
Array$dataassociative array with basic types only, this data will be serialized as xml and sent to view level
setEvent (   $Name,
  $Handler 
)

Example $Sender->SetEvent('OnEnable', array($this, 'OnEnableEvent'));

Parameters
$Namename of event, event will be called like $Sender->OnEnable()
$Handlerarray(object what contains method, method name) where "method" is a fuction what does all real work
setEventManager ( EventManager  $eventManager)

$eventManager EventManaget

Here is the caller graph for this function:

setParent ( Container  $Container)

set another control as parent control for this one, then call onParented event

Parameters
\vihv\Container$Container

Here is the caller graph for this function:

setTheme ( ITheme  $theme)

set theme for current control, in most cases should be used only for root control theme needed to handle relation between control and xmlt template (view level) you can avoid using themes by overriding getTemplate method for each control

Parameters
\vihv\ITheme$theme
warningHandler (   $code,
  $message 
)
Parameters
number$code
string$message
Exceptions
EXslError

Field Documentation

$Data

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