61 $this->user_id = $a_user_id;
64 $this->lng->loadLanguageModule(
'dateplaner');
79 $next_class = $this->ctrl->getNextClass($this);
80 $this->ctrl->saveParameter($this,
'category_id');
81 $this->ctrl->setParameter($this,
'seed',$this->seed->get(
IL_CAL_DATE));
84 case 'ilcalendarappointmentgui':
85 $this->ctrl->setReturn($this,
'details');
87 include_once(
'./Services/Calendar/classes/class.ilCalendarAppointmentGUI.php');
89 $this->ctrl->forwardCommand($app);
93 $cmd = $this->ctrl->getCmd(
"show");
95 if(!in_array(
$cmd, array(
"details",
"askDeleteAppointments",
"deleteAppointments")))
111 $this->ctrl->returnToParent($this);
122 global
$tpl, $ilTabs;
124 $ilTabs->clearTargets();
126 if(
$_REQUEST[
'backv'] == self::VIEW_MANAGE)
135 $ilTabs->setBackTarget($this->lng->txt(
"cal_back_to_list"), $this->ctrl->getLinkTarget($this, $back));
137 $this->tpl =
new ilTemplate(
'tpl.edit_category.html',
true,
true,
'Services/Calendar');
139 $this->tpl->setVariable(
'EDIT_CAT',$this->form->getHTML());
140 $tpl->setContent($this->tpl->get());
152 include_once(
'./Services/Calendar/classes/class.ilCalendarCategory.php');
156 $category->setLocationType((
int)
$_POST[
'type_rl']);
163 $category->setType((
int) $_POST[
'type']);
164 $category->setObjId(0);
169 $category->setObjId($ilUser->getId());
172 if(!$category->validate())
210 global
$tpl, $ilTabs;
212 if(!
$_GET[
'category_id'])
215 $this->ctrl->returnToParent($this);
228 $ilTabs->clearTargets();
229 $ilTabs->setBackTarget($this->lng->txt(
"cal_back_to_list"), $this->ctrl->getLinkTarget($this,
"manage"));
232 $tpl->setContent($this->form->getHTML());
245 if(!
$_GET[
'category_id'])
248 $this->ctrl->returnToParent($this);
257 include_once
"./Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php";
258 $toolbar =
new ilToolbarGui();
259 $toolbar->addButton($this->lng->txt(
"cal_add_appointment"), $this->ctrl->getLinkTargetByClass(
"ilcalendarappointmentgui",
"add"));
263 $toolbar->addButton($this->lng->txt(
"cal_import_appointments"), $this->ctrl->getLinkTarget($this,
"importAppointments"));
265 $toolbar = $toolbar->getHTML();
269 include_once(
"./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
271 $info->setFormAction($this->ctrl->getFormAction($this));
273 $info->addSection($this->lng->txt(
'cal_cal_details'));
276 $info->addProperty($this->lng->txt(
'cal_calendar_name'),$category->getTitle());
277 switch($category->getType())
280 $info->addProperty($this->lng->txt(
'cal_cal_type'),$this->lng->txt(
'cal_type_personal'));
284 $info->addProperty($this->lng->txt(
'cal_cal_type'),$this->lng->txt(
'cal_type_system'));
288 $info->addProperty($this->lng->txt(
'cal_cal_type'),$this->lng->txt(
'cal_type_'.$category->getObjType()));
290 $info->addSection($this->lng->txt(
'additional_info'));
291 $info->addProperty($this->lng->txt(
'perma_link'),$this->
addReferenceLinks($category->getObjId()));
301 $this->ctrl->setParameterByClass(
'ilcalendarsubscriptiongui',
'cal_id',(
int) $_GET[
'category_id']);
303 $this->lng->txt(
'cal_ical_infoscreen'),
304 '<img src="'.ilUtil::getImagePath(
'ical.png',
'Services/Calendar').
'" />',
305 $this->ctrl->getLinkTargetByClass(array(
'ilcalendarpresentationgui',
'ilcalendarsubscriptiongui'))
308 $tpl->setContent($toolbar.$info->getHTML().$this->showAssignedAppointments());
313 if(!
$_GET[
'category_id'])
316 $this->ctrl->returnToParent($this);
326 $this->ctrl->redirect($this,
'manage');
329 $this->ctrl->redirect($this,
'manage');
338 include_once
'./Services/Calendar/classes/class.ilCalendarRemoteReader.php';
343 $remote->import($category);
354 if(!
$_GET[
'category_id'])
357 $this->ctrl->returnToParent($this);
367 include_once(
'./Services/Calendar/classes/class.ilCalendarCategory.php');
388 if(!
$_POST[
'selected_cat_ids'])
404 include_once(
'./Services/Utilities/classes/class.ilConfirmationGUI.php');
407 $confirmation_gui->setFormAction($this->ctrl->getFormAction($this));
408 $confirmation_gui->setHeaderText($this->lng->txt(
'cal_del_cal_sure'));
409 $confirmation_gui->setConfirm($this->lng->txt(
'delete'),
'delete');
410 $confirmation_gui->setCancel($this->lng->txt(
'cancel'),
'manage');
412 include_once(
'./Services/Calendar/classes/class.ilCalendarCategory.php');
413 foreach(
$_POST[
'selected_cat_ids'] as $cat_id)
416 $confirmation_gui->addItem(
'category_id[]',$cat_id,$category->getTitle());
419 $tpl->setContent($confirmation_gui->getHTML());
429 protected function delete()
433 if(!
$_POST[
'category_id'])
449 include_once(
'./Services/Calendar/classes/class.ilCalendarCategory.php');
450 foreach(
$_POST[
'category_id'] as $cat_id)
457 $ilCtrl->redirect($this,
'manage');
473 include_once(
'./Services/Calendar/classes/class.ilCalendarCategories.php');
474 include_once(
'./Services/Calendar/classes/class.ilCalendarHidden.php');
476 $selected_cat_ids =
$_POST[
'selected_cat_ids'] ?
$_POST[
'selected_cat_ids'] : array();
477 $shown_cat_ids =
$_POST[
'shown_cat_ids'] ?
$_POST[
'shown_cat_ids'] : array();
480 $cat_ids = $cats->getCategories();
483 $hidden_cat_ids = $hidden_cats->getHidden();
487 foreach($hidden_cat_ids as $hidden_cat_id)
489 if( !in_array($hidden_cat_id,$shown_cat_ids) )
491 $hidden[] = $hidden_cat_id;
495 foreach($shown_cat_ids as $shown_cat_id)
497 $shown_cat_id = (int)$shown_cat_id;
498 if( !in_array($shown_cat_id, $selected_cat_ids) )
500 $hidden[] = $shown_cat_id;
505 $hidden_categories->hideSelected($hidden);
506 $hidden_categories->save();
509 $this->ctrl->returnToParent($this);
521 include_once(
'./Services/Calendar/classes/class.ilCalendarCategoryTableGUI.php');
523 $nav_parameter = $table_gui->getNavParameter();
525 if(
$_POST[$nav_parameter] !=
"")
527 if(
$_POST[$nav_parameter.
"1"] !=
$_POST[$nav_parameter])
529 $nav_value =
$_POST[$nav_parameter.
"1"];
531 elseif(
$_POST[$nav_parameter.
"2"] !=
$_POST[$nav_parameter])
533 $nav_value =
$_POST[$nav_parameter.
"2"];
538 $nav_value =
$_GET[$nav_parameter];
543 $this->ctrl->returnToParent($this);
555 global
$tpl, $ilTabs;
557 if(!
$_GET[
'category_id'])
560 $this->ctrl->returnToParent($this);
571 $ilTabs->clearTargets();
572 $ilTabs->setBackTarget($this->lng->txt(
"cal_back_to_list"), $this->ctrl->getLinkTarget($this,
"manage"));
576 $this->ctrl->saveParameter($this,
'category_id');
579 include_once(
'./Services/Calendar/classes/class.ilCalendarSharedListTableGUI.php');
581 $table->setTitle($this->lng->txt(
'cal_shared_header'));
582 $table->setCalendarId((
int)
$_GET[
'category_id']);
585 $tpl->setContent($this->form->getHTML().
'<br />'.$table->getHTML());
598 $this->lng->loadLanguageModule(
'search');
600 if(!
$_GET[
'category_id'])
603 $this->ctrl->returnToParent($this);
605 $this->ctrl->saveParameter($this,
'category_id');
608 if(!isset(
$_POST[
'query']))
627 include_once
'Services/Search/classes/class.ilQueryParser.php';
628 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
629 include_once
'Services/Search/classes/class.ilSearchResult.php';
635 $query_parser->setMinWordLength(3);
636 $query_parser->parse();
641 case self::SEARCH_USER:
643 $search->enableActiveCheck(
true);
645 $search->setFields(array(
'login'));
646 $res = $search->performSearch();
647 $res_sum->mergeEntries(
$res);
649 $search->setFields(array(
'firstname'));
650 $res = $search->performSearch();
651 $res_sum->mergeEntries(
$res);
653 $search->setFields(array(
'lastname'));
654 $res = $search->performSearch();
655 $res_sum->mergeEntries(
$res);
660 case self::SEARCH_ROLE:
662 include_once
'Services/Search/classes/Like/class.ilLikeObjectSearch.php';
664 $search->setFilter(array(
'role'));
666 $res = $search->performSearch();
667 $res_sum->mergeEntries(
$res);
673 if(!count($res_sum->getResults()))
680 $ilTabs->clearTargets();
681 $ilTabs->setBackTarget($this->lng->txt(
"cal_back_to_search"), $this->ctrl->getLinkTarget($this,
"shareSearch"));
685 case self::SEARCH_USER:
689 case self::SEARCH_ROLE:
705 if(!
$_GET[
'category_id'])
708 $this->ctrl->returnToParent($this);
710 if(!count(
$_POST[
'user_ids']))
726 include_once(
'./Services/Calendar/classes/class.ilCalendarShared.php');
751 if(!
$_GET[
'category_id'])
754 $this->ctrl->returnToParent($this);
756 if(!count(
$_POST[
'role_ids']))
771 include_once(
'./Services/Calendar/classes/class.ilCalendarShared.php');
774 foreach(
$_POST[
'role_ids'] as $role_id)
791 if(!
$_GET[
'category_id'])
794 $this->ctrl->returnToParent($this);
796 if(!count(
$_POST[
'obj_ids']))
812 include_once(
'./Services/Calendar/classes/class.ilCalendarShared.php');
815 foreach(
$_POST[
'obj_ids'] as $obj_id)
817 $shared->stopSharing($obj_id);
836 include_once(
'./Services/Calendar/classes/class.ilCalendarSharedUserListTableGUI.php');
839 $table->setTitle($this->lng->txt(
'cal_share_search_usr_header'));
840 $table->setFormAction($this->ctrl->getFormAction($this));
841 $table->setUsers($a_ids);
847 $tpl->setContent($table->getHTML());
861 include_once(
'./Services/Calendar/classes/class.ilCalendarSharedRoleListTableGUI.php');
864 $table->setTitle($this->lng->txt(
'cal_share_search_role_header'));
865 $table->setFormAction($this->ctrl->getFormAction($this));
866 $table->setRoles($a_ids);
872 $tpl->setContent($table->getHTML());
886 $lng->loadLanguageModule(
'search');
888 if(!is_object($this->form))
890 include_once(
'Services/Form/classes/class.ilPropertyFormGUI.php');
892 $this->form->setFormAction($this->ctrl->getFormAction($this));
893 $this->form->setTitle($this->lng->txt(
'cal_share_search_header'));
898 $type->setRequired(
true);
901 $type->addOption($user);
904 $type->addOption($role);
906 $this->form->addItem($type);
908 $search =
new ilTextInputGUI($this->lng->txt(
'cal_search'),
'query');
910 $search->setSize(16);
911 $search->setMaxLength(128);
912 $search->setRequired(
true);
913 $search->setInfo($this->lng->txt(
'cal_search_info_share'));
915 $this->form->addItem($search);
916 $this->form->addCommandButton(
'sharePerformSearch',$this->lng->txt(
'search'));
930 include_once(
'./Services/Form/classes/class.ilPropertyFormGUI.php');
931 include_once(
'./Services/Calendar/classes/class.ilCalendarCategory.php');
933 include_once(
'./Services/Calendar/classes/class.ilCalendarCategories.php');
937 #$this->form->setTableWidth('40%');
942 $this->form->setTitle($this->lng->txt(
'cal_edit_category'));
943 $this->ctrl->saveParameter($this,array(
'seed',
'category_id'));
944 $this->form->setFormAction($this->ctrl->getFormAction($this));
947 $this->form->addCommandButton(
'update',$this->lng->txt(
'save'));
957 $this->form->addCommandButton(
'manage',$this->lng->txt(
'cancel'));
961 $this->editable =
true;
963 $this->ctrl->saveParameter($this,array(
'category_id'));
964 $this->form->setFormAction($this->ctrl->getFormAction($this));
965 $this->form->setTitle($this->lng->txt(
'cal_add_category'));
966 $this->form->addCommandButton(
'save',$this->lng->txt(
'save'));
967 $this->form->addCommandButton(
'manage',$this->lng->txt(
'cancel'));
973 if($a_mode ==
'edit')
977 $title->setRequired(
true);
980 $title->setValue($category->getTitle());
981 $this->form->addItem(
$title);
984 include_once(
'./Services/Calendar/classes/class.ilCalendarSettings.php');
988 $type->
setValue($category->getType());
989 $type->setRequired(
true);
992 $type->addOption($opt);
995 $type->addOption($opt);
996 $type->
setInfo($this->lng->txt(
'cal_type_info'));
997 $this->form->addItem($type);
1002 $color->
setValue($category->getColor());
1005 $color->setDisabled(
true);
1007 $color->setRequired(
true);
1008 $this->form->addItem($color);
1011 $location->setDisabled($a_mode ==
'edit');
1016 $location->setValue($category->getLocationType());
1019 $url =
new ilTextInputGUI($this->lng->txt(
'cal_remote_url'),
'remote_url');
1021 $url->setValue($category->getRemoteUrl());
1022 $url->setMaxLength(500);
1024 $url->setRequired(
true);
1025 $location_remote->addSubItem($url);
1027 $user =
new ilTextInputGUI($this->lng->txt(
'username'),
'remote_user');
1029 $user->setValue($category->getRemoteUser());
1030 $user->setMaxLength(50);
1032 $user->setRequired(
false);
1033 $location_remote->addSubItem($user);
1036 $pass->setDisabled($a_mode ==
'edit');
1037 $pass->setValue($category->getRemotePass());
1038 $pass->setMaxLength(50);
1040 $pass->setRetype(
false);
1041 $pass->setInfo($this->lng->txt(
'remote_pass_info'));
1042 $location_remote->addSubItem(
$pass);
1055 if(!
$_GET[
'category_id'])
1058 $this->ctrl->returnToParent($this);
1064 include_once(
'./Services/Calendar/classes/class.ilCalendarSharedStatus.php');
1067 include_once(
'./Services/Calendar/classes/class.ilCalendarShared.php');
1074 $status->decline(
$_GET[
'category_id']);
1077 $this->ctrl->redirect($this,
'manage');
1088 include_once(
'./Services/Calendar/classes/class.ilCalendarCategoryTableGUI.php');
1089 include_once(
'./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
1090 include_once(
'./Services/Calendar/classes/class.ilCalendarAppointmentsTableGUI.php');
1093 $table_gui->setTitle($this->lng->txt(
'cal_assigned_appointments'));
1094 $table_gui->setAppointments(
1097 return $table_gui->getHTML();
1110 if(!count(
$_POST[
'appointments']))
1117 include_once(
'./Services/Utilities/classes/class.ilConfirmationGUI.php');
1120 $this->ctrl->setParameter($this,
'category_id',(
int)
$_GET[
'category_id']);
1121 $confirmation_gui->setFormAction($this->ctrl->getFormAction($this));
1122 $confirmation_gui->setHeaderText($this->lng->txt(
'cal_del_app_sure'));
1123 $confirmation_gui->setConfirm($this->lng->txt(
'delete'),
'deleteAppointments');
1124 $confirmation_gui->setCancel($this->lng->txt(
'cancel'),
'details');
1126 include_once(
'./Services/Calendar/classes/class.ilCalendarEntry.php');
1127 foreach(
$_POST[
'appointments'] as $app_id)
1130 $confirmation_gui->addItem(
'appointments[]',(
int) $app_id,$app->getTitle());
1133 $tpl->setContent($confirmation_gui->getHTML());
1144 if(!count(
$_POST[
'appointments']))
1150 include_once(
'./Services/Calendar/classes/class.ilCalendarEntry.php');
1151 foreach(
$_POST[
'appointments'] as $app_id)
1156 include_once(
'./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
1170 include_once(
"./Services/Calendar/classes/class.ilCalendarSelectionBlockGUI.php");
1172 $html = $ilCtrl->getHTML($block_gui);
1186 $this->lng->loadLanguageModule(
'pd');
1188 $tpl =
new ilTemplate(
'tpl.calendar_selection.html',
true,
true,
'Services/Calendar');
1189 include_once(
'./Services/Calendar/classes/class.ilCalendarUserSettings.php');
1193 $tpl->setVariable(
'HTEXT',$this->lng->txt(
'pd_my_memberships'));
1194 $tpl->touchBlock(
'head_item');
1195 $tpl->touchBlock(
'head_delim');
1196 $tpl->touchBlock(
'head_item');
1199 $this->ctrl->setParameter($this,
'seed',$this->seed->get(
IL_CAL_DATE));
1200 $tpl->setVariable(
'HHREF',$this->ctrl->getLinkTarget($this,
'switchCalendarMode'));
1201 $tpl->setVariable(
'HLINK',$this->lng->txt(
'pd_my_offers'));
1202 $tpl->touchBlock(
'head_item');
1207 $this->ctrl->setParameter($this,
'seed',$this->seed->get(
IL_CAL_DATE));
1208 $tpl->setVariable(
'HHREF',$this->ctrl->getLinkTarget($this,
'switchCalendarMode'));
1209 $tpl->setVariable(
'HLINK',$this->lng->txt(
'pd_my_memberships'));
1210 $tpl->touchBlock(
'head_item');
1211 $tpl->touchBlock(
'head_delim');
1212 $tpl->touchBlock(
'head_item');
1214 $tpl->setVariable(
'HTEXT',$this->lng->txt(
'pd_my_offers'));
1215 $tpl->touchBlock(
'head_item');
1229 include_once(
'./Services/Calendar/classes/class.ilCalendarUserSettings.php');
1233 $this->ctrl->returnToParent($this);
1247 global
$ilUser,$rbacsystem,$ilAccess;
1249 $this->editable =
false;
1250 $this->visible =
false;
1251 $this->importable =
false;
1253 include_once(
'./Services/Calendar/classes/class.ilCalendarShared.php');
1258 switch($cat->getType())
1262 if($cat->getObjId() == $ilUser->getId())
1264 $this->visible =
true;
1265 $this->editable =
true;
1266 $this->importable =
true;
1268 elseif(isset($shared[$cat->getCategoryID()]))
1270 $this->visible =
true;
1276 $this->visible =
true;
1280 $this->editable =
false;
1283 foreach($refs as $ref)
1285 if($ilAccess->checkAccess(
'read',
'',$ref))
1287 $this->visible =
true;
1289 if($ilAccess->checkAccess(
'edit_event',
'',$ref))
1291 $this->importable =
true;
1298 $this->editable = $ilUser->getId() == $cat->getCategoryID();
1299 $this->visible =
true;
1300 $this->importable =
false;
1317 $ilErr->raiseError($this->lng->txt(
'permission_denied'),$ilErr->FATAL);
1333 return $this->importable;
1346 $tpl =
new ilTemplate(
'tpl.cal_reference_links.html',
true,
true,
'Services/Calendar');
1350 include_once(
'./Services/Link/classes/class.ilLink.php');
1352 $parent_ref_id = $tree->getParentId(
$ref_id);
1360 $tpl->setCurrentBlock(
'reference');
1362 $tpl->setVariable(
'PIMG_ALT',$this->lng->txt(
'obj_'.$parent_type));
1363 $tpl->setVariable(
'PARENT_TITLE',$parent_title);
1367 $tpl->setVariable(
'ALT',$this->lng->txt(
'obj_'.$type));
1370 $tpl->parseCurrentBlock();
1381 protected function manage($a_reset_offsets =
false)
1385 include_once(
'./Services/Calendar/classes/class.ilCalendarManageTableGUI.php');
1388 if($a_reset_offsets)
1390 $table_gui->resetToDefaults();
1393 $table_gui->parse();
1395 include_once
"./Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php";
1396 $toolbar =
new ilToolbarGui();
1397 $ilCtrl->setParameter($this,
'backv',self::VIEW_MANAGE);
1398 $toolbar->addButton($lng->txt(
"cal_add_calendar"), $ilCtrl->getLinkTarget($this,
"add"));
1400 $tpl->setContent($toolbar->getHTML().$table_gui->getHTML());
1408 global $ilTabs,
$tpl;
1410 if(!
$_GET[
'category_id'])
1413 $this->ctrl->returnToParent($this);
1416 $this->ctrl->setParameter($this,
'category_id',(
int)
$_GET[
'category_id']);
1429 $ilTabs->clearTargets();
1430 $ilTabs->setBackTarget($this->lng->txt(
"cal_back_to_list"), $this->ctrl->getLinkTarget($this,
"manage"));
1437 $tpl->setContent($form->getHTML());
1445 include_once
'./Services/Form/classes/class.ilPropertyFormGUI.php';
1447 $form->setTitle($this->lng->txt(
'cal_import_tbl'));
1448 $form->setFormAction($this->ctrl->getFormAction($this));
1450 $form->addCommandButton(
'uploadAppointments',$this->lng->txt(
'import'));
1452 $ics =
new ilFileInputGUI($this->lng->txt(
'cal_import_file'),
'file');
1454 $ics->setSuffixes(array(
'ics'));
1455 $ics->setInfo($this->lng->txt(
'cal_import_file_info'));
1456 $form->addItem($ics);
1469 if($form->checkInput())
1471 $file = $form->getInput(
'file');
1479 $this->ctrl->redirect($this,
'manage');
1493 include_once
'./Services/Calendar/classes/../classes/iCal/class.ilICalParser.php';
1494 include_once
'./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php';
1496 $GLOBALS[
'ilLog']->write(__METHOD__.
': Starting ical import...');
1501 $parser->setCategoryId($category_id);
1506 return $assigned_after - $assigned_before;