00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 class Mage_Rule_Block_Editable extends Mage_Core_Block_Abstract
00029 implements Varien_Data_Form_Element_Renderer_Interface
00030 {
00031 public function render(Varien_Data_Form_Element_Abstract $element)
00032 {
00033 $valueName = $element->getValueName();
00034
00035 if ($valueName==='') {
00036 $valueName = '...';
00037 } else {
00038 $valueName = Mage::helper('core/string')->truncate($valueName, 30);
00039 }
00040 if ($element->getShowAsText()) {
00041 $html = ' <input type="hidden" class="hidden" id="'.$element->getHtmlId().'" name="'.$element->getName().'" value="'.$element->getValue().'"/> ';
00042
00043 $html.= htmlspecialchars($valueName).' ';
00044 } else {
00045 $html = ' <span class="rule-param"' . ($element->getParamId() ? ' id="' . $element->getParamId() . '"' : '') . '>';
00046
00047 $html.= '<a href="javascript:void(0)" class="label">';
00048
00049 $html.= htmlspecialchars($valueName);
00050
00051 $html.= '</a><span class="element"> ';
00052
00053 $html.= $element->getElementHtml();
00054
00055 if ($element->getExplicitApply()) {
00056 $html.= ' <a href="javascript:void(0)" class="rule-param-apply"><img src="'.$this->getSkinUrl('images/rule_component_apply.gif').'" class="v-middle" alt="'.$this->__('Apply').'" title="'.$this->__('Apply').'" /></a> ';
00057 }
00058
00059 $html.= '</span></span> ';
00060 }
00061 return $html;
00062 }
00063 }