/** * Insert property html */ function insert(&$a_tpl) { $tpl = new ilTemplate("tpl.prop_fontsize.html", true, true, "Services/Style"); $tpl->setVariable("POSTVAR", $this->getPostVar()); $unit_options = ilObjStyleSheet::_getStyleParameterNumericUnits(); $pre_options = ilObjStyleSheet::_getStyleParameterValues("font-size"); $value = strtolower(trim($this->getValue())); if (in_array($value, $pre_options)) { $current_type = "pre"; $tpl->setVariable("PREDEFINED_SELECTED", 'checked="checked"'); } else { $current_type = "unit"; $tpl->setVariable("NUMERIC_SELECTED", 'checked="checked"'); $current_unit = ""; foreach ($unit_options as $u) { if (substr($value, strlen($value) - strlen($u)) == $u) { $current_unit = $u; } } $tpl->setVariable("VAL_NUM", substr($value, 0, strlen($value) - strlen($current_unit))); if ($current_unit == "") { $current_unit = "px"; } } foreach ($unit_options as $option) { $tpl->setCurrentBlock("unit_option"); $tpl->setVariable("VAL_UNIT", $option); $tpl->setVariable("TXT_UNIT", $option); if ($current_type == "unit" && $current_unit == $option) { $tpl->setVariable("UNIT_SELECTED", 'selected="selected"'); } $tpl->parseCurrentBlock(); } foreach ($pre_options as $option) { $tpl->setCurrentBlock("pre_option"); $tpl->setVariable("VAL_PRE", $option); $tpl->setVariable("TXT_PRE", $option); if ($current_type == "pre" && $value == $option) { $tpl->setVariable("PRE_SELECTED", 'selected="selected"'); } $tpl->parseCurrentBlock(); } $a_tpl->setCurrentBlock("prop_generic"); $a_tpl->setVariable("PROP_GENERIC", $tpl->get()); $a_tpl->parseCurrentBlock(); }
/** * Insert property html */ function insert(&$a_tpl) { $tpl = new ilTemplate("tpl.prop_style_numeric.html", true, true, "Services/Style"); $tpl->setVariable("POSTVAR", $this->getPostVar()); $unit_options = ilObjStyleSheet::_getStyleParameterNumericUnits(!$this->getAllowPercentage()); $value = strtolower(trim($this->getValue())); $current_unit = ""; foreach ($unit_options as $u) { if (substr($value, strlen($value) - strlen($u)) == $u) { $current_unit = $u; } } $tpl->setVariable("VAL_NUM", substr($value, 0, strlen($value) - strlen($current_unit))); if ($current_unit == "") { $current_unit = "px"; } foreach ($unit_options as $option) { $tpl->setCurrentBlock("unit_option"); $tpl->setVariable("VAL_UNIT", $option); $tpl->setVariable("TXT_UNIT", $option); if ($current_unit == $option) { $tpl->setVariable("UNIT_SELECTED", 'selected="selected"'); } $tpl->parseCurrentBlock(); } $a_tpl->setCurrentBlock("prop_generic"); $a_tpl->setVariable("PROP_GENERIC", $tpl->get()); $a_tpl->parseCurrentBlock(); }
/** * Insert property html */ function insert(&$a_tpl) { global $lng; $layout_tpl = new ilTemplate("tpl.prop_hv_layout.html", true, true, "Services/Style"); foreach ($this->dirs as $dir) { $tpl = new ilTemplate("tpl.prop_background_position.html", true, true, "Services/Style"); $unit_options = ilObjStyleSheet::_getStyleParameterNumericUnits(); $pre_options = ilObjStyleSheet::_getStyleParameterValues("background-position"); $pre_options = $pre_options[$dir]; switch ($dir) { case "horizontal": $value = strtolower(trim($this->getHorizontalValue())); break; case "vertical": $value = strtolower(trim($this->getVerticalValue())); break; } if (in_array($value, $pre_options)) { $current_type = "pre"; $tpl->setVariable("PREDEFINED_SELECTED", 'checked="checked"'); } else { $current_type = "unit"; $tpl->setVariable("NUMERIC_SELECTED", 'checked="checked"'); $current_unit = ""; foreach ($unit_options as $u) { if (substr($value, strlen($value) - strlen($u)) == $u) { $current_unit = $u; } } $disp_val = substr($value, 0, strlen($value) - strlen($current_unit)); if ($current_unit == "") { $current_unit = "px"; } $tpl->setVariable("VAL_NUM", $disp_val); } foreach ($unit_options as $option) { $tpl->setCurrentBlock("unit_option"); $tpl->setVariable("VAL_UNIT", $option); $tpl->setVariable("TXT_UNIT", $option); if ($current_type == "unit" && $current_unit == $option) { $tpl->setVariable("UNIT_SELECTED", 'selected="selected"'); } $tpl->parseCurrentBlock(); } foreach ($pre_options as $option) { $tpl->setCurrentBlock("pre_option"); $tpl->setVariable("VAL_PRE", $option); $tpl->setVariable("TXT_PRE", $option); if ($current_type == "pre" && $value == $option) { $tpl->setVariable("PRE_SELECTED", 'selected="selected"'); } $tpl->parseCurrentBlock(); } $tpl->setVariable("POSTVAR", $this->getPostVar()); $tpl->setVariable("TXT_DIR", $lng->txt("sty_{$dir}")); $tpl->setVariable("DIR", $dir); $layout_tpl->setVariable(strtoupper($dir), $tpl->get()); } $layout_tpl->setVariable("COLSPAN", "2"); $a_tpl->setCurrentBlock("prop_generic"); $a_tpl->setVariable("PROP_GENERIC", $layout_tpl->get()); $a_tpl->parseCurrentBlock(); }
/** * Insert property html */ function insert(&$a_tpl) { global $lng; $layout_tpl = new ilTemplate("tpl.prop_trbl_layout.html", true, true, "Services/Style"); foreach ($this->dirs as $dir) { $tpl = new ilTemplate("tpl.prop_trbl_style_numeric.html", true, true, "Services/Style"); $unit_options = ilObjStyleSheet::_getStyleParameterNumericUnits(!$this->getAllowPercentage()); switch ($dir) { case "all": $value = strtolower(trim($this->getAllValue())); break; case "top": $value = strtolower(trim($this->getTopValue())); break; case "bottom": $value = strtolower(trim($this->getBottomValue())); break; case "left": $value = strtolower(trim($this->getLeftValue())); break; case "right": $value = strtolower(trim($this->getRightValue())); break; } $current_unit = ""; foreach ($unit_options as $u) { if (substr($value, strlen($value) - strlen($u)) == $u) { $current_unit = $u; } } $disp_val = substr($value, 0, strlen($value) - strlen($current_unit)); if ($current_unit == "") { $current_unit = "px"; } foreach ($unit_options as $option) { $tpl->setCurrentBlock("unit_option"); $tpl->setVariable("VAL_UNIT", $option); $tpl->setVariable("TXT_UNIT", $option); if ($current_unit == $option) { $tpl->setVariable("UNIT_SELECTED", 'selected="selected"'); } $tpl->parseCurrentBlock(); } $tpl->setVariable("POSTVAR", $this->getPostVar()); $tpl->setVariable("VAL_NUM", $disp_val); $tpl->setVariable("TXT_DIR", $lng->txt("sty_{$dir}")); $tpl->setVariable("DIR", $dir); $layout_tpl->setVariable(strtoupper($dir), $tpl->get()); } $a_tpl->setCurrentBlock("prop_generic"); $a_tpl->setVariable("PROP_GENERIC", $layout_tpl->get()); $a_tpl->parseCurrentBlock(); }