ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilTypicalLearningTimeInputGUI Class Reference

This class represents a typical learning time property in a property form. More...

+ Inheritance diagram for ilTypicalLearningTimeInputGUI:
+ Collaboration diagram for ilTypicalLearningTimeInputGUI:

Public Member Functions

 __construct ($a_title="", $a_postvar="")
 Constructor. More...
 
 setValue ($a_value)
 Set Value. More...
 
 setValueByLOMDuration ($a_value)
 Set by LOM duration. More...
 
 getValue ()
 Get Value. More...
 
 setValueByArray ($a_values)
 Set value by array. More...
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 __buildMonthsSelect ($sel_month)
 
 __buildDaysSelect ($sel_day)
 
 insert (&$a_tpl)
 Insert property html. 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...
 
 stripSlashesAddSpaceFallback ($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...
 

Protected Attributes

 $value
 
 $valid = true
 
- Protected Attributes inherited from ilFormPropertyGUI
 $ctrl
 
 $lng
 
 $type
 
 $title
 
 $postvar
 
 $info
 
 $alert
 
 $required = false
 
 $parentgui
 
 $parentform
 
 $hidden_title = ""
 
 $multi = false
 
 $multi_sortable = false
 
 $multi_addremove = true
 
 $multi_values
 

Additional Inherited Members

- Static Public Member Functions inherited from ilFormPropertyGUI
static removeProhibitedCharacters ($a_text)
 Remove prohibited characters see #19159. More...
 
- 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 typical learning time 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 14 of file class.ilTypicalLearningTimeInputGUI.php.

Constructor & Destructor Documentation

◆ __construct()

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

Constructor.

Parameters
string$a_titleTitle
string$a_postvarPost Variable

Definition at line 25 of file class.ilTypicalLearningTimeInputGUI.php.

References $DIC, ilFormPropertyGUI\$lng, ilFormPropertyGUI\setType(), and setValue().

26  {
27  global $DIC;
28 
29  $lng = $DIC['lng'];
30 
31  $this->lng = $lng;
32  $this->lng->loadLanguageModule("meta");
33 
34  parent::__construct($a_title, $a_postvar);
35  $this->setType("typical_learntime");
36  $this->setValue(array(0,0,0,0,0));
37  }
global $DIC
Definition: saml.php:7
setType($a_type)
Set Type.
+ Here is the call graph for this function:

Member Function Documentation

◆ __buildDaysSelect()

ilTypicalLearningTimeInputGUI::__buildDaysSelect (   $sel_day)

Definition at line 131 of file class.ilTypicalLearningTimeInputGUI.php.

References $i, PHPMailer\PHPMailer\$options, ilUtil\formSelect(), and ilFormPropertyGUI\getPostVar().

Referenced by insert().

132  {
133  for ($i = 0;$i <= 31;$i++) {
134  $options[$i] = sprintf('%02d', $i);
135  }
136  return ilUtil::formSelect($sel_day, $this->getPostVar() . '[d]', $options, false, true);
137  }
getPostVar()
Get Post Variable.
static formSelect( $selected, $varname, $options, $multiple=false, $direct_text=false, $size="0", $style_class="", $attribs="", $disabled=false)
Builds a select form field with options and shows the selected option first.
$i
Definition: disco.tpl.php:19
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __buildMonthsSelect()

ilTypicalLearningTimeInputGUI::__buildMonthsSelect (   $sel_month)

Definition at line 122 of file class.ilTypicalLearningTimeInputGUI.php.

References $i, PHPMailer\PHPMailer\$options, ilUtil\formSelect(), and ilFormPropertyGUI\getPostVar().

Referenced by insert().

123  {
124  for ($i = 0;$i <= 24;$i++) {
125  $options[$i] = sprintf('%02d', $i);
126  }
127  return ilUtil::formSelect($sel_month, $this->getPostVar() . '[mo]', $options, false, true);
128  }
getPostVar()
Get Post Variable.
static formSelect( $selected, $varname, $options, $multiple=false, $direct_text=false, $size="0", $style_class="", $attribs="", $disabled=false)
Builds a select form field with options and shows the selected option first.
$i
Definition: disco.tpl.php:19
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkInput()

ilTypicalLearningTimeInputGUI::checkInput ( )

Check input, strip slashes etc.

set alert, if input is not ok.

Returns
boolean Input ok, true/false

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

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

98  {
99  global $DIC;
100 
101  $lng = $DIC['lng'];
102 
103  $_POST[$this->getPostVar()][0] = (int) ilUtil::stripSlashes($_POST[$this->getPostVar()][0]);
104  $_POST[$this->getPostVar()][1] = (int) ilUtil::stripSlashes($_POST[$this->getPostVar()][1]);
105  $_POST[$this->getPostVar()][2] = (int) ilUtil::stripSlashes($_POST[$this->getPostVar()][2]);
106  $_POST[$this->getPostVar()][3] = (int) ilUtil::stripSlashes($_POST[$this->getPostVar()][3]);
107  if (isset($_POST[$this->getPostVar()][4])) {
108  $_POST[$this->getPostVar()][4] = (int) ilUtil::stripSlashes($_POST[$this->getPostVar()][4]);
109  }
110 
111  // check required
112  $v = $_POST[$this->getPostVar()];
113  if ($this->getRequired() && $v[0] == 0 && $v[1] == 0 &&
114  $v[2] == 0 && $v[3] == 0 && (int) $v[4] == 0) {
115  $this->setAlert($lng->txt("msg_input_is_required"));
116  return false;
117  }
118 
119  return true;
120  }
global $DIC
Definition: saml.php:7
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
$_POST["username"]
+ Here is the call graph for this function:

◆ getValue()

ilTypicalLearningTimeInputGUI::getValue ( )

Get Value.

Returns
string Value

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

References $value.

Referenced by insert().

+ Here is the caller graph for this function:

◆ insert()

ilTypicalLearningTimeInputGUI::insert ( $a_tpl)

Insert property html.

Definition at line 142 of file class.ilTypicalLearningTimeInputGUI.php.

References __buildDaysSelect(), __buildMonthsSelect(), ilFormPropertyGUI\getPostVar(), getValue(), and ilUtil\makeTimeSelect().

143  {
144  $ttpl = new ilTemplate("tpl.prop_typical_learning_time.html", true, true, "Services/MetaData");
145  $val = $this->getValue();
146 
147  $ttpl->setVariable("TXT_MONTH", $this->lng->txt('md_months'));
148  $ttpl->setVariable("SEL_MONTHS", $this->__buildMonthsSelect($val[0]));
149  $ttpl->setVariable("SEL_DAYS", $this->__buildDaysSelect($val[1]));
150 
151  $ttpl->setVariable("TXT_DAYS", $this->lng->txt('md_days'));
152  $ttpl->setVariable("TXT_TIME", $this->lng->txt('md_time'));
153 
154  $ttpl->setVariable("SEL_TLT", ilUtil::makeTimeSelect(
155  $this->getPostVar(),
156  $val[4] ? false : true,
157  $val[2],
158  $val[3],
159  $val[4],
160  false
161  ));
162  $ttpl->setVariable("TLT_HINT", $tlt[4] ? '(hh:mm:ss)' : '(hh:mm)');
163 
164  if (!$this->valid) {
165  $ttpl->setCurrentBlock("tlt_not_valid");
166  $ttpl->setVariable("TXT_CURRENT_VAL", $this->lng->txt('meta_current_value'));
167  $ttpl->setVariable("TLT", $this->lom_duration);
168  $ttpl->setVariable("INFO_TLT_NOT_VALID", $this->lng->txt('meta_info_tlt_not_valid'));
169  $ttpl->parseCurrentBlock();
170  }
171 
172  $a_tpl->setCurrentBlock("prop_generic");
173  $a_tpl->setVariable("PROP_GENERIC", $ttpl->get());
174  $a_tpl->parseCurrentBlock();
175  }
getPostVar()
Get Post Variable.
static makeTimeSelect($prefix, $short=true, $hour="", $minute="", $second="", $a_use_default=true, $a_further_options=array())
Creates a combination of HTML selects for time inputs.
special template class to simplify handling of ITX/PEAR
+ Here is the call graph for this function:

◆ setValue()

ilTypicalLearningTimeInputGUI::setValue (   $a_value)

Set Value.

Parameters
string$a_valueValue

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

Referenced by __construct(), setValueByArray(), and setValueByLOMDuration().

45  {
46  $this->value = $a_value;
47  }
+ Here is the caller graph for this function:

◆ setValueByArray()

ilTypicalLearningTimeInputGUI::setValueByArray (   $a_values)

Set value by array.

Parameters
array$a_valuesvalue array

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

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

88  {
89  $this->setValue($a_values[$this->getPostVar()]);
90  }
getPostVar()
Get Post Variable.
+ Here is the call graph for this function:

◆ setValueByLOMDuration()

ilTypicalLearningTimeInputGUI::setValueByLOMDuration (   $a_value)

Set by LOM duration.

Parameters
string$a_valueValue

Definition at line 54 of file class.ilTypicalLearningTimeInputGUI.php.

References ilMDUtils\_LOMDurationToArray(), and setValue().

Referenced by ilMDEditorGUI\initQuickEditForm().

55  {
56  $this->lom_duration = $a_value;
57  $this->valid = true;
58 
59  include_once 'Services/MetaData/classes/class.ilMDUtils.php';
60  $tlt = ilMDUtils::_LOMDurationToArray($a_value);
61 
62  if (!$tlt) {
63  $this->setValue(array(0,0,0,0,0));
64  if ($a_value != "") {
65  $this->valid = false;
66  }
67  } else {
68  $this->setValue($tlt);
69  }
70  }
static _LOMDurationToArray($a_string)
LOM datatype duration is a string like P2M4DT7H18M2S (2 months 4 days 7 hours 18 minutes 2 seconds) T...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $valid

ilTypicalLearningTimeInputGUI::$valid = true
protected

Definition at line 17 of file class.ilTypicalLearningTimeInputGUI.php.

◆ $value

ilTypicalLearningTimeInputGUI::$value
protected

Definition at line 16 of file class.ilTypicalLearningTimeInputGUI.php.

Referenced by getValue().


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