Mage_Tag_Block_Customer_Tags Class Reference

Inheritance diagram for Mage_Tag_Block_Customer_Tags:

Mage_Customer_Block_Account_Dashboard Mage_Core_Block_Template Mage_Core_Block_Abstract Varien_Object

List of all members.

Public Member Functions

 getTags ()
 getMaxPopularity ()
 getMinPopularity ()

Protected Member Functions

 _loadTags ()

Protected Attributes

 $_tags
 $_minPopularity
 $_maxPopularity


Detailed Description

Definition at line 35 of file Tags.php.


Member Function Documentation

_loadTags (  )  [protected]

Definition at line 41 of file Tags.php.

00042     {
00043         if (empty($this->_tags)) {
00044             $this->_tags = array();
00045 
00046             $tags = Mage::getResourceModel('tag/tag_collection')
00047                 ->addPopularity()
00048                 ->setOrder('popularity', 'DESC')
00049                 #->addStatusFilter(Mage_Tag_Model_Tag::STATUS_APPROVED)
00050                 ->addCustomerFilter(Mage::getSingleton('customer/session')->getCustomerId())
00051                 ->setActiveFilter()
00052                 ->load()
00053                 ->getItems();
00054         } else {
00055             return;
00056         }
00057 
00058         if( isset($tags) && count($tags) == 0 ) {
00059             return;
00060         }
00061 
00062         $this->_maxPopularity = reset($tags)->getPopularity();
00063         $this->_minPopularity = end($tags)->getPopularity();
00064         $range = $this->_maxPopularity - $this->_minPopularity;
00065         $range = ( $range == 0 ) ? 1 : $range;
00066 
00067         foreach ($tags as $tag) {
00068             $tag->setRatio(($tag->getPopularity()-$this->_minPopularity)/$range);
00069             $this->_tags[$tag->getName()] = $tag;
00070         }
00071         ksort($this->_tags);
00072     }

getMaxPopularity (  ) 

Definition at line 80 of file Tags.php.

00081     {
00082         return $this->_maxPopularity;
00083     }

getMinPopularity (  ) 

Definition at line 85 of file Tags.php.

00086     {
00087         return $this->_minPopularity;
00088     }

getTags (  ) 

Definition at line 74 of file Tags.php.

00075     {
00076         $this->_loadTags();
00077         return $this->_tags;
00078     }


Member Data Documentation

$_maxPopularity [protected]

Definition at line 39 of file Tags.php.

$_minPopularity [protected]

Definition at line 38 of file Tags.php.

$_tags [protected]

Definition at line 37 of file Tags.php.


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

Generated on Sat Jul 4 17:24:52 2009 for Magento by  doxygen 1.5.8