19 declare(strict_types=1);
31 protected string $alt =
"";
37 string $a_postvar =
"" 41 $this->
lng = $DIC->language();
42 $lng = $DIC->language();
47 $this->
setSuffixes(array(
"jpg",
"jpeg",
"png",
"gif"));
50 $this->tpl = $DIC->ui()->mainTemplate();
55 $this->allow_deletion = $a_val;
65 $this->allow_capture = $a_val;
81 $this->cache = $a_cache;
89 public function setImage(
string $a_image): void
91 $this->image = $a_image;
99 public function setAlt(
string $a_alt): void
113 $quota_exceeded = $quota_legend =
false;
114 $i_tpl =
new ilTemplate(
"tpl.prop_image_file.html",
true,
true,
"components/ILIAS/Form");
117 $i_tpl->setCurrentBlock(
"capture");
118 $i_tpl->setVariable(
"POST_VAR_V", $this->
getPostVar());
119 $i_tpl->setVariable(
"TXT_USE_CAMERA",
$lng->
txt(
"form_use_camera"));
120 $i_tpl->setVariable(
"TXT_TAKE_SNAPSHOT",
$lng->
txt(
"form_take_snapshot"));
121 $i_tpl->parseCurrentBlock();
123 $main_tpl->addJavascript(
"assets/js/ServiceFormImageFileCapture.js");
129 $i_tpl->setVariable(
"POST_VAR_D", $this->
getPostVar());
131 "TXT_DELETE_EXISTING",
132 $lng->
txt(
"delete_existing_file")
134 $i_tpl->parseCurrentBlock();
138 $i_tpl->setCurrentBlock(
"has_value");
139 $i_tpl->setVariable(
"TEXT_IMAGE_NAME", $this->
getValue());
140 $i_tpl->parseCurrentBlock();
142 $i_tpl->setCurrentBlock(
"image");
144 $pos = strpos($this->
getImage(),
'?');
145 if ($pos !==
false) {
146 $i_tpl->setVariable(
"SRC_IMAGE", $this->
getImage() .
"&time=" . time());
148 $i_tpl->setVariable(
"SRC_IMAGE", $this->
getImage() .
"?time=" . time());
151 $i_tpl->setVariable(
"SRC_IMAGE", $this->
getImage());
153 $i_tpl->setVariable(
"POST_VAR_I", $this->
getPostVar());
154 $i_tpl->setVariable(
"ALT_IMAGE", $this->
getAlt());
155 $i_tpl->parseCurrentBlock();
160 $i_tpl->setCurrentBlock(
"pending");
161 $i_tpl->setVariable(
"TXT_PENDING",
$lng->
txt(
"file_upload_pending") .
163 $i_tpl->parseCurrentBlock();
166 $i_tpl->setVariable(
'MAX_SIZE_WARNING', $this->
lng->txt(
'form_msg_file_size_exceeds'));
167 $i_tpl->setVariable(
'MAX_SIZE', $this->upload_limit->getPhpUploadLimitInBytes());
168 $i_tpl->setVariable(
"POST_VAR", $this->
getPostVar());
169 $i_tpl->setVariable(
"ID", $this->
getFieldId());
170 $i_tpl->setVariable(
"LABEL_SELECTED_FILES_INPUT", $this->
lng->txt(
'selected_files'));
173 $i_tpl->setVariable(
"TXT_BROWSE",
$lng->
txt(
"select_file"));
176 if (!$quota_exceeded) {
177 $i_tpl->setVariable(
"TXT_MAX_SIZE",
$lng->
txt(
"file_notice") .
" " .
182 $i_tpl->setVariable(
"TXT_MAX_SIZE", $quota_exceeded);
188 " disabled=\"disabled\"" 193 $a_tpl->
setVariable(
"PROP_GENERIC", $i_tpl->get());
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
setCurrentBlock(string $part=self::DEFAULT_BLOCK)
Sets the template to the given block.
setVariable($variable, $value='')
Sets a variable value.
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
__construct(Container $dic, ilPlugin $plugin)