Public Member Functions | |
__construct () | |
getForm () | |
asArray (array $arrAttributes=array()) | |
asXml () | |
loadArray (array $arr) | |
loadAttributeOptions () | |
getAttributeSelectOptions () | |
getAttributeName () | |
loadOperatorOptions () | |
getOperatorSelectOptions () | |
getOperatorName () | |
loadValueOptions () | |
getValueSelectOptions () | |
getValueName () | |
getNewChildSelectOptions () | |
getNewChildName () | |
asHtml () | |
asHtmlRecursive () | |
getTypeElement () | |
getAttributeElement () | |
getOperatorElement () | |
getValueElement () | |
getAddLinkHtml () | |
getRemoveLinkHtml () | |
asString ($format='') | |
asStringRecursive ($level=0) | |
process () |
Definition at line 35 of file Abstract.php.
__construct | ( | ) |
Constructor
By default is looking for first argument as array and assignes it as object attributes This behaviour may change in child classes
Reimplemented from Varien_Object.
Reimplemented in Mage_CatalogRule_Model_Rule_Action_Collection, Mage_Rule_Model_Action_Collection, and Mage_SalesRule_Model_Rule_Action_Collection.
Definition at line 37 of file Abstract.php.
00038 { 00039 parent::__construct(); 00040 $this->loadAttributeOptions()->loadOperatorOptions()->loadValueOptions(); 00041 00042 foreach ($this->getAttributeOption() as $attr=>$dummy) { $this->setAttribute($attr); break; } 00043 foreach ($this->getOperatorOption() as $operator=>$dummy) { $this->setOperator($operator); break; } 00044 }
Reimplemented in Mage_Rule_Model_Action_Collection.
Definition at line 51 of file Abstract.php.
00052 { 00053 $out = array( 00054 'type'=>$this->getType(), 00055 'attribute'=>$this->getAttribute(), 00056 'operator'=>$this->getOperator(), 00057 'value'=>$this->getValue(), 00058 ); 00059 return $out; 00060 }
asHtml | ( | ) |
Reimplemented in Mage_CatalogRule_Model_Rule_Action_Product, Mage_Rule_Model_Action_Collection, and Mage_SalesRule_Model_Rule_Action_Product.
Definition at line 162 of file Abstract.php.
asHtmlRecursive | ( | ) |
Reimplemented in Mage_Rule_Model_Action_Collection.
Definition at line 167 of file Abstract.php.
00168 { 00169 $str = $this->asHtml(); 00170 return $str; 00171 }
asString | ( | $ | format = '' |
) |
asStringRecursive | ( | $ | level = 0 |
) |
Reimplemented in Mage_Rule_Model_Action_Collection.
Definition at line 231 of file Abstract.php.
00232 { 00233 $str = str_pad('', $level*3, ' ', STR_PAD_LEFT).$this->asString(); 00234 return $str; 00235 }
asXml | ( | ) |
Definition at line 62 of file Abstract.php.
00063 { 00064 extract($this->toArray()); 00065 $xml = "<type>".$this->getType()."</type>" 00066 ."<attribute>".$this->getAttribute()."</attribute>" 00067 ."<operator>".$this->getOperator()."</operator>" 00068 ."<value>".$this->getValue()."</value>"; 00069 return $xml; 00070 }
getAddLinkHtml | ( | ) |
Definition at line 211 of file Abstract.php.
00212 { 00213 $src = Mage::getDesign()->getSkinUrl('images/rule_component_add.gif'); 00214 $html = '<img src="'.$src.'" alt="" class="rule-param-add v-middle" />'; 00215 return $html; 00216 }
getAttributeElement | ( | ) |
Definition at line 182 of file Abstract.php.
00183 { 00184 return $this->getForm()->addField('action:'.$this->getId().':attribute', 'select', array( 00185 'name'=>'rule[actions]['.$this->getId().'][attribute]', 00186 'values'=>$this->getAttributeSelectOptions(), 00187 'value'=>$this->getAttribute(), 00188 'value_name'=>$this->getAttributeName(), 00189 ))->setRenderer(Mage::getBlockSingleton('rule/editable')); 00190 }
getAttributeName | ( | ) |
getAttributeSelectOptions | ( | ) |
Definition at line 92 of file Abstract.php.
00093 { 00094 $opt = array(); 00095 foreach ($this->getAttributeOption() as $k=>$v) { 00096 $opt[] = array('value'=>$k, 'label'=>$v); 00097 } 00098 return $opt; 00099 }
getForm | ( | ) |
getNewChildName | ( | ) |
getNewChildSelectOptions | ( | ) |
Reimplemented in Mage_CatalogRule_Model_Rule_Action_Collection, and Mage_SalesRule_Model_Rule_Action_Collection.
Definition at line 150 of file Abstract.php.
00151 { 00152 return array( 00153 array('value'=>'', 'label'=>Mage::helper('rule')->__('Please choose an action to add...')), 00154 ); 00155 }
getOperatorElement | ( | ) |
Definition at line 192 of file Abstract.php.
00193 { 00194 return $this->getForm()->addField('action:'.$this->getId().':operator', 'select', array( 00195 'name'=>'rule[actions]['.$this->getId().'][operator]', 00196 'values'=>$this->getOperatorSelectOptions(), 00197 'value'=>$this->getOperator(), 00198 'value_name'=>$this->getOperatorName(), 00199 ))->setRenderer(Mage::getBlockSingleton('rule/editable')); 00200 }
getOperatorName | ( | ) |
getOperatorSelectOptions | ( | ) |
Definition at line 115 of file Abstract.php.
00116 { 00117 $opt = array(); 00118 foreach ($this->getOperatorOption() as $k=>$v) { 00119 $opt[] = array('value'=>$k, 'label'=>$v); 00120 } 00121 return $opt; 00122 }
getRemoveLinkHtml | ( | ) |
Definition at line 219 of file Abstract.php.
00220 { 00221 $src = Mage::getDesign()->getSkinUrl('images/rule_component_remove.gif'); 00222 $html = '<span class="rule-param"><a href="javascript:void(0)" class="rule-param-remove"><img src="'.$src.'" alt="" class="v-middle" /></a></span>'; 00223 return $html; 00224 }
getTypeElement | ( | ) |
getValueElement | ( | ) |
Definition at line 202 of file Abstract.php.
00203 { 00204 return $this->getForm()->addField('action:'.$this->getId().':value', 'text', array( 00205 'name'=>'rule[actions]['.$this->getId().'][value]', 00206 'value'=>$this->getValue(), 00207 'value_name'=>$this->getValueName(), 00208 ))->setRenderer(Mage::getBlockSingleton('rule/editable')); 00209 }
getValueName | ( | ) |
Definition at line 144 of file Abstract.php.
00145 { 00146 $value = $this->getValue(); 00147 return !empty($value) || 0===$value ? $value : '...';; 00148 }
getValueSelectOptions | ( | ) |
Definition at line 135 of file Abstract.php.
00136 { 00137 $opt = array(); 00138 foreach ($this->getValueOption() as $k=>$v) { 00139 $opt[] = array('value'=>$k, 'label'=>$v); 00140 } 00141 return $opt; 00142 }
loadArray | ( | array $ | arr | ) |
Reimplemented in Mage_Rule_Model_Action_Collection.
Definition at line 72 of file Abstract.php.
00073 { 00074 $this->addData(array( 00075 'type'=>$arr['type'], 00076 'attribute'=>$arr['attribute'], 00077 'operator'=>$arr['operator'], 00078 'value'=>$arr['value'], 00079 )); 00080 $this->loadAttributeOptions(); 00081 $this->loadOperatorOptions(); 00082 $this->loadValueOptions(); 00083 return $this; 00084 }
loadAttributeOptions | ( | ) |
Reimplemented in Mage_CatalogRule_Model_Rule_Action_Product, and Mage_SalesRule_Model_Rule_Action_Product.
Definition at line 86 of file Abstract.php.
00087 { 00088 $this->setAttributeOption(array()); 00089 return $this; 00090 }
loadOperatorOptions | ( | ) |
Reimplemented in Mage_CatalogRule_Model_Rule_Action_Product, and Mage_SalesRule_Model_Rule_Action_Product.
Definition at line 106 of file Abstract.php.
00107 { 00108 $this->setOperatorOption(array( 00109 '=' => Mage::helper('rule')->__('to'), 00110 '+=' => Mage::helper('rule')->__('by'), 00111 )); 00112 return $this; 00113 }
loadValueOptions | ( | ) |
Definition at line 129 of file Abstract.php.
00130 { 00131 $this->setValueOption(array()); 00132 return $this; 00133 }
process | ( | ) |