(root)/shared-tags.php - Rev 434
Rev 425 |
Blame |
Compare with Previous |
Last modification |
View Log
| RSS feed
<?php
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* This file is part of Travelsized CMS
* A content management system with modules, based on wiki syntax
*
* Author: Dan Jensen <admin@leinir.dk>
* Copyright 2003/2004
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License is available at: http://www.gnu.org/copyleft/
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
include( "shared-tags-TagsHandler.class.php" );
include( "shared-tags-TagGlobalID.class.php" );
include( "shared-tags-TagUser.class.php" );
include( "shared-tags-TagKeyword.class.php" );
$tagsHandler = new TagsHandler();
/**
* Use to render a tag cloud into HTML format
*
* The class is able to render either users or passwords pertaining to a
* GlobalID as either a cloud or a list, and the UI for managing adding
* tags for the current user (only shown if the user is logged in)
*/
class TagRenderer
{
/// @var string The type of renderer to use by default. Possible values: Cloud (default), List
var $type;
/// @var string What to show. Possible values: Users, Keywords (default)
var $showWhat;
/// @var string What to sort by. Possible values: Alphabetical, Size (default)
var $sortOrder;
var $data;
/**
* Constructs a new instance of the TagRenderer class
*
* @param string type The type of renderer to use by default. Possible values: Cloud (default), List
* @param string showWhat What you wish to show. Possible values: Users, Keywords (default)
* @param string sortOrder What to sort by. Possible values: Alphabetical, Size (default)
*/
function TagRenderer( $type = "Cloud", $showWhat = "Keywords", $sortOrder = "Size" )
{
$this->type = $type;
$this->showWhat = $showWhat;
$this->sortOrder = $sortOrder;
}
/**
* Render the tags for a specified GlobalID as a cloud. The HTML output will be in the following format:
*
* \code
* <div class="tags-cloud">
* <span class="tags-cloud-tag"><a class="tags-cloud-tag-link" href="$tagurl">$tag</a></span>
* <span class="tags-cloud-tag"><a class="tags-cloud-tag-link" href="$tagurl">$tag</a></span>
* </div>
* \endcode
*
* @param string globalID The GlobalID you wish to render the cloud for
*
* @return string A HTML representation of the tags as a cloud
*/
function renderCloud( $globalID )
{
global $tagsHandler;
$renderedData = "";
return $renderedData;
}
/**
* Render the tags for a specified GlobalID as a list. The HTML output will be in the following format:
*
* \code
* <ul class="tags-list">
* <li class="tags-list-tag"><a class="tags-list-tag-link" href="$tagurl">$tag</a></li>
* <li class="tags-list-tag"><a class="tags-list-tag-link" href="$tagurl">$tag</a></li>
* </ul>
* \endcode
*
* @param string globalID The GlobalID you wish to render the cloud for
*
* @return string A HTML representation of the tags as a cloud
*/
function renderList( $globalID )
{
global $tagsHandler;
$renderedData = "";
return $renderedData;
}
/**
* Renders the HTML UI for adding new tags, and manages the addition of the tag
* The rendered UI will be in the following format:
*
* \code
* <div class="tags-add">
* <form method="post" name="addTag[$globalID]">
* <input type="text" class="tags-add-input" name="newTag" />
* <input type="submit" class="tags-add-add" value="+" />
* </form>
* </div>
* \endcode
*
* @param string globalID The GlobalID you wish to handle
*
* @return string The rendered HTML UI for adding new tags
*/
function renderAdd( $globalID )
{
global $tagsHandler;
$renderedData = "";
return $renderedData;
}
/**
* Render the tag handling UI for a specific globalID
*
* @param string globalID The globalID to render the tag handling UI for
* @return string The tag cloud rendered in HTML format
*/
function render( $globalID )
{
global $tagsHandler;
$renderedData = "";
$renderType = "render" . $this->type;
$renderedData .= $this->$renderType( $globalID );
$renderedData .= $this->renderAdd( $globalID );
return $renderedData;
}
}
?>