19 declare(strict_types=1);
37 public function __construct(
string $a_title =
"",
string $a_postvar =
"")
41 $this->
lng = $DIC->language();
42 $this->
user = $DIC->user();
45 $this->dirs = array(
"horizontal",
"vertical");
50 $this->horizontalvalue = $a_horizontalvalue;
60 $this->verticalvalue = $a_verticalvalue;
86 $a_val = trim($a_val);
87 $a_val_arr = explode(
" ", $a_val);
88 $hor = trim($a_val_arr[0]);
89 $ver = trim($a_val_arr[1] ??
"");
90 if ($hor ==
"center" && $ver ==
"") {
103 foreach ($this->dirs as $dir) {
104 $type = $input[$dir][
"type"];
105 $num_value = $input[$dir][
"num_value"];
106 $num_unit = $input[$dir][
"num_unit"];
107 $pre_value = $input[$dir][
"pre_value"];
109 if (!is_numeric($num_value) && trim($num_value) !=
"") {
115 if (
$type ==
"numeric") {
116 if ($num_value !=
"") {
117 $value = $num_value . $num_unit;
123 if (trim($value) !=
"") {
145 $layout_tpl =
new ilTemplate(
"tpl.prop_hv_layout.html",
true,
true,
"components/ILIAS/Style/Content");
147 foreach ($this->dirs as $dir) {
150 $tpl =
new ilTemplate(
"tpl.prop_background_position.html",
true,
true,
"components/ILIAS/Style/Content");
153 $pre_options = $pre_options[$dir];
161 if (in_array($value, $pre_options)) {
162 $current_type =
"pre";
163 $tpl->setVariable(
"PREDEFINED_SELECTED",
'checked="checked"');
165 $current_type =
"unit";
166 $tpl->setVariable(
"NUMERIC_SELECTED",
'checked="checked"');
168 foreach ($unit_options as $u) {
169 if (substr($value, strlen($value) - strlen($u)) == $u) {
173 $disp_val = substr($value, 0, strlen($value) - strlen($current_unit));
174 if ($current_unit ==
"") {
175 $current_unit =
"px";
177 $tpl->setVariable(
"VAL_NUM", $disp_val);
180 foreach ($unit_options as $option) {
181 $tpl->setCurrentBlock(
"unit_option");
182 $tpl->setVariable(
"VAL_UNIT", $option);
183 $tpl->setVariable(
"TXT_UNIT", $option);
184 if ($current_type ==
"unit" && $current_unit == $option) {
185 $tpl->setVariable(
"UNIT_SELECTED",
'selected="selected"');
187 $tpl->parseCurrentBlock();
190 foreach ($pre_options as $option) {
191 $tpl->setCurrentBlock(
"pre_option");
192 $tpl->setVariable(
"VAL_PRE", $option);
193 $tpl->setVariable(
"TXT_PRE", $option);
194 if ($current_type ==
"pre" && $value == $option) {
195 $tpl->setVariable(
"PRE_SELECTED",
'selected="selected"');
197 $tpl->parseCurrentBlock();
200 $tpl->setVariable(
"POSTVAR", $this->
getPostVar());
201 $tpl->setVariable(
"TXT_DIR",
$lng->
txt(
"sty_$dir"));
202 $tpl->setVariable(
"DIR", $dir);
204 $layout_tpl->setVariable(strtoupper($dir), $tpl->get());
206 $layout_tpl->setVariable(
"COLSPAN",
"2");
209 $a_tpl->
setVariable(
"PROP_GENERIC", $layout_tpl->get());
215 if ($a_values[$this->
getPostVar()][
"horizontal"][
"type"] ==
"predefined") {
219 $a_values[$this->
getPostVar()][
"horizontal"][
"num_unit"]);
221 if ($a_values[$this->
getPostVar()][
"vertical"][
"type"] ==
"predefined") {
225 $a_values[$this->
getPostVar()][
"vertical"][
"num_unit"]);
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...
static _getStyleParameterNumericUnits(bool $a_no_percentage=false)
setVariable($variable, $value='')
Sets a variable value.
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
__construct(Container $dic, ilPlugin $plugin)
static _getStyleParameterValues(string $par)