ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilRecurrenceInputGUI Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilRecurrenceInputGUI:
+ Collaboration diagram for ilRecurrenceInputGUI:

Public Member Functions

 __construct (string $a_title, string $a_postvar)
 
 checkInput ()
 
 setRecurrence (ilCalendarRecurrence $a_rec)
 
 getRecurrence ()
 
 allowUnlimitedRecurrences (bool $a_status)
 Allow unlimited recurrences. More...
 
 isUnlimitedRecurrenceAllowed ()
 
 setEnabledSubForms (array $a_sub_forms)
 set enabled subforms More...
 
 getEnabledSubForms ()
 
 insert (ilTemplate $a_tpl)
 
- Public Member Functions inherited from ilCustomInputGUI
 __construct (string $a_title="", string $a_postvar="")
 
 setHtml (string $a_html)
 
 getHtml ()
 
 setValueByArray (array $a_values)
 
 insert (ilTemplate $a_tpl)
 
 setSkipRequiredCheck (bool $skip)
 
 checkInput ()
 
 getInput ()
 
- Public Member Functions inherited from ilSubEnabledFormPropertyGUI
 addSubItem (ilFormPropertyGUI $a_item)
 
 getSubItems ()
 
 getSubInputItemsRecursive ()
 returns a flat array of possibly existing subitems recursively More...
 
 checkSubItemsInput ()
 Check SubItems. More...
 
 getSubForm ()
 
 getItemByPostVar (string $a_post_var)
 
- Public Member Functions inherited from ilFormPropertyGUI
 __construct (string $a_title="", string $a_postvar="")
 
 executeCommand ()
 
 getType ()
 
 setTitle (string $a_title)
 
 getTitle ()
 
 setPostVar (string $a_postvar)
 
 getPostVar ()
 
 getFieldId ()
 
 setInfo (string $a_info)
 
 getInfo ()
 
 setAlert (string $a_alert)
 
 getAlert ()
 
 setRequired (bool $a_required)
 
 getRequired ()
 
 setDisabled (bool $a_disabled)
 
 getDisabled ()
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 setParentForm (ilPropertyFormGUI $a_parentform)
 
 getParentForm ()
 
 setParent (ilFormPropertyGUI $a_val)
 
 getParent ()
 
 getSubForm ()
 
 hideSubForm ()
 
 setHiddenTitle (string $a_val)
 
 getHiddenTitle ()
 
 getItemByPostVar (string $a_post_var)
 Get item by post var. More...
 
 serializeData ()
 
 unserializeData (string $a_data)
 
 setParentTable ($a_val)
 Set parent table. More...
 
 getParentTable ()
 Get parent table. More...
 
 writeToSession ()
 
 clearFromSession ()
 
 readFromSession ()
 
 getHiddenTag (string $a_post_var, string $a_value)
 
 setMulti (bool $a_multi, bool $a_sortable=false, bool $a_addremove=true)
 
 getMulti ()
 
 setMultiValues (array $a_values)
 
 getMultiValues ()
 
 getContentOutsideFormTag ()
 Get content that has to reside outside of the parent form tag, e.g. More...
 
 stripSlashesAddSpaceFallback (string $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...
 
 setRequestParam (string $key, $val)
 This writes the request (aka post) values. More...
 

Protected Member Functions

 getRecurrenceInputByTypeAsInt (string $input)
 
 getRecurrenceInputByTypeAsString (string $input)
 
 loadRecurrence ()
 
 buildWeekDaySelection (ilTemplate $tpl)
 build weekday checkboxes More...
 
 buildMonthlyByDaySelection (ilTemplate $tpl)
 build monthly by day list (e.g second monday) More...
 
 buildMonthlyByMonthDaySelection (ilTemplate $tpl)
 build monthly bymonthday selection More...
 
 buildYearlyByMonthDaySelection (ilTemplate $tpl)
 
 buildYearlyByDaySelection (ilTemplate $tpl)
 
 buildUntilSelection (ilTemplate $tpl)
 build selection for ending date More...
 
- Protected Member Functions inherited from ilFormPropertyGUI
 setType (string $a_type)
 
 checkParentFormTable ()
 
 getSessionKey ()
 
 getMultiIconsHTML ()
 
 int ($key)
 
 intArray ($key)
 
 str ($key)
 
 raw ($key)
 
 strArray ($key)
 
 arrayArray ($key)
 
 isRequestParamArray (string $key)
 
 getRequestParam (string $key, Refinery\Transformation $t)
 

Protected Attributes

const REC_LIMITED = 2
 
const REC_UNLIMITED = 1
 
ilCalendarRecurrence $recurrence
 
ilObjUser $user
 
ilCalendarUserSettings $user_settings
 
bool $allow_unlimited_recurrences = true
 
array $enabled_subforms
 
- Protected Attributes inherited from ilCustomInputGUI
bool $skip_required_check = false
 
string $html = ""
 
- Protected Attributes inherited from ilSubEnabledFormPropertyGUI
array $sub_items = array()
 
- Protected Attributes inherited from ilFormPropertyGUI
array $set_params = []
 
ilTable2GUI $parent_table = null
 
ilFormPropertyGUI $parent_gui = null
 
ilCtrl $ctrl
 
ilLanguage $lng
 
string $type = ""
 
string $title = ""
 
string $postvar = ""
 
string $info = ""
 
string $alert = ""
 
bool $required = false
 
ilPropertyFormGUI $parentform = null
 
string $hidden_title = ""
 
bool $multi = false
 
bool $multi_sortable = false
 
bool $multi_addremove = true
 
array $multi_values = []
 
RequestInterface $request
 
HTTP Services $http
 
Refinery Factory $refinery = null
 
bool $disabled = false
 
ilGlobalTemplateInterface $global_tpl = null
 

Additional Inherited Members

- Static Public Member Functions inherited from ilFormPropertyGUI
static removeProhibitedCharacters (string $a_text)
 Remove prohibited characters see #19159. More...
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning This class represents an input GUI for recurring events/appointments (course events or calendar appointments)

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 28 of file class.ilRecurrenceInputGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilRecurrenceInputGUI::__construct ( string  $a_title,
string  $a_postvar 
)

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

References $DIC, ILIAS\GlobalScreen\Provider\__construct(), ilCalendarUserSettings\_getInstanceByUserId(), ILIAS\Repository\lng(), and ILIAS\Repository\user().

47  {
48  global $DIC;
49 
50  $DIC->ui()->mainTemplate()->addJavaScript("./Services/Calendar/js/recurrence_input.js");
51  $this->user = $DIC->user();
52  $this->user_settings = ilCalendarUserSettings::_getInstanceByUserId($this->user->getId());
53  $this->recurrence = new ilCalendarRecurrence();
54  parent::__construct($a_title, $a_postvar);
55  $this->lng->loadLanguageModule('dateplaner');
56  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getInstanceByUserId(int $a_user_id)
global $DIC
Definition: feed.php:28
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ allowUnlimitedRecurrences()

ilRecurrenceInputGUI::allowUnlimitedRecurrences ( bool  $a_status)

Allow unlimited recurrences.

Definition at line 240 of file class.ilRecurrenceInputGUI.php.

240  : void
241  {
242  $this->allow_unlimited_recurrences = $a_status;
243  }

◆ buildMonthlyByDaySelection()

ilRecurrenceInputGUI::buildMonthlyByDaySelection ( ilTemplate  $tpl)
protected

build monthly by day list (e.g second monday)

Definition at line 374 of file class.ilRecurrenceInputGUI.php.

References $i, ilCalendarUtil\_numericDayToString(), ilLegacyFormElementsUtil\formSelect(), ILIAS\Repository\lng(), and HTML_Template_IT\setVariable().

Referenced by insert().

374  : void
375  {
376  $byday_list = $this->recurrence->getBYDAYList();
377  $chosen_num_day = 1;
378  $chosen_day = 'MO';
379  $chosen = false;
380  foreach ($byday_list as $byday) {
381  if (preg_match('/^(-?\d)([A-Z][A-Z])/', $byday, $parsed) === 1) {
382  $chosen = true;
383  $chosen_num_day = $parsed[1];
384  $chosen_day = $parsed[2];
385  }
386  }
387  // check for last day
388  if (count($this->recurrence->getBYMONTHDAYList()) == 1) {
389  $bymonthday = $this->recurrence->getBYMONTHDAY();
390  if (in_array($bymonthday, array(1, 2, 3, 4, 5, -1))) {
391  $chosen = true;
392  $chosen_num_day = $bymonthday;
393  $chosen_day = 9;
394  }
395  }
396  // Check for first, second... last weekday
397  if (count($this->recurrence->getBYSETPOSList()) == 1) {
398  $bysetpos = $this->recurrence->getBYSETPOS();
399  if (in_array($bysetpos, array(1, 2, 3, 4, 5, -1))) {
400  if ($this->recurrence->getBYDAYList() == array('MO', 'TU', 'WE', 'TH', 'FR')) {
401  $chosen = true;
402  $chosen_num_day = $bysetpos;
403  $chosen_day = 8;
404  }
405  }
406  }
407 
408  if ($chosen) {
409  $tpl->setVariable('M_BYDAY_CHECKED', 'checked="checked"');
410  }
411 
412  $num_options = array(
413  1 => $this->lng->txt('cal_first'),
414  2 => $this->lng->txt('cal_second'),
415  3 => $this->lng->txt('cal_third'),
416  4 => $this->lng->txt('cal_fourth'),
417  5 => $this->lng->txt('cal_fifth'),
418  -1 => $this->lng->txt('cal_last')
419  );
420 
421  $tpl->setVariable('SELECT_BYDAY_NUM_MONTHLY', ilLegacyFormElementsUtil::formSelect(
422  $chosen_num_day,
423  'monthly_byday_num',
424  $num_options,
425  false,
426  true,
427  0,
428  '',
429  array('onchange' => "ilUpdateSubTypeSelection('sub_monthly_radio_1');")
430  ));
431 
432  $days = array(0 => 'SU', 1 => 'MO', 2 => 'TU', 3 => 'WE', 4 => 'TH', 5 => 'FR', 6 => 'SA', 7 => 'SU');
433 
434  for ($i = $this->user_settings->getWeekStart(); $i < 7 + $this->user_settings->getWeekStart(); $i++) {
435  $days_select[$days[$i]] = ilCalendarUtil::_numericDayToString($i);
436  }
437  $days_select[8] = $this->lng->txt('cal_weekday');
438  $days_select[9] = $this->lng->txt('cal_day_of_month');
439  $tpl->setVariable('SEL_BYDAY_DAY_MONTHLY', ilLegacyFormElementsUtil::formSelect(
440  $chosen_day,
441  'monthly_byday_day',
442  $days_select,
443  false,
444  true,
445  0,
446  '',
447  array('onchange' => "ilUpdateSubTypeSelection('sub_monthly_radio_1');")
448  ));
449  }
static formSelect( $selected, string $varname, array $options, bool $multiple=false, bool $direct_text=false, int $size=0, string $style_class="", array $attribs=[], bool $disabled=false)
Builds a select form field with options and shows the selected option first.
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:514
static _numericDayToString(int $a_day, bool $a_long=true)
$i
Definition: metadata.php:41
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildMonthlyByMonthDaySelection()

ilRecurrenceInputGUI::buildMonthlyByMonthDaySelection ( ilTemplate  $tpl)
protected

build monthly bymonthday selection

Definition at line 454 of file class.ilRecurrenceInputGUI.php.

References $i, ilLegacyFormElementsUtil\formSelect(), ILIAS\Repository\lng(), and HTML_Template_IT\setVariable().

Referenced by insert().

454  : void
455  {
456  $tpl->setVariable('TXT_IN', $this->lng->txt('cal_in'));
457 
458  $chosen_day = 1;
459  $chosen = false;
460  if (count($bymonthday = $this->recurrence->getBYMONTHDAYList()) == 1) {
461  foreach ($bymonthday as $mday) {
462  if ($mday > 0 and $mday < 32) {
463  $chosen = true;
464  $chosen_day = $mday;
465  }
466  }
467  }
468 
469  if ($chosen) {
470  $tpl->setVariable('M_BYMONTHDAY_CHECKED', 'checked="checked"');
471  }
472  $options = [];
473  for ($i = 1; $i < 32; $i++) {
474  $options[$i] = $i;
475  }
476  $tpl->setVariable('SELECT_BYMONTHDAY', ilLegacyFormElementsUtil::formSelect(
477  $chosen_day,
478  'monthly_bymonthday',
479  $options,
480  false,
481  true,
482  0,
483  '',
484  array('onchange' => "ilUpdateSubTypeSelection('sub_monthly_radio_2');")
485  ));
486  }
static formSelect( $selected, string $varname, array $options, bool $multiple=false, bool $direct_text=false, int $size=0, string $style_class="", array $attribs=[], bool $disabled=false)
Builds a select form field with options and shows the selected option first.
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:514
$i
Definition: metadata.php:41
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildUntilSelection()

ilRecurrenceInputGUI::buildUntilSelection ( ilTemplate  $tpl)
protected

build selection for ending date

Definition at line 619 of file class.ilRecurrenceInputGUI.php.

References isUnlimitedRecurrenceAllowed(), ILIAS\Repository\lng(), and HTML_Template_IT\setVariable().

Referenced by insert().

619  : void
620  {
621  if ($this->isUnlimitedRecurrenceAllowed()) {
622  $tpl->setVariable('TXT_NO_ENDING', $this->lng->txt('cal_no_ending'));
623  }
624 
625  $tpl->setVariable('TXT_UNTIL_CREATE', $this->lng->txt('cal_create'));
626  $tpl->setVariable('TXT_APPOINTMENTS', $this->lng->txt('cal_appointments'));
627 
628  $tpl->setVariable('VAL_COUNT', $this->recurrence->getFrequenceUntilCount() ?:
629  2);
630 
631  if ($this->recurrence->getFrequenceUntilDate()) {
632  $tpl->setVariable('UNTIL_END_CHECKED', 'checked="checked"');
633  } elseif ($this->recurrence->getFrequenceUntilCount() or !$this->isUnlimitedRecurrenceAllowed()) {
634  $tpl->setVariable('UNTIL_COUNT_CHECKED', 'checked="checked"');
635  } else {
636  $tpl->setVariable('UNTIL_NO_CHECKED', 'checked="checked"');
637  }
638 
639  $tpl->setVariable('TXT_UNTIL_END', $this->lng->txt('cal_repeat_until'));
640  $dt = new ilDateTimeInputGUI('', 'until_end');
641  // no proper subform
642  // $dt->setRequired(true);
643  $dt->setDate(
644  $this->recurrence->getFrequenceUntilDate() ?: null
645  );
646  $tpl->setVariable('UNTIL_END_DATE', $dt->getTableFilterHTML());
647  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:514
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildWeekDaySelection()

ilRecurrenceInputGUI::buildWeekDaySelection ( ilTemplate  $tpl)
protected

build weekday checkboxes

Definition at line 346 of file class.ilRecurrenceInputGUI.php.

References $i, ilCalendarUtil\_numericDayToString(), ILIAS\Repository\lng(), ilTemplate\parseCurrentBlock(), ilTemplate\setCurrentBlock(), and HTML_Template_IT\setVariable().

Referenced by insert().

346  : void
347  {
348  $days = array(0 => 'SU', 1 => 'MO', 2 => 'TU', 3 => 'WE', 4 => 'TH', 5 => 'FR', 6 => 'SA', 7 => 'SU');
349 
350  $checked_days = array();
351  foreach ($this->recurrence->getBYDAYList() as $byday) {
352  if (in_array($byday, $days)) {
353  $checked_days[] = $byday;
354  }
355  }
356 
357  for ($i = $this->user_settings->getWeekStart(); $i < 7 + $this->user_settings->getWeekStart(); $i++) {
358  $tpl->setCurrentBlock('byday_simple');
359 
360  if (in_array($days[$i], $checked_days)) {
361  $tpl->setVariable('BYDAY_WEEKLY_CHECKED', 'checked="checked"');
362  }
363  $tpl->setVariable('TXT_ON', $this->lng->txt('cal_on'));
364  $tpl->setVariable('DAY_COUNT', $i);
365  $tpl->setVariable('BYDAY_WEEKLY_VAL', $days[$i]);
366  $tpl->setVariable('TXT_DAY_SHORT', ilCalendarUtil::_numericDayToString($i, false));
367  $tpl->parseCurrentBlock();
368  }
369  }
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:514
static _numericDayToString(int $a_day, bool $a_long=true)
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
$i
Definition: metadata.php:41
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildYearlyByDaySelection()

ilRecurrenceInputGUI::buildYearlyByDaySelection ( ilTemplate  $tpl)
protected

Definition at line 540 of file class.ilRecurrenceInputGUI.php.

References $i, ilCalendarUtil\_numericDayToString(), ilCalendarUtil\_numericMonthToString(), ilLegacyFormElementsUtil\formSelect(), ILIAS\Repository\lng(), and HTML_Template_IT\setVariable().

Referenced by insert().

540  : void
541  {
542  $tpl->setVariable('TXT_ON_THE', $this->lng->txt('cal_on_the'));
543 
544  $chosen_num_day = 1;
545  $chosen_day = 'MO';
546  $chosen = false;
547  foreach ($this->recurrence->getBYDAYList() as $byday) {
548  if (preg_match('/^(-?\d)([A-Z][A-Z])/', $byday, $parsed) === 1) {
549  $chosen = true;
550  $chosen_num_day = $parsed[1];
551  $chosen_day = $parsed[2];
552  }
553  }
554 
555  $num_options = array(
556  1 => $this->lng->txt('cal_first'),
557  2 => $this->lng->txt('cal_second'),
558  3 => $this->lng->txt('cal_third'),
559  4 => $this->lng->txt('cal_fourth'),
560  5 => $this->lng->txt('cal_fifth'),
561  -1 => $this->lng->txt('cal_last')
562  );
563 
564  $tpl->setVariable('SELECT_BYDAY_NUM_YEARLY', ilLegacyFormElementsUtil::formSelect(
565  $chosen_num_day,
566  'yearly_byday_num',
567  $num_options,
568  false,
569  true,
570  0,
571  '',
572  array('onchange' => "ilUpdateSubTypeSelection('sub_yearly_radio_1');")
573  ));
574 
575  $days = array(0 => 'SU', 1 => 'MO', 2 => 'TU', 3 => 'WE', 4 => 'TH', 5 => 'FR', 6 => 'SA', 7 => 'SU');
576  $days_select = [];
577  for ($i = $this->user_settings->getWeekStart(); $i < 7 + $this->user_settings->getWeekStart(); $i++) {
578  $days_select[$days[$i]] = ilCalendarUtil::_numericDayToString($i);
579  }
580  $tpl->setVariable('SELECT_BYDAY_DAY_YEARLY', ilLegacyFormElementsUtil::formSelect(
581  $chosen_day,
582  'yearly_byday',
583  $days_select,
584  false,
585  true,
586  0,
587  '',
588  array('onchange' => "ilUpdateSubTypeSelection('sub_yearly_radio_1');")
589  ));
590 
591  $chosen = false;
592  $chosen_month = 1;
593  foreach ($this->recurrence->getBYMONTHList() as $month) {
594  if ($this->recurrence->getBYMONTHDAYList()) {
595  $chosen_month = $month;
596  $chosen = true;
597  break;
598  }
599  }
600  $options = array();
601  for ($m = 1; $m < 13; $m++) {
602  $options[$m] = ilCalendarUtil::_numericMonthToString($m);
603  }
604  $tpl->setVariable('SELECT_BYMONTH_BYDAY', ilLegacyFormElementsUtil::formSelect(
605  $chosen_month,
606  'yearly_bymonth_byday',
607  $options,
608  false,
609  true,
610  0,
611  '',
612  array('onchange' => "ilUpdateSubTypeSelection('sub_yearly_radio_1');")
613  ));
614  }
static _numericMonthToString(int $a_month, bool $a_long=true)
numeric month to string
static formSelect( $selected, string $varname, array $options, bool $multiple=false, bool $direct_text=false, int $size=0, string $style_class="", array $attribs=[], bool $disabled=false)
Builds a select form field with options and shows the selected option first.
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:514
static _numericDayToString(int $a_day, bool $a_long=true)
$i
Definition: metadata.php:41
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildYearlyByMonthDaySelection()

ilRecurrenceInputGUI::buildYearlyByMonthDaySelection ( ilTemplate  $tpl)
protected

Definition at line 488 of file class.ilRecurrenceInputGUI.php.

References $i, ilCalendarUtil\_numericMonthToString(), ilLegacyFormElementsUtil\formSelect(), ILIAS\Repository\lng(), and HTML_Template_IT\setVariable().

Referenced by insert().

488  : void
489  {
490  $tpl->setVariable('TXT_Y_EVERY', $this->lng->txt('cal_every'));
491 
492  $chosen = false;
493  $chosen_month = 1;
494  $chosen_day = 1;
495  foreach ($this->recurrence->getBYMONTHList() as $month) {
496  if ($this->recurrence->getBYMONTHDAYList()) {
497  $chosen_month = $month;
498  $chosen = true;
499  break;
500  }
501  }
502  foreach ($this->recurrence->getBYMONTHDAYList() as $day) {
503  $chosen_day = $day;
504  }
505  $options = [];
506  for ($i = 1; $i < 32; $i++) {
507  $options[$i] = $i;
508  }
509  $tpl->setVariable('SELECT_BYMONTHDAY_NUM_YEARLY', ilLegacyFormElementsUtil::formSelect(
510  $chosen_day,
511  'yearly_bymonthday',
512  $options,
513  false,
514  true,
515  0,
516  '',
517  array('onchange' => "ilUpdateSubTypeSelection('sub_yearly_radio_2');")
518  ));
519 
520  $options = array();
521  for ($m = 1; $m < 13; $m++) {
522  $options[$m] = ilCalendarUtil::_numericMonthToString($m);
523  }
524  $tpl->setVariable('SELECT_BYMONTH_YEARLY', ilLegacyFormElementsUtil::formSelect(
525  $chosen_month,
526  'yearly_bymonth_by_monthday',
527  $options,
528  false,
529  true,
530  0,
531  '',
532  array('onchange' => "ilUpdateSubTypeSelection('sub_yearly_radio_2');")
533  ));
534 
535  if ($chosen) {
536  $tpl->setVariable('Y_BYMONTHDAY_CHECKED', 'checked="checked"');
537  }
538  }
static _numericMonthToString(int $a_month, bool $a_long=true)
numeric month to string
static formSelect( $selected, string $varname, array $options, bool $multiple=false, bool $direct_text=false, int $size=0, string $style_class="", array $attribs=[], bool $disabled=false)
Builds a select form field with options and shows the selected option first.
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:514
$i
Definition: metadata.php:41
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkInput()

ilRecurrenceInputGUI::checkInput ( )

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

References $DIC, ilFormPropertyGUI\$lng, ilCalendarRecurrence\FREQ_NONE, getRecurrenceInputByTypeAsInt(), getRecurrenceInputByTypeAsString(), ILIAS\Repository\lng(), loadRecurrence(), and ilFormPropertyGUI\setAlert().

61  : bool
62  {
63  global $DIC;
64 
65  $lng = $DIC['lng'];
66 
67  if (!$this->loadRecurrence()) {
68  return false;
69  }
70 
72  return true;
73  }
74 
75  if (
76  (
77  $this->getRecurrenceInputByTypeAsInt('until_type') === 0 ||
78  $this->getRecurrenceInputByTypeAsInt('until_type') == self::REC_LIMITED
79  ) &&
80  (
81  $this->getRecurrenceInputByTypeAsInt('count') <= 0 ||
82  $this->getRecurrenceInputByTypeAsInt('count') >= 100
83  )
84  ) {
85  $this->setAlert($this->lng->txt("cal_rec_err_limit"));
86  return false;
87  }
88  return true;
89  }
getRecurrenceInputByTypeAsInt(string $input)
global $DIC
Definition: feed.php:28
getRecurrenceInputByTypeAsString(string $input)
+ Here is the call graph for this function:

◆ getEnabledSubForms()

ilRecurrenceInputGUI::getEnabledSubForms ( )

Definition at line 260 of file class.ilRecurrenceInputGUI.php.

References $enabled_subforms.

Referenced by insert().

260  : array
261  {
263  }
+ Here is the caller graph for this function:

◆ getRecurrence()

ilRecurrenceInputGUI::getRecurrence ( )

Definition at line 232 of file class.ilRecurrenceInputGUI.php.

References $recurrence.

Referenced by loadRecurrence().

233  {
234  return $this->recurrence;
235  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilCalendarRecurrence $recurrence
+ Here is the caller graph for this function:

◆ getRecurrenceInputByTypeAsInt()

ilRecurrenceInputGUI::getRecurrenceInputByTypeAsInt ( string  $input)
protected

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

References ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

Referenced by checkInput(), and loadRecurrence().

91  : int
92  {
93  if ($this->http->wrapper()->post()->has($input)) {
94  return $this->http->wrapper()->post()->retrieve(
95  $input,
96  $this->refinery->kindlyTo()->int()
97  );
98  }
99  return 0;
100  }
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRecurrenceInputByTypeAsString()

ilRecurrenceInputGUI::getRecurrenceInputByTypeAsString ( string  $input)
protected

Definition at line 102 of file class.ilRecurrenceInputGUI.php.

References ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

Referenced by checkInput(), and loadRecurrence().

102  : string
103  {
104  if ($this->http->wrapper()->post()->has($input)) {
105  return $this->http->wrapper()->post()->retrieve(
106  $input,
107  $this->refinery->kindlyTo()->string()
108  );
109  }
110  return '';
111  }
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ insert()

ilRecurrenceInputGUI::insert ( ilTemplate  $a_tpl)

Definition at line 268 of file class.ilRecurrenceInputGUI.php.

References $tpl, buildMonthlyByDaySelection(), buildMonthlyByMonthDaySelection(), buildUntilSelection(), buildWeekDaySelection(), buildYearlyByDaySelection(), buildYearlyByMonthDaySelection(), ilLegacyFormElementsUtil\formSelect(), ilCalendarRecurrence\FREQ_DAILY, ilCalendarRecurrence\FREQ_MONTHLY, ilCalendarRecurrence\FREQ_WEEKLY, ilCalendarRecurrence\FREQ_YEARLY, getEnabledSubForms(), ILIAS\Repository\lng(), ilTemplate\parseCurrentBlock(), ilTemplate\setCurrentBlock(), and HTML_Template_IT\setVariable().

268  : void
269  {
270  $tpl = new ilTemplate('tpl.recurrence_input.html', true, true, 'Services/Calendar');
271 
272  $options = array('NONE' => $this->lng->txt('cal_no_recurrence'));
273  if (in_array(ilCalendarRecurrence::FREQ_DAILY, $this->getEnabledSubForms())) {
274  $options[ilCalendarRecurrence::FREQ_DAILY] = $this->lng->txt('cal_daily');
275  }
276  if (in_array(ilCalendarRecurrence::FREQ_WEEKLY, $this->getEnabledSubForms())) {
277  $options[ilCalendarRecurrence::FREQ_WEEKLY] = $this->lng->txt('cal_weekly');
278  }
279  if (in_array(ilCalendarRecurrence::FREQ_MONTHLY, $this->getEnabledSubForms())) {
280  $options[ilCalendarRecurrence::FREQ_MONTHLY] = $this->lng->txt('cal_monthly');
281  }
282  if (in_array(ilCalendarRecurrence::FREQ_YEARLY, $this->getEnabledSubForms())) {
283  $options[ilCalendarRecurrence::FREQ_YEARLY] = $this->lng->txt('cal_yearly');
284  }
285 
286  $tpl->setVariable(
287  'FREQUENCE',
289  $this->recurrence->getFrequenceType(),
290  'frequence',
291  $options,
292  false,
293  true,
294  0,
295  '',
296  ['onchange' => 'ilHideFrequencies();', 'id' => 'il_recurrence_1']
297  )
298  );
299 
300  $tpl->setVariable('TXT_EVERY', $this->lng->txt('cal_every'));
301 
302  // DAILY
303  if (in_array(ilCalendarRecurrence::FREQ_DAILY, $this->getEnabledSubForms())) {
304  $tpl->setVariable('TXT_DAILY_FREQ_UNIT', $this->lng->txt('cal_day_s'));
305  $tpl->setVariable('COUNT_DAILY_VAL', $this->recurrence->getInterval());
306  }
307 
308  // WEEKLY
309  if (in_array(ilCalendarRecurrence::FREQ_WEEKLY, $this->getEnabledSubForms())) {
310  $tpl->setVariable('TXT_WEEKLY_FREQ_UNIT', $this->lng->txt('cal_week_s'));
311  $tpl->setVariable('COUNT_WEEKLY_VAL', $this->recurrence->getInterval());
312  $this->buildWeekDaySelection($tpl);
313  }
314 
315  // MONTHLY
316  if (in_array(ilCalendarRecurrence::FREQ_MONTHLY, $this->getEnabledSubForms())) {
317  $tpl->setVariable('TXT_MONTHLY_FREQ_UNIT', $this->lng->txt('cal_month_s'));
318  $tpl->setVariable('COUNT_MONTHLY_VAL', $this->recurrence->getInterval());
319  $tpl->setVariable('TXT_ON_THE', $this->lng->txt('cal_on_the'));
320  $tpl->setVariable('TXT_BYMONTHDAY', $this->lng->txt('cal_on_the'));
321  $tpl->setVariable('TXT_OF_THE_MONTH', $this->lng->txt('cal_of_the_month'));
324  }
325 
326  // YEARLY
327  if (in_array(ilCalendarRecurrence::FREQ_YEARLY, $this->getEnabledSubForms())) {
328  $tpl->setVariable('TXT_YEARLY_FREQ_UNIT', $this->lng->txt('cal_year_s'));
329  $tpl->setVariable('COUNT_YEARLY_VAL', $this->recurrence->getInterval());
330  $tpl->setVariable('TXT_ON_THE', $this->lng->txt('cal_on_the'));
333  }
334 
335  // UNTIL
336  $this->buildUntilSelection($tpl);
337 
338  $a_tpl->setCurrentBlock("prop_custom");
339  $a_tpl->setVariable("CUSTOM_CONTENT", $tpl->get());
340  $a_tpl->parseCurrentBlock();
341  }
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
buildWeekDaySelection(ilTemplate $tpl)
build weekday checkboxes
static formSelect( $selected, string $varname, array $options, bool $multiple=false, bool $direct_text=false, int $size=0, string $style_class="", array $attribs=[], bool $disabled=false)
Builds a select form field with options and shows the selected option first.
buildYearlyByMonthDaySelection(ilTemplate $tpl)
buildYearlyByDaySelection(ilTemplate $tpl)
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:514
buildUntilSelection(ilTemplate $tpl)
build selection for ending date
buildMonthlyByMonthDaySelection(ilTemplate $tpl)
build monthly bymonthday selection
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
buildMonthlyByDaySelection(ilTemplate $tpl)
build monthly by day list (e.g second monday)
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41
+ Here is the call graph for this function:

◆ isUnlimitedRecurrenceAllowed()

ilRecurrenceInputGUI::isUnlimitedRecurrenceAllowed ( )

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

References $allow_unlimited_recurrences.

Referenced by buildUntilSelection().

245  : bool
246  {
248  }
+ Here is the caller graph for this function:

◆ loadRecurrence()

ilRecurrenceInputGUI::loadRecurrence ( )
protected

Definition at line 113 of file class.ilRecurrenceInputGUI.php.

References ilCalendarRecurrence\FREQ_DAILY, ilCalendarRecurrence\FREQ_MONTHLY, ilCalendarRecurrence\FREQ_WEEKLY, ilCalendarRecurrence\FREQ_YEARLY, getRecurrence(), getRecurrenceInputByTypeAsInt(), getRecurrenceInputByTypeAsString(), ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

Referenced by checkInput().

113  : bool
114  {
115  if (!$this->getRecurrence() instanceof ilCalendarRecurrence) {
116  return false;
117  }
118  switch ($this->getRecurrenceInputByTypeAsString('frequence')) {
120  $this->getRecurrence()->setFrequenceType($this->getRecurrenceInputByTypeAsString('frequence'));
121  $this->getRecurrence()->setInterval($this->getRecurrenceInputByTypeAsInt('count_DAILY'));
122  break;
123 
125  $this->getRecurrence()->setFrequenceType($this->getRecurrenceInputByTypeAsString('frequence'));
126  $this->getRecurrence()->setInterval($this->getRecurrenceInputByTypeAsInt('count_WEEKLY'));
127 
128  $weekly_days = [];
129  if ($this->http->wrapper()->post()->has('byday_WEEKLY')) {
130  $weekly_days = $this->http->wrapper()->post()->retrieve(
131  'byday_WEEKLY',
132  $this->refinery->kindlyTo()->dictOf(
133  $this->refinery->kindlyTo()->string()
134  )
135  );
136  }
137  if ($weekly_days !== []) {
138  $this->getRecurrence()->setBYDAY(implode(',', $weekly_days));
139  }
140  break;
141 
143  $this->getRecurrence()->setFrequenceType($this->getRecurrenceInputByTypeAsString('frequence'));
144  $this->getRecurrence()->setInterval($this->getRecurrenceInputByTypeAsInt('count_MONTHLY'));
145  switch ($this->getRecurrenceInputByTypeAsInt('subtype_MONTHLY')) {
146  case 0:
147  // nothing to do;
148  break;
149  case 1:
150  switch ($this->getRecurrenceInputByTypeAsString('monthly_byday_day')) {
151  case '8':
152  // Weekday
153  $this->getRecurrence()->setBYSETPOS($this->getRecurrenceInputByTypeAsString('monthly_byday_num'));
154  $this->getRecurrence()->setBYDAY('MO,TU,WE,TH,FR');
155  break;
156 
157  case '9':
158  // Day of month
159  $this->getRecurrence()->setBYMONTHDAY($this->getRecurrenceInputByTypeAsString('monthly_byday_num'));
160  break;
161 
162  default:
163  $this->getRecurrence()->setBYDAY(
164  $this->getRecurrenceInputByTypeAsString('monthly_byday_num') .
165  $this->getRecurrenceInputByTypeAsString('monthly_byday_day')
166  );
167  break;
168  }
169  break;
170 
171  case 2:
172  $this->getRecurrence()->setBYMONTHDAY($this->getRecurrenceInputByTypeAsString('monthly_bymonthday'));
173  break;
174  }
175  break;
176 
178  $this->getRecurrence()->setFrequenceType($this->getRecurrenceInputByTypeAsString('frequence'));
179  $this->getRecurrence()->setInterval($this->getRecurrenceInputByTypeAsInt('count_YEARLY'));
180  switch ($this->getRecurrenceInputByTypeAsInt('subtype_YEARLY')) {
181  case 0:
182  // nothing to do;
183  break;
184 
185  case 1:
186  $this->getRecurrence()->setBYDAY(
187  $this->getRecurrenceInputByTypeAsString('yearly_byday_num') .
188  $this->getRecurrenceInputByTypeAsString('yearly_byday')
189  );
190  $this->getRecurrence()->setBYMONTH($this->getRecurrenceInputByTypeAsString('yearly_bymonth_byday'));
191  break;
192 
193  case 2:
194  $this->getRecurrence()->setBYMONTH($this->getRecurrenceInputByTypeAsString('yearly_bymonthday'));
195  $this->getRecurrence()->setBYMONTHDAY($this->getRecurrenceInputByTypeAsString('yearly_bymonthday'));
196  break;
197  }
198  break;
199  }
200 
201  // UNTIL
202  switch ($this->getRecurrenceInputByTypeAsInt('until_type')) {
203  case 1:
204  $this->getRecurrence()->setFrequenceUntilDate(null);
205  // nothing to do
206  break;
207 
208  case 2:
209  $this->getRecurrence()->setFrequenceUntilDate(null);
210  $this->getRecurrence()->setFrequenceUntilCount($this->getRecurrenceInputByTypeAsInt('count'));
211  break;
212 
213  case 3:
214  $dt = new ilDateTimeInputGUI('', 'until_end');
215  $dt->setRequired(true);
216  if ($dt->checkInput()) {
217  $this->getRecurrence()->setFrequenceUntilCount(0);
218  $this->getRecurrence()->setFrequenceUntilDate($dt->getDate());
219  } else {
220  return false;
221  }
222  break;
223  }
224  return true;
225  }
getRecurrenceInputByTypeAsInt(string $input)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static http()
Fetches the global http state from ILIAS.
getRecurrenceInputByTypeAsString(string $input)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setEnabledSubForms()

ilRecurrenceInputGUI::setEnabledSubForms ( array  $a_sub_forms)

set enabled subforms

Parameters
array(IL_CAL_FREQ_DAILY,FREQ_WEEKLY...)
Returns
void

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

Referenced by ilConsultationHoursGUI\initFormSequence().

255  : void
256  {
257  $this->enabled_subforms = $a_sub_forms;
258  }
+ Here is the caller graph for this function:

◆ setRecurrence()

ilRecurrenceInputGUI::setRecurrence ( ilCalendarRecurrence  $a_rec)

Definition at line 227 of file class.ilRecurrenceInputGUI.php.

227  : void
228  {
229  $this->recurrence = $a_rec;
230  }

Field Documentation

◆ $allow_unlimited_recurrences

bool ilRecurrenceInputGUI::$allow_unlimited_recurrences = true
protected

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

Referenced by isUnlimitedRecurrenceAllowed().

◆ $enabled_subforms

array ilRecurrenceInputGUI::$enabled_subforms
protected

◆ $recurrence

ilCalendarRecurrence ilRecurrenceInputGUI::$recurrence
protected

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

Referenced by getRecurrence().

◆ $user

ilObjUser ilRecurrenceInputGUI::$user
protected

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

◆ $user_settings

ilCalendarUserSettings ilRecurrenceInputGUI::$user_settings
protected

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

◆ REC_LIMITED

const ilRecurrenceInputGUI::REC_LIMITED = 2
protected

Definition at line 30 of file class.ilRecurrenceInputGUI.php.

◆ REC_UNLIMITED

const ilRecurrenceInputGUI::REC_UNLIMITED = 1
protected

Definition at line 31 of file class.ilRecurrenceInputGUI.php.


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