ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilRecurrenceInputGUI Class Reference

This class represents an input GUI for recurring events/appointments (course events or calendar appointments) More...

+ Inheritance diagram for ilRecurrenceInputGUI:
+ Collaboration diagram for ilRecurrenceInputGUI:

Public Member Functions

 __construct ($a_title, $a_postvar)
 Constructor.
 checkInput ()
 check input
 setRecurrence ($a_rec)
 set recurrence object
 enableUntilSelection ($a_enabled)
 enable until selection
 enabledUntilSelection ()
 enabled until selection
 setEnabledSubForms ($a_sub_forms)
 set enabled subforms
 getEnabledSubForms ()
 get enabled subforms
 insert ($a_tpl)
 insert
- Public Member Functions inherited from ilCustomInputGUI
 setHtml ($a_html)
 Set Html.
 getHtml ()
 Get Html.
 setValueByArray ($a_values)
 Set value by array.
 insert (&$a_tpl)
 Insert property html.
- Public Member Functions inherited from ilSubEnabledFormPropertyGUI
 addSubItem ($a_item)
 Add Subitem.
 getSubItems ()
 Get Subitems.
 setSubformMode ($a_subformmode)
 Set Subform Mode.
 getSubformMode ()
 Get Subform Mode.
 checkSubItemsInput ()
 Check SubItems.
 getSubForm ()
 Get sub form html.
- Public Member Functions inherited from ilFormPropertyGUI
 getType ()
 Get Type.
 setTitle ($a_title)
 Set Title.
 getTitle ()
 Get Title.
 setPostVar ($a_postvar)
 Set Post Variable.
 getPostVar ()
 Get Post Variable.
 getFieldId ()
 Get Post Variable.
 setInfo ($a_info)
 Set Information Text.
 getInfo ()
 Get Information Text.
 setAlert ($a_alert)
 Set Alert Text.
 getAlert ()
 Get Alert Text.
 setRequired ($a_required)
 Set Required.
 getRequired ()
 Get Required.
 setDisabled ($a_disabled)
 Set Disabled.
 getDisabled ()
 Get Disabled.

Data Fields

const REC_LIMITED = 2
const REC_UNLIMITED = 1

Protected Member Functions

 buildWeekDaySelection ($tpl)
 build weekday checkboxes
 buildMonthlyByDaySelection ($tpl)
 build monthly by day list (e.g second monday)
 buildMonthlyByMonthDaySelection ($tpl)
 build monthly bymonthday selection
 buildYearlyByMonthDaySelection ($tpl)
 protected
 buildYearlyByDaySelection ($tpl)
 protected
 buildUntilSelection ($tpl)
 build selection for ending date

Protected Attributes

 $lng
 $recurrence
 $user_settings
 $until_selection = true
 $enabled_subforms
- Protected Attributes inherited from ilCustomInputGUI
 $html
- Protected Attributes inherited from ilSubEnabledFormPropertyGUI
 $sub_items = array()
 $subformmode = "bottom"
- Protected Attributes inherited from ilFormPropertyGUI
 $type
 $title
 $postvar
 $info
 $alert
 $required = false

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

Constructor & Destructor Documentation

ilRecurrenceInputGUI::__construct (   $a_title,
  $a_postvar 
)

Constructor.

public

Parameters
stringtitle
stringpostvar

Reimplemented from ilCustomInputGUI.

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

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

{
global $lng,$tpl,$ilUser;
$this->lng = $lng;
$this->lng->loadLanguageModule('dateplaner');
$this->user_settings = ilCalendarUserSettings::_getInstanceByUserId($ilUser->getId());
$tpl->addJavascript("./Services/Calendar/js/recurrence_input.js");
parent::__construct($a_title,$a_postvar);
}

+ Here is the call graph for this function:

Member Function Documentation

ilRecurrenceInputGUI::buildMonthlyByDaySelection (   $tpl)
protected

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

protected

Parameters
@return

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

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

Referenced by insert().

{
$byday_list = $this->recurrence->getBYDAYList();
$chosen_num_day = 1;
$chosen_day = 'MO';
$chosen = false;
foreach($byday_list as $byday)
{
if(preg_match('/^(-?\d)([A-Z][A-Z])/',$byday,$parsed) === 1)
{
$chosen = true;
$chosen_num_day = $parsed[1];
$chosen_day = $parsed[2];
}
}
// check for last day
if(count($this->recurrence->getBYMONTHDAYList()) == 1)
{
$bymonthday = $this->recurrence->getBYMONTHDAY();
if(in_array($bymonthday,array(1,2,3,4,5,-1)))
{
$chosen = true;
$chosen_num_day = $bymonthday;
$chosen_day = 9;
}
}
// Check for first, second... last weekday
if(count($this->recurrence->getBYSETPOSList()) == 1)
{
$bysetpos = $this->recurrence->getBYSETPOS();
if(in_array($bysetpos,array(1,2,3,4,5,-1)))
{
if($this->recurrence->getBYDAYList() == array('MO','TU','WE','TH','FR'))
{
$chosen = true;
$chosen_num_day = $bysetpos;
$chosen_day = 8;
}
}
}
if($chosen)
{
$tpl->setVariable('M_BYDAY_CHECKED','checked="checked"');
}
$num_options = array(
1 => $this->lng->txt('cal_first'),
2 => $this->lng->txt('cal_second'),
3 => $this->lng->txt('cal_third'),
4 => $this->lng->txt('cal_fourth'),
5 => $this->lng->txt('cal_fifth'),
-1 => $this->lng->txt('cal_last'));
$tpl->setVariable('SELECT_BYDAY_NUM_MONTHLY',ilUtil::formSelect(
$chosen_num_day,
'monthly_byday_num',
$num_options,
false,
true,
'',
'',
array('onchange' => "ilUpdateSubTypeSelection('sub_monthly_radio_1');")));
$days = array(0 => 'SU',1 => 'MO',2 => 'TU',3 => 'WE',4 => 'TH',5 => 'FR',6 => 'SA',7 => 'SU');
for($i = (int) $this->user_settings->getWeekStart();$i < 7 + (int) $this->user_settings->getWeekStart();$i++)
{
$days_select[$days[$i]] = ilCalendarUtil::_numericDayToString($i);
}
$days_select[8] = $this->lng->txt('cal_weekday');
$days_select[9] = $this->lng->txt('cal_day_of_month');
$tpl->setVariable('SEL_BYDAY_DAY_MONTHLY',ilUtil::formSelect(
$chosen_day,
'monthly_byday_day',
$days_select,
false,
true,
'',
'',
array('onchange' => "ilUpdateSubTypeSelection('sub_monthly_radio_1');")));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilRecurrenceInputGUI::buildMonthlyByMonthDaySelection (   $tpl)
protected

build monthly bymonthday selection

protected

Parameters
@return

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

References $tpl, and ilUtil\formSelect().

Referenced by insert().

{
$tpl->setVariable('TXT_IN',$this->lng->txt('cal_in'));
$chosen_day = 1;
$chosen = false;
if(count($bymonthday = $this->recurrence->getBYMONTHDAYList()) == 1)
{
foreach($bymonthday as $mday)
{
if($mday > 0 and $mday < 32)
{
$chosen = true;
$chosen_day = $mday;
}
}
}
if($chosen)
{
$tpl->setVariable('M_BYMONTHDAY_CHECKED','checked="checked"');
}
for($i = 1; $i < 32;$i++)
{
$options[$i] = $i;
}
$tpl->setVariable('SELECT_BYMONTHDAY',ilUtil::formSelect(
$chosen_day,
'monthly_bymonthday',
$options,
false,
true,
'',
'',
array('onchange' => "ilUpdateSubTypeSelection('sub_monthly_radio_2');")));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilRecurrenceInputGUI::buildUntilSelection (   $tpl)
protected

build selection for ending date

protected

Parameters
objecttpl
Returns

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

References $tpl, and enabledUntilSelection().

Referenced by insert().

{
if($this->enabledUntilSelection())
{
$tpl->setVariable('TXT_NO_ENDING',$this->lng->txt('cal_no_ending'));
$tpl->setVariable('TXT_UNTIL_CREATE',$this->lng->txt('cal_create'));
$tpl->setVariable('TXT_APPOINTMENTS',$this->lng->txt('cal_appointments'));
$tpl->setVariable('VAL_COUNT',$this->recurrence->getFrequenceUntilCount() ?
$this->recurrence->getFrequenceUntilCount() :
2);
if($this->recurrence->getFrequenceUntilCount())
{
$tpl->setVariable('UNTIL_COUNT_CHECKED','checked="checked"');
}
else
{
$tpl->setVariable('UNTIL_NO_CHECKED','checked="checked"');
}
}
else
{
$tpl->setVariable('TXT_FIXED_UNTIL_CREATE',$this->lng->txt('cal_create'));
$tpl->setVariable('TXT_FIXED_APPOINTMENTS',$this->lng->txt('cal_appointments'));
$tpl->setVariable('VAL_FIXED_COUNT',$this->recurrence->getFrequenceUntilCount() ?
$this->recurrence->getFrequenceUntilCount() :
5);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilRecurrenceInputGUI::buildWeekDaySelection (   $tpl)
protected

build weekday checkboxes

protected

Parameters
objecttpl

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

References $tpl, and ilCalendarUtil\_numericDayToString().

Referenced by insert().

{
$days = array(0 => 'SU',1 => 'MO',2 => 'TU',3 => 'WE',4 => 'TH',5 => 'FR',6 => 'SA',7 => 'SU');
$checked_days = array();
foreach($this->recurrence->getBYDAYList() as $byday)
{
if(in_array($byday,$days))
{
$checked_days[] = $byday;
}
}
for($i = (int) $this->user_settings->getWeekStart();$i < 7 + (int) $this->user_settings->getWeekStart();$i++)
{
$tpl->setCurrentBlock('byday_simple');
if(in_array($days[$i],$checked_days))
{
$tpl->setVariable('BYDAY_WEEKLY_CHECKED','checked="checked"');
}
$tpl->setVariable('TXT_ON',$this->lng->txt('cal_on'));
$tpl->setVariable('BYDAY_WEEKLY_VAL',$days[$i]);
$tpl->setVariable('TXT_DAY_SHORT',ilCalendarUtil::_numericDayToString($i,false));
$tpl->parseCurrentBlock();
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilRecurrenceInputGUI::buildYearlyByDaySelection (   $tpl)
protected

protected

Parameters
@return

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

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

Referenced by insert().

{
$tpl->setVariable('TXT_ON_THE',$this->lng->txt('cal_on_the'));
$chosen_num_day = 1;
$chosen_day = 'MO';
$chosen = false;
foreach($this->recurrence->getBYDAYList() as $byday)
{
if(preg_match('/^(-?\d)([A-Z][A-Z])/',$byday,$parsed) === 1)
{
$chosen = true;
$chosen_num_day = $parsed[1];
$chosen_day = $parsed[2];
}
}
$num_options = array(
1 => $this->lng->txt('cal_first'),
2 => $this->lng->txt('cal_second'),
3 => $this->lng->txt('cal_third'),
4 => $this->lng->txt('cal_fourth'),
5 => $this->lng->txt('cal_fifth'),
-1 => $this->lng->txt('cal_last'));
$tpl->setVariable('SELECT_BYDAY_NUM_YEARLY',ilUtil::formSelect(
$chosen_num_day,
'yearly_byday_num',
$num_options,
false,
true,
'',
'',
array('onchange' => "ilUpdateSubTypeSelection('sub_yearly_radio_1');")));
$days = array(0 => 'SU',1 => 'MO',2 => 'TU',3 => 'WE',4 => 'TH',5 => 'FR',6 => 'SA',7 => 'SU');
for($i = (int) $this->user_settings->getWeekStart();$i < 7 + (int) $this->user_settings->getWeekStart();$i++)
{
$days_select[$days[$i]] = ilCalendarUtil::_numericDayToString($i);
}
$tpl->setVariable('SELECT_BYDAY_DAY_YEARLY',ilUtil::formSelect(
$chosen_day,
'yearly_byday',
$days_select,
false,
true,
'',
'',
array('onchange' => "ilUpdateSubTypeSelection('sub_yearly_radio_1');")));
$chosen = false;
$chosen_month = 1;
foreach($this->recurrence->getBYMONTHList() as $month)
{
if($this->recurrence->getBYMONTHDAYList())
{
$chosen_month = $month;
$chosen = true;
break;
}
}
$options = array();
for($m = 1;$m < 13;$m++)
{
}
$tpl->setVariable('SELECT_BYMONTH_BYDAY',ilUtil::formSelect(
$chosen_month,
'yearly_bymonth_byday',
$options,
false,
true,
'',
'',
array('onchange' => "ilUpdateSubTypeSelection('sub_yearly_radio_1');")));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilRecurrenceInputGUI::buildYearlyByMonthDaySelection (   $tpl)
protected

protected

Parameters
objettpl
Returns

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

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

Referenced by insert().

{
$tpl->setVariable('TXT_Y_EVERY',$this->lng->txt('cal_every'));
$chosen = false;
$chosen_month = 1;
$chosen_day = 1;
foreach($this->recurrence->getBYMONTHList() as $month)
{
if($this->recurrence->getBYMONTHDAYList())
{
$chosen_month = $month;
$chosen = true;
break;
}
}
foreach($this->recurrence->getBYMONTHDAYList() as $day)
{
$chosen_day = $day;
}
for($i = 1; $i < 32;$i++)
{
$options[$i] = $i;
}
$tpl->setVariable('SELECT_BYMONTHDAY_NUM_YEARLY',ilUtil::formSelect(
$chosen_day,
'yearly_bymonthday',
$options,
false,
true,
'',
'',
array('onchange' => "ilUpdateSubTypeSelection('sub_yearly_radio_2');")));
$options = array();
for($m = 1;$m < 13;$m++)
{
}
$tpl->setVariable('SELECT_BYMONTH_YEARLY',ilUtil::formSelect(
$chosen_month,
'yearly_bymonth_by_monthday',
$options,
false,
true,
'',
'',
array('onchange' => "ilUpdateSubTypeSelection('sub_yearly_radio_2');")));
if($chosen)
{
$tpl->setVariable('Y_BYMONTHDAY_CHECKED','checked="checked"');
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilRecurrenceInputGUI::checkInput ( )

check input

public

Parameters
@return

Reimplemented from ilFormPropertyGUI.

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

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

{
global $lng;
if($_POST['frequence'] == 'NONE')
{
return true;
}
if(!isset($_POST['until_type']) or $_POST['until_type'] == REC_LIMITED)
{
if($_POST['count'] <= 0 or $_POST['count'] >= 100)
{
$this->setAlert($lng->txt("cal_rec_err_limit"));
return false;
}
}
return true;
}

+ Here is the call graph for this function:

ilRecurrenceInputGUI::enabledUntilSelection ( )

enabled until selection

public

Returns

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

References $until_selection.

Referenced by buildUntilSelection().

{
return (bool) $this->until_selection;
}

+ Here is the caller graph for this function:

ilRecurrenceInputGUI::enableUntilSelection (   $a_enabled)

enable until selection

public

Returns

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

Referenced by ilObjSessionGUI\initForm().

{
$this->until_selection = $a_enabled;
}

+ Here is the caller graph for this function:

ilRecurrenceInputGUI::getEnabledSubForms ( )

get enabled subforms

public

Returns

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

References $enabled_subforms.

ilRecurrenceInputGUI::insert (   $a_tpl)

insert

public

Parameters
@return

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

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

{
$tpl = new ilTemplate('tpl.recurrence_input.html',true,true,'Services/Calendar');
$options = array('NONE' => $this->lng->txt('cal_no_recurrences'),
IL_CAL_FREQ_DAILY => $this->lng->txt('cal_daily'),
IL_CAL_FREQ_WEEKLY=> $this->lng->txt('cal_weekly'),
IL_CAL_FREQ_MONTHLY => $this->lng->txt('cal_monthly'),
IL_CAL_FREQ_YEARLY => $this->lng->txt('cal_yearly'));
$tpl->setVariable('FREQUENCE',ilUtil::formSelect(
$this->recurrence->getFrequenceType(),
'frequence',
$options,
false,
true,
'',
'',
array('onchange' => 'ilHideFrequencies();','id' => 'il_recurrence_1')));
$tpl->setVariable('TXT_EVERY',$this->lng->txt('cal_every'));
// DAILY
$tpl->setVariable('TXT_DAILY_FREQ_UNIT',$this->lng->txt('cal_day_s'));
$tpl->setVariable('COUNT_DAILY_VAL',$this->recurrence->getInterval());
// WEEKLY
$tpl->setVariable('TXT_WEEKLY_FREQ_UNIT',$this->lng->txt('cal_week_s'));
$tpl->setVariable('COUNT_WEEKLY_VAL',$this->recurrence->getInterval());
// MONTHLY
$tpl->setVariable('TXT_MONTHLY_FREQ_UNIT',$this->lng->txt('cal_month_s'));
$tpl->setVariable('COUNT_MONTHLY_VAL',$this->recurrence->getInterval());
$tpl->setVariable('TXT_ON_THE',$this->lng->txt('cal_on_the'));
$tpl->setVariable('TXT_BYMONTHDAY',$this->lng->txt('cal_on_the'));
$tpl->setVariable('TXT_OF_THE_MONTH',$this->lng->txt('cal_of_the_month'));
// YEARLY
$tpl->setVariable('TXT_YEARLY_FREQ_UNIT',$this->lng->txt('cal_year_s'));
$tpl->setVariable('COUNT_YEARLY_VAL',$this->recurrence->getInterval());
$tpl->setVariable('TXT_ON_THE',$this->lng->txt('cal_on_the'));
// UNTIL
$a_tpl->setCurrentBlock("prop_custom");
$a_tpl->setVariable("CUSTOM_CONTENT", $tpl->get());
$a_tpl->parseCurrentBlock();
}

+ Here is the call graph for this function:

ilRecurrenceInputGUI::setEnabledSubForms (   $a_sub_forms)

set enabled subforms

public

Parameters
array(IL_CAL_FREQ_DAILY,IL_CAL_FREQ_WEEKLY...)
Returns

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

{
$this->enabled_subforms = $a_sub_forms;
}
ilRecurrenceInputGUI::setRecurrence (   $a_rec)

set recurrence object

public

Parameters
@return

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

{
$this->recurrence = $a_rec;
}

Field Documentation

ilRecurrenceInputGUI::$enabled_subforms
protected
ilRecurrenceInputGUI::$lng
protected

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

Referenced by __construct(), and checkInput().

ilRecurrenceInputGUI::$recurrence
protected

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

ilRecurrenceInputGUI::$until_selection = true
protected

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

Referenced by enabledUntilSelection().

ilRecurrenceInputGUI::$user_settings
protected

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

const ilRecurrenceInputGUI::REC_LIMITED = 2

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

Referenced by checkInput().

const ilRecurrenceInputGUI::REC_UNLIMITED = 1

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


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