50 $this->main_tpl = $DIC->ui()->mainTemplate();
55 $this->
setType(self::TYPE_INFO);
64 public function setType(
int $a_value): void
72 if (in_array($a_value,
$valid)) {
73 $this->type = $a_value;
77 public function setMin(
int $a_value): void
79 $this->min = abs($a_value);
82 public function setMax(
int $a_value): void
84 $this->max = abs($a_value);
89 $this->caption = trim($a_value);
94 $this->show_caption = $a_value;
99 $this->striped = $a_value;
104 $this->animated = $a_value;
109 $this->current = (
int) abs($a_value);
114 $this->ajax_url = $a_target;
119 $this->async_timeout = $a_timeout;
122 public function setId(
string $a_id): void
124 $this->unique_id = $a_id;
129 $tpl =
new ilTemplate(
"tpl.il_progress.html",
true,
true,
"components/ILIAS/UIComponent/ProgressBar");
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);
138 self::TYPE_INFO =>
"info" 139 ,self::TYPE_SUCCESS =>
"success" 140 ,self::TYPE_WARNING =>
"warning" 141 ,self::TYPE_DANGER =>
"danger" 143 $css = array(
"progress-bar-" . $map[$this->type]);
145 if ($this->striped) {
146 $css[] =
"progress-bar-striped";
149 if ($this->animated) {
153 $tpl->setVariable(
"CSS", implode(
" ", $css));
155 if (!$this->show_caption) {
156 $tpl->touchBlock(
"hide_caption_in_bl");
157 $tpl->touchBlock(
"hide_caption_out_bl");
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);
165 $tpl->setVariable(
'AJAX_URL', $this->ajax_url);
166 $tpl->setVariable(
'AJAX_TIMEOUT', 1000 * $this->ajax_timeout);
167 $tpl->parseCurrentBlock();
170 $tpl->setVariable(
'PROGRESS_ID', $this->unique_id);
ilGlobalTemplateInterface $main_tpl
setShowCaption(bool $a_value)
setCurrent(float $a_value)
setAnimated(bool $a_value)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setAsynStatusTimeout(int $a_timeout)
setAsyncStatusUrl(string $a_target)
setStriped(bool $a_value)
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
setCaption(string $a_value)