ILIAS  release_7 Revision v7.30-3-g800a261c036
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{
17 protected $user;
18
19 protected $value;
20
27 public function __construct($a_title = "", $a_postvar = "")
28 {
29 global $DIC;
30
31 $this->lng = $DIC->language();
32 $this->user = $DIC->user();
33 parent::__construct($a_title, $a_postvar);
34 $this->setType("border_style");
35 $this->dirs = array("all", "top", "bottom", "left", "right");
36 }
37
43 public function setAllValue($a_allvalue)
44 {
45 $this->allvalue = $a_allvalue;
46 }
47
53 public function getAllValue()
54 {
55 return $this->allvalue;
56 }
57
63 public function setTopValue($a_topvalue)
64 {
65 $this->topvalue = $a_topvalue;
66 }
67
73 public function getTopValue()
74 {
75 return $this->topvalue;
76 }
77
83 public function setBottomValue($a_bottomvalue)
84 {
85 $this->bottomvalue = $a_bottomvalue;
86 }
87
93 public function getBottomValue()
94 {
95 return $this->bottomvalue;
96 }
97
103 public function setLeftValue($a_leftvalue)
104 {
105 $this->leftvalue = $a_leftvalue;
106 }
107
113 public function getLeftValue()
114 {
115 return $this->leftvalue;
116 }
117
123 public function setRightValue($a_rightvalue)
124 {
125 $this->rightvalue = $a_rightvalue;
126 }
127
133 public function getRightValue()
134 {
135 return $this->rightvalue;
136 }
137
143 public function checkInput()
144 {
146
147 foreach ($this->dirs as $dir) {
148 $pre_value = $_POST[$this->getPostVar()][$dir]["pre_value"] =
149 ilUtil::stripSlashes($_POST[$this->getPostVar()][$dir]["pre_value"]);
150
151 /*
152 if ($this->getRequired() && trim($num_value) == "")
153 {
154 $this->setAlert($lng->txt("msg_input_is_required"));
155
156 return false;
157 }*/
158
159 $value = $pre_value;
160
161 if (trim($value) != "") {
162 switch ($dir) {
163 case "all": $this->setAllValue($value); break;
164 case "top": $this->setTopValue($value); break;
165 case "bottom": $this->setBottomValue($value); break;
166 case "left": $this->setLeftValue($value); break;
167 case "right": $this->setRightValue($value); break;
168 }
169 }
170 }
171
172 return true;
173 }
174
178 public function insert(&$a_tpl)
179 {
181
182 $layout_tpl = new ilTemplate("tpl.prop_trbl_layout.html", true, true, "Services/Style/Content");
183
184 foreach ($this->dirs as $dir) {
185 $tpl = new ilTemplate("tpl.prop_trbl_select.html", true, true, "Services/Style/Content");
186 $pre_options = array_merge(
187 array("" => ""),
189 );
190
191 switch ($dir) {
192 case "all": $value = strtolower(trim($this->getAllValue())); break;
193 case "top": $value = strtolower(trim($this->getTopValue())); break;
194 case "bottom": $value = strtolower(trim($this->getBottomValue())); break;
195 case "left": $value = strtolower(trim($this->getLeftValue())); break;
196 case "right": $value = strtolower(trim($this->getRightValue())); break;
197 }
198
199 foreach ($pre_options as $option) {
200 $tpl->setCurrentBlock("pre_option");
201 $tpl->setVariable("VAL_PRE", $option);
202 $tpl->setVariable("TXT_PRE", $option);
203 if ($value == $option) {
204 $tpl->setVariable("PRE_SELECTED", 'selected="selected"');
205 }
206 $tpl->parseCurrentBlock();
207 }
208
209 $tpl->setVariable("POSTVAR", $this->getPostVar());
210 $tpl->setVariable("TXT_DIR", $lng->txt("sty_$dir"));
211 $tpl->setVariable("DIR", $dir);
212
213 $layout_tpl->setVariable(strtoupper($dir), $tpl->get());
214 }
215
216 $a_tpl->setCurrentBlock("prop_generic");
217 $a_tpl->setVariable("PROP_GENERIC", $layout_tpl->get());
218 $a_tpl->parseCurrentBlock();
219 }
220
226 public function setValueByArray($a_values)
227 {
229
230 $this->setAllValue($a_values[$this->getPostVar()]["all"]["pre_value"]);
231 $this->setBottomValue($a_values[$this->getPostVar()]["bottom"]["pre_value"]);
232 $this->setTopValue($a_values[$this->getPostVar()]["top"]["pre_value"]);
233 $this->setLeftValue($a_values[$this->getPostVar()]["left"]["pre_value"]);
234 $this->setRightValue($a_values[$this->getPostVar()]["right"]["pre_value"]);
235 }
236}
user()
Definition: user.php:4
$_POST["username"]
An exception for terminatinating execution or to throw for unit testing.
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
global $DIC
Definition: goto.php:24
$ilUser
Definition: imgupload.php:18
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc