Umfragen
Main Page
Related Pages
Data Structures
Files
File List
Globals
longtext.class.php
Go to the documentation of this file.
1
<?php
2
3
class
longtext
extends
widget
implements
iWidget
,
input_widget
,
output_widget
{
4
5
public
$typ
=
"longtext"
;
6
public
$long_result
=
true
;
7
public
$direct_result
=
true
;
8
9
function
__construct
(){
10
}
11
12
public
function
set_default_values
(
$db
){
13
$this->
set_dispName
(
"Bitte Fragestellung eingeben"
);
14
}
15
16
17
function
display_edit
(){
18
if
($this->is_required){
19
$req =
"<span class='required_asterisk'>*</span>"
;
20
}
else
{$req =
""
;}
21
$font_bold= $this->
get_config
(
"font-bold"
);
22
if
( $font_bold ==
true
){ $font_bold =
"font-weight:bold"
; }
else
{ $font_bold=
""
; }
23
24
$this->
display_edit_begin
();
25
echo
"<label for='{$this->name}' style='$font_bold' >{$this->dispName} $req</label> <br/>"
;
26
echo
"<span class='widget_indent'></span><textarea rows='5' cols='50' name='{$this->name}' id='{$this->name}' style='margin-top:4px'></textarea><br/>"
;
27
echo
"</div>"
.PHP_EOL;
28
}
29
30
31
function
display
(){
32
if
( (isset($this->
name
)) ){
33
if
( isset($this->dispName) ){
34
$n =
$this->dispName
;
35
}
else
{ $n =
$this->name
; }
36
$value
= htmlspecialchars($this->
value
,ENT_QUOTES,
"UTF-8"
,
true
);
37
$font_family= $this->
get_config
(
"font-family"
);
38
$font_size= $this->
get_config
(
"font-size"
);
39
$font_bold= $this->
get_config
(
"font-bold"
);
40
41
if
( $font_family !=
""
){ $font_family =
"font-family:"
.$font_family; }
42
if
( $font_size !=
""
){ $font_size =
"font-size:"
.$font_size; }
43
if
( $font_bold ==
true
){ $font_bold =
"font-weight:bold"
; }
else
{ $font_bold=
""
; }
44
45
if
($this->is_required){
46
$req =
"<span class='required_asterisk'>*</span>"
;
47
}
else
{$req =
""
;}
48
echo
"<div class='widget_container longtext_widget' style='$font_family;$font_size'>"
;
49
echo
"<label for='{$this->name}' class='widget_question' style='$font_bold'>$n $req</label> <br/>"
;
50
echo
"<span class='widget_indent'></span><textarea rows='5' cols='50' name='{$this->name}' id='{$this->name}' style='margin-top:4px'>{$value}</textarea><br/>"
;
51
echo
"</div>"
.PHP_EOL;
52
}
else
{
53
throw
new
Exception(
"Widget name or default value not set"
);
54
}
55
}
56
57
58
59
function
handle_inpt
(){
60
$req = $this->
check_required
();
61
if
($req !==
true
) {
62
return
$req;
63
}
else
{
64
if
( (!isset($this->
name
)) OR ($this->
name
==
""
) ){
65
throw
new
varException
(
"Widget Name not set!"
);
66
}
67
//$value = htmlspecialchars($_POST[ $this->name ],ENT_QUOTES,"UTF-8",true);
68
$this->
value
= $_POST[
$this->name
];
69
return
true
;
70
}
71
}
72
73
74
}
75
// ! no ending newLine
76
?>
demo
inc
longtext.class.php
Generated on Sat Nov 30 2013 14:28:43 for Umfragen by
1.8.1.2