Mage_Adminhtml_Block_Customer_Edit_Tab_Addresses Class Reference

Inheritance diagram for Mage_Adminhtml_Block_Customer_Edit_Tab_Addresses:

Mage_Adminhtml_Block_Widget_Form Mage_Adminhtml_Block_Widget Mage_Adminhtml_Block_Template Mage_Core_Block_Template Mage_Core_Block_Abstract Varien_Object

List of all members.

Public Member Functions

 __construct ()
 getRegionsUrl ()
 isReadonly ()
 getDeleteButtonHtml ()
 initForm ()
 getCancelButtonHtml ()
 getAddNewButtonHtml ()
 getTemplatePrefix ()

Protected Member Functions

 _prepareLayout ()


Detailed Description

Definition at line 34 of file Addresses.php.


Constructor & Destructor Documentation

__construct (  ) 

Class constructor

Reimplemented from Mage_Adminhtml_Block_Widget_Form.

Definition at line 36 of file Addresses.php.

00037     {
00038         parent::__construct();
00039         $this->setTemplate('customer/tab/addresses.phtml');
00040     }


Member Function Documentation

_prepareLayout (  )  [protected]

Prepare block children and data

Reimplemented from Mage_Adminhtml_Block_Widget_Form.

Definition at line 47 of file Addresses.php.

00048     {
00049         $this->setChild('delete_button',
00050             $this->getLayout()->createBlock('adminhtml/widget_button')
00051                 ->setData(array(
00052                     'label'  => Mage::helper('customer')->__('Delete Address'),
00053                     'name'   => 'delete_address',
00054                     'disabled' => $this->isReadonly(),
00055                     'class'  => 'delete' . ($this->isReadonly() ? ' disabled' : '')
00056                 ))
00057         );
00058         $this->setChild('add_address_button',
00059             $this->getLayout()->createBlock('adminhtml/widget_button')
00060                 ->setData(array(
00061                     'label'  => Mage::helper('customer')->__('Add New Address'),
00062                     'id'     => 'add_address_button',
00063                     'name'   => 'add_address_button',
00064                     'disabled' => $this->isReadonly(),
00065                     'class'  => 'add'  . ($this->isReadonly() ? ' disabled' : ''),
00066                     'onclick'=> 'customerAddresses.addNewAddress()'
00067                 ))
00068         );
00069         $this->setChild('cancel_button',
00070             $this->getLayout()->createBlock('adminhtml/widget_button')
00071                 ->setData(array(
00072                     'label'  => Mage::helper('customer')->__('Cancel'),
00073                     'id'     => 'cancel_add_address'.$this->getTemplatePrefix(),
00074                     'name'   => 'cancel_address',
00075                     'class'  => 'cancel delete-address'  . ($this->isReadonly() ? ' disabled' : ''),
00076                     'disabled' => $this->isReadonly(),
00077                     'onclick'=> 'customerAddresses.cancelAdd(this)',
00078                 ))
00079         );
00080         return parent::_prepareLayout();
00081     }

getAddNewButtonHtml (  ) 

Definition at line 148 of file Addresses.php.

00149     {
00150         return $this->getChildHtml('add_address_button');
00151     }

getCancelButtonHtml (  ) 

Definition at line 143 of file Addresses.php.

00144     {
00145         return $this->getChildHtml('cancel_button');
00146     }

getDeleteButtonHtml (  ) 

Definition at line 94 of file Addresses.php.

00095     {
00096         return $this->getChildHtml('delete_button');
00097     }

getRegionsUrl (  ) 

Definition at line 42 of file Addresses.php.

00043     {
00044         return $this->getUrl('*/json/countryRegion');
00045     }

getTemplatePrefix (  ) 

Definition at line 153 of file Addresses.php.

00154     {
00155         return '_template_';
00156     }

initForm (  ) 

Definition at line 99 of file Addresses.php.

00100     {
00101         $customer = Mage::registry('current_customer');
00102 
00103         $form = new Varien_Data_Form();
00104         $fieldset = $form->addFieldset('address_fieldset', array('legend'=>Mage::helper('customer')->__("Edit Customer's Address")));
00105 
00106         $addressModel = Mage::getModel('customer/address');
00107 
00108         $this->_setFieldset($addressModel->getAttributes(), $fieldset);
00109 
00110         if ($streetElement = $form->getElement('street')) {
00111             $streetElement->setLineCount(Mage::helper('customer/address')->getStreetLines());
00112         }
00113 
00114         if ($regionElement = $form->getElement('region')) {
00115             $regionElement->setRenderer(Mage::getModel('adminhtml/customer_renderer_region'));
00116         }
00117 
00118         if ($regionElement = $form->getElement('region_id')) {
00119             $regionElement->setNoDisplay(true);
00120         }
00121 
00122         if ($country = $form->getElement('country_id')) {
00123             $country->addClass('countries');
00124         }
00125 
00126         if ($this->isReadonly()) {
00127             foreach ($addressModel->getAttributes() as $attribute) {
00128                 $element = $form->getElement($attribute->getAttributeCode());
00129                 if ($element) {
00130                     $element->setReadonly(true, true);
00131                 }
00132             }
00133         }
00134 
00135         $addressCollection = $customer->getAddresses();
00136         $this->assign('customer', $customer);
00137         $this->assign('addressCollection', $addressCollection);
00138         $this->setForm($form);
00139 
00140         return $this;
00141     }

isReadonly (  ) 

Check block is readonly.

Returns:
boolean

Definition at line 88 of file Addresses.php.

00089     {
00090         $customer = Mage::registry('current_customer');
00091         return $customer->isReadonly();
00092     }


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

Generated on Sat Jul 4 17:22:47 2009 for Magento by  doxygen 1.5.8