ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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.

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

38  {
39  $this->setMin(0);
40  $this->setMax(100);
41  $this->setShowCaption(true);
42  $this->setType(self::TYPE_INFO);
43  $this->setStriped(true);
44  }
setShowCaption($a_value)
Toggle show caption status.
setMax($a_value)
Set maximum value.
setMin($a_value)
Set minimum value.
setStriped($a_value)
Toggle striped layout.
setType($a_value)
Set type (currently unwanted)
+ Here is the call graph for this function:

Member Function Documentation

◆ getInstance()

◆ render()

ilProgressBar::render ( )

Render.

Returns
string

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

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

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

◆ setAnimated()

ilProgressBar::setAnimated (   $a_value)

Toggle animated layout.

Parameters
bool$a_value

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

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

◆ setAsyncStatusUrl()

ilProgressBar::setAsyncStatusUrl (   $a_target)

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

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

◆ setAsynStatusTimeout()

ilProgressBar::setAsynStatusTimeout (   $a_timeout)

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

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

◆ setCaption()

ilProgressBar::setCaption (   $a_value)

Set Caption.

Parameters
string$a_value

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

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

◆ setCurrent()

ilProgressBar::setCurrent (   $a_value)

Set current value.

Parameters
int | float$a_value

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

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

◆ setId()

ilProgressBar::setId (   $a_id)

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

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

◆ setMax()

ilProgressBar::setMax (   $a_value)

Set maximum value.

Parameters
int$a_value

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

Referenced by __construct().

96  {
97  $this->max = abs((int)$a_value);
98  }
+ Here is the caller graph for this function:

◆ setMin()

ilProgressBar::setMin (   $a_value)

Set minimum value.

Parameters
int$a_value

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

Referenced by __construct().

86  {
87  $this->min = abs((int)$a_value);
88  }
+ Here is the caller graph for this function:

◆ setShowCaption()

ilProgressBar::setShowCaption (   $a_value)

Toggle show caption status.

Parameters
bool$a_value

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

Referenced by __construct().

116  {
117  $this->show_caption = (bool)$a_value;
118  }
+ Here is the caller graph for this function:

◆ setStriped()

ilProgressBar::setStriped (   $a_value)

Toggle striped layout.

Parameters
bool$a_value

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

Referenced by __construct().

126  {
127  $this->striped = (bool)$a_value;
128  }
+ 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.

References $valid, array, and TYPE_WARNING.

Referenced by __construct().

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  {
76  $this->type = $a_value;
77  }
78  }
const TYPE_WARNING
Definition: langcheck.php:49
$valid
Create styles array
The data for the language used.
+ 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: