Public Member Functions | |
__construct () | |
getHeaderText () |
Definition at line 35 of file Edit.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 Mage_Adminhtml_Block_Widget_Form_Container.
Definition at line 37 of file Edit.php.
00038 { 00039 parent::__construct(); 00040 00041 $this->_objectId = 'id'; 00042 $this->_controller = 'review'; 00043 00044 $this->_updateButton('save', 'label', Mage::helper('review')->__('Save Review')); 00045 $this->_updateButton('save', 'id', 'save_button'); 00046 $this->_updateButton('delete', 'label', Mage::helper('review')->__('Delete Review')); 00047 00048 if( $this->getRequest()->getParam('productId', false) ) { 00049 $this->_updateButton('back', 'onclick', 'setLocation(\'' . $this->getUrl('*/catalog_product/edit', array('id' => $this->getRequest()->getParam('productId', false))) .'\')' ); 00050 } 00051 00052 if( $this->getRequest()->getParam('customerId', false) ) { 00053 $this->_updateButton('back', 'onclick', 'setLocation(\'' . $this->getUrl('*/customer/edit', array('id' => $this->getRequest()->getParam('customerId', false))) .'\')' ); 00054 } 00055 00056 if( $this->getRequest()->getParam('ret', false) == 'pending' ) { 00057 $this->_updateButton('back', 'onclick', 'setLocation(\'' . $this->getUrl('*/*/pending') .'\')' ); 00058 $this->_updateButton('delete', 'onclick', 'deleteConfirm(\'' . Mage::helper('review')->__('Are you sure you want to do this?') . '\', \'' . $this->getUrl('*/*/delete', array( 00059 $this->_objectId => $this->getRequest()->getParam($this->_objectId), 00060 'ret' => 'pending', 00061 )) .'\')' ); 00062 Mage::register('ret', 'pending'); 00063 } 00064 00065 if( $this->getRequest()->getParam($this->_objectId) ) { 00066 $reviewData = Mage::getModel('review/review') 00067 ->load($this->getRequest()->getParam($this->_objectId)); 00068 Mage::register('review_data', $reviewData); 00069 } 00070 00071 $this->_formInitScripts[] = ' 00072 var review = { 00073 updateRating: function() { 00074 elements = [$("select_stores"), $("rating_detail").getElementsBySelector("input[type=\'radio\']")].flatten(); 00075 $(\'save_button\').disabled = true; 00076 new Ajax.Updater("rating_detail", "'.$this->getUrl('*/*/ratingItems', array('_current'=>true)).'", {parameters:Form.serializeElements(elements), evalScripts:true, onComplete:function(){ $(\'save_button\').disabled = false; } }); 00077 } 00078 } 00079 Event.observe(window, \'load\', function(){ 00080 Event.observe($("select_stores"), \'change\', review.updateRating); 00081 }); 00082 '; 00083 }
getHeaderText | ( | ) |
Get header text
Reimplemented from Mage_Adminhtml_Block_Widget_Container.
Definition at line 85 of file Edit.php.
00086 { 00087 if( Mage::registry('review_data') && Mage::registry('review_data')->getId() ) { 00088 return Mage::helper('review')->__("Edit Review '%s'", $this->htmlEscape(Mage::registry('review_data')->getTitle())); 00089 } else { 00090 return Mage::helper('review')->__('New Review'); 00091 } 00092 }