本文整理匯總了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();
}