00001 <?php 00002 /** 00003 * Magento 00004 * 00005 * NOTICE OF LICENSE 00006 * 00007 * This source file is subject to the Open Software License (OSL 3.0) 00008 * that is bundled with this package in the file LICENSE.txt. 00009 * It is also available through the world-wide-web at this URL: 00010 * http://opensource.org/licenses/osl-3.0.php 00011 * If you did not receive a copy of the license and are unable to 00012 * obtain it through the world-wide-web, please send an email 00013 * to license@magentocommerce.com so we can send you a copy immediately. 00014 * 00015 * DISCLAIMER 00016 * 00017 * Do not edit or add to this file if you wish to upgrade Magento to newer 00018 * versions in the future. If you wish to customize Magento for your 00019 * needs please refer to http://www.magentocommerce.com for more information. 00020 * 00021 * @category Mage 00022 * @package Mage_Bundle 00023 * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com) 00024 * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 00025 */ 00026 00027 /** 00028 * Adminhtml catalog product bundle items tab block 00029 * 00030 * @category Mage 00031 * @package Mage_Bundle 00032 * @author Magento Core Team <core@magentocommerce.com> 00033 */ 00034 class Mage_Bundle_Block_Adminhtml_Catalog_Product_Edit_Tab_Bundle extends Mage_Adminhtml_Block_Widget implements Mage_Adminhtml_Block_Widget_Tab_Interface 00035 { 00036 protected $_product = null; 00037 public function __construct() 00038 { 00039 parent::__construct(); 00040 $this->setSkipGenerateContent(true); 00041 $this->setTemplate('bundle/product/edit/bundle.phtml'); 00042 } 00043 00044 public function getTabUrl() 00045 { 00046 return $this->getUrl('bundle/product_edit/form', array('_current' => true)); 00047 } 00048 00049 public function getTabClass() 00050 { 00051 return 'ajax'; 00052 } 00053 00054 protected function _prepareLayout() 00055 { 00056 $this->setChild('add_button', 00057 $this->getLayout()->createBlock('adminhtml/widget_button') 00058 ->setData(array( 00059 'label' => Mage::helper('bundle')->__('Add New Option'), 00060 'class' => 'add', 00061 'id' => 'add_new_option', 00062 'on_click' => 'bOption.add()' 00063 )) 00064 ); 00065 00066 $this->setChild('options_box', 00067 $this->getLayout()->createBlock('bundle/adminhtml_catalog_product_edit_tab_bundle_option') 00068 ); 00069 00070 return parent::_prepareLayout(); 00071 } 00072 00073 /** 00074 * Check block readonly 00075 * 00076 * @return boolean 00077 */ 00078 public function isReadonly() 00079 { 00080 return $this->getProduct()->getCompositeReadonly(); 00081 } 00082 00083 public function getAddButtonHtml() 00084 { 00085 return $this->getChildHtml('add_button'); 00086 } 00087 00088 public function getOptionsBoxHtml() 00089 { 00090 return $this->getChildHtml('options_box'); 00091 } 00092 00093 public function getFieldSuffix() 00094 { 00095 return 'product'; 00096 } 00097 00098 public function getProduct() 00099 { 00100 return Mage::registry('product'); 00101 } 00102 00103 public function getTabLabel() 00104 { 00105 return Mage::helper('bundle')->__('Bundle Items'); 00106 } 00107 public function getTabTitle() 00108 { 00109 return Mage::helper('bundle')->__('Bundle Items'); 00110 } 00111 public function canShowTab() 00112 { 00113 return true; 00114 } 00115 public function isHidden() 00116 { 00117 return false; 00118 } 00119 }