ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilDurationInputGUI Class Reference

This class represents a duration (typical hh:mm:ss) property in a property form. More...

+ Inheritance diagram for ilDurationInputGUI:
+ Collaboration diagram for ilDurationInputGUI:

Public Member Functions

 __construct ($a_title="", $a_postvar="")
 Constructor. More...
 
 setDays ($a_days)
 Set Days. More...
 
 getDays ()
 Get Days. More...
 
 setHours ($a_hours)
 Set Hours. More...
 
 getHours ()
 Get Hours. More...
 
 setMinutes ($a_minutes)
 Set Minutes. More...
 
 getMinutes ()
 Get Minutes. More...
 
 setSeconds ($a_seconds)
 Set Seconds. More...
 
 setMonths ($a_months)
 set months More...
 
 getMonths ()
 get months More...
 
 getSeconds ()
 Get Seconds. More...
 
 setShowMonths ($a_show_months)
 Set show months. More...
 
 getShowMonths ()
 Get show months. More...
 
 setShowDays ($a_showdays)
 Set Show Days. More...
 
 getShowDays ()
 Get Show Days. More...
 
 setShowHours ($a_showhours)
 Set Show Hours. More...
 
 getShowHours ()
 Get Show Hours. More...
 
 setShowMinutes ($a_showminutes)
 Set Show Minutes. More...
 
 getShowMinutes ()
 Get Show Minutes. More...
 
 setShowSeconds ($a_showseconds)
 Set Show Seconds. More...
 
 getShowSeconds ()
 Get Show Seconds. More...
 
 setValueByArray ($a_values)
 Set value by array. More...
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 insert ($a_tpl)
 Insert property html. More...
 
 render ()
 Insert property html. More...
 
 getTableFilterHTML ()
 Get HTML for table filter. More...
 
 serializeData ()
 serialize data More...
 
 unserializeData ($a_data)
 unserialize data More...
 
 getValueInSeconds ()
 Get combined value in seconds. 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

 $months = 0
 
 $days = 0
 
 $hours = 0
 
 $minutes = 0
 
 $seconds = 0
 
 $showmonths = false
 
 $showdays = false
 
 $showhours = true
 
 $showminutes = true
 
 $showseconds = false
 
- 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 duration (typical hh:mm:ss) 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.ilDurationInputGUI.php.

Constructor & Destructor Documentation

◆ __construct()

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

Constructor.

Parameters
string$a_titleTitle
string$a_postvarPost Variable

Definition at line 50 of file class.ilDurationInputGUI.php.

References ilFormPropertyGUI\setType().

51  {
52  parent::__construct($a_title, $a_postvar);
53  $this->setType("duration");
54  }
setType($a_type)
Set Type.
+ Here is the call graph for this function:

Member Function Documentation

◆ checkInput()

ilDurationInputGUI::checkInput ( )

Check input, strip slashes etc.

set alert, if input is not ok.

Returns
boolean Input ok, true/false

Definition at line 279 of file class.ilDurationInputGUI.php.

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

280  {
281  global $lng;
282 
283  $_POST[$this->getPostVar()]["MM"] =
284  ilUtil::stripSlashes($_POST[$this->getPostVar()]["MM"]);
285  $_POST[$this->getPostVar()]["dd"] =
286  ilUtil::stripSlashes($_POST[$this->getPostVar()]["dd"]);
287  $_POST[$this->getPostVar()]["hh"] =
288  ilUtil::stripSlashes($_POST[$this->getPostVar()]["hh"]);
289  $_POST[$this->getPostVar()]["mm"] =
290  ilUtil::stripSlashes($_POST[$this->getPostVar()]["mm"]);
291  $_POST[$this->getPostVar()]["ss"] =
292  ilUtil::stripSlashes($_POST[$this->getPostVar()]["ss"]);
293 
294  return true;
295  }
getPostVar()
Get Post Variable.
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:

◆ getDays()

ilDurationInputGUI::getDays ( )

Get Days.

Returns
int Days

Definition at line 71 of file class.ilDurationInputGUI.php.

References $days.

Referenced by getValueInSeconds(), render(), and serializeData().

72  {
73  return $this->days;
74  }
+ Here is the caller graph for this function:

