Source for file TCheckButton.php
Documentation is available at TCheckButton.php
namespace
Adianti \
Widget \
Form ;
use
Adianti \
Widget \
Form \
TField ;
use
Adianti \
Widget \
Form \
TLabel ;
* @author Pablo Dall'Oglio
* @copyright Copyright (c) 2006 Adianti Solutions Ltd. (http://www.adianti.com.br)
* @license http://www.adianti.com.br/framework-license
* @param $name Name of the widget
$this -> id =
'tcheckbutton_' .
mt_rand ( 1000000000 , 1999999999 ) ;
$this -> tag -> { 'class' } =
'' ;
$this -> useSwitch =
FALSE ;
public function setUseSwitch ( $useSwitch =
TRUE , $labelClass =
'blue' )
$this -> labelClass =
'tswitch ' .
$labelClass ;
$this -> useSwitch =
$useSwitch ;
* Define the index value for check button
$this -> indexValue =
$index ;
* Shows the widget at the screen
// define the tag properties for the checkbutton
$this -> tag -> { 'name' } =
$this -> name ; // tag name
$this -> tag -> { 'type' } =
'checkbox' ; // input type
$this -> tag -> { 'value' } =
$this -> indexValue ; // value
if ( $this -> id and empty ( $this -> tag -> { 'id' } ))
$this -> tag -> { 'id' } =
$this -> id ;
// compare current value with indexValue
$this -> tag -> { 'checked' } =
'1' ;
// check whether the widget is non-editable
// make the widget read-only
//$this->tag-> disabled = "1"; // the value don't post
$this -> tag -> { 'onclick' } =
"return false;" ;
$this -> tag -> { 'style' } =
'pointer-events:none' ;
$this -> tag -> { 'tabindex' } =
'-1' ;
$obj -> { 'class' } =
'tswitch ' .
$this -> labelClass ;
$obj -> { 'for' } =
$this -> id ;
$this -> tag -> { 'class' } =
'filled-in btn-tswitch' ;
$wrapper -> { 'style' } =
'display:inline-flex;align-items:center;' ;
$wrapper -> add ( $this -> tag ) ;