ILIAS  release_4-4 Revision
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...
 

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
 

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
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
global $ilUser
Definition: imgupload.php:15
+ 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.

Referenced by ilObjSessionGUI\initForm().

248  {
249  $this->allow_unlimited_recurrences = $a_status;
250  }
+ 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 413 of file class.ilRecurrenceInputGUI.php.

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

Referenced by insert().

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

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

Referenced by insert().

506  {
507  $tpl->setVariable('TXT_IN',$this->lng->txt('cal_in'));
508 
509  $chosen_day = 1;
510  $chosen = false;
511  if(count($bymonthday = $this->recurrence->getBYMONTHDAYList()) == 1)
512  {
513  foreach($bymonthday as $mday)
514  {
515  if($mday > 0 and $mday < 32)
516  {
517  $chosen = true;
518  $chosen_day = $mday;
519  }
520  }
521  }
522 
523  if($chosen)
524  {
525  $tpl->setVariable('M_BYMONTHDAY_CHECKED','checked="checked"');
526  }
527 
528  for($i = 1; $i < 32;$i++)
529  {
530  $options[$i] = $i;
531  }
532  $tpl->setVariable('SELECT_BYMONTHDAY',ilUtil::formSelect(
533  $chosen_day,
534  'monthly_bymonthday',
535  $options,
536  false,
537  true,
538  '',
539  '',
540  array('onchange' => "ilUpdateSubTypeSelection('sub_monthly_radio_2');")));
541  }
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.
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
+ 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 705 of file class.ilRecurrenceInputGUI.php.

References $tpl, IL_CAL_UNIX, and isUnlimitedRecurrenceAllowed().

Referenced by insert().

706  {
707 
708  if($this->isUnlimitedRecurrenceAllowed())
709  {
710  $tpl->setVariable('TXT_NO_ENDING',$this->lng->txt('cal_no_ending'));
711  }
712 
713  $tpl->setVariable('TXT_UNTIL_CREATE',$this->lng->txt('cal_create'));
714  $tpl->setVariable('TXT_APPOINTMENTS',$this->lng->txt('cal_appointments'));
715 
716  $tpl->setVariable('VAL_COUNT',$this->recurrence->getFrequenceUntilCount() ?
717  $this->recurrence->getFrequenceUntilCount() :
718  2);
719 
720  if($this->recurrence->getFrequenceUntilDate())
721  {
722  $tpl->setVariable('UNTIL_END_CHECKED','checked="checked"');
723  }
724  elseif($this->recurrence->getFrequenceUntilCount() or !$this->isUnlimitedRecurrenceAllowed())
725  {
726  $tpl->setVariable('UNTIL_COUNT_CHECKED','checked="checked"');
727  }
728  else
729  {
730  $tpl->setVariable('UNTIL_NO_CHECKED','checked="checked"');
731  }
732 
733  $tpl->setVariable('TXT_UNTIL_END',$this->lng->txt('cal_repeat_until'));
734  $dt = new ilDateTimeInputGUI('','until_end');
735  $dt->setDate(
736  $this->recurrence->getFrequenceUntilDate() ? $this->recurrence->getFrequenceUntilDate() : new ilDate(time(),IL_CAL_UNIX));
737  $tpl->setVariable('UNTIL_END_DATE',$dt->getTableFilterHTML());
738  }
const IL_CAL_UNIX
This class represents a date/time property in a property form.
Class for single dates.
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
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 377 of file class.ilRecurrenceInputGUI.php.

References $tpl, and ilCalendarUtil\_numericDayToString().

Referenced by insert().

378  {
379  $days = array(0 => 'SU',1 => 'MO',2 => 'TU',3 => 'WE',4 => 'TH',5 => 'FR',6 => 'SA',7 => 'SU');
380 
381  $checked_days = array();
382  foreach($this->recurrence->getBYDAYList() as $byday)
383  {
384  if(in_array($byday,$days))
385  {
386  $checked_days[] = $byday;
387  }
388  }
389 
390  for($i = (int) $this->user_settings->getWeekStart();$i < 7 + (int) $this->user_settings->getWeekStart();$i++)
391  {
392  $tpl->setCurrentBlock('byday_simple');
393 
394  if(in_array($days[$i],$checked_days))
395  {
396  $tpl->setVariable('BYDAY_WEEKLY_CHECKED','checked="checked"');
397  }
398  $tpl->setVariable('TXT_ON',$this->lng->txt('cal_on'));
399  $tpl->setVariable('BYDAY_WEEKLY_VAL',$days[$i]);
400  $tpl->setVariable('TXT_DAY_SHORT',ilCalendarUtil::_numericDayToString($i,false));
401  $tpl->parseCurrentBlock();
402  }
403 
404  }
static _numericDayToString($a_day, $a_long=true)
get
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
+ 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 617 of file class.ilRecurrenceInputGUI.php.

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

Referenced by insert().

618  {
619  $tpl->setVariable('TXT_ON_THE',$this->lng->txt('cal_on_the'));
620 
621  $chosen_num_day = 1;
622  $chosen_day = 'MO';
623  $chosen = false;
624  foreach($this->recurrence->getBYDAYList() as $byday)
625  {
626  if(preg_match('/^(-?\d)([A-Z][A-Z])/',$byday,$parsed) === 1)
627  {
628  $chosen = true;
629  $chosen_num_day = $parsed[1];
630  $chosen_day = $parsed[2];
631  }
632  }
633 
634 
635  $num_options = array(
636  1 => $this->lng->txt('cal_first'),
637  2 => $this->lng->txt('cal_second'),
638  3 => $this->lng->txt('cal_third'),
639  4 => $this->lng->txt('cal_fourth'),
640  5 => $this->lng->txt('cal_fifth'),
641  -1 => $this->lng->txt('cal_last'));
642 
643  $tpl->setVariable('SELECT_BYDAY_NUM_YEARLY',ilUtil::formSelect(
644  $chosen_num_day,
645  'yearly_byday_num',
646  $num_options,
647  false,
648  true,
649  '',
650  '',
651  array('onchange' => "ilUpdateSubTypeSelection('sub_yearly_radio_1');")));
652 
653 
654  $days = array(0 => 'SU',1 => 'MO',2 => 'TU',3 => 'WE',4 => 'TH',5 => 'FR',6 => 'SA',7 => 'SU');
655  for($i = (int) $this->user_settings->getWeekStart();$i < 7 + (int) $this->user_settings->getWeekStart();$i++)
656  {
657  $days_select[$days[$i]] = ilCalendarUtil::_numericDayToString($i);
658  }
659  $tpl->setVariable('SELECT_BYDAY_DAY_YEARLY',ilUtil::formSelect(
660  $chosen_day,
661  'yearly_byday',
662  $days_select,
663  false,
664  true,
665  '',
666  '',
667  array('onchange' => "ilUpdateSubTypeSelection('sub_yearly_radio_1');")));
668 
669 
670  $chosen = false;
671  $chosen_month = 1;
672  foreach($this->recurrence->getBYMONTHList() as $month)
673  {
674  if($this->recurrence->getBYMONTHDAYList())
675  {
676  $chosen_month = $month;
677  $chosen = true;
678  break;
679  }
680  }
681  $options = array();
682  for($m = 1;$m < 13;$m++)
683  {
685  }
686  $tpl->setVariable('SELECT_BYMONTH_BYDAY',ilUtil::formSelect(
687  $chosen_month,
688  'yearly_bymonth_byday',
689  $options,
690  false,
691  true,
692  '',
693  '',
694  array('onchange' => "ilUpdateSubTypeSelection('sub_yearly_radio_1');")));
695 
696  }
static _numericDayToString($a_day, $a_long=true)
get
static _numericMonthToString($a_month, $a_long=true)
numeric month to string
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.
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
+ 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 550 of file class.ilRecurrenceInputGUI.php.

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

Referenced by insert().

551  {
552  $tpl->setVariable('TXT_Y_EVERY',$this->lng->txt('cal_every'));
553 
554 
555  $chosen = false;
556  $chosen_month = 1;
557  $chosen_day = 1;
558  foreach($this->recurrence->getBYMONTHList() as $month)
559  {
560  if($this->recurrence->getBYMONTHDAYList())
561  {
562  $chosen_month = $month;
563  $chosen = true;
564  break;
565  }
566  }
567  foreach($this->recurrence->getBYMONTHDAYList() as $day)
568  {
569  $chosen_day = $day;
570  }
571 
572  for($i = 1; $i < 32;$i++)
573  {
574  $options[$i] = $i;
575  }
576  $tpl->setVariable('SELECT_BYMONTHDAY_NUM_YEARLY',ilUtil::formSelect(
577  $chosen_day,
578  'yearly_bymonthday',
579  $options,
580  false,
581  true,
582 
583  '',
584  '',
585  array('onchange' => "ilUpdateSubTypeSelection('sub_yearly_radio_2');")));
586 
587  $options = array();
588  for($m = 1;$m < 13;$m++)
589  {
591  }
592  $tpl->setVariable('SELECT_BYMONTH_YEARLY',ilUtil::formSelect(
593  $chosen_month,
594  'yearly_bymonth_by_monthday',
595  $options,
596  false,
597  true,
598  '',
599  '',
600  array('onchange' => "ilUpdateSubTypeSelection('sub_yearly_radio_2');")));
601 
602 
603  if($chosen)
604  {
605  $tpl->setVariable('Y_BYMONTHDAY_CHECKED','checked="checked"');
606  }
607 
608  }
static _numericMonthToString($a_month, $a_long=true)
numeric month to string
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.
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
+ 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  $this->loadRecurrence();
89 
90  if($_POST['frequence'] == 'NONE')
91  {
92  return true;
93  }
94 
95  if(!isset($_POST['until_type']) or $_POST['until_type'] == REC_LIMITED)
96  {
97  if($_POST['count'] <= 0 or $_POST['count'] >= 100)
98  {
99  $this->setAlert($lng->txt("cal_rec_err_limit"));
100  return false;
101  }
102  }
103 
104 
105  return true;
106  }
$_POST['username']
Definition: cron.php:12
loadRecurrence()
load recurrence settings protected
setAlert($a_alert)
Set Alert Text.
+ Here is the call graph for this function:

