ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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

 $lng
 
 $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
 $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 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

Reimplemented from ilFormPropertyGUI.

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

56 {
57 global $DIC;
58
59 $this->lng = $DIC->language();
60 parent::__construct($a_title, $a_postvar);
61 $this->setType("duration");
62 }
setType($a_type)
Set Type.
global $DIC
Definition: saml.php:7

References $DIC, and ilFormPropertyGUI\setType().

+ 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

Reimplemented from ilFormPropertyGUI.

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

288 {
290
291 $_POST[$this->getPostVar()]["MM"] =
292 ilUtil::stripSlashes($_POST[$this->getPostVar()]["MM"]);
293 $_POST[$this->getPostVar()]["dd"] =
294 ilUtil::stripSlashes($_POST[$this->getPostVar()]["dd"]);
295 $_POST[$this->getPostVar()]["hh"] =
296 ilUtil::stripSlashes($_POST[$this->getPostVar()]["hh"]);
297 $_POST[$this->getPostVar()]["mm"] =
298 ilUtil::stripSlashes($_POST[$this->getPostVar()]["mm"]);
299 $_POST[$this->getPostVar()]["ss"] =
300 ilUtil::stripSlashes($_POST[$this->getPostVar()]["ss"]);
301
302 return true;
303 }
$_POST["username"]
getPostVar()
Get Post Variable.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled

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

+ Here is the call graph for this function:

◆ getDays()

ilDurationInputGUI::getDays ( )

Get Days.

Returns
int Days

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

References $days.

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

+ Here is the caller graph for this function:

◆ getHours()

ilDurationInputGUI::getHours ( )

Get Hours.

Returns
int Hours

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

References $hours.

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

+ Here is the caller graph for this function:

◆ getMinutes()

ilDurationInputGUI::getMinutes ( )

Get Minutes.

Returns
int Minutes

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

References $minutes.

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

+ Here is the caller graph for this function:

◆ getMonths()

ilDurationInputGUI::getMonths ( )

get months

@access public

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

References $months.

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

+ Here is the caller graph for this function:

◆ getSeconds()

ilDurationInputGUI::getSeconds ( )

Get Seconds.

Returns
int Seconds

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

References $seconds.

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

+ Here is the caller graph for this function:

◆ getShowDays()

ilDurationInputGUI::getShowDays ( )

Get Show Days.

Returns
boolean Show Days

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

References $showdays.

Referenced by getValueInSeconds(), and render().

+ Here is the caller graph for this function:

◆ getShowHours()

ilDurationInputGUI::getShowHours ( )

Get Show Hours.

Returns
boolean Show Hours

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

References $showhours.

Referenced by getValueInSeconds(), and render().

+ Here is the caller graph for this function:

◆ getShowMinutes()

ilDurationInputGUI::getShowMinutes ( )

Get Show Minutes.

Returns
boolean Show Minutes

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

References $showminutes.

Referenced by getValueInSeconds(), and render().

+ Here is the caller graph for this function:

◆ getShowMonths()

ilDurationInputGUI::getShowMonths ( )

Get show months.

@access public

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

References $showmonths.

Referenced by getValueInSeconds(), and render().

+ Here is the caller graph for this function:

◆ getShowSeconds()

ilDurationInputGUI::getShowSeconds ( )

Get Show Seconds.

Returns
boolean Show Seconds

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

References $showseconds.

Referenced by getValueInSeconds(), and render().

+ Here is the caller graph for this function:

◆ getTableFilterHTML()

ilDurationInputGUI::getTableFilterHTML ( )

Get HTML for table filter.

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

452 {
453 $html = $this->render();
454 return $html;
455 }
render()
Insert property html.
$html
Definition: example_001.php:87

References $html, and render().

+ Here is the call graph for this function:

◆ getValueInSeconds()

ilDurationInputGUI::getValueInSeconds ( )

Get combined value in seconds.

Returns
int

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

491 {
492 $value = 0;
493 if ($this->getShowMonths()) {
494 $value += $this->getMonths()*30*24*60*60;
495 }
496 if ($this->getShowDays()) {
497 $value += $this->getDays()*24*60*60;
498 }
499 if ($this->getShowHours()) {
500 $value += $this->getHours()*60*60;
501 }
502 if ($this->getShowMinutes()) {
503 $value += $this->getMinutes()*60;
504 }
505 if ($this->getShowSeconds()) {
506 $value += $this->getSeconds();
507 }
508 return $value;
509 }
getShowMinutes()
Get Show Minutes.
getShowMonths()
Get show months.
getShowSeconds()
Get Show Seconds.

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

+ Here is the call graph for this function:

◆ insert()

ilDurationInputGUI::insert (   $a_tpl)

Insert property html.

Returns
int Size

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

311 {
312 $html = $this->render();
313
314 $a_tpl->setCurrentBlock("prop_generic");
315 $a_tpl->setVariable("PROP_GENERIC", $html);
316 $a_tpl->parseCurrentBlock();
317 }

References $html, and render().

+ Here is the call graph for this function:

◆ render()

ilDurationInputGUI::render ( )

Insert property html.

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

324 {
326
327 $tpl = new ilTemplate("tpl.prop_duration.html", true, true, "Services/Form");
328
329 if ($this->getShowMonths()) {
330 $tpl->setCurrentBlock("dur_months");
331 $tpl->setVariable("TXT_MONTHS", $lng->txt("form_months"));
332 $val = array();
333 for ($i=0; $i<=36; $i++) {
334 $val[$i] = $i;
335 }
336 $tpl->setVariable(
337 "SELECT_MONTHS",
339 $this->getMonths(),
340 $this->getPostVar() . "[MM]",
341 $val,
342 false,
343 true,
344 0,
345 '',
346 '',
347 $this->getDisabled()
348 )
349 );
350 $tpl->parseCurrentBlock();
351 }
352 if ($this->getShowDays()) {
353 $tpl->setCurrentBlock("dur_days");
354 $tpl->setVariable("TXT_DAYS", $lng->txt("form_days"));
355 $val = array();
356 for ($i=0; $i<=366; $i++) {
357 $val[$i] = $i;
358 }
359 $tpl->setVariable(
360 "SELECT_DAYS",
362 $this->getDays(),
363 $this->getPostVar() . "[dd]",
364 $val,
365 false,
366 true,
367 0,
368 '',
369 '',
370 $this->getDisabled()
371 )
372 );
373 $tpl->parseCurrentBlock();
374 }
375 if ($this->getShowHours()) {
376 $tpl->setCurrentBlock("dur_hours");
377 $tpl->setVariable("TXT_HOURS", $lng->txt("form_hours"));
378 $val = array();
379 for ($i=0; $i<=23; $i++) {
380 $val[$i] = $i;
381 }
382 $tpl->setVariable(
383 "SELECT_HOURS",
385 $this->getHours(),
386 $this->getPostVar() . "[hh]",
387 $val,
388 false,
389 true,
390 0,
391 '',
392 '',
393 $this->getDisabled()
394 )
395 );
396 $tpl->parseCurrentBlock();
397 }
398 if ($this->getShowMinutes()) {
399 $tpl->setCurrentBlock("dur_minutes");
400 $tpl->setVariable("TXT_MINUTES", $lng->txt("form_minutes"));
401 $val = array();
402 for ($i=0; $i<=59; $i++) {
403 $val[$i] = $i;
404 }
405 $tpl->setVariable(
406 "SELECT_MINUTES",
408 $this->getMinutes(),
409 $this->getPostVar() . "[mm]",
410 $val,
411 false,
412 true,
413 0,
414 '',
415 '',
416 $this->getDisabled()
417 )
418 );
419 $tpl->parseCurrentBlock();
420 }
421 if ($this->getShowSeconds()) {
422 $tpl->setCurrentBlock("dur_seconds");
423 $tpl->setVariable("TXT_SECONDS", $lng->txt("form_seconds"));
424 $val = array();
425 for ($i=0; $i<=59; $i++) {
426 $val[$i] = $i;
427 }
428 $tpl->setVariable(
429 "SELECT_SECONDS",
431 $this->getSeconds(),
432 $this->getPostVar() . "[ss]",
433 $val,
434 false,
435 true,
436 0,
437 '',
438 '',
439 $this->getDisabled()
440 )
441 );
442 $tpl->parseCurrentBlock();
443 }
444
445 return $tpl->get();
446 }
$tpl
Definition: ilias.php:10
special template class to simplify handling of ITX/PEAR
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

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

Referenced by getTableFilterHTML(), and insert().

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

◆ serializeData()

ilDurationInputGUI::serializeData ( )

serialize data

Reimplemented from ilFormPropertyGUI.

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

461 {
462 $data = array("months" => $this->getMonths(),
463 "days" => $this->getDays(),
464 "hours" => $this->getHours(),
465 "minutes" => $this->getMinutes(),
466 "seconds" => $this->getSeconds());
467
468 return serialize($data);
469 }

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

+ Here is the call graph for this function:

◆ setDays()

ilDurationInputGUI::setDays (   $a_days)

Set Days.

Parameters
int$a_daysDays

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

70 {
71 $this->days = $a_days;
72 }

Referenced by setValueByArray(), and unserializeData().

+ Here is the caller graph for this function:

◆ setHours()

ilDurationInputGUI::setHours (   $a_hours)

Set Hours.

Parameters
int$a_hoursHours

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

90 {
91 $this->hours = $a_hours;
92 }
hours($input)
Definition: memcachestat.php:7

References hours().

Referenced by setValueByArray(), and unserializeData().

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

◆ setMinutes()

ilDurationInputGUI::setMinutes (   $a_minutes)

Set Minutes.

Parameters
int$a_minutesMinutes

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

110 {
111 $this->minutes = $a_minutes;
112 }

Referenced by setValueByArray(), and unserializeData().

+ Here is the caller graph for this function:

◆ setMonths()

ilDurationInputGUI::setMonths (   $a_months)

set months

@access public

Parameters
intmonths

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

142 {
143 $this->months = $a_months;
144 }

Referenced by setValueByArray(), and unserializeData().

+ Here is the caller graph for this function:

◆ setSeconds()

ilDurationInputGUI::setSeconds (   $a_seconds)

Set Seconds.

Parameters
int$a_secondsSeconds

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

130 {
131 $this->seconds = $a_seconds;
132 }

Referenced by setValueByArray(), and unserializeData().

+ Here is the caller graph for this function:

◆ setShowDays()

ilDurationInputGUI::setShowDays (   $a_showdays)

Set Show Days.

Parameters
boolean$a_showdaysShow Days

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

194 {
195 $this->showdays = $a_showdays;
196 }

◆ setShowHours()

ilDurationInputGUI::setShowHours (   $a_showhours)

Set Show Hours.

Parameters
boolean$a_showhoursShow Hours

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

214 {
215 $this->showhours = $a_showhours;
216 }

◆ setShowMinutes()

ilDurationInputGUI::setShowMinutes (   $a_showminutes)

Set Show Minutes.

Parameters
boolean$a_showminutesShow Minutes

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

234 {
235 $this->showminutes = $a_showminutes;
236 }

◆ setShowMonths()

ilDurationInputGUI::setShowMonths (   $a_show_months)

Set show months.

@access public

Parameters
boolean$a_show_month

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

174 {
175 $this->showmonths = $a_show_months;
176 }

◆ setShowSeconds()

ilDurationInputGUI::setShowSeconds (   $a_showseconds)

Set Show Seconds.

Parameters
boolean$a_showsecondsShow Seconds

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

254 {
255 $this->showseconds = $a_showseconds;
256 }

◆ setValueByArray()

ilDurationInputGUI::setValueByArray (   $a_values)

Set value by array.

Parameters
array$a_valuesvalue array

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

274 {
275 $this->setMonths($a_values[$this->getPostVar()]["MM"]);
276 $this->setDays($a_values[$this->getPostVar()]["dd"]);
277 $this->setHours($a_values[$this->getPostVar()]["hh"]);
278 $this->setMinutes($a_values[$this->getPostVar()]["mm"]);
279 $this->setSeconds($a_values[$this->getPostVar()]["ss"]);
280 }
setMinutes($a_minutes)
Set Minutes.
setMonths($a_months)
set months
setHours($a_hours)
Set Hours.
setSeconds($a_seconds)
Set Seconds.

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

+ Here is the call graph for this function:

◆ unserializeData()

ilDurationInputGUI::unserializeData (   $a_data)

unserialize data

Reimplemented from ilFormPropertyGUI.

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

475 {
476 $data = unserialize($a_data);
477
478 $this->setMonths($data["months"]);
479 $this->setDays($data["days"]);
480 $this->setHours($data["hours"]);
481 $this->setMinutes($data["minutes"]);
482 $this->setSeconds($data["seconds"]);
483 }

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

+ Here is the call graph for this function:

Field Documentation

◆ $days

ilDurationInputGUI::$days = 0
protected

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

Referenced by getDays().

◆ $hours

ilDurationInputGUI::$hours = 0
protected

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

Referenced by getHours().

◆ $lng

ilDurationInputGUI::$lng
protected

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

Referenced by checkInput(), and render().

◆ $minutes

ilDurationInputGUI::$minutes = 0
protected

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

Referenced by getMinutes().

◆ $months

ilDurationInputGUI::$months = 0
protected

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

Referenced by getMonths().

◆ $seconds

ilDurationInputGUI::$seconds = 0
protected

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

Referenced by getSeconds().

◆ $showdays

ilDurationInputGUI::$showdays = false
protected

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

Referenced by getShowDays().

◆ $showhours

ilDurationInputGUI::$showhours = true
protected

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

Referenced by getShowHours().

◆ $showminutes

ilDurationInputGUI::$showminutes = true
protected

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

Referenced by getShowMinutes().

◆ $showmonths

ilDurationInputGUI::$showmonths = false
protected

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

Referenced by getShowMonths().

◆ $showseconds

ilDurationInputGUI::$showseconds = false
protected

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

Referenced by getShowSeconds().


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