51 $this->lng = $DIC->language();
52 $this->
user = $DIC->user();
53 parent::__construct($a_title, $a_postvar);
54 $this->
setType(
"style_numeric");
55 $this->dirs = array(
"all",
"top",
"bottom",
"left",
"right");
65 $this->allvalue = $a_allvalue;
75 return $this->allvalue;
85 $this->topvalue = $a_topvalue;
95 return $this->topvalue;
105 $this->bottomvalue = $a_bottomvalue;
115 return $this->bottomvalue;
125 $this->leftvalue = $a_leftvalue;
135 return $this->leftvalue;
145 $this->rightvalue = $a_rightvalue;
155 return $this->rightvalue;
165 $this->allowpercentage = $a_allowpercentage;
187 foreach ($this->dirs as $dir) {
201 if (!is_numeric($num_value) && $num_value !=
"") {
202 $this->
setAlert(
$lng->txt(
"sty_msg_input_must_be_numeric"));
206 if (trim($num_value) !=
"") {
208 case "all": $this->
setAllValue($num_value . $num_unit);
break;
209 case "top": $this->
setTopValue($num_value . $num_unit);
break;
210 case "bottom": $this->
setBottomValue($num_value . $num_unit);
break;
211 case "left": $this->
setLeftValue($num_value . $num_unit);
break;
212 case "right": $this->
setRightValue($num_value . $num_unit);
break;
227 $layout_tpl =
new ilTemplate(
"tpl.prop_trbl_layout.html",
true,
true,
"Services/Style/Content");
229 foreach ($this->dirs as $dir) {
230 $tpl =
new ilTemplate(
"tpl.prop_trbl_style_numeric.html",
true,
true,
"Services/Style/Content");
242 foreach ($unit_options as $u) {
243 if (substr(
$value, strlen(
$value) - strlen($u)) == $u) {
247 $disp_val = substr(
$value, 0, strlen(
$value) - strlen($current_unit));
248 if ($current_unit ==
"") {
249 $current_unit =
"px";
252 foreach ($unit_options as $option) {
253 $tpl->setCurrentBlock(
"unit_option");
254 $tpl->setVariable(
"VAL_UNIT", $option);
255 $tpl->setVariable(
"TXT_UNIT", $option);
256 if ($current_unit == $option) {
257 $tpl->setVariable(
"UNIT_SELECTED",
'selected="selected"');
259 $tpl->parseCurrentBlock();
263 $tpl->setVariable(
"VAL_NUM", $disp_val);
264 $tpl->setVariable(
"TXT_DIR",
$lng->txt(
"sty_$dir"));
265 $tpl->setVariable(
"DIR", $dir);
267 $layout_tpl->setVariable(strtoupper($dir),
$tpl->get());
270 $a_tpl->setCurrentBlock(
"prop_generic");
271 $a_tpl->setVariable(
"PROP_GENERIC", $layout_tpl->get());
272 $a_tpl->parseCurrentBlock();
285 $a_values[$this->
getPostVar()][
"all"][
"num_unit"]);
287 $a_values[$this->
getPostVar()][
"bottom"][
"num_unit"]);
289 $a_values[$this->
getPostVar()][
"top"][
"num_unit"]);
291 $a_values[$this->
getPostVar()][
"left"][
"num_unit"]);
293 $a_values[$this->
getPostVar()][
"right"][
"num_unit"]);
special template class to simplify handling of ITX/PEAR
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static _getStyleParameterNumericUnits($a_no_percentage=false)