1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25:
26:
27:
28: class Mage_Rule_Block_Editable extends Mage_Core_Block_Abstract
29: implements Varien_Data_Form_Element_Renderer_Interface
30: {
31: 32: 33: 34: 35: 36: 37:
38: public function render(Varien_Data_Form_Element_Abstract $element)
39: {
40: $element->addClass('element-value-changer');
41: $valueName = $element->getValueName();
42:
43: if ($valueName === '') {
44: $valueName = '...';
45: }
46:
47: if ($element->getShowAsText()) {
48: $html = ' <input type="hidden" class="hidden" id="' . $element->getHtmlId()
49: . '" name="' . $element->getName() . '" value="' . $element->getValue() . '"/> '
50: . htmlspecialchars($valueName) . ' ';
51: } else {
52: $html = ' <span class="rule-param"'
53: . ($element->getParamId() ? ' id="' . $element->getParamId() . '"' : '') . '>'
54: . '<a href="javascript:void(0)" class="label">';
55:
56: $translate = Mage::getSingleton('core/translate_inline');
57:
58: $html .= $translate->isAllowed() ? Mage::helper('core')->escapeHtml($valueName) :
59: Mage::helper('core')->escapeHtml(Mage::helper('core/string')->truncate($valueName, 33, '...'));
60:
61: $html .= '</a><span class="element"> ' . $element->getElementHtml();
62:
63: if ($element->getExplicitApply()) {
64: $html .= ' <a href="javascript:void(0)" class="rule-param-apply"><img src="'
65: . $this->getSkinUrl('images/rule_component_apply.gif') . '" class="v-middle" alt="'
66: . $this->__('Apply') . '" title="' . $this->__('Apply') . '" /></a> ';
67: }
68:
69: $html .= '</span></span> ';
70: }
71:
72: return $html;
73: }
74: }
75: