ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilProgressBar Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Collaboration diagram for ilProgressBar:

Public Member Functions

 setType (int $a_value)
 
 setMin (int $a_value)
 
 setMax (int $a_value)
 
 setCaption (string $a_value)
 
 setShowCaption (bool $a_value)
 
 setStriped (bool $a_value)
 
 setAnimated (bool $a_value)
 
 setCurrent (float $a_value)
 
 setAsyncStatusUrl (string $a_target)
 
 setAsynStatusTimeout (int $a_timeout)
 
 setId (string $a_id)
 
 render ()
 

Static Public Member Functions

static getInstance ()
 

Data Fields

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

Protected Member Functions

 __construct ()
 

Protected Attributes

ilGlobalTemplateInterface $main_tpl
 
int $min = 0
 
int $max = 0
 
int $current = 0
 
bool $show_caption = false
 
int $type = 0
 
string $caption = ""
 
bool $striped = false
 
bool $animated = false
 
string $ajax_url = ''
 
int $ajax_timeout = 5
 
string $unique_id = ''
 
int $async_timeout = 0
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Progress bar GUI

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om

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

Constructor & Destructor Documentation

◆ __construct()

ilProgressBar::__construct ( )
protected

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

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

45  {
46  global $DIC;
47 
48  $this->main_tpl = $DIC->ui()->mainTemplate();
49 
50  $this->setMin(0);
51  $this->setMax(100);
52  $this->setShowCaption(true);
53  $this->setType(self::TYPE_INFO);
54  $this->setStriped(true);
55  }
setShowCaption(bool $a_value)
global $DIC
Definition: feed.php:28
setMin(int $a_value)
setType(int $a_value)
setStriped(bool $a_value)
setMax(int $a_value)
+ Here is the call graph for this function:

Member Function Documentation

◆ getInstance()

◆ render()

ilProgressBar::render ( )

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

References $tpl, and ilUtil\getImagePath().

125  : string
126  {
127  $tpl = new ilTemplate("tpl.il_progress.html", true, true, "Services/UIComponent/ProgressBar");
128 
129  $tpl->setVariable("MIN", $this->min);
130  $tpl->setVariable("MAX", $this->max);
131  $tpl->setVariable("CURRENT_INT", round($this->current));
132  $tpl->setVariable("CURRENT", round($this->current));
133  $tpl->setVariable("CAPTION", $this->caption);
134 
135  $map = array(
136  self::TYPE_INFO => "info"
137  ,self::TYPE_SUCCESS => "success"
138  ,self::TYPE_WARNING => "warning"
139  ,self::TYPE_DANGER => "danger"
140  );
141  $css = array("progress-bar-" . $map[$this->type]);
142 
143  if ($this->striped) {
144  $css[] = "progress-bar-striped";
145  }
146 
147  if ($this->animated) {
148  $css[] = "active";
149  }
150 
151  $tpl->setVariable("CSS", implode(" ", $css));
152 
153  if (!$this->show_caption) {
154  $tpl->touchBlock("hide_caption_in_bl");
155  $tpl->touchBlock("hide_caption_out_bl");
156  }
157 
158  if ($this->ajax_url !== '' && $this->ajax_timeout) {
159  $this->main_tpl->addJavaScript("Services/UIComponent/ProgressBar/js/progress_bar.js");
160  $tpl->setCurrentBlock('async_status');
161  $tpl->setVariable('ASYNC_STATUS_ID', $this->unique_id);
162  $tpl->setVariable('ICON_OK', ilUtil::getImagePath('icon_ok.svg'));
163  $tpl->setVariable('AJAX_URL', $this->ajax_url);
164  $tpl->setVariable('AJAX_TIMEOUT', 1000 * $this->ajax_timeout);
165  $tpl->parseCurrentBlock();
166  }
167 
168  $tpl->setVariable('PROGRESS_ID', $this->unique_id);
169 
170  return $tpl->get();
171  }
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41
+ Here is the call graph for this function:

◆ setAnimated()

ilProgressBar::setAnimated ( bool  $a_value)

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

100  : void
101  {
102  $this->animated = $a_value;
103  }

◆ setAsyncStatusUrl()

ilProgressBar::setAsyncStatusUrl ( string  $a_target)

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

110  : void
111  {
112  $this->ajax_url = $a_target;
113  }

◆ setAsynStatusTimeout()

ilProgressBar::setAsynStatusTimeout ( int  $a_timeout)

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

115  : void
116  {
117  $this->async_timeout = $a_timeout;
118  }

◆ setCaption()

ilProgressBar::setCaption ( string  $a_value)

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

85  : void
86  {
87  $this->caption = trim($a_value);
88  }

◆ setCurrent()

ilProgressBar::setCurrent ( float  $a_value)

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

105  : void
106  {
107  $this->current = abs($a_value);
108  }

◆ setId()

ilProgressBar::setId ( string  $a_id)

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

120  : void
121  {
122  $this->unique_id = $a_id;
123  }

◆ setMax()

ilProgressBar::setMax ( int  $a_value)

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

Referenced by __construct().

80  : void
81  {
82  $this->max = abs($a_value);
83  }
+ Here is the caller graph for this function:

◆ setMin()

ilProgressBar::setMin ( int  $a_value)

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

Referenced by __construct().

75  : void
76  {
77  $this->min = abs($a_value);
78  }
+ Here is the caller graph for this function:

◆ setShowCaption()

ilProgressBar::setShowCaption ( bool  $a_value)

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

Referenced by __construct().

90  : void
91  {
92  $this->show_caption = $a_value;
93  }
+ Here is the caller graph for this function:

◆ setStriped()

ilProgressBar::setStriped ( bool  $a_value)

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

Referenced by __construct().

95  : void
96  {
97  $this->striped = $a_value;
98  }
+ Here is the caller graph for this function:

◆ setType()

ilProgressBar::setType ( int  $a_value)

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

References $valid.

Referenced by __construct().

62  : void
63  {
64  $valid = array(
65  self::TYPE_INFO
66  ,self::TYPE_SUCCESS
67  ,self::TYPE_WARNING
68  ,self::TYPE_DANGER
69  );
70  if (in_array($a_value, $valid)) {
71  $this->type = $a_value;
72  }
73  }
$valid
+ Here is the caller graph for this function:

Field Documentation

◆ $ajax_timeout

int ilProgressBar::$ajax_timeout = 5
protected

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

◆ $ajax_url

string ilProgressBar::$ajax_url = ''
protected

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

◆ $animated

bool ilProgressBar::$animated = false
protected

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

◆ $async_timeout

int ilProgressBar::$async_timeout = 0
protected

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

◆ $caption

string ilProgressBar::$caption = ""
protected

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

◆ $current

int ilProgressBar::$current = 0
protected

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

◆ $main_tpl

ilGlobalTemplateInterface ilProgressBar::$main_tpl
protected

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

◆ $max

int ilProgressBar::$max = 0
protected

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

◆ $min

int ilProgressBar::$min = 0
protected

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

◆ $show_caption

bool ilProgressBar::$show_caption = false
protected

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

◆ $striped

bool ilProgressBar::$striped = false
protected

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

◆ $type

int ilProgressBar::$type = 0
protected

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

◆ $unique_id

string ilProgressBar::$unique_id = ''
protected

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

◆ TYPE_DANGER

const ilProgressBar::TYPE_DANGER = 4

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

◆ TYPE_INFO

const ilProgressBar::TYPE_INFO = 1

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

◆ TYPE_SUCCESS

const ilProgressBar::TYPE_SUCCESS = 2

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

Referenced by ilObjectCopyProgressTableGUI\fillRow().

◆ TYPE_WARNING

const ilProgressBar::TYPE_WARNING = 3

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


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