4use Psr\Http\Message\RequestInterface;
 
    5use Psr\Http\Message\ServerRequestInterface;
 
   47        $this->lng = 
$DIC->language();
 
   48        $this->lng->loadLanguageModule(
'dateplaner');
 
   49        $this->ctrl = 
$DIC->ctrl();
 
   50        $this->tpl = 
$DIC->ui()->mainTemplate();
 
   51        $this->logger = 
$GLOBALS[
'DIC']->logger()->cal();
 
   52        $this->request = 
$DIC->http()->request();
 
   67        $ilTabs = 
$DIC[
'ilTabs'];
 
   71        $ilTabs->clearTargets();
 
   72        $ilTabs->setBackTarget(
 
   73            $this->lng->txt(
'cal_back_to_cal'),
 
   74            $this->ctrl->getLinkTarget($this, 
'cancel')
 
   77        $next_class = $this->ctrl->getNextClass($this);
 
   78        switch ($next_class) {
 
   81                $cmd = $this->ctrl->getCmd(
"add");
 
  106        $this->ctrl->returnToParent($this);
 
  116    protected function initForm($a_mode, $a_as_milestone = 
false, $a_edit_single_app = 
false)
 
  125        include_once(
'./Services/YUI/classes/class.ilYuiUtil.php');
 
  130                $this->ctrl->saveParameter($this, array(
'seed',
'idate'));
 
  131                $this->form->setFormAction($this->ctrl->getFormAction($this));
 
  132                if ($a_as_milestone) {
 
  133                    $this->form->setTitle($this->lng->txt(
'cal_new_ms'));
 
  134                    $this->form->addCommandButton(
'saveMilestone', $this->lng->txt(
'cal_add_milestone'));
 
  135                    $this->form->addCommandButton(
'cancel', $this->lng->txt(
'cancel'));
 
  137                    $this->form->setTitle($this->lng->txt(
'cal_new_app'));
 
  138                    $this->form->addCommandButton(
'save', $this->lng->txt(
'cal_add_appointment'));
 
  139                    $this->form->addCommandButton(
'cancel', $this->lng->txt(
'cancel'));
 
  144                if ($a_as_milestone) {
 
  145                    $this->form->setTitle($this->lng->txt(
'cal_edit_milestone'));
 
  147                    $this->form->setTitle($this->lng->txt(
'cal_edit_appointment'));
 
  149                $this->ctrl->saveParameter($this, array(
'seed',
'app_id',
'idate'));
 
  150                $this->form->setFormAction($this->ctrl->getFormAction($this));
 
  153                $cat = $ass->getFirstAssignment();
 
  154                include_once(
'./Services/Calendar/classes/class.ilCalendarCategory.php');
 
  160                    $this->form->addCommandButton(
'editResponsibleUsers', $this->lng->txt(
'cal_change_responsible_users'));
 
  162                $this->form->addCommandButton(
'update', $this->lng->txt(
'save'));
 
  164                $this->form->addCommandButton(
'cancel', $this->lng->txt(
'cancel'));
 
  169        $title->setValue($this->app->getTitle());
 
  170        $title->setRequired(
true);
 
  171        $title->setMaxLength(128);
 
  173        $this->form->addItem($title);
 
  176        $calendar = 
new ilSelectInputGUI($this->lng->txt(
'cal_category_selection'), 
'calendar');
 
  178            $calendar->setValue((
int) 
$_POST[
'calendar']);
 
  179            $selected_calendar = (int) 
$_POST[
'calendar'];
 
  180        } elseif (
$_GET[
'category_id']) {
 
  181            $calendar->setValue((
int) 
$_GET[
'category_id']);
 
  182            $selected_calendar = (int) 
$_GET[
'category_id'];
 
  183        } elseif ($a_mode == 
'edit') {
 
  185            $cat = $ass->getFirstAssignment();
 
  186            $calendar->setValue($cat);
 
  187            $selected_calendar = $cat;
 
  188        } elseif (isset(
$_GET[
'ref_id'])) {
 
  189            include_once(
'./Services/Calendar/classes/class.ilCalendarCategories.php');
 
  194            $cats->readSingleCalendar($selected_calendar);
 
  197            $categories = $cats->prepareCategoriesOfUserForSelection();
 
  198            $selected_calendar = key((array) $categories);
 
  199            $calendar->setValue($selected_calendar);
 
  201        $calendar->setRequired(
true);
 
  203        $calendar->setOptions($cats->prepareCategoriesOfUserForSelection());
 
  205        include_once 
'./Services/Calendar/classes/class.ilCalendarSettings.php';
 
  207            $notification_cals = $cats->getNotificationCalendars();
 
  208            $notification_cals = count($notification_cals) ? implode(
',', $notification_cals) : 
'';
 
  209            $calendar->addCustomAttribute(
"onchange=\"ilToggleNotification([" . $notification_cals . 
"]);\"");
 
  211        $this->form->addItem($calendar);
 
  213        if (!$a_as_milestone) {
 
  214            include_once 
'./Services/Form/classes/class.ilDateDurationInputGUI.php';
 
  215            $tpl->addJavaScript(
'./Services/Form/js/date_duration.js');
 
  217            $dur->setRequired(
true);
 
  218            $dur->enableToggleFullTime(
 
  219                $this->lng->txt(
'cal_fullday_title'),
 
  220                $this->app->isFullday() ? 
true : 
false 
  222            $dur->setShowTime(
true);
 
  223            $dur->setStart($this->app->getStart());
 
  224            $dur->setEnd($this->app->getEnd());
 
  225            $this->form->addItem($dur);
 
  228            include_once(
'./Services/Calendar/classes/Form/class.ilRecurrenceInputGUI.php');
 
  230            $rec->setRecurrence($this->rec);
 
  231            $this->form->addItem(
$rec);
 
  234            $where = 
new ilTextInputGUI($this->lng->txt(
'cal_where'), 
'location');
 
  235            $where->setValue($this->app->getLocation());
 
  236            $where->setMaxLength(128);
 
  238            $this->form->addItem($where);
 
  241            $deadline->setDate($this->app->getStart());
 
  242            $deadline->setShowTime(
false);
 
  243            $deadline->setMinuteStepSize(5);
 
  244            $this->form->addItem($deadline);
 
  247            $completion_vals = array();
 
  248            for (
$i = 0; 
$i <= 100; 
$i += 5) {
 
  249                $completion_vals[
$i] = 
$i . 
" %";
 
  252                $this->lng->txt(
'cal_task_completion'),
 
  255            $compl->setOptions($completion_vals);
 
  256            $compl->setValue($this->app->getCompletion());
 
  257            $this->form->addItem($compl);
 
  261        $desc->setValue($this->app->getDescription());
 
  263        $this->form->addItem($desc);
 
  265        if ($a_as_milestone && $a_mode == 
"edit" && $resp_info) {
 
  267            $users = $this->app->readResponsibleUsers();
 
  270            foreach ($users as $r) {
 
  271                $value .= $delim . $r[
"lastname"] . 
", " . $r[
"firstname"] . 
" [" . $r[
"login"] . 
"]";
 
  274            if (count($users) > 0) {
 
  275                $resp->setValue($value);
 
  277                $resp->setValue(
"-");
 
  280            $this->form->addItem(
$resp);
 
  286            $notu->setInfo($this->lng->txt(
'cal_user_notification_info'));
 
  288            $notu->setMaxLength(64);
 
  291            foreach ($this->
notification->getRecipients() as $rcp) {
 
  292                switch ($rcp[
'type']) {
 
  298                        $values[] = $rcp[
'email'];
 
  302            if (count($values)) {
 
  303                $notu->setValues($values);
 
  305                $notu->setValues(array(
''));
 
  307            $this->form->addItem($notu);
 
  311        include_once 
'./Services/Calendar/classes/class.ilCalendarSettings.php';
 
  321            $tpl->addJavaScript(
'./Services/Calendar/js/toggle_notification.js');
 
  323            $not->setInfo($this->lng->txt(
'cal_notification_info'));
 
  325            $not->setChecked($this->app->isNotificationEnabled());
 
  326            $not->setDisabled($disabled);
 
  327            $this->form->addItem($not);
 
  343        $ilHelp = 
$DIC->help();
 
  345        $ilHelp->setScreenIdComponent(
"cal");
 
  346        $ilHelp->setScreenId(
"app");
 
  347        $ilHelp->setSubScreenId(
"create");
 
  352        $this->tpl->setContent($this->form->getHTML());
 
  366        $ilHelp = 
$DIC[
'ilHelp'];
 
  368        $ilHelp->setScreenIdComponent(
"cal");
 
  369        $ilHelp->setScreenId(
"app");
 
  370        $ilHelp->setSubScreenId(
"create_milestone");
 
  373        $tpl->setContent($this->form->getHTML());
 
  391    protected function save($a_as_milestone = 
false)
 
  397        $this->
load(
'create', $a_as_milestone);
 
  399        if ($this->app->validate() and $this->notification->validate()) {
 
  400            if (!(
int) 
$_POST[
'calendar']) {
 
  403                $cat_id = (int) 
$_POST[
'calendar'];
 
  407            $this->
notification->setEntryId($this->app->getEntryId());
 
  409            $this->rec->setEntryId($this->app->getEntryId());
 
  412            include_once(
'./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
 
  414            $ass->addAssignment($cat_id);
 
  417            include_once 
'./Services/Calendar/classes/class.ilCalendarSettings.php';
 
  425            include_once(
'./Services/Calendar/classes/class.ilCalendarCategory.php');
 
  431                ilUtil::sendSuccess($this->lng->txt(
'cal_created_milestone_resp_q'), 
true);
 
  433            } elseif ($a_as_milestone) {
 
  434                ilUtil::sendSuccess($this->lng->txt(
'cal_created_milestone'), 
true);
 
  435                $this->ctrl->returnToParent($this);
 
  437                ilUtil::sendSuccess($this->lng->txt(
'cal_created_appointment'), 
true);
 
  438                $this->ctrl->returnToParent($this);
 
  441            $this->form->setValuesByPost();
 
  443            return $this->
add($this->form);
 
  445        if ($a_as_milestone) {
 
  462        include_once 
'./Services/Calendar/classes/class.ilCalendarMailNotification.php';
 
  464        $notification->setAppointmentId($this->app->getEntryId());
 
  466        foreach ($this->
notification->getRecipients() as $rcp) {
 
  467            switch ($rcp[
'type']) {
 
  469                    $notification->setSender(ANONYMOUS_USER_ID);
 
  470                    $notification->setRecipients(array($rcp[
'usr_id']));
 
  475                    $notification->setSender(ANONYMOUS_USER_ID);
 
  476                    $notification->setRecipients(array($rcp[
'email']));
 
  480            $notification->send();
 
  491        include_once(
'./Services/Calendar/classes/class.ilCalendarCategory.php');
 
  494        include_once 
'./Services/Calendar/classes/class.ilCalendarMailNotification.php';
 
  496        $notification->setAppointmentId($app_id);
 
  498        switch ($cat_info[
'type']) {
 
  501                    switch ($cat_info[
'obj_type']) {
 
  504                            $ref_id = current($ref_ids);
 
  505                            $notification->setRefId($ref_id);
 
  506                            $notification->setType(
 
  515                            $ref_id = current($ref_ids);
 
  516                            $notification->setRefId($ref_id);
 
  517                            $notification->setType(
 
  527        $notification->send();
 
  535        include_once(
'./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
 
  537        include_once(
'./Services/Calendar/classes/class.ilCalendarCategory.php');
 
  553        include_once(
"./Services/Calendar/classes/class.ilMilestoneResponsiblesTableGUI.php");
 
  558            $this->app->getEntryId()
 
  560        $tpl->setContent($table_gui->getHTML());
 
  572        $this->app->writeResponsibleUsers(
$_POST[
"user_id"]);
 
  573        $ilCtrl->returnToParent($this);
 
  583        include_once 
'./Services/Calendar/classes/class.ilCalendarRecurrences.php';
 
  586            return $this->
edit(
true);
 
  589        $this->ctrl->saveParameter($this, array(
'seed',
'app_id',
'dt',
'idate'));
 
  591        include_once(
'./Services/Utilities/classes/class.ilConfirmationGUI.php');
 
  593        $confirm->setFormAction($this->ctrl->getFormAction($this));
 
  594        #$confirm->setHeaderText($this->lng->txt('cal_edit_app_sure')); 
  595        $confirm->setCancel($this->lng->txt(
'cancel'), 
'cancel');
 
  596        $confirm->addItem(
'appointments[]', $this->app->getEntryId(), $this->app->getTitle());
 
  597        $confirm->addButton($this->lng->txt(
'cal_edit_single'), 
'editSingle');
 
  598        $confirm->setConfirm($this->lng->txt(
'cal_edit_recurrences'), 
'edit');
 
  600        $GLOBALS[
'DIC'][
'tpl']->setContent($confirm->getHTML());
 
  608        $_REQUEST[
'rexl'] = 1;
 
  609        $GLOBALS[
'DIC'][
'ilCtrl']->setParameter($this, 
'rexcl', 1);
 
  628        $ilHelp = 
$DIC[
'ilHelp'];
 
  630        $ilHelp->setScreenIdComponent(
"cal");
 
  631        $ilHelp->setScreenId(
"app");
 
  632        if ($this->app->isMilestone()) {
 
  633            $ilHelp->setSubScreenId(
"edit_milestone");
 
  635            $ilHelp->setSubScreenId(
"edit");
 
  638        include_once(
'./Services/Calendar/classes/class.ilCalendarCategory.php');
 
  639        include_once(
'./Services/Calendar/classes/class.ilCalendarCategories.php');
 
  640        include_once(
'./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
 
  642        $GLOBALS[
'DIC'][
'ilCtrl']->saveParameter($this, array(
'seed',
'app_id',
'dt',
'idate'));
 
  644        if ($_REQUEST[
'rexl']) {
 
  645            $GLOBALS[
'DIC'][
'ilCtrl']->setParameter($this, 
'rexl', 1);
 
  649            include_once 
'./Services/Calendar/classes/class.ilCalendarRecurrenceCalculator.php';
 
  654            $yesterday = clone $current_date;
 
  656            $tomorrow = clone $current_date;
 
  660            foreach ($calc->calculateDateList($current_date, $tomorrow, 1) as $date_entry) {
 
  675        if (!$cats->isVisible($cat_id)) {
 
  676            $ilErr->raiseError($this->lng->txt(
'permission_denied'), 
$ilErr->WARNING);
 
  679        if (!$cats->isEditable($cat_id) or $this->app->isAutoGenerated()) {
 
  684            $this->
initForm(
'edit', $this->app->isMilestone(), $a_edit_single_app);
 
  686        $tpl->setContent($this->form->getHTML());
 
  702        include_once(
"./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
 
  704        $info->setFormAction($this->ctrl->getFormAction($this));
 
  706        if ($this->app->isMilestone()) {
 
  707            $info->addSection($this->lng->txt(
'cal_ms_details'));
 
  709            $info->addSection($this->lng->txt(
'cal_details'));
 
  714            $this->lng->txt(
'appointment'),
 
  716                $this->app->getStart(),
 
  720        $info->addProperty($this->lng->txt(
'title'), $this->app->getPresentationTitle());
 
  723        if (strlen($desc = $this->app->getDescription())) {
 
  724            $info->addProperty($this->lng->txt(
'description'), $desc);
 
  728        if (strlen($loc = $this->app->getLocation())) {
 
  729            $info->addProperty($this->lng->txt(
'cal_where'), $loc);
 
  733        if ($this->app->isMilestone() && $this->app->getCompletion() > 0) {
 
  735                $this->lng->txt(
'cal_task_completion'),
 
  736                $this->app->getCompletion() . 
" %" 
  740        include_once(
'./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
 
  747            $users = $this->app->readResponsibleUsers();
 
  749            foreach ($users as $r) {
 
  750                $value .= $delim . $r[
"lastname"] . 
", " . $r[
"firstname"] . 
" [" . $r[
"login"] . 
"]";
 
  753            if (count($users) > 0) {
 
  755                    $this->lng->txt(
'cal_responsible'),
 
  764            $info->addSection($this->lng->txt(
'additional_info'));
 
  769            include_once(
'./Services/Link/classes/class.ilLink.php');
 
  771            $info->addProperty($this->lng->txt(
'perma_link'), 
'<a class="small" href="' . $href . 
'" target="_top">' . $href . 
'</a>');
 
  774        $tpl->setContent($info->getHTML());
 
  789        $single_editing = ($_REQUEST[
'rexl'] ? true : 
false);
 
  791        $this->
load(
'edit', $this->app->isMilestone());
 
  793        if ($this->app->validate() and $this->notification->validate()) {
 
  794            if (!(
int) 
$_POST[
'calendar']) {
 
  797                $cat_id = (int) 
$_POST[
'calendar'];
 
  800            if ($single_editing) {
 
  803                $selected_ut = (int) ($this->request->getQueryParams()[
'dt'] ?? 0);
 
  804                if ($selected_ut > 0) {
 
  806                    $exclusion->setEntryId($original_id);
 
  819            include_once(
'./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
 
  821            $this->logger->debug($this->app->getEntryId());
 
  822            $ass->deleteAssignments();
 
  823            $ass->addAssignment($cat_id);
 
  826            include_once 
'./Services/Calendar/classes/class.ilCalendarSettings.php';
 
  834            ilUtil::sendSuccess($this->lng->txt(
'msg_obj_modified'), 
true);
 
  835            $this->ctrl->returnToParent($this);
 
  837            $this->form->setValuesByPost();
 
  840        $this->
edit(
false, $this->form);
 
  855        $this->ctrl->saveParameter(
 
  865        $app_id = (int) ($this->request->getQueryParams()[
'app_id'] ?? 0);
 
  868            $this->ctrl->returnToParent($this);
 
  875            !$this->app->isMilestone()
 
  878            $confirm->setFormAction($this->ctrl->getFormAction($this));
 
  879            $confirm->setHeaderText($this->lng->txt(
'cal_delete_app_sure'));
 
  880            $confirm->setCancel($this->lng->txt(
'cancel'), 
'cancel');
 
  881            $confirm->addItem(
'appointments[]', $this->app->getEntryId(), $this->app->getTitle());
 
  882            $confirm->setConfirm($this->lng->txt(
'delete'), 
'delete');
 
  883            $this->tpl->setContent($confirm->getHTML());
 
  893            $this->tpl->setContent($table->getHTML());
 
  906    protected function delete()
 
  908        $app_ids = (array) ($this->request->getParsedBody()[
'appointment_ids'] ?? []);
 
  910            $this->logger->dump($app_ids);
 
  911            $app_ids = (array) ($this->request->getQueryParams()[
'app_id'] ?? []);
 
  914            $this->ctrl->returnToParent($this);
 
  916        foreach ($app_ids as $app_id) {
 
  920            include_once(
'./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
 
  923            include_once 
'./Services/Calendar/classes/class.ilCalendarUserNotification.php';
 
  926        ilUtil::sendSuccess($this->lng->txt(
'cal_deleted_app'), 
true);
 
  927        $this->ctrl->returnToParent($this);
 
  939        $recurrence_ids = (array) ($this->request->getParsedBody()[
'recurrence_ids'] ?? []);
 
  940        $app_id = (int) ($this->request->getQueryParams()[
'app_id'] ?? 0);
 
  941        if (!count($recurrence_ids)) {
 
  943            $this->ctrl->redirect($this, 
'askDelete');
 
  946            $this->ctrl->returnToParent($this);
 
  948        foreach ($recurrence_ids as $rdate) {
 
  950            $exclusion->setEntryId($app_id);
 
  955            ilUtil::sendSuccess($this->lng->txt(
'cal_deleted_app'), 
true);
 
  956            $this->ctrl->returnToParent($this);
 
  973        $this->timezone = 
$ilUser->getTimeZone();
 
  982        if (!isset(
$_GET[
'hour'])) {
 
  984            $this->default_fulltime = 
true;
 
  986            if ((
int) 
$_GET[
'hour'] < 10) {
 
  987                $time = 
'0' . (int) 
$_GET[
'hour'] . 
':00:00';
 
  989                $time = (int) 
$_GET[
'hour'] . 
':00:00';
 
  992            $this->default_fulltime = 
false;
 
 1005        $this->seed = clone 
$seed;
 
 1006        $this->default_fulltime = 
true;
 
 1018        include_once(
'./Services/Calendar/classes/class.ilCalendarEntry.php');
 
 1019        include_once(
'./Services/Calendar/classes/class.ilCalendarRecurrences.php');
 
 1022        include_once 
'./Services/Calendar/classes/class.ilCalendarUserNotification.php';
 
 1027            $this->app->setStart($start);
 
 1030            if ($this->default_fulltime) {
 
 1031                #$seed_end->increment(IL_CAL_DAY,1); 
 1035            $this->app->setEnd($seed_end);
 
 1036            $this->app->setFullday($this->default_fulltime);
 
 1051    protected function load($a_mode, $a_as_milestone = 
false)
 
 1054        $this->
initForm($a_mode, $a_as_milestone);
 
 1055        $this->form->checkInput();
 
 1057        if ($a_as_milestone) {
 
 1058            $this->app->setMilestone(
true);
 
 1066        $this->app->enableNotification((
int) 
$_POST[
'not']);
 
 1068        if ($a_as_milestone) {  
 
 1069            $start = $this->form->getItemByPostVar(
'event_start');
 
 1070            $start = $start->getDate();
 
 1072            $this->app->setFullday(
true);
 
 1075            $this->app->setStart($start);
 
 1076            $this->app->setEnd($start);
 
 1078            $period = $this->form->getItemByPostVar(
'event');
 
 1079            $start = $period->getStart();
 
 1080            $end = $period->getEnd();
 
 1082            $this->app->setFullday($start instanceof 
ilDate);
 
 1083            $this->app->setStart($start);
 
 1084            $this->app->setEnd($end);
 
 1095        foreach ((array) 
$_POST[
'notu'] as $rcp) {
 
 1099            if (strlen($rcp) == 0) {
 
 1126        $this->rec->reset();
 
 1128        switch (
$_POST[
'frequence']) {
 
 1130                $this->rec->setFrequenceType(
$_POST[
'frequence']);
 
 1131                $this->rec->setInterval((
int) 
$_POST[
'count_DAILY']);
 
 1135                $this->rec->setFrequenceType(
$_POST[
'frequence']);
 
 1136                $this->rec->setInterval((
int) 
$_POST[
'count_WEEKLY']);
 
 1137                if (is_array(
$_POST[
'byday_WEEKLY'])) {
 
 1143                $this->rec->setFrequenceType(
$_POST[
'frequence']);
 
 1144                $this->rec->setInterval((
int) 
$_POST[
'count_MONTHLY']);
 
 1145                switch ((
int) 
$_POST[
'subtype_MONTHLY']) {
 
 1151                        switch ((
int) 
$_POST[
'monthly_byday_day']) {
 
 1154                                $this->rec->setBYSETPOS((
int) 
$_POST[
'monthly_byday_num']);
 
 1155                                $this->rec->setBYDAY(
'MO,TU,WE,TH,FR');
 
 1160                                $this->rec->setBYMONTHDAY((
int) 
$_POST[
'monthly_byday_num']);
 
 1164                                $this->rec->setBYDAY((
int) 
$_POST[
'monthly_byday_num'] . 
$_POST[
'monthly_byday_day']);
 
 1170                        $this->rec->setBYMONTHDAY((
int) 
$_POST[
'monthly_bymonthday']);
 
 1176                $this->rec->setFrequenceType(
$_POST[
'frequence']);
 
 1177                $this->rec->setInterval((
int) 
$_POST[
'count_YEARLY']);
 
 1178                switch ((
int) 
$_POST[
'subtype_YEARLY']) {
 
 1184                        $this->rec->setBYMONTH((
int) 
$_POST[
'yearly_bymonth_byday']);
 
 1185                        $this->rec->setBYDAY((
int) 
$_POST[
'yearly_byday_num'] . 
$_POST[
'yearly_byday']);
 
 1189                        $this->rec->setBYMONTH((
int) 
$_POST[
'yearly_bymonth_by_monthday']);
 
 1190                        $this->rec->setBYMONTHDAY((
int) 
$_POST[
'yearly_bymonthday']);
 
 1197        switch ((
int) 
$_POST[
'until_type']) {
 
 1199                $this->rec->setFrequenceUntilDate(
null);
 
 1204                $this->rec->setFrequenceUntilDate(
null);
 
 1205                $this->rec->setFrequenceUntilCount((
int) 
$_POST[
'count']);
 
 1210                $dt->setRequired(
true);
 
 1211                if ($dt->checkInput()) {
 
 1212                    $this->rec->setFrequenceUntilCount(0);
 
 1213                    $this->rec->setFrequenceUntilDate($dt->getDate());
 
 1228        switch (
$_POST[
'frequence']) {
 
 1232                if ($this->rec->getRecurrenceId()) {
 
 1233                    $this->rec->delete();
 
 1238                if ($this->rec->getRecurrenceId()) {
 
 1239                    $this->rec->update();
 
 1263        $cat->setTitle($this->lng->txt(
'cal_default_calendar'));
 
 1264        $cat->setObjId(
$ilUser->getId());
 
 1267        include_once 
'./Services/Calendar/classes/class.ilCalendarCache.php';
 
 1290        include_once 
'Services/Utilities/classes/class.ilConfirmationGUI.php';
 
 1293        $this->ctrl->setParameter($this, 
'dstart', (
int) $_REQUEST[
'dstart']);
 
 1294        $this->ctrl->setParameter($this, 
'dend', (
int) $_REQUEST[
'dend']);
 
 1297        $conf->setHeaderText($this->lng->txt(
'cal_confirm_reg_info'));
 
 1298        $conf->setConfirm($this->lng->txt(
'cal_reg_register'), 
'register');
 
 1299        $conf->setCancel($this->lng->txt(
'cancel'), 
'cancel');
 
 1300        $conf->addItem(
'app_id', $entry->getEntryId(), $entry->getTitle() . 
' (' . $start . 
')');
 
 1302        $tpl->setContent($conf->getHTML());
 
 1309    protected function register()
 
 1315        include_once 
'./Services/Calendar/classes/class.ilCalendarRegistration.php';
 
 1323        ilUtil::sendSuccess($this->lng->txt(
'cal_reg_registered'), 
true);
 
 1324        $this->ctrl->returnToParent($this);
 
 1344        include_once 
'Services/Utilities/classes/class.ilConfirmationGUI.php';
 
 1347        $this->ctrl->setParameter($this, 
'dstart', (
int) $_REQUEST[
'dstart']);
 
 1348        $this->ctrl->setParameter($this, 
'dend', (
int) $_REQUEST[
'dend']);
 
 1351        $conf->setHeaderText($this->lng->txt(
'cal_confirm_unreg_info'));
 
 1352        $conf->setConfirm($this->lng->txt(
'cal_reg_unregister'), 
'unregister');
 
 1353        $conf->setCancel($this->lng->txt(
'cancel'), 
'cancel');
 
 1354        $conf->addItem(
'app_id', $entry->getEntryId(), $entry->getTitle() . 
' (' . $start . 
')');
 
 1356        $tpl->setContent($conf->getHTML());
 
 1369        include_once 
'./Services/Calendar/classes/class.ilCalendarRegistration.php';
 
 1377        ilUtil::sendSuccess($this->lng->txt(
'cal_reg_unregistered'), 
true);
 
 1378        $this->ctrl->returnToParent($this);
 
 1391        $entry_id = (int) 
$_GET[
'app_id'];
 
 1392        $this->ctrl->saveParameter($this, 
'app_id');
 
 1394        include_once 
'Services/Calendar/classes/class.ilCalendarEntry.php';
 
 1395        include_once 
'Services/Booking/classes/class.ilBookingEntry.php';
 
 1397        $booking = new \ilBookingEntry($entry->getContextId());
 
 1398        $user = $booking->getObjId();
 
 1405        $tpl->setContent($form->getHTML());
 
 1415        include_once 
'./Services/Form/classes/class.ilPropertyFormGUI.php';
 
 1417        $form->setFormAction($this->ctrl->getFormAction($this));
 
 1418        $form->addCommandButton(
'bookconfirmed', $this->lng->txt(
'cal_confirm_booking'));
 
 1419        $form->addCommandButton(
'cancel', $this->lng->txt(
'cancel'));
 
 1422        $form->addItem($date);
 
 1425        $form->addItem($title);
 
 1443        $entry = (int) $_REQUEST[
'app_id'];
 
 1445        if ($form->checkInput()) {
 
 1447            include_once 
'./Services/Calendar/classes/class.ilCalendarEntry.php';
 
 1450            include_once 
'./Services/Booking/classes/class.ilBookingEntry.php';
 
 1453            if (!$booking->isAppointmentBookableForUser($entry, 
$GLOBALS[
'DIC'][
'ilUser']->getId())) {
 
 1455                $this->ctrl->returnToParent($this);
 
 1458            include_once 
'./Services/Calendar/classes/ConsultationHours/class.ilConsultationHourUtils.php';
 
 1461            include_once 
'./Services/Booking/classes/class.ilBookingEntry.php';
 
 1464        ilUtil::sendSuccess($this->lng->txt(
'cal_booking_confirmed'), 
true);
 
 1465        $this->ctrl->returnToParent($this);
 
 1479        $entry = (int) 
$_GET[
'app_id'];
 
 1481        include_once 
'Services/Calendar/classes/class.ilCalendarEntry.php';
 
 1486            include_once 
'Services/Booking/classes/class.ilBookingEntry.php';
 
 1488            if (!$booking->hasBooked($entry->getEntryId())) {
 
 1489                $this->ctrl->returnToParent($this);
 
 1495            $entry_title = 
' ' . $entry->getTitle();
 
 1497            $this->ctrl->returnToParent($this);
 
 1503        include_once 
'Services/Utilities/classes/class.ilConfirmationGUI.php';
 
 1506        $conf->setHeaderText($this->lng->txt(
'cal_cancel_booking_info'));
 
 1507        $conf->setConfirm($this->lng->txt(
'cal_cancel_booking'), 
'cancelconfirmed');
 
 1508        $conf->setCancel($this->lng->txt(
'cancel'), 
'cancel');
 
 1509        $conf->addItem(
'app_id', $entry->getEntryId(), $title . 
' - ' . $entry_title);
 
 1511        $tpl->setContent($conf->getHTML());
 
 1524        $entry = (int) 
$_POST[
'app_id'];
 
 1526        include_once 
'Services/Calendar/classes/class.ilCalendarEntry.php';
 
 1532            include_once 
'Services/Calendar/classes/ConsultationHours/class.ilConsultationHourAppointments.php';
 
 1535                $entry->getContextId(),
 
 1542            foreach ((array) $apps as $own_app) {
 
 1544                $ref_entry->delete();
 
 1547            include_once 
'Services/Booking/classes/class.ilBookingEntry.php';
 
 1549            $booking->cancelBooking($entry->getEntryId());
 
 1560        ilUtil::sendSuccess($this->lng->txt(
'cal_cancel_booking_confirmed'), 
true);
 
 1561        $this->ctrl->returnToParent($this);
 
 1571        include_once 
'Services/Calendar/classes/class.ilCalendarCategoryAssignments.php';
 
 1572        include_once 
'Services/Calendar/classes/class.ilCalendarCategory.php';
 
 1574        $assignment = $assignment->getFirstAssignment();
 
 1584        if (!isset(
$_GET[
'autoCompleteField'])) {
 
 1585            $a_fields = array(
'login',
'firstname',
'lastname',
'email');
 
 1587            $a_fields = array((
string) 
$_GET[
'autoCompleteField']);
 
 1590        include_once 
'./Services/User/classes/class.ilUserAutoComplete.php';
 
 1592        $auto->setSearchFields($a_fields);
 
 1593        $auto->enableFieldSearchableCheck(
true);
 
 1594        $auto->setMoreLinkAvailable(
true);
 
 1596        if (($_REQUEST[
'fetchall'])) {
 
 1600        echo $auto->getList($_REQUEST[
'query']);
 
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
An exception for terminatinating execution or to throw for unit testing.
const IL_CAL_FREQ_MONTHLY
static writeBookingMessage($a_entry_id, $a_usr_id, $a_message)
Write booking message.
Administrate calendar appointments.
askEdit()
Check edit single apppointment / edit all appointments for recurring appointments.
initForm($a_mode, $a_as_milestone=false, $a_edit_single_app=false)
init form
deleteExclude($a_return=true)
delete single item of recurrence list
__construct(ilDate $seed, ilDate $initialDate, $a_appointment_id=0)
calendarEntryToCategory(ilCalendarEntry $entry)
Get category object of given calendar entry.
editSingle()
Edit one single appointment ^.
initInitialDate(ilDate $initialDate)
init initial date
bookconfirmed()
Book consultation appointment, was confirmed.
saveMilestone()
save milestone
distributeUserNotifications()
Send mail to selected users @global ilObjUser $ilUser.
load($a_mode, $a_as_milestone=false)
load post
loadRecurrenceSettings($a_as_milestone=false)
load recurrence settings
showResponsibleUsersList($a_grp_id)
Show responsible uses of a milestone (default set is participants of group)
distributeNotifications($a_cat_id, $app_id, $a_new_appointment=true)
Distribute mail notifications.
saveRecurrenceSettings()
save recurrence settings
createDefaultCalendar()
Create a default calendar.
confirmRegister()
Register to an appointment.
cancelConfirmed()
Cancel consultation appointment or ressource booking, was confirmed This will delete the calendar ent...
doUserAutoComplete()
Do auto completion.
showInfoScreen()
show info screen
book()
Confirmation screen for booking of consultation appointment.
loadNotificationRecipients()
add(ilPropertyFormGUI $form=null)
add new appointment
save($a_as_milestone=false)
save appointment
saveMilestoneResponsibleUsers()
Save milestone responsibilites.
getAppointment()
Get current appointment.
edit($a_edit_single_app=false, ilPropertyFormGUI $form=null)
edit appointment
initAppointment($a_app_id=0)
init appointment
initSeed(ilDate $seed)
init seed
initTimeZone()
init timezone
addMilestone()
add milestone
editResponsibleUsers()
Edit responsible users.
cancelBooking()
Confirmation screen to cancel consultation appointment or ressource booking depends on calendar categ...
confirmUnregister()
Confirmation screen to unregister calendar.
unregister()
Unregister calendar, was confirmed.
static getInstance()
get singleton instance
static _lookupCategoryIdByObjId($a_obj_id)
lookup category by obj_id
static _getInstance($a_usr_id=0)
get singleton instance
static _lookupCategory($a_cal_id)
Lookup category id.
static _deleteByAppointmentId($a_app_id)
Delete appointment assignment.
Stores calendar categories.
Model for a calendar entry.
Distributes calendar mail notifications.
const TYPE_USER_ANONYMOUS
const TYPE_CRS_NEW_NOTIFICATION
const TYPE_CRS_NOTIFICATION
const TYPE_GRP_NOTIFICATION
const TYPE_GRP_NEW_NOTIFICATION
Calculates an ilDateList for a given calendar entry and recurrence rule.
Stores exclusion dates for calendar recurrences.
Class ilCalendarRecurrenceTableGUI.
static _getRecurrences($a_cal_id)
get all recurrences of an appointment
static _getFirstRecurrence($a_cal_id)
get first recurrence
registration for calendar appointments
static _getInstance()
get singleton instance
static deleteCalendarEntry($a_cal_id)
Delete notification for a calendar entry @global ilDB $ilDB.
Confirmation screen class.
setFormAction($a_form_action)
static getAppointmentIds($a_user_id, $a_context_id=null, $a_start=null, $a_type=null, $a_check_owner=true)
Get all appointment ids.
static bookAppointment($a_usr_id, $a_app_id)
Book an appointment.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date @access public.
static formatPeriod(ilDateTime $start, ilDateTime $end, $a_skip_starting_day=false)
Format a period of two date Shows: 14.
@classDescription Date and time handling
static _equals(ilDateTime $start, ilDateTime $end, $a_compare_field='', $a_tz='')
Check if two date are equal.
static _getStaticLink( $a_ref_id, $a_type='', $a_fallback_goto=true, $append="")
Get static link.
TableGUI class for selection of milestone responsibles.
This class represents a non editable value in a property form.
static _lookupLogin($a_user_id)
lookup login
static _lookupFullname($a_user_id)
Lookup Full Name.
static _loginExists($a_login, $a_user_id=0)
check if a login name already exists You may exclude a user from the check by giving his user id as 2...
static _lookupObjId($a_id)
static _getAllReferences($a_id)
get all reference ids of object
static _lookupType($a_id, $a_reference=false)
lookup object type
This class represents a text area property in a property form.
This class represents a text property in a property form.
This class represents a text wizard property in a property form.
Auto completion class for user lists.
static sendQuestion($a_info="", $a_keep=false)
Send Question to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static initDomEvent(ilGlobalTemplateInterface $a_main_tpl=null)
Init YUI DomEvent.
const IL_CAL_FREQ_DAILY
Model of calendar entry recurrcences.