1: <?php
2: /**
3: * Magento
4: *
5: * NOTICE OF LICENSE
6: *
7: * This source file is subject to the Open Software License (OSL 3.0)
8: * that is bundled with this package in the file LICENSE.txt.
9: * It is also available through the world-wide-web at this URL:
10: * http://opensource.org/licenses/osl-3.0.php
11: * If you did not receive a copy of the license and are unable to
12: * obtain it through the world-wide-web, please send an email
13: * to license@magentocommerce.com so we can send you a copy immediately.
14: *
15: * DISCLAIMER
16: *
17: * Do not edit or add to this file if you wish to upgrade Magento to newer
18: * versions in the future. If you wish to customize Magento for your
19: * needs please refer to http://www.magentocommerce.com for more information.
20: *
21: * @category Mage
22: * @package Mage_Adminhtml
23: * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24: * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25: */
26:
27: /**
28: * Adminhtml sales order create items block
29: *
30: * @category Mage
31: * @package Mage_Adminhtml
32: * @author Magento Core Team <core@magentocommerce.com>
33: */
34:
35: class Mage_Adminhtml_Block_Sales_Order_Create_Items extends Mage_Adminhtml_Block_Sales_Order_Create_Abstract
36: {
37: /**
38: * Contains button descriptions to be shown at the top of accordion
39: * @var array
40: */
41: protected $_buttons = array();
42:
43: /**
44: * Define block ID
45: */
46: public function __construct()
47: {
48: parent::__construct();
49: $this->setId('sales_order_create_items');
50: }
51:
52: /**
53: * Accordion header text
54: *
55: * @return string
56: */
57: public function getHeaderText()
58: {
59: return Mage::helper('sales')->__('Items Ordered');
60: }
61:
62: /**
63: * Returns all visible items
64: *
65: * @return array
66: */
67: public function getItems()
68: {
69: return $this->getQuote()->getAllVisibleItems();
70: }
71:
72: /**
73: * Add button to the items header
74: *
75: * @param $args array
76: */
77: public function addButton($args)
78: {
79: $this->_buttons[] = $args;
80: }
81:
82: /**
83: * Render buttons and return HTML code
84: *
85: * @return string
86: */
87: public function getButtonsHtml()
88: {
89: $html = '';
90: // Make buttons to be rendered in opposite order of addition. This makes "Add products" the last one.
91: $this->_buttons = array_reverse($this->_buttons);
92: foreach ($this->_buttons as $buttonData) {
93: $html .= $this->getLayout()->createBlock('adminhtml/widget_button')->setData($buttonData)->toHtml();
94: }
95:
96: return $html;
97: }
98:
99: /**
100: * Return HTML code of the block
101: *
102: * @return string
103: */
104: protected function _toHtml()
105: {
106: if ($this->getStoreId()) {
107: return parent::_toHtml();
108: }
109: return '';
110: }
111:
112: }
113: