<?php 
if (!defined('VB_ENTRY')) die('Access denied.');
/*======================================================================*\
|| #################################################################### ||
|| # vBulletin 5.0.0 Beta 10
|| # ---------------------------------------------------------------- # ||
|| # Copyright �2000-2012 vBulletin Solutions Inc. All Rights Reserved. ||
|| # This file may not be redistributed in whole or significant part. # ||
|| # ---------------- VBULLETIN IS NOT FREE SOFTWARE ---------------- # ||
|| # http://www.vbulletin.com | http://www.vbulletin.com/license.html # ||
|| #################################################################### ||
\*======================================================================*/

/**
 * vB_Library_Functions
 *
 * @package vBApi
 * @access public
 */
class vB_Library_Admin extends vB_Library
{
	public static function buildElementCell($name, $text, $depth, $bold = false, $link = '', $do = '', $session = '', $subtext = '', $subtitle = '')
	{
		$cell = $name ? '<a name="'.$name.'">&nbsp;</a>' : '';
		$cell .= $bold ? '<b>' : '';
		$cell .= self::constructDepthMark($depth, '- - ');
		$cell .= $link ? '<a href="'.$link : '';
		$cell .= ($link AND $session) ? '?'.$session : '';
		$cell .= ($link AND $do AND $session) ? '&do=' . $do : '';
		$cell .= ($link AND $do AND !$session) ? '?do=' . $do : '';
		$cell .= $link ? '">' : '';
		$cell .= $text;
		$cell .= $link ? '</a>' : '';
		$cell .= $bold ? '</b>' : '';
		$cell .= $subtext ? '&nbsp;&nbsp;<span class="acpsmallfont" title = "'.$subtitle.'">('.$subtext.')</span>' : '';
		return $cell;
	}

	public static function buildCheckboxCell($name, $value = 1, $id = 'id', $checked = false, $disabled = false, $onclick = false, $vinput = true)
	{
		$current = $disabled ? 3 : 0;
		$cell = '<input type="checkbox" name="'.$name.'" id="'.$id.'"';
		$cell .= ($checked ? ' checked="checked" ' : '');
		$cell .= ($disabled ? ' disabled="disabled" ' : '');
		$cell .= ($onclick ? ' onclick="'.$onclick.';"' : '');
		$cell .= ' value="'.$value.'" />';
		$cell .= ($vinput ? ' <input id="v'.$id.'" type="hidden" name="v'.$name.'" value="'.$current.'" />' : '');
		return $cell;
	}

	public static function buildTextInputCell($name, $value = '', $size = 5, $title = '', $taborder = 1)
	{
		$cell = '<input type="text" class="bginput" name="'.$name.'" value="'.$value;
		$cell .= '" tabindex="'.$taborder.'" size="'.$size.'" title="'.$title.'" />';
		return $cell;
	}

	public static function buildDisplayCell($text, $bold = false, $smallfont = false, $istrike = false)
	{
		$cell = $smallfont ? '<span class="smallfont">' : '<span>';
		$cell .= $bold ? '<b>' : '';
		$cell .= $istrike ? '<i><s>' : '';
		$cell .= $text;
		$cell .= $istrike ? '</s></i>' : '';
		$cell .= $bold ? '</b>' : '';
		$cell .= '</span>';
		return $cell;
	}

	public static function buildActionCell($name, $options, $jsfunction = '', $button = 'Go', $onclick = false, $onchange = false)
	{
		$cell = '<select name="'.$name.'"';
		$cell .= ($onchange ? ' onchange="'.$jsfunction.';"' : '') . ' >';
		$cell .= construct_select_options($options) . '</select>';
		$cell .= "\t".'<input type="button" class="button" value="'.$button.'"';
		$cell .= ($onclick ? ' onclick="'.$jsfunction.';"' : '') . ' />';
		return $cell;
	}

	public static function constructDepthMark($name, $options, $jsfunction = '', $button = 'Go', $onclick = false, $onchange = false)
	{
		return $depthmark . str_repeat($depthchar, $depth);
	}
}

/*======================================================================*\
|| ####################################################################
|| # 
|| # SVN: $Revision$
|| ####################################################################
\*======================================================================*/
