forms
[
class tree: forms
] [
index: forms
] [
all elements
]
changelog
install
readme
Todo List
Packages:
core
communication
databases
data_structures
filesystem
forms
GilliGan
html
Services_JSON
Source for file ColorInput.class.php
Documentation is available at
ColorInput.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
forms
*
@subpackage
items
*/
if
(
!
defined
(
"CLASSPATH"
) )
{
echo
"<h3>You have to define the constant CLASSPATH!</h3>\r\n"
;
echo
"Example: define( 'CLASSPATH', '../path/to/classes/' );\r\n"
;
exit
(
)
;
}
/**
*
*/
require_once
(
CLASSPATH
.
"forms/items/ABSTHTMLFormItem.class.php"
)
;
/**
*
*/
require_once
(
CLASSPATH
.
"forms/items/HTMLTextInput.class.php"
)
;
/**
*
*/
require_once
(
CLASSPATH
.
"forms/items/HTMLButton.class.php"
)
;
/**
*
@package
forms
*
@subpackage
items
*
@version
0.1.5
*
@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
ColorInput
extends
ABSTHTMLFormItem
{
/**
*
@access
private
*
@var
HTMLTextInput
*/
var
$textinput
;
/**
*
@access
private
*
@var
HTMLButton
*/
var
$button
;
/**
* Constructor
*
*
@version
1.1
*
@since
0.1.0
*
@author
Daniel Plücken <daniel@debakel.net>
*
@access
public
*
@param
string
$name
The name of the textfield.
*
@param
string
$value
The value of the Textfield.
*
@param
interger
$size
The Size of the Textfield.
*
@param
string
$buttonlabel
*/
function
ColorInput
(
$name
=
""
,
$value
=
""
,
$size
=
null
,
$buttonlabel
=
""
)
{
$this
->
textinput
=
new
HTMLTextInput
(
$name
,
$value
,
$size
,
7
)
;
$this
->
button
=
new
HTMLButton
(
"backbone"
,
(
empty
(
$buttonlabel
)
?
"zur Farbauswahl"
:
$buttonlabel
)
)
;
}
/**
* Returns the value of textfield tag's "name"-attribute.
*
*
@version
1.0
*
@since
0.1.0
*
@author
Daniel Plücken <daniel@debakel.net>
*
@access
public
*
@return
string
*/
function
getName
(
)
{
return
$this
->
textinput
->
getName
(
)
;
}
/**
* Returns the value of textfield tag's "value"-attribute.
*
*
@version
1.0
*
@since
0.1.0
*
@author
Daniel Plücken <daniel@debakel.net>
*
@access
public
*
@return
string
*/
function
getValue
(
)
{
return
$this
->
textinput
->
getValue
(
)
;
}
/**
* Returns the size of textfield in text columns.
*
*
@version
1.0
*
@since
0.1.0
*
@author
Daniel Plücken <daniel@debakel.net>
*
@access
public
*
@return
integer
*/
function
getSize
(
)
{
return
$this
->
textinput
->
getSize
(
)
;
}
/**
* Returns the value of button tag's "value"-attribute.
*
*
@version
1.0
*
@since
0.1.0
*
@author
Daniel Plücken <daniel@debakel.net>
*
@access
public
*
@return
string
*/
function
getButtonLabel
(
)
{
return
$this
->
button
->
getValue
(
)
;
}
/**
* Returns the value of textfield tag's "name"-attribute.
*
*
@version
1.0
*
@since
0.1.0
*
@author
Daniel Plücken <daniel@debakel.net>
*
@access
public
*
@param
string
$string
*/
function
setName
(
$string
)
{
return
$this
->
textinput
->
setName
(
$string
)
;
}
/**
* Sets the value of textfield tag's "value"-attribute.
*
*
@version
1.0
*
@since
0.1.0
*
@author
Daniel Plücken <daniel@debakel.net>
*
@access
public
*
@param
string
$string
*/
function
setValue
(
$string
)
{
$this
->
textinput
->
setValue
(
$string
)
;
}
/**
* Returns an if-order of a javascript to check whether this item is NOT
* filled
*
*
@version
1.1
*
@since
0.1.7
*
@author
Daniel Plücken <daniel@debakel.net>
*
@access
public
*
@return
string
*/
function
getCheckOrder
(
$formName
)
{
$out
=
$this
->
textinput
->
getCheckOrder
(
)
;
return
$out
;
}
/**
* Stores a reference to the form-object that contains this item-object.
*
*
@version
1.1
*
@since
0.1.5
*
@author
Daniel Plücken <daniel@debakel.net>
*
@access
public
*
@param
object
*
@return
void
*/
function
setParentForm
(
&
$formobj
)
{
parent
::
setParentForm
(
$formobj
)
;
$this
->
textinput
->
setParentForm
(
$formobj
)
;
}
/**
* Generates the sourcecode to build this object and returns it.
*
*
@version
1.1
*
@since
0.1.0
*
@author
Daniel Plücken <daniel@debakel.net>
*
@param
string
$type*
*
@access
public
*
@return
string
*/
function
getPHPSource
(
)
{
$out
=
"unset( \x24value );\r\n"
;
$out
.=
"\x24value = \x24_POST[\""
.
$this
->
getName
(
)
.
"\"]\r\n"
.
" .\x24_GET[\""
.
$this
->
getName
(
)
.
"\"];\r\n"
;
$out
.=
"\x24input[] = new ColorInput(\r\n"
.
" \""
.
$this
->
getName
(
)
.
"\",\r\n"
.
" \x24value,\r\n"
.
" \""
.
$this
->
getSize
(
)
.
"\",\r\n"
.
" \""
.
$this
->
getButtonLabel
(
)
.
"\"\r\n"
.
" );\r\n"
;
$tmp
=
$this
->
getValue
(
)
;
$out
.=
!
empty
(
$tmp
)
?
"if( \x24value === \"\" )\r\n"
.
" \x24input[count(\x24input)-1]->setValue( \""
.
$tmp
.
"\" );"
.
"\r\n\r\n"
:
"\r\n"
;
return
$out
;
}
/**
* Returns a generated string based on the attributes of this object.
*
*
@version
1.2
*
@since
0.1.0
*
@author
Daniel Plücken <daniel@debakel.net>
*
@access
public
*
@return
string
*/
function
get
(
)
{
if
(
!
empty
(
$this
->
parentform
) )
$this
->
button
->
setonMouseup
(
"open( './"
.
CLASSPATH
.
"dialogs/"
.
"colorchooser.php"
.
"?callerForm="
.
$this
->
parentform
->
getName
(
)
.
"&callerItem="
.
$this
->
getName
(
)
.
"', "
.
"'colorchooser', "
.
"'width=600,height=300' );"
)
;
$out
=
$this
->
textinput
->
get
(
)
.
"\r\n"
;
$out
.=
$this
->
button
->
get
(
)
;
return
$out
;
}
}
// END of class ColorInput
?>
Documentation generated on Thu, 05 Jun 2008 19:10:24 +0200 by
phpDocumentor 1.4.1