ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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 ($a_title, $a_postvar)
 Constructor. More...
 
 checkInput ()
 check input More...
 
 setRecurrence ($a_rec)
 set recurrence object More...
 
 getRecurrence ()
 Get Recurrence. More...
 
 allowUnlimitedRecurrences ($a_status)
 Allow unlimited recurrences. More...
 
 isUnlimitedRecurrenceAllowed ()
 Check if unlimited recurrence is allowed. More...
 
 setEnabledSubForms ($a_sub_forms)
 set enabled subforms More...
 
 getEnabledSubForms ()
 get enabled subforms More...
 
 insert ($a_tpl)
 insert More...
 
- Public Member Functions inherited from ilCustomInputGUI
 __construct ($a_title="", $a_postvar="")
 Constructor. More...
 
 setHtml ($a_html)
 Set Html. More...
 
 getHtml ()
 Get Html. More...
 
 setValueByArray ($a_values)
 Set value by array. More...
 
 insert ($a_tpl)
 Insert property html. More...
 
 checkInput ()
 Check input, strip slashes etc. More...
 
- Public Member Functions inherited from ilSubEnabledFormPropertyGUI
 addSubItem ($a_item)
 Add Subitem. More...
 
 getSubItems ()
 Get Subitems. More...
 
 getSubInputItemsRecursive ()
 returns a flat array of possibly existing subitems recursively More...
 
 checkSubItemsInput ()
 Check SubItems. More...
 
 getSubForm ()
 Get sub form html. More...
 
 getItemByPostVar ($a_post_var)
 Get item by post var. 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...
 
 getTableFilterLabelFor ()
 Get label "for" attribute value for filter. More...
 
 getFormLabelFor ()
 Get label "for" attribute value for form. More...
 

Data Fields

const REC_LIMITED = 2
 
const REC_UNLIMITED = 1
 

Protected Member Functions

 loadRecurrence ()
 load recurrence settings @access protected More...
 
 buildWeekDaySelection ($tpl)
 build weekday checkboxes More...
 
 buildMonthlyByDaySelection ($tpl)
 build monthly by day list (e.g second monday) More...
 
 buildMonthlyByMonthDaySelection ($tpl)
 build monthly bymonthday selection More...
 
 buildYearlyByMonthDaySelection ($tpl)
 @access protected More...
 
 buildYearlyByDaySelection ($tpl)
 @access protected More...
 
 buildUntilSelection ($tpl)
 build selection for ending date More...
 
- Protected Member Functions inherited from ilFormPropertyGUI
 setType ($a_type)
 Set Type. More...
 
 getMultiIconsHTML ()
 Get HTML for multiple value icons. More...
 

Protected Attributes

 $lng
 
 $recurrence
 
 $user_settings
 
 $allow_unlimited_recurrences = true
 
 $enabled_subforms
 
- Protected Attributes inherited from ilCustomInputGUI
 $lng
 
 $html
 
- Protected Attributes inherited from ilSubEnabledFormPropertyGUI
 $sub_items = array()
 
- 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...
 

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 37 of file class.ilRecurrenceInputGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilRecurrenceInputGUI::__construct (   $a_title,
  $a_postvar 
)

Constructor.

@access public

Parameters
stringtitle
stringpostvar

Reimplemented from ilCustomInputGUI.

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

63 {
64 global $DIC;
65
66 $lng = $DIC['lng'];
67 $tpl = $DIC['tpl'];
68 $ilUser = $DIC['ilUser'];
69
70 $this->lng = $lng;
71 $this->lng->loadLanguageModule('dateplaner');
72
73 $this->user_settings = ilCalendarUserSettings::_getInstanceByUserId($ilUser->getId());
74 $tpl->addJavascript("./Services/Calendar/js/recurrence_input.js");
75
77
78 parent::__construct($a_title, $a_postvar);
79 }
static _getInstanceByUserId($a_user_id)
get singleton instance
setRecurrence($a_rec)
set recurrence object
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
$ilUser
Definition: imgupload.php:18
$DIC
Definition: xapitoken.php:46

References $DIC, $ilUser, $lng, $tpl, ILIAS\GlobalScreen\Provider\__construct(), ilCalendarUserSettings\_getInstanceByUserId(), and setRecurrence().

+ Here is the call graph for this function:

Member Function Documentation

◆ allowUnlimitedRecurrences()

ilRecurrenceInputGUI::allowUnlimitedRecurrences (   $a_status)

Allow unlimited recurrences.

Parameters
object$a_status
Returns

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

248 {
249 $this->allow_unlimited_recurrences = $a_status;
250 }

◆ buildMonthlyByDaySelection()

ilRecurrenceInputGUI::buildMonthlyByDaySelection (   $tpl)
protected

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

@access protected

Parameters

return

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

402 {
403 $byday_list = $this->recurrence->getBYDAYList();
404 $chosen_num_day = 1;
405 $chosen_day = 'MO';
406 $chosen = false;
407 foreach ($byday_list as $byday) {
408 if (preg_match('/^(-?\d)([A-Z][A-Z])/', $byday, $parsed) === 1) {
409 $chosen = true;
410 $chosen_num_day = $parsed[1];
411 $chosen_day = $parsed[2];
412 }
413 }
414 // check for last day
415 if (count($this->recurrence->getBYMONTHDAYList()) == 1) {
416 $bymonthday = $this->recurrence->getBYMONTHDAY();
417 if (in_array($bymonthday, array(1,2,3,4,5,-1))) {
418 $chosen = true;
419 $chosen_num_day = $bymonthday;
420 $chosen_day = 9;
421 }
422 }
423 // Check for first, second... last weekday
424 if (count($this->recurrence->getBYSETPOSList()) == 1) {
425 $bysetpos = $this->recurrence->getBYSETPOS();
426 if (in_array($bysetpos, array(1,2,3,4,5,-1))) {
427 if ($this->recurrence->getBYDAYList() == array('MO','TU','WE','TH','FR')) {
428 $chosen = true;
429 $chosen_num_day = $bysetpos;
430 $chosen_day = 8;
431 }
432 }
433 }
434
435
436
437 if ($chosen) {
438 $tpl->setVariable('M_BYDAY_CHECKED', 'checked="checked"');
439 }
440
441 $num_options = array(
442 1 => $this->lng->txt('cal_first'),
443 2 => $this->lng->txt('cal_second'),
444 3 => $this->lng->txt('cal_third'),
445 4 => $this->lng->txt('cal_fourth'),
446 5 => $this->lng->txt('cal_fifth'),
447 -1 => $this->lng->txt('cal_last'));
448
449 $tpl->setVariable('SELECT_BYDAY_NUM_MONTHLY', ilUtil::formSelect(
450 $chosen_num_day,
451 'monthly_byday_num',
452 $num_options,
453 false,
454 true,
455 '',
456 '',
457 array('onchange' => "ilUpdateSubTypeSelection('sub_monthly_radio_1');")
458 ));
459
460 $days = array(0 => 'SU',1 => 'MO',2 => 'TU',3 => 'WE',4 => 'TH',5 => 'FR',6 => 'SA',7 => 'SU');
461
462 for ($i = (int) $this->user_settings->getWeekStart();$i < 7 + (int) $this->user_settings->getWeekStart();$i++) {
463 $days_select[$days[$i]] = ilCalendarUtil::_numericDayToString($i);
464 }
465 $days_select[8] = $this->lng->txt('cal_weekday');
466 $days_select[9] = $this->lng->txt('cal_day_of_month');
467 $tpl->setVariable('SEL_BYDAY_DAY_MONTHLY', ilUtil::formSelect(
468 $chosen_day,
469 'monthly_byday_day',
470 $days_select,
471 false,
472 true,
473 '',
474 '',
475 array('onchange' => "ilUpdateSubTypeSelection('sub_monthly_radio_1');")
476 ));
477 }
static _numericDayToString($a_day, $a_long=true)
get
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: metadata.php:24

References $i, $tpl, ilCalendarUtil\_numericDayToString(), and ilUtil\formSelect().

Referenced by insert().

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

◆ buildMonthlyByMonthDaySelection()

ilRecurrenceInputGUI::buildMonthlyByMonthDaySelection (   $tpl)
protected

build monthly bymonthday selection

@access protected

Parameters

return

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

487 {
488 $tpl->setVariable('TXT_IN', $this->lng->txt('cal_in'));
489
490 $chosen_day = 1;
491 $chosen = false;
492 if (count($bymonthday = $this->recurrence->getBYMONTHDAYList()) == 1) {
493 foreach ($bymonthday as $mday) {
494 if ($mday > 0 and $mday < 32) {
495 $chosen = true;
496 $chosen_day = $mday;
497 }
498 }
499 }
500
501 if ($chosen) {
502 $tpl->setVariable('M_BYMONTHDAY_CHECKED', 'checked="checked"');
503 }
504
505 for ($i = 1; $i < 32;$i++) {
506 $options[$i] = $i;
507 }
508 $tpl->setVariable('SELECT_BYMONTHDAY', ilUtil::formSelect(
509 $chosen_day,
510 'monthly_bymonthday',
511 $options,
512 false,
513 true,
514 '',
515 '',
516 array('onchange' => "ilUpdateSubTypeSelection('sub_monthly_radio_2');")
517 ));
518 }

References $i, $tpl, and ilUtil\formSelect().

Referenced by insert().

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

◆ buildUntilSelection()

ilRecurrenceInputGUI::buildUntilSelection (   $tpl)
protected

build selection for ending date

@access protected

Parameters
objecttpl
Returns

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

673 {
674 if ($this->isUnlimitedRecurrenceAllowed()) {
675 $tpl->setVariable('TXT_NO_ENDING', $this->lng->txt('cal_no_ending'));
676 }
677
678 $tpl->setVariable('TXT_UNTIL_CREATE', $this->lng->txt('cal_create'));
679 $tpl->setVariable('TXT_APPOINTMENTS', $this->lng->txt('cal_appointments'));
680
681 $tpl->setVariable('VAL_COUNT', $this->recurrence->getFrequenceUntilCount() ?
682 $this->recurrence->getFrequenceUntilCount() :
683 2);
684
685 if ($this->recurrence->getFrequenceUntilDate()) {
686 $tpl->setVariable('UNTIL_END_CHECKED', 'checked="checked"');
687 } elseif ($this->recurrence->getFrequenceUntilCount() or !$this->isUnlimitedRecurrenceAllowed()) {
688 $tpl->setVariable('UNTIL_COUNT_CHECKED', 'checked="checked"');
689 } else {
690 $tpl->setVariable('UNTIL_NO_CHECKED', 'checked="checked"');
691 }
692
693 $tpl->setVariable('TXT_UNTIL_END', $this->lng->txt('cal_repeat_until'));
694 $dt = new ilDateTimeInputGUI('', 'until_end');
695 // no proper subform
696 // $dt->setRequired(true);
697 $dt->setDate(
698 $this->recurrence->getFrequenceUntilDate() ? $this->recurrence->getFrequenceUntilDate() : null
699 );
700 $tpl->setVariable('UNTIL_END_DATE', $dt->getTableFilterHTML());
701 }
This class represents a date/time property in a property form.
isUnlimitedRecurrenceAllowed()
Check if unlimited recurrence is allowed.

References $tpl, and isUnlimitedRecurrenceAllowed().

Referenced by insert().

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

◆ buildWeekDaySelection()

ilRecurrenceInputGUI::buildWeekDaySelection (   $tpl)
protected

build weekday checkboxes

@access protected

Parameters
objecttpl

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

370 {
371 $days = array(0 => 'SU',1 => 'MO',2 => 'TU',3 => 'WE',4 => 'TH',5 => 'FR',6 => 'SA',7 => 'SU');
372
373 $checked_days = array();
374 foreach ($this->recurrence->getBYDAYList() as $byday) {
375 if (in_array($byday, $days)) {
376 $checked_days[] = $byday;
377 }
378 }
379
380 for ($i = (int) $this->user_settings->getWeekStart();$i < 7 + (int) $this->user_settings->getWeekStart();$i++) {
381 $tpl->setCurrentBlock('byday_simple');
382
383 if (in_array($days[$i], $checked_days)) {
384 $tpl->setVariable('BYDAY_WEEKLY_CHECKED', 'checked="checked"');
385 }
386 $tpl->setVariable('TXT_ON', $this->lng->txt('cal_on'));
387 $tpl->setVariable('DAY_COUNT', $i);
388 $tpl->setVariable('BYDAY_WEEKLY_VAL', $days[$i]);
389 $tpl->setVariable('TXT_DAY_SHORT', ilCalendarUtil::_numericDayToString($i, false));
390 $tpl->parseCurrentBlock();
391 }
392 }

References $i, $tpl, and ilCalendarUtil\_numericDayToString().

Referenced by insert().

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

◆ buildYearlyByDaySelection()

ilRecurrenceInputGUI::buildYearlyByDaySelection (   $tpl)
protected

@access protected

Parameters

return

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

589 {
590 $tpl->setVariable('TXT_ON_THE', $this->lng->txt('cal_on_the'));
591
592 $chosen_num_day = 1;
593 $chosen_day = 'MO';
594 $chosen = false;
595 foreach ($this->recurrence->getBYDAYList() as $byday) {
596 if (preg_match('/^(-?\d)([A-Z][A-Z])/', $byday, $parsed) === 1) {
597 $chosen = true;
598 $chosen_num_day = $parsed[1];
599 $chosen_day = $parsed[2];
600 }
601 }
602
603
604 $num_options = array(
605 1 => $this->lng->txt('cal_first'),
606 2 => $this->lng->txt('cal_second'),
607 3 => $this->lng->txt('cal_third'),
608 4 => $this->lng->txt('cal_fourth'),
609 5 => $this->lng->txt('cal_fifth'),
610 -1 => $this->lng->txt('cal_last'));
611
612 $tpl->setVariable('SELECT_BYDAY_NUM_YEARLY', ilUtil::formSelect(
613 $chosen_num_day,
614 'yearly_byday_num',
615 $num_options,
616 false,
617 true,
618 '',
619 '',
620 array('onchange' => "ilUpdateSubTypeSelection('sub_yearly_radio_1');")
621 ));
622
623
624 $days = array(0 => 'SU',1 => 'MO',2 => 'TU',3 => 'WE',4 => 'TH',5 => 'FR',6 => 'SA',7 => 'SU');
625 for ($i = (int) $this->user_settings->getWeekStart();$i < 7 + (int) $this->user_settings->getWeekStart();$i++) {
626 $days_select[$days[$i]] = ilCalendarUtil::_numericDayToString($i);
627 }
628 $tpl->setVariable('SELECT_BYDAY_DAY_YEARLY', ilUtil::formSelect(
629 $chosen_day,
630 'yearly_byday',
631 $days_select,
632 false,
633 true,
634 '',
635 '',
636 array('onchange' => "ilUpdateSubTypeSelection('sub_yearly_radio_1');")
637 ));
638
639
640 $chosen = false;
641 $chosen_month = 1;
642 foreach ($this->recurrence->getBYMONTHList() as $month) {
643 if ($this->recurrence->getBYMONTHDAYList()) {
644 $chosen_month = $month;
645 $chosen = true;
646 break;
647 }
648 }
649 $options = array();
650 for ($m = 1;$m < 13;$m++) {
651 $options[$m] = ilCalendarUtil::_numericMonthToString($m);
652 }
653 $tpl->setVariable('SELECT_BYMONTH_BYDAY', ilUtil::formSelect(
654 $chosen_month,
655 'yearly_bymonth_byday',
656 $options,
657 false,
658 true,
659 '',
660 '',
661 array('onchange' => "ilUpdateSubTypeSelection('sub_yearly_radio_1');")
662 ));
663 }
static _numericMonthToString($a_month, $a_long=true)
numeric month to string

References $i, $tpl, ilCalendarUtil\_numericDayToString(), ilCalendarUtil\_numericMonthToString(), and ilUtil\formSelect().

Referenced by insert().

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

◆ buildYearlyByMonthDaySelection()

ilRecurrenceInputGUI::buildYearlyByMonthDaySelection (   $tpl)
protected

@access protected

Parameters
objettpl
Returns

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

528 {
529 $tpl->setVariable('TXT_Y_EVERY', $this->lng->txt('cal_every'));
530
531
532 $chosen = false;
533 $chosen_month = 1;
534 $chosen_day = 1;
535 foreach ($this->recurrence->getBYMONTHList() as $month) {
536 if ($this->recurrence->getBYMONTHDAYList()) {
537 $chosen_month = $month;
538 $chosen = true;
539 break;
540 }
541 }
542 foreach ($this->recurrence->getBYMONTHDAYList() as $day) {
543 $chosen_day = $day;
544 }
545
546 for ($i = 1; $i < 32;$i++) {
547 $options[$i] = $i;
548 }
549 $tpl->setVariable('SELECT_BYMONTHDAY_NUM_YEARLY', ilUtil::formSelect(
550 $chosen_day,
551 'yearly_bymonthday',
552 $options,
553 false,
554 true,
555 '',
556 '',
557 array('onchange' => "ilUpdateSubTypeSelection('sub_yearly_radio_2');")
558 ));
559
560 $options = array();
561 for ($m = 1;$m < 13;$m++) {
562 $options[$m] = ilCalendarUtil::_numericMonthToString($m);
563 }
564 $tpl->setVariable('SELECT_BYMONTH_YEARLY', ilUtil::formSelect(
565 $chosen_month,
566 'yearly_bymonth_by_monthday',
567 $options,
568 false,
569 true,
570 '',
571 '',
572 array('onchange' => "ilUpdateSubTypeSelection('sub_yearly_radio_2');")
573 ));
574
575
576 if ($chosen) {
577 $tpl->setVariable('Y_BYMONTHDAY_CHECKED', 'checked="checked"');
578 }
579 }

References $i, $tpl, ilCalendarUtil\_numericMonthToString(), and ilUtil\formSelect().

Referenced by insert().

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

◆ checkInput()

ilRecurrenceInputGUI::checkInput ( )

check input

@access public

Parameters

return

Reimplemented from ilCustomInputGUI.

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

89 {
90 global $DIC;
91
92 $lng = $DIC['lng'];
93
94 if (!$this->loadRecurrence()) {
95 return false;
96 }
97
98 if ($_POST['frequence'] == 'NONE') {
99 return true;
100 }
101
102 if (!isset($_POST['until_type']) or $_POST['until_type'] == self::REC_LIMITED) {
103 if ($_POST['count'] <= 0 or $_POST['count'] >= 100) {
104 $this->setAlert($lng->txt("cal_rec_err_limit"));
105 return false;
106 }
107 }
108
109
110 return true;
111 }
$_POST["username"]
setAlert($a_alert)
Set Alert Text.
loadRecurrence()
load recurrence settings @access protected

References $_POST, $DIC, $lng, loadRecurrence(), and ilFormPropertyGUI\setAlert().

+ Here is the call graph for this function:

◆ getEnabledSubForms()

ilRecurrenceInputGUI::getEnabledSubForms ( )

get enabled subforms

@access public

Returns

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

References $enabled_subforms.

Referenced by insert().

+ Here is the caller graph for this function:

◆ getRecurrence()

ilRecurrenceInputGUI::getRecurrence ( )

Get Recurrence.

Returns
ilCalendarRecurrence

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

References $recurrence.

Referenced by loadRecurrence().

+ Here is the caller graph for this function:

◆ insert()

ilRecurrenceInputGUI::insert (   $a_tpl)

insert

@access public

Parameters

return

Reimplemented from ilCustomInputGUI.

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

292 {
293 $tpl = new ilTemplate('tpl.recurrence_input.html', true, true, 'Services/Calendar');
294
295 $options = array('NONE' => $this->lng->txt('cal_no_recurrence'));
296 if (in_array(IL_CAL_FREQ_DAILY, $this->getEnabledSubForms())) {
297 $options[IL_CAL_FREQ_DAILY] = $this->lng->txt('cal_daily');
298 }
299 if (in_array(IL_CAL_FREQ_WEEKLY, $this->getEnabledSubForms())) {
300 $options[IL_CAL_FREQ_WEEKLY] = $this->lng->txt('cal_weekly');
301 }
302 if (in_array(IL_CAL_FREQ_MONTHLY, $this->getEnabledSubForms())) {
303 $options[IL_CAL_FREQ_MONTHLY] = $this->lng->txt('cal_monthly');
304 }
305 if (in_array(IL_CAL_FREQ_YEARLY, $this->getEnabledSubForms())) {
306 $options[IL_CAL_FREQ_YEARLY] = $this->lng->txt('cal_yearly');
307 }
308
309 $tpl->setVariable('FREQUENCE', ilUtil::formSelect(
310 $this->recurrence->getFrequenceType(),
311 'frequence',
312 $options,
313 false,
314 true,
315 '',
316 '',
317 array('onchange' => 'ilHideFrequencies();','id' => 'il_recurrence_1')
318 ));
319
320 $tpl->setVariable('TXT_EVERY', $this->lng->txt('cal_every'));
321
322 // DAILY
323 if (in_array(IL_CAL_FREQ_DAILY, $this->getEnabledSubForms())) {
324 $tpl->setVariable('TXT_DAILY_FREQ_UNIT', $this->lng->txt('cal_day_s'));
325 $tpl->setVariable('COUNT_DAILY_VAL', $this->recurrence->getInterval());
326 }
327
328 // WEEKLY
329 if (in_array(IL_CAL_FREQ_WEEKLY, $this->getEnabledSubForms())) {
330 $tpl->setVariable('TXT_WEEKLY_FREQ_UNIT', $this->lng->txt('cal_week_s'));
331 $tpl->setVariable('COUNT_WEEKLY_VAL', $this->recurrence->getInterval());
333 }
334
335 // MONTHLY
336 if (in_array(IL_CAL_FREQ_MONTHLY, $this->getEnabledSubForms())) {
337 $tpl->setVariable('TXT_MONTHLY_FREQ_UNIT', $this->lng->txt('cal_month_s'));
338 $tpl->setVariable('COUNT_MONTHLY_VAL', $this->recurrence->getInterval());
339 $tpl->setVariable('TXT_ON_THE', $this->lng->txt('cal_on_the'));
340 $tpl->setVariable('TXT_BYMONTHDAY', $this->lng->txt('cal_on_the'));
341 $tpl->setVariable('TXT_OF_THE_MONTH', $this->lng->txt('cal_of_the_month'));
344 }
345
346 // YEARLY
347 if (in_array(IL_CAL_FREQ_YEARLY, $this->getEnabledSubForms())) {
348 $tpl->setVariable('TXT_YEARLY_FREQ_UNIT', $this->lng->txt('cal_year_s'));
349 $tpl->setVariable('COUNT_YEARLY_VAL', $this->recurrence->getInterval());
350 $tpl->setVariable('TXT_ON_THE', $this->lng->txt('cal_on_the'));
353 }
354
355 // UNTIL
357
358 $a_tpl->setCurrentBlock("prop_custom");
359 $a_tpl->setVariable("CUSTOM_CONTENT", $tpl->get());
360 $a_tpl->parseCurrentBlock();
361 }
const IL_CAL_FREQ_YEARLY
const IL_CAL_FREQ_MONTHLY
const IL_CAL_FREQ_WEEKLY
getEnabledSubForms()
get enabled subforms
buildYearlyByDaySelection($tpl)
@access protected
buildMonthlyByMonthDaySelection($tpl)
build monthly bymonthday selection
buildWeekDaySelection($tpl)
build weekday checkboxes
buildYearlyByMonthDaySelection($tpl)
@access protected
buildUntilSelection($tpl)
build selection for ending date
buildMonthlyByDaySelection($tpl)
build monthly by day list (e.g second monday)
special template class to simplify handling of ITX/PEAR
const IL_CAL_FREQ_DAILY
Model of calendar entry recurrcences.

References $tpl, buildMonthlyByDaySelection(), buildMonthlyByMonthDaySelection(), buildUntilSelection(), buildWeekDaySelection(), buildYearlyByDaySelection(), buildYearlyByMonthDaySelection(), ilUtil\formSelect(), getEnabledSubForms(), IL_CAL_FREQ_DAILY, IL_CAL_FREQ_MONTHLY, IL_CAL_FREQ_WEEKLY, and IL_CAL_FREQ_YEARLY.

+ Here is the call graph for this function:

◆ isUnlimitedRecurrenceAllowed()

ilRecurrenceInputGUI::isUnlimitedRecurrenceAllowed ( )

Check if unlimited recurrence is allowed.

Returns

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

References $allow_unlimited_recurrences.

Referenced by buildUntilSelection().

+ Here is the caller graph for this function:

◆ loadRecurrence()

ilRecurrenceInputGUI::loadRecurrence ( )
protected

load recurrence settings @access protected

Returns

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

119 {
120 if (!$this->getRecurrence() instanceof ilCalendarRecurrence) {
121 return false;
122 }
123
124
125 switch ($_POST['frequence']) {
127 $this->getRecurrence()->setFrequenceType($_POST['frequence']);
128 $this->getRecurrence()->setInterval((int) $_POST['count_DAILY']);
129 break;
130
132 $this->getRecurrence()->setFrequenceType($_POST['frequence']);
133 $this->getRecurrence()->setInterval((int) $_POST['count_WEEKLY']);
134 if (is_array($_POST['byday_WEEKLY'])) {
135 $this->getRecurrence()->setBYDAY(ilUtil::stripSlashes(implode(',', $_POST['byday_WEEKLY'])));
136 }
137 break;
138
140 $this->getRecurrence()->setFrequenceType($_POST['frequence']);
141 $this->getRecurrence()->setInterval((int) $_POST['count_MONTHLY']);
142 switch ((int) $_POST['subtype_MONTHLY']) {
143 case 0:
144 // nothing to do;
145 break;
146
147 case 1:
148 switch ((int) $_POST['monthly_byday_day']) {
149 case 8:
150 // Weekday
151 $this->getRecurrence()->setBYSETPOS((int) $_POST['monthly_byday_num']);
152 $this->getRecurrence()->setBYDAY('MO,TU,WE,TH,FR');
153 break;
154
155 case 9:
156 // Day of month
157 $this->getRecurrence()->setBYMONTHDAY((int) $_POST['monthly_byday_num']);
158 break;
159
160 default:
161 $this->getRecurrence()->setBYDAY((int) $_POST['monthly_byday_num'] . $_POST['monthly_byday_day']);
162 break;
163 }
164 break;
165
166 case 2:
167 $this->getRecurrence()->setBYMONTHDAY((int) $_POST['monthly_bymonthday']);
168 break;
169 }
170 break;
171
173 $this->getRecurrence()->setFrequenceType($_POST['frequence']);
174 $this->getRecurrence()->setInterval((int) $_POST['count_YEARLY']);
175 switch ((int) $_POST['subtype_YEARLY']) {
176 case 0:
177 // nothing to do;
178 break;
179
180 case 1:
181 $this->getRecurrence()->setBYMONTH((int) $_POST['yearly_bymonth_byday']);
182 $this->getRecurrence()->setBYDAY((int) $_POST['yearly_byday_num'] . $_POST['yearly_byday']);
183 break;
184
185 case 2:
186 $this->getRecurrence()->setBYMONTH((int) $_POST['yearly_bymonth_by_monthday']);
187 $this->getRecurrence()->setBYMONTHDAY((int) $_POST['yearly_bymonthday']);
188 break;
189 }
190 break;
191 }
192
193 // UNTIL
194 switch ((int) $_POST['until_type']) {
195 case 1:
196 $this->getRecurrence()->setFrequenceUntilDate(null);
197 // nothing to do
198 break;
199
200 case 2:
201 $this->getRecurrence()->setFrequenceUntilDate(null);
202 $this->getRecurrence()->setFrequenceUntilCount((int) $_POST['count']);
203 break;
204
205 case 3:
206 $dt = new ilDateTimeInputGUI('', 'until_end');
207 $dt->setRequired(true);
208 if ($dt->checkInput()) {
209 $this->getRecurrence()->setFrequenceUntilCount(0);
210 $this->getRecurrence()->setFrequenceUntilDate($dt->getDate());
211 } else {
212 return false;
213 }
214 break;
215 }
216
217 return true;
218 }
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled

References $_POST, getRecurrence(), IL_CAL_FREQ_DAILY, IL_CAL_FREQ_MONTHLY, IL_CAL_FREQ_WEEKLY, IL_CAL_FREQ_YEARLY, and ilUtil\stripSlashes().

Referenced by checkInput().

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

◆ setEnabledSubForms()

ilRecurrenceInputGUI::setEnabledSubForms (   $a_sub_forms)

set enabled subforms

@access public

Parameters
array(IL_CAL_FREQ_DAILY,IL_CAL_FREQ_WEEKLY...)
Returns

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

269 {
270 $this->enabled_subforms = $a_sub_forms;
271 }

◆ setRecurrence()

ilRecurrenceInputGUI::setRecurrence (   $a_rec)

set recurrence object

@access public

Parameters

return

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

229 {
230 $this->recurrence = $a_rec;
231 }

Referenced by __construct().

+ Here is the caller graph for this function:

Field Documentation

◆ $allow_unlimited_recurrences

ilRecurrenceInputGUI::$allow_unlimited_recurrences = true
protected

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

Referenced by isUnlimitedRecurrenceAllowed().

◆ $enabled_subforms

ilRecurrenceInputGUI::$enabled_subforms
protected

◆ $lng

ilRecurrenceInputGUI::$lng
protected

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

Referenced by __construct(), and checkInput().

◆ $recurrence

ilRecurrenceInputGUI::$recurrence
protected

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

Referenced by getRecurrence().

◆ $user_settings

ilRecurrenceInputGUI::$user_settings
protected

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

◆ REC_LIMITED

const ilRecurrenceInputGUI::REC_LIMITED = 2

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

◆ REC_UNLIMITED

const ilRecurrenceInputGUI::REC_UNLIMITED = 1

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


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