Class ModulePanelItem
CComponent is the base class for all components.
CComponent implements the protocol of defining, using properties and events.
A property is defined by a getter method, and/or a setter method. Properties can be accessed in the way like accessing normal object members. Reading or writing a property will cause the invocation of the corresponding getter or setter method, e.g
$a=$component->text; // equivalent to $a=$component->getText(); $component->text='abc'; // equivalent to $component->setText('abc');
The signatures of getter and setter methods are as follows,
// getter, defines a readable property 'text' public function getText() { ... } // setter, defines a writable property 'text' with $value to be set to the property public function setText($value) { ... }
An event is defined by the presence of a method whose name starts with 'on'. The event name is the method name. When an event is raised, functions (called event handlers) attached to the event will be invoked automatically.
An event can be raised by calling CComponent::raiseEvent()
method, upon which the
attached event handlers will be invoked automatically in the order they are
attached to the event. Event handlers must have the following signature,
function eventHandler($event) { ... }
where $event includes parameters associated with the event.
To attach an event handler to an event, see CComponent::attachEventHandler()
. You
can also use the following syntax:
$component->onClick=$callback; // or $component->onClick->add($callback);
where $callback refers to a valid PHP callback. Below we show some callback examples:
'handleOnClick' // handleOnClick() is a global function array($object,'handleOnClick') // using $object->handleOnClick() array('Page','handleOnClick') // using Page::handleOnClick()
To raise an event, use CComponent::raiseEvent()
. The on-method defining an event is
commonly written like the following:
public function onClick($event) { $this->raiseEvent('onClick',$event); }
where <span class="php-var">$event</span>
is an
instance of CEvent or its child class. One can then raise the event by
calling the on-method instead of CComponent::raiseEvent()
directly.
Both property names and event names are case-insensitive.
CComponent supports behaviors. A behavior is an instance of IBehavior which is attached to a component. The methods of the behavior can be invoked as if they belong to the component. Multiple behaviors can be attached to the same component.
To attach a behavior to a component, call CComponent::attachBehavior()
; and to
detach the behavior from the component, call CComponent::detachBehavior()
.
A behavior can be temporarily enabled or disabled by calling CComponent::enableBehavior()
or CComponent::disableBehavior()
, respectively. When disabled, the
behavior methods cannot be invoked via the component.
Starting from version 1.1.0, a behavior's properties (either its public member variables or its properties defined via getters and/or setters) can be accessed through the component it is attached to.
- CComponent
- PanelItem
- ModulePanelItem
Author: Qiang Xue <qiang.xue@gmail.com>
Since: 1.0
Located at x2engine/protected/modules/mobile/components/panel/ModulePanelItem.php
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
setHref(),
setId(),
setIsSelected(),
setTitle()
|
__call(),
__get(),
__isset(),
__set(),
__unset(),
asa(),
attachBehavior(),
attachBehaviors(),
attachEventHandler(),
canGetProperty(),
canSetProperty(),
detachBehavior(),
detachBehaviors(),
detachEventHandler(),
disableBehavior(),
disableBehaviors(),
enableBehavior(),
enableBehaviors(),
evaluateExpression(),
getEventHandlers(),
hasEvent(),
hasEventHandler(),
hasProperty(),
raiseEvent()
|
public
mixed
|
$module |
|
$htmlOptions,
$linkHtmlOptions
|