◆ getEnabledSubForms()

ilRecurrenceInputGUI::getEnabledSubForms ( )

get enabled subforms

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

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

References $recurrence.

Referenced by loadRecurrence().

238  {
239  return $this->recurrence;
240  }
+ Here is the caller graph for this function:

◆ insert()

ilRecurrenceInputGUI::insert (   $a_tpl)

insert

public

Parameters

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

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.

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  {
298  $options[IL_CAL_FREQ_DAILY] = $this->lng->txt('cal_daily');
299  }
300  if(in_array(IL_CAL_FREQ_WEEKLY, $this->getEnabledSubForms()))
301  {
302  $options[IL_CAL_FREQ_WEEKLY] = $this->lng->txt('cal_weekly');
303  }
304  if(in_array(IL_CAL_FREQ_MONTHLY, $this->getEnabledSubForms()))
305  {
306  $options[IL_CAL_FREQ_MONTHLY] = $this->lng->txt('cal_monthly');
307  }
308  if(in_array(IL_CAL_FREQ_YEARLY, $this->getEnabledSubForms()))
309  {
310  $options[IL_CAL_FREQ_YEARLY] = $this->lng->txt('cal_yearly');
311  }
312 
313  $tpl->setVariable('FREQUENCE',ilUtil::formSelect(
314  $this->recurrence->getFrequenceType(),
315  'frequence',
316  $options,
317  false,
318  true,
319  '',
320  '',
321  array('onchange' => 'ilHideFrequencies();','id' => 'il_recurrence_1')));
322 
323  $tpl->setVariable('TXT_EVERY',$this->lng->txt('cal_every'));
324 
325  // DAILY
326  if(in_array(IL_CAL_FREQ_DAILY, $this->getEnabledSubForms()))
327  {
328  $tpl->setVariable('TXT_DAILY_FREQ_UNIT',$this->lng->txt('cal_day_s'));
329  $tpl->setVariable('COUNT_DAILY_VAL',$this->recurrence->getInterval());
330  }
331 
332  // WEEKLY
333  if(in_array(IL_CAL_FREQ_WEEKLY, $this->getEnabledSubForms()))
334  {
335  $tpl->setVariable('TXT_WEEKLY_FREQ_UNIT',$this->lng->txt('cal_week_s'));
336  $tpl->setVariable('COUNT_WEEKLY_VAL',$this->recurrence->getInterval());
337  $this->buildWeekDaySelection($tpl);
338  }
339 
340  // MONTHLY
341  if(in_array(IL_CAL_FREQ_MONTHLY, $this->getEnabledSubForms()))
342  {
343  $tpl->setVariable('TXT_MONTHLY_FREQ_UNIT',$this->lng->txt('cal_month_s'));
344  $tpl->setVariable('COUNT_MONTHLY_VAL',$this->recurrence->getInterval());
345  $tpl->setVariable('TXT_ON_THE',$this->lng->txt('cal_on_the'));
346  $tpl->setVariable('TXT_BYMONTHDAY',$this->lng->txt('cal_on_the'));
347  $tpl->setVariable('TXT_OF_THE_MONTH',$this->lng->txt('cal_of_the_month'));
350  }
351 
352  // YEARLY
353  if(in_array(IL_CAL_FREQ_YEARLY, $this->getEnabledSubForms()))
354  {
355  $tpl->setVariable('TXT_YEARLY_FREQ_UNIT',$this->lng->txt('cal_year_s'));
356  $tpl->setVariable('COUNT_YEARLY_VAL',$this->recurrence->getInterval());
357  $tpl->setVariable('TXT_ON_THE',$this->lng->txt('cal_on_the'));
360  }
361 
362  // UNTIL
363  $this->buildUntilSelection($tpl);
364 
365  $a_tpl->setCurrentBlock("prop_custom");
366  $a_tpl->setVariable("CUSTOM_CONTENT", $tpl->get());
367  $a_tpl->parseCurrentBlock();
368 
369  }
const IL_CAL_FREQ_MONTHLY
buildUntilSelection($tpl)
build selection for ending date
buildMonthlyByDaySelection($tpl)
build monthly by day list (e.g second monday)
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
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
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 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 protected

Returns

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

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

Referenced by checkInput().

114  {
115  if(!$this->getRecurrence() instanceof ilCalendarRecurrence)
116  {
117  return false;
118  }
119 
120 
121  switch($_POST['frequence'])
122  {
123  case IL_CAL_FREQ_DAILY:
124  $this->getRecurrence()->setFrequenceType($_POST['frequence']);
125  $this->getRecurrence()->setInterval((int) $_POST['count_DAILY']);
126  break;
127 
128  case IL_CAL_FREQ_WEEKLY:
129  $this->getRecurrence()->setFrequenceType($_POST['frequence']);
130  $this->getRecurrence()->setInterval((int) $_POST['count_WEEKLY']);
131  if(is_array($_POST['byday_WEEKLY']))
132  {
133  $this->getRecurrence()->setBYDAY(ilUtil::stripSlashes(implode(',',$_POST['byday_WEEKLY'])));
134  }
135  break;
136 
137  case IL_CAL_FREQ_MONTHLY:
138  $this->getRecurrence()->setFrequenceType($_POST['frequence']);
139  $this->getRecurrence()->setInterval((int) $_POST['count_MONTHLY']);
140  switch((int) $_POST['subtype_MONTHLY'])
141  {
142  case 0:
143  // nothing to do;
144  break;
145 
146  case 1:
147  switch((int) $_POST['monthly_byday_day'])
148  {
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 
172  case IL_CAL_FREQ_YEARLY:
173  $this->getRecurrence()->setFrequenceType($_POST['frequence']);
174  $this->getRecurrence()->setInterval((int) $_POST['count_YEARLY']);
175  switch((int) $_POST['subtype_YEARLY'])
176  {
177  case 0:
178  // nothing to do;
179  break;
180 
181  case 1:
182  $this->getRecurrence()->setBYMONTH((int) $_POST['yearly_bymonth_byday']);
183  $this->getRecurrence()->setBYDAY((int) $_POST['yearly_byday_num'].$_POST['yearly_byday']);
184  break;
185 
186  case 2:
187  $this->getRecurrence()->setBYMONTH((int) $_POST['yearly_bymonth_by_monthday']);
188  $this->getRecurrence()->setBYMONTHDAY((int) $_POST['yearly_bymonthday']);
189  break;
190  }
191  break;
192  }
193 
194  // UNTIL
195  switch((int) $_POST['until_type'])
196  {
197  case 1:
198  $this->getRecurrence()->setFrequenceUntilDate(null);
199  // nothing to do
200  break;
201 
202  case 2:
203  $this->getRecurrence()->setFrequenceUntilDate(null);
204  $this->getRecurrence()->setFrequenceUntilCount((int) $_POST['count']);
205  break;
206 
207  case 3:
208  $end_dt['year'] = (int) $_POST['until_end']['date']['y'];
209  $end_dt['mon'] = (int) $_POST['until_end']['date']['m'];
210  $end_dt['mday'] = (int) $_POST['until_end']['date']['d'];
211 
212  $this->getRecurrence()->setFrequenceUntilCount(0);
213  $this->getRecurrence()->setFrequenceUntilDate(new ilDate($end_dt,IL_CAL_FKT_GETDATE,$this->timezone));
214  break;
215  }
216 
217  return true;
218  }
const IL_CAL_FREQ_MONTHLY
$_POST['username']
Definition: cron.php:12
Class for single dates.
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
const IL_CAL_FKT_GETDATE
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 268 of file class.ilRecurrenceInputGUI.php.

Referenced by ilConsultationHoursGUI\initFormSequence().

269  {
270  $this->enabled_subforms = $a_sub_forms;
271  }
+ Here is the caller graph for this function:

◆ setRecurrence()

ilRecurrenceInputGUI::setRecurrence (   $a_rec)

set recurrence object

public

Parameters

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

Referenced by __construct().

229  {
230  $this->recurrence = $a_rec;
231  }
+ 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: