CFormStringElement
包 | system.web.form |
---|---|
继承 | class CFormStringElement » CFormElement » CComponent |
可用自 | 1.1 |
源码 | framework/web/form/CFormStringElement.php |
公共属性
属性 | 类型 | 描述 | 被定义在 |
---|---|---|---|
attributes | array | list of attributes (name=>value) for the HTML element represented by this object. | CFormElement |
content | string | the string content | CFormStringElement |
on | string | Returns a value indicating under which scenarios this string is visible. | CFormStringElement |
parent | mixed | the direct parent of this element. | CFormElement |
visible | boolean | Returns a value indicating whether this element is visible and should be rendered. | CFormElement |
公共方法
方法 | 描述 | 被定义在 |
---|---|---|
__call() | Calls the named method which is not a class method. | CComponent |
__construct() | Constructor. | CFormElement |
__get() | Returns a property value or an attribute value. | CFormElement |
__isset() | Checks a property value or an attribute value on existence or not null | CFormElement |
__set() | Sets value of a property or attribute. | CFormElement |
__toString() | Converts the object to a string. | CFormElement |
__unset() | Sets a component property to be null. | CComponent |
asa() | Returns the named behavior object. | CComponent |
attachBehavior() | Attaches a behavior to this component. | CComponent |
attachBehaviors() | Attaches a list of behaviors to the component. | CComponent |
attachEventHandler() | Attaches an event handler to an event. | CComponent |
canGetProperty() | Determines whether a property can be read. | CComponent |
canSetProperty() | Determines whether a property can be set. | CComponent |
configure() | Configures this object with property initial values. | CFormElement |
detachBehavior() | Detaches a behavior from the component. | CComponent |
detachBehaviors() | Detaches all behaviors from the component. | CComponent |
detachEventHandler() | Detaches an existing event handler. | CComponent |
disableBehavior() | Disables an attached behavior. | CComponent |
disableBehaviors() | Disables all behaviors attached to this component. | CComponent |
enableBehavior() | Enables an attached behavior. | CComponent |
enableBehaviors() | Enables all behaviors attached to this component. | CComponent |
evaluateExpression() | Evaluates a PHP expression or callback under the context of this component. | CComponent |
getEventHandlers() | Returns the list of attached event handlers for an event. | CComponent |
getOn() | Returns a value indicating under which scenarios this string is visible. | CFormStringElement |
getParent() | Returns the direct parent of this element. This could be either a CForm object or a CBaseController object (a controller or a widget). | CFormElement |
getVisible() | Returns a value indicating whether this element is visible and should be rendered. | CFormElement |
hasEvent() | Determines whether an event is defined. | CComponent |
hasEventHandler() | Checks whether the named event has attached handlers. | CComponent |
hasProperty() | Determines whether a property is defined. | CComponent |
raiseEvent() | Raises an event. | CComponent |
render() | Renders this element. | CFormStringElement |
setOn() | Sets scenario names separated by commas. | CFormStringElement |
setVisible() | Sets whether this element is visible and should be rendered. | CFormElement |
受保护的方法
方法 | 描述 | 被定义在 |
---|---|---|
evaluateVisible() | Evaluates the visibility of this element. | CFormStringElement |
属性详情
the string content
Returns a value indicating under which scenarios this string is visible. If the value is empty, it means the string is visible under all scenarios. Otherwise, only when the model is in the scenario whose name can be found in this value, will the string be visible. See CModel::scenario for more information about model scenarios.
方法详情
protected boolean evaluateVisible()
| ||
{return} | boolean | whether this element is visible. |
protected function evaluateVisible()
{
return empty($this->_on) || in_array($this->getParent()->getModel()->getScenario(),$this->_on);
}
Evaluates the visibility of this element. This method will check the on property to see if the model is in a scenario that should have this string displayed.
public string getOn()
| ||
{return} | string | scenario names separated by commas. Defaults to null. |
Returns a value indicating under which scenarios this string is visible. If the value is empty, it means the string is visible under all scenarios. Otherwise, only when the model is in the scenario whose name can be found in this value, will the string be visible. See CModel::scenario for more information about model scenarios.
public string render()
| ||
{return} | string | the string content |
public function render()
{
return $this->content;
}
Renders this element. The default implementation simply returns content.
public void setOn(string $value)
| ||
$value | string | scenario names separated by commas. |
public function setOn($value)
{
$this->_on=preg_split('/[\s,]+/',$value,-1,PREG_SPLIT_NO_EMPTY);
}