Mage_Adminhtml_Block_Review_Rating_Detailed Class Reference

Inheritance diagram for Mage_Adminhtml_Block_Review_Rating_Detailed:

Mage_Adminhtml_Block_Template Mage_Core_Block_Template Mage_Core_Block_Abstract Varien_Object

List of all members.

Public Member Functions

 __construct ()
 getRating ()
 setIndependentMode ()
 isSelected ($option, $rating)

Protected Attributes

 $_voteCollection = false


Detailed Description

Definition at line 35 of file Detailed.php.


Constructor & Destructor Documentation

__construct (  ) 

Constructor

By default is looking for first argument as array and assignes it as object attributes This behaviour may change in child classes

Reimplemented from Varien_Object.

Definition at line 38 of file Detailed.php.

00039     {
00040         parent::__construct();
00041         $this->setTemplate('rating/detailed.phtml');
00042         if( Mage::registry('review_data') ) {
00043             $this->setReviewId(Mage::registry('review_data')->getReviewId());
00044         }
00045     }


Member Function Documentation

getRating (  ) 

Definition at line 47 of file Detailed.php.

00048     {
00049         if( !$this->getRatingCollection() ) {
00050             if( Mage::registry('review_data') ) {
00051                 $stores = Mage::registry('review_data')->getStores();
00052 
00053                 $stores = array_diff($stores, array(0));
00054 
00055                 $ratingCollection = Mage::getModel('rating/rating')
00056                     ->getResourceCollection()
00057                     ->addEntityFilter('product')
00058                     ->setStoreFilter($stores)
00059                     ->setPositionOrder()
00060                     ->load()
00061                     ->addOptionToItems();
00062 
00063                 $this->_voteCollection = Mage::getModel('rating/rating_option_vote')
00064                     ->getResourceCollection()
00065                     ->setReviewFilter($this->getReviewId())
00066                     ->addOptionInfo()
00067                     ->load()
00068                     ->addRatingOptions();
00069 
00070             } elseif (!$this->getIsIndependentMode()) {
00071                 $ratingCollection = Mage::getModel('rating/rating')
00072                     ->getResourceCollection()
00073                     ->addEntityFilter('product')
00074                     ->setStoreFilter(null)
00075                     ->setPositionOrder()
00076                     ->load()
00077                     ->addOptionToItems();
00078             } else {
00079                  $ratingCollection = Mage::getModel('rating/rating')
00080                     ->getResourceCollection()
00081                     ->addEntityFilter('product')
00082                     ->setStoreFilter($this->getRequest()->getParam('select_stores') ? $this->getRequest()->getParam('select_stores') : $this->getRequest()->getParam('stores'))
00083                     ->setPositionOrder()
00084                     ->load()
00085                     ->addOptionToItems();
00086 
00087 
00088             }
00089             $this->setRatingCollection( ( $ratingCollection->getSize() ) ? $ratingCollection : false );
00090         }
00091         return $this->getRatingCollection();
00092     }

isSelected ( option,
rating 
)

Definition at line 100 of file Detailed.php.

00101     {
00102         if($this->getIsIndependentMode()) {
00103             $ratings = $this->getRequest()->getParam('ratings');
00104 
00105             if(isset($ratings[$option->getRatingId()])) {
00106                 return $option->getId() == $ratings[$option->getRatingId()];
00107             }
00108 
00109             return false;
00110         }
00111 
00112         if($this->_voteCollection) {
00113             foreach($this->_voteCollection as $vote) {
00114                 if($option->getId() == $vote->getOptionId()) {
00115                     return true;
00116                 }
00117             }
00118         }
00119 
00120         return false;
00121     }

setIndependentMode (  ) 

Definition at line 94 of file Detailed.php.

00095     {
00096         $this->setIsIndependentMode(true);
00097         return $this;
00098     }


Member Data Documentation

$_voteCollection = false [protected]

Definition at line 37 of file Detailed.php.


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:22:57 2009 for Magento by  doxygen 1.5.8