ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
ilProgressBar Class Reference
+ Collaboration diagram for ilProgressBar:

Public Member Functions

 setMin ($a_value)
 Set minimum value. More...
 
 setMax ($a_value)
 Set maximum value. More...
 
 setCaption ($a_value)
 Set Caption. More...
 
 setShowCaption ($a_value)
 Toggle show caption status. More...
 
 setStriped ($a_value)
 Toggle striped layout. More...
 
 setAnimated ($a_value)
 Toggle animated layout. More...
 
 setCurrent ($a_value)
 Set current value. More...
 
 render ()
 Render. More...
 

Static Public Member Functions

static getInstance ()
 Factory. More...
 

Data Fields

const TYPE_INFO = 1
 
const TYPE_SUCCESS = 2
 
const TYPE_WARNING = 3
 
const TYPE_DANGER = 4
 

Protected Member Functions

 __construct ()
 Constructor. More...
 
 setType ($a_value)
 Set type (currently unwanted) More...
 

Protected Attributes

 $min
 
 $max
 
 $current
 
 $show_caption
 
 $type
 
 $caption
 
 $striped
 
 $animated
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilProgressBar::__construct ( )
protected

Constructor.

Returns
self

Definition at line 32 of file class.ilProgressBar.php.

33 {
34 $this->setMin(0);
35 $this->setMax(100);
36 $this->setShowCaption(true);
37 $this->setType(self::TYPE_INFO);
38 $this->setStriped(true);
39 }
setMin($a_value)
Set minimum value.
setType($a_value)
Set type (currently unwanted)
setShowCaption($a_value)
Toggle show caption status.
setStriped($a_value)
Toggle striped layout.
setMax($a_value)
Set maximum value.

References setMax(), setMin(), setShowCaption(), setStriped(), and setType().

+ Here is the call graph for this function:

Member Function Documentation

◆ getInstance()

static ilProgressBar::getInstance ( )
static

◆ render()

ilProgressBar::render ( )

Render.

Returns
string

Definition at line 155 of file class.ilProgressBar.php.

156 {
157 $tpl = new ilTemplate("tpl.il_progress.html", true, true, "Services/UIComponent/ProgressBar");
158
159 $tpl->setVariable("MIN", $this->min);
160 $tpl->setVariable("MAX", $this->max);
161 $tpl->setVariable("CURRENT_INT", round($this->current));
162 $tpl->setVariable("CURRENT", round($this->current));
163 $tpl->setVariable("CAPTION", $this->caption);
164
165 $map = array(
166 self::TYPE_INFO => "info"
167 ,self::TYPE_SUCCESS => "success"
168 ,self::TYPE_WARNING => "warning"
169 ,self::TYPE_DANGER => "danger"
170 );
171 $css = array("progress-bar-".$map[$this->type]);
172
173 if($this->striped)
174 {
175 $css[] = "progress-bar-striped";
176 }
177
178 if($this->animated)
179 {
180 $css[] = "active";
181 }
182
183 $tpl->setVariable("CSS", implode(" ", $css));
184
185 if(!$this->show_caption)
186 {
187 $tpl->touchBlock("hide_caption_in_bl");
188 $tpl->touchBlock("hide_caption_out_bl");
189 }
190
191 return $tpl->get();
192 }
global $tpl
Definition: ilias.php:8
special template class to simplify handling of ITX/PEAR

References $tpl.

◆ setAnimated()

ilProgressBar::setAnimated (   $a_value)

Toggle animated layout.

Parameters
bool$a_value

Definition at line 130 of file class.ilProgressBar.php.

131 {
132 $this->animated = (bool)$a_value;
133 }

◆ setCaption()

ilProgressBar::setCaption (   $a_value)

Set Caption.

Parameters
string$a_value

Definition at line 100 of file class.ilProgressBar.php.

101 {
102 $this->caption = trim($a_value);
103 }

◆ setCurrent()

ilProgressBar::setCurrent (   $a_value)

Set current value.

Parameters
int | float$a_value

Definition at line 140 of file class.ilProgressBar.php.

141 {
142 $this->current = abs($a_value);
143 }

◆ setMax()

ilProgressBar::setMax (   $a_value)

Set maximum value.

Parameters
int$a_value

Definition at line 90 of file class.ilProgressBar.php.

91 {
92 $this->max = abs((int)$a_value);
93 }

Referenced by __construct().

+ Here is the caller graph for this function:

◆ setMin()

ilProgressBar::setMin (   $a_value)

Set minimum value.

Parameters
int$a_value

Definition at line 80 of file class.ilProgressBar.php.

81 {
82 $this->min = abs((int)$a_value);
83 }

Referenced by __construct().

+ Here is the caller graph for this function:

◆ setShowCaption()

ilProgressBar::setShowCaption (   $a_value)

Toggle show caption status.

Parameters
bool$a_value

Definition at line 110 of file class.ilProgressBar.php.

111 {
112 $this->show_caption = (bool)$a_value;
113 }

Referenced by __construct().

+ Here is the caller graph for this function:

◆ setStriped()

ilProgressBar::setStriped (   $a_value)

Toggle striped layout.

Parameters
bool$a_value

Definition at line 120 of file class.ilProgressBar.php.

121 {
122 $this->striped = (bool)$a_value;
123 }

Referenced by __construct().

+ Here is the caller graph for this function:

◆ setType()

ilProgressBar::setType (   $a_value)
protected

Set type (currently unwanted)

Parameters
int$a_value

Definition at line 61 of file class.ilProgressBar.php.

62 {
63 $valid = array(
64 self::TYPE_INFO
65 ,self::TYPE_SUCCESS
66 ,self::TYPE_WARNING
67 ,self::TYPE_DANGER
68 );
69 if(in_array($a_value, $valid))
70 {
71 $this->type = $a_value;
72 }
73 }
$valid

References $valid.

Referenced by __construct().

+ Here is the caller graph for this function:

Field Documentation

◆ $animated

ilProgressBar::$animated
protected

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

◆ $caption

ilProgressBar::$caption
protected

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

◆ $current

ilProgressBar::$current
protected

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

◆ $max

ilProgressBar::$max
protected

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

◆ $min

ilProgressBar::$min
protected

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

◆ $show_caption

ilProgressBar::$show_caption
protected

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

◆ $striped

ilProgressBar::$striped
protected

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

◆ $type

ilProgressBar::$type
protected

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

◆ TYPE_DANGER

const ilProgressBar::TYPE_DANGER = 4

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

◆ TYPE_INFO

const ilProgressBar::TYPE_INFO = 1

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

◆ TYPE_SUCCESS

const ilProgressBar::TYPE_SUCCESS = 2

Definition at line 23 of file class.ilProgressBar.php.

◆ TYPE_WARNING

const ilProgressBar::TYPE_WARNING = 3

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


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