3 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) !=
"") {
143 $layout_tpl =
new ilTemplate(
"tpl.prop_hv_layout.html",
true,
true,
"Services/Style/Content");
145 foreach ($this->dirs as $dir) {
148 $tpl =
new ilTemplate(
"tpl.prop_background_position.html",
true,
true,
"Services/Style/Content");
151 $pre_options = $pre_options[$dir];
154 case "vertical": $value = strtolower(trim($this->
getVerticalValue()));
break;
157 if (in_array($value, $pre_options)) {
158 $current_type =
"pre";
159 $tpl->setVariable(
"PREDEFINED_SELECTED",
'checked="checked"');
161 $current_type =
"unit";
162 $tpl->setVariable(
"NUMERIC_SELECTED",
'checked="checked"');
164 foreach ($unit_options as $u) {
165 if (substr($value, strlen($value) - strlen($u)) == $u) {
169 $disp_val = substr($value, 0, strlen($value) - strlen($current_unit));
170 if ($current_unit ==
"") {
171 $current_unit =
"px";
173 $tpl->setVariable(
"VAL_NUM", $disp_val);
176 foreach ($unit_options as $option) {
177 $tpl->setCurrentBlock(
"unit_option");
178 $tpl->setVariable(
"VAL_UNIT", $option);
179 $tpl->setVariable(
"TXT_UNIT", $option);
180 if ($current_type ==
"unit" && $current_unit == $option) {
181 $tpl->setVariable(
"UNIT_SELECTED",
'selected="selected"');
183 $tpl->parseCurrentBlock();
186 foreach ($pre_options as $option) {
187 $tpl->setCurrentBlock(
"pre_option");
188 $tpl->setVariable(
"VAL_PRE", $option);
189 $tpl->setVariable(
"TXT_PRE", $option);
190 if ($current_type ==
"pre" && $value == $option) {
191 $tpl->setVariable(
"PRE_SELECTED",
'selected="selected"');
193 $tpl->parseCurrentBlock();
197 $tpl->setVariable(
"TXT_DIR",
$lng->
txt(
"sty_$dir"));
198 $tpl->setVariable(
"DIR", $dir);
200 $layout_tpl->setVariable(strtoupper($dir),
$tpl->get());
202 $layout_tpl->setVariable(
"COLSPAN",
"2");
205 $a_tpl->
setVariable(
"PROP_GENERIC", $layout_tpl->get());
211 if ($a_values[$this->
getPostVar()][
"horizontal"][
"type"] ==
"predefined") {
215 $a_values[$this->
getPostVar()][
"horizontal"][
"num_unit"]);
217 if ($a_values[$this->
getPostVar()][
"vertical"][
"type"] ==
"predefined") {
221 $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)
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl