ILIAS  trunk Revision v11.0_alpha-1723-g8e69f309bab
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilRecurrenceInputGUI Class Reference

This class represents an input GUI for recurring events/appointments (course events or calendar appointments) 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
 symbol ()
 
 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 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 27 of file class.ilRecurrenceInputGUI.php.

Constructor & Destructor Documentation

◆ __construct()

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

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

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

46  {
47  global $DIC;
48 
49  $DIC->ui()->mainTemplate()->addJavaScript("assets/js/recurrence_input.js");
50  $this->user = $DIC->user();
51  $this->user_settings = ilCalendarUserSettings::_getInstanceByUserId($this->user->getId());
52  $this->recurrence = new ilCalendarRecurrence();
53  parent::__construct($a_title, $a_postvar);
54  $this->lng->loadLanguageModule('dateplaner');
55  }
Model of calendar entry recurrcences based on iCalendar-RFC-5545.
static _getInstanceByUserId(int $a_user_id)
global $DIC
Definition: shib_login.php:22
__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 239 of file class.ilRecurrenceInputGUI.php.

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

◆ buildMonthlyByDaySelection()

ilRecurrenceInputGUI::buildMonthlyByDaySelection ( ilTemplate  $tpl)
protected

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

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

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

Referenced by insert().

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

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

Referenced by insert().

453  : void
454  {
455  $tpl->setVariable('TXT_IN', $this->lng->txt('cal_in'));
456 
457  $chosen_day = 1;
458  $chosen = false;
459  if (count($bymonthday = $this->recurrence->getBYMONTHDAYList()) == 1) {
460  foreach ($bymonthday as $mday) {
461  if ($mday > 0 and $mday < 32) {
462  $chosen = true;
463  $chosen_day = $mday;
464  }
465  }
466  }
467 
468  if ($chosen) {
469  $tpl->setVariable('M_BYMONTHDAY_CHECKED', 'checked="checked"');
470  }
471  $options = [];
472  for ($i = 1; $i < 32; $i++) {
473  $options[$i] = $i;
474  }
475  $tpl->setVariable('SELECT_BYMONTHDAY', ilLegacyFormElementsUtil::formSelect(
476  $chosen_day,
477  'monthly_bymonthday',
478  $options,
479  false,
480  true,
481  0,
482  '',
483  array('onchange' => "ilUpdateSubTypeSelection('sub_monthly_radio_2');")
484  ));
485  }
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:544
+ 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 618 of file class.ilRecurrenceInputGUI.php.

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

Referenced by insert().

618  : void
619  {
620  if ($this->isUnlimitedRecurrenceAllowed()) {
621  $tpl->setVariable('TXT_NO_ENDING', $this->lng->txt('cal_no_ending'));
622  }
623 
624  $tpl->setVariable('TXT_UNTIL_CREATE', $this->lng->txt('cal_create'));
625  $tpl->setVariable('TXT_APPOINTMENTS', $this->lng->txt('cal_appointments'));
626 
627  $tpl->setVariable('VAL_COUNT', $this->recurrence->getFrequenceUntilCount() ?:
628  2);
629 
630  if ($this->recurrence->getFrequenceUntilDate()) {
631  $tpl->setVariable('UNTIL_END_CHECKED', 'checked="checked"');
632  } elseif ($this->recurrence->getFrequenceUntilCount() or !$this->isUnlimitedRecurrenceAllowed()) {
633  $tpl->setVariable('UNTIL_COUNT_CHECKED', 'checked="checked"');
634  } else {
635  $tpl->setVariable('UNTIL_NO_CHECKED', 'checked="checked"');
636  }
637 
638  $tpl->setVariable('TXT_UNTIL_END', $this->lng->txt('cal_repeat_until'));
639  $dt = new ilDateTimeInputGUI('', 'until_end');
640  // no proper subform
641  // $dt->setRequired(true);
642  $dt->setDate(
643  $this->recurrence->getFrequenceUntilDate() ?: null
644  );
645  $tpl->setVariable('UNTIL_END_DATE', $dt->getTableFilterHTML());
646  }
This class represents a date/time property in a property form.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:544
+ 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 345 of file class.ilRecurrenceInputGUI.php.

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

Referenced by insert().

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

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

Referenced by insert().

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

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

Referenced by insert().

487  : void
488  {
489  $tpl->setVariable('TXT_Y_EVERY', $this->lng->txt('cal_every'));
490 
491  $chosen = false;
492  $chosen_month = 1;
493  $chosen_day = 1;
494  foreach ($this->recurrence->getBYMONTHList() as $month) {
495  if ($this->recurrence->getBYMONTHDAYList()) {
496  $chosen_month = $month;
497  $chosen = true;
498  break;
499  }
500  }
501  foreach ($this->recurrence->getBYMONTHDAYList() as $day) {
502  $chosen_day = $day;
503  }
504  $options = [];
505  for ($i = 1; $i < 32; $i++) {
506  $options[$i] = $i;
507  }
508  $tpl->setVariable('SELECT_BYMONTHDAY_NUM_YEARLY', ilLegacyFormElementsUtil::formSelect(
509  $chosen_day,
510  'yearly_bymonthday',
511  $options,
512  false,
513  true,
514  0,
515  '',
516  array('onchange' => "ilUpdateSubTypeSelection('sub_yearly_radio_2');")
517  ));
518 
519  $options = array();
520  for ($m = 1; $m < 13; $m++) {
521  $options[$m] = ilCalendarUtil::_numericMonthToString($m);
522  }
523  $tpl->setVariable('SELECT_BYMONTH_YEARLY', ilLegacyFormElementsUtil::formSelect(
524  $chosen_month,
525  'yearly_bymonth_by_monthday',
526  $options,
527  false,
528  true,
529  0,
530  '',
531  array('onchange' => "ilUpdateSubTypeSelection('sub_yearly_radio_2');")
532  ));
533 
534  if ($chosen) {
535  $tpl->setVariable('Y_BYMONTHDAY_CHECKED', 'checked="checked"');
536  }
537  }
static _numericMonthToString(int $a_month, bool $a_long=true, ?ilLanguage $lng=null)
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:544
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkInput()

ilRecurrenceInputGUI::checkInput ( )

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

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

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

◆ getEnabledSubForms()

ilRecurrenceInputGUI::getEnabledSubForms ( )

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

References $enabled_subforms.

Referenced by insert().

259  : array
260  {
262  }
+ Here is the caller graph for this function:

◆ getRecurrence()

ilRecurrenceInputGUI::getRecurrence ( )

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

References $recurrence.

Referenced by loadRecurrence().

232  {
233  return $this->recurrence;
234  }
Model of calendar entry recurrcences based on iCalendar-RFC-5545.
ilCalendarRecurrence $recurrence
+ Here is the caller graph for this function:

◆ getRecurrenceInputByTypeAsInt()

ilRecurrenceInputGUI::getRecurrenceInputByTypeAsInt ( string  $input)
protected

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

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

Referenced by checkInput(), and loadRecurrence().

90  : int
91  {
92  if ($this->http->wrapper()->post()->has($input)) {
93  return $this->http->wrapper()->post()->retrieve(
94  $input,
95  $this->refinery->kindlyTo()->int()
96  );
97  }
98  return 0;
99  }
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 101 of file class.ilRecurrenceInputGUI.php.

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

Referenced by checkInput(), and loadRecurrence().

101  : string
102  {
103  if ($this->http->wrapper()->post()->has($input)) {
104  return $this->http->wrapper()->post()->retrieve(
105  $input,
106  $this->refinery->kindlyTo()->string()
107  );
108  }
109  return '';
110  }
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 267 of file class.ilRecurrenceInputGUI.php.

References 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().

267  : void
268  {
269  $tpl = new ilTemplate('tpl.recurrence_input.html', true, true, 'components/ILIAS/Calendar');
270 
271  $options = array('NONE' => $this->lng->txt('cal_no_recurrence'));
272  if (in_array(ilCalendarRecurrence::FREQ_DAILY, $this->getEnabledSubForms())) {
273  $options[ilCalendarRecurrence::FREQ_DAILY] = $this->lng->txt('cal_daily');
274  }
275  if (in_array(ilCalendarRecurrence::FREQ_WEEKLY, $this->getEnabledSubForms())) {
276  $options[ilCalendarRecurrence::FREQ_WEEKLY] = $this->lng->txt('cal_weekly');
277  }
278  if (in_array(ilCalendarRecurrence::FREQ_MONTHLY, $this->getEnabledSubForms())) {
279  $options[ilCalendarRecurrence::FREQ_MONTHLY] = $this->lng->txt('cal_monthly');
280  }
281  if (in_array(ilCalendarRecurrence::FREQ_YEARLY, $this->getEnabledSubForms())) {
282  $options[ilCalendarRecurrence::FREQ_YEARLY] = $this->lng->txt('cal_yearly');
283  }
284 
285  $tpl->setVariable(
286  'FREQUENCE',
288  $this->recurrence->getFrequenceType(),
289  'frequence',
290  $options,
291  false,
292  true,
293  0,
294  '',
295  ['onchange' => 'ilHideFrequencies();', 'id' => 'il_recurrence_1']
296  )
297  );
298 
299  $tpl->setVariable('TXT_EVERY', $this->lng->txt('cal_every'));
300 
301  // DAILY
302  if (in_array(ilCalendarRecurrence::FREQ_DAILY, $this->getEnabledSubForms())) {
303  $tpl->setVariable('TXT_DAILY_FREQ_UNIT', $this->lng->txt('cal_day_s'));
304  $tpl->setVariable('COUNT_DAILY_VAL', $this->recurrence->getInterval());
305  }
306 
307  // WEEKLY
308  if (in_array(ilCalendarRecurrence::FREQ_WEEKLY, $this->getEnabledSubForms())) {
309  $tpl->setVariable('TXT_WEEKLY_FREQ_UNIT', $this->lng->txt('cal_week_s'));
310  $tpl->setVariable('COUNT_WEEKLY_VAL', $this->recurrence->getInterval());
311  $this->buildWeekDaySelection($tpl);
312  }
313 
314  // MONTHLY
315  if (in_array(ilCalendarRecurrence::FREQ_MONTHLY, $this->getEnabledSubForms())) {
316  $tpl->setVariable('TXT_MONTHLY_FREQ_UNIT', $this->lng->txt('cal_month_s'));
317  $tpl->setVariable('COUNT_MONTHLY_VAL', $this->recurrence->getInterval());
318  $tpl->setVariable('TXT_ON_THE', $this->lng->txt('cal_on_the'));
319  $tpl->setVariable('TXT_BYMONTHDAY', $this->lng->txt('cal_on_the'));
320  $tpl->setVariable('TXT_OF_THE_MONTH', $this->lng->txt('cal_of_the_month'));
321  $this->buildMonthlyByDaySelection($tpl);
322  $this->buildMonthlyByMonthDaySelection($tpl);
323  }
324 
325  // YEARLY
326  if (in_array(ilCalendarRecurrence::FREQ_YEARLY, $this->getEnabledSubForms())) {
327  $tpl->setVariable('TXT_YEARLY_FREQ_UNIT', $this->lng->txt('cal_year_s'));
328  $tpl->setVariable('COUNT_YEARLY_VAL', $this->recurrence->getInterval());
329  $tpl->setVariable('TXT_ON_THE', $this->lng->txt('cal_on_the'));
330  $this->buildYearlyByMonthDaySelection($tpl);
331  $this->buildYearlyByDaySelection($tpl);
332  }
333 
334  // UNTIL
335  $this->buildUntilSelection($tpl);
336 
337  $a_tpl->setCurrentBlock("prop_custom");
338  $a_tpl->setVariable("CUSTOM_CONTENT", $tpl->get());
339  $a_tpl->parseCurrentBlock();
340  }
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:544
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)
+ Here is the call graph for this function:

◆ isUnlimitedRecurrenceAllowed()

ilRecurrenceInputGUI::isUnlimitedRecurrenceAllowed ( )

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

References $allow_unlimited_recurrences.

Referenced by buildUntilSelection().

244  : bool
245  {
247  }
+ Here is the caller graph for this function:

◆ loadRecurrence()

ilRecurrenceInputGUI::loadRecurrence ( )
protected

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

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

Referenced by checkInput().

112  : bool
113  {
114  if (!$this->getRecurrence() instanceof ilCalendarRecurrence) {
115  return false;
116  }
117  switch ($this->getRecurrenceInputByTypeAsString('frequence')) {
119  $this->getRecurrence()->setFrequenceType($this->getRecurrenceInputByTypeAsString('frequence'));
120  $this->getRecurrence()->setInterval($this->getRecurrenceInputByTypeAsInt('count_DAILY'));
121  break;
122 
124  $this->getRecurrence()->setFrequenceType($this->getRecurrenceInputByTypeAsString('frequence'));
125  $this->getRecurrence()->setInterval($this->getRecurrenceInputByTypeAsInt('count_WEEKLY'));
126 
127  $weekly_days = [];
128  if ($this->http->wrapper()->post()->has('byday_WEEKLY')) {
129  $weekly_days = $this->http->wrapper()->post()->retrieve(
130  'byday_WEEKLY',
131  $this->refinery->kindlyTo()->dictOf(
132  $this->refinery->kindlyTo()->string()
133  )
134  );
135  }
136  if ($weekly_days !== []) {
137  $this->getRecurrence()->setBYDAY(implode(',', $weekly_days));
138  }
139  break;
140 
142  $this->getRecurrence()->setFrequenceType($this->getRecurrenceInputByTypeAsString('frequence'));
143  $this->getRecurrence()->setInterval($this->getRecurrenceInputByTypeAsInt('count_MONTHLY'));
144  switch ($this->getRecurrenceInputByTypeAsInt('subtype_MONTHLY')) {
145  case 0:
146  // nothing to do;
147  break;
148  case 1:
149  switch ($this->getRecurrenceInputByTypeAsString('monthly_byday_day')) {
150  case '8':
151  // Weekday
152  $this->getRecurrence()->setBYSETPOS($this->getRecurrenceInputByTypeAsString('monthly_byday_num'));
153  $this->getRecurrence()->setBYDAY('MO,TU,WE,TH,FR');
154  break;
155 
156  case '9':
157  // Day of month
158  $this->getRecurrence()->setBYMONTHDAY($this->getRecurrenceInputByTypeAsString('monthly_byday_num'));
159  break;
160 
161  default:
162  $this->getRecurrence()->setBYDAY(
163  $this->getRecurrenceInputByTypeAsString('monthly_byday_num') .
164  $this->getRecurrenceInputByTypeAsString('monthly_byday_day')
165  );
166  break;
167  }
168  break;
169 
170  case 2:
171  $this->getRecurrence()->setBYMONTHDAY($this->getRecurrenceInputByTypeAsString('monthly_bymonthday'));
172  break;
173  }
174  break;
175 
177  $this->getRecurrence()->setFrequenceType($this->getRecurrenceInputByTypeAsString('frequence'));
178  $this->getRecurrence()->setInterval($this->getRecurrenceInputByTypeAsInt('count_YEARLY'));
179  switch ($this->getRecurrenceInputByTypeAsInt('subtype_YEARLY')) {
180  case 0:
181  // nothing to do;
182  break;
183 
184  case 1:
185  $this->getRecurrence()->setBYDAY(
186  $this->getRecurrenceInputByTypeAsString('yearly_byday_num') .
187  $this->getRecurrenceInputByTypeAsString('yearly_byday')
188  );
189  $this->getRecurrence()->setBYMONTH($this->getRecurrenceInputByTypeAsString('yearly_bymonth_byday'));
190  break;
191 
192  case 2:
193  $this->getRecurrence()->setBYMONTH($this->getRecurrenceInputByTypeAsString('yearly_bymonthday'));
194  $this->getRecurrence()->setBYMONTHDAY($this->getRecurrenceInputByTypeAsString('yearly_bymonthday'));
195  break;
196  }
197  break;
198  }
199 
200  // UNTIL
201  switch ($this->getRecurrenceInputByTypeAsInt('until_type')) {
202  case 1:
203  $this->getRecurrence()->setFrequenceUntilDate(null);
204  // nothing to do
205  break;
206 
207  case 2:
208  $this->getRecurrence()->setFrequenceUntilDate(null);
209  $this->getRecurrence()->setFrequenceUntilCount($this->getRecurrenceInputByTypeAsInt('count'));
210  break;
211 
212  case 3:
213  $dt = new ilDateTimeInputGUI('', 'until_end');
214  $dt->setRequired(true);
215  if ($dt->checkInput()) {
216  $this->getRecurrence()->setFrequenceUntilCount(0);
217  $this->getRecurrence()->setFrequenceUntilDate($dt->getDate());
218  } else {
219  return false;
220  }
221  break;
222  }
223  return true;
224  }
getRecurrenceInputByTypeAsInt(string $input)
Model of calendar entry recurrcences based on iCalendar-RFC-5545.
This class represents a date/time property in a property form.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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 254 of file class.ilRecurrenceInputGUI.php.

Referenced by ilConsultationHoursGUI\initFormSequence().

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

◆ setRecurrence()

ilRecurrenceInputGUI::setRecurrence ( ilCalendarRecurrence  $a_rec)

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

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

Field Documentation

◆ $allow_unlimited_recurrences

bool ilRecurrenceInputGUI::$allow_unlimited_recurrences = true
protected

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

Referenced by isUnlimitedRecurrenceAllowed().

◆ $enabled_subforms

array ilRecurrenceInputGUI::$enabled_subforms
protected

◆ $recurrence

ilCalendarRecurrence ilRecurrenceInputGUI::$recurrence
protected

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

Referenced by getRecurrence().

◆ $user

ilObjUser ilRecurrenceInputGUI::$user
protected

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

◆ $user_settings

ilCalendarUserSettings ilRecurrenceInputGUI::$user_settings
protected

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

◆ REC_LIMITED

const ilRecurrenceInputGUI::REC_LIMITED = 2
protected

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

◆ REC_UNLIMITED

const ilRecurrenceInputGUI::REC_UNLIMITED = 1
protected

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


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