ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilProgressBar Class Reference
+ Collaboration diagram for ilProgressBar:

Public Member Functions

 setType ($a_value)
 Set type (currently unwanted) More...
 
 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...
 
 setAsyncStatusUrl ($a_target)
 
 setAsynStatusTimeout ($a_timeout)
 
 setId ($a_id)
 
 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...
 

Protected Attributes

 $min
 
 $max
 
 $current
 
 $show_caption
 
 $type
 
 $caption
 
 $striped
 
 $animated
 
 $ajax_url = ''
 
 $ajax_timeout = 5
 
 $unique_id = ''
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilProgressBar::__construct ( )
protected

Constructor.

Returns
self

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

38 {
39 $this->setMin(0);
40 $this->setMax(100);
41 $this->setShowCaption(true);
42 $this->setType(self::TYPE_INFO);
43 $this->setStriped(true);
44 }
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()

◆ render()

ilProgressBar::render ( )

Render.

Returns
string

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

174 {
175 $tpl = new ilTemplate("tpl.il_progress.html", true, true, "Services/UIComponent/ProgressBar");
176
177 $tpl->setVariable("MIN", $this->min);
178 $tpl->setVariable("MAX", $this->max);
179 $tpl->setVariable("CURRENT_INT", round($this->current));
180 $tpl->setVariable("CURRENT", round($this->current));
181 $tpl->setVariable("CAPTION", $this->caption);
182
183 $map = array(
184 self::TYPE_INFO => "info"
185 ,self::TYPE_SUCCESS => "success"
186 ,self::TYPE_WARNING => "warning"
187 ,self::TYPE_DANGER => "danger"
188 );
189 $css = array("progress-bar-" . $map[$this->type]);
190
191 if ($this->striped) {
192 $css[] = "progress-bar-striped";
193 }
194
195 if ($this->animated) {
196 $css[] = "active";
197 }
198
199 $tpl->setVariable("CSS", implode(" ", $css));
200
201 if (!$this->show_caption) {
202 $tpl->touchBlock("hide_caption_in_bl");
203 $tpl->touchBlock("hide_caption_out_bl");
204 }
205
206 if (strlen($this->ajax_url) and $this->ajax_timeout) {
207 $tpl->setCurrentBlock('async_status');
208 $tpl->setVariable('ASYNC_STATUS_ID', $this->unique_id);
209 $tpl->setVariable('ICON_OK', ilUtil::getImagePath('icon_ok.svg'));
210 $tpl->setVariable('AJAX_URL', $this->ajax_url);
211 $tpl->setVariable('AJAX_TIMEOUT', 1000 * (int) $this->ajax_timeout);
212 $tpl->parseCurrentBlock();
213 }
214
215 $tpl->setVariable('PROGRESS_ID', $this->unique_id);
216
217 return $tpl->get();
218 }
$tpl
Definition: ilias.php:10
special template class to simplify handling of ITX/PEAR
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
const TYPE_WARNING
Definition: langcheck.php:49

References $map, $tpl, ilUtil\getImagePath(), and TYPE_WARNING.

+ Here is the call graph for this function:

◆ setAnimated()

ilProgressBar::setAnimated (   $a_value)

Toggle animated layout.

Parameters
bool$a_value

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

135 {
136 $this->animated = (bool) $a_value;
137 }

◆ setAsyncStatusUrl()

ilProgressBar::setAsyncStatusUrl (   $a_target)

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

150 {
151 $this->ajax_url = $a_target;
152 }

◆ setAsynStatusTimeout()

ilProgressBar::setAsynStatusTimeout (   $a_timeout)

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

155 {
156 $this->async_timeout = $a_timeout;
157 }

◆ setCaption()

ilProgressBar::setCaption (   $a_value)

Set Caption.

Parameters
string$a_value

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

105 {
106 $this->caption = trim($a_value);
107 }

◆ setCurrent()

ilProgressBar::setCurrent (   $a_value)

Set current value.

Parameters
int | float$a_value

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

145 {
146 $this->current = abs($a_value);
147 }

◆ setId()

ilProgressBar::setId (   $a_id)

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

160 {
161 $this->unique_id = $a_id;
162 }

◆ setMax()

ilProgressBar::setMax (   $a_value)

Set maximum value.

Parameters
int$a_value

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

95 {
96 $this->max = abs((int) $a_value);
97 }

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 84 of file class.ilProgressBar.php.

85 {
86 $this->min = abs((int) $a_value);
87 }

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 114 of file class.ilProgressBar.php.

115 {
116 $this->show_caption = (bool) $a_value;
117 }

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 124 of file class.ilProgressBar.php.

125 {
126 $this->striped = (bool) $a_value;
127 }

Referenced by __construct().

+ Here is the caller graph for this function:

◆ setType()

ilProgressBar::setType (   $a_value)

Set type (currently unwanted)

Parameters
int$a_value

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

67 {
68 $valid = array(
69 self::TYPE_INFO
70 ,self::TYPE_SUCCESS
72 ,self::TYPE_DANGER
73 );
74 if (in_array($a_value, $valid)) {
75 $this->type = $a_value;
76 }
77 }
$valid

References $valid, and TYPE_WARNING.

Referenced by __construct().

+ Here is the caller graph for this function:

Field Documentation

◆ $ajax_timeout

ilProgressBar::$ajax_timeout = 5
protected

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

◆ $ajax_url

ilProgressBar::$ajax_url = ''
protected

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

◆ $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.

◆ $unique_id

ilProgressBar::$unique_id = ''
protected

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

◆ TYPE_DANGER

const ilProgressBar::TYPE_DANGER = 4

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

◆ TYPE_INFO

const ilProgressBar::TYPE_INFO = 1

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

◆ TYPE_SUCCESS

const ilProgressBar::TYPE_SUCCESS = 2

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

Referenced by ilObjectCopyProgressTableGUI\fillRow().

◆ TYPE_WARNING

const ilProgressBar::TYPE_WARNING = 3

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


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