ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilButton Class Reference
+ Inheritance diagram for ilButton:
+ Collaboration diagram for ilButton:

Public Member Functions

 __clone ()
 Clone instance.
 getType ()
 Get button type.
 setId ($a_value)
 Set id.
 getId ()
 Get id.
 setCaption ($a_value, $a_is_lng_id=true)
 Set caption.
 getCaption ($a_translate=true)
 Get caption.
 setPrimary ($a_value)
 Toggle primary status.
 isPrimary ()
 Get primary status.
 setOmitPreventDoubleSubmission ($a_value)
 Toggle double submission prevention status.
 getOmitPreventDoubleSubmission ()
 Get double submission prevention status.
 setOnClick ($a_value)
 Set onclick.
 getOnClick ()
 Get onclick.
 setAccessKey ($a_value)
 Set access key.
 getAccessKey ()
 Get access key.
 setDisabled ($a_value)
 Toggle disabled status.
 isDisabled ()
 Get disabled status.
 addCSSClass ($a_value)
 Add CSS class.
 getCSSClasses ()
 Get CSS class(es)
 render ()
 Render HTML.

Static Public Member Functions

static getInstance ()
 Factory.

Data Fields

const TYPE_SUBMIT = 1
const TYPE_LINK = 2

Protected Member Functions

 __construct ($a_type)
 Constructor.
 setType ($a_value)
 Set button type.
 gatherCssClasses ()
 Gather all active CSS classes.
 renderAttributesHelper (array $a_attr)
 Render HTML node attributes.
 renderAttributes (array $a_additional_attr=null)
 Render current HTML attributes.
 prepareRender ()
 Prepare render.

Protected Attributes

 $type
 $id
 $caption
 $caption_is_lng_id
 $primary
 $omit_prevent_double_submission
 $onclick
 $acc_key
 $disabled
 $css = array()

Detailed Description

Definition at line 11 of file class.ilButton.php.

Constructor & Destructor Documentation

ilButton::__construct (   $a_type)
protected

Constructor.

Parameters
int$a_type
Returns
self

Definition at line 33 of file class.ilButton.php.

References setType().

{
$this->setType($a_type);
}

+ Here is the call graph for this function:

Member Function Documentation

ilButton::__clone ( )

Clone instance.

Definition at line 41 of file class.ilButton.php.

References setId().

{
$this->setId(null);
}

+ Here is the call graph for this function:

ilButton::addCSSClass (   $a_value)

Add CSS class.

Parameters
string$a_value

Definition at line 236 of file class.ilButton.php.

Referenced by prepareRender().

{
$this->css[] = $a_value;
}

+ Here is the caller graph for this function:

ilButton::gatherCssClasses ( )
protected

Gather all active CSS classes.

Returns
string

Definition at line 261 of file class.ilButton.php.

References $css, getCSSClasses(), getOmitPreventDoubleSubmission(), and isPrimary().

Referenced by renderAttributes().

