Version Notes
Dashboard tab hides if "Pending Reviews" permission is missing
Download this release
Release Info
Developer | Daniel Deady |
Extension | Clockworkgeek_DashboardReviews |
Version | 1.0.7 |
Comparing to | |
See all releases |
Code changes from version 1.0.6 to 1.0.7
- app/code/community/Clockworkgeek/DashboardReviews/Block/Grid.php +55 -50
- app/code/community/Clockworkgeek/DashboardReviews/Block/Tab.php +17 -9
- app/code/community/Clockworkgeek/DashboardReviews/controllers/DashboardReviewsController.php +10 -4
- app/code/community/Clockworkgeek/DashboardReviews/etc/config.xml +37 -32
- package.xml +8 -8
app/code/community/Clockworkgeek/DashboardReviews/Block/Grid.php
CHANGED
@@ -27,78 +27,83 @@ class Clockworkgeek_DashboardReviews_Block_Grid extends Mage_Adminhtml_Block_Das
|
|
27 |
|
28 |
protected function _prepareCollection()
|
29 |
{
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
$storeIds = Mage::app()->getWebsite($this->getParam('website'))
|
|
|
38 |
$storeId = array_pop($storeIds);
|
39 |
-
} else
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
}
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
/* @var $item Mage_Catalog_Model_Product */
|
50 |
-
foreach ($collection as $item) {
|
51 |
-
if (!Mage::registry('review_data')) Mage::register('review_data', $item);
|
52 |
-
/* @var $rating Mage_Adminhtml_Block_Review_Rating_Summary */
|
53 |
-
$rating = $this->getLayout()->createBlock('adminhtml/review_rating_summary');
|
54 |
-
$rating->setReviewId($item->getReviewId());
|
55 |
-
$item->setData('summary_rating', $rating->toHtml());
|
56 |
-
}
|
57 |
-
|
58 |
-
$this->setCollection($collection);
|
59 |
-
|
60 |
-
return parent::_prepareCollection();
|
61 |
}
|
62 |
|
63 |
protected function _prepareColumns()
|
64 |
{
|
65 |
$this->addColumn('name', array(
|
66 |
-
'header'
|
67 |
-
'sortable'
|
68 |
-
'index'
|
69 |
-
|
70 |
));
|
71 |
-
|
72 |
$this->addColumn('title', array(
|
73 |
-
'header'
|
74 |
-
'width'
|
75 |
-
'sortable'
|
76 |
-
'index'
|
77 |
-
|
78 |
-
|
79 |
));
|
80 |
-
|
81 |
$this->addColumn('summary_rating', array(
|
82 |
-
'header'
|
83 |
-
'width'
|
84 |
-
|
85 |
-
'index'
|
86 |
-
'type'
|
87 |
));
|
88 |
-
|
89 |
$this->setFilterVisibility(false);
|
90 |
$this->setPagerVisibility(false);
|
91 |
-
|
92 |
return parent::_prepareColumns();
|
93 |
}
|
94 |
|
95 |
public function getRowUrl($row)
|
96 |
{
|
97 |
-
$params = array(
|
|
|
|
|
98 |
if ($this->getRequest()->getParam('store')) {
|
99 |
$params['store'] = $this->getRequest()->getParam('store');
|
100 |
}
|
101 |
return $this->getUrl('*/catalog_product_review/edit', $params);
|
102 |
}
|
103 |
-
|
104 |
}
|
27 |
|
28 |
protected function _prepareCollection()
|
29 |
{
|
30 |
+
/* @var $model Mage_Review_Model_Review */
|
31 |
+
$model = Mage::getModel('review/review');
|
32 |
+
/* @var $collection Mage_Review_Model_Mysql4_Review_Product_Collection */
|
33 |
+
$collection = $model->getProductCollection()
|
34 |
+
->addStatusFilter($model->getPendingStatus())
|
35 |
+
->addStoreData();
|
36 |
+
if ($this->getParam('website')) {
|
37 |
+
$storeIds = Mage::app()->getWebsite($this->getParam('website'))
|
38 |
+
->getStoreIds();
|
39 |
$storeId = array_pop($storeIds);
|
40 |
+
} else
|
41 |
+
if ($this->getParam('group')) {
|
42 |
+
$storeIds = Mage::app()->getGroup($this->getParam('group'))
|
43 |
+
->getStoreIds();
|
44 |
+
$storeId = array_pop($storeIds);
|
45 |
+
} else {
|
46 |
+
$storeId = (int) $this->getParam('store');
|
47 |
+
}
|
48 |
+
$collection->setDateOrder()
|
49 |
+
->setStoreId($storeId)
|
50 |
+
->addStoreFilter($storeId)
|
51 |
+
->addReviewSummary();
|
52 |
+
/* @var $item Mage_Catalog_Model_Product */
|
53 |
+
foreach ($collection as $item) {
|
54 |
+
if (! Mage::registry('review_data'))
|
55 |
+
Mage::register('review_data', $item);
|
56 |
+
/* @var $rating Mage_Adminhtml_Block_Review_Rating_Summary */
|
57 |
+
$rating = $this->getLayout()->createBlock('adminhtml/review_rating_summary');
|
58 |
+
$rating->setReviewId($item->getReviewId());
|
59 |
+
$item->setData('summary_rating', $rating->toHtml());
|
60 |
}
|
61 |
+
|
62 |
+
$this->setCollection($collection);
|
63 |
+
|
64 |
+
return parent::_prepareCollection();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
}
|
66 |
|
67 |
protected function _prepareColumns()
|
68 |
{
|
69 |
$this->addColumn('name', array(
|
70 |
+
'header' => Mage::helper('reports')->__('Product Name'),
|
71 |
+
'sortable' => false,
|
72 |
+
'index' => 'name',
|
73 |
+
'escape' => true
|
74 |
));
|
75 |
+
|
76 |
$this->addColumn('title', array(
|
77 |
+
'header' => Mage::helper('reports')->__('Title'),
|
78 |
+
'width' => '200px',
|
79 |
+
'sortable' => false,
|
80 |
+
'index' => 'title',
|
81 |
+
'truncate' => 50,
|
82 |
+
'escape' => true
|
83 |
));
|
84 |
+
|
85 |
$this->addColumn('summary_rating', array(
|
86 |
+
'header' => Mage::helper('review')->__('Summary Rating'),
|
87 |
+
'width' => '100px',
|
88 |
+
'sortable' => false,
|
89 |
+
'index' => 'summary_rating',
|
90 |
+
'type' => 'text'
|
91 |
));
|
92 |
+
|
93 |
$this->setFilterVisibility(false);
|
94 |
$this->setPagerVisibility(false);
|
95 |
+
|
96 |
return parent::_prepareColumns();
|
97 |
}
|
98 |
|
99 |
public function getRowUrl($row)
|
100 |
{
|
101 |
+
$params = array(
|
102 |
+
'id' => $row->getReviewId()
|
103 |
+
);
|
104 |
if ($this->getRequest()->getParam('store')) {
|
105 |
$params['store'] = $this->getRequest()->getParam('store');
|
106 |
}
|
107 |
return $this->getUrl('*/catalog_product_review/edit', $params);
|
108 |
}
|
|
|
109 |
}
|
app/code/community/Clockworkgeek/DashboardReviews/Block/Tab.php
CHANGED
@@ -20,14 +20,22 @@ class Clockworkgeek_DashboardReviews_Block_Tab extends Mage_Adminhtml_Block_Abst
|
|
20 |
|
21 |
protected function _prepareLayout()
|
22 |
{
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
}
|
32 |
-
|
33 |
}
|
20 |
|
21 |
protected function _prepareLayout()
|
22 |
{
|
23 |
+
/* @var $session Mage_Admin_Model_Session */
|
24 |
+
$session = Mage::getSingleton('admin/session');
|
25 |
+
if ($session->isAllowed('catalog/reviews_ratings/reviews/pending')) {
|
26 |
+
/* @var $grids Mage_Adminhtml_Block_Dashboard_Grids */
|
27 |
+
$grids = $this->getLayout()
|
28 |
+
->getBlock('content')
|
29 |
+
->getChild('dashboard')
|
30 |
+
->getChild('grids');
|
31 |
+
$grids->addTab('pending_reviews', array(
|
32 |
+
'label' => Mage::helper('review')->__('Pending Reviews'),
|
33 |
+
'url' => $this->getUrl('*/dashboardReviews/pending', array(
|
34 |
+
'_current' => true
|
35 |
+
)),
|
36 |
+
'class' => 'ajax'
|
37 |
+
));
|
38 |
+
}
|
39 |
+
return parent::_prepareLayout();
|
40 |
}
|
|
|
41 |
}
|
app/code/community/Clockworkgeek/DashboardReviews/controllers/DashboardReviewsController.php
CHANGED
@@ -18,9 +18,15 @@
|
|
18 |
class Clockworkgeek_DashboardReviews_DashboardReviewsController extends Mage_Adminhtml_Controller_Action
|
19 |
{
|
20 |
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
|
|
|
|
25 |
|
|
|
|
|
|
|
|
|
26 |
}
|
18 |
class Clockworkgeek_DashboardReviews_DashboardReviewsController extends Mage_Adminhtml_Controller_Action
|
19 |
{
|
20 |
|
21 |
+
public function pendingAction()
|
22 |
+
{
|
23 |
+
$this->getResponse()->setBody($this->getLayout()
|
24 |
+
->createBlock('dashboardreviews/grid')
|
25 |
+
->toHtml());
|
26 |
+
}
|
27 |
|
28 |
+
protected function _isAllowed()
|
29 |
+
{
|
30 |
+
return Mage::getSingleton('admin/session')->isAllowed('catalog/reviews_ratings/reviews/pending');
|
31 |
+
}
|
32 |
}
|
app/code/community/Clockworkgeek/DashboardReviews/etc/config.xml
CHANGED
@@ -17,36 +17,41 @@
|
|
17 |
*/
|
18 |
-->
|
19 |
<config>
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
|
|
|
|
|
|
|
|
|
|
52 |
</config>
|
17 |
*/
|
18 |
-->
|
19 |
<config>
|
20 |
+
<modules>
|
21 |
+
<Clockworkgeek_DashboardReviews>
|
22 |
+
<version>1.0.7</version>
|
23 |
+
</Clockworkgeek_DashboardReviews>
|
24 |
+
</modules>
|
25 |
+
<global>
|
26 |
+
<blocks>
|
27 |
+
<dashboardreviews>
|
28 |
+
<class>Clockworkgeek_DashboardReviews_Block</class>
|
29 |
+
</dashboardreviews>
|
30 |
+
</blocks>
|
31 |
+
<models>
|
32 |
+
<dashboardreviews>
|
33 |
+
<class>Clockworkgeek_DashboardReviews_Model</class>
|
34 |
+
</dashboardreviews>
|
35 |
+
</models>
|
36 |
+
</global>
|
37 |
+
<admin>
|
38 |
+
<routers>
|
39 |
+
<adminhtml>
|
40 |
+
<args>
|
41 |
+
<modules>
|
42 |
+
<dashboardreviews before="Mage_Adminhtml">Clockworkgeek_DashboardReviews</dashboardreviews>
|
43 |
+
</modules>
|
44 |
+
</args>
|
45 |
+
</adminhtml>
|
46 |
+
</routers>
|
47 |
+
</admin>
|
48 |
+
<adminhtml>
|
49 |
+
<layout>
|
50 |
+
<updates>
|
51 |
+
<dashboardreviews>
|
52 |
+
<file>dashboardreviews.xml</file>
|
53 |
+
</dashboardreviews>
|
54 |
+
</updates>
|
55 |
+
</layout>
|
56 |
+
</adminhtml>
|
57 |
</config>
|
package.xml
CHANGED
@@ -1,18 +1,18 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Clockworkgeek_DashboardReviews</name>
|
4 |
-
<version>1.0.
|
5 |
<stability>stable</stability>
|
6 |
-
<license
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Show the newest, pending product reviews on the admin dashboard.</summary>
|
10 |
-
<description
|
11 |
-
<notes>
|
12 |
-
<authors><author><name>
|
13 |
-
<date>
|
14 |
-
<time>18:
|
15 |
-
<contents><target name="
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Clockworkgeek_DashboardReviews</name>
|
4 |
+
<version>1.0.7</version>
|
5 |
<stability>stable</stability>
|
6 |
+
<license>OSL-3.0</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Show the newest, pending product reviews on the admin dashboard.</summary>
|
10 |
+
<description/>
|
11 |
+
<notes>Dashboard tab hides if "Pending Reviews" permission is missing</notes>
|
12 |
+
<authors><author><name>Daniel Deady</name><user>daniel</user><email>daniel@clockworkgeek.com</email></author></authors>
|
13 |
+
<date>2015-03-26</date>
|
14 |
+
<time>18:56:59</time>
|
15 |
+
<contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="dashboardreviews.xml" hash="b967cebe14913211d0261fe076909fbd"/></dir></dir></dir></dir></target><target name="magecommunity"><dir name="Clockworkgeek"><dir name="DashboardReviews"><dir name="Block"><file name="Grid.php" hash="ee29c0c7194451628a041e32cac7b83f"/><file name="Tab.php" hash="47e14ada6cf69c4ba7f8ce53436f89a7"/></dir><dir name="controllers"><file name="DashboardReviewsController.php" hash="226a45801594297151f681fe246839f3"/></dir><dir name="etc"><file name="config.xml" hash="e181073f1f400bb6c5a590989d0cee82"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Clockworkgeek_DashboardReviews.xml" hash="8eb4821e4a9c5fc84cd9cd8f7bcac622"/></dir></target></contents>
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
</package>
|