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_XmlConnect
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: * XmlConnect application history grid
29: *
30: * @category Mage
31: * @package Mage_XmlConnect
32: * @author Magento Core Team <core@magentocommerce.com>
33: */
34: class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tab_Submission_History
35: extends Mage_Adminhtml_Block_Widget_Grid
36: implements Mage_Adminhtml_Block_Widget_Tab_Interface
37: {
38: /**
39: * Set order by column and order direction
40: * Set grid ID
41: * Set use AJAX for grid
42: *
43: */
44: public function __construct()
45: {
46: parent::__construct();
47: $this->setId('history_grid');
48: $this->setDefaultSort('created_at');
49: $this->setDefaultDir('ASC');
50: $this->setUseAjax(true);
51: $this->setSaveParametersInSession(true);
52: $this->setVarNameFilter('history_filter');
53: }
54:
55: /**
56: * Tab label getter
57: *
58: * @return string
59: */
60: public function getTabLabel()
61: {
62: return $this->__('Submission History');
63: }
64:
65: /**
66: * Tab title getter
67: *
68: * @return string
69: */
70: public function getTabTitle()
71: {
72: return $this->__('Submission History');
73: }
74:
75: /**
76: * Check if tab can be shown
77: *
78: * @return bool
79: */
80: public function canShowTab()
81: {
82: return (bool) !Mage::getSingleton('adminhtml/session')->getNewApplication();
83: }
84:
85: /**
86: * Check if tab hidden
87: *
88: * @return bool
89: */
90: public function isHidden()
91: {
92: return false;
93: }
94:
95: /**
96: * Initialize history collection
97: * Set application filter
98: *
99: * @return Mage_Adminhtml_Block_Widget_Grid
100: */
101: protected function _prepareCollection()
102: {
103: $collection = Mage::getResourceModel('xmlconnect/history_collection')
104: ->addApplicationFilter($this->_getApplication()->getId());
105: $this->setCollection($collection);
106: return parent::_prepareCollection();
107: }
108:
109: /**
110: * Configuration of grid
111: *
112: * @return Mage_Adminhtml_Block_Widget_Grid
113: */
114: protected function _prepareColumns()
115: {
116: $this->addColumn('activation_key', array(
117: 'header' => $this->__('Activation Key'),
118: 'align' => 'left',
119: 'index' => 'activation_key',
120: 'type' => 'text',
121: 'escape' => true
122: ));
123:
124: $this->addColumn('created_at', array(
125: 'header' => $this->__('Date Submitted'),
126: 'align' => 'left',
127: 'index' => 'created_at',
128: 'type' => 'datetime'
129: ));
130:
131: return parent::_prepareColumns();
132: }
133:
134: /**
135: * Ajax grid URL getter
136: * @return string
137: */
138: public function getGridUrl()
139: {
140: return $this->getUrl('*/*/submissionHistoryGrid', array('_current'=>true));
141: }
142:
143: /**
144: * Get current application model
145: *
146: * @return Mage_XmlConnect_Model_Application
147: */
148: protected function _getApplication()
149: {
150: return Mage::helper('xmlconnect')->getApplication();
151: }
152:
153: /**
154: * Remove row click url
155: *
156: * @param Mage_Catalog_Model_Product|Varien_Object $row
157: * @return string
158: */
159: public function getRowUrl($row)
160: {
161: return '';
162: }
163: }
164: