ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilTRBLBorderStyleInputGUI.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
4
13{
14 protected $value;
15
22 function __construct($a_title = "", $a_postvar = "")
23 {
24 parent::__construct($a_title, $a_postvar);
25 $this->setType("border_style");
26 $this->dirs = array("all", "top", "bottom", "left", "right");
27 }
28
34 function setAllValue($a_allvalue)
35 {
36 $this->allvalue = $a_allvalue;
37 }
38
44 function getAllValue()
45 {
46 return $this->allvalue;
47 }
48
54 function setTopValue($a_topvalue)
55 {
56 $this->topvalue = $a_topvalue;
57 }
58
64 function getTopValue()
65 {
66 return $this->topvalue;
67 }
68
74 function setBottomValue($a_bottomvalue)
75 {
76 $this->bottomvalue = $a_bottomvalue;
77 }
78
84 function getBottomValue()
85 {
86 return $this->bottomvalue;
87 }
88
94 function setLeftValue($a_leftvalue)
95 {
96 $this->leftvalue = $a_leftvalue;
97 }
98
104 function getLeftValue()
105 {
106 return $this->leftvalue;
107 }
108
114 function setRightValue($a_rightvalue)
115 {
116 $this->rightvalue = $a_rightvalue;
117 }
118
124 function getRightValue()
125 {
126 return $this->rightvalue;
127 }
128
134 function checkInput()
135 {
136 global $lng;
137
138 foreach ($this->dirs as $dir)
139 {
140 $pre_value = $_POST[$this->getPostVar()][$dir]["pre_value"] =
141 ilUtil::stripSlashes($_POST[$this->getPostVar()][$dir]["pre_value"]);
142
143 /*
144 if ($this->getRequired() && trim($num_value) == "")
145 {
146 $this->setAlert($lng->txt("msg_input_is_required"));
147
148 return false;
149 }*/
150
151 $value = $pre_value;
152
153 if (trim($value) != "")
154 {
155 switch ($dir)
156 {
157 case "all": $this->setAllValue($value); break;
158 case "top": $this->setTopValue($value); break;
159 case "bottom": $this->setBottomValue($value); break;
160 case "left": $this->setLeftValue($value); break;
161 case "right": $this->setRightValue($value); break;
162 }
163 }
164
165 }
166
167 return true;
168 }
169
173 function insert(&$a_tpl)
174 {
175 global $lng;
176
177 $layout_tpl = new ilTemplate("tpl.prop_trbl_layout.html", true, true, "Services/Style");
178
179 foreach ($this->dirs as $dir)
180 {
181 $tpl = new ilTemplate("tpl.prop_trbl_select.html", true, true, "Services/Style");
182 $pre_options = array_merge(array("" => ""),
184
185 switch($dir)
186 {
187 case "all": $value = strtolower(trim($this->getAllValue())); break;
188 case "top": $value = strtolower(trim($this->getTopValue())); break;
189 case "bottom": $value = strtolower(trim($this->getBottomValue())); break;
190 case "left": $value = strtolower(trim($this->getLeftValue())); break;
191 case "right": $value = strtolower(trim($this->getRightValue())); break;
192 }
193
194 foreach ($pre_options as $option)
195 {
196 $tpl->setCurrentBlock("pre_option");
197 $tpl->setVariable("VAL_PRE", $option);
198 $tpl->setVariable("TXT_PRE", $option);
199 if ($value == $option)
200 {
201 $tpl->setVariable("PRE_SELECTED", 'selected="selected"');
202 }
203 $tpl->parseCurrentBlock();
204 }
205
206 $tpl->setVariable("POSTVAR", $this->getPostVar());
207 $tpl->setVariable("TXT_DIR", $lng->txt("sty_$dir"));
208 $tpl->setVariable("DIR", $dir);
209
210 $layout_tpl->setVariable(strtoupper($dir), $tpl->get());
211 }
212
213 $a_tpl->setCurrentBlock("prop_generic");
214 $a_tpl->setVariable("PROP_GENERIC", $layout_tpl->get());
215 $a_tpl->parseCurrentBlock();
216 }
217
223 function setValueByArray($a_values)
224 {
225 global $ilUser;
226
227 $this->setAllValue($a_values[$this->getPostVar()]["all"]["pre_value"]);
228 $this->setBottomValue($a_values[$this->getPostVar()]["bottom"]["pre_value"]);
229 $this->setTopValue($a_values[$this->getPostVar()]["top"]["pre_value"]);
230 $this->setLeftValue($a_values[$this->getPostVar()]["left"]["pre_value"]);
231 $this->setRightValue($a_values[$this->getPostVar()]["right"]["pre_value"]);
232 }
233
234}
global $tpl
Definition: ilias.php:8
This class represents a property in a property form.
setType($a_type)
Set Type.
getPostVar()
Get Post Variable.
static _getStyleParameterValues($par)
This class represents a border style with all/top/right/bottom/left in a property form.
setTopValue($a_topvalue)
Set Top Value.
setBottomValue($a_bottomvalue)
Set Bottom Value.
__construct($a_title="", $a_postvar="")
Constructor.
checkInput()
Check input, strip slashes etc.
insert(&$a_tpl)
Insert property html.
setLeftValue($a_leftvalue)
Set Left Value.
setAllValue($a_allvalue)
Set All Value.
setValueByArray($a_values)
Set value by array.
setRightValue($a_rightvalue)
Set Right Value.
special template class to simplify handling of ITX/PEAR
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
$_POST['username']
Definition: cron.php:12
global $lng
Definition: privfeed.php:40
global $ilUser
Definition: imgupload.php:15