Location: PHPKode > projects > JavaScript PHP Window Manager > jpwm0.32/php/class.window.php
<?php
	$windowId = 0;
	class window
	{
		var $id;			// int
		var $title; 		// string
		var $client;		// string
		var $width;			// int
		var $height;		// int
		var $top;			// int
		var $left;			// int
		var $autostart; 	// bool
		var $resizable; 	// bool
		var $opacity;	 	// float
		var $type; 			// enum('html','java','flash');
		

		function window($info)
		{
			global $starter;
			$this->client 	= join(file('apps/' . $info['file'] . '/index.php'));
			
			$this->setVar("type"		, $info[0], "html");
			$this->setVar("title"		, $info[1], "Untitled");
			$this->setVar("top"			, $info[2], 20);
			$this->setVar("left"		, $info[3], 20);
			$this->setVar("width"		, $info[4], 400);
			$this->setVar("height"		, $info[5], 250);
			$this->setVar("autostart"	, $info[6], 'true');
			$this->setVar("resizable"	, $info[7], 'true');
			$this->setVar("opacity"		, $info[8], 1.0);
			
			if($this->type == 'text')
				$this->client = nl2br(htmlentities($this->client));
				
			$this->id = getId();
			$this->show();
			$starter .= '<a href="javascript:void(0);" onClick="launch('.$this->id.');">'.$this->title.'</a>&nbsp;&nbsp;';
		}
		
		function show()
		{
			$ret = "";
			$ret .= '<div id="frame'.$this->id.'" class="windowFrame" style="top:'.$this->top.';left:'.$this->left.';width:'.$this->width.';height:'.$this->height.';"></div>' . "\n";
			$ret .= '<div id="titlebar'.$this->id.'" class="windowTitlebar" onDblClick="rollupWindow('.$this->id.');">';
			$ret .= '<span class="windowTitle">'.$this->title.'</span>';
			$ret .= '</div>' . "\n";
			$ret .= '<div id="client'.$this->id.'" class="windowClient'.$this->type.'">' . "\n";
			$ret .= $this->client . "\n";
			$ret .= '</div>' . "\n";
			if($this->resizable == true)
			{
				$ret .= '<div id="resize'.$this->id.'" class="resize"></div>' . "\n";
				$ret .= '<div id="maximize'.$this->id.'" class="maximize"></div>' . "\n";
			}
			$ret .= '<div id="rollup'.$this->id.'" class="rollup"></div>' . "\n";
			$ret .= '<div id="close' .$this->id.'" class="close"></div>' . "\n";
			$ret .= '<script type="text/javascript">' . "\n";
			$ret .= '<!--' . "\n";
			

			$ret .= 'ADD_DHTML("titlebar'.$this->id.'"+CURSOR_MOVE);' . "\n";
			$ret .= 'ADD_DHTML("frame'   .$this->id.'"+VERTICAL+HORIZONTAL);' . "\n";
			$ret .= 'ADD_DHTML("client'  .$this->id.'"+NO_DRAG);' . "\n";
			if($this->resizable == 'true')
			{
				$ret .= 'ADD_DHTML("resize'.$this->id.'"+MAXOFFLEFT+'.($this->width-100).'+MAXOFFTOP+'.($this->height-60).'+CURSOR_SE_RESIZE);' . "\n";
				$ret .= 'ADD_DHTML("maximize'.$this->id.'"+VERTICAL+HORIZONTAL);' . "\n";
			}
			$ret .= 'ADD_DHTML("rollup'.$this->id.'"+VERTICAL+HORIZONTAL);' . "\n";
			$ret .= 'ADD_DHTML("close' .$this->id.'"+VERTICAL+HORIZONTAL);' . "\n";
			$ret .= 'dd.elements["titlebar'.$this->id.'"].framePadding = 0;' . "\n";
			$ret .= 'dd.elements["titlebar'.$this->id.'"].titlebarH = 16;' . "\n";
			$ret .= 'dd.elements["titlebar'.$this->id.'"].toolbarH = 1;' . "\n";
			$ret .= 'dd.elements["titlebar'.$this->id.'"].statusbarH = 16;' . "\n";
			$ret .= 'dd.elements["titlebar'.$this->id.'"].clientMargin = 1;' . "\n";
			$ret .= 'dd.elements["titlebar'.$this->id.'"].lastWindowH = 0;' . "\n";
			$ret .= 'dd.elements["titlebar'.$this->id.'"].opacity = '.$this->opacity.';' . "\n";
			if($this->autostart == 'true')
			{
				$ret .= 'dd.elements["titlebar'.$this->id.'"].autostart = true;' . "\n";
			}
			else
			{
				$ret .= 'dd.elements["titlebar'.$this->id.'"].autostart = false;' . "\n";
			}
			$ret .= 'createWindow('.$this->id.');' . "\n";
			$ret .= '-->' . "\n";
			$ret .= '</script>' . "\n";
			$this->output = $ret;
			
			echo $ret;
		}
		function setVar($var, $value, $default)
		{
			if(strlen($value) > 0 || (($value == true || $value == false) && $value != NULL) )
			{
				$this->$var = $value;
			}
			else
			{
				$this->$var = $default;
			}
		}
	}
	
	function getId()
	{
		global $windowId;
		$windowId++;
		return $windowId;
	}
?>
Return current item: JavaScript PHP Window Manager