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 transaction details grid
29: *
30: * @category Mage
31: * @package Mage_Adminhtml
32: * @author Magento Core Team <core@magentocommerce.com>
33: */
34: class Mage_Adminhtml_Block_Sales_Transactions_Detail_Grid extends Mage_Adminhtml_Block_Widget_Grid
35: {
36: /**
37: * Initialize default sorting and html ID
38: */
39: protected function _construct()
40: {
41: $this->setId('transactionDetailsGrid');
42: $this->setPagerVisibility(false);
43: $this->setFilterVisibility(false);
44: }
45:
46: /**
47: * Prepare collection for grid
48: *
49: * @return Mage_Adminhtml_Block_Widget_Grid
50: */
51: protected function _prepareCollection()
52: {
53: $collection = new Varien_Data_Collection();
54: foreach ($this->getTransactionAdditionalInfo() as $key => $value) {
55: $data = new Varien_Object(array('key' => $key, 'value' => $value));
56: $collection->addItem($data);
57: }
58:
59: $this->setCollection($collection);
60: return parent::_prepareCollection();
61: }
62:
63: /**
64: * Add columns to grid
65: *
66: * @return Mage_Adminhtml_Block_Widget_Grid
67: */
68: protected function _prepareColumns()
69: {
70: $this->addColumn('key', array(
71: 'header' => Mage::helper('sales')->__('Key'),
72: 'index' => 'key',
73: 'sortable' => false,
74: 'type' => 'text',
75: 'width' => '50%'
76: ));
77:
78: $this->addColumn('value', array(
79: 'header' => Mage::helper('sales')->__('Value'),
80: 'index' => 'value',
81: 'sortable' => false,
82: 'type' => 'text',
83: 'escape' => true
84: ));
85:
86: return parent::_prepareColumns();
87: }
88:
89: /**
90: * Retrieve Transaction addtitional info
91: *
92: * @return array
93: */
94: public function getTransactionAdditionalInfo()
95: {
96: $info = Mage::registry('current_transaction')->getAdditionalInformation(
97: Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS
98: );
99: return (is_array($info)) ? $info : array();
100: }
101: }
102: