ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilCalendarCategoryGUI.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2006 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +-----------------------------------------------------------------------------+
22 */
23 
36 {
37  const SEARCH_USER = 1;
38  const SEARCH_ROLE = 2;
39 
40  const VIEW_MANAGE = 1;
41 
42  protected $user_id;
43 
47  protected $ctrl;
48 
52  protected $lng;
53 
57  protected $tabs;
58 
59  protected $editable = false;
60  protected $visible = false;
61 
65  protected $category_id = 0;
66 
70  protected $tpl;
71 
80  public function __construct($a_user_id, $seed, $a_ref_id = 0)
81  {
82  global $DIC;
83 
84  $this->user_id = $a_user_id;
85  $this->seed = $seed;
86  $this->lng = $DIC->language();
87  $this->lng->loadLanguageModule('dateplaner');
88  $this->ctrl = $DIC->ctrl();
89  $this->ref_id = $a_ref_id;
90  $this->obj_id = ilObject::_lookupObjId($a_ref_id);
91  $this->tabs = $DIC->tabs();
92  $this->tpl = $DIC->ui()->mainTemplate();
93 
94  $this->lng->loadLanguageModule("dateplaner");
95 
96  if (in_array($this->ctrl->getNextClass(), array("", "ilcalendarcategorygui")) && $this->ctrl->getCmd() == "manage") {
97  if ($a_ref_id > 0) { // no manage screen in repository
98  $this->ctrl->returnToParent($this);
99  }
100  if ((int) $_GET['category_id'] > 0) {
101  // reset category id on manage screen (redirect needed to initialize categories correctly)
102  $this->ctrl->setParameter($this, "category_id", "");
103  $this->ctrl->setParameterByClass("ilcalendarpresentationgui", "category_id", "");
104  $this->ctrl->redirect($this, "manage");
105  }
106  }
107 
108  $this->category_id = (int) $_GET['category_id'];
109 
110  include_once("./Services/Calendar/classes/class.ilCalendarActions.php");
111  $this->actions = ilCalendarActions::getInstance();
112  }
113 
121  public function executeCommand()
122  {
123  global $ilUser, $ilSetting,$tpl;
124 
125  $next_class = $this->ctrl->getNextClass($this);
126  $this->ctrl->saveParameter($this, 'category_id');
127  $this->ctrl->setParameter($this, 'seed', $this->seed->get(IL_CAL_DATE));
128  switch ($next_class) {
129  case 'ilcalendarappointmentgui':
130  $this->ctrl->setReturn($this, 'details');
131 
132  include_once('./Services/Calendar/classes/class.ilCalendarAppointmentGUI.php');
133  $app = new ilCalendarAppointmentGUI($this->seed, $this->seed, (int) $_GET['app_id']);
134  $this->ctrl->forwardCommand($app);
135  break;
136 
137  default:
138  $cmd = $this->ctrl->getCmd("show");
139  $this->$cmd();
140  if (!in_array($cmd, array("details", "askDeleteAppointments", "deleteAppointments"))) {
141  return true;
142  }
143  }
144  return false;
145  }
146 
153  protected function cancel()
154  {
155  $this->ctrl->returnToParent($this);
156  }
157 
158 
165  protected function add(ilPropertyFormGUI $form = null)
166  {
167  global $tpl, $ilTabs;
168 
169  $ilTabs->clearTargets();
170 
171  if ($_REQUEST['backv'] == self::VIEW_MANAGE) {
172  $back = 'manage';
173  } else {
174  $back = 'cancel';
175  }
176 
177  $ilTabs->setBackTarget($this->lng->txt("cal_back_to_list"), $this->ctrl->getLinkTarget($this, $back));
178 
179  $ed_tpl = new ilTemplate('tpl.edit_category.html', true, true, 'Services/Calendar');
180 
181  if (!$form instanceof ilPropertyFormGUI) {
182  $form = $this->initFormCategory('create');
183  }
184  $ed_tpl->setVariable('EDIT_CAT', $form->getHTML());
185  $tpl->setContent($ed_tpl->get());
186  }
187 
193  protected function save()
194  {
195  $form = $this->initFormCategory('create');
196  if ($form->checkInput()) {
197  $category = new ilCalendarCategory(0);
198  $category->setTitle($form->getInput('title'));
199  $category->setColor('#' . $form->getInput('color'));
200  $category->setLocationType($form->getInput('type_rl'));
201  $category->setRemoteUrl($form->getInput('remote_url'));
202  $category->setRemoteUser($form->getInput('remote_user'));
203  $category->setRemotePass($form->getInput('remote_pass'));
204  if ($form->getInput('type') == ilCalendarCategory::TYPE_GLOBAL) {
205  $category->setType((int) $form->getInput('type'));
206  $category->setObjId(0);
207  } else {
208  $category->setType(ilCalendarCategory::TYPE_USR);
209  $category->setObjId($GLOBALS['DIC']->user()->getId());
210  }
211  $category->add();
212  } else {
213  ilUtil::sendFailure($this->lng->txt('err_check_input'));
214  $form->setValuesByPost();
215  $this->add($form);
216  return false;
217  }
218 
219  // try sync
220  try {
221  if ($category->getLocationType() == ilCalendarCategory::LTYPE_REMOTE) {
222  $this->doSynchronisation($category);
223  }
224  } catch (Exception $e) {
225  // Delete calendar if creation failed
226  $category->delete();
227  ilUtil::sendFailure($e->getMessage());
228  $form->setValuesByPost();
229  $this->add($form);
230  return false;
231  }
232 
233  ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
234  $GLOBALS['DIC']->ctrl()->redirect($this, 'manage');
235  }
236 
242  protected function edit(ilPropertyFormGUI $form = null)
243  {
244  global $DIC;
245 
246  $tpl = $DIC["tpl"];
247  $tabs = $DIC->tabs();
248  $tabs->activateTab("edit");
249 
250  $this->readPermissions();
251 
252  if (!$this->category_id) {
253  ilUtil::sendFailure($this->lng->txt('select_one'), true);
254  $this->ctrl->returnToParent($this);
255  }
256 
257  if (!$this->actions->checkSettingsCal($this->category_id)) {
258  ilUtil::sendFailure($this->lng->txt('permission_denied'), true);
259  $this->ctrl->returnToParent($this);
260  }
261 
262  if (!$form instanceof ilPropertyFormGUI) {
263  $form = $this->initFormCategory('edit');
264  }
265  $tpl->setContent($form->getHTML());
266  }
267 
273  protected function details()
274  {
275  global $tpl;
276 
277  if (!$this->category_id) {
278  ilUtil::sendFailure($this->lng->txt('select_one'), true);
279  $this->ctrl->returnToParent($this);
280  }
281 
282  $this->readPermissions();
283  $this->checkVisible();
284 
285  // Non editable category
286  include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
287  $info = new ilInfoScreenGUI($this);
288  $info->setFormAction($this->ctrl->getFormAction($this));
289 
290  $info->addSection($this->lng->txt('cal_cal_details'));
291 
292  $tpl->setContent($info->getHTML() . $this->showAssignedAppointments());
293  }
294 
295  protected function synchroniseCalendar()
296  {
297  if (!$this->category_id) {
298  ilUtil::sendFailure($this->lng->txt('select_one'), true);
299  $this->ctrl->returnToParent($this);
300  }
301 
302  $category = new ilCalendarCategory($this->category_id);
303 
304  try {
305  $this->doSynchronisation($category);
306  } catch (Exception $e) {
307  ilUtil::sendFailure($e->getMessage(), true);
308  $this->ctrl->redirect($this, 'manage');
309  }
310  ilUtil::sendSuccess($this->lng->txt('cal_cal_sync_success'), true);
311  $this->ctrl->redirect($this, 'manage');
312  }
313 
318  protected function doSynchronisation(ilCalendarCategory $category)
319  {
320  include_once './Services/Calendar/classes/class.ilCalendarRemoteReader.php';
321  $remote = new ilCalendarRemoteReader($category->getRemoteUrl());
322  $remote->setUser($category->getRemoteUser());
323  $remote->setPass($category->getRemotePass());
324  $remote->read();
325  $remote->import($category);
326  }
327 
334  protected function update()
335  {
336  if (!$this->category_id) {
337  ilUtil::sendFailure($this->lng->txt('select_one'), true);
338  $this->ctrl->returnToParent($this);
339  }
340  $this->readPermissions();
341  if (!$this->isEditable()) {
342  ilUtil::sendFailure($this->lng->txt('permission_denied'));
343  $this->edit();
344  return false;
345  }
346 
347  $form = $this->initFormCategory('edit');
348  if ($form->checkInput()) {
349  $category = new ilCalendarCategory($this->category_id);
350  if ($category->getType() != ilCalendarCategory::TYPE_OBJ) {
351  $category->setTitle($form->getInput('title'));
352  }
353  $category->setColor('#' . $form->getInput('color'));
354  $category->update();
355  ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
356  if ($this->ref_id > 0) {
357  $this->ctrl->returnToParent($this);
358  } else {
359  $this->ctrl->redirect($this, "manage");
360  }
361  } else {
362  $form->setValuesByPost();
363  ilUtil::sendFailure($this->lng->txt('err_check_input'));
364  $this->edit($form);
365  }
366  }
367 
374  protected function confirmDelete()
375  {
376  global $tpl;
377 
378  $cat_ids = (is_array($_POST['selected_cat_ids']) && count($_POST['selected_cat_ids']) > 0)
379  ? $_POST['selected_cat_ids']
380  : ($_GET["category_id"] > 0 ? array($_GET["category_id"]) : null);
381 
382  if (!is_array($cat_ids)) {
383  ilUtil::sendFailure($this->lng->txt('select_one'), true);
384  $this->manage();
385  }
386 
387  /*
388  $this->readPermissions();
389  if(!$this->isEditable())
390  {
391  ilUtil::sendFailure($this->lng->txt('permission_denied'));
392  $this->manage();
393  return false;
394  }
395  */
396 
397  include_once('./Services/Utilities/classes/class.ilConfirmationGUI.php');
398  $confirmation_gui = new ilConfirmationGUI();
399 
400  $confirmation_gui->setFormAction($this->ctrl->getFormAction($this));
401  $confirmation_gui->setHeaderText($this->lng->txt('cal_del_cal_sure'));
402  $confirmation_gui->setConfirm($this->lng->txt('delete'), 'delete');
403  $confirmation_gui->setCancel($this->lng->txt('cancel'), 'manage');
404 
405  include_once('./Services/Calendar/classes/class.ilCalendarCategory.php');
406  foreach ($cat_ids as $cat_id) {
407  $category = new ilCalendarCategory((int) $cat_id);
408  $confirmation_gui->addItem('category_id[]', $cat_id, $category->getTitle());
409  }
410 
411  $tpl->setContent($confirmation_gui->getHTML());
412  }
413 
421  protected function delete()
422  {
423  global $ilCtrl;
424 
425  if (!$_POST['category_id']) {
426  ilUtil::sendFailure($this->lng->txt('select_one'), true);
427  $this->manage();
428  }
429 
430  /*
431  $this->readPermissions();
432  if(!$this->isEditable())
433  {
434  ilUtil::sendFailure($this->lng->txt('permission_denied'));
435  $this->edit();
436  return false;
437  }
438  */
439 
440  include_once('./Services/Calendar/classes/class.ilCalendarCategory.php');
441  foreach ($_POST['category_id'] as $cat_id) {
442  $category = new ilCalendarCategory((int) $cat_id);
443  $category->delete();
444  }
445 
446  ilUtil::sendSuccess($this->lng->txt('cal_cal_deleted'), true);
447  $ilCtrl->redirect($this, 'manage');
448  }
449 
450 
451 
459  public function saveSelection()
460  {
461  global $ilUser;
462 
463  include_once('./Services/Calendar/classes/class.ilCalendarCategories.php');
464  include_once('./Services/Calendar/classes/class.ilCalendarVisibility.php');
465 
466  $selected_cat_ids = $_POST['selected_cat_ids'] ? $_POST['selected_cat_ids'] : array();
467  $shown_cat_ids = $_POST['shown_cat_ids'] ? $_POST['shown_cat_ids'] : array();
468 
469  $cats = ilCalendarCategories::_getInstance($ilUser->getId());
470  $cat_ids = $cats->getCategories();
471 
472  $cat_visibility = ilCalendarVisibility::_getInstanceByUserId($ilUser->getId(), $this->ref_id);
473 
474 
475 
476  if ($this->obj_id > 0) {
477  $old_selection = $cat_visibility->getVisible();
478  } else {
479  $old_selection = $cat_visibility->getHidden();
480  }
481 
482 
483  $new_selection = array();
484 
485  // put all entries from the old selection into the new one
486  // that are not presented on the screen
487  foreach ($old_selection as $cat_id) {
488  if (!in_array($cat_id, $shown_cat_ids)) {
489  $new_selection[] = $cat_id;
490  }
491  }
492 
493  foreach ($shown_cat_ids as $shown_cat_id) {
494  $shown_cat_id = (int) $shown_cat_id;
495  if ($this->obj_id > 0) {
496  if (in_array($shown_cat_id, $selected_cat_ids)) {
497  $new_selection[] = $shown_cat_id;
498  }
499  } else {
500  if (!in_array($shown_cat_id, $selected_cat_ids)) {
501  $new_selection[] = $shown_cat_id;
502  }
503  }
504  }
505 
506  if ($this->obj_id > 0) {
507  $cat_visibility->showSelected($new_selection);
508  } else {
509  $cat_visibility->hideSelected($new_selection);
510  }
511 
512  $cat_visibility->save();
513 
514  ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
515  $this->ctrl->returnToParent($this);
516  }
517 
525  public function shareSearch()
526  {
527  global $tpl, $DIC;
528 
529  $tabs = $DIC->tabs();
530  $tabs->activateTab("share");
531 
532  if (!$this->category_id) {
533  ilUtil::sendFailure($this->lng->txt('select_one'), true);
534  $this->ctrl->returnToParent($this);
535  }
536 
537  $this->readPermissions();
538  if (!$this->isEditable()) {
539  ilUtil::sendFailure($this->lng->txt('permission_denied'));
540  $this->manage();
541  return false;
542  }
543 
544 
545  $_SESSION['cal_query'] = '';
546 
547  $this->ctrl->saveParameter($this, 'category_id');
548 
549  include_once('./Services/Calendar/classes/class.ilCalendarSharedListTableGUI.php');
550  $table = new ilCalendarSharedListTableGUI($this, 'shareSearch');
551  $table->setTitle($this->lng->txt('cal_cal_shared_with'));
552  $table->setCalendarId($this->category_id);
553  $table->parse();
554 
555  $this->getSearchToolbar();
556  $tpl->setContent($table->getHTML());
557  }
558 
565  public function sharePerformSearch()
566  {
567  global $DIC;
568 
569  $tabs = $DIC->tabs();
570  $tabs->activateTab("share");
571 
572  $this->lng->loadLanguageModule('search');
573 
574  if (!$this->category_id) {
575  ilUtil::sendFailure($this->lng->txt('select_one'), true);
576  $this->ctrl->returnToParent($this);
577  }
578  $this->ctrl->saveParameter($this, 'category_id');
579 
580 
581  if (!isset($_POST['query'])) {
582  $query = $_SESSION['cal_query'];
583  $type = $_SESSION['cal_type'];
584  } elseif ($_POST['query']) {
585  $query = $_SESSION['cal_query'] = $_POST['query'];
586  $type = $_SESSION['cal_type'] = $_POST['query_type'];
587  }
588 
589  if (!$query) {
590  ilUtil::sendFailure($this->lng->txt('msg_no_search_string'));
591  $this->shareSearch();
592  return false;
593  }
594 
595  $this->getSearchToolbar();
596 
597  include_once 'Services/Search/classes/class.ilQueryParser.php';
598  include_once 'Services/Search/classes/class.ilObjectSearchFactory.php';
599  include_once 'Services/Search/classes/class.ilSearchResult.php';
600 
601  $res_sum = new ilSearchResult();
602 
603  $query_parser = new ilQueryParser(ilUtil::stripSlashes($query));
604  $query_parser->setCombination(QP_COMBINATION_OR);
605  $query_parser->setMinWordLength(3);
606  $query_parser->parse();
607 
608 
609  switch ($type) {
610  case self::SEARCH_USER:
611  $search = ilObjectSearchFactory::_getUserSearchInstance($query_parser);
612  $search->enableActiveCheck(true);
613 
614  $search->setFields(array('login'));
615  $res = $search->performSearch();
616  $res_sum->mergeEntries($res);
617 
618  $search->setFields(array('firstname'));
619  $res = $search->performSearch();
620  $res_sum->mergeEntries($res);
621 
622  $search->setFields(array('lastname'));
623  $res = $search->performSearch();
624  $res_sum->mergeEntries($res);
625 
626  $res_sum->filter(ROOT_FOLDER_ID, QP_COMBINATION_OR);
627  break;
628 
629  case self::SEARCH_ROLE:
630 
631  include_once 'Services/Search/classes/Like/class.ilLikeObjectSearch.php';
632  $search = new ilLikeObjectSearch($query_parser);
633  $search->setFilter(array('role'));
634 
635  $res = $search->performSearch();
636  $res_sum->mergeEntries($res);
637 
638  $res_sum->filter(ROOT_FOLDER_ID, QP_COMBINATION_OR);
639  break;
640  }
641 
642  if (!count($res_sum->getResults())) {
643  ilUtil::sendFailure($this->lng->txt('search_no_match'));
644  $this->shareSearch();
645  return true;
646  }
647 
648 
649  switch ($type) {
650  case self::SEARCH_USER:
651  $this->showUserList($res_sum->getResultIds());
652  break;
653 
654  case self::SEARCH_ROLE:
655  $this->showRoleList($res_sum->getResultIds());
656  break;
657  }
658  }
659 
663  public function shareAssignEditable()
664  {
665  return $this->shareAssign(true);
666  }
667 
674  public function shareAssign($a_editable = false)
675  {
676  global $ilUser;
677 
678  if (!$this->category_id) {
679  ilUtil::sendFailure($this->lng->txt('select_one'), true);
680  $this->ctrl->returnToParent($this);
681  }
682  if (!count($_POST['user_ids'])) {
683  ilUtil::sendFailure($this->lng->txt('select_one'));
684  $this->sharePerformSearch();
685  return false;
686  }
687 
688  $this->readPermissions();
689  if (!$this->isEditable()) {
690  ilUtil::sendFailure($this->lng->txt('permission_denied'));
691  $this->shareSearch();
692  return false;
693  }
694 
695 
696  include_once('./Services/Calendar/classes/class.ilCalendarShared.php');
697  $shared = new ilCalendarShared($this->category_id);
698 
699  foreach ($_POST['user_ids'] as $user_id) {
700  if ($ilUser->getId() != $user_id) {
701  $shared->share($user_id, ilCalendarShared::TYPE_USR, $a_editable);
702  }
703  }
704  ilUtil::sendSuccess($this->lng->txt('cal_shared_selected_usr'));
705  $this->shareSearch();
706  }
707 
711  protected function shareAssignRolesEditable()
712  {
713  return $this->shareAssignRoles(true);
714  }
715 
723  public function shareAssignRoles($a_editable = false)
724  {
725  global $ilUser;
726 
727  if (!$this->category_id) {
728  ilUtil::sendFailure($this->lng->txt('select_one'), true);
729  $this->ctrl->returnToParent($this);
730  }
731  if (!count($_POST['role_ids'])) {
732  ilUtil::sendFailure($this->lng->txt('select_one'));
733  $this->sharePerformSearch();
734  return false;
735  }
736 
737  $this->readPermissions();
738  if (!$this->isEditable()) {
739  ilUtil::sendFailure($this->lng->txt('permission_denied'));
740  $this->shareSearch();
741  return false;
742  }
743 
744  include_once('./Services/Calendar/classes/class.ilCalendarShared.php');
745  $shared = new ilCalendarShared($this->category_id);
746 
747  foreach ($_POST['role_ids'] as $role_id) {
748  $shared->share($role_id, ilCalendarShared::TYPE_ROLE, $a_editable);
749  }
750  ilUtil::sendSuccess($this->lng->txt('cal_shared_selected_usr'));
751  $this->shareSearch();
752  }
753 
761  public function shareDeassign()
762  {
763  if (!$this->category_id) {
764  ilUtil::sendFailure($this->lng->txt('select_one'), true);
765  $this->ctrl->returnToParent($this);
766  }
767  if (!count($_POST['obj_ids'])) {
768  ilUtil::sendFailure($this->lng->txt('select_one'));
769  $this->shareSearch();
770  return false;
771  }
772 
773  $this->readPermissions();
774  if (!$this->isEditable()) {
775  ilUtil::sendFailure($this->lng->txt('permission_denied'));
776  $this->shareSearch();
777  return false;
778  }
779 
780 
781  include_once('./Services/Calendar/classes/class.ilCalendarShared.php');
782  $shared = new ilCalendarShared($this->category_id);
783 
784  foreach ($_POST['obj_ids'] as $obj_id) {
785  $shared->stopSharing($obj_id);
786  }
787  ilUtil::sendSuccess($this->lng->txt('cal_unshared_selected_usr'));
788  $this->shareSearch();
789  return true;
790  }
791 
792 
800  protected function showUserList($a_ids = array())
801  {
802  global $tpl;
803 
804  include_once('./Services/Calendar/classes/class.ilCalendarSharedUserListTableGUI.php');
805 
806  $table = new ilCalendarSharedUserListTableGUI($this, 'sharePerformSearch');
807  $table->setTitle($this->lng->txt('cal_share_search_usr_header'));
808  $table->setFormAction($this->ctrl->getFormAction($this));
809  $table->setUsers($a_ids);
810  $table->parse();
811 
812  // $table->addCommandButton('shareSearch',$this->lng->txt('search_new'));
813  // $table->addCommandButton('manage',$this->lng->txt('cancel'));
814 
815  $tpl->setContent($table->getHTML());
816  }
817 
825  protected function showRoleList($a_ids = array())
826  {
827  global $tpl;
828 
829  include_once('./Services/Calendar/classes/class.ilCalendarSharedRoleListTableGUI.php');
830 
831  $table = new ilCalendarSharedRoleListTableGUI($this, 'sharePerformSearch');
832  $table->setTitle($this->lng->txt('cal_share_search_role_header'));
833  $table->setFormAction($this->ctrl->getFormAction($this));
834  $table->setRoles($a_ids);
835  $table->parse();
836 
837  // $table->addCommandButton('shareSearch',$this->lng->txt('search_new'));
838  // $table->addCommandButton('manage',$this->lng->txt('cancel'));
839 
840  $tpl->setContent($table->getHTML());
841  }
842 
848  public function getSearchToolbar()
849  {
850  global $DIC;
851 
852  $tb = $DIC->toolbar();
853  $lng = $DIC->language();
854 
855  $lng->loadLanguageModule('search');
856 
857  $tb->setFormAction($this->ctrl->getFormAction($this));
858 
859  // search term
860  $search = new ilTextInputGUI($this->lng->txt('cal_search'), 'query');
861  $search->setValue($_POST['query']);
862  $search->setSize(16);
863  $search->setMaxLength(128);
864 
865  $tb->addInputItem($search, true);
866 
867  // search type
868  include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
869  $options = array(
870  self::SEARCH_USER => $this->lng->txt('obj_user'),
871  self::SEARCH_ROLE => $this->lng->txt('obj_role'),
872  );
873  $si = new ilSelectInputGUI($this->lng->txt('search_type'), "query_type");
874  $si->setValue($_POST['query_type']);
875  $si->setOptions($options);
876  $si->setInfo($this->lng->txt(""));
877  $tb->addInputItem($si);
878 
879 
880  $tb->addFormButton($this->lng->txt('search'), "sharePerformSearch");
881  }
882 
883 
890  protected function initFormCategory($a_mode)
891  {
892  global $rbacsystem,$ilUser, $ilHelp;
893 
894  $ilHelp->setScreenIdComponent("cal");
895  $ilHelp->setScreenId("cal");
896  if ($a_mode == "edit") {
897  $ilHelp->setSubScreenId("edit");
898  } else {
899  $ilHelp->setSubScreenId("create");
900  }
901 
902  include_once('./Services/Calendar/classes/class.ilCalendarCategories.php');
903  $cat_info = ilCalendarCategories::_getInstance()->getCategoryInfo($this->category_id);
904 
905  $this->form = new ilPropertyFormGUI();
906  #$this->form->setTableWidth('40%');
907  switch ($a_mode) {
908  case 'edit':
909  $category = new ilCalendarCategory($this->category_id);
910  $this->form->setTitle($this->lng->txt('cal_edit_category'));
911  $this->ctrl->saveParameter($this, array('seed','category_id'));
912  $this->form->setFormAction($this->ctrl->getFormAction($this));
913  if ($this->isEditable()) {
914  $this->form->addCommandButton('update', $this->lng->txt('save'));
915 
916  /*
917  if($cat_info['type'] == ilCalendarCategory::TYPE_USR)
918  {
919  $this->form->addCommandButton('shareSearch',$this->lng->txt('cal_share'));
920  }
921  $this->form->addCommandButton('confirmDelete',$this->lng->txt('delete'));
922  */
923  }
924  break;
925  case 'create':
926  $this->editable = true;
927  $category = new ilCalendarCategory(0);
928  $this->ctrl->saveParameter($this, array('category_id'));
929  $this->form->setFormAction($this->ctrl->getFormAction($this));
930  $this->form->setTitle($this->lng->txt('cal_add_category'));
931  $this->form->addCommandButton('save', $this->lng->txt('save'));
932  break;
933  }
934 
935  if ($_REQUEST['backv'] == self::VIEW_MANAGE) {
936  $this->form->addCommandButton('manage', $this->lng->txt('cancel'));
937  } else {
938  $this->form->addCommandButton('cancel', $this->lng->txt('cancel'));
939  }
940 
941  // Calendar name
942  $title = new ilTextInputGUI($this->lng->txt('cal_calendar_name'), 'title');
943  if ($a_mode == 'edit') {
944  if (!$this->isEditable() || $category->getType() == ilCalendarCategory::TYPE_OBJ) {
945  $title->setDisabled(true);
946  }
947  }
948  $title->setRequired(true);
949  $title->setMaxLength(64);
950  $title->setSize(32);
951  $title->setValue($category->getTitle());
952  $this->form->addItem($title);
953 
954 
955  include_once('./Services/Calendar/classes/class.ilCalendarSettings.php');
956  if ($a_mode == 'create' and $rbacsystem->checkAccess('edit_event', ilCalendarSettings::_getInstance()->getCalendarSettingsId())) {
957  $type = new ilRadioGroupInputGUI($this->lng->txt('cal_cal_type'), 'type');
958  $type->setValue($category->getType());
959  $type->setRequired(true);
960 
961  $opt = new ilRadioOption($this->lng->txt('cal_type_personal'), ilCalendarCategory::TYPE_USR);
962  $type->addOption($opt);
963 
964  $opt = new ilRadioOption($this->lng->txt('cal_type_system'), ilCalendarCategory::TYPE_GLOBAL);
965  $type->addOption($opt);
966  $type->setInfo($this->lng->txt('cal_type_info'));
967  $this->form->addItem($type);
968  }
969 
970  // color
971  $color = new ilColorPickerInputGUI($this->lng->txt('cal_calendar_color'), 'color');
972  $color->setValue($category->getColor());
973  if (!$this->isEditable()) {
974  $color->setDisabled(true);
975  }
976  $color->setRequired(true);
977  $this->form->addItem($color);
978 
979  $location = new ilRadioGroupInputGUI($this->lng->txt('cal_type_rl'), 'type_rl');
980  $location->setDisabled($a_mode == 'edit');
981  $location_local = new ilRadioOption($this->lng->txt('cal_type_local'), ilCalendarCategory::LTYPE_LOCAL);
982  $location->addOption($location_local);
983  $location_remote = new ilRadioOption($this->lng->txt('cal_type_remote'), ilCalendarCategory::LTYPE_REMOTE);
984  $location->addOption($location_remote);
985  $location->setValue($category->getLocationType());
986 
987 
988  $url = new ilTextInputGUI($this->lng->txt('cal_remote_url'), 'remote_url');
989  $url->setDisabled($a_mode == 'edit');
990  $url->setValue($category->getRemoteUrl());
991  $url->setMaxLength(500);
992  $url->setSize(60);
993  $url->setRequired(true);
994  $location_remote->addSubItem($url);
995 
996  $user = new ilTextInputGUI($this->lng->txt('username'), 'remote_user');
997  $user->setDisabled($a_mode == 'edit');
998  $user->setValue($category->getRemoteUser());
999  $user->setMaxLength(50);
1000  $user->setSize(20);
1001  $user->setRequired(false);
1002  $location_remote->addSubItem($user);
1003 
1004  $pass = new ilPasswordInputGUI($this->lng->txt('password'), 'remote_pass');
1005  $pass->setDisabled($a_mode == 'edit');
1006  $pass->setValue($category->getRemotePass());
1007  $pass->setMaxLength(50);
1008  $pass->setSize(20);
1009  $pass->setRetype(false);
1010  $pass->setInfo($this->lng->txt('remote_pass_info'));
1011  $location_remote->addSubItem($pass);
1012 
1013  // permalink
1014  if ($a_mode == "edit" && $category->getType() == ilCalendarCategory::TYPE_OBJ) {
1015  $ne = new ilNonEditableValueGUI($this->lng->txt("perma_link"), "", true);
1016  $ne->setValue($this->addReferenceLinks($category->getObjId()));
1017  $this->form->addItem($ne);
1018  }
1019 
1020  // owner
1021  if ($a_mode == "edit" && $category->getType() == ilCalendarCategory::TYPE_USR) {
1022  $ne = new ilNonEditableValueGUI($this->lng->txt("cal_owner"), "", true);
1023  $ne->setValue(ilUserUtil::getNamePresentation($category->getObjId()));
1024  $this->form->addItem($ne);
1025  }
1026 
1027  $this->form->addItem($location);
1028  return $this->form;
1029  }
1030 
1034  protected function unshare()
1035  {
1036  global $ilUser;
1037 
1038  if (!$this->category_id) {
1039  ilUtil::sendFailure($this->lng->txt('select_one'), true);
1040  $this->ctrl->returnToParent($this);
1041  }
1042 
1043  $this->readPermissions();
1044  $this->checkVisible();
1045 
1046  include_once('./Services/Calendar/classes/class.ilCalendarSharedStatus.php');
1047  $status = new ilCalendarSharedStatus($ilUser->getId());
1048 
1049  include_once('./Services/Calendar/classes/class.ilCalendarShared.php');
1050  if (!ilCalendarShared::isSharedWithUser($ilUser->getId(), $this->category_id)) {
1051  ilUtil::sendFailure($this->lng->txt('permission_denied'));
1052  $this->inbox();
1053  return false;
1054  }
1055  $status->decline($this->category_id);
1056 
1057  ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
1058  $this->ctrl->redirect($this, 'manage');
1059  }
1060 
1067  protected function showAssignedAppointments()
1068  {
1069  include_once('./Services/Calendar/classes/class.ilCalendarCategoryTableGUI.php');
1070  include_once('./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
1071  include_once('./Services/Calendar/classes/class.ilCalendarAppointmentsTableGUI.php');
1072 
1073  $table_gui = new ilCalendarAppointmentsTableGUI($this, 'details', $this->category_id);
1074  $table_gui->setTitle($this->lng->txt('cal_assigned_appointments'));
1075  $table_gui->setAppointments(
1077  ilCalendarCategories::_getInstance()->getSubitemCategories($this->category_id)
1078  )
1079  );
1080  return $table_gui->getHTML();
1081  }
1082 
1089  protected function askDeleteAppointments()
1090  {
1091  global $tpl;
1092 
1093  if (!count($_POST['appointments'])) {
1094  ilUtil::sendFailure($this->lng->txt('select_one'));
1095  $this->details();
1096  return true;
1097  }
1098 
1099  include_once('./Services/Utilities/classes/class.ilConfirmationGUI.php');
1100  $confirmation_gui = new ilConfirmationGUI();
1101 
1102  $this->ctrl->setParameter($this, 'category_id', $this->category_id);
1103  $confirmation_gui->setFormAction($this->ctrl->getFormAction($this));
1104  $confirmation_gui->setHeaderText($this->lng->txt('cal_del_app_sure'));
1105  $confirmation_gui->setConfirm($this->lng->txt('delete'), 'deleteAppointments');
1106  $confirmation_gui->setCancel($this->lng->txt('cancel'), 'details');
1107 
1108  include_once('./Services/Calendar/classes/class.ilCalendarEntry.php');
1109  foreach ($_POST['appointments'] as $app_id) {
1110  $app = new ilCalendarEntry($app_id);
1111  $confirmation_gui->addItem('appointments[]', (int) $app_id, $app->getTitle());
1112  }
1113 
1114  $tpl->setContent($confirmation_gui->getHTML());
1115  }
1116 
1123  protected function deleteAppointments()
1124  {
1125  if (!count($_POST['appointments'])) {
1126  ilUtil::sendFailure($this->lng->txt('select_one'));
1127  $this->details();
1128  return true;
1129  }
1130  include_once('./Services/Calendar/classes/class.ilCalendarEntry.php');
1131  foreach ($_POST['appointments'] as $app_id) {
1132  $app = new ilCalendarEntry($app_id);
1133  $app->delete();
1134 
1135  include_once('./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
1137  }
1138 
1139  ilUtil::sendSuccess($this->lng->txt('settings_saved'));
1140  $this->details();
1141  return true;
1142  }
1143 
1144  public function getHTML()
1145  {
1146  global $ilUser, $ilCtrl;
1147 
1148  include_once("./Services/Calendar/classes/class.ilCalendarSelectionBlockGUI.php");
1149  $block_gui = new ilCalendarSelectionBlockGUI($this->seed, $this->ref_id);
1150  $html = $ilCtrl->getHTML($block_gui);
1151  return $html;
1152  }
1153 
1154 
1160  protected function appendCalendarSelection()
1161  {
1162  global $ilUser;
1163 
1164  $this->lng->loadLanguageModule('pd');
1165 
1166  $tpl = new ilTemplate('tpl.calendar_selection.html', true, true, 'Services/Calendar');
1167  include_once('./Services/Calendar/classes/class.ilCalendarUserSettings.php');
1168  switch (ilCalendarUserSettings::_getInstance()->getCalendarSelectionType()) {
1170  $tpl->setVariable('HTEXT', $this->lng->txt('pd_my_memberships'));
1171  $tpl->touchBlock('head_item');
1172  $tpl->touchBlock('head_delim');
1173  $tpl->touchBlock('head_item');
1174 
1175  $this->ctrl->setParameter($this, 'calendar_mode', ilCalendarUserSettings::CAL_SELECTION_ITEMS);
1176  $this->ctrl->setParameter($this, 'seed', $this->seed->get(IL_CAL_DATE));
1177  $tpl->setVariable('HHREF', $this->ctrl->getLinkTarget($this, 'switchCalendarMode'));
1178  $tpl->setVariable('HLINK', $this->lng->txt('pd_my_offers'));
1179  $tpl->touchBlock('head_item');
1180  break;
1181 
1183  $this->ctrl->setParameter($this, 'calendar_mode', ilCalendarUserSettings::CAL_SELECTION_MEMBERSHIP);
1184  $this->ctrl->setParameter($this, 'seed', $this->seed->get(IL_CAL_DATE));
1185  $tpl->setVariable('HHREF', $this->ctrl->getLinkTarget($this, 'switchCalendarMode'));
1186  $tpl->setVariable('HLINK', $this->lng->txt('pd_my_memberships'));
1187  $tpl->touchBlock('head_item');
1188  $tpl->touchBlock('head_delim');
1189  $tpl->touchBlock('head_item');
1190 
1191  $tpl->setVariable('HTEXT', $this->lng->txt('pd_my_offers'));
1192  $tpl->touchBlock('head_item');
1193  break;
1194 
1195 
1196  }
1197  return $tpl->get();
1198  }
1199 
1204  protected function switchCalendarMode()
1205  {
1206  include_once('./Services/Calendar/classes/class.ilCalendarUserSettings.php');
1207  ilCalendarUserSettings::_getInstance()->setCalendarSelectionType((int) $_GET['calendar_mode']);
1209 
1210  $this->ctrl->returnToParent($this);
1211  }
1212 
1213 
1221  private function readPermissions()
1222  {
1223  global $ilUser,$rbacsystem,$ilAccess;
1224 
1225  $this->editable = false;
1226 
1227  $this->visible = false;
1228  $this->importable = false;
1229 
1230  include_once('./Services/Calendar/classes/class.ilCalendarShared.php');
1231 
1232  $shared = ilCalendarShared::getSharedCalendarsForUser($ilUser->getId());
1233  $cat = new ilCalendarCategory($this->category_id);
1234 
1235  switch ($cat->getType()) {
1237 
1238  if ($cat->getObjId() == $ilUser->getId()) {
1239  $this->visible = true;
1240  $this->editable = true;
1241  $this->importable = true;
1242  } elseif (isset($shared[$cat->getCategoryID()])) {
1243  $this->visible = true;
1244  }
1245  break;
1246 
1248  $this->importable = $this->editable = $rbacsystem->checkAccess('edit_event', ilCalendarSettings::_getInstance()->getCalendarSettingsId());
1249  $this->visible = true;
1250  break;
1251 
1253  $this->editable = false;
1254 
1255  $refs = ilObject::_getAllReferences($cat->getObjId());
1256  foreach ($refs as $ref) {
1257  if ($ilAccess->checkAccess('read', '', $ref)) {
1258  $this->visible = true;
1259  }
1260  if ($ilAccess->checkAccess('edit_event', '', $ref)) {
1261  $this->importable = true;
1262  }
1263  if ($ilAccess->checkAccess('write', '', $ref)) {
1264  $this->editable = true;
1265  }
1266  }
1267  break;
1268 
1271  $this->editable = $ilUser->getId() == $cat->getCategoryID();
1272  $this->visible = true;
1273  $this->importable = false;
1274  break;
1275  }
1276  }
1277 
1283  protected function checkVisible()
1284  {
1285  global $ilErr;
1286 
1287  if (!$this->visible) {
1288  $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->FATAL);
1289  }
1290  }
1291 
1297  private function isEditable()
1298  {
1299  return $this->editable;
1300  }
1301 
1302  protected function isImportable()
1303  {
1304  return $this->importable;
1305  }
1306 
1307 
1313  protected function addReferenceLinks($a_obj_id)
1314  {
1315  global $tree;
1316 
1317  $tpl = new ilTemplate('tpl.cal_reference_links.html', true, true, 'Services/Calendar');
1318 
1319  foreach (ilObject::_getAllReferences($a_obj_id) as $ref_id => $ref_id) {
1320  include_once('./Services/Link/classes/class.ilLink.php');
1321 
1322  $parent_ref_id = $tree->getParentId($ref_id);
1323  $parent_obj_id = ilObject::_lookupObjId($parent_ref_id);
1324  $parent_type = ilObject::_lookupType($parent_obj_id);
1325  $parent_title = ilObject::_lookupTitle($parent_obj_id);
1326 
1327  $type = ilObject::_lookupType($a_obj_id);
1328  $title = ilObject::_lookupTitle($a_obj_id);
1329 
1330  $tpl->setCurrentBlock('reference');
1331  //$tpl->setVariable('PIMG_SRC',ilUtil::getTypeIconPath($parent_type,$parent_obj_id,'tiny'));
1332  //$tpl->setVariable('PIMG_ALT',$this->lng->txt('obj_'.$parent_type));
1333  $tpl->setVariable('PARENT_TITLE', $parent_title);
1334  $tpl->setVariable('PARENT_HREF', ilLink::_getLink($parent_ref_id));
1335 
1336  //$tpl->setVariable('SRC',ilUtil::getTypeIconPath($type,$a_obj_id,'tiny'));
1337  //$tpl->setVariable('ALT',$this->lng->txt('obj_'.$type));
1338  $tpl->setVariable('TITLE', $title);
1339  $tpl->setVariable('HREF', ilLink::_getLink($ref_id));
1340  $tpl->parseCurrentBlock();
1341  }
1342  return $tpl->get();
1343  }
1344 
1351  protected function manage($a_reset_offsets = false)
1352  {
1353  global $lng, $ilCtrl, $tpl;
1354 
1355  $this->addSubTabs("manage");
1356 
1357  include_once('./Services/Calendar/classes/class.ilCalendarManageTableGUI.php');
1358  $table_gui = new ilCalendarManageTableGUI($this);
1359 
1360  if ($a_reset_offsets) {
1361  $table_gui->resetToDefaults();
1362  }
1363 
1364  $table_gui->parse();
1365 
1366  include_once "./Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php";
1367  $toolbar = new ilToolbarGui();
1368  $ilCtrl->setParameter($this, 'backv', self::VIEW_MANAGE);
1369  $toolbar->addButton($lng->txt("cal_add_calendar"), $ilCtrl->getLinkTarget($this, "add"));
1370 
1371  $tpl->setContent($toolbar->getHTML() . $table_gui->getHTML());
1372  }
1373 
1377  protected function importAppointments(ilPropertyFormGUI $form = null)
1378  {
1379  global $ilTabs, $tpl;
1380 
1381  if (!$this->category_id) {
1382  ilUtil::sendFailure($this->lng->txt('select_one'), true);
1383  $this->ctrl->returnToParent($this);
1384  }
1385  if (array_key_exists('backv', $_REQUEST)) {
1386  $this->ctrl->setParameter($this, 'backv', (int) $_REQUEST['backv']);
1387  }
1388 
1389  $this->ctrl->setParameter($this, 'category_id', $this->category_id);
1390 
1391  // Check permissions
1392  $this->readPermissions();
1393  $this->checkVisible();
1394 
1395  if (!$this->isImportable()) {
1396  ilUtil::sendFailure($this->lng->txt('permission_denied'), true);
1397  $this->ctrl->returnToParent($this);
1398  }
1399 
1400  $ilTabs->clearTargets();
1401  $ilTabs->setBackTarget($this->lng->txt("back"), $this->ctrl->getLinkTarget($this, "cancel"));
1402 
1403 
1404  if (!$form instanceof ilPropertyFormGUI) {
1405  $form = $this->initImportForm();
1406  }
1407  $tpl->setContent($form->getHTML());
1408  }
1409 
1413  protected function initImportForm()
1414  {
1415  include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
1416  $form = new ilPropertyFormGUI();
1417  $form->setTitle($this->lng->txt('cal_import_tbl'));
1418  $form->setFormAction($this->ctrl->getFormAction($this));
1419 
1420  $form->addCommandButton('uploadAppointments', $this->lng->txt('import'));
1421 
1422  $ics = new ilFileInputGUI($this->lng->txt('cal_import_file'), 'file');
1423  $ics->setALlowDeletion(false);
1424  $ics->setSuffixes(array('ics'));
1425  $ics->setInfo($this->lng->txt('cal_import_file_info'));
1426  $form->addItem($ics);
1427 
1428  return $form;
1429  }
1430 
1434  protected function uploadAppointments()
1435  {
1436  if ($_REQUEST['backv'] == self::VIEW_MANAGE) {
1437  $back = 'manage';
1438  } else {
1439  $back = 'cancel';
1440  }
1441  $form = $this->initImportForm();
1442  if ($form->checkInput()) {
1443  $file = $form->getInput('file');
1444  $tmp = ilUtil::ilTempnam();
1445 
1446  ilUtil::moveUploadedFile($file['tmp_name'], $file['name'], $tmp);
1447 
1448  $num = $this->doImportFile($tmp, (int) $_REQUEST['category_id']);
1449 
1450  ilUtil::sendSuccess(sprintf($this->lng->txt('cal_imported_success'), (int) $num), true);
1451  $this->ctrl->redirect($this, $back);
1452  }
1453 
1454  ilUtil::sendFailure($this->lng->txt('cal_err_file_upload'), true);
1455  $this->initImportForm($form);
1456  }
1457 
1463  protected function doImportFile($file, $category_id)
1464  {
1465  include_once './Services/Calendar/classes/../classes/iCal/class.ilICalParser.php';
1466  include_once './Services/Calendar/classes/class.ilCalendarCategoryAssignments.php';
1467 
1468  $GLOBALS['ilLog']->write(__METHOD__ . ': Starting ical import...');
1469 
1471 
1473  $parser->setCategoryId($category_id);
1474  $parser->parse();
1475 
1477 
1478  return $assigned_after - $assigned_before;
1479  }
1480 
1487  public function addSubTabs($a_active)
1488  {
1489  $ilTabs = $this->tabs;
1490  $ilCtrl = $this->ctrl;
1491  $lng = $this->lng;
1492 
1493  $ilTabs->addSubTab(
1494  "manage",
1495  $lng->txt("calendar"),
1496  $ilCtrl->getLinkTarget($this, "manage")
1497  );
1498 
1499  $status = new ilCalendarSharedStatus($this->user_id);
1500  $calendars = $status->getOpenInvitations();
1501 
1502  //if (count($calendars) > 0)
1503  //{
1504  $ilTabs->addSubTab(
1505  "invitations",
1506  $lng->txt("cal_shared_calendars"),
1507  $ilCtrl->getLinkTarget($this, "invitations")
1508  );
1509  //}
1510 
1511  $ilTabs->activateSubTab($a_active);
1512  }
1513 
1520  public function invitations()
1521  {
1522  $this->addSubTabs("invitations");
1523 
1524  // shared calendar invitations: @todo needs to be moved
1525  include_once('./Services/Calendar/classes/class.ilCalendarInboxSharedTableGUI.php');
1526  include_once('./Services/Calendar/classes/class.ilCalendarShared.php');
1527 
1528  $table = new ilCalendarInboxSharedTableGUI($this, 'inbox');
1530 
1531  //if($table->parse())
1532  //{
1533  $this->tpl->setContent($table->getHTML());
1534  //}
1535  }
1536 
1543  protected function acceptShared()
1544  {
1545  global $ilUser;
1546 
1547  if (!$_POST['cal_ids'] or !is_array($_POST['cal_ids'])) {
1548  ilUtil::sendFailure($this->lng->txt('select_one'));
1549  $this->inbox();
1550  return false;
1551  }
1552 
1553  include_once('./Services/Calendar/classes/class.ilCalendarSharedStatus.php');
1554  $status = new ilCalendarSharedStatus($ilUser->getId());
1555 
1556  include_once('./Services/Calendar/classes/class.ilCalendarShared.php');
1557  foreach ($_POST['cal_ids'] as $calendar_id) {
1558  if (!ilCalendarShared::isSharedWithUser($ilUser->getId(), $calendar_id)) {
1559  ilUtil::sendFailure($this->lng->txt('permission_denied'));
1560  $this->inbox();
1561  return false;
1562  }
1563  $status->accept($calendar_id);
1564  }
1565 
1566  ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
1567 
1568  $this->ctrl->redirect($this, 'invitations');
1569  }
1570 
1577  protected function declineShared()
1578  {
1579  global $ilUser;
1580 
1581  if (!$_POST['cal_ids'] or !is_array($_POST['cal_ids'])) {
1582  ilUtil::sendFailure($this->lng->txt('select_one'));
1583  $this->inbox();
1584  return false;
1585  }
1586 
1587  include_once('./Services/Calendar/classes/class.ilCalendarSharedStatus.php');
1588  $status = new ilCalendarSharedStatus($ilUser->getId());
1589 
1590  include_once('./Services/Calendar/classes/class.ilCalendarShared.php');
1591  foreach ($_POST['cal_ids'] as $calendar_id) {
1592  if (!ilCalendarShared::isSharedWithUser($ilUser->getId(), $calendar_id)) {
1593  ilUtil::sendFailure($this->lng->txt('permission_denied'));
1594  $this->inbox();
1595  return false;
1596  }
1597  $status->decline($calendar_id);
1598  }
1599 
1600  ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
1601 
1602  $this->ctrl->redirect($this, 'invitations');
1603  }
1604 }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
global $ilErr
Definition: raiseError.php:16
This class represents an option in a radio group.
initImportForm()
Create import form.
Model for a calendar entry.
static _getInstance()
get singleton instance
Class ilInfoScreenGUI.
initFormCategory($a_mode)
init edit/create category form
sharePerformSearch()
share perform search
$_SESSION["AccountId"]
This class represents a selection list property in a property form.
This class represents a property form user interface.
$type
global $DIC
Definition: saml.php:7
static getSharedCalendarsForUser($a_usr_id=0)
get shared calendars of user
$_GET["client_id"]
$location
Definition: buildRTE.php:44
addReferenceLinks($a_obj_id)
Show links to references.
setALlowDeletion($a_val)
Set allow deletion.
unshare()
Stop calendar sharing.
This class represents a file property in a property form.
Stores status (accepted/declined) of shared calendars.
acceptShared()
accept shared calendar
shareAssignRoles($a_editable=false)
share assign roles
Color picker form for selecting color hexcodes using yui library.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
saveSelection()
save selection of categories
static getInstance()
Get instance.
static lookupNumberOfAssignedAppointments($a_cat_ids)
Get number of assigned appoitments.
show list of alle calendars to manage
static _lookupTitle($a_id)
lookup object title
isEditable()
check if calendar is editable private
declineShared()
accept shared calendar
Stores calendar categories.
Reader for remote ical calendars.
showUserList($a_ids=array())
show user list
BlockGUI class calendar selection.
Handles shared calendars.
switchCalendarMode()
Switch calendar selection nmode.
__construct($a_user_id, $seed, $a_ref_id=0)
Constructor.
user()
Definition: user.php:4
static _getAllReferences($a_id)
get all reference ids of object
const QP_COMBINATION_OR
doSynchronisation(ilCalendarCategory $category)
Sync calendar.
global $ilCtrl
Definition: ilias.php:18
static _getInstanceByUserId($a_user_id, $a_ref_id=0)
get instance by user id
importAppointments(ilPropertyFormGUI $form=null)
import appointments
deleteAppointments()
delete appointments
static _getUserSearchInstance($query_parser)
get reference of ilLikeUserSearch
showAssignedAppointments()
show assigned aapointments
This class represents a property in a property form.
Show shared calendars for a specific user.
foreach($_POST as $key=> $value) $res
if(isset($_POST['submit'])) $form
setValue($a_value)
Set Value.
static _getInstance()
get instance for logged in user
static _lookupObjId($a_id)
special template class to simplify handling of ITX/PEAR
This class represents a text property in a property form.
shareAssign($a_editable=false)
share assign
This class represents a password property in a property form.
$ilUser
Definition: imgupload.php:18
shareAssignRolesEditable()
Share editable.
$query
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static getNamePresentation( $a_user_id, $a_user_image=false, $a_profile_link=false, $a_profile_back_link="", $a_force_first_lastname=false, $a_omit_login=false, $a_sortable=true, $a_return_data_array=false, $a_ctrl_path="ilpublicuserprofilegui")
Default behaviour is:
getSearchToolbar()
Get search toolbar.
static _deleteByAppointmentId($a_app_id)
Delete appointment assignment.
static _getInstance($a_usr_id=0)
get singleton instance
askDeleteAppointments()
ask delete appointments
Create styles array
The data for the language used.
static _lookupType($a_id, $a_reference=false)
lookup object type
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
add(ilPropertyFormGUI $form=null)
add new calendar
static _getAssignedAppointments($a_cat_id)
Get assigned apointments.
static ilTempnam($a_temp_path=null)
Create a temporary file in an ILIAS writable directory.
doImportFile($file, $category_id)
Import ics.
const IL_CAL_DATE
shareAssignEditable()
Share with write access.
$parser
Definition: BPMN2Parser.php:23
This class represents a non editable value in a property form.
Administrate calendar appointments.
global $ilSetting
Definition: privfeed.php:17
$url
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
if(empty($password)) $table
Definition: pwgen.php:24
addSubTabs($a_active)
Add subtabs.
showRoleList($a_ids=array())
show role list
$info
Definition: index.php:5
setValue($a_value)
Set Value.
edit(ilPropertyFormGUI $form=null)
edit category
details()
show calendar details
setDisabled($a_disabled)
Set Disabled.
$_POST["username"]
$html
Definition: example_001.php:87
static isSharedWithUser($a_usr_id, $a_calendar_id)
is shared with user
manage($a_reset_offsets=false)
Manage calendars type $lng type $ilCtrl type $tpl.
shareDeassign()
desassign users/roles from calendar
if(!isset($_REQUEST['ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
Definition: as_login.php:20
Administration, Side-Block presentation of calendar categories.
Confirmation screen class.
uploadAppointments()
Upload appointments.