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 SubmitCancelButton.class.php
Documentation is available at
SubmitCancelButton.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>\n"
;
echo
"Example: define( 'CLASSPATH', '../path/to/classes/' );\n"
;
exit
(
)
;
}
if
(
defined
(
"LANG"
) )
/**
* Including language specific messages.
*/
include
CLASSPATH
.
"/forms/items/SubmitCancelButton/"
.
LANG
.
".inc.php"
;
else
{
echo
"<h3>You have to define the constant LANG!</h3>\n"
;
echo
"Example for german: define( 'LANG', 'de' );\n"
;
exit
(
)
;
}
/**
*
*/
require_once
CLASSPATH
.
"forms/items/HTMLButton.class.php"
;
/**
*
*/
require_once
CLASSPATH
.
"forms/items/HTMLSubmitButton.class.php"
;
/**
* A class to create a reset and a buton to submit forms.
*
*
@package
forms
*
@subpackage
items
*
@version
0.1.21
*
@author
Daniel Plücken <daniel@debakel.net>
*
@license
http://www.gnu.org/copyleft/lesser.html
* GNU Lesser General Public License
*
@copyright
Copyright (C) 2006 Daniel Pluecken <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
SubmitCancelButton
extends
ABSTHTMLFormItem
{
/**
*
@var
object
* access private
*/
var
$cncbt
;
/**
*
@var
object
* access private
*/
var
$sbtbt
;
/**
* Constructor
*
*
@version
1.1
*
@since
0.1.0
*
@author
Daniel Plücken <daniel@debakel.net>
*
@access
public
*
@param
string
$labelSbtBt
Label for the submit button.
*
@param
string
$labelCncBt
Label for the cancel button.
*/
function
SubmitCancelButton
(
)
{
$param
=
func_get_args
(
)
;
$labelSbtBt
=
empty
(
$param
[
0
]
)
?
STANDARD_LABEL_SUBMIT_BT
:
$param
[
0
]
;
$labelCncBt
=
empty
(
$param
[
1
]
)
?
STANDARD_LABEL_CANCEL_BT
:
$param
[
1
]
;
$this
->
sbtbt
=
&
new
HTMLSubmitButton
(
"formsent"
,
$labelSbtBt
)
;
$this
->
cncbt
=
&
new
HTMLButton
(
"cancel"
,
$labelCncBt
)
;
}
/**
* Sets the label of the reset button.
*
*
@version
1.0
*
@since
0.1.0
*
@author
Daniel Plücken <daniel@debakel.net>
*
@access
public
*
@param
string
$string
The text how the reset button should be labled.
*/
function
setLabelOfCancelButton
(
$string
)
{
if
(
get_class
(
$this
->
cncbt
)
==
"htmlresetbutton"
)
$this
->
cncbt
->
setValue
(
$string
)
;
}
/**
* Sets the label of the submit button.
*
*
@version
1.0
*
@since
0.1.0
*
@author
Daniel Plücken <daniel@debakel.net>
*
@access
public
*
@param
string
$string
The text how the submit button should be labled.
*/
function
setLabelOfSubmitButton
(
$string
)
{
if
(
get_class
(
$this
->
sbtbt
)
==
"htmlsubmitbutton"
)
$this
->
sbtbt
->
setValue
(
$string
)
;
}
/**
* Sets the "parentform"-attribute of both buttons.
*
*
@version
1.0
*
@since
0.1.0
*
@author
Daniel Plücken <daniel@debakel.net>
*
@access
public
*
@param
object
$formobj
This object's parent object.
*/
function
setParentForm
(
&
$formobj
)
{
$this
->
cncbt
->
parentform
=
&
$formobj
;
$this
->
sbtbt
->
parentform
=
&
$formobj
;
}
/**
* Sets the mouseUp-function of the cancel button.
*
*
@version
1.0
*
@since
0.1.0
*
@author
Daniel Plücken <daniel@debakel.net>
*
@access
public
*
@param
string
$js_string
Javascript of what to do on cancel.
*/
function
setCancelOrder
(
$js_string
)
{
$this
->
cncbt
->
setOnMouseUp
(
$js_string
)
;
}
/**
* Blind method cause other objects will invoke it.
*
*
@version
1.0
*
@since
0.1.0
*
@author
Daniel Plücken <daniel@debakel.net>
*
@access
public
*
@return
string
*/
function
getName
(
)
{
return
""
;
}
/**
* Returns the name of the cancel button.
*
*
@version
1.0
*
@since
0.1.0
*
@author
Daniel Plücken <daniel@debakel.net>
*
@access
public
*
@return
string
*/
function
getNameOfCancelButton
(
)
{
return
$this
->
cncbt
->
getName
(
)
;
}
/**
* Returns the label of the cancel button.
*
*
@version
1.0
*
@since
0.1.0
*
@author
Daniel Plücken <daniel@debakel.net>
*
@access
public
*
@return
string
*/
function
getLabelOfCancelButton
(
)
{
if
(
get_class
(
$this
->
cncbt
)
==
"htmlbutton"
)
return
$this
->
cncbt
->
getValue
(
)
;
else
return
false
;
}
/**
* Returns the name of the submit button.
*
*
@version
1.0
*
@since
0.1.0
*
@author
Daniel Plücken <daniel@debakel.net>
*
@access
public
*
@return
string
*/
function
getNameOfSubmitButton
(
)
{
return
$this
->
sbtbt
->
getName
(
)
;
}
/**
* Returns the label of the submit button.
*
*
@version
1.0
*
@since
0.1.0
*
@author
Daniel Plücken <daniel@debakel.net>
*
@access
public
*
@return
string
*/
function
getLabelOfSubmitButton
(
)
{
if
(
get_class
(
$this
->
sbtbt
)
==
"htmlsubmitbutton"
)
return
$this
->
sbtbt
->
getValue
(
)
;
else
return
false
;
}
/**
* Blind method cause other objects will invoke it.
*
*
@version
1.0
*
@since
0.1.0
*
@author
Daniel Plücken <daniel@debakel.net>
*
@access
public
*
@return
boolean
*/
function
getCheckOrder
(
$formName
)
{
return
false
;
}
/**
* Blind method cause other objects will invoke it.
*
*
@version
1.0
*
@since
0.1.0
*
@author
Daniel Plücken <daniel@debakel.net>
*
@access
public
*
@return
boolean
*/
function
getValidationOrder
(
$formName
)
{
return
false
;
}
/**
* Generates the sourcecode to build this object and returns it.
*
*
@version
1.0
*
@since
0.1.0
*
@author
Daniel Plücken <daniel@debakel.net>
*
@access
public
*
@return
string
*/
function
getPHPSource
(
)
{
$outputstr
=
"\x24input[] = new ResetSubmitButton(\n"
.
" \""
.
$this
->
getLabelOfCancelButton
(
)
.
"\",\n"
.
" \""
.
$this
->
getLabelOfSubmitButton
(
)
.
"\"\n"
.
" );\n"
;
return
$outputstr
;
}
/**
* Returns a generated string based on the attributes of this HTML-Object.
*
*
@version
1.1
*
@since
0.1.0
*
@author
Daniel Plücken <daniel@debakel.net>
*
@access
public
*
@param
boolean
$swap_position
*
@return
string
*/
function
get
(
$swap_position
=
false
)
{
if
(
$swap_position
)
return
$this
->
sbtbt
->
get
(
)
.
$this
->
cncbt
->
get
(
)
;
else
return
$this
->
cncbt
->
get
(
)
.
$this
->
sbtbt
->
get
(
)
;
}
}
// End of class SubmitCancelButton
?>
Documentation generated on Thu, 05 Jun 2008 19:15:12 +0200 by
phpDocumentor 1.4.1