/** * Insert property html * * @return int Size */ function insert($a_tpl) { global $tpl; include_once './Services/YUI/classes/class.ilYuiUtil.php'; ilYuiUtil::initColorPicker(); $a_tpl->setCurrentBlock("prop_color"); $js_tpl = new ilTemplate('tpl.color_picker.js', true, true, 'Services/Form'); $js_tpl->setVariable('THUMB_PATH', ilUtil::getImagePath('color_picker_thumb.png', 'Services/Form')); $js_tpl->setVariable('HUE_THUMB_PATH', ilUtil::getImagePath('color_picker_hue_thumb.png', 'Services/Form')); $js_tpl->setVariable('COLOR_ID', $this->getFieldId()); $ic = ilColorPickerInputGUI::determineHexcode($this->getHexcode()); if ($ic == "") { $ic = "FFFFFF"; } $js_tpl->setVariable('INIT_COLOR_SHORT', $ic); $js_tpl->setVariable('INIT_COLOR', '#' . $this->getHexcode()); $js_tpl->setVariable('POST_VAR', $this->getPostVar()); if ($this->getDisabled()) { $a_tpl->setVariable('COLOR_DISABLED', 'disabled="disabled"'); } else { $a_tpl->setVariable('PROP_COLOR_JS', $js_tpl->get()); } $a_tpl->setVariable("POST_VAR", $this->getPostVar()); $a_tpl->setVariable("PROP_COLOR_ID", $this->getFieldId()); if (substr(trim($this->getValue()), 0, 1) == "!" && $this->getAcceptNamedColors()) { $a_tpl->setVariable("PROPERTY_VALUE_COLOR", ilUtil::prepareFormOutput(trim($this->getValue()))); } else { $a_tpl->setVariable("PROPERTY_VALUE_COLOR", ilUtil::prepareFormOutput($this->getHexcode())); } $a_tpl->parseCurrentBlock(); }
/** * Insert property html * * @return int Size */ function insert($a_tpl) { global $lng; include_once './Services/YUI/classes/class.ilYuiUtil.php'; ilYuiUtil::initColorPicker(); $layout_tpl = new ilTemplate("tpl.prop_trbl_layout.html", true, true, "Services/Style"); $funcs = array("all" => "getAllValue", "top" => "getTopValue", "bottom" => "getBottomValue", "left" => "getLeftValue", "right" => "getRightValue"); foreach ($this->dirs as $dir) { /*switch($dir) { case "all": $value = strtoupper(trim($this->getAllValue())); break; case "top": $value = strtoupper(trim($this->getTopValue())); break; case "bottom": $value = strtoupper(trim($this->getBottomValue())); break; case "left": $value = strtoupper(trim($this->getLeftValue())); break; case "right": $value = strtoupper(trim($this->getRightValue())); break; }*/ $value = trim($this->{$funcs}[$dir]()); if (!$this->getAcceptNamedColors() || substr($value, 0, 1) != "!") { $value = strtoupper($value); } $ctpl = new ilTemplate("tpl.prop_trbl_color.html", true, true, "Services/Style"); $js_tpl = new ilTemplate('tpl.trbl_color_picker.js', true, true, 'Services/Style'); $js_tpl->setVariable('THUMB_PATH', ilUtil::getImagePath('color_picker_thumb.png', 'Services/Form')); $js_tpl->setVariable('HUE_THUMB_PATH', ilUtil::getImagePath('color_picker_hue_thumb.png', 'Services/Form')); $js_tpl->setVariable('COLOR_ID', $this->getFieldId() . "_" . $dir); $ic = ilColorPickerInputGUI::determineHexcode($value); if ($ic == "") { $ic = "FFFFFF"; } $js_tpl->setVariable('INIT_COLOR_SHORT', $ic); $js_tpl->setVariable('INIT_COLOR', '#' . $value); $js_tpl->setVariable('POST_VAR', $this->getPostVar()); $js_tpl->setVariable('DIR', $dir); if ($this->getDisabled()) { $ctpl->setVariable('COLOR_DISABLED', 'disabled="disabled"'); } else { $ctpl->setVariable('PROP_COLOR_JS', $js_tpl->get()); } $ctpl->setVariable("POST_VAR", $this->getPostVar()); $ctpl->setVariable("PROP_COLOR_ID", $this->getFieldId() . "_" . $dir); $ctpl->setVariable("PROPERTY_VALUE_COLOR", $value); $ctpl->setVariable("DIR", $dir); $ctpl->setVariable("TXT_DIR", $lng->txt("sty_{$dir}")); $layout_tpl->setVariable(strtoupper($dir), $ctpl->get()); } $a_tpl->setCurrentBlock("prop_generic"); $a_tpl->setVariable("PROP_GENERIC", $layout_tpl->get()); $a_tpl->parseCurrentBlock(); }