ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilTRBLColorPickerInputGUI Class Reference

Color picker form for selecting color hexcodes using yui library (all/top/right/bottom/left) More...

+ Inheritance diagram for ilTRBLColorPickerInputGUI:
+ Collaboration diagram for ilTRBLColorPickerInputGUI:

Public Member Functions

 __construct ($a_title="", $a_postvar="")
 Constructor. More...
 
 setAllValue ($a_allvalue)
 Set All Value. More...
 
 getAllValue ()
 Get All Value. More...
 
 setTopValue ($a_topvalue)
 Set Top Value. More...
 
 getTopValue ()
 Get Top Value. More...
 
 setBottomValue ($a_bottomvalue)
 Set Bottom Value. More...
 
 getBottomValue ()
 Get Bottom Value. More...
 
 setLeftValue ($a_leftvalue)
 Set Left Value. More...
 
 getLeftValue ()
 Get Left Value. More...
 
 setRightValue ($a_rightvalue)
 Set Right Value. More...
 
 getRightValue ()
 Get Right Value. More...
 
 setDefaultColor ($a_defaultcolor)
 Set Default Color. More...
 
 getDefaultColor ()
 Get Default Color. More...
 
 setAcceptNamedColors ($a_acceptnamedcolors)
 Set Accept Named Colors (Leading '!'). More...
 
 getAcceptNamedColors ()
 Get Accept Named Colors (Leading '!'). More...
 
 checkInput ()
 check input More...
 
 insert ($a_tpl)
 Insert property html. More...
 
- Public Member Functions inherited from ilTextInputGUI
 __construct ($a_title="", $a_postvar="")
 Constructor. More...
 
 setValue ($a_value)
 Set Value. More...
 
 getValue ()
 Get Value. More...
 
 setValidationFailureMessage ($a_msg)
 Set message string for validation failure. More...
 
 getValidationFailureMessage ()
 
 setValidationRegexp ($a_value)
 Set validation regexp. More...
 
 getValidationRegexp ()
 Get validation regexp. More...
 
 setMaxLength ($a_maxlength)
 Set Max Length. More...
 
 getMaxLength ()
 Get Max Length. More...
 
 setSize ($a_size)
 Set Size. More...
 
 setInlineStyle ($a_style)
 Set inline style. More...
 
 getInlineStyle ()
 Get inline style. More...
 
 setCssClass ($a_class)
 
 getCssClass ()
 
 setValueByArray ($a_values)
 Set value by array. More...
 
 getSize ()
 Get Size. More...
 
 setSuffix ($a_value)
 Set suffix. More...
 
 getSuffix ()
 Get suffix. More...
 
 setInputType ($a_type)
 set input type More...
 
 getInputType ()
 get input type More...
 
 setSubmitFormOnEnter ($a_val)
 Set submit form on enter. More...
 
 getSubmitFormOnEnter ()
 Get submit form on enter. More...
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 getDataSource ()
 get datasource link for js autocomplete More...
 
 setDataSource ($href, $a_delimiter=null)
 set datasource link for js autocomplete More...
 
 setDataSourceSubmitOnSelection ($a_stat)
 
 getDataSourceSubmitOnSelection ()
 
 setDataSourceSubmitUrl ($a_url)
 
 getDataSourceSubmitUrl ()
 
 setMultiValues (array $a_values)
 Set multi values. More...
 
 insert (&$a_tpl)
 Insert property html. More...
 
 getTableFilterHTML ()
 Get HTML for table filter. More...
 
 getToolbarHTML ()
 Get HTML for toolbar. More...
 
 setDisableHtmlAutoComplete ($autocomplete)
 
 isHtmlAutoCompleteDisabled ()
 
- Public Member Functions inherited from ilSubEnabledFormPropertyGUI
 addSubItem ($a_item)
 Add Subitem. More...
 
 getSubItems ()
 Get Subitems. More...
 
 getSubInputItemsRecursive ()
 returns a flat array of possibly existing subitems recursively More...
 
 checkSubItemsInput ()
 Check SubItems. More...
 
 getSubForm ()
 Get sub form html. More...
 
 getItemByPostVar ($a_post_var)
 Get item by post var. More...
 
- Public Member Functions inherited from ilFormPropertyGUI
 __construct ($a_title="", $a_postvar="")
 Constructor. More...
 
executeCommand ()
 Execute command. More...
 
 getType ()
 Get Type. More...
 
 setTitle ($a_title)
 Set Title. More...
 
 getTitle ()
 Get Title. More...
 
 setPostVar ($a_postvar)
 Set Post Variable. More...
 
 getPostVar ()
 Get Post Variable. More...
 
 getFieldId ()
 Get Post Variable. More...
 
 setInfo ($a_info)
 Set Information Text. More...
 
 getInfo ()
 Get Information Text. More...
 
 setAlert ($a_alert)
 Set Alert Text. More...
 
 getAlert ()
 Get Alert Text. More...
 
 setRequired ($a_required)
 Set Required. More...
 
 getRequired ()
 Get Required. More...
 
 setDisabled ($a_disabled)
 Set Disabled. More...
 
 getDisabled ()
 Get Disabled. More...
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 setParentForm ($a_parentform)
 Set Parent Form. More...
 
 getParentForm ()
 Get Parent Form. More...
 
 setParent ($a_val)
 Set Parent GUI object. More...
 
 getParent ()
 Get Parent GUI object. More...
 
 getSubForm ()
 Get sub form html. More...
 
 hideSubForm ()
 Sub form hidden on init? More...
 
 setHiddenTitle ($a_val)
 Set hidden title (for screenreaders) More...
 
 getHiddenTitle ()
 Get hidden title. More...
 
 getItemByPostVar ($a_post_var)
 Get item by post var. More...
 
 serializeData ()
 serialize data More...
 
 unserializeData ($a_data)
 unserialize data More...
 
 writeToSession ()
 Write to session. More...
 
 clearFromSession ()
 Clear session value. More...
 
 readFromSession ()
 Read from session. More...
 
 getHiddenTag ($a_post_var, $a_value)
 Get hidden tag (used for disabled properties) More...
 
 setMulti ($a_multi, $a_sortable=false, $a_addremove=true)
 Set Multi. More...
 
 getMulti ()
 Get Multi. More...
 
 setMultiValues (array $a_values)
 Set multi values. More...
 
 getMultiValues ()
 Get multi values. More...
 
 getContentOutsideFormTag ()
 Get content that has to reside outside of the parent form tag, e.g. More...
 
 removeProhibitedCharacters ($a_text)
 Remove prohibited characters see #19159. More...
 
 stripSlashesAddSpaceFallback ($a_str)
 Strip slashes with add space fallback, see https://www.ilias.de/mantis/view.php?id=19727. More...
 
 getTableFilterHTML ()
 Get input item HTML to be inserted into table filters. More...
 
 getToolbarHTML ()
 Get input item HTML to be inserted into ilToolbarGUI. More...
 

Protected Attributes

 $hex
 
- Protected Attributes inherited from ilTextInputGUI
 $value
 
 $maxlength = 200
 
 $size = 40
 
 $validationRegexp
 
 $validationFailureMessage = ''
 
 $suffix
 
 $style_css
 
 $css_class
 
 $ajax_datasource
 
 $ajax_datasource_delimiter
 
 $ajax_datasource_commit = FALSE
 
 $ajax_datasource_commit_url
 
 $submit_form_on_enter = false
 
 $autocomplete_disabled = false
 
- Protected Attributes inherited from ilSubEnabledFormPropertyGUI
 $sub_items = array()
 
- Protected Attributes inherited from ilFormPropertyGUI
 $type
 
 $title
 
 $postvar
 
 $info
 
 $alert
 
 $required = false
 
 $parentgui
 
 $parentform
 
 $hidden_title = ""
 
 $multi = false
 
 $multi_sortable = false
 
 $multi_addremove = true
 
 $multi_values
 

Additional Inherited Members

- Protected Member Functions inherited from ilFormPropertyGUI
 setType ($a_type)
 Set Type. More...
 
 getMultiIconsHTML ()
 Get HTML for multiple value icons. More...
 

Detailed Description

Color picker form for selecting color hexcodes using yui library (all/top/right/bottom/left)

Author
Alex Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..com
Version
$Id$

Definition at line 33 of file class.ilTRBLColorPickerInputGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilTRBLColorPickerInputGUI::__construct (   $a_title = "",
  $a_postvar = "" 
)

Constructor.

Parameters
string$a_titleTitle
string$a_postvarPost Variable

Reimplemented from ilTextInputGUI.

Definition at line 44 of file class.ilTRBLColorPickerInputGUI.php.

45 {
46 parent::__construct($a_title, $a_postvar);
47 $this->setType("trbl_color");
48 $this->dirs = array("all", "top", "bottom", "left", "right");
49 }
setType($a_type)
Set Type.

References ilFormPropertyGUI\setType().

+ Here is the call graph for this function:

Member Function Documentation

◆ checkInput()

ilTRBLColorPickerInputGUI::checkInput ( )

check input

@access public

Returns

Reimplemented from ilTextInputGUI.

Definition at line 237 of file class.ilTRBLColorPickerInputGUI.php.

238 {
239 foreach ($this->dirs as $dir)
240 {
241 $value = $_POST[$this->getPostVar()][$dir]["value"] =
242 ilUtil::stripSlashes($_POST[$this->getPostVar()][$dir]["value"]);
243
244 if (trim($value) != "")
245 {
246 switch ($dir)
247 {
248 case "all": $this->setAllValue($value); break;
249 case "top": $this->setTopValue($value); break;
250 case "bottom": $this->setBottomValue($value); break;
251 case "left": $this->setLeftValue($value); break;
252 case "right": $this->setRightValue($value); break;
253 }
254 }
255 }
256 return true;
257 }
getPostVar()
Get Post Variable.
setLeftValue($a_leftvalue)
Set Left Value.
setBottomValue($a_bottomvalue)
Set Bottom Value.
setRightValue($a_rightvalue)
Set Right Value.
setTopValue($a_topvalue)
Set Top Value.
setAllValue($a_allvalue)
Set All Value.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
$_POST['username']
Definition: cron.php:12

References $_POST, ilTextInputGUI\$value, ilFormPropertyGUI\getPostVar(), setAllValue(), setBottomValue(), setLeftValue(), setRightValue(), setTopValue(), and ilUtil\stripSlashes().

+ Here is the call graph for this function:

◆ getAcceptNamedColors()

ilTRBLColorPickerInputGUI::getAcceptNamedColors ( )

Get Accept Named Colors (Leading '!').

Returns
boolean Accept Named Colors (Leading '!')

Definition at line 226 of file class.ilTRBLColorPickerInputGUI.php.

227 {
228 return $this->acceptnamedcolors;
229 }

Referenced by insert(), setAllValue(), setBottomValue(), setLeftValue(), setRightValue(), and setTopValue().

+ Here is the caller graph for this function:

◆ getAllValue()

ilTRBLColorPickerInputGUI::getAllValue ( )

Get All Value.

Returns
string All Value

Definition at line 74 of file class.ilTRBLColorPickerInputGUI.php.

75 {
76 return $this->allvalue;
77 }

◆ getBottomValue()

ilTRBLColorPickerInputGUI::getBottomValue ( )

Get Bottom Value.

Returns
string Bottom Value

Definition at line 130 of file class.ilTRBLColorPickerInputGUI.php.

131 {
132 return $this->bottomvalue;
133 }

◆ getDefaultColor()

ilTRBLColorPickerInputGUI::getDefaultColor ( )

Get Default Color.

Returns
mixed Default Color

Definition at line 206 of file class.ilTRBLColorPickerInputGUI.php.

207 {
208 return $this->defaultcolor;
209 }

◆ getLeftValue()

ilTRBLColorPickerInputGUI::getLeftValue ( )

Get Left Value.

Returns
string Left Value

Definition at line 158 of file class.ilTRBLColorPickerInputGUI.php.

159 {
160 return $this->leftvalue;
161 }

◆ getRightValue()

ilTRBLColorPickerInputGUI::getRightValue ( )

Get Right Value.

Returns
string Right Value

Definition at line 186 of file class.ilTRBLColorPickerInputGUI.php.

187 {
188 return $this->rightvalue;
189 }

◆ getTopValue()

ilTRBLColorPickerInputGUI::getTopValue ( )

Get Top Value.

Returns
string Top Value

Definition at line 102 of file class.ilTRBLColorPickerInputGUI.php.

103 {
104 return $this->topvalue;
105 }

◆ insert()

ilTRBLColorPickerInputGUI::insert (   $a_tpl)

Insert property html.

Returns
int Size

Definition at line 264 of file class.ilTRBLColorPickerInputGUI.php.

265 {
266 global $lng;
267
268 include_once('./Services/YUI/classes/class.ilYuiUtil.php');
270
271 $layout_tpl = new ilTemplate("tpl.prop_trbl_layout.html", true, true, "Services/Style");
272
273 $funcs = array(
274 "all" => "getAllValue", "top" => "getTopValue",
275 "bottom" => "getBottomValue", "left" => "getLeftValue",
276 "right" => "getRightValue");
277
278 foreach ($this->dirs as $dir)
279 {
280 /*switch($dir)
281 {
282 case "all": $value = strtoupper(trim($this->getAllValue())); break;
283 case "top": $value = strtoupper(trim($this->getTopValue())); break;
284 case "bottom": $value = strtoupper(trim($this->getBottomValue())); break;
285 case "left": $value = strtoupper(trim($this->getLeftValue())); break;
286 case "right": $value = strtoupper(trim($this->getRightValue())); break;
287 }*/
288 $value = trim($this->$funcs[$dir]());
289 if (!$this->getAcceptNamedColors() || substr($value, 0, 1) != "!")
290 {
291 $value = strtoupper($value);
292 }
293
294 $ctpl = new ilTemplate("tpl.prop_trbl_color.html", true, true, "Services/Style");
295
296 $js_tpl = new ilTemplate('tpl.trbl_color_picker.js',true,true,'Services/Style');
297 $js_tpl->setVariable('THUMB_PATH',ilUtil::getImagePath('color_picker_thumb.png','Services/Form'));
298 $js_tpl->setVariable('HUE_THUMB_PATH',ilUtil::getImagePath('color_picker_hue_thumb.png','Services/Form'));
299 $js_tpl->setVariable('COLOR_ID',$this->getFieldId()."_".$dir);
301 if ($ic == "")
302 {
303 $ic = "FFFFFF";
304 }
305 $js_tpl->setVariable('INIT_COLOR_SHORT',$ic);
306 $js_tpl->setVariable('INIT_COLOR','#'.$value);
307 $js_tpl->setVariable('POST_VAR', $this->getPostVar());
308 $js_tpl->setVariable('DIR', $dir);
309
310
311 if($this->getDisabled())
312 {
313 $ctpl->setVariable('COLOR_DISABLED','disabled="disabled"');
314 }
315 else
316 {
317 $ctpl->setVariable('PROP_COLOR_JS',$js_tpl->get());
318 }
319 $ctpl->setVariable("POST_VAR", $this->getPostVar());
320 $ctpl->setVariable("PROP_COLOR_ID", $this->getFieldId()."_".$dir);
321
322 $ctpl->setVariable("PROPERTY_VALUE_COLOR", $value);
323 $ctpl->setVariable("DIR", $dir);
324 $ctpl->setVariable("TXT_DIR", $lng->txt("sty_$dir"));
325
326 $layout_tpl->setVariable(strtoupper($dir), $ctpl->get());
327 }
328
329 $a_tpl->setCurrentBlock("prop_generic");
330 $a_tpl->setVariable("PROP_GENERIC", $layout_tpl->get());
331 $a_tpl->parseCurrentBlock();
332
333 }
static determineHexcode($a_value)
Determine hex code for a given value.
getFieldId()
Get Post Variable.
getAcceptNamedColors()
Get Accept Named Colors (Leading '!').
special template class to simplify handling of ITX/PEAR
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static initColorPicker()
init color picker button
global $lng
Definition: privfeed.php:40

References $lng, ilTextInputGUI\$value, ilColorPickerInputGUI\determineHexcode(), getAcceptNamedColors(), ilFormPropertyGUI\getDisabled(), ilFormPropertyGUI\getFieldId(), ilUtil\getImagePath(), ilFormPropertyGUI\getPostVar(), and ilYuiUtil\initColorPicker().

+ Here is the call graph for this function:

◆ setAcceptNamedColors()

ilTRBLColorPickerInputGUI::setAcceptNamedColors (   $a_acceptnamedcolors)

Set Accept Named Colors (Leading '!').

Parameters
boolean$a_acceptnamedcolorsAccept Named Colors (Leading '!')

Definition at line 216 of file class.ilTRBLColorPickerInputGUI.php.

217 {
218 $this->acceptnamedcolors = $a_acceptnamedcolors;
219 }

