ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilCalendarAppointmentGUI Class Reference

Administrate calendar appointments. More...

+ Collaboration diagram for ilCalendarAppointmentGUI:

Public Member Functions

 __construct (ilDate $seed, $a_appointment_id=0)
 Constructor.
 executeCommand ()
 Execute command.
 editResponsibleUsers ()
 Edit responsible users.
 showResponsibleUsersList ($a_grp_id)
 Show responsible uses of a milestone (default set is participants of group)
 saveMilestoneResponsibleUsers ()
 Save milestone responsibilites.

Protected Member Functions

 cancel ()
 cancel editing
 initForm ($a_mode, $a_as_milestone=false)
 init form
 add ()
 add new appointment
 addMilestone ()
 add milestone
 saveMilestone ()
 save milestone
 save ($a_as_milestone=false)
 save appointment
 edit ()
 edit appointment
 showInfoScreen ()
 show info screen
 update ()
 update
 askDelete ()
 ask delete
 delete ()
 delete
 initTimeZone ()
 init timezone
 initSeed (ilDate $seed)
 init seed
 initAppointment ($a_app_id=0)
 init appointment
 load ($a_as_milestone=false)
 load post
 loadRecurrenceSettings ($a_as_milestone=false)
 load recurrence settings
 saveRecurrenceSettings ()
 save recurrence settings
 createDefaultCalendar ()
 Create a default calendar.

Protected Attributes

 $seed = null
 $default_fulltime = true
 $app = null
 $rec = null
 $timezone = null
 $tpl
 $lng
 $ctrl

Detailed Description

Administrate 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.ilCalendarAppointmentGUI.php.

Constructor & Destructor Documentation

ilCalendarAppointmentGUI::__construct ( ilDate  $seed,
  $a_appointment_id = 0 
)

Constructor.

public

Parameters
ilDateseed
Returns

Definition at line 56 of file class.ilCalendarAppointmentGUI.php.

References $ilCtrl, $lng, initAppointment(), initSeed(), and initTimeZone().

{
global $ilCtrl,$lng;
$this->lng = $lng;
$lng->loadLanguageModule('dateplaner');
$this->ctrl = $ilCtrl;
$this->initTimeZone();
$this->initSeed($seed);
$this->initAppointment($a_appointment_id);
}

+ Here is the call graph for this function:

Member Function Documentation

ilCalendarAppointmentGUI::add ( )
protected

add new appointment

protected

Returns

Definition at line 317 of file class.ilCalendarAppointmentGUI.php.

References $tpl, and initForm().

Referenced by save().

{
global $tpl;
$this->initForm('create');
$tpl->setContent($this->form->getHTML());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCalendarAppointmentGUI::addMilestone ( )
protected

add milestone

protected

Returns

Definition at line 331 of file class.ilCalendarAppointmentGUI.php.

References $tpl, and initForm().

Referenced by save().

{
global $tpl;
$this->initForm('create', true);
$tpl->setContent($this->form->getHTML());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCalendarAppointmentGUI::askDelete ( )
protected

ask delete

protected

Returns

Definition at line 623 of file class.ilCalendarAppointmentGUI.php.

References $tpl.

{
global $tpl;
include_once('./Services/Utilities/classes/class.ilConfirmationGUI.php');
$this->ctrl->saveParameter($this,array('seed','app_id'));
$confirm = new ilConfirmationGUI();
$confirm->setFormAction($this->ctrl->getFormAction($this));
$confirm->setHeaderText($this->lng->txt('cal_delete_app_sure'));
$confirm->setCancel($this->lng->txt('cancel'),'edit');
$confirm->setConfirm($this->lng->txt('delete'),'delete');
$confirm->addItem('appointments[]',$this->app->getEntryId(),$this->app->getTitle());
$tpl->setContent($confirm->getHTML());
}
ilCalendarAppointmentGUI::cancel ( )
protected

cancel editing

protected

Parameters
@return

Definition at line 99 of file class.ilCalendarAppointmentGUI.php.

{
$this->ctrl->returnToParent($this);
}
ilCalendarAppointmentGUI::createDefaultCalendar ( )
protected

Create a default calendar.

protected

Returns

Definition at line 948 of file class.ilCalendarAppointmentGUI.php.

References $lng, ilCalendarCategory\DEFAULT_COLOR, and ilCalendarCategory\TYPE_USR.

Referenced by save(), and update().

{
global $ilUser,$lng;
$cat = new ilCalendarCategory();
$cat->setTitle($this->lng->txt('cal_default_calendar'));
$cat->setObjId($ilUser->getId());
return $cat->add();
}

+ Here is the caller graph for this function:

ilCalendarAppointmentGUI::delete ( )
protected

delete

protected

Parameters
@return

Definition at line 648 of file class.ilCalendarAppointmentGUI.php.

References $_POST, $app, ilCalendarCategoryAssignments\_deleteByAppointmentId(), and ilUtil\sendSuccess().

{
foreach($_POST['appointments'] as $app_id)
{
$app = new ilCalendarEntry($app_id);
$app->delete();
include_once('./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
}
ilUtil::sendSuccess($this->lng->txt('cal_deleted_app'),true);
$this->ctrl->returnToParent($this);
}

+ Here is the call graph for this function:

ilCalendarAppointmentGUI::edit ( )
protected

edit appointment

protected

Parameters
@return

Definition at line 460 of file class.ilCalendarAppointmentGUI.php.

References $ilErr, $tpl, ilCalendarCategories\_getInstance(), ilCalendarCategoryAssignments\_lookupCategory(), initForm(), and showInfoScreen().

Referenced by update().

{
global $tpl,$ilUser,$ilErr;
include_once('./Services/Calendar/classes/class.ilCalendarCategory.php');
include_once('./Services/Calendar/classes/class.ilCalendarCategories.php');
include_once('./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
$cat_id = ilCalendarCategoryAssignments::_lookupCategory($this->app->getEntryId());
$cats = ilCalendarCategories::_getInstance($ilUser->getId());
if(!$cats->isVisible($cat_id))
{
$ilErr->raiseError($this->lng->txt('permission_denied'),$ilErr->WARNING);
return false;
}
if(!$cats->isEditable($cat_id) or $this->app->isAutoGenerated())
{
$this->showInfoScreen();
return true;
}
$this->initForm('edit', $this->app->isMilestone());
$tpl->setContent($this->form->getHTML());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCalendarAppointmentGUI::editResponsibleUsers ( )

Edit responsible users.

Definition at line 418 of file class.ilCalendarAppointmentGUI.php.

References ilCalendarCategories\_getInstance(), ilCalendarCategoryAssignments\_lookupCategory(), and showResponsibleUsersList().

{
include_once('./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
$cat_id = ilCalendarCategoryAssignments::_lookupCategory($this->app->getEntryId());
include_once('./Services/Calendar/classes/class.ilCalendarCategory.php');
$cat_info = ilCalendarCategories::_getInstance()->getCategoryInfo($cat_id);
$this->showResponsibleUsersList($cat_info['obj_id']);
}

+ Here is the call graph for this function:

ilCalendarAppointmentGUI::executeCommand ( )

Execute command.

public

Parameters

Definition at line 76 of file class.ilCalendarAppointmentGUI.php.

References $cmd, $ilSetting, and $tpl.

{
global $ilUser, $ilSetting,$tpl;
$next_class = $this->ctrl->getNextClass($this);
switch($next_class)
{
default:
$cmd = $this->ctrl->getCmd("add");
$this->$cmd();
break;
}
return true;
}
ilCalendarAppointmentGUI::initAppointment (   $a_app_id = 0)
protected

init appointment

protected

Parameters
intappointment id
Returns

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

References $seed, $start, ilCalendarRecurrences\_getFirstRecurrence(), and IL_CAL_HOUR.

Referenced by __construct().

{
include_once('./Services/Calendar/classes/class.ilCalendarEntry.php');
include_once('./Services/Calendar/classes/class.ilCalendarRecurrences.php');
$this->app = new ilCalendarEntry($a_app_id);
if(!$a_app_id)
{
$this->app->setStart($start);
$seed_end = clone $this->seed;
if($this->default_fulltime)
{
#$seed_end->increment(IL_CAL_DAY,1);
}
else
{
$seed_end->increment(IL_CAL_HOUR,1);
}
$this->app->setEnd($seed_end);
$this->app->setFullday($this->default_fulltime);
$this->rec = new ilCalendarRecurrence();
}
else
{
$this->rec = ilCalendarRecurrences::_getFirstRecurrence($this->app->getEntryId());
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCalendarAppointmentGUI::initForm (   $a_mode,
  $a_as_milestone = false 
)
protected

init form

protected

Parameters
stringmode ('edit' | 'create')
Returns

Definition at line 111 of file class.ilCalendarAppointmentGUI.php.

References $_GET, $_POST, $desc, $rec, $title, $tpl, $type, ilCalendarCategories\_getInstance(), ilCalendarCategories\_lookupCategoryIdByObjId(), ilObject\_lookupObjId(), ilObject\_lookupType(), elseif(), ilCalendarCategoryAssignments\getFirstAssignment(), ilYuiUtil\initDomEvent(), ilDateTimeInputGUI\setDate(), ilSelectInputGUI\setOptions(), ilDateDurationInputGUI\setStartText(), ilTextInputGUI\setValue(), ilSelectInputGUI\setValue(), ilNonEditableValueGUI\setValue(), and ilCalendarCategory\TYPE_OBJ.

Referenced by add(), addMilestone(), and edit().

{
global $ilUser,$tpl;
include_once('./Services/Form/classes/class.ilPropertyFormGUI.php');
include_once('./Services/Calendar/classes/class.ilCalendarRecurrenceGUI.php');
include_once('./Services/Calendar/classes/class.ilCalendarCategories.php');
include_once('./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
include_once('./Services/Calendar/classes/class.ilCalendarCategory.php');
$this->form = new ilPropertyFormGUI();
include_once('./Services/YUI/classes/class.ilYuiUtil.php');
$resp_info = false;
switch($a_mode)
{
case 'create':
$this->ctrl->saveParameter($this,array('seed'));
$this->form->setFormAction($this->ctrl->getFormAction($this));
if ($a_as_milestone)
{
$this->form->setTitle($this->lng->txt('cal_new_ms'));
$this->form->addCommandButton('saveMilestone',$this->lng->txt('cal_add_milestone'));
$this->form->addCommandButton('cancel',$this->lng->txt('cancel'));
}
else
{
$this->form->setTitle($this->lng->txt('cal_new_app'));
$this->form->addCommandButton('save',$this->lng->txt('cal_add_appointment'));
$this->form->addCommandButton('cancel',$this->lng->txt('cancel'));
}
break;
case 'edit':
if ($a_as_milestone)
{
$this->form->setTitle($this->lng->txt('cal_edit_milestone'));
}
else
{
$this->form->setTitle($this->lng->txt('cal_edit_appointment'));
}
$this->ctrl->saveParameter($this,array('seed','app_id'));
$this->form->setFormAction($this->ctrl->getFormAction($this));
$ass = new ilCalendarCategoryAssignments($this->app->getEntryId());
$cat = $ass->getFirstAssignment();
include_once('./Services/Calendar/classes/class.ilCalendarCategory.php');
$cat_info = ilCalendarCategories::_getInstance()->getCategoryInfo($cat);
$type = ilObject::_lookupType($cat_info['obj_id']);
if ($a_as_milestone && $cat_info['type'] == ilCalendarCategory::TYPE_OBJ
&& ($type == "grp" || $type == "crs"))
{
$resp_info = true;
$this->form->addCommandButton('editResponsibleUsers',$this->lng->txt('cal_change_responsible_users'));
}
$this->form->addCommandButton('update',$this->lng->txt('save'));
$this->form->addCommandButton('askDelete',$this->lng->txt('delete'));
$this->form->addCommandButton('cancel',$this->lng->txt('cancel'));
break;
}
// title
$title = new ilTextInputGUI($this->lng->txt('title'),'title');
$title->setValue($this->app->getTitle());
$title->setRequired(true);
$title->setMaxLength(128);
$title->setSize(32);
$this->form->addItem($title);
// calendar selection
$calendar = new ilSelectInputGUI($this->lng->txt('cal_category_selection'),'calendar');
if($_POST['category'])
{
$calendar->setValue((int) $_POST['calendar']);
}
elseif($a_mode == 'edit')
{
$ass = new ilCalendarCategoryAssignments($this->app->getEntryId());
$cat = $ass->getFirstAssignment();
$calendar->setValue($cat);
}
elseif(isset($_GET['ref_id']))
{
include_once('./Services/Calendar/classes/class.ilCalendarCategories.php');
$obj_cal = ilObject::_lookupObjId($_GET['ref_id']);
$calendar->setValue(ilCalendarCategories::_lookupCategoryIdByObjId($obj_cal));
}
$calendar->setRequired(true);
$cats = ilCalendarCategories::_getInstance($ilUser->getId());
$calendar->setOptions($cats->prepareCategoriesOfUserForSelection());
$this->form->addItem($calendar);
if (!$a_as_milestone)
{
include_once './Services/Form/classes/class.ilDateDurationInputGUI.php';
#$tpl->addJavaScript('./Modules/Session/js/toggle_session_time.js');
$tpl->addJavaScript('./Services/Form/js/date_duration.js');
$dur = new ilDateDurationInputGUI($this->lng->txt('cal_fullday'),'event');
$dur->setStartText($this->lng->txt('cal_start'));
$dur->setEndText($this->lng->txt('cal_end'));
$dur->enableToggleFullTime(
$this->lng->txt('cal_fullday_title'),
$this->app->isFullday() ? true : false
);
$dur->setMinuteStepSize(5);
$dur->setShowDate(true);
$dur->setShowTime(true);
$dur->setStart($this->app->getStart());
$dur->setEnd($this->app->getEnd());
$this->form->addItem($dur);
/*
$tpl->addJavaScript('./Services/Calendar/js/toggle_appointment_time.js');
$fullday = new ilCheckboxInputGUI($this->lng->txt('cal_fullday'),'fullday');
$fullday->setChecked($this->app->isFullday() ? true : false);
$fullday->setOptionTitle($this->lng->txt('cal_fullday_title'));
$fullday->setAdditionalAttributes('onchange="ilToggleAppointmentTime(this);"');
$this->form->addItem($fullday);
$start = new ilDateTimeInputGUI($this->lng->txt('cal_start'),'start');
$start->setDate($this->app->getStart());
$start->setShowTime(true);
$start->setMinuteStepSize(5);
$this->form->addItem($start);
#$fullday->addSubItem($start);
$end = new ilDateTimeInputGUI($this->lng->txt('cal_end'),'end');
$end->setDate($this->app->getEnd());
$end->setShowTime(true);
$end->setMinuteStepSize(5);
#$fullday->addSubItem($end);
$this->form->addItem($end);
*/
// recurrence
include_once('./Services/Calendar/classes/Form/class.ilRecurrenceInputGUI.php');
$rec = new ilRecurrenceInputGUI($this->lng->txt('cal_recurrences'),'frequence');
$rec->setRecurrence($this->rec);
$this->form->addItem($rec);
// location
$where = new ilTextInputGUI($this->lng->txt('cal_where'),'location');
$where->setValue($this->app->getLocation());
$where->setMaxLength(128);
$where->setSize(32);
$this->form->addItem($where);
}
else
{
$deadline = new ilDateTimeInputGUI($this->lng->txt('cal_deadline'),'event[start]');
$deadline->setDate($this->app->getStart());
$deadline->setShowTime(false);
$deadline->setMinuteStepSize(5);
$this->form->addItem($deadline);
// completion
$completion_vals = array();
for($i = 0; $i <= 100; $i+=5)
{
$completion_vals[$i] = $i." %";
}
$compl = new ilSelectInputGUI($this->lng->txt('cal_task_completion'),
'completion');
$compl->setOptions($completion_vals);
$compl->setValue($this->app->getCompletion());
$this->form->addItem($compl);
}
$desc = new ilTextAreaInputGUI($this->lng->txt('description'),'description');
$desc->setValue($this->app->getDescription());
$desc->setCols(3);
$this->form->addItem($desc);
if ($a_as_milestone && $a_mode == "edit" && $resp_info)
{
// users responsible
$users = $this->app->readResponsibleUsers();
$resp = new ilNonEditableValueGUI($this->lng->txt('cal_responsible'),
$users);
$delim = "";
foreach($users as $r)
{
$value.= $delim.$r["lastname"].", ".$r["firstname"]." [".$r["login"]."]";
$delim = "<br />";
}
if (count($users) > 0)
{
$resp->setValue($value);
}
else
{
$resp->setValue("-");
}
$this->form->addItem($resp);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCalendarAppointmentGUI::initSeed ( ilDate  $seed)
protected

init seed

protected

Parameters
@return

Definition at line 683 of file class.ilCalendarAppointmentGUI.php.

References $_GET, $seed, $timezone, ilDate\get(), IL_CAL_DATE, and IL_CAL_DATETIME.

Referenced by __construct().

{
if(!isset($_GET['hour']))
{
$this->seed = clone $seed;
$this->default_fulltime = true;
}
else
{
if((int) $_GET['hour'] < 10)
{
$time = '0'.(int) $_GET['hour'].':00:00';
}
else
{
$time = (int) $_GET['hour'].':00:00';
}
$this->seed = new ilDateTime($seed->get(IL_CAL_DATE).' '.$time,IL_CAL_DATETIME,$this->timezone);
$this->default_fulltime = false;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCalendarAppointmentGUI::initTimeZone ( )
protected

init timezone

protected

Parameters
@return

Definition at line 669 of file class.ilCalendarAppointmentGUI.php.

Referenced by __construct().

{
global $ilUser;
$this->timezone = $ilUser->getTimeZone();
}

+ Here is the caller graph for this function:

ilCalendarAppointmentGUI::load (   $a_as_milestone = false)
protected

load post

protected

Parameters
@return

Definition at line 752 of file class.ilCalendarAppointmentGUI.php.

References $_POST, $start, IL_CAL_DATE, IL_CAL_FKT_GETDATE, loadRecurrenceSettings(), and ilUtil\stripSlashes().

Referenced by save(), and update().

{
if ($a_as_milestone)
{
$this->app->setMilestone(true);
$this->app->setCompletion(ilUtil::stripSlashes($_POST['completion']));
}
$this->app->setTitle(ilUtil::stripSlashes($_POST['title']));
$this->app->setLocation(ilUtil::stripSlashes($_POST['location']));
$this->app->setDescription(ilUtil::stripSlashes($_POST['description']));
$this->app->setTitle(ilUtil::stripSlashes($_POST['title']));
if ($a_as_milestone) // milestones are always fullday events
{
$this->app->setFullday(true);
}
else
{
$this->app->setFullday(isset($_POST['event']['fulltime']) ? true : false);
}
if($this->app->isFullday())
{
$start = new ilDate($_POST['event']['start']['date']['y'].'-'.$_POST['event']['start']['date']['m'].'-'.$_POST['event']['start']['date']['d'],
$this->app->setStart($start);
$end = new ilDate($_POST['event']['end']['date']['y'].'-'.$_POST['event']['end']['date']['m'].'-'.$_POST['event']['end']['date']['d'],
if ($a_as_milestone)
{
// for milestones is end date = start date
$this->app->setEnd($start);
}
else
{
$this->app->setEnd($end);
}
}
else
{
$start_dt['year'] = (int) $_POST['event']['start']['date']['y'];
$start_dt['mon'] = (int) $_POST['event']['start']['date']['m'];
$start_dt['mday'] = (int) $_POST['event']['start']['date']['d'];
$start_dt['hours'] = (int) $_POST['event']['start']['time']['h'];
$start_dt['minutes'] = (int) $_POST['event']['start']['time']['m'];
$start = new ilDateTime($start_dt,IL_CAL_FKT_GETDATE,$this->timezone);
$this->app->setStart($start);
$end_dt['year'] = (int) $_POST['event']['end']['date']['y'];
$end_dt['mon'] = (int) $_POST['event']['end']['date']['m'];
$end_dt['mday'] = (int) $_POST['event']['end']['date']['d'];
$end_dt['hours'] = (int) $_POST['event']['end']['time']['h'];
$end_dt['minutes'] = (int) $_POST['event']['end']['time']['m'];
$end = new ilDateTime($end_dt,IL_CAL_FKT_GETDATE,$this->timezone);
$this->app->setEnd($end);
}
$this->loadRecurrenceSettings($a_as_milestone = false);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCalendarAppointmentGUI::loadRecurrenceSettings (   $a_as_milestone = false)
protected

load recurrence settings

protected

Returns

Definition at line 819 of file class.ilCalendarAppointmentGUI.php.

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

Referenced by load().

{
$this->rec->reset();
switch($_POST['frequence'])
{
$this->rec->setFrequenceType($_POST['frequence']);
$this->rec->setInterval((int) $_POST['count_DAILY']);
break;
$this->rec->setFrequenceType($_POST['frequence']);
$this->rec->setInterval((int) $_POST['count_WEEKLY']);
if(is_array($_POST['byday_WEEKLY']))
{
$this->rec->setBYDAY(ilUtil::stripSlashes(implode(',',$_POST['byday_WEEKLY'])));
}
break;
$this->rec->setFrequenceType($_POST['frequence']);
$this->rec->setInterval((int) $_POST['count_MONTHLY']);
switch((int) $_POST['subtype_MONTHLY'])
{
case 0:
// nothing to do;
break;
case 1:
switch((int) $_POST['monthly_byday_day'])
{
case 8:
// Weekday
$this->rec->setBYSETPOS((int) $_POST['monthly_byday_num']);
$this->rec->setBYDAY('MO,TU,WE,TH,FR');
break;
case 9:
// Day of month
$this->rec->setBYMONTHDAY((int) $_POST['monthly_byday_num']);
break;
default:
$this->rec->setBYDAY((int) $_POST['monthly_byday_num'].$_POST['monthly_byday_day']);
break;
}
break;
case 2:
$this->rec->setBYMONTHDAY((int) $_POST['monthly_bymonthday']);
break;
}
break;
$this->rec->setFrequenceType($_POST['frequence']);
$this->rec->setInterval((int) $_POST['count_YEARLY']);
switch((int) $_POST['subtype_YEARLY'])
{
case 0:
// nothing to do;
break;
case 1:
$this->rec->setBYMONTH((int) $_POST['yearly_bymonth_byday']);
$this->rec->setBYDAY((int) $_POST['yearly_byday_num'].$_POST['yearly_byday']);
break;
case 2:
$this->rec->setBYMONTH((int) $_POST['yearly_bymonth_by_monthday']);
$this->rec->setBYMONTHDAY((int) $_POST['yearly_bymonthday']);
break;
}
break;
}
// UNTIL
switch((int) $_POST['until_type'])
{
case 1:
// nothing to do
break;
case 2:
$this->rec->setFrequenceUntilCount((int) $_POST['count']);
break;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCalendarAppointmentGUI::save (   $a_as_milestone = false)
protected

save appointment

protected

Definition at line 354 of file class.ilCalendarAppointmentGUI.php.

References $_POST, $ilErr, $type, ilCalendarCategories\_getInstance(), ilObject\_lookupType(), add(), ilCalendarCategoryAssignments\addAssignment(), addMilestone(), createDefaultCalendar(), elseif(), load(), saveRecurrenceSettings(), ilUtil\sendFailure(), ilUtil\sendSuccess(), showResponsibleUsersList(), and ilCalendarCategory\TYPE_OBJ.

Referenced by saveMilestone().

{
global $ilErr;
$this->load($a_as_milestone);
if($this->app->validate())
{
if(!(int) $_POST['calendar'])
{
$cat_id = $this->createDefaultCalendar();
}
else
{
$cat_id = (int) $_POST['calendar'];
}
$this->app->save();
$this->rec->setEntryId($this->app->getEntryId());
include_once('./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
$ass = new ilCalendarCategoryAssignments($this->app->getEntryId());
$ass->addAssignment($cat_id);
include_once('./Services/Calendar/classes/class.ilCalendarCategory.php');
$cat_info = ilCalendarCategories::_getInstance()->getCategoryInfo($cat_id);
$type = ilObject::_lookupType($cat_info['obj_id']);
if ($a_as_milestone && $cat_info['type'] == ilCalendarCategory::TYPE_OBJ
&& ($type == "grp" || $type == "crs"))
{
ilUtil::sendSuccess($this->lng->txt('cal_created_milestone_resp_q'),true);
return $this->showResponsibleUsersList($cat_info['obj_id']);
}
elseif($a_as_milestone)
{
ilUtil::sendSuccess($this->lng->txt('cal_created_milestone'),true);
$this->ctrl->returnToParent($this);
}
else
{
ilUtil::sendSuccess($this->lng->txt('cal_created_appointment'),true);
$this->ctrl->returnToParent($this);
}
}
else
{
ilUtil::sendFailure($ilErr->getMessage());
}
if ($a_as_milestone)
{
$this->addMilestone();
}
else
{
$this->add();
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCalendarAppointmentGUI::saveMilestone ( )
protected

save milestone

protected

Definition at line 344 of file class.ilCalendarAppointmentGUI.php.

References save().

{
$this->save(true);
}

+ Here is the call graph for this function:

ilCalendarAppointmentGUI::saveMilestoneResponsibleUsers ( )

Save milestone responsibilites.

Definition at line 445 of file class.ilCalendarAppointmentGUI.php.

References $_POST, and $ilCtrl.

{
global $ilCtrl;
$this->app->writeResponsibleUsers($_POST["user_id"]);
$ilCtrl->returnToParent($this);
}
ilCalendarAppointmentGUI::saveRecurrenceSettings ( )
protected

save recurrence settings

protected

Parameters
@return

Definition at line 917 of file class.ilCalendarAppointmentGUI.php.

References $_POST.

Referenced by save(), and update().

{
switch($_POST['frequence'])
{
case 'NONE':
// No recurrence => delete if there is an recurrence rule
if($this->rec->getRecurrenceId())
{
$this->rec->delete();
}
break;
default:
if($this->rec->getRecurrenceId())
{
$this->rec->update();
}
else
{
$this->rec->save();
}
break;
}
}

+ Here is the caller graph for this function:

ilCalendarAppointmentGUI::showInfoScreen ( )
protected

show info screen

protected

Returns

Definition at line 492 of file class.ilCalendarAppointmentGUI.php.

References $desc, $tpl, $type, ilObject\_getAllReferences(), ilCalendarCategories\_getInstance(), ilLink\_getStaticLink(), ilCalendarCategoryAssignments\_lookupCategory(), ilObject\_lookupType(), ilDatePresentation\formatPeriod(), and ilCalendarCategory\TYPE_OBJ.

Referenced by edit().

{
global $tpl,$ilUser;
include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
$info = new ilInfoScreenGUI($this);
$info->setFormAction($this->ctrl->getFormAction($this));
if ($this->app->isMilestone())
{
$info->addSection($this->lng->txt('cal_ms_details'));
}
else
{
$info->addSection($this->lng->txt('cal_details'));
}
// Appointment
$info->addProperty($this->lng->txt('appointment'),
$this->app->getStart(),
$this->app->getEnd()));
$info->addProperty($this->lng->txt('title'),$this->app->getPresentationTitle());
// Description
if(strlen($desc = $this->app->getDescription()))
{
$info->addProperty($this->lng->txt('description'),$desc);
}
// Location
if(strlen($loc = $this->app->getLocation()))
{
$info->addProperty($this->lng->txt('cal_where'),$loc);
}
// completion
if ($this->app->isMilestone() && $this->app->getCompletion() > 0)
{
$info->addProperty($this->lng->txt('cal_task_completion'),
$this->app->getCompletion()." %");
}
include_once('./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
$cat_id = ilCalendarCategoryAssignments::_lookupCategory($this->app->getEntryId());
$cat_info = ilCalendarCategories::_getInstance()->getCategoryInfo($cat_id);
$type = ilObject::_lookupType($cat_info['obj_id']);
if ($this->app->isMilestone() && $cat_info['type'] == ilCalendarCategory::TYPE_OBJ
&& ($type == "grp" || $type == "crs"))
{
// users responsible
$users = $this->app->readResponsibleUsers();
$delim = "";
foreach($users as $r)
{
$value.= $delim.$r["lastname"].", ".$r["firstname"]." [".$r["login"]."]";
$delim = "<br />";
}
if (count($users) > 0)
{
$info->addProperty($this->lng->txt('cal_responsible'),
$value);
}
}
$category = new ilCalendarCategory($cat_id);
if($category->getType() == ilCalendarCategory::TYPE_OBJ)
{
$info->addSection($this->lng->txt('additional_info'));
$cat_info = ilCalendarCategories::_getInstance()->getCategoryInfo($cat_id);
$refs = ilObject::_getAllReferences($cat_info['obj_id']);
include_once('classes/class.ilLink.php');
$href = ilLink::_getStaticLink(current($refs),ilObject::_lookupType($cat_info['obj_id']),true);
$info->addProperty($this->lng->txt('perma_link'),'<a class="small" href="'.$href.'" target="_top">'.$href.'</a>');
}
$tpl->setContent($info->getHTML());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCalendarAppointmentGUI::showResponsibleUsersList (   $a_grp_id)

Show responsible uses of a milestone (default set is participants of group)

Definition at line 432 of file class.ilCalendarAppointmentGUI.php.

References $tpl.

Referenced by editResponsibleUsers(), and save().

{
global $tpl;
include_once("./Services/Calendar/classes/class.ilMilestoneResponsiblesTableGUI.php");
$table_gui = new ilMilestoneResponsiblesTableGUI($this, "", $a_grp_id,
$this->app->getEntryId());
$tpl->setContent($table_gui->getHTML());
}

+ Here is the caller graph for this function:

ilCalendarAppointmentGUI::update ( )
protected

update

protected

Returns

Definition at line 580 of file class.ilCalendarAppointmentGUI.php.

References $_POST, $ilErr, createDefaultCalendar(), ilCalendarCategoryAssignments\deleteAssignments(), edit(), load(), saveRecurrenceSettings(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

{
global $ilErr;
$this->load($this->app->isMilestone());
if($this->app->validate())
{
if(!(int) $_POST['calendar'])
{
$cat_id = $this->createDefaultCalendar();
}
else
{
$cat_id = (int) $_POST['calendar'];
}
$this->app->update();
include_once('./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
$ass = new ilCalendarCategoryAssignments($this->app->getEntryId());
$ass->addAssignment($cat_id);
ilUtil::sendSuccess($this->lng->txt('settings_saved'));
$this->ctrl->returnToParent($this);
}
else
{
ilUtil::sendFailure($ilErr->getMessage());
}
$this->edit();
}

+ Here is the call graph for this function:

Field Documentation

ilCalendarAppointmentGUI::$app = null
protected

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

Referenced by delete().

ilCalendarAppointmentGUI::$ctrl
protected

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

ilCalendarAppointmentGUI::$default_fulltime = true
protected

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

ilCalendarAppointmentGUI::$lng
protected

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

Referenced by __construct(), and createDefaultCalendar().

ilCalendarAppointmentGUI::$rec = null
protected

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

Referenced by initForm().

ilCalendarAppointmentGUI::$seed = null
protected

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

Referenced by initAppointment(), and initSeed().

ilCalendarAppointmentGUI::$timezone = null
protected

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

Referenced by initSeed().

ilCalendarAppointmentGUI::$tpl
protected

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