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

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 $lng,$tpl,$ilUser;
65
66 $this->lng = $lng;
67 $this->lng->loadLanguageModule('dateplaner');
68
69 $this->user_settings = ilCalendarUserSettings::_getInstanceByUserId($ilUser->getId());
70 $tpl->addJavascript("./Services/Calendar/js/recurrence_input.js");
71
73
74 parent::__construct($a_title, $a_postvar);
75 }
$tpl
Definition: ilias.php:10
static _getInstanceByUserId($a_user_id)
get singleton instance
setRecurrence($a_rec)
set recurrence object
$ilUser
Definition: imgupload.php:18

References $ilUser, $lng, $tpl, 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 241 of file class.ilRecurrenceInputGUI.php.

242 {
243 $this->allow_unlimited_recurrences = $a_status;
244 }

◆ buildMonthlyByDaySelection()

ilRecurrenceInputGUI::buildMonthlyByDaySelection (   $tpl)
protected

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

@access protected

Parameters

return

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

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

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

480 {
481 $tpl->setVariable('TXT_IN', $this->lng->txt('cal_in'));
482
483 $chosen_day = 1;
484 $chosen = false;
485 if (count($bymonthday = $this->recurrence->getBYMONTHDAYList()) == 1) {
486 foreach ($bymonthday as $mday) {
487 if ($mday > 0 and $mday < 32) {
488 $chosen = true;
489 $chosen_day = $mday;
490 }
491 }
492 }
493
494 if ($chosen) {
495 $tpl->setVariable('M_BYMONTHDAY_CHECKED', 'checked="checked"');
496 }
497
498 for ($i = 1; $i < 32;$i++) {
499 $options[$i] = $i;
500 }
501 $tpl->setVariable('SELECT_BYMONTHDAY', ilUtil::formSelect(
502 $chosen_day,
503 'monthly_bymonthday',
504 $options,
505 false,
506 true,
507 '',
508 '',
509 array('onchange' => "ilUpdateSubTypeSelection('sub_monthly_radio_2');")
510 ));
511 }
if(!isset( $_REQUEST[ 'ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
Definition: as_login.php:20

References $i, $options, $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 665 of file class.ilRecurrenceInputGUI.php.

666 {
667 if ($this->isUnlimitedRecurrenceAllowed()) {
668 $tpl->setVariable('TXT_NO_ENDING', $this->lng->txt('cal_no_ending'));
669 }
670
671 $tpl->setVariable('TXT_UNTIL_CREATE', $this->lng->txt('cal_create'));
672 $tpl->setVariable('TXT_APPOINTMENTS', $this->lng->txt('cal_appointments'));
673
674 $tpl->setVariable('VAL_COUNT', $this->recurrence->getFrequenceUntilCount() ?
675 $this->recurrence->getFrequenceUntilCount() :
676 2);
677
678 if ($this->recurrence->getFrequenceUntilDate()) {
679 $tpl->setVariable('UNTIL_END_CHECKED', 'checked="checked"');
680 } elseif ($this->recurrence->getFrequenceUntilCount() or !$this->isUnlimitedRecurrenceAllowed()) {
681 $tpl->setVariable('UNTIL_COUNT_CHECKED', 'checked="checked"');
682 } else {
683 $tpl->setVariable('UNTIL_NO_CHECKED', 'checked="checked"');
684 }
685
686 $tpl->setVariable('TXT_UNTIL_END', $this->lng->txt('cal_repeat_until'));
687 $dt = new ilDateTimeInputGUI('', 'until_end');
688 // no proper subform
689 // $dt->setRequired(true);
690 $dt->setDate(
691 $this->recurrence->getFrequenceUntilDate() ? $this->recurrence->getFrequenceUntilDate() : null
692 );
693 $tpl->setVariable('UNTIL_END_DATE', $dt->getTableFilterHTML());
694 }
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 363 of file class.ilRecurrenceInputGUI.php.

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

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

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

References $i, $m, $options, $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 520 of file class.ilRecurrenceInputGUI.php.

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

References $i, $m, $options, $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 84 of file class.ilRecurrenceInputGUI.php.

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

References $_POST, $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 273 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 231 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 285 of file class.ilRecurrenceInputGUI.php.

286 {
287 $tpl = new ilTemplate('tpl.recurrence_input.html', true, true, 'Services/Calendar');
288
289 $options = array('NONE' => $this->lng->txt('cal_no_recurrence'));
290 if (in_array(IL_CAL_FREQ_DAILY, $this->getEnabledSubForms())) {
291 $options[IL_CAL_FREQ_DAILY] = $this->lng->txt('cal_daily');
292 }
293 if (in_array(IL_CAL_FREQ_WEEKLY, $this->getEnabledSubForms())) {
294 $options[IL_CAL_FREQ_WEEKLY] = $this->lng->txt('cal_weekly');
295 }
296 if (in_array(IL_CAL_FREQ_MONTHLY, $this->getEnabledSubForms())) {
297 $options[IL_CAL_FREQ_MONTHLY] = $this->lng->txt('cal_monthly');
298 }
299 if (in_array(IL_CAL_FREQ_YEARLY, $this->getEnabledSubForms())) {
300 $options[IL_CAL_FREQ_YEARLY] = $this->lng->txt('cal_yearly');
301 }
302
303 $tpl->setVariable('FREQUENCE', ilUtil::formSelect(
304 $this->recurrence->getFrequenceType(),
305 'frequence',
306 $options,
307 false,
308 true,
309 '',
310 '',
311 array('onchange' => 'ilHideFrequencies();','id' => 'il_recurrence_1')
312 ));
313
314 $tpl->setVariable('TXT_EVERY', $this->lng->txt('cal_every'));
315
316 // DAILY
317 if (in_array(IL_CAL_FREQ_DAILY, $this->getEnabledSubForms())) {
318 $tpl->setVariable('TXT_DAILY_FREQ_UNIT', $this->lng->txt('cal_day_s'));
319 $tpl->setVariable('COUNT_DAILY_VAL', $this->recurrence->getInterval());
320 }
321
322 // WEEKLY
323 if (in_array(IL_CAL_FREQ_WEEKLY, $this->getEnabledSubForms())) {
324 $tpl->setVariable('TXT_WEEKLY_FREQ_UNIT', $this->lng->txt('cal_week_s'));
325 $tpl->setVariable('COUNT_WEEKLY_VAL', $this->recurrence->getInterval());
327 }
328
329 // MONTHLY
330 if (in_array(IL_CAL_FREQ_MONTHLY, $this->getEnabledSubForms())) {
331 $tpl->setVariable('TXT_MONTHLY_FREQ_UNIT', $this->lng->txt('cal_month_s'));
332 $tpl->setVariable('COUNT_MONTHLY_VAL', $this->recurrence->getInterval());
333 $tpl->setVariable('TXT_ON_THE', $this->lng->txt('cal_on_the'));
334 $tpl->setVariable('TXT_BYMONTHDAY', $this->lng->txt('cal_on_the'));
335 $tpl->setVariable('TXT_OF_THE_MONTH', $this->lng->txt('cal_of_the_month'));
338 }
339
340 // YEARLY
341 if (in_array(IL_CAL_FREQ_YEARLY, $this->getEnabledSubForms())) {
342 $tpl->setVariable('TXT_YEARLY_FREQ_UNIT', $this->lng->txt('cal_year_s'));
343 $tpl->setVariable('COUNT_YEARLY_VAL', $this->recurrence->getInterval());
344 $tpl->setVariable('TXT_ON_THE', $this->lng->txt('cal_on_the'));
347 }
348
349 // UNTIL
351
352 $a_tpl->setCurrentBlock("prop_custom");
353 $a_tpl->setVariable("CUSTOM_CONTENT", $tpl->get());
354 $a_tpl->parseCurrentBlock();
355 }
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 $options, $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 250 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 112 of file class.ilRecurrenceInputGUI.php.

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

263 {
264 $this->enabled_subforms = $a_sub_forms;
265 }

◆ setRecurrence()

ilRecurrenceInputGUI::setRecurrence (   $a_rec)

set recurrence object

@access public

Parameters

return

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

223 {
224 $this->recurrence = $a_rec;
225 }

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: