ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 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)
 protected More...
 
 buildYearlyByDaySelection ($tpl)
 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
 $html
 
- Protected Attributes inherited from ilSubEnabledFormPropertyGUI
 $sub_items = array()
 
- Protected Attributes inherited from ilFormPropertyGUI
 $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.

public

Parameters
stringtitle
stringpostvar

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

References $ilUser, $lng, $tpl, ilCalendarUserSettings\_getInstanceByUserId(), and setRecurrence().

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 
72  $this->setRecurrence(new ilCalendarRecurrence());
73 
74  parent::__construct($a_title,$a_postvar);
75  }
static _getInstanceByUserId($a_user_id)
get singleton instance
setRecurrence($a_rec)
set recurrence object
global $tpl
Definition: ilias.php:8
$ilUser
Definition: imgupload.php:18
+ 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 255 of file class.ilRecurrenceInputGUI.php.

Referenced by ilObjSessionGUI\initForm().

256  {
257  $this->allow_unlimited_recurrences = $a_status;
258  }
+ Here is the caller graph for this function:

◆ buildMonthlyByDaySelection()

ilRecurrenceInputGUI::buildMonthlyByDaySelection (   $tpl)
protected

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

protected

Parameters

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

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

Referenced by insert().

422  {
423  $byday_list = $this->recurrence->getBYDAYList();
424  $chosen_num_day = 1;
425  $chosen_day = 'MO';
426  $chosen = false;
427  foreach($byday_list as $byday)
428  {
429  if(preg_match('/^(-?\d)([A-Z][A-Z])/',$byday,$parsed) === 1)
430  {
431  $chosen = true;
432  $chosen_num_day = $parsed[1];
433  $chosen_day = $parsed[2];
434  }
435  }
436  // check for last day
437  if(count($this->recurrence->getBYMONTHDAYList()) == 1)
438  {
439  $bymonthday = $this->recurrence->getBYMONTHDAY();
440  if(in_array($bymonthday,array(1,2,3,4,5,-1)))
441  {
442  $chosen = true;
443  $chosen_num_day = $bymonthday;
444  $chosen_day = 9;
445  }
446  }
447  // Check for first, second... last weekday
448  if(count($this->recurrence->getBYSETPOSList()) == 1)
449  {
450  $bysetpos = $this->recurrence->getBYSETPOS();
451  if(in_array($bysetpos,array(1,2,3,4,5,-1)))
452  {
453  if($this->recurrence->getBYDAYList() == array('MO','TU','WE','TH','FR'))
454  {
455  $chosen = true;
456  $chosen_num_day = $bysetpos;
457  $chosen_day = 8;
458  }
459  }
460  }
461 
462 
463 
464  if($chosen)
465  {
466  $tpl->setVariable('M_BYDAY_CHECKED','checked="checked"');
467  }
468 
469  $num_options = array(
470  1 => $this->lng->txt('cal_first'),
471  2 => $this->lng->txt('cal_second'),
472  3 => $this->lng->txt('cal_third'),
473  4 => $this->lng->txt('cal_fourth'),
474  5 => $this->lng->txt('cal_fifth'),
475  -1 => $this->lng->txt('cal_last'));
476 
477  $tpl->setVariable('SELECT_BYDAY_NUM_MONTHLY',ilUtil::formSelect(
478  $chosen_num_day,
479  'monthly_byday_num',
480  $num_options,
481  false,
482  true,
483  '',
484  '',
485  array('onchange' => "ilUpdateSubTypeSelection('sub_monthly_radio_1');")));
486 
487  $days = array(0 => 'SU',1 => 'MO',2 => 'TU',3 => 'WE',4 => 'TH',5 => 'FR',6 => 'SA',7 => 'SU');
488 
489  for($i = (int) $this->user_settings->getWeekStart();$i < 7 + (int) $this->user_settings->getWeekStart();$i++)
490  {
491  $days_select[$days[$i]] = ilCalendarUtil::_numericDayToString($i);
492  }
493  $days_select[8] = $this->lng->txt('cal_weekday');
494  $days_select[9] = $this->lng->txt('cal_day_of_month');
495  $tpl->setVariable('SEL_BYDAY_DAY_MONTHLY',ilUtil::formSelect(
496  $chosen_day,
497  'monthly_byday_day',
498  $days_select,
499  false,
500  true,
501  '',
502  '',
503  array('onchange' => "ilUpdateSubTypeSelection('sub_monthly_radio_1');")));
504  }
static _numericDayToString($a_day, $a_long=true)
get
global $tpl
Definition: ilias.php:8
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.
Create styles array
The data for the language used.
+ 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

protected

Parameters

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

References $options, $tpl, array, and ilUtil\formSelect().

Referenced by insert().

514  {
515  $tpl->setVariable('TXT_IN',$this->lng->txt('cal_in'));
516 
517  $chosen_day = 1;
518  $chosen = false;
519  if(count($bymonthday = $this->recurrence->getBYMONTHDAYList()) == 1)
520  {
521  foreach($bymonthday as $mday)
522  {
523  if($mday > 0 and $mday < 32)
524  {
525  $chosen = true;
526  $chosen_day = $mday;
527  }
528  }
529  }
530 
531  if($chosen)
532  {
533  $tpl->setVariable('M_BYMONTHDAY_CHECKED','checked="checked"');
534  }
535 
536  for($i = 1; $i < 32;$i++)
537  {
538  $options[$i] = $i;
539  }
540  $tpl->setVariable('SELECT_BYMONTHDAY',ilUtil::formSelect(
541  $chosen_day,
542  'monthly_bymonthday',
543  $options,
544  false,
545  true,
546  '',
547  '',
548  array('onchange' => "ilUpdateSubTypeSelection('sub_monthly_radio_2');")));
549  }
global $tpl
Definition: ilias.php:8
if(!is_array($argv)) $options
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.
Create styles array
The data for the language used.
+ 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

protected

Parameters
objecttpl
Returns

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

References $tpl, and isUnlimitedRecurrenceAllowed().

Referenced by insert().

714  {
715 
716  if($this->isUnlimitedRecurrenceAllowed())
717  {
718  $tpl->setVariable('TXT_NO_ENDING',$this->lng->txt('cal_no_ending'));
719  }
720 
721  $tpl->setVariable('TXT_UNTIL_CREATE',$this->lng->txt('cal_create'));
722  $tpl->setVariable('TXT_APPOINTMENTS',$this->lng->txt('cal_appointments'));
723 
724  $tpl->setVariable('VAL_COUNT',$this->recurrence->getFrequenceUntilCount() ?
725  $this->recurrence->getFrequenceUntilCount() :
726  2);
727 
728  if($this->recurrence->getFrequenceUntilDate())
729  {
730  $tpl->setVariable('UNTIL_END_CHECKED','checked="checked"');
731  }
732  elseif($this->recurrence->getFrequenceUntilCount() or !$this->isUnlimitedRecurrenceAllowed())
733  {
734  $tpl->setVariable('UNTIL_COUNT_CHECKED','checked="checked"');
735  }
736  else
737  {
738  $tpl->setVariable('UNTIL_NO_CHECKED','checked="checked"');
739  }
740 
741  $tpl->setVariable('TXT_UNTIL_END',$this->lng->txt('cal_repeat_until'));
742  $dt = new ilDateTimeInputGUI('','until_end');
743  // no proper subform
744  // $dt->setRequired(true);
745  $dt->setDate(
746  $this->recurrence->getFrequenceUntilDate() ? $this->recurrence->getFrequenceUntilDate() : null);
747  $tpl->setVariable('UNTIL_END_DATE',$dt->getTableFilterHTML());
748  }
This class represents a date/time property in a property form.
global $tpl
Definition: ilias.php:8
isUnlimitedRecurrenceAllowed()
Check if unlimited recurrence is allowed.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildWeekDaySelection()

ilRecurrenceInputGUI::buildWeekDaySelection (   $tpl)
protected

build weekday checkboxes

protected

Parameters
objecttpl

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

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

Referenced by insert().

386  {
387  $days = array(0 => 'SU',1 => 'MO',2 => 'TU',3 => 'WE',4 => 'TH',5 => 'FR',6 => 'SA',7 => 'SU');
388 
389  $checked_days = array();
390  foreach($this->recurrence->getBYDAYList() as $byday)
391  {
392  if(in_array($byday,$days))
393  {
394  $checked_days[] = $byday;
395  }
396  }
397 
398  for($i = (int) $this->user_settings->getWeekStart();$i < 7 + (int) $this->user_settings->getWeekStart();$i++)
399  {
400  $tpl->setCurrentBlock('byday_simple');
401 
402  if(in_array($days[$i],$checked_days))
403  {
404  $tpl->setVariable('BYDAY_WEEKLY_CHECKED','checked="checked"');
405  }
406  $tpl->setVariable('TXT_ON',$this->lng->txt('cal_on'));
407  $tpl->setVariable('BYDAY_WEEKLY_VAL',$days[$i]);
408  $tpl->setVariable('TXT_DAY_SHORT',ilCalendarUtil::_numericDayToString($i,false));
409  $tpl->parseCurrentBlock();
410  }
411 
412  }
static _numericDayToString($a_day, $a_long=true)
get
global $tpl
Definition: ilias.php:8
Create styles array
The data for the language used.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildYearlyByDaySelection()

ilRecurrenceInputGUI::buildYearlyByDaySelection (   $tpl)
protected

protected

Parameters

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

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

Referenced by insert().

626  {
627  $tpl->setVariable('TXT_ON_THE',$this->lng->txt('cal_on_the'));
628 
629  $chosen_num_day = 1;
630  $chosen_day = 'MO';
631  $chosen = false;
632  foreach($this->recurrence->getBYDAYList() as $byday)
633  {
634  if(preg_match('/^(-?\d)([A-Z][A-Z])/',$byday,$parsed) === 1)
635  {
636  $chosen = true;
637  $chosen_num_day = $parsed[1];
638  $chosen_day = $parsed[2];
639  }
640  }
641 
642 
643  $num_options = array(
644  1 => $this->lng->txt('cal_first'),
645  2 => $this->lng->txt('cal_second'),
646  3 => $this->lng->txt('cal_third'),
647  4 => $this->lng->txt('cal_fourth'),
648  5 => $this->lng->txt('cal_fifth'),
649  -1 => $this->lng->txt('cal_last'));
650 
651  $tpl->setVariable('SELECT_BYDAY_NUM_YEARLY',ilUtil::formSelect(
652  $chosen_num_day,
653  'yearly_byday_num',
654  $num_options,
655  false,
656  true,
657  '',
658  '',
659  array('onchange' => "ilUpdateSubTypeSelection('sub_yearly_radio_1');")));
660 
661 
662  $days = array(0 => 'SU',1 => 'MO',2 => 'TU',3 => 'WE',4 => 'TH',5 => 'FR',6 => 'SA',7 => 'SU');
663  for($i = (int) $this->user_settings->getWeekStart();$i < 7 + (int) $this->user_settings->getWeekStart();$i++)
664  {
665  $days_select[$days[$i]] = ilCalendarUtil::_numericDayToString($i);
666  }
667  $tpl->setVariable('SELECT_BYDAY_DAY_YEARLY',ilUtil::formSelect(
668  $chosen_day,
669  'yearly_byday',
670  $days_select,
671  false,
672  true,
673  '',
674  '',
675  array('onchange' => "ilUpdateSubTypeSelection('sub_yearly_radio_1');")));
676 
677 
678  $chosen = false;
679  $chosen_month = 1;
680  foreach($this->recurrence->getBYMONTHList() as $month)
681  {
682  if($this->recurrence->getBYMONTHDAYList())
683  {
684  $chosen_month = $month;
685  $chosen = true;
686  break;
687  }
688  }
689  $options = array();
690  for($m = 1;$m < 13;$m++)
691  {
693  }
694  $tpl->setVariable('SELECT_BYMONTH_BYDAY',ilUtil::formSelect(
695  $chosen_month,
696  'yearly_bymonth_byday',
697  $options,
698  false,
699  true,
700  '',
701  '',
702  array('onchange' => "ilUpdateSubTypeSelection('sub_yearly_radio_1');")));
703 
704  }
static _numericDayToString($a_day, $a_long=true)
get
static _numericMonthToString($a_month, $a_long=true)
numeric month to string
global $tpl
Definition: ilias.php:8
if(!is_array($argv)) $options
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.
Create styles array
The data for the language used.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildYearlyByMonthDaySelection()

ilRecurrenceInputGUI::buildYearlyByMonthDaySelection (   $tpl)
protected

protected

Parameters
objettpl
Returns

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

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

Referenced by insert().

559  {
560  $tpl->setVariable('TXT_Y_EVERY',$this->lng->txt('cal_every'));
561 
562 
563  $chosen = false;
564  $chosen_month = 1;
565  $chosen_day = 1;
566  foreach($this->recurrence->getBYMONTHList() as $month)
567  {
568  if($this->recurrence->getBYMONTHDAYList())
569  {
570  $chosen_month = $month;
571  $chosen = true;
572  break;
573  }
574  }
575  foreach($this->recurrence->getBYMONTHDAYList() as $day)
576  {
577  $chosen_day = $day;
578  }
579 
580  for($i = 1; $i < 32;$i++)
581  {
582  $options[$i] = $i;
583  }
584  $tpl->setVariable('SELECT_BYMONTHDAY_NUM_YEARLY',ilUtil::formSelect(
585  $chosen_day,
586  'yearly_bymonthday',
587  $options,
588  false,
589  true,
590 
591  '',
592  '',
593  array('onchange' => "ilUpdateSubTypeSelection('sub_yearly_radio_2');")));
594 
595  $options = array();
596  for($m = 1;$m < 13;$m++)
597  {
599  }
600  $tpl->setVariable('SELECT_BYMONTH_YEARLY',ilUtil::formSelect(
601  $chosen_month,
602  'yearly_bymonth_by_monthday',
603  $options,
604  false,
605  true,
606  '',
607  '',
608  array('onchange' => "ilUpdateSubTypeSelection('sub_yearly_radio_2');")));
609 
610 
611  if($chosen)
612  {
613  $tpl->setVariable('Y_BYMONTHDAY_CHECKED','checked="checked"');
614  }
615 
616  }
static _numericMonthToString($a_month, $a_long=true)
numeric month to string
global $tpl
Definition: ilias.php:8
if(!is_array($argv)) $options
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.
Create styles array
The data for the language used.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkInput()

ilRecurrenceInputGUI::checkInput ( )

check input

public

Parameters

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

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

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

◆ getEnabledSubForms()

ilRecurrenceInputGUI::getEnabledSubForms ( )

get enabled subforms

public

Returns

Definition at line 287 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 245 of file class.ilRecurrenceInputGUI.php.

References $recurrence.

Referenced by loadRecurrence().

246  {
247  return $this->recurrence;
248  }
+ Here is the caller graph for this function:

◆ insert()

ilRecurrenceInputGUI::insert (   $a_tpl)

insert

public

Parameters

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

References $options, $tpl, array, 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.

300  {
301  $tpl = new ilTemplate('tpl.recurrence_input.html',true,true,'Services/Calendar');
302 
303  $options = array('NONE' => $this->lng->txt('cal_no_recurrence'));
304  if(in_array(IL_CAL_FREQ_DAILY, $this->getEnabledSubForms()))
305  {
306  $options[IL_CAL_FREQ_DAILY] = $this->lng->txt('cal_daily');
307  }
308  if(in_array(IL_CAL_FREQ_WEEKLY, $this->getEnabledSubForms()))
309  {
310  $options[IL_CAL_FREQ_WEEKLY] = $this->lng->txt('cal_weekly');
311  }
312  if(in_array(IL_CAL_FREQ_MONTHLY, $this->getEnabledSubForms()))
313  {
314  $options[IL_CAL_FREQ_MONTHLY] = $this->lng->txt('cal_monthly');
315  }
316  if(in_array(IL_CAL_FREQ_YEARLY, $this->getEnabledSubForms()))
317  {
318  $options[IL_CAL_FREQ_YEARLY] = $this->lng->txt('cal_yearly');
319  }
320 
321  $tpl->setVariable('FREQUENCE',ilUtil::formSelect(
322  $this->recurrence->getFrequenceType(),
323  'frequence',
324  $options,
325  false,
326  true,
327  '',
328  '',
329  array('onchange' => 'ilHideFrequencies();','id' => 'il_recurrence_1')));
330 
331  $tpl->setVariable('TXT_EVERY',$this->lng->txt('cal_every'));
332 
333  // DAILY
334  if(in_array(IL_CAL_FREQ_DAILY, $this->getEnabledSubForms()))
335  {
336  $tpl->setVariable('TXT_DAILY_FREQ_UNIT',$this->lng->txt('cal_day_s'));
337  $tpl->setVariable('COUNT_DAILY_VAL',$this->recurrence->getInterval());
338  }
339 
340  // WEEKLY
341  if(in_array(IL_CAL_FREQ_WEEKLY, $this->getEnabledSubForms()))
342  {
343  $tpl->setVariable('TXT_WEEKLY_FREQ_UNIT',$this->lng->txt('cal_week_s'));
344  $tpl->setVariable('COUNT_WEEKLY_VAL',$this->recurrence->getInterval());
345  $this->buildWeekDaySelection($tpl);
346  }
347 
348  // MONTHLY
349  if(in_array(IL_CAL_FREQ_MONTHLY, $this->getEnabledSubForms()))
350  {
351  $tpl->setVariable('TXT_MONTHLY_FREQ_UNIT',$this->lng->txt('cal_month_s'));
352  $tpl->setVariable('COUNT_MONTHLY_VAL',$this->recurrence->getInterval());
353  $tpl->setVariable('TXT_ON_THE',$this->lng->txt('cal_on_the'));
354  $tpl->setVariable('TXT_BYMONTHDAY',$this->lng->txt('cal_on_the'));
355  $tpl->setVariable('TXT_OF_THE_MONTH',$this->lng->txt('cal_of_the_month'));
358  }
359 
360  // YEARLY
361  if(in_array(IL_CAL_FREQ_YEARLY, $this->getEnabledSubForms()))
362  {
363  $tpl->setVariable('TXT_YEARLY_FREQ_UNIT',$this->lng->txt('cal_year_s'));
364  $tpl->setVariable('COUNT_YEARLY_VAL',$this->recurrence->getInterval());
365  $tpl->setVariable('TXT_ON_THE',$this->lng->txt('cal_on_the'));
368  }
369 
370  // UNTIL
371  $this->buildUntilSelection($tpl);
372 
373  $a_tpl->setCurrentBlock("prop_custom");
374  $a_tpl->setVariable("CUSTOM_CONTENT", $tpl->get());
375  $a_tpl->parseCurrentBlock();
376 
377  }
const IL_CAL_FREQ_MONTHLY
buildUntilSelection($tpl)
build selection for ending date
buildMonthlyByDaySelection($tpl)
build monthly by day list (e.g second monday)
global $tpl
Definition: ilias.php:8
getEnabledSubForms()
get enabled subforms
buildMonthlyByMonthDaySelection($tpl)
build monthly bymonthday selection
if(!is_array($argv)) $options
const IL_CAL_FREQ_DAILY
Model of calendar entry recurrcences.
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.
const IL_CAL_FREQ_YEARLY
buildYearlyByMonthDaySelection($tpl)
protected
special template class to simplify handling of ITX/PEAR
Create styles array
The data for the language used.
buildWeekDaySelection($tpl)
build weekday checkboxes
const IL_CAL_FREQ_WEEKLY
+ Here is the call graph for this function:

◆ isUnlimitedRecurrenceAllowed()

ilRecurrenceInputGUI::isUnlimitedRecurrenceAllowed ( )

Check if unlimited recurrence is allowed.

Returns

Definition at line 264 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 protected

Returns

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

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

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

public

Parameters
array(IL_CAL_FREQ_DAILY,IL_CAL_FREQ_WEEKLY...)
Returns

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

Referenced by ilConsultationHoursGUI\initFormSequence().

277  {
278  $this->enabled_subforms = $a_sub_forms;
279  }
+ Here is the caller graph for this function:

◆ setRecurrence()

ilRecurrenceInputGUI::setRecurrence (   $a_rec)

set recurrence object

public

Parameters

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

Referenced by __construct().

237  {
238  $this->recurrence = $a_rec;
239  }
+ 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.

Referenced by checkInput().

◆ 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: