Public Member Functions | |
getSaveButtonHtml () | |
setEntity (Varien_Object $entity) | |
getEntity () | |
getDefaultSender () | |
getDefaultRecipient () | |
getFieldName ($name) | |
getFieldId ($id) | |
getFieldIdPrefix () | |
getMessage () | |
getSaveUrl () | |
getHtmlId () | |
canDisplayGiftmessage () | |
Protected Member Functions | |
_beforeToHtml () | |
_prepareLayout () | |
_initMessage () | |
Protected Attributes | |
$_entity | |
$_giftMessage |
Definition at line 34 of file Giftmessage.php.
_beforeToHtml | ( | ) | [protected] |
Before rendering html, but after trying to load cache
Reimplemented from Mage_Core_Block_Abstract.
Definition at line 50 of file Giftmessage.php.
00051 { 00052 if ($this->getParentBlock() && ($order = $this->getParentBlock()->getOrder())) { 00053 $this->setEntity($order); 00054 } 00055 parent::_beforeToHtml(); 00056 }
_initMessage | ( | ) | [protected] |
Initialize gift message for entity
Definition at line 199 of file Giftmessage.php.
00200 { 00201 $this->_giftMessage = $this->helper('giftmessage/message')->getGiftMessage( 00202 $this->getEntity()->getGiftMessageId() 00203 ); 00204 00205 // init default values for giftmessage form 00206 if(!$this->getMessage()->getSender()) { 00207 $this->getMessage()->setSender($this->getDefaultSender()); 00208 } 00209 if(!$this->getMessage()->getRecipient()) { 00210 $this->getMessage()->setRecipient($this->getDefaultRecipient()); 00211 } 00212 00213 return $this; 00214 }
_prepareLayout | ( | ) | [protected] |
Prepares layout of block
Reimplemented from Mage_Core_Block_Abstract.
Definition at line 63 of file Giftmessage.php.
00064 { 00065 $this->setChild('save_button', 00066 $this->getLayout()->createBlock('adminhtml/widget_button') 00067 ->setData(array( 00068 'label' => Mage::helper('giftmessage')->__('Save Gift Message'), 00069 'class' => 'save' 00070 )) 00071 ); 00072 00073 return $this; 00074 }
canDisplayGiftmessage | ( | ) |
Indicates that block can display giftmessages form
Definition at line 256 of file Giftmessage.php.
00257 { 00258 return $this->helper('giftmessage/message')->getIsMessagesAvailable( 00259 'order', $this->getEntity(), $this->getEntity()->getStoreId() 00260 ); 00261 }
getDefaultRecipient | ( | ) |
Retrive default value for giftmessage recipient
Definition at line 139 of file Giftmessage.php.
00140 { 00141 if(!$this->getEntity()) { 00142 return ''; 00143 } 00144 00145 if($this->getEntity()->getOrder()) { 00146 if ($this->getEntity()->getOrder()->getShippingAddress()) { 00147 return $this->getEntity()->getOrder()->getShippingAddress()->getName(); 00148 } else if ($this->getEntity()->getOrder()->getBillingAddress()) { 00149 return $this->getEntity()->getOrder()->getBillingAddress()->getName(); 00150 } 00151 } 00152 00153 if ($this->getEntity()->getShippingAddress()) { 00154 return $this->getEntity()->getShippingAddress()->getName(); 00155 } else if ($this->getEntity()->getBillingAddress()) { 00156 return $this->getEntity()->getBillingAddress()->getName(); 00157 } 00158 00159 return ''; 00160 }
getDefaultSender | ( | ) |
Retrive default value for giftmessage sender
Definition at line 121 of file Giftmessage.php.
00122 { 00123 if(!$this->getEntity()) { 00124 return ''; 00125 } 00126 00127 if($this->getEntity()->getOrder()) { 00128 return $this->getEntity()->getOrder()->getCustomerName(); 00129 } 00130 00131 return $this->getEntity()->getCustomerName(); 00132 }
getEntity | ( | ) |
Retrive entity for form
Definition at line 107 of file Giftmessage.php.
00108 { 00109 if(is_null($this->_entity)) { 00110 $this->setEntity(Mage::getModel('giftmessage/message')->getEntityModelByType('order')); 00111 $this->getEntity()->load($this->getRequest()->getParam('entity')); 00112 } 00113 return $this->_entity; 00114 }
getFieldId | ( | $ | id | ) |
Retrive real html id for field
string | $name |
Definition at line 179 of file Giftmessage.php.
00180 { 00181 return $this->getFieldIdPrefix() . $id; 00182 }
getFieldIdPrefix | ( | ) |
Retrive field html id prefix
Definition at line 189 of file Giftmessage.php.
00190 { 00191 return 'giftmessage_order_' . $this->getEntity()->getId() . '_'; 00192 }
getFieldName | ( | $ | name | ) |
Retrive real name for field
string | $name |
Definition at line 168 of file Giftmessage.php.
00169 { 00170 return 'giftmessage[' . $this->getEntity()->getId() . '][' . $name . ']'; 00171 }
getHtmlId | ( | ) |
Retrive block html id
Reimplemented from Mage_Adminhtml_Block_Widget.
Definition at line 246 of file Giftmessage.php.
00247 { 00248 return substr($this->getFieldIdPrefix(), 0, -1); 00249 }
getMessage | ( | ) |
Retrive gift message for entity
Definition at line 221 of file Giftmessage.php.
00222 { 00223 if(is_null($this->_giftMessage)) { 00224 $this->_initMessage(); 00225 } 00226 00227 return $this->_giftMessage; 00228 }
getSaveButtonHtml | ( | ) |
Retrive save button html
Definition at line 81 of file Giftmessage.php.
00082 { 00083 $this->getChild('save_button')->setOnclick( 00084 'giftMessagesController.saveGiftMessage(\''. $this->getHtmlId() .'\')' 00085 ); 00086 00087 return $this->getChildHtml('save_button'); 00088 }
getSaveUrl | ( | ) |
setEntity | ( | Varien_Object $ | entity | ) |
Set entity for form
Varien_Object | $entity |
Definition at line 96 of file Giftmessage.php.
$_entity [protected] |
Definition at line 41 of file Giftmessage.php.
$_giftMessage [protected] |
Definition at line 48 of file Giftmessage.php.