Mage_Adminhtml_Block_Customer_Edit_Tab_Newsletter Class Reference

Inheritance diagram for Mage_Adminhtml_Block_Customer_Edit_Tab_Newsletter:

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 ()
 initForm ()
 getStatusChangedDate ()

Protected Member Functions

 _prepareLayout ()


Detailed Description

Definition at line 34 of file Newsletter.php.


Constructor & Destructor Documentation

__construct (  ) 

Class constructor

Reimplemented from Mage_Adminhtml_Block_Widget_Form.

Definition at line 37 of file Newsletter.php.

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


Member Function Documentation

_prepareLayout (  )  [protected]

Prepare block children and data

Reimplemented from Mage_Adminhtml_Block_Widget_Form.

Definition at line 91 of file Newsletter.php.

00092     {
00093         $this->setChild('grid',
00094             $this->getLayout()->createBlock('adminhtml/customer_edit_tab_newsletter_grid','newsletter.grid')
00095         );
00096         return parent::_prepareLayout();
00097     }

getStatusChangedDate (  ) 

Definition at line 81 of file Newsletter.php.

00082     {
00083         $subscriber = Mage::registry('subscriber');
00084         if($subscriber->getChangeStatusAt()) {
00085             return $this->formatDate($subscriber->getChangeStatusAt(), Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM, true);
00086         }
00087 
00088         return null;
00089     }

initForm (  ) 

Definition at line 43 of file Newsletter.php.

00044     {
00045         $form = new Varien_Data_Form();
00046         $form->setHtmlIdPrefix('_newsletter');
00047         $customer = Mage::registry('current_customer');
00048         $subscriber = Mage::getModel('newsletter/subscriber')->loadByCustomer($customer);
00049         Mage::register('subscriber', $subscriber);
00050 
00051         $fieldset = $form->addFieldset('base_fieldset', array('legend'=>Mage::helper('customer')->__('Newsletter Information')));
00052 
00053         $fieldset->addField('subscription', 'checkbox',
00054              array(
00055                     'label' => Mage::helper('customer')->__('Subscribed to Newsletter?'),
00056                     'name'  => 'subscription'
00057              )
00058         );
00059 
00060         if ($customer->isReadonly()) {
00061             $form->getElement('subscription')->setReadonly(true, true);
00062         }
00063 
00064         $form->getElement('subscription')->setIsChecked($subscriber->isSubscribed());
00065 
00066         if($changedDate = $this->getStatusChangedDate()) {
00067              $fieldset->addField('change_status_date', 'label',
00068                  array(
00069                         'label' => $subscriber->isSubscribed() ? Mage::helper('customer')->__('Last date subscribed') : Mage::helper('customer')->__('Last date unsubscribed'),
00070                         'value' => $changedDate,
00071                         'bold'  => true
00072                  )
00073             );
00074         }
00075 
00076 
00077         $this->setForm($form);
00078         return $this;
00079     }


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