Skip to content

Commit

Permalink
Implemented MAGETWO-11122: Configurable Grids (magento#471)
Browse files Browse the repository at this point in the history
- converted Magento\Sales\Block\Adminhtml\Transactions\Grid and Magento\Sales\Block\Adminhtml\Order\View\Tab\Transactions to new layout xml config format
  • Loading branch information
Zyava committed Feb 1, 2014
1 parent 87c9601 commit 6094315
Show file tree
Hide file tree
Showing 19 changed files with 777 additions and 238 deletions.
58 changes: 58 additions & 0 deletions app/code/Magento/Payment/Model/Resource/Grid/GroupsArray.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?php
/**
* Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@magentocommerce.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade Magento to newer
* versions in the future. If you wish to customize Magento for your
* needs please refer to http://www.magentocommerce.com for more information.
*
* @category Magento
* @package Magento_Sales
* @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/

namespace Magento\Payment\Model\Resource\Grid;

/**
* Sales transaction types option array
*/
class GroupsArray implements \Magento\Core\Model\Option\ArrayInterface
{
/**
* Payment data
*
* @var \Magento\Payment\Helper\Data
*/
protected $_paymentData;

/**
* @param \Magento\Payment\Helper\Data $paymentData
*/
public function __construct(\Magento\Payment\Helper\Data $paymentData)
{
$this->_paymentData = $paymentData;
}

/**
* Return option array
*
* @return array
*/
public function toOptionArray()
{
return $this->_paymentData->getPaymentMethodList(true, true, true);
}
}
58 changes: 58 additions & 0 deletions app/code/Magento/Payment/Model/Resource/Grid/TypesArray.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?php
/**
* Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@magentocommerce.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade Magento to newer
* versions in the future. If you wish to customize Magento for your
* needs please refer to http://www.magentocommerce.com for more information.
*
* @category Magento
* @package Magento_Sales
* @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/

namespace Magento\Payment\Model\Resource\Grid;

/**
* Sales transaction payment method types option array
*/
class TypesArray implements \Magento\Core\Model\Option\ArrayInterface
{
/**
* Payment data
*
* @var \Magento\Payment\Helper\Data
*/
protected $_paymentData;

/**
* @param \Magento\Payment\Helper\Data $paymentData
*/
public function __construct(\Magento\Payment\Helper\Data $paymentData)
{
$this->_paymentData = $paymentData;
}

/**
* Return option array
*
* @return array
*/
public function toOptionArray()
{
return $this->_paymentData->getPaymentMethodList(true);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,64 +34,84 @@
namespace Magento\Sales\Block\Adminhtml\Order\View\Tab;

class Transactions
extends \Magento\Sales\Block\Adminhtml\Transactions\Grid
extends \Magento\View\Element\Text\ListText
implements \Magento\Backend\Block\Widget\Tab\TabInterface
{
/**
* @var \Magento\AuthorizationInterface
*/
protected $_authorization;

/**
* Retrieve grid url
*
* @return string
* @param \Magento\View\Element\Context $context
* @param \Magento\AuthorizationInterface $authorization
* @param array $data
*/
public function getGridUrl()
{
return $this->getUrl('sales/order/transactions', array('_current' => true));
public function __construct(
\Magento\View\Element\Context $context,
\Magento\AuthorizationInterface $authorization,
array $data = array()
) {
$this->_authorization = $authorization;
parent::__construct($context, $data);
}

// /**
// * Retrieve grid url
// *
// * @return string
// */
// public function getGridUrl()
// {
// return $this->getUrl('sales/order/transactions', array('_current' => true));
// }
//
// /**
// * Retrieve grid row url
// *
// * @return string
// */
// public function getRowUrl($item)
// {
// return $this->getUrl('sales/transactions/view', array('_current' => true, 'txn_id' => $item->getId()));
// }

/**
* Retrieve grid row url
*
* @return string
* Initialize grid params
*/
public function getRowUrl($item)
protected function _construct()
{
return $this->getUrl('sales/transactions/view', array('_current' => true, 'txn_id' => $item->getId()));
parent::_construct();
$this->setId('order_transactions');
$this->setUseAjax(true);
}

/**
* Retrieve tab label
*
* @return string
* {@inheritdoc}
*/
public function getTabLabel()
{
return __('Transactions');
}

/**
* Retrieve tab title
*
* @return string
* {@inheritdoc}
*/
public function getTabTitle()
{
return __('Transactions');
}

/**
* Check whether can show tab
*
* @return bool
* {@inheritdoc}
*/
public function canShowTab()
{
return true;
}

/**
* Check whether tab is hidden
*
* @return bool
* {@inheritdoc}
*/
public function isHidden()
{
Expand Down
Loading

0 comments on commit 6094315

Please sign in to comment.