ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5
ilBackgroundImageInputGUI Class Reference

This class represents a background image property in a property form. More...

+ Inheritance diagram for ilBackgroundImageInputGUI:
+ Collaboration diagram for ilBackgroundImageInputGUI:

Public Member Functions

 __construct ($a_title="", $a_postvar="")
 Constructor. More...
 
 setValue ($a_value)
 Set Value. More...
 
 getValue ()
 Get Value. More...
 
 setImages ($a_images)
 Set Images. More...
 
 getImages ()
 Get Images. More...
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 insert (&$a_tpl)
 Insert property html. More...
 
 setValueByArray ($a_values)
 Set value by array. 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...
 

Protected Attributes

 $value
 
- 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

This class represents a background image property in a property form.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 31 of file class.ilBackgroundImageInputGUI.php.

Constructor & Destructor Documentation

◆ __construct()

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

Constructor.

Parameters
string$a_titleTitle
string$a_postvarPost Variable

Definition at line 41 of file class.ilBackgroundImageInputGUI.php.

References ilFormPropertyGUI\setType().

42  {
43  parent::__construct($a_title, $a_postvar);
44  $this->setType("background_image");
45  }
setType($a_type)
Set Type.
+ Here is the call graph for this function:

Member Function Documentation

◆ checkInput()

ilBackgroundImageInputGUI::checkInput ( )

Check input, strip slashes etc.

set alert, if input is not ok.

Returns
boolean Input ok, true/false

Definition at line 92 of file class.ilBackgroundImageInputGUI.php.

References $_POST, $lng, ilFormPropertyGUI\$type, ilFormPropertyGUI\getPostVar(), ilFormPropertyGUI\getRequired(), ilFormPropertyGUI\setAlert(), setValue(), and ilUtil\stripSlashes().

93  {
94  global $lng;
95 
96  $type = $_POST[$this->getPostVar()]["type"] =
97  ilUtil::stripSlashes($_POST[$this->getPostVar()]["type"]);
98  $int_value = $_POST[$this->getPostVar()]["int_value"] =
99  ilUtil::stripSlashes($_POST[$this->getPostVar()]["int_value"]);
100  $ext_value = $_POST[$this->getPostVar()]["ext_value"] =
101  ilUtil::stripSlashes($_POST[$this->getPostVar()]["ext_value"]);
102 
103  if ($this->getRequired() && $type == "ext" && trim($ext_value) == "")
104  {
105  $this->setAlert($lng->txt("msg_input_is_required"));
106 
107  return false;
108  }
109 
110  if ($type == "external")
111  {
112  $this->setValue($ext_value);
113  }
114  else
115  {
116  $this->setValue($int_value);
117  }
118 
119  return true;
120  }
$_POST['username']
Definition: cron.php:12
getPostVar()
Get Post Variable.
setAlert($a_alert)
Set Alert Text.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
global $lng
Definition: privfeed.php:40
+ Here is the call graph for this function:

◆ getImages()

ilBackgroundImageInputGUI::getImages ( )

Get Images.

Returns
array Images

Definition at line 82 of file class.ilBackgroundImageInputGUI.php.

Referenced by insert().

83  {
84  return $this->images;
85  }
+ Here is the caller graph for this function:

◆ getValue()

ilBackgroundImageInputGUI::getValue ( )

Get Value.

Returns
string Value

Definition at line 62 of file class.ilBackgroundImageInputGUI.php.

References $value.

Referenced by insert().

+ Here is the caller graph for this function:

◆ insert()

ilBackgroundImageInputGUI::insert ( $a_tpl)

Insert property html.

Definition at line 125 of file class.ilBackgroundImageInputGUI.php.

References $tpl, $value, getImages(), ilFormPropertyGUI\getPostVar(), getValue(), and ilUtil\prepareFormOutput().

126  {
127  $tpl = new ilTemplate("tpl.prop_background_image.html", true, true, "Services/Style");
128 
129  $tpl->setVariable("POSTVAR", $this->getPostVar());
130 
131  $int_options = array_merge(array("" => ""), $this->getImages());
132 
133  $value = trim($this->getValue());
134 
135  if (is_int(strpos($value, "/")))
136  {
137  $current_type = "ext";
138  $tpl->setVariable("EXTERNAL_SELECTED", 'checked="checked"');
139  $tpl->setVariable("VAL_EXT", ilUtil::prepareFormOutput($value));
140  }
141  else
142  {
143  $current_type = "int";
144  $tpl->setVariable("INTERNAL_SELECTED", 'checked="checked"');
145  }
146 
147  foreach ($int_options as $option)
148  {
149  $tpl->setCurrentBlock("int_option");
150  $tpl->setVariable("VAL_INT", $option);
151  $tpl->setVariable("TXT_INT", $option);
152 
153  if ($current_type == "int" && $value == $option)
154  {
155  $tpl->setVariable("INT_SELECTED", 'selected="selected"');
156  }
157  $tpl->parseCurrentBlock();
158  }
159 
160  $a_tpl->setCurrentBlock("prop_generic");
161  $a_tpl->setVariable("PROP_GENERIC", $tpl->get());
162  $a_tpl->parseCurrentBlock();
163  }
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
getPostVar()
Get Post Variable.
global $tpl
Definition: ilias.php:8
special template class to simplify handling of ITX/PEAR
+ Here is the call graph for this function:

◆ setImages()

ilBackgroundImageInputGUI::setImages (   $a_images)

Set Images.

Parameters
array$a_imagesImages

Definition at line 72 of file class.ilBackgroundImageInputGUI.php.

Referenced by ilObjStyleSheetGUI\initTagStyleForm().

73  {
74  $this->images = $a_images;
75  }
+ Here is the caller graph for this function:

◆ setValue()

ilBackgroundImageInputGUI::setValue (   $a_value)

Set Value.

Parameters
string$a_valueValue

Definition at line 52 of file class.ilBackgroundImageInputGUI.php.

Referenced by checkInput(), and setValueByArray().

53  {
54  $this->value = $a_value;
55  }
+ Here is the caller graph for this function:

◆ setValueByArray()

ilBackgroundImageInputGUI::setValueByArray (   $a_values)

Set value by array.

Parameters
array$a_valuesvalue array

Definition at line 170 of file class.ilBackgroundImageInputGUI.php.

References $ilUser, ilFormPropertyGUI\getPostVar(), and setValue().

171  {
172  global $ilUser;
173 
174  if ($a_values[$this->getPostVar()]["type"] == "internal")
175  {
176  $this->setValue($a_values[$this->getPostVar()]["int_value"]);
177  }
178  else
179  {
180  $this->setValue($a_values[$this->getPostVar()]["ext_value"]);
181  }
182  }
getPostVar()
Get Post Variable.
global $ilUser
Definition: imgupload.php:15
+ Here is the call graph for this function:

Field Documentation

◆ $value

ilBackgroundImageInputGUI::$value
protected

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

Referenced by getValue(), and insert().


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