CMC for PHP
  • Namespace
  • Class
  • Tree

Namespaces

  • cmc
    • core
      • ui
    • db
      • mysqli
    • error
    • ui
      • widgets
  • PHP

Classes

  • area
  • areafactory
  • button
  • buttonfactory
  • checkbox
  • checkboxfactory
  • compositelist
  • compositelistfactory
  • input
  • inputfactory
  • label
  • labelfactory
  • link
  • linkfactory
  • menu
  • menufactory
  • select
  • selectfactory
  • tab
  • tabfactory
  • textarea
  • textareafactory
  • widget
  • widgetfactory

CMC for PHP is a web framework for PHP.
Copyright (c) 2014 by Calmarsoft company http://calmarsoft.com (FRANCE). All rights reserved.
Project information available here.

Class widget

common model for each widget

the widget as a relationship with a frame's view. It follows the lifecycle of the frame inside the view - we can change the view but the frame may remain valid -. it at first linked to the initial DOM. Then it can be updated using the Ajax scheme.

cmc\ui\widgets\widget implements cmc\core\IClonable, cmc\core\ISerializable

Direct known subclasses

cmc\ui\widgets\area, cmc\ui\widgets\compositelist, cmc\ui\widgets\input, cmc\ui\widgets\label, cmc\ui\widgets\link, cmc\ui\widgets\menu, cmc\ui\widgets\tab, cmc\ui\widgets\textarea

Indirect known subclasses

cmc\ui\widgets\button, cmc\ui\widgets\checkbox, cmc\ui\widgets\select

Abstract
Namespace: cmc\ui\widgets
Copyright: Copyright (c) Calmarsoft company (FRANCE) (http://calmarsoft.com)
License: GNU General Public License version 3
Version: 0.9
Link: CMC Project
Located at ui/widgets/widget.php

Methods summary

public
# __construct( mixed $frame, mixed $xpath = '' )
public
# setFrame( cmc\cmc\ui\frame $frame )

reassigns the underlying frame

reassigns the underlying frame

Parameters

$frame
cmc\ui\frame
$frame
public
# getFrame( )
public
# setName( strings $name )

assigns a name

assigns a name

Parameters

$name
strings
$name
public type
# getName( )

retrieves the name

retrieves the name

Returns

type
public
# setJSObject( string $jsType )

sets the javascript 'object' name, used in the JavaScript framework (jQuery, ...)

sets the javascript 'object' name, used in the JavaScript framework (jQuery, ...)

Parameters

$jsType
string
$jsType
public
# setJSObjectParms( mixed $jsParms )
public
# viewAttach( cmc\cmc\ui\view $view )

view attach: a new view's DOM is available used to update the current dom item from the current view

view attach: a new view's DOM is available used to update the current dom item from the current view

Parameters

$view
cmc\ui\view
$view
public
# AddWidgetEventListener( mixed $eventname, callable $cb )
public
# AddEventListener( type $eventname, callable $cb )

adds a callback listened for given event on given widget

adds a callback listened for given event on given widget

Parameters

$eventname
type
$eventname
$cb
cmc\ui\callable
$cb
protected
# OnWidgetEvent( mixed $eventName )
public
# DOMSetHtml( string $html_code )

shortcut method to change the value as HTML

shortcut method to change the value as HTML

Parameters

$html_code
string
$html_code
public
# DOMSetText( mixed $new_text )
public string
# DOMGetText( )

retrieves text part from the DOM

retrieves text part from the DOM

Returns

string
public
# DOMUpdateAttr( mixed $attr, mixed $attrval = null )
public
# DOMRemoveAttr( mixed $attr )
public string
# DOMGetAttr( string $attr )

gets an attribute value from the DOM

gets an attribute value from the DOM

Parameters

$attr
string
$attr

Returns

string
public string|boolean
# DOMGetNodeAttr( string $nodename, string $attr )

gets an attribute value from a named child node in the DOM

gets an attribute value from a named child node in the DOM

Parameters

$nodename
string
$nodename
$attr
string
$attr

Returns

string|boolean
public boolean
# DOMPutNodeAttr( string $nodename, string $attr, string $value )

sets an attribute value from a named child node in the DOM

sets an attribute value from a named child node in the DOM

Parameters

$nodename
string
$nodename
$attr
string
$attr
$value
string
$value

Returns

boolean
protected boolean
# applyPropertyDOM( baseview $view, string $propname, mixed $propval )

Changes the DOM using the given property

Changes the DOM using the given property

Parameters

$view
baseview
$view view being updated
$propname
string
$propname property name
$propval
mixed
$propval property new value

Returns

boolean
true if success
protected mixed
# modelPropertyDOM( string $propname )

Retreives the original property value (from model)

Retreives the original property value (from model)

Parameters

$propname
string
$propname property name

Returns

mixed
property value or false
protected
# getAjaxPropVal( mixed $propname )
protected
# setDataStateAjax( mixed $view, mixed $ajax )
public
# viewInitialUpdate( cmc\cmc\ui\view $view, cmc\cmc\ui\frame $frame )

initial update part (event trigered before cloning the view to the session)

initial update part (event trigered before cloning the view to the session)

Parameters

$view
baseview
$view
$frame
public
# viewPreUpdate( cmc\cmc\ui\dynview $view )

dynamic pre update current implementation restores the DOM element from current view

dynamic pre update current implementation restores the DOM element from current view

Parameters

$view
cmc\ui\dynview
$view
public
# viewUpdate( cmc\cmc\ui\dynview $view )

dynamic update current implementation applies the properties to the DOM, and updates the scripting part

dynamic update current implementation applies the properties to the DOM, and updates the scripting part

Parameters

$view
cmc\dynview
$view
public
# POSTupdatedata( type $wprops )

new properties come from a POST

new properties come from a POST

Parameters

$wprops
type
$wprops
public string
# getAjaxData( mixed $view )

gets updated data for the Ajax anwser (updated value, error, or empty if unchanged)

gets updated data for the Ajax anwser (updated value, error, or empty if unchanged)

Returns

string
public
# onPOSTDone( type $view )

POST 'done' event

POST 'done' event

Parameters

$view
type
$view
public
# setConstants( array $constants )

defines some constants for later use in the widget

defines some constants for later use in the widget

the constants can be referenced in place of field values

Parameters

$constants
array
$constants
public
# setProperty( string $propname, mixed $newval )

server-side new property value

server-side new property value

Parameters

$propname
string
$propname
$newval
mixed
$newval
public
# setPropertyDatasource( string $propname, cmc\cmc\db\datasource $ds )

direct datasource ...

direct datasource ...

Parameters

$propname
string
$propname
$ds
cmc\datasource
$ds
public
# setPropertyQuery( cmc\cmc\sess $sess, type $propname, type $query )

assigns a property name with a query name

assigns a property name with a query name

implementation will pull the datasource from the default data environment of the session

Parameters

$sess
cmc\sess
$sess
$propname
type
$propname
$query
type
$query
public
# syncProperty( string $propname, mixed $value )

sets a property value identical on client and on server

sets a property value identical on client and on server

Parameters

$propname
string
$propname
$value
mixed
$value
public mixed
# getProperty( string $propname )

retrieves the current property value

retrieves the current property value

Parameters

$propname
string
$propname

Returns

mixed
public boolean
# setCaption( string $newval )

server-side textual value update

server-side textual value update

Parameters

$newval
string
$newval

Returns

boolean
public boolean
# setHTML( string $newval )

server-side HTML value update

server-side HTML value update

Parameters

$newval
string
html text

Returns

boolean
public boolean
# setValue( string $newval )

sets the 'value' property

sets the 'value' property

Parameters

$newval
string
$newval

Returns

boolean
public boolean
# setVisible( boolean $newval )

sets the 'visible' property

sets the 'visible' property

Parameters

$newval
boolean
$newval

Returns

boolean
public
# show( )

shows the widget

shows the widget

public
# hide( )

hides the widget

hides the widget

public boolean
# setEnabled( boolean $newval )

sets the 'visible' property

sets the 'visible' property

Parameters

$newval
boolean
$newval

Returns

boolean
public
# enable( )

shows the widget

shows the widget

public
# disable( )

hides the widget

hides the widget

public string|boolean
# getCaption( )

gets the caption property valud

gets the caption property valud

Returns

string|boolean
public string|boolean
# getValue( )

gets the 'value' property

gets the 'value' property

Returns

string|boolean
public
# getVisible( )

gets the 'visible' property

gets the 'visible' property

public
# getEnabled( )

gets the 'enabled' property

gets the 'enabled' property

public
# setOptions( integer $opt )

enables a bool option

enables a bool option

Parameters

$opt
integer
$opt
public
# unsetOptions( integer $opt )

disables a bool option

disables a bool option

Parameters

$opt
integer
$opt
public
# bOption( integer $opt )

tests an option

tests an option

Parameters

$opt
integer
$opt
public boolean
# bDynamic( )

checks if the component as client interaction and feedback

checks if the component as client interaction and feedback

Returns

boolean
public
# bSetDynamic( )

forces the dynamic status (can be false in a static frame and simple component like label)

forces the dynamic status (can be false in a static frame and simple component like label)

public
# bClearDynamic( )

clears dynamic status to false (useful to avoid javascript dependencies, if no object javascript interaction is needed)

clears dynamic status to false (useful to avoid javascript dependencies, if no object javascript interaction is needed)

public
# getScriptCode( )

gets JavaScript Snipset to add in the document.ready() section - creation, client side validation, ajax update -

gets JavaScript Snipset to add in the document.ready() section - creation, client side validation, ajax update -

public
# addEventPost( string $event )

defines an event that will trigger a POST request

defines an event that will trigger a POST request

Parameters

$event
string
event name ('click', 'change', ...)
public
# addEventLocal( type $event, type $fn )

defines an event that will trigger a user defined function

defines an event that will trigger a user defined function

Parameters

$event
type
event name ('click', 'change', ...)
$fn
type
javascript function name
public
# addValidation( )

adds a validation to the widget

adds a validation to the widget

public
# addScriptCode( string $code )

adds some script code bound to widget client side object

adds some script code bound to widget client side object

Parameters

$code
string
$code
public
# OnSerialize( )

called before serialize

called before serialize

Implementation of

cmc\core\ISerializable::OnSerialize()
public
# OnUnserialize( )

called after unserialize

called after unserialize

Implementation of

cmc\core\ISerializable::OnUnserialize()
public
# onClone( mixed $srcinstance )

Methods inherited from cmc\core\IClonable

OnClone()

Magic methods summary

Constants summary

integer OPT_INPUT_LEAVE_AUTOCOMPLETE 1
#

When enabled, don't set 'autocomplete=off' attribute in input items (default is disabled)

When enabled, don't set 'autocomplete=off' attribute in input items (default is disabled)

string jqueryHighlight 'ui-state-highlight'
#
string jqueryFocus 'ui-state-focus'
#
string jqueryHover 'ui-state-hover'
#

Properties summary

protected mixed $_options
#
protected string $_dftTagId
#
protected mixed $_wviews
#
protected mixed $_currwview
#
protected mixed $_name
#
protected mixed $_jsObj
#
protected mixed $_jsObjParms
#
protected mixed $_domid
#
protected mixed $_properties
#
protected mixed $_constants
#
protected mixed $_bDynamic
#
protected boolean $_matDynamic
#
protected boolean $_preupdate
#
protected mixed $_actualscript
#
protected mixed $_composcript
#
CMC for PHP API documentation generated by ApiGen 2.8.0