◆ getHours()

ilDurationInputGUI::getHours ( )

Get Hours.

Returns
int Hours

Definition at line 91 of file class.ilDurationInputGUI.php.

References $hours.

Referenced by getValueInSeconds(), render(), and serializeData().

92  {
93  return $this->hours;
94  }
+ Here is the caller graph for this function:

◆ getMinutes()

ilDurationInputGUI::getMinutes ( )

Get Minutes.

Returns
int Minutes

Definition at line 111 of file class.ilDurationInputGUI.php.

References $minutes.

Referenced by getValueInSeconds(), render(), and serializeData().

112  {
113  return $this->minutes;
114  }
+ Here is the caller graph for this function:

◆ getMonths()

ilDurationInputGUI::getMonths ( )

get months

public

Definition at line 144 of file class.ilDurationInputGUI.php.

References $months.

Referenced by getValueInSeconds(), render(), and serializeData().

145  {
146  return $this->months;
147  }
+ Here is the caller graph for this function:

◆ getSeconds()

ilDurationInputGUI::getSeconds ( )

Get Seconds.

Returns
int Seconds

Definition at line 154 of file class.ilDurationInputGUI.php.

References $seconds.

Referenced by getValueInSeconds(), render(), and serializeData().

155  {
156  return $this->seconds;
157  }
+ Here is the caller graph for this function:

◆ getShowDays()

ilDurationInputGUI::getShowDays ( )

Get Show Days.

Returns
boolean Show Days

Definition at line 195 of file class.ilDurationInputGUI.php.

References $showdays.

Referenced by getValueInSeconds(), and render().

196  {
197  return $this->showdays;
198  }
+ Here is the caller graph for this function:

◆ getShowHours()

ilDurationInputGUI::getShowHours ( )

Get Show Hours.

Returns
boolean Show Hours

Definition at line 215 of file class.ilDurationInputGUI.php.

References $showhours.

Referenced by getValueInSeconds(), and render().

216  {
217  return $this->showhours;
218  }
+ Here is the caller graph for this function:

◆ getShowMinutes()

ilDurationInputGUI::getShowMinutes ( )

Get Show Minutes.

Returns
boolean Show Minutes

Definition at line 235 of file class.ilDurationInputGUI.php.

References $showminutes.

Referenced by getValueInSeconds(), and render().

236  {
237  return $this->showminutes;
238  }
+ Here is the caller graph for this function:

◆ getShowMonths()

ilDurationInputGUI::getShowMonths ( )

Get show months.

public

Definition at line 175 of file class.ilDurationInputGUI.php.

References $showmonths.

Referenced by getValueInSeconds(), and render().

176  {
177  return $this->showmonths;
178  }
+ Here is the caller graph for this function:

◆ getShowSeconds()

ilDurationInputGUI::getShowSeconds ( )

Get Show Seconds.

Returns
boolean Show Seconds

Definition at line 255 of file class.ilDurationInputGUI.php.

References $showseconds.

Referenced by getValueInSeconds(), and render().

256  {
257  return $this->showseconds;
258  }
+ Here is the caller graph for this function:

◆ getTableFilterHTML()

ilDurationInputGUI::getTableFilterHTML ( )

Get HTML for table filter.

Definition at line 398 of file class.ilDurationInputGUI.php.

References $html, and render().

399  {
400  $html = $this->render();
401  return $html;
402  }
render()
Insert property html.
$html
Definition: example_001.php:87
+ Here is the call graph for this function:

◆ getValueInSeconds()

ilDurationInputGUI::getValueInSeconds ( )

Get combined value in seconds.

Returns
int

Definition at line 437 of file class.ilDurationInputGUI.php.

References getDays(), getHours(), getMinutes(), getMonths(), getSeconds(), getShowDays(), getShowHours(), getShowMinutes(), getShowMonths(), and getShowSeconds().

438  {
439  $value = 0;
440  if($this->getShowMonths())
441  {
442  $value += $this->getMonths()*30*24*60*60;
443  }
444  if($this->getShowDays())
445  {
446  $value += $this->getDays()*24*60*60;
447  }
448  if($this->getShowHours())
449  {
450  $value += $this->getHours()*60*60;
451  }
452  if($this->getShowMinutes())
453  {
454  $value += $this->getMinutes()*60;
455  }
456  if($this->getShowSeconds())
457  {
458  $value += $this->getSeconds();
459  }
460  return $value;
461  }
getShowMonths()
Get show months.
getShowSeconds()
Get Show Seconds.
getShowHours()
Get Show Hours.
getShowMinutes()
Get Show Minutes.
+ Here is the call graph for this function:

◆ insert()

ilDurationInputGUI::insert (   $a_tpl)

Insert property html.

Returns
int Size

Definition at line 302 of file class.ilDurationInputGUI.php.

References $html, and render().

303  {
304  $html = $this->render();
305 
306  $a_tpl->setCurrentBlock("prop_generic");
307  $a_tpl->setVariable("PROP_GENERIC", $html);
308  $a_tpl->parseCurrentBlock();
309  }
render()
Insert property html.
$html
Definition: example_001.php:87
+ Here is the call graph for this function:

◆ render()

ilDurationInputGUI::render ( )

Insert property html.

Definition at line 315 of file class.ilDurationInputGUI.php.

References $lng, $tpl, array, ilUtil\formSelect(), getDays(), ilFormPropertyGUI\getDisabled(), getHours(), getMinutes(), getMonths(), ilFormPropertyGUI\getPostVar(), getSeconds(), getShowDays(), getShowHours(), getShowMinutes(), getShowMonths(), and getShowSeconds().

Referenced by getTableFilterHTML(), and insert().

316  {
317  global $lng;
318 
319  $tpl = new ilTemplate("tpl.prop_duration.html", true, true, "Services/Form");
320 
321  if($this->getShowMonths())
322  {
323  $tpl->setCurrentBlock("dur_months");
324  $tpl->setVariable("TXT_MONTHS", $lng->txt("form_months"));
325  $val = array();
326  for ($i=0; $i<=36; $i++)
327  {
328  $val[$i] = $i;
329  }
330  $tpl->setVariable("SELECT_MONTHS",
331  ilUtil::formSelect($this->getMonths(), $this->getPostVar()."[MM]",
332  $val, false, true, 0, '', '', $this->getDisabled()));
333  $tpl->parseCurrentBlock();
334  }
335  if ($this->getShowDays())
336  {
337  $tpl->setCurrentBlock("dur_days");
338  $tpl->setVariable("TXT_DAYS", $lng->txt("form_days"));
339  $val = array();
340  for ($i=0; $i<=366; $i++)
341  {
342  $val[$i] = $i;
343  }
344  $tpl->setVariable("SELECT_DAYS",
345  ilUtil::formSelect($this->getDays(), $this->getPostVar()."[dd]",
346  $val, false, true, 0, '', '', $this->getDisabled()));
347  $tpl->parseCurrentBlock();
348  }
349  if ($this->getShowHours())
350  {
351  $tpl->setCurrentBlock("dur_hours");
352  $tpl->setVariable("TXT_HOURS", $lng->txt("form_hours"));
353  $val = array();
354  for ($i=0; $i<=23; $i++)
355  {
356  $val[$i] = $i;
357  }
358  $tpl->setVariable("SELECT_HOURS",
359  ilUtil::formSelect($this->getHours(), $this->getPostVar()."[hh]",
360  $val, false, true, 0, '', '', $this->getDisabled()));
361  $tpl->parseCurrentBlock();
362  }
363  if ($this->getShowMinutes())
364  {
365  $tpl->setCurrentBlock("dur_minutes");
366  $tpl->setVariable("TXT_MINUTES", $lng->txt("form_minutes"));
367  $val = array();
368  for ($i=0; $i<=59; $i++)
369  {
370  $val[$i] = $i;
371  }
372  $tpl->setVariable("SELECT_MINUTES",
373  ilUtil::formSelect($this->getMinutes(), $this->getPostVar()."[mm]",
374  $val, false, true, 0, '', '', $this->getDisabled()));
375  $tpl->parseCurrentBlock();
376  }
377  if ($this->getShowSeconds())
378  {
379  $tpl->setCurrentBlock("dur_seconds");
380  $tpl->setVariable("TXT_SECONDS", $lng->txt("form_seconds"));
381  $val = array();
382  for ($i=0; $i<=59; $i++)
383  {
384  $val[$i] = $i;
385  }
386  $tpl->setVariable("SELECT_SECONDS",
387  ilUtil::formSelect($this->getSeconds(), $this->getPostVar()."[ss]",
388  $val, false, true, 0, '', '', $this->getDisabled()));
389  $tpl->parseCurrentBlock();
390  }
391 
392  return $tpl->get();
393  }
getShowMonths()
Get show months.
getShowSeconds()
Get Show Seconds.
getPostVar()
Get Post Variable.
getShowHours()
Get Show Hours.
global $tpl
Definition: ilias.php:8
getShowMinutes()
Get Show Minutes.
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.
special template class to simplify handling of ITX/PEAR
Create styles array
The data for the language used.
global $lng
Definition: privfeed.php:17
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ serializeData()

ilDurationInputGUI::serializeData ( )

serialize data

Definition at line 407 of file class.ilDurationInputGUI.php.

References $data, array, getDays(), getHours(), getMinutes(), getMonths(), and getSeconds().

408  {
409  $data = array("months" => $this->getMonths(),
410  "days" => $this->getDays(),
411  "hours" => $this->getHours(),
412  "minutes" => $this->getMinutes(),
413  "seconds" => $this->getSeconds());
414 
415  return serialize($data);
416  }
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ setDays()

ilDurationInputGUI::setDays (   $a_days)

Set Days.

Parameters
int$a_daysDays

Definition at line 61 of file class.ilDurationInputGUI.php.

Referenced by setValueByArray(), and unserializeData().

62  {
63  $this->days = $a_days;
64  }
+ Here is the caller graph for this function:

◆ setHours()

ilDurationInputGUI::setHours (   $a_hours)

Set Hours.

Parameters
int$a_hoursHours

Definition at line 81 of file class.ilDurationInputGUI.php.

Referenced by setValueByArray(), ilAdvancedMDRecordGUI\showECSStart(), and unserializeData().

82  {
83  $this->hours = $a_hours;
84  }
+ Here is the caller graph for this function:

◆ setMinutes()

ilDurationInputGUI::setMinutes (   $a_minutes)

Set Minutes.

Parameters
int$a_minutesMinutes

Definition at line 101 of file class.ilDurationInputGUI.php.

Referenced by setValueByArray(), and unserializeData().

102  {
103  $this->minutes = $a_minutes;
104  }
+ Here is the caller graph for this function:

◆ setMonths()

ilDurationInputGUI::setMonths (   $a_months)

set months

public

Parameters
intmonths

Definition at line 133 of file class.ilDurationInputGUI.php.

Referenced by setValueByArray(), and unserializeData().

134  {
135  $this->months = $a_months;
136  }
+ Here is the caller graph for this function:

◆ setSeconds()

ilDurationInputGUI::setSeconds (   $a_seconds)

Set Seconds.

Parameters
int$a_secondsSeconds

Definition at line 121 of file class.ilDurationInputGUI.php.

References seconds.

Referenced by setValueByArray(), and unserializeData().

122  {
123  $this->seconds = $a_seconds;
124  }
sprintf('%.4f', $callTime) seconds
+ Here is the caller graph for this function:

◆ setShowDays()

ilDurationInputGUI::setShowDays (   $a_showdays)

Set Show Days.

Parameters
boolean$a_showdaysShow Days

Definition at line 185 of file class.ilDurationInputGUI.php.

Referenced by ilECSSettingsGUI\initSettingsForm().

186  {
187  $this->showdays = $a_showdays;
188  }
+ Here is the caller graph for this function:

◆ setShowHours()

ilDurationInputGUI::setShowHours (   $a_showhours)

Set Show Hours.

Parameters
boolean$a_showhoursShow Hours

Definition at line 205 of file class.ilDurationInputGUI.php.

206  {
207  $this->showhours = $a_showhours;
208  }

◆ setShowMinutes()

ilDurationInputGUI::setShowMinutes (   $a_showminutes)

Set Show Minutes.

Parameters
boolean$a_showminutesShow Minutes

Definition at line 225 of file class.ilDurationInputGUI.php.

