<?php
/**
 * Product Tag Cloud Panel.
 */
class ISC_HOMETAGS_PANEL extends PANEL
{
	/**
	 * Set the settings for this panel.
	 */
	public function SetPanelSettings()
	{
		// How many tags do we have?
		$query = "
			SELECT COUNT(tagid) AS tagcount
			FROM [|PREFIX|]product_tags
		";
		$tagCount = $GLOBALS['ISC_CLASS_DB']->FetchOne($query);

		// How many products does the most popular tag contain?
		$query = "
			SELECT MAX(tagcount) AS popularcount, MIN(tagcount) AS leastcount
			FROM [|PREFIX|]product_tags
		";
		$result = $GLOBALS['ISC_CLASS_DB']->Query($query);
		$tagCounts = $GLOBALS['ISC_CLASS_DB']->Fetch($result);

		// Get a list of all of the tags
		$query = "
			SELECT *
			FROM [|PREFIX|]product_tags
			ORDER BY RAND()
		";
		$min = 100;
$aa = 0;
		$max = 300;
		$GLOBALS['SNIPPETS']['TagList'] = '';
		$result = $GLOBALS['ISC_CLASS_DB']->Query($query);
		while($tag = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {

if($aa<=50){

			$weight = ceil(($tag['tagcount']/$tagCount)*100);

       
				$fontSize = rand(10,18);
#9400D3
$cores = array('#330033','#3333FF','#006600','#333333','#CC0000','#FF9900','#8E236B','#2F2F4F','#3299CC');
$cor = count($cores);

$GLOBALS['FontCor'] = $cores[rand(0,$cor-1)];


			$fontSize = (int)$fontSize;
			$GLOBALS['FontSize'] = $fontSize.'px';
			$GLOBALS['TagName'] = isc_html_escape($tag['tagname']);
			$GLOBALS['TagLink'] = TagLink($tag['tagfriendlyname'], $tag['tagid']);
			$GLOBALS['TagProductCount'] = sprintf(GetLang('XProductsTaggedWith'), $tag['tagcount'], isc_html_escape($tag['tagname']));
			$GLOBALS['SNIPPETS']['TagList'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet('HomeTags');
	}
$aa++;	

}
	}
}