ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
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
Deprecated:
10

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

Constructor & Destructor Documentation

◆ __construct()

ilProgressBar::__construct ( )
protected

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

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

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

Member Function Documentation

◆ getInstance()

static ilProgressBar::getInstance ( )
static

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

Referenced by ilObjectCopyProgressTableGUI\fillRow(), ilObjWikiGUI\getUserHTMLExportProgressObject(), and ilSurveyExecutionGUI\outSurveyPage().

59  : self
60  {
61  return new self();
62  }
+ Here is the caller graph for this function:

◆ render()

ilProgressBar::render ( )

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

References ilUtil\getImagePath().

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

◆ setAnimated()

ilProgressBar::setAnimated ( bool  $a_value)

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

102  : void
103  {
104  $this->animated = $a_value;
105  }

◆ setAsyncStatusUrl()

ilProgressBar::setAsyncStatusUrl ( string  $a_target)

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

112  : void
113  {
114  $this->ajax_url = $a_target;
115  }

◆ setAsynStatusTimeout()

ilProgressBar::setAsynStatusTimeout ( int  $a_timeout)

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

117  : void
118  {
119  $this->async_timeout = $a_timeout;
120  }

◆ setCaption()

ilProgressBar::setCaption ( string  $a_value)

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

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

◆ setCurrent()

ilProgressBar::setCurrent ( float  $a_value)

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

References ILIAS\Repository\int().

107  : void
108  {
109  $this->current = (int) abs($a_value);
110  }
+ Here is the call graph for this function:

◆ setId()

ilProgressBar::setId ( string  $a_id)

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

122  : void
123  {
124  $this->unique_id = $a_id;
125  }

◆ setMax()

ilProgressBar::setMax ( int  $a_value)

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

Referenced by __construct().

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

◆ setMin()

ilProgressBar::setMin ( int  $a_value)

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

Referenced by __construct().

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

◆ setShowCaption()

ilProgressBar::setShowCaption ( bool  $a_value)

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

Referenced by __construct().

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

◆ setStriped()

ilProgressBar::setStriped ( bool  $a_value)

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

Referenced by __construct().

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

◆ setType()

ilProgressBar::setType ( int  $a_value)

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

References $valid.

Referenced by __construct().

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

Field Documentation

◆ $ajax_timeout

int ilProgressBar::$ajax_timeout = 5
protected

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

◆ $ajax_url

string ilProgressBar::$ajax_url = ''
protected

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

◆ $animated

bool ilProgressBar::$animated = false
protected

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

◆ $async_timeout

int ilProgressBar::$async_timeout = 0
protected

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

◆ $caption

string ilProgressBar::$caption = ""
protected

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

◆ $current

int ilProgressBar::$current = 0
protected

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

◆ $main_tpl

ilGlobalTemplateInterface ilProgressBar::$main_tpl
protected

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

◆ $max

int ilProgressBar::$max = 0
protected

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

◆ $min

int ilProgressBar::$min = 0
protected

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

◆ $show_caption

bool ilProgressBar::$show_caption = false
protected

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

◆ $striped

bool ilProgressBar::$striped = false
protected

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

◆ $type

int ilProgressBar::$type = 0
protected

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

◆ $unique_id

string ilProgressBar::$unique_id = ''
protected

Definition at line 43 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: