Version Notes
Show review count in tab title
Download this release
Release Info
Developer | Daniel Deady |
Extension | Clockworkgeek_DashboardReviews |
Version | 1.1.0 |
Comparing to | |
See all releases |
Code changes from version 1.0.7 to 1.1.0
- app/code/community/Clockworkgeek/DashboardReviews/Block/Grid.php +3 -33
- app/code/community/Clockworkgeek/DashboardReviews/Block/Tab.php +3 -1
- app/code/community/Clockworkgeek/DashboardReviews/Model/Resource/Review/Pending/Collection.php +38 -0
- app/code/community/Clockworkgeek/DashboardReviews/etc/config.xml +1 -1
- package.xml +4 -4
app/code/community/Clockworkgeek/DashboardReviews/Block/Grid.php
CHANGED
@@ -27,39 +27,9 @@ class Clockworkgeek_DashboardReviews_Block_Grid extends Mage_Adminhtml_Block_Das
|
|
27 |
|
28 |
protected function _prepareCollection()
|
29 |
{
|
30 |
-
/* @var $
|
31 |
-
$
|
32 |
-
|
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 |
}
|
27 |
|
28 |
protected function _prepareCollection()
|
29 |
{
|
30 |
+
/* @var $reviews Clockworkgeek_DashboardReviews_Model_Resource_Review_Pending_Collection */
|
31 |
+
$reviews = Mage::getModel('dashboardreviews/resource_review_pending_collection');
|
32 |
+
$this->setCollection($reviews);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
|
34 |
return parent::_prepareCollection();
|
35 |
}
|
app/code/community/Clockworkgeek/DashboardReviews/Block/Tab.php
CHANGED
@@ -23,13 +23,15 @@ class Clockworkgeek_DashboardReviews_Block_Tab extends Mage_Adminhtml_Block_Abst
|
|
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 |
)),
|
23 |
/* @var $session Mage_Admin_Model_Session */
|
24 |
$session = Mage::getSingleton('admin/session');
|
25 |
if ($session->isAllowed('catalog/reviews_ratings/reviews/pending')) {
|
26 |
+
/* @var $reviews Clockworkgeek_DashboardReviews_Model_Resource_Review_Pending_Collection */
|
27 |
+
$reviews = Mage::getModel('dashboardreviews/resource_review_pending_collection');
|
28 |
/* @var $grids Mage_Adminhtml_Block_Dashboard_Grids */
|
29 |
$grids = $this->getLayout()
|
30 |
->getBlock('content')
|
31 |
->getChild('dashboard')
|
32 |
->getChild('grids');
|
33 |
$grids->addTab('pending_reviews', array(
|
34 |
+
'label' => Mage::helper('review')->__('Pending Reviews (%d)', $reviews->getSize()),
|
35 |
'url' => $this->getUrl('*/dashboardReviews/pending', array(
|
36 |
'_current' => true
|
37 |
)),
|
app/code/community/Clockworkgeek/DashboardReviews/Model/Resource/Review/Pending/Collection.php
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Clockworkgeek_DashboardReviews_Model_Resource_Review_Pending_Collection
|
4 |
+
extends Mage_Review_Model_Mysql4_Review_Product_Collection
|
5 |
+
{
|
6 |
+
|
7 |
+
protected function _initSelect()
|
8 |
+
{
|
9 |
+
parent::_initSelect();
|
10 |
+
$this->addStatusFilter(Mage_Review_Model_Review::STATUS_PENDING)
|
11 |
+
->addStoreData()
|
12 |
+
->setDateOrder()
|
13 |
+
->addReviewSummary();
|
14 |
+
return $this;
|
15 |
+
}
|
16 |
+
|
17 |
+
protected function _afterLoad()
|
18 |
+
{
|
19 |
+
parent::_afterLoad();
|
20 |
+
$this->_addSummaryData();
|
21 |
+
return $this;
|
22 |
+
}
|
23 |
+
|
24 |
+
protected function _addSummaryData()
|
25 |
+
{
|
26 |
+
Mage::register('review_data', $this->getFirstItem(), true);
|
27 |
+
|
28 |
+
/* @var $layout Mage_Core_Model_Layout */
|
29 |
+
$layout = Mage::app()->getLayout();
|
30 |
+
foreach ($this as $item) {
|
31 |
+
$rating = $layout->createBlock('adminhtml/review_rating_summary');
|
32 |
+
$rating->setReviewId($item->getReviewId());
|
33 |
+
$item->setData('summary_rating', $rating->toHtml());
|
34 |
+
}
|
35 |
+
|
36 |
+
return $this;
|
37 |
+
}
|
38 |
+
}
|
app/code/community/Clockworkgeek/DashboardReviews/etc/config.xml
CHANGED
@@ -19,7 +19,7 @@
|
|
19 |
<config>
|
20 |
<modules>
|
21 |
<Clockworkgeek_DashboardReviews>
|
22 |
-
<version>1.0
|
23 |
</Clockworkgeek_DashboardReviews>
|
24 |
</modules>
|
25 |
<global>
|
19 |
<config>
|
20 |
<modules>
|
21 |
<Clockworkgeek_DashboardReviews>
|
22 |
+
<version>1.1.0</version>
|
23 |
</Clockworkgeek_DashboardReviews>
|
24 |
</modules>
|
25 |
<global>
|
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>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>
|
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>
|
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="
|
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.1.0</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>Show review count in tab title</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>20:05:48</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="f652abe75dd0a800a4fd908040c92268"/><file name="Tab.php" hash="fbc52bdf73a46040d51548e8d380b12c"/></dir><dir name="Model"><dir name="Resource"><dir name="Review"><dir name="Pending"><file name="Collection.php" hash="3910888856efd01d13e9970fd45bfb7c"/></dir></dir></dir></dir><dir name="controllers"><file name="DashboardReviewsController.php" hash="226a45801594297151f681fe246839f3"/></dir><dir name="etc"><file name="config.xml" hash="37a104cf0834f509dac51fa707a56bc9"/></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>
|