示例#1
0
 function getCloud(&$params)
 {
     $moduleclass_sfx = $params->get('moduleclass_sfx', '');
     $table = $params->get('table', '');
     $column = $params->get('column', '');
     $filter = $params->get('filter', '');
     $url = $params->get('url', '');
     $splitter = $params->get('splitter', '');
     $alphabetically = $params->get('alphabetically', '');
     $min = intval($params->get('min', 1));
     $max = intval($params->get('max', 20));
     $seperator = $params->get('seperator', '');
     $document =& JFactory::getDocument();
     $db =& JFactory::getDBO();
     $query = "SELECT {$column} FROM {$table}";
     if ($filter != '') {
         $query .= " WHERE {$filter}";
     }
     $db->setQuery($query);
     $rows = $db->loadResultArray();
     $oCloud = new tagCloud($rows, $url, $min, $max, $seperator, $splitter);
     return $oCloud->render($alphabetically);
 }
示例#2
0
文件: helper.php 项目: rhotog/fabrik
 function getCloud(&$params)
 {
     $moduleclass_sfx = $params->get('moduleclass_sfx', '');
     $table = $params->get('table', '');
     $column = $params->get('column', '');
     $filter = $params->get('filter', '');
     $url = $params->get('url', '');
     $splitter = $params->get('splitter', '');
     $alphabetically = $params->get('alphabetically', '');
     $min = (int) $params->get('min', 1);
     $max = (int) $params->get('max', 20);
     $seperator = $params->get('seperator', '');
     $document = JFactory::getDocument();
     $db = JFactory::getDBO();
     $query = $db->getQuery(true);
     $query->select($column)->from($table);
     if ($filter != '') {
         $query->wher($filter);
     }
     $db->setQuery($query);
     $rows = $db->loadResultArray();
     $oCloud = new tagCloud($rows, $url, $min, $max, $seperator, $splitter);
     return $oCloud->render($alphabetically);
 }
    echo "width:650px;";
    echo "border: 1px solid black;";
    echo "text-align: center;";
    echo "}";
    echo "#tagcloud a{";
    echo "      color: #871e32;";
    echo "      text-decoration: none;";
    echo "      text-transform: capitalize;";
    echo "}";
    echo "</style>";
    echo "<body>";
    echo "</body>";
    echo "</html>";
    echo "<div id=\"tagcloud\">";
    /*** create a new tag cloud object ***/
    $tagCloud = new tagCloud($tags);
    echo $tagCloud->displayTagCloud();
    echo "</div>";
    echo "</body>";
    echo "</html>";
}
if ($outputFormat == 'json') {
    $tagCloudJSON = new stdClass();
    $tagCloudJSON->tagCloud = (object) array('maxFontSize' => $maxFontSize, 'maxObjects' => $maxObjects, 'tags' => array());
    shuffle($tags);
    for ($i = 0; $i < count($tags); $i++) {
        $tagCloudJSON->tagCloud->tags[$i]->title = $tags[$i]['tagname'];
        $tagCloudJSON->tagCloud->tags[$i]->url = $tags[$i]['url'];
        $tagCloudJSON->tagCloud->tags[$i]->weight = $tags[$i]['weight'];
    }
    #echo "json";
示例#4
0
            while ($tok !== false) {
				$tok = strtok(" .,");
				tokensAR[] = $tok;
			}
           
            );
            $ordersTokens = array_count_values($tokensAR);
        }
        $tags = array();
        foreach ($ordersTokens as $tag=>$count){
			$tags[] = array('weight'  =>$count, 'tagname' =>$tag, 'url'=>'info.php?op=course_info&id= $serviceId);
		}
*/
$tags = array(array('weight' => 40, 'tagname' => 'lingue', 'url' => 'info.php?op=course_info&id=2'), array('weight' => 12, 'tagname' => 'programmazione', 'url' => 'info.php?op=course_info&id=0'), array('weight' => 10, 'tagname' => 'sicurezza', 'url' => 'info.php?op=course_info&id=1'), array('weight' => 15, 'tagname' => 'reti', 'url' => 'info.php?op=course_info&id=2'), array('weight' => 28, 'tagname' => 'consulenza', 'url' => 'info.php?op=course_info&id=2'), array('weight' => 35, 'tagname' => 'web 2.0', 'url' => 'info.php?op=course_info&id=9'), array('weight' => 20, 'tagname' => 'android', 'url' => 'info.php?op=course_info&id=1'));
/*** create a new tag cloud object ***/
$tagCloud = new tagCloud($tags);
return $tagCloud->displayTagCloud();
class tagCloud
{
    /*** the array of tags ***/
    private $tagsArray;
    public function __construct($tags)
    {
        /*** set a few properties ***/
        $this->tagsArray = $tags;
    }
    /**
     *
     * Display tag cloud
     *
     * @access public