本文整理汇总了PHP中ilObjStyleSheet::_getStyleParameterNumericUnits方法的典型用法代码示例。如果您正苦于以下问题:PHP ilObjStyleSheet::_getStyleParameterNumericUnits方法的具体用法?PHP ilObjStyleSheet::_getStyleParameterNumericUnits怎么用?PHP ilObjStyleSheet::_getStyleParameterNumericUnits使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilObjStyleSheet
的用法示例。
在下文中一共展示了ilObjStyleSheet::_getStyleParameterNumericUnits方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: insert
/**
* 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();
}
示例2: insert
/**
* 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();
}
示例3: insert
/**
* 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();
}
示例4: insert
/**
* 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();
}