Referenced by ilConsultationHoursGUI\initFormSequence().

226  {
227  $this->showminutes = $a_showminutes;
228  }
+ Here is the caller graph for this function:

◆ setShowMonths()

ilDurationInputGUI::setShowMonths (   $a_show_months)

Set show months.

public

Parameters
boolean$a_show_month

Definition at line 165 of file class.ilDurationInputGUI.php.

166  {
167  $this->showmonths = $a_show_months;
168  }

◆ setShowSeconds()

ilDurationInputGUI::setShowSeconds (   $a_showseconds)

Set Show Seconds.

Parameters
boolean$a_showsecondsShow Seconds

Definition at line 245 of file class.ilDurationInputGUI.php.

246  {
247  $this->showseconds = $a_showseconds;
248  }

◆ setValueByArray()

ilDurationInputGUI::setValueByArray (   $a_values)

Set value by array.

Parameters
array$a_valuesvalue array

Definition at line 265 of file class.ilDurationInputGUI.php.

References ilFormPropertyGUI\getPostVar(), setDays(), setHours(), setMinutes(), setMonths(), and setSeconds().

266  {
267  $this->setMonths($a_values[$this->getPostVar()]["MM"]);
268  $this->setDays($a_values[$this->getPostVar()]["dd"]);
269  $this->setHours($a_values[$this->getPostVar()]["hh"]);
270  $this->setMinutes($a_values[$this->getPostVar()]["mm"]);
271  $this->setSeconds($a_values[$this->getPostVar()]["ss"]);
272  }
setDays($a_days)
Set Days.
getPostVar()
Get Post Variable.
setHours($a_hours)
Set Hours.
setMinutes($a_minutes)
Set Minutes.
setMonths($a_months)
set months
setSeconds($a_seconds)
Set Seconds.
+ Here is the call graph for this function:

◆ unserializeData()

ilDurationInputGUI::unserializeData (   $a_data)

unserialize data

Definition at line 421 of file class.ilDurationInputGUI.php.

References $data, setDays(), setHours(), setMinutes(), setMonths(), and setSeconds().

422  {
423  $data = unserialize($a_data);
424 
425  $this->setMonths($data["months"]);
426  $this->setDays($data["days"]);
427  $this->setHours($data["hours"]);
428  $this->setMinutes($data["minutes"]);
429  $this->setSeconds($data["seconds"]);
430  }
setDays($a_days)
Set Days.
setHours($a_hours)
Set Hours.
setMinutes($a_minutes)
Set Minutes.
setMonths($a_months)
set months
setSeconds($a_seconds)
Set Seconds.
+ Here is the call graph for this function:

Field Documentation

◆ $days

ilDurationInputGUI::$days = 0
protected

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

Referenced by getDays().

◆ $hours

ilDurationInputGUI::$hours = 0
protected

Definition at line 35 of file class.ilDurationInputGUI.php.

Referenced by getHours().

◆ $minutes

ilDurationInputGUI::$minutes = 0
protected

Definition at line 36 of file class.ilDurationInputGUI.php.

Referenced by getMinutes().

◆ $months

ilDurationInputGUI::$months = 0
protected

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

Referenced by getMonths().

◆ $seconds

ilDurationInputGUI::$seconds = 0
protected

Definition at line 37 of file class.ilDurationInputGUI.php.

Referenced by getSeconds().

◆ $showdays

ilDurationInputGUI::$showdays = false
protected

Definition at line 39 of file class.ilDurationInputGUI.php.

Referenced by getShowDays().

◆ $showhours

ilDurationInputGUI::$showhours = true
protected

Definition at line 40 of file class.ilDurationInputGUI.php.

Referenced by getShowHours().

◆ $showminutes

ilDurationInputGUI::$showminutes = true
protected

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

Referenced by getShowMinutes().

◆ $showmonths

ilDurationInputGUI::$showmonths = false
protected

Definition at line 38 of file class.ilDurationInputGUI.php.

Referenced by getShowMonths().

◆ $showseconds

ilDurationInputGUI::$showseconds = false
protected

Definition at line 42 of file class.ilDurationInputGUI.php.

Referenced by getShowSeconds().


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