html
[
class tree: html
] [
index: html
] [
all elements
]
changelog
install
readme
Todo List
Packages:
core
communication
databases
data_structures
filesystem
forms
GilliGan
html
Services_JSON
Source for file HTMLLayer.class.php
Documentation is available at
HTMLLayer.class.php
<?php
/**
* For including this file you have to define the constant "CLASSPATH".
* Because every include in the framework depends on the CLASSPATH definition.
* The CLASSPATH means the relative path to the folder that contains the
* framework GilliGan.
*
*
@package
html
*/
if
(
!
defined
(
"CLASSPATH"
) )
{
echo
"<h3>You have to define the constant CLASSPATH!</h3>\n"
;
echo
"Example: define( 'CLASSPATH', '../path/to/classes/' );\n"
;
exit
(
)
;
}
/**
* Including the basic class of all HTML-tags.
*/
require_once
(
CLASSPATH
.
"html/ABSTHTMLTag.class.php"
)
;
/**
* A pool of regular expressions.
*/
include_once
(
CLASSPATH
.
"RegExpConstants.inc.php"
)
;
/**
* A class to generate "<div>"-Layer.
*
*
@package
html
*
@version
0.2.33
*
@author
Daniel Plücken <daniel@debakel.net>
*
@license
http://www.gnu.org/copyleft/lesser.html
* GNU Lesser General Public License
*
@copyright
Copyright (c) 2004 Daniel Plücken <daniel@debakel.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License.
*
* This library 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General
* Public License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
class
HTMLLayer
extends
ABSTHTMLTag
{
/**
*
@var
integer
*
@access
public
*/
var
$position
;
/**
*
@var
integer
*
@access
public
*/
var
$top
;
/**
*
@var
integer
*
@access
public
*/
var
$left
;
/**
*
@var
integer
*
@access
public
*/
var
$width
;
/**
*
@var
integer
*
@access
public
*/
var
$height
;
/**
*
@var
string
*
@access
public
*/
var
$visible
=
"visible"
;
// hidden
/**
*
@var
string
*
@access
public
*/
var
$z_index
=
10
;
/**
*
@var
string
*
@access
public
*/
var
$body
;
/**
* var string
*
@access
public
*/
var
$bgcolor
;
/**
*
@var
boolean
*
@access
public
*/
var
$noformat
=
false
;
/**
* Constructor.
*
*
@version
1.2
*
@since
0.1.0
*
@author
Daniel Plücken <daniel@debakel.net>
*
@access
public
*
@param
$name
The value of the name- and id-attribute of this layer.
*
@return
void
*/
function
HTMLLayer
(
$name
=
""
)
{
$this
->
name
=
$name
;
$this
->
setId
(
$name
)
;
}
/**
* Sets the background color of this layer.
*
*
@version
1.0
*
@since
0.1.0
*
@author
Daniel Plücken <daniel@debakel.net>
*
@access
public
*
@param
string
$string
*
@return
void
*/
function
setBGColor
(
$string
)
{
$this
->
bgcolor
=
$string
;
}
/**
* Sets the content of this layer.
*
*
@version
1.0
*
@since
0.1.0
*
@author
Daniel Plücken <daniel@debakel.net>
*
@access
public
*
@param
string
$string
*
@return
void
*/
function
setBody
(
$string
)
{
$this
->
body
=
$string
;
}
/**
* Sets the depth of this layer.
*
*
@version
1.1
*
@since
0.1.0
*
@author
Daniel Plücken <daniel@debakel.net>
*
@access
public
*
@param
integer
$int
*
@return
void
*/
function
setZIndex
(
$int
)
{
if
(
preg_match
(
"!^-?"
.
INTEGER
.
"$!"
,
$int
) )
$this
->
z_index
=
$int
;
else
if
(
!
empty
(
$int
) )
die
(
"The value \""
.
$int
.
"\" is not valid for the z-index of a Layer."
.
"<br>The value has to be a number!"
)
;
}
/**
* Sets the visibility of this layer to visible.
*
*
@version
1.0
*
@since
0.1.0
*
@author
Daniel Plücken <daniel@debakel.net>
*
@access
public
*
@return
void
*/
function
setVisible
(
)
{
$this
->
visible
=
"visible"
;
}
/**
* Sets the visibility of this layer to visible.
*
*
@version
1.0
*
@since
0.2.1
*
@author
Daniel Plücken <daniel@debakel.net>
*
@access
public
*
@return
void
*/
function
setInvisible
(
)
{
$this
->
visible
=
"hidden"
;
}
/**
* Sets the behaviour of the position of this layer.
*
*
@version
1.1
*
@since
0.1.0
*
@author
Daniel Plücken <daniel@debakel.net>
*
@access
public
*
@param
string
$string
*
@return
void
*/
function
setPosition
(
$string
)
{
if
(
$string
==
"absolute"
||
$string
==
"fixed"
||
$string
==
"relative"
||
$string
==
"static"
)
$this
->
position
=
$string
;
else
die
(
"<pre>\r\n"
.
"You can only set the following values to the position:\r\n\r\n"
.
" absolute\r\n"
.
" fixed\r\n"
.
" relative\r\n"
.
" static\r\n"
.
"</pre>\r\n"
)
;
}
/**
* Sets the left-position of this layer.
*
*
@version
1.0
*
@since
0.1.8
*
@author
Daniel Plücken <daniel@debakel.net>
*
@access
public
*
@param
integer
$int
*
@return
void
*/
function
setLeft
(
$int
=
0
)
{
if
(
preg_match
(
"!^"
.
INTEGER
.
"%?$!"
,
$int
) )
$this
->
left
=
$int
;
else
if
(
!
empty
(
$int
) )
die
(
"The value \""
.
$int
.
"\" is not valid for the top-position of a "
.
"Layer.<br>"
.
"The value has to be a number!"
)
;
}
/**
* Sets the top-position of this layer.
*
*
@version
1.0
*
@since
0.1.8
*
@author
Daniel Plücken <daniel@debakel.net>
*
@access
public
*
@param
integer
$int
*
@return
void
*/
function
setTop
(
$int
=
0
)
{
if
(
preg_match
(
"!^"
.
INTEGER
.
"%?$!"
,
$int
) )
$this
->
top
=
$int
;
else
die
(
"The value \""
.
$int
.
"\" is not valid for the top-position of a "
.
"Layer.<br>"
.
"The value has to be a number!"
)
;
}
/**
* Sets the width of this layer.
*
*
@version
1.0
*
@since
0.1.8
*
@author
Daniel Plücken <daniel@debakel.net>
*
@access
public
*
@param
integer
$int
*
@return
void
*/
function
setWidth
(
$int
=
0
)
{
if
(
preg_match
(
"!^"
.
INTEGER
.
"%?$!"
,
$int
) )
$this
->
width
=
$int
;
else
if
(
!
empty
(
$int
) )
die
(
"The value \""
.
$int
.
"\" is not valid for the width of a Layer.<br>"
.
"The value has to be a number!"
)
;
}
/**
* Sets the height of this layer.
*
*
@version
1.0
*
@since
0.1.8
*
@author
Daniel Plücken <daniel@debakel.net>
*
@access
public
*
@param
integer
$int
*
@return
void
*/
function
setHeight
(
$int
=
0
)
{
if
(
preg_match
(
"!^"
.
INTEGER
.
"%?$!"
,
$int
) )
$this
->
height
=
$int
;
else
die
(
"The value \""
.
$int
.
"\" is not valid for the height of a Layer.<br>"
.
"The value has to be a number!"
)
;
}
/**
* Returns a generated string based on the attributes of this HTML-Object.
*
*
@version
1.94
*
@since
0.1.0
*
@author
Daniel Plücken <daniel@debakel.net>
*
@access
public
*
@return
string
*/
function
get
(
)
{
$this
->
idExists
(
$this
->
id
,
true
)
;
$newline
=
$this
->
no_format
?
""
:
"\r\n"
;
$outputstr
=
"<!--\r\n"
.
"--><div id=\""
.
$this
->
id
.
"\"\r\n"
.
" style=\"z-index:"
.
$this
->
z_index
.
";"
.
"visibility:"
.
$this
->
visible
.
";"
.
(
!
empty
(
$this
->
bgcolor
)
?
"background-color:"
.
$this
->
bgcolor
.
";"
:
""
)
.
(
!
empty
(
$this
->
position
)
?
"position:"
.
$this
->
position
.
";"
:
""
)
.
(
preg_match
(
"!\d+!"
,
$this
->
top
)
?
"top:"
.
$this
->
top
.
(
strpos
(
$this
->
top
,
"%"
)
?
";"
:
"px;"
)
:
""
)
.
(
preg_match
(
"!\d+!"
,
$this
->
left
)
?
"left:"
.
$this
->
left
.
(
strpos
(
$this
->
left
,
"%"
)
?
";"
:
"px;"
)
:
""
)
.
(
preg_match
(
"!\d+!"
,
$this
->
width
)
?
"width:"
.
$this
->
width
.
(
strpos
(
$this
->
width
,
"%"
)
?
";"
:
"px;"
)
:
""
)
.
(
preg_match
(
"!\d+!"
,
$this
->
height
)
?
"height:"
.
$this
->
height
.
(
strpos
(
$this
->
height
,
"%"
)
?
";"
:
"px;"
)
:
""
)
.
(
!
empty
(
$this
->
freestyle
)
?
$this
->
freestyle
:
""
)
.
"\"\r\n"
.
(
!
empty
(
$this
->
name
)
?
" name=\""
.
$this
->
name
.
"\"\r\n"
:
""
)
.
(
!
empty
(
$this
->
style_class
)
?
" class=\""
.
$this
->
style_class
.
"\"\r\n"
:
""
)
.
(
!
empty
(
$this
->
click
)
?
" onClick=\""
.
$this
->
click
.
"\"\r\n"
:
""
)
.
(
!
empty
(
$this
->
mouseup
)
?
" onMouseup=\""
.
$this
->
mouseup
.
"\"\r\n"
:
""
)
.
(
!
empty
(
$this
->
mouseout
)
?
" onMouseout=\""
.
$this
->
mouseout
.
"\"\r\n"
:
""
)
.
(
!
empty
(
$this
->
mouseover
)
?
" onMouseover=\""
.
$this
->
mouseover
.
"\"\r\n"
:
""
)
.
(
!
empty
(
$this
->
mousemove
)
?
" onMousemove=\""
.
$this
->
mousemove
.
"\"\r\n"
:
""
)
.
(
!
empty
(
$this
->
other_attributes
)
?
" "
.
$this
->
other_attributes
.
"\r\n"
:
""
)
.
" >"
;
$outputstr
.=
$this
->
body
;
$outputstr
.=
"<!--\r\n"
.
"--></div>"
;
return
$outputstr
;
}
}
// END of class HTMLLayer
?>
Documentation generated on Thu, 05 Jun 2008 19:12:35 +0200 by
phpDocumentor 1.4.1