{
$css = array_unique($this->getCSSClasses());
if($this->isPrimary())
{
$css[] = "btn-primary";
}
{
$css[] = "omitPreventDoubleSubmission";
}
return implode(" ", $css);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilButton::getAccessKey ( )

Get access key.

Returns
string

Definition at line 206 of file class.ilButton.php.

References $acc_key.

Referenced by renderAttributes().

{
}

+ Here is the caller graph for this function:

ilButton::getCaption (   $a_translate = true)

Get caption.

Parameters
bool$a_translate
Returns
string

Definition at line 116 of file class.ilButton.php.

References $caption, and $lng.

Referenced by ilSubmitButton\render(), and ilImageLinkButton\renderCaption().

{
global $lng;
if($this->caption_is_lng_id &&
(bool)$a_translate)
{
$caption = $lng->txt($caption);
}
return $caption;
}

+ Here is the caller graph for this function:

ilButton::getCSSClasses ( )

Get CSS class(es)

Returns
array

Definition at line 246 of file class.ilButton.php.

References $css.

Referenced by gatherCssClasses().

{
return $this->css;
}

+ Here is the caller graph for this function:

ilButton::getId ( )

Get id.

Returns
string

Definition at line 93 of file class.ilButton.php.

References $id.

Referenced by renderAttributes().

{
return $this->id;
}

+ Here is the caller graph for this function:

static ilButton::getInstance ( )
staticabstract

Factory.

Returns
self

Reimplemented in ilDataCollectionLinkButton, ilImageLinkButton, ilLinkButton, and ilSubmitButton.

ilButton::getOmitPreventDoubleSubmission ( )

Get double submission prevention status.

Returns
bool

Definition at line 166 of file class.ilButton.php.

References $omit_prevent_double_submission.

Referenced by gatherCssClasses().

+ Here is the caller graph for this function:

ilButton::getOnClick ( )

Get onclick.

Returns
string

Definition at line 186 of file class.ilButton.php.

References $onclick.

Referenced by renderAttributes().

{
}

+ Here is the caller graph for this function:

ilButton::getType ( )

Get button type.

Returns
int

Definition at line 73 of file class.ilButton.php.

References $type.

{
return $this->type;
}
ilButton::isDisabled ( )

Get disabled status.

Returns
bool

Definition at line 226 of file class.ilButton.php.

References $disabled.

Referenced by renderAttributes().

{
}

+ Here is the caller graph for this function:

ilButton::isPrimary ( )

Get primary status.

Returns
bool

Definition at line 146 of file class.ilButton.php.

References $primary.

Referenced by gatherCssClasses().

{
}

+ Here is the caller graph for this function:

ilButton::prepareRender ( )
protected

Prepare render.

Reimplemented in ilImageLinkButton, and ilDataCollectionLinkButton.

Definition at line 335 of file class.ilButton.php.

References addCSSClass().

Referenced by ilSubmitButton\render(), and ilLinkButton\render().

{
$this->addCSSClass("btn");
$this->addCSSClass("btn-default");
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilButton::render ( )
abstract

Render HTML.

Returns
string

Reimplemented in ilLinkButton, ilSubmitButton, and ilDataCollectionLinkButton.

ilButton::renderAttributes ( array  $a_additional_attr = null)
protected

Render current HTML attributes.

Parameters
array$a_additional_attr
Returns
string

Definition at line 306 of file class.ilButton.php.

References gatherCssClasses(), getAccessKey(), getId(), ilAccessKey\getKey(), getOnClick(), isDisabled(), and renderAttributesHelper().

{
$attr = array();
$attr["id"] = $this->getId();
$attr["class"] = $this->gatherCssClasses();
$attr["onclick"] = $this->getOnClick();
if($this->getAccessKey())
{
include_once("./Services/Accessibility/classes/class.ilAccessKey.php");
$attr["accesskey"] = ilAccessKey::getKey($this->getAccessKey());
}
if($this->isDisabled())
{
$attr["disabled"] = "disabled";
}
if(sizeof($a_additional_attr))
{
$attr = array_merge($attr, $a_additional_attr);
}
return $this->renderAttributesHelper($attr);
}

+ Here is the call graph for this function:

ilButton::renderAttributesHelper ( array  $a_attr)
protected

Render HTML node attributes.

Returns
string

Definition at line 282 of file class.ilButton.php.

References $id, and $res.

Referenced by renderAttributes().

{
$res = array();
foreach($a_attr as $id => $value)
{
if(trim($value))
{
$res[] = strtolower(trim($id)).'="'.$value.'"';
}
}
if(sizeof($res))
{
return " ".implode(" ", $res);
}
}

+ Here is the caller graph for this function:

ilButton::setAccessKey (   $a_value)

Set access key.

Parameters
string$a_value

Definition at line 196 of file class.ilButton.php.

{
$this->acc_key = trim($a_value);
}
ilButton::setCaption (   $a_value,
  $a_is_lng_id = true 
)

Set caption.

Parameters
string$a_value
bool$a_is_lng_id

Definition at line 104 of file class.ilButton.php.

{
$this->caption = $a_value;
$this->caption_is_lng_id = (bool)$a_is_lng_id;
}
ilButton::setDisabled (   $a_value)

Toggle disabled status.

Parameters
bool$a_value

Definition at line 216 of file class.ilButton.php.

{
$this->disabled = (bool)$a_value;
}
ilButton::setId (   $a_value)

Set id.

Parameters
string$a_value

Definition at line 83 of file class.ilButton.php.

Referenced by __clone().

{
$this->id = $a_value;
}

+ Here is the caller graph for this function:

ilButton::setOmitPreventDoubleSubmission (   $a_value)

Toggle double submission prevention status.

Parameters
bool$a_value

Definition at line 156 of file class.ilButton.php.

{
$this->omit_prevent_double_submission = (bool)$a_value;
}
ilButton::setOnClick (   $a_value)

Set onclick.

Parameters
string$a_value

Definition at line 176 of file class.ilButton.php.

{
$this->onclick = trim($a_value);
}
ilButton::setPrimary (   $a_value)

Toggle primary status.

Parameters
bool$a_value

Definition at line 136 of file class.ilButton.php.

{
$this->primary = (bool)$a_value;
}
ilButton::setType (   $a_value)
protected

Set button type.

Parameters
int$a_value

Definition at line 63 of file class.ilButton.php.

Referenced by __construct().

{
$this->type = (int)$a_value;
}

+ Here is the caller graph for this function:

Field Documentation

ilButton::$acc_key
protected

Definition at line 20 of file class.ilButton.php.

Referenced by getAccessKey().

ilButton::$caption
protected

Definition at line 15 of file class.ilButton.php.

Referenced by getCaption().

ilButton::$caption_is_lng_id
protected

Definition at line 16 of file class.ilButton.php.

ilButton::$css = array()
protected

Definition at line 22 of file class.ilButton.php.

Referenced by gatherCssClasses(), and getCSSClasses().

ilButton::$disabled
protected

Definition at line 21 of file class.ilButton.php.

Referenced by isDisabled().

ilButton::$id
protected

Definition at line 14 of file class.ilButton.php.

Referenced by getId(), and renderAttributesHelper().

ilButton::$omit_prevent_double_submission
protected

Definition at line 18 of file class.ilButton.php.

Referenced by getOmitPreventDoubleSubmission().

ilButton::$onclick
protected

Definition at line 19 of file class.ilButton.php.

Referenced by getOnClick().

ilButton::$primary
protected

Definition at line 17 of file class.ilButton.php.

Referenced by isPrimary().

ilButton::$type
protected

Definition at line 13 of file class.ilButton.php.

Referenced by getType().

const ilButton::TYPE_LINK = 2

Definition at line 25 of file class.ilButton.php.

Referenced by ilImageLinkButton\getInstance(), and ilLinkButton\getInstance().

const ilButton::TYPE_SUBMIT = 1

Definition at line 24 of file class.ilButton.php.

Referenced by ilSubmitButton\getInstance().


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