<?php

/**
 * THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 *
 * @package fusionLib
 * @copyright Copyright (c) 2012 - 2013 fusionLib. All rights reserved.
 * @link http://fusionlib.com
 */

/**
 * flFormElementPane Class
 *
 * Pane element to hold arbitrary HTML.
 *
 * @package fusionLib
 */
class flFormElementPane extends flFormElement {

	/**
	 * The content for the pane.
	 *
	 * @var string
	 */
	protected $content = '';

	/**
	 *	Construct the element.
	 *
	 *	@param flForm $form The form the element will be used with or null if not using flForm
	 *	@param string $name The name of the element.
	 *	@param string $content The content for the pane.
	 */
	function __construct($form, $name, $content) {
		parent::__construct($form, $name);
		$this->content = $content;
	}

	/**
	 * Set the content for the pane.
	 *
	 * @param string $content The HTML content for the pane.
	 */
	function setContent($content) {
		$this->content = $content;
	}

	/**
	 * Draw the element.
	 */
	function render() {
		return $this->class !== null ? "<div class=\"$this->class\">$this->content</div>\n" : "$this->content\n";
	}

	/**
	 * Generate the HTML for the elements label.
	 *
	 * @return string The label HTML.
	 */
	function getLabelHTML() {
		return $this->label === null ? '' : parent::getLabelHTML();
	}
}
