Mage_GiftMessage_Block_Message_Inline Class Reference

Inheritance diagram for Mage_GiftMessage_Block_Message_Inline:

Mage_Core_Block_Template Mage_Core_Block_Abstract Varien_Object

List of all members.

Public Member Functions

 setEntity ($entity)
 getEntity ()
 setType ($type)
 getType ()
 hasGiftMessage ()
 getDefaultFrom ()
 getDefaultTo ()
 getMessage ($entity=null)
 getItems ()
 getAdditionalUrl ()
 isItemsAvailable ()
 countItems ()
 getItemsHasMesssages ()
 getEntityHasMessage ()
 getEscaped ($value, $defaultValue='')

Protected Member Functions

 _construct ()
 _initMessage ()

Protected Attributes

 $_entity = null
 $_type = null
 $_giftMessage = null


Detailed Description

Definition at line 35 of file Inline.php.


Member Function Documentation

_construct (  )  [protected]

Internal constructor, that is called from real constructor

Please override this one instead of overriding real __construct constructor

Please override this one instead of overriding real __construct constructor

Reimplemented from Mage_Core_Block_Abstract.

Definition at line 42 of file Inline.php.

00043     {
00044         parent::_construct();
00045         $this->setTemplate('giftmessage/inline.phtml');
00046     }

_initMessage (  )  [protected]

Definition at line 75 of file Inline.php.

00076     {
00077         $this->_giftMessage = $this->helper('giftmessage/message')->getGiftMessage(
00078                                             $this->getEntity()->getGiftMessageId()
00079                               );
00080         return $this;
00081     }

countItems (  ) 

Definition at line 134 of file Inline.php.

00135     {
00136         return count($this->getItems());
00137     }

getAdditionalUrl (  ) 

Definition at line 124 of file Inline.php.

00125     {
00126         return $this->getUrl('*/*/getAdditional');
00127     }

getDefaultFrom (  ) 

Definition at line 83 of file Inline.php.

00084     {
00085         return Mage::getSingleton('customer/session')->isLoggedIn() ? Mage::getSingleton('customer/session')->getCustomer()->getName() :  $this->getEntity()->getBillingAddress()->getName();
00086     }

getDefaultTo (  ) 

Definition at line 88 of file Inline.php.

00089     {
00090         return $this->getEntity()->getShippingAddress() ? $this->getEntity()->getShippingAddress()->getName() : $this->getEntity()->getName();
00091     }

getEntity (  ) 

Definition at line 54 of file Inline.php.

00055     {
00056         return $this->_entity;
00057     }

getEntityHasMessage (  ) 

Definition at line 150 of file Inline.php.

00151     {
00152         return $this->getEntity()->getGiftMessageId() > 0;
00153     }

getEscaped ( value,
defaultValue = '' 
)

Definition at line 155 of file Inline.php.

00156     {
00157         return $this->htmlEscape(trim($value)!='' ? $value : $defaultValue);
00158     }

getItems (  ) 

Definition at line 109 of file Inline.php.

00110     {
00111         if(!$this->getData('items')) {
00112             $items = array();
00113             foreach ($this->getEntity()->getAllItems() as $item) {
00114                 if($this->helper('giftmessage/message')->isMessagesAvailable( substr($this->getType(), 0, 5)=='multi' ? 'address_item'  : 'item', $item)) {
00115                     $items[] = $item;
00116                 }
00117             }
00118             $this->setData('items', $items);
00119         }
00120 
00121         return $this->getData('items');
00122     }

getItemsHasMesssages (  ) 

Definition at line 139 of file Inline.php.

00140     {
00141         foreach($this->getItems() as $item) {
00142             if($item->getGiftMessageId()) {
00143                 return true;
00144             }
00145         }
00146 
00147         return false;
00148     }

getMessage ( entity = null  ) 

Definition at line 93 of file Inline.php.

00094     {
00095         if(is_null($this->_giftMessage)) {
00096             $this->_initMessage();
00097         }
00098 
00099         if($entity) {
00100             if(!$entity->getGiftMessage()) {
00101                 $entity->setGiftMessage($this->helper('giftmessage/message')->getGiftMessage($entity->getGiftMessageId()));
00102             }
00103             return $entity->getGiftMessage();
00104         }
00105 
00106         return $this->_giftMessage;
00107     }

getType (  ) 

Definition at line 65 of file Inline.php.

00066     {
00067         return $this->_type;
00068     }

hasGiftMessage (  ) 

Definition at line 70 of file Inline.php.

00071     {
00072         return $this->getEntity()->getGiftMessageId() > 0;
00073     }

isItemsAvailable (  ) 

Definition at line 129 of file Inline.php.

00130     {
00131         return count($this->getItems()) > 0;
00132     }

setEntity ( entity  ) 

Definition at line 48 of file Inline.php.

00049     {
00050         $this->_entity = $entity;
00051         return $this;
00052     }

setType ( type  ) 

Definition at line 59 of file Inline.php.

00060     {
00061         $this->_type = $type;
00062         return $this;
00063     }


Member Data Documentation

$_entity = null [protected]

Definition at line 38 of file Inline.php.

$_giftMessage = null [protected]

Definition at line 40 of file Inline.php.

$_type = null [protected]

Definition at line 39 of file Inline.php.


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:24:12 2009 for Magento by  doxygen 1.5.8