ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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...
 

Protected Attributes

 $value
 
 $valid = true
 
- 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

- 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 $lng, array, ilFormPropertyGUI\setType(), and setValue().

26  {
27  global $lng;
28 
29  $this->lng = $lng;
30  $this->lng->loadLanguageModule("meta");
31 
32  parent::__construct($a_title, $a_postvar);
33  $this->setType("typical_learntime");
34  $this->setValue(array(0,0,0,0,0));
35  }
setType($a_type)
Set Type.
Create styles array
The data for the language used.
global $lng
Definition: privfeed.php:17
+ Here is the call graph for this function:

Member Function Documentation

◆ __buildDaysSelect()

ilTypicalLearningTimeInputGUI::__buildDaysSelect (   $sel_day)

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

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

Referenced by insert().

136  {
137  for($i = 0;$i <= 31;$i++)
138  {
139  $options[$i] = sprintf('%02d',$i);
140  }
141  return ilUtil::formSelect($sel_day, $this->getPostVar().'[d]',$options,false,true);
142  }
getPostVar()
Get Post Variable.
if(!is_array($argv)) $options
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.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __buildMonthsSelect()

ilTypicalLearningTimeInputGUI::__buildMonthsSelect (   $sel_month)

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

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

Referenced by insert().

126  {
127  for($i = 0;$i <= 24;$i++)
128  {
129  $options[$i] = sprintf('%02d',$i);
130  }
131  return ilUtil::formSelect($sel_month,$this->getPostVar().'[mo]',$options,false,true);
132  }
getPostVar()
Get Post Variable.
if(!is_array($argv)) $options
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.
+ 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 100 of file class.ilTypicalLearningTimeInputGUI.php.

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

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

◆ getValue()

ilTypicalLearningTimeInputGUI::getValue ( )

Get Value.

Returns
string Value

Definition at line 80 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 147 of file class.ilTypicalLearningTimeInputGUI.php.

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

148  {
149  $ttpl = new ilTemplate("tpl.prop_typical_learning_time.html", true, true, "Services/MetaData");
150  $val = $this->getValue();
151 
152  $ttpl->setVariable("TXT_MONTH",$this->lng->txt('md_months'));
153  $ttpl->setVariable("SEL_MONTHS",$this->__buildMonthsSelect($val[0]));
154  $ttpl->setVariable("SEL_DAYS",$this->__buildDaysSelect($val[1]));
155 
156  $ttpl->setVariable("TXT_DAYS",$this->lng->txt('md_days'));
157  $ttpl->setVariable("TXT_TIME",$this->lng->txt('md_time'));
158 
159  $ttpl->setVariable("SEL_TLT",ilUtil::makeTimeSelect($this->getPostVar(),$val[4] ? false : true,
160  $val[2],$val[3],$val[4],
161  false));
162  $ttpl->setVariable("TLT_HINT",$tlt[4] ? '(hh:mm:ss)' : '(hh:mm)');
163 
164  if(!$this->valid)
165  {
166  $ttpl->setCurrentBlock("tlt_not_valid");
167  $ttpl->setVariable("TXT_CURRENT_VAL",$this->lng->txt('meta_current_value'));
168  $ttpl->setVariable("TLT", $this->lom_duration);
169  $ttpl->setVariable("INFO_TLT_NOT_VALID",$this->lng->txt('meta_info_tlt_not_valid'));
170  $ttpl->parseCurrentBlock();
171  }
172 
173  $a_tpl->setCurrentBlock("prop_generic");
174  $a_tpl->setVariable("PROP_GENERIC", $ttpl->get());
175  $a_tpl->parseCurrentBlock();
176  }
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 42 of file class.ilTypicalLearningTimeInputGUI.php.

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

43  {
44  $this->value = $a_value;
45  }
+ 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 90 of file class.ilTypicalLearningTimeInputGUI.php.

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

91  {
92  $this->setValue($a_values[$this->getPostVar()]);
93  }
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 52 of file class.ilTypicalLearningTimeInputGUI.php.

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

Referenced by ilMDEditorGUI\initQuickEditForm().

53  {
54  $this->lom_duration = $a_value;
55  $this->valid = true;
56 
57  include_once 'Services/MetaData/classes/class.ilMDUtils.php';
58  $tlt = ilMDUtils::_LOMDurationToArray($a_value);
59 
60  if(!$tlt)
61  {
62  $this->setValue(array(0,0,0,0,0));
63  if ($a_value != "")
64  {
65  $this->valid = false;
66  }
67  }
68  else
69  {
70  $this->setValue($tlt);
71  }
72 
73  }
static _LOMDurationToArray($a_string)
LOM datatype duration is a string like P2M4DT7H18M2S (2 months 4 days 7 hours 18 minutes 2 seconds) T...
Create styles array
The data for the language used.
+ 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: