ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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
 $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 ilFormPropertyGUI\$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.
+ Here is the call graph for this function:

Member Function Documentation

◆ __buildDaysSelect()

ilTypicalLearningTimeInputGUI::__buildDaysSelect (   $sel_day)

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

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

Referenced by insert().

128  {
129  for ($i = 0;$i <= 31;$i++) {
130  $options[$i] = sprintf('%02d', $i);
131  }
132  return ilUtil::formSelect($sel_day, $this->getPostVar() . '[d]', $options, false, true);
133  }
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
if(!isset($_REQUEST['ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
Definition: as_login.php:20
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __buildMonthsSelect()

ilTypicalLearningTimeInputGUI::__buildMonthsSelect (   $sel_month)

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

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

Referenced by insert().

119  {
120  for ($i = 0;$i <= 24;$i++) {
121  $options[$i] = sprintf('%02d', $i);
122  }
123  return ilUtil::formSelect($sel_month, $this->getPostVar() . '[mo]', $options, false, true);
124  }
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
if(!isset($_REQUEST['ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
Definition: as_login.php:20
+ 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 95 of file class.ilTypicalLearningTimeInputGUI.php.

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

96  {
97  global $lng;
98 
99  $_POST[$this->getPostVar()][0] = (int) ilUtil::stripSlashes($_POST[$this->getPostVar()][0]);
100  $_POST[$this->getPostVar()][1] = (int) ilUtil::stripSlashes($_POST[$this->getPostVar()][1]);
101  $_POST[$this->getPostVar()][2] = (int) ilUtil::stripSlashes($_POST[$this->getPostVar()][2]);
102  $_POST[$this->getPostVar()][3] = (int) ilUtil::stripSlashes($_POST[$this->getPostVar()][3]);
103  if (isset($_POST[$this->getPostVar()][4])) {
104  $_POST[$this->getPostVar()][4] = (int) ilUtil::stripSlashes($_POST[$this->getPostVar()][4]);
105  }
106 
107  // check required
108  $v = $_POST[$this->getPostVar()];
109  if ($this->getRequired() && $v[0] == 0 && $v[1] == 0 &&
110  $v[2] == 0 && $v[3] == 0 && (int) $v[4] == 0) {
111  $this->setAlert($lng->txt("msg_input_is_required"));
112  return false;
113  }
114 
115  return true;
116  }
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 75 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 138 of file class.ilTypicalLearningTimeInputGUI.php.

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

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

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

86  {
87  $this->setValue($a_values[$this->getPostVar()]);
88  }
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  $this->setValue(array(0,0,0,0,0));
62  if ($a_value != "") {
63  $this->valid = false;
64  }
65  } else {
66  $this->setValue($tlt);
67  }
68  }
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: