59 $this->user_id = $a_user_id;
62 $this->lng->loadLanguageModule(
'dateplaner');
77 $next_class = $this->ctrl->getNextClass($this);
78 $this->ctrl->saveParameter($this,
'category_id');
81 case 'ilcalendarappointmentgui':
82 $this->ctrl->setReturn($this,
'details');
84 include_once(
'./Services/Calendar/classes/class.ilCalendarAppointmentGUI.php');
86 $this->ctrl->forwardCommand($app);
90 $cmd = $this->ctrl->getCmd(
"show");
92 if(!in_array(
$cmd, array(
"details",
"askDeleteAppointments",
"deleteAppointments")))
108 $this->ctrl->returnToParent($this);
119 global
$tpl, $ilTabs;
121 $ilTabs->clearTargets();
122 $ilTabs->setBackTarget($this->lng->txt(
"cal_back_to_list"), $this->ctrl->getLinkTarget($this,
"manage"));
124 $this->tpl =
new ilTemplate(
'tpl.edit_category.html',
true,
true,
'Services/Calendar');
126 $this->tpl->setVariable(
'EDIT_CAT',$this->form->getHTML());
127 $tpl->setContent($this->tpl->get());
139 include_once(
'./Services/Calendar/classes/class.ilCalendarCategory.php');
146 $category->setType((
int)
$_POST[
'type']);
147 $category->setObjId(0);
152 $category->setObjId($ilUser->getId());
155 if(!$category->validate())
176 global
$tpl, $ilTabs;
178 if(!
$_GET[
'category_id'])
181 $this->ctrl->returnToParent($this);
194 $ilTabs->clearTargets();
195 $ilTabs->setBackTarget($this->lng->txt(
"cal_back_to_list"), $this->ctrl->getLinkTarget($this,
"manage"));
198 $tpl->setContent($this->form->getHTML());
211 if(!
$_GET[
'category_id'])
214 $this->ctrl->returnToParent($this);
223 include_once
"./Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php";
224 $toolbar =
new ilToolbarGui();
225 $toolbar->addButton($this->lng->txt(
"cal_add_appointment"), $this->ctrl->getLinkTargetByClass(
"ilcalendarappointmentgui",
"add"));
226 $toolbar = $toolbar->getHTML();
230 include_once(
"./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
232 $info->setFormAction($this->ctrl->getFormAction($this));
234 $info->addSection($this->lng->txt(
'cal_cal_details'));
237 $info->addProperty($this->lng->txt(
'cal_calendar_name'),$category->getTitle());
238 switch($category->getType())
241 $info->addProperty($this->lng->txt(
'cal_cal_type'),$this->lng->txt(
'cal_type_personal'));
245 $info->addProperty($this->lng->txt(
'cal_cal_type'),$this->lng->txt(
'cal_type_system'));
249 $info->addProperty($this->lng->txt(
'cal_cal_type'),$this->lng->txt(
'cal_type_'.$category->getObjType()));
251 $info->addSection($this->lng->txt(
'additional_info'));
252 $info->addProperty($this->lng->txt(
'perma_link'),$this->
addReferenceLinks($category->getObjId()));
261 $tpl->setContent($toolbar.$info->getHTML().$this->showAssignedAppointments());
272 if(!
$_GET[
'category_id'])
275 $this->ctrl->returnToParent($this);
285 include_once(
'./Services/Calendar/classes/class.ilCalendarCategory.php');
306 if(!
$_POST[
'selected_cat_ids'])
322 include_once(
'./Services/Utilities/classes/class.ilConfirmationGUI.php');
325 $confirmation_gui->setFormAction($this->ctrl->getFormAction($this));
326 $confirmation_gui->setHeaderText($this->lng->txt(
'cal_del_cal_sure'));
327 $confirmation_gui->setConfirm($this->lng->txt(
'delete'),
'delete');
328 $confirmation_gui->setCancel($this->lng->txt(
'cancel'),
'manage');
330 include_once(
'./Services/Calendar/classes/class.ilCalendarCategory.php');
331 foreach(
$_POST[
'selected_cat_ids'] as $cat_id)
334 $confirmation_gui->addItem(
'category_id[]',$cat_id,$category->getTitle());
337 $tpl->setContent($confirmation_gui->getHTML());
347 protected function delete()
351 if(!
$_POST[
'category_id'])
367 include_once(
'./Services/Calendar/classes/class.ilCalendarCategory.php');
368 foreach(
$_POST[
'category_id'] as $cat_id)
375 $ilCtrl->redirect($this,
'manage');
391 include_once(
'./Services/Calendar/classes/class.ilCalendarCategories.php');
392 include_once(
'./Services/Calendar/classes/class.ilCalendarHidden.php');
394 $selected_cat_ids =
$_POST[
'selected_cat_ids'] ?
$_POST[
'selected_cat_ids'] : array();
395 $shown_cat_ids =
$_POST[
'shown_cat_ids'] ?
$_POST[
'shown_cat_ids'] : array();
398 $cat_ids = $cats->getCategories();
401 $hidden_cat_ids = $hidden_cats->getHidden();
405 foreach($hidden_cat_ids as $hidden_cat_id)
407 if( !in_array($hidden_cat_id,$shown_cat_ids) )
409 $hidden[] = $hidden_cat_id;
413 foreach($shown_cat_ids as $shown_cat_id)
415 $shown_cat_id = (int)$shown_cat_id;
416 if( !in_array($shown_cat_id, $selected_cat_ids) )
418 $hidden[] = $shown_cat_id;
423 $hidden_categories->hideSelected($hidden);
424 $hidden_categories->save();
427 $this->ctrl->returnToParent($this);
439 include_once(
'./Services/Calendar/classes/class.ilCalendarCategoryTableGUI.php');
441 $nav_parameter = $table_gui->getNavParameter();
443 if(
$_POST[$nav_parameter] !=
"")
445 if(
$_POST[$nav_parameter.
"1"] !=
$_POST[$nav_parameter])
447 $nav_value =
$_POST[$nav_parameter.
"1"];
449 elseif(
$_POST[$nav_parameter.
"2"] !=
$_POST[$nav_parameter])
451 $nav_value =
$_POST[$nav_parameter.
"2"];
456 $nav_value =
$_GET[$nav_parameter];
461 $this->ctrl->returnToParent($this);
473 global
$tpl, $ilTabs;
475 if(!
$_GET[
'category_id'])
478 $this->ctrl->returnToParent($this);
489 $ilTabs->clearTargets();
490 $ilTabs->setBackTarget($this->lng->txt(
"cal_back_to_list"), $this->ctrl->getLinkTarget($this,
"manage"));
494 $this->ctrl->saveParameter($this,
'category_id');
497 include_once(
'./Services/Calendar/classes/class.ilCalendarSharedListTableGUI.php');
499 $table->setTitle($this->lng->txt(
'cal_shared_header'));
500 $table->setCalendarId((
int)
$_GET[
'category_id']);
502 $tpl->setContent($this->form->getHTML().$table->getHTML());
515 $this->lng->loadLanguageModule(
'search');
517 if(!
$_GET[
'category_id'])
520 $this->ctrl->returnToParent($this);
522 $this->ctrl->saveParameter($this,
'category_id');
525 if(!isset(
$_POST[
'query']))
544 include_once
'Services/Search/classes/class.ilQueryParser.php';
545 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
546 include_once
'Services/Search/classes/class.ilSearchResult.php';
552 $query_parser->setMinWordLength(3);
553 $query_parser->parse();
558 case self::SEARCH_USER:
560 $search->enableActiveCheck(
true);
562 $search->setFields(array(
'login'));
563 $res = $search->performSearch();
564 $res_sum->mergeEntries(
$res);
566 $search->setFields(array(
'firstname'));
567 $res = $search->performSearch();
568 $res_sum->mergeEntries(
$res);
570 $search->setFields(array(
'lastname'));
571 $res = $search->performSearch();
572 $res_sum->mergeEntries(
$res);
577 case self::SEARCH_ROLE:
579 include_once
'Services/Search/classes/Like/class.ilLikeObjectSearch.php';
581 $search->setFilter(array(
'role'));
583 $res = $search->performSearch();
584 $res_sum->mergeEntries(
$res);
590 if(!count($res_sum->getResults()))
597 $ilTabs->clearTargets();
598 $ilTabs->setBackTarget($this->lng->txt(
"cal_back_to_search"), $this->ctrl->getLinkTarget($this,
"shareSearch"));
602 case self::SEARCH_USER:
606 case self::SEARCH_ROLE:
622 if(!
$_GET[
'category_id'])
625 $this->ctrl->returnToParent($this);
627 if(!count(
$_POST[
'user_ids']))
643 include_once(
'./Services/Calendar/classes/class.ilCalendarShared.php');
668 if(!
$_GET[
'category_id'])
671 $this->ctrl->returnToParent($this);
673 if(!count(
$_POST[
'role_ids']))
688 include_once(
'./Services/Calendar/classes/class.ilCalendarShared.php');
691 foreach(
$_POST[
'role_ids'] as $role_id)
708 if(!
$_GET[
'category_id'])
711 $this->ctrl->returnToParent($this);
713 if(!count(
$_POST[
'obj_ids']))
729 include_once(
'./Services/Calendar/classes/class.ilCalendarShared.php');
732 foreach(
$_POST[
'obj_ids'] as $obj_id)
734 $shared->stopSharing($obj_id);
753 include_once(
'./Services/Calendar/classes/class.ilCalendarSharedUserListTableGUI.php');
756 $table->setTitle($this->lng->txt(
'cal_share_search_usr_header'));
757 $table->setFormAction($this->ctrl->getFormAction($this));
758 $table->setUsers($a_ids);
764 $tpl->setContent($table->getHTML());
778 include_once(
'./Services/Calendar/classes/class.ilCalendarSharedRoleListTableGUI.php');
781 $table->setTitle($this->lng->txt(
'cal_share_search_role_header'));
782 $table->setFormAction($this->ctrl->getFormAction($this));
783 $table->setRoles($a_ids);
789 $tpl->setContent($table->getHTML());
803 $lng->loadLanguageModule(
'search');
805 if(!is_object($this->form))
807 include_once(
'Services/Form/classes/class.ilPropertyFormGUI.php');
809 $this->form->setFormAction($this->ctrl->getFormAction($this));
810 $this->form->setTitle($this->lng->txt(
'cal_share_search_header'));
814 $type->setValue(
$_POST[
'query_type'] ?
$_POST[
'query_type'] : self::SEARCH_USER);
815 $type->setRequired(
true);
818 $type->addOption($user);
821 $type->addOption($role);
823 $this->form->addItem(
$type);
825 $search =
new ilTextInputGUI($this->lng->txt(
'cal_search'),
'query');
827 $search->setSize(16);
828 $search->setMaxLength(128);
829 $search->setRequired(
true);
830 $search->setInfo($this->lng->txt(
'cal_search_info_share'));
832 $this->form->addItem($search);
833 $this->form->addCommandButton(
'sharePerformSearch',$this->lng->txt(
'search'));
845 global $rbacsystem,$ilUser;
847 include_once(
'./Services/Form/classes/class.ilPropertyFormGUI.php');
848 include_once(
'./Services/Calendar/classes/class.ilCalendarCategory.php');
850 include_once(
'./Services/Calendar/classes/class.ilCalendarCategories.php');
854 $this->form->setTableWidth(
'40%');
859 $this->form->setTitle($this->lng->txt(
'cal_edit_category'));
860 $this->ctrl->saveParameter($this,array(
'seed',
'category_id'));
861 $this->form->setFormAction($this->ctrl->getFormAction($this));
864 $this->form->addCommandButton(
'update',$this->lng->txt(
'save'));
874 $this->form->addCommandButton(
'manage',$this->lng->txt(
'cancel'));
878 $this->editable =
true;
880 $this->ctrl->saveParameter($this,array(
'category_id'));
881 $this->form->setFormAction($this->ctrl->getFormAction($this));
882 $this->form->setTitle($this->lng->txt(
'cal_add_category'));
883 $this->form->addCommandButton(
'save',$this->lng->txt(
'save'));
884 $this->form->addCommandButton(
'manage',$this->lng->txt(
'cancel'));
890 if($a_mode ==
'edit')
894 $title->setRequired(
true);
897 $title->setValue($category->getTitle());
898 $this->form->addItem(
$title);
901 include_once(
'./Services/Calendar/classes/class.ilCalendarSettings.php');
905 $type->setValue($category->getType());
906 $type->setRequired(
true);
909 $type->addOption($opt);
912 $type->addOption($opt);
913 $type->setInfo($this->lng->txt(
'cal_type_info'));
914 $this->form->addItem(
$type);
919 $color->
setValue($category->getColor());
922 $color->setDisabled(
true);
924 $color->setRequired(
true);
925 $this->form->addItem($color);
935 if(!
$_GET[
'category_id'])
938 $this->ctrl->returnToParent($this);
944 include_once(
'./Services/Calendar/classes/class.ilCalendarSharedStatus.php');
947 include_once(
'./Services/Calendar/classes/class.ilCalendarShared.php');
954 $status->decline(
$_GET[
'category_id']);
957 $this->ctrl->redirect($this,
'manage');
968 include_once(
'./Services/Calendar/classes/class.ilCalendarCategoryTableGUI.php');
969 include_once(
'./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
970 include_once(
'./Services/Calendar/classes/class.ilCalendarAppointmentsTableGUI.php');
973 $table_gui->setTitle($this->lng->txt(
'cal_assigned_appointments'));
974 $table_gui->setAppointments(
977 return $table_gui->getHTML();
990 if(!count(
$_POST[
'appointments']))
997 include_once(
'./Services/Utilities/classes/class.ilConfirmationGUI.php');
1000 $this->ctrl->setParameter($this,
'category_id',(
int)
$_GET[
'category_id']);
1001 $confirmation_gui->setFormAction($this->ctrl->getFormAction($this));
1002 $confirmation_gui->setHeaderText($this->lng->txt(
'cal_del_app_sure'));
1003 $confirmation_gui->setConfirm($this->lng->txt(
'delete'),
'deleteAppointments');
1004 $confirmation_gui->setCancel($this->lng->txt(
'cancel'),
'details');
1006 include_once(
'./Services/Calendar/classes/class.ilCalendarEntry.php');
1007 foreach(
$_POST[
'appointments'] as $app_id)
1010 $confirmation_gui->addItem(
'appointments[]',(
int) $app_id,$app->getTitle());
1013 $tpl->setContent($confirmation_gui->getHTML());
1024 if(!count(
$_POST[
'appointments']))
1030 include_once(
'./Services/Calendar/classes/class.ilCalendarEntry.php');
1031 foreach(
$_POST[
'appointments'] as $app_id)
1036 include_once(
'./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
1060 include_once(
'./Services/Calendar/classes/class.ilCalendarCategoryTableGUI.php');
1063 $title = $this->lng->txt(
'cal_table_categories');
1066 $table_gui->setTitle(
$title);
1067 $table_gui->addMultiCommand(
'saveSelection',$this->lng->txt(
'show'));
1069 $table_gui->parse();
1071 return $table_gui->getHTML();
1084 $this->lng->loadLanguageModule(
'pd');
1086 $tpl =
new ilTemplate(
'tpl.calendar_selection.html',
true,
true,
'Services/Calendar');
1087 include_once(
'./Services/Calendar/classes/class.ilCalendarUserSettings.php');
1091 $tpl->setVariable(
'HTEXT',$this->lng->txt(
'pd_my_memberships'));
1092 $tpl->touchBlock(
'head_item');
1093 $tpl->touchBlock(
'head_delim');
1094 $tpl->touchBlock(
'head_item');
1097 $tpl->setVariable(
'HHREF',$this->ctrl->getLinkTarget($this,
'switchCalendarMode'));
1098 $tpl->setVariable(
'HLINK',$this->lng->txt(
'pd_my_offers'));
1099 $tpl->touchBlock(
'head_item');
1104 $tpl->setVariable(
'HHREF',$this->ctrl->getLinkTarget($this,
'switchCalendarMode'));
1105 $tpl->setVariable(
'HLINK',$this->lng->txt(
'pd_my_memberships'));
1106 $tpl->touchBlock(
'head_item');
1107 $tpl->touchBlock(
'head_delim');
1108 $tpl->touchBlock(
'head_item');
1110 $tpl->setVariable(
'HTEXT',$this->lng->txt(
'pd_my_offers'));
1111 $tpl->touchBlock(
'head_item');
1125 include_once(
'./Services/Calendar/classes/class.ilCalendarUserSettings.php');
1129 $this->ctrl->returnToParent($this);
1143 global $ilUser,$rbacsystem,$ilAccess;
1145 $this->editable =
false;
1146 $this->visible =
false;
1148 include_once(
'./Services/Calendar/classes/class.ilCalendarShared.php');
1152 switch($cat->getType())
1155 if($cat->getObjId() == $ilUser->getId())
1157 $this->visible =
true;
1158 $this->editable =
true;
1160 elseif(isset($shared[$cat->getCategoryID()]))
1162 $this->visible =
true;
1168 $this->visible =
true;
1172 $this->editable =
false;
1175 foreach($refs as $ref)
1177 if($ilAccess->checkAccess(
'read',
'',$ref))
1179 $this->visible =
true;
1187 $this->editable = $ilUser->getId() == $cat->getCategoryID();
1188 $this->visible =
true;
1205 $ilErr->raiseError($this->lng->txt(
'permission_denied'),$ilErr->FATAL);
1228 $tpl =
new ilTemplate(
'tpl.cal_reference_links.html',
true,
true,
'Services/Calendar');
1232 include_once(
'./classes/class.ilLink.php');
1234 $parent_ref_id = $tree->getParentId(
$ref_id);
1242 $tpl->setCurrentBlock(
'reference');
1244 $tpl->setVariable(
'PIMG_ALT',$this->lng->txt(
'obj_'.$parent_type));
1245 $tpl->setVariable(
'PARENT_TITLE',$parent_title);
1249 $tpl->setVariable(
'ALT',$this->lng->txt(
'obj_'.$type));
1252 $tpl->parseCurrentBlock();
1261 include_once(
'./Services/Calendar/classes/class.ilCalendarManageTableGUI.php');
1263 $table_gui->parse();
1265 include_once
"./Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php";
1266 $toolbar =
new ilToolbarGui();
1267 $toolbar->addButton($lng->txt(
"add"), $ilCtrl->getLinkTarget($this,
"add"));
1269 $tpl->setContent($toolbar->getHTML().$table_gui->getHTML());