◆ setAllValue()

ilTRBLColorPickerInputGUI::setAllValue (   $a_allvalue)

Set All Value.

Parameters
string$a_allvalueAll Value

Definition at line 56 of file class.ilTRBLColorPickerInputGUI.php.

57 {
58 $a_allvalue = trim($a_allvalue);
59 if ($this->getAcceptNamedColors() && substr($a_allvalue, 0, 1) == "!")
60 {
61 $this->allvalue = $a_allvalue;
62 }
63 else
64 {
65 $this->allvalue = ilColorPickerInputGUI::determineHexcode($a_allvalue);
66 }
67 }

References ilColorPickerInputGUI\determineHexcode(), and getAcceptNamedColors().

Referenced by checkInput().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setBottomValue()

ilTRBLColorPickerInputGUI::setBottomValue (   $a_bottomvalue)

Set Bottom Value.

Parameters
string$a_bottomvalueBottom Value

Definition at line 112 of file class.ilTRBLColorPickerInputGUI.php.

113 {
114 $a_bottomvalue = trim($a_bottomvalue);
115 if ($this->getAcceptNamedColors() && substr($a_bottomvalue, 0, 1) == "!")
116 {
117 $this->bottomvalue = $a_bottomvalue;
118 }
119 else
120 {
121 $this->bottomvalue = ilColorPickerInputGUI::determineHexcode($a_bottomvalue);
122 }
123 }

References ilColorPickerInputGUI\determineHexcode(), and getAcceptNamedColors().

Referenced by checkInput().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setDefaultColor()

ilTRBLColorPickerInputGUI::setDefaultColor (   $a_defaultcolor)

Set Default Color.

Parameters
mixed$a_defaultcolorDefault Color

Definition at line 196 of file class.ilTRBLColorPickerInputGUI.php.

197 {
198 $this->defaultcolor = $a_defaultcolor;
199 }

◆ setLeftValue()

ilTRBLColorPickerInputGUI::setLeftValue (   $a_leftvalue)

Set Left Value.

Parameters
string$a_leftvalueLeft Value

Definition at line 140 of file class.ilTRBLColorPickerInputGUI.php.

141 {
142 $a_leftvalue = trim($a_leftvalue);
143 if ($this->getAcceptNamedColors() && substr($a_leftvalue, 0, 1) == "!")
144 {
145 $this->leftvalue = $a_leftvalue;
146 }
147 else
148 {
149 $this->leftvalue = ilColorPickerInputGUI::determineHexcode($a_leftvalue);
150 }
151 }

References ilColorPickerInputGUI\determineHexcode(), and getAcceptNamedColors().

Referenced by checkInput().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setRightValue()

ilTRBLColorPickerInputGUI::setRightValue (   $a_rightvalue)

Set Right Value.

Parameters
string$a_rightvalueRight Value

Definition at line 168 of file class.ilTRBLColorPickerInputGUI.php.

169 {
170 $a_rightvalue = trim($a_rightvalue);
171 if ($this->getAcceptNamedColors() && substr($a_rightvalue, 0, 1) == "!")
172 {
173 $this->rightvalue = $a_rightvalue;
174 }
175 else
176 {
177 $this->rightvalue = ilColorPickerInputGUI::determineHexcode($a_rightvalue);
178 }
179 }

References ilColorPickerInputGUI\determineHexcode(), and getAcceptNamedColors().

Referenced by checkInput().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setTopValue()

ilTRBLColorPickerInputGUI::setTopValue (   $a_topvalue)

Set Top Value.

Parameters
string$a_topvalueTop Value

Definition at line 84 of file class.ilTRBLColorPickerInputGUI.php.

85 {
86 $a_topvalue = trim($a_topvalue);
87 if ($this->getAcceptNamedColors() && substr($a_topvalue, 0, 1) == "!")
88 {
89 $this->topvalue = $a_topvalue;
90 }
91 else
92 {
93 $this->topvalue = ilColorPickerInputGUI::determineHexcode($a_topvalue);
94 }
95 }

References ilColorPickerInputGUI\determineHexcode(), and getAcceptNamedColors().

Referenced by checkInput().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $hex

ilTRBLColorPickerInputGUI::$hex
protected

Definition at line 35 of file class.ilTRBLColorPickerInputGUI.php.


The documentation for this class was generated from the following file: