ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilWidthHeightInputGUI Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilWidthHeightInputGUI:
+ Collaboration diagram for ilWidthHeightInputGUI:

Public Member Functions

 __construct (string $a_title="", string $a_postvar="")
 
 setSupportConstraintsProps (bool $a_val)
 
 getSupportConstraintsProps ()
 
 setWidth (?int $a_width)
 
 getWidth ()
 
 setHeight (?int $a_height)
 
 getHeight ()
 
 setConstrainProportions (bool $a_constrainproportions)
 
 getConstrainProportions ()
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 getInput ()
 
 insert (ilTemplate $a_tpl)
 
 setValueByArray (array $a_values)
 
- Public Member Functions inherited from ilFormPropertyGUI
 __construct (string $a_title="", string $a_postvar="")
 
 executeCommand ()
 
 getType ()
 
 setTitle (string $a_title)
 
 getTitle ()
 
 setPostVar (string $a_postvar)
 
 getPostVar ()
 
 getFieldId ()
 
 setInfo (string $a_info)
 
 getInfo ()
 
 setAlert (string $a_alert)
 
 getAlert ()
 
 setRequired (bool $a_required)
 
 getRequired ()
 
 setDisabled (bool $a_disabled)
 
 getDisabled ()
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 setParentForm (ilPropertyFormGUI $a_parentform)
 
 getParentForm ()
 
 setParent (ilFormPropertyGUI $a_val)
 
 getParent ()
 
 getSubForm ()
 
 hideSubForm ()
 
 setHiddenTitle (string $a_val)
 
 getHiddenTitle ()
 
 getItemByPostVar (string $a_post_var)
 Get item by post var. More...
 
 serializeData ()
 
 unserializeData (string $a_data)
 
 setParentTable ($a_val)
 Set parent table. More...
 
 getParentTable ()
 Get parent table. More...
 
 writeToSession ()
 
 clearFromSession ()
 
 readFromSession ()
 
 getHiddenTag (string $a_post_var, string $a_value)
 
 setMulti (bool $a_multi, bool $a_sortable=false, bool $a_addremove=true)
 
 getMulti ()
 
 setMultiValues (array $a_values)
 
 getMultiValues ()
 
 getContentOutsideFormTag ()
 Get content that has to reside outside of the parent form tag, e.g. More...
 
 stripSlashesAddSpaceFallback (string $a_str)
 Strip slashes with add space fallback, see https://www.ilias.de/mantis/view.php?id=19727. More...
 
 getTableFilterLabelFor ()
 Get label "for" attribute value for filter. More...
 
 getFormLabelFor ()
 Get label "for" attribute value for form. More...
 
 setRequestParam (string $key, $val)
 This writes the request (aka post) values. More...
 

Protected Attributes

bool $support_constraint_props = false
 
bool $constrainproportions = false
 
int $height = null
 
int $width = null
 
array $dirs = []
 
ilObjUser $user
 
ilGlobalTemplateInterface $main_tpl
 
- Protected Attributes inherited from ilFormPropertyGUI
array $set_params = []
 
ilTable2GUI $parent_table = null
 
ilFormPropertyGUI $parent_gui = null
 
ilCtrl $ctrl
 
ilLanguage $lng
 
string $type = ""
 
string $title = ""
 
string $postvar = ""
 
string $info = ""
 
string $alert = ""
 
bool $required = false
 
ilPropertyFormGUI $parentform = null
 
string $hidden_title = ""
 
bool $multi = false
 
bool $multi_sortable = false
 
bool $multi_addremove = true
 
array $multi_values = []
 
RequestInterface $request
 
HTTP Services $http
 
Refinery Factory $refinery = null
 
bool $disabled = false
 
ilGlobalTemplateInterface $global_tpl = null
 

Additional Inherited Members

- Static Public Member Functions inherited from ilFormPropertyGUI
static removeProhibitedCharacters (string $a_text)
 Remove prohibited characters see #19159. More...
 
- Protected Member Functions inherited from ilFormPropertyGUI
 symbol ()
 
 setType (string $a_type)
 
 checkParentFormTable ()
 
 getSessionKey ()
 
 getMultiIconsHTML ()
 
 int ($key)
 
 intArray ($key)
 
 str ($key)
 
 raw ($key)
 
 strArray ($key)
 
 arrayArray ($key)
 
 isRequestParamArray (string $key)
 
 getRequestParam (string $key, Refinery\Transformation $t)
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning This class represents a width/height item in a property form.

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 24 of file class.ilWidthHeightInputGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilWidthHeightInputGUI::__construct ( string  $a_title = "",
string  $a_postvar = "" 
)

Reimplemented from ilFormPropertyGUI.

Definition at line 34 of file class.ilWidthHeightInputGUI.php.

37 {
38 global $DIC;
39
40 $this->lng = $DIC->language();
41 $this->user = $DIC->user();
42 parent::__construct($a_title, $a_postvar);
43 $this->setType("width_height");
44 $this->main_tpl = $DIC->ui()->mainTemplate();
45 }
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26

References $DIC, ILIAS\GlobalScreen\Provider\__construct(), ILIAS\Repository\lng(), ilFormPropertyGUI\setType(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

Member Function Documentation

◆ checkInput()

ilWidthHeightInputGUI::checkInput ( )

Check input, strip slashes etc.

set alert, if input is not ok.

Reimplemented from ilFormPropertyGUI.

Definition at line 87 of file class.ilWidthHeightInputGUI.php.

87 : bool
88 {
89 $i = $this->getInput();
90 $this->setWidth($i["width"] ? (int) $i["width"] : null);
91 $this->setHeight($i["height"] ? (int) $i["height"] : null);
92 $this->setConstrainProportions((bool) $i["constr_prop"]);
93
94 return true;
95 }
setConstrainProportions(bool $a_constrainproportions)

References getInput(), setConstrainProportions(), setHeight(), and setWidth().

+ Here is the call graph for this function:

◆ getConstrainProportions()

ilWidthHeightInputGUI::getConstrainProportions ( )

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

82 : bool
83 {
85 }

References $constrainproportions.

Referenced by insert().

+ Here is the caller graph for this function:

◆ getHeight()

ilWidthHeightInputGUI::getHeight ( )

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

72 : ?int
73 {
74 return $this->height;
75 }

References $height.

Referenced by insert().

+ Here is the caller graph for this function:

◆ getInput()

ilWidthHeightInputGUI::getInput ( )

Definition at line 97 of file class.ilWidthHeightInputGUI.php.

97 : array
98 {
99 $val = $this->strArray($this->getPostVar());
100 return [
101 "width" => (string) ($val["width"] ?? ""),
102 "height" => (string) ($val["height"] ?? ""),
103 "constr_prop" => (bool) ($val["constr_prop"] ?? false)
104 ];
105 }

References ilFormPropertyGUI\getPostVar(), and ilFormPropertyGUI\strArray().

Referenced by checkInput().

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

◆ getSupportConstraintsProps()

ilWidthHeightInputGUI::getSupportConstraintsProps ( )

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

52 : bool
53 {
55 }

References $support_constraint_props.

Referenced by insert().

+ Here is the caller graph for this function:

◆ getWidth()

ilWidthHeightInputGUI::getWidth ( )

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

62 : ?int
63 {
64 return $this->width;
65 }

References $width.

Referenced by insert().

+ Here is the caller graph for this function:

◆ insert()

ilWidthHeightInputGUI::insert ( ilTemplate  $a_tpl)

Definition at line 107 of file class.ilWidthHeightInputGUI.php.

107 : void
108 {
110
111 $tpl = new ilTemplate("tpl.prop_width_height.html", true, true, "components/ILIAS/MediaObjects");
112
113 $wh_ratio = 0;
114 if ((int) $this->getHeight() > 0) {
115 $wh_ratio = (int) $this->getWidth() / (int) $this->getHeight();
116 }
117 $ratio = str_replace(",", ".", round($wh_ratio, 6));
118 if ($this->getSupportConstraintsProps() && $wh_ratio > 0) {
119 $tpl->setCurrentBlock("cs_prop");
120 $tpl->setVariable("TXT_CONSTR_PROP", $lng->txt("cont_constrain_proportions"));
121 $tpl->setVariable("CS_POST_VAR", $this->getPostVar());
122 if ($this->getConstrainProportions()) {
123 $tpl->setVariable("CHECKED", 'checked="checked"');
124 }
125 $tpl->parseCurrentBlock();
126 $this->main_tpl->addOnLoadCode(
127 'prop_width_height["prop_' . $this->getPostVar() . '"] = ' . $ratio . ';'
128 );
129 }
130
131 $tpl->setVariable("VAL_WIDTH", strtolower(trim((string) $this->getWidth())));
132 $tpl->setVariable("VAL_HEIGHT", strtolower(trim((string) $this->getHeight())));
133
134 $tpl->setVariable("POST_VAR", $this->getPostVar());
135
136 $a_tpl->setCurrentBlock("prop_generic");
137 $a_tpl->setVariable("PROP_GENERIC", $tpl->get());
138 $a_tpl->parseCurrentBlock();
139
140 $this->main_tpl
141 ->addJavaScript("assets/js/ServiceMediaObjectPropWidthHeight.js");
142 $this->main_tpl->addOnLoadCode(
143 'prop_width_height["prop_' . $this->getPostVar() . '"] = ' . $ratio . ';'
144 );
145 }
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:544
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
special template class to simplify handling of ITX/PEAR
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)

References ilFormPropertyGUI\$lng, getConstrainProportions(), getHeight(), ilFormPropertyGUI\getPostVar(), getSupportConstraintsProps(), getWidth(), ilFormPropertyGUI\int(), ilTemplate\parseCurrentBlock(), ilTemplate\setCurrentBlock(), HTML_Template_IT\setVariable(), and ilLanguage\txt().

+ Here is the call graph for this function:

◆ setConstrainProportions()

ilWidthHeightInputGUI::setConstrainProportions ( bool  $a_constrainproportions)

Definition at line 77 of file class.ilWidthHeightInputGUI.php.

77 : void
78 {
79 $this->constrainproportions = $a_constrainproportions;
80 }

Referenced by checkInput(), and setValueByArray().

+ Here is the caller graph for this function:

◆ setHeight()

ilWidthHeightInputGUI::setHeight ( ?int  $a_height)

Definition at line 67 of file class.ilWidthHeightInputGUI.php.

67 : void
68 {
69 $this->height = $a_height;
70 }

Referenced by checkInput(), and setValueByArray().

+ Here is the caller graph for this function:

◆ setSupportConstraintsProps()

ilWidthHeightInputGUI::setSupportConstraintsProps ( bool  $a_val)

Definition at line 47 of file class.ilWidthHeightInputGUI.php.

47 : void
48 {
49 $this->support_constraint_props = $a_val;
50 }

◆ setValueByArray()

ilWidthHeightInputGUI::setValueByArray ( array  $a_values)

Definition at line 147 of file class.ilWidthHeightInputGUI.php.

147 : void
148 {
149 $w = $a_values[$this->getPostVar()]["width"] ?? false;
150 $h = $a_values[$this->getPostVar()]["height"] ?? false;
151 $this->setWidth($w ? (int) $w : null);
152 $this->setHeight($h ? (int) $h : null);
153 $this->setConstrainProportions($a_values[$this->getPostVar()]["constr_prop"] ?? false);
154 }

References ilFormPropertyGUI\getPostVar(), setConstrainProportions(), setHeight(), and setWidth().

+ Here is the call graph for this function:

◆ setWidth()

ilWidthHeightInputGUI::setWidth ( ?int  $a_width)

Definition at line 57 of file class.ilWidthHeightInputGUI.php.

57 : void
58 {
59 $this->width = $a_width;
60 }

Referenced by checkInput(), and setValueByArray().

+ Here is the caller graph for this function:

Field Documentation

◆ $constrainproportions

bool ilWidthHeightInputGUI::$constrainproportions = false
protected

Definition at line 27 of file class.ilWidthHeightInputGUI.php.

Referenced by getConstrainProportions().

◆ $dirs

array ilWidthHeightInputGUI::$dirs = []
protected

Definition at line 30 of file class.ilWidthHeightInputGUI.php.

◆ $height

int ilWidthHeightInputGUI::$height = null
protected

Definition at line 28 of file class.ilWidthHeightInputGUI.php.

Referenced by getHeight().

◆ $main_tpl

ilGlobalTemplateInterface ilWidthHeightInputGUI::$main_tpl
protected

Definition at line 32 of file class.ilWidthHeightInputGUI.php.

◆ $support_constraint_props

bool ilWidthHeightInputGUI::$support_constraint_props = false
protected

Definition at line 26 of file class.ilWidthHeightInputGUI.php.

Referenced by getSupportConstraintsProps().

◆ $user

ilObjUser ilWidthHeightInputGUI::$user
protected

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

◆ $width

int ilWidthHeightInputGUI::$width = null
protected

Definition at line 29 of file class.ilWidthHeightInputGUI.php.

Referenced by getWidth().


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