<?php
/*
 * This file is part of the Easy-CMS project.
 * Easy-CMS 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.
 * 
 * Easy-CMS is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with Easy-CMS; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

/**
 * @package Display
 */
 
/**
 */
include_once('classes/display/LinkManager.class.php');

class EditionPopup{

	var $head;
	var $body;
	var $tail;

	var $bodyTag;
	
	function EditionPopup(){		

		if(($rootDir = dirname($_SERVER["PHP_SELF"])) == "/")
			$rootDir = "";
		
		$this->head = "";
		$this->body = "";
		$this->tail = "";
		$this->head .= "<table border=\"0\" cellpadding=\"8\" cellspacing=\"0\" width=\"100%\">\n";
		$this->head .= " <tr>\n";
		$this->head .= "   <td height=\"48\" background=\"".$rootDir."/".REPOSITORY_FOLDER."/".IMAGES_FOLDER."/top_banner_small.png\">\n";
		$this->head .= "   </td>\n";
		$this->head .= " </tr>\n";		
		$this->head .= " <tr>\n";
		$this->head .= "   <td>\n";
		$this->head .= "    <table align=\"left\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">\n";
		$this->head .= "      <tr>\n";

		$this->body .= "       	<td width=\"99%\" height=\"1\"><table border=\"0\" width=\"99%\" height=\"1\" cellspacing=\"0\" cellpadding=\"0\"><tr><td></td></tr></table></td>\n";
		$this->body .= "      </tr>\n";
		$this->body .= "      <tr>\n";
		$this->body .= "       <td colspan=\"10\" class=\"alpha\" width=\"100%\" height=\"5\"><table border=\"0\" width=\"100%\" height=\"5\" cellspacing=\"0\" cellpadding=\"0\"><tr><td></td></tr></table></td>\n";
		$this->body .= "      <tr>\n";
		$this->body .= "    </table>\n";
		$this->body .= "   </td>\n";
		$this->body .= " </tr>\n";		
		$this->body .= " <tr>\n";
		$this->body .= "	<td>\n";

		$this->tail .= "	</td>\n";
		$this->tail .= " </tr>\n";
		$this->tail .= "</table>\n";
			
	}
	
	function addTitle($title, $varsTable){
		$linkManager = new LinkManager($_SERVER['PHP_SELF'], $varsTable);

		$this->head .= "      	<td width=\"106\">\n";
		$this->head .= "      		<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"106\">\n";
		$this->head .= "      		    <tr>\n";
		$this->head .= "      				<td class=\"alpha\" rowspan=\"2\" width=\"1\" height=\"1\"><table border=\"0\" width=\"1\" height=\"1\" cellspacing=\"0\" cellpadding=\"0\"><tr><td></td></tr></table></td>\n";
		$this->head .= "      				<td class=\"alpha\" width=\"104\" height=\"1\"><table border=\"0\" width=\"104\" height=\"1\" cellspacing=\"0\" cellpadding=\"0\"><tr><td></td></tr></table></td>\n";
		$this->head .= "      				<td class=\"alpha\" rowspan=\"2\" width=\"1\" height=\"1\"><table border=\"0\" width=\"1\" height=\"1\" cellspacing=\"0\" cellpadding=\"0\"><tr><td></td></tr></table></td>\n";
		$this->head .= "      			</tr>\n";
		$this->head .= "      			<tr>\n";
		$this->head .= "      				<td class=\"beta\" width=\"104\" height=\"1\"><table border=\"0\" width=\"104\" height=\"1\" cellspacing=\"0\" cellpadding=\"0\"><tr><td></td></tr></table></td>\n";
		$this->head .= "      			</tr>\n";	
		$this->head .= "      		</table>\n";
		$this->head .= "      		<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"106\">\n";
		$this->head .= "      		<tr class=\"beta\">\n";
		$this->head .= "      			<td class=\"alpha\" rowspan=\"2\" width=\"1\"><table border=\"0\" width=\"1\" height=\"1\" cellspacing=\"0\" cellpadding=\"0\"><tr><td></td></tr></table></td>\n";
		$this->head .= "      			<td align=\"center\" nowrap width=\"104\">\n";
		$this->head .= "      				&nbsp;<a class=\"easy_cms_link\"href=\"".$linkManager->getLink()."\">".$title."</a>&nbsp;\n";
		$this->head .= "      			</td>\n";
		$this->head .= "      			<td class=\"alpha\" rowspan=\"2\" width=\"1\" height=\"1\"><table border=\"0\" width=\"1\" height=\"1\" cellspacing=\"0\" cellpadding=\"0\"><tr><td></td></tr></table></td>\n";
		$this->head .= "      		</tr>\n";
		$this->head .= "      		<tr class=\"beta\">\n";
		$this->head .= "      			<td width=\"1\" height=\"3\"><table border=\"0\" width=\"1\" height=\"3\" cellspacing=\"0\" cellpadding=\"0\"><tr><td></td></tr></table></td>\n";
		$this->head .= "      		</tr>\n";
		$this->head .= "      		</table>\n";
		$this->head .= "      	</td>\n";
		$this->head .= "      	<td width=\"2\" height=\"1\"><table border=\"0\" width=\"2\" height=\"1\" cellspacing=\"0\" cellpadding=\"0\"><tr><td></td></tr></table></td>\n";
	}

	function setBodyTag(&$bodyTag){
		$this->bodyTag = &$bodyTag;
	}
	
	function addContent(&$content){
		$this->body .= $content;
	}
	
	function &getHead(){
		return $this->head;
	}

	function &getBody(){
		return $this->body;
	}

	function &getTail(){
		return $this->tail;
	}
	
	function &getHTML(){
		return $this->bodyTag.$this->head.$this->body.$this->tail."</body>\n";
	}
	
}

?>
