ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilCalendarCategoryGUI Class Reference

Administration, Side-Block presentation of calendar categories. More...

+ Collaboration diagram for ilCalendarCategoryGUI:

Public Member Functions

 __construct ($a_user_id, $seed, $a_ref_id=0)
 Constructor. More...
 
 executeCommand ()
 Execute command. More...
 
 saveSelection ()
 save selection of categories More...
 
 shareSearch ()
 share calendar More...
 
 sharePerformSearch ()
 share perform search More...
 
 shareAssignEditable ()
 Share with write access. More...
 
 shareAssign ($a_editable=false)
 share assign More...
 
 shareAssignRoles ($a_editable=false)
 share assign roles More...
 
 shareDeassign ()
 desassign users/roles from calendar More...
 
 getSearchToolbar ()
 Get search toolbar. More...
 
 getHTML ()
 
 addSubTabs ($a_active)
 Add subtabs. More...
 
 invitations ()
 Invitations. More...
 

Data Fields

const SEARCH_USER = 1
 
const SEARCH_ROLE = 2
 
const VIEW_MANAGE = 1
 

Protected Member Functions

 cancel ()
 cancel More...
 
 add (ilPropertyFormGUI $form=null)
 add new calendar More...
 
 save ()
 save new calendar More...
 
 edit (ilPropertyFormGUI $form=null)
 edit category More...
 
 details ()
 show calendar details More...
 
 synchroniseCalendar ()
 
 doSynchronisation (ilCalendarCategory $category)
 Sync calendar. More...
 
 update ()
 update More...
 
 confirmDelete ()
 confirm delete More...
 
 delete ()
 Delete. More...
 
 shareAssignRolesEditable ()
 Share editable. More...
 
 showUserList ($a_ids=array())
 show user list More...
 
 showRoleList ($a_ids=array())
 show role list More...
 
 initFormCategory ($a_mode)
 init edit/create category form More...
 
 unshare ()
 Stop calendar sharing. More...
 
 showAssignedAppointments ()
 show assigned aapointments More...
 
 askDeleteAppointments ()
 ask delete appointments More...
 
 deleteAppointments ()
 delete appointments More...
 
 appendCalendarSelection ()
 
 switchCalendarMode ()
 Switch calendar selection nmode. More...
 
 checkVisible ()
 
 isImportable ()
 
 addReferenceLinks ($a_obj_id)
 Show links to references. More...
 
 manage ($a_reset_offsets=false)
 Manage calendars @global type $lng @global type $ilCtrl @global type $tpl. More...
 
 importAppointments (ilPropertyFormGUI $form=null)
 import appointments More...
 
 initImportForm ()
 Create import form. More...
 
 uploadAppointments ()
 Upload appointments. More...
 
 doImportFile ($file, $category_id)
 Import ics. More...
 
 acceptShared ()
 accept shared calendar More...
 
 declineShared ()
 accept shared calendar More...
 

Protected Attributes

 $user_id
 
 $ctrl
 
 $lng
 
 $tabs
 
 $editable = false
 
 $visible = false
 
 $category_id = 0
 
 $tpl
 

Private Member Functions

 readPermissions ()
 read permissions More...
 
 isEditable ()
 check if calendar is editable @access private More...
 

Detailed Description

Administration, Side-Block presentation of calendar categories.

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

@ilCtrl_Calls ilCalendarCategoryGUI: ilCalendarAppointmentGUI, ilCalendarSelectionBlockGUI

Definition at line 35 of file class.ilCalendarCategoryGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilCalendarCategoryGUI::__construct (   $a_user_id,
  $seed,
  $a_ref_id = 0 
)

Constructor.

@access public

Parameters
int$a_user_iduser id
int$seedseed
int$a_ref_idcontainer ref id

Definition at line 80 of file class.ilCalendarCategoryGUI.php.

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 }
$_GET["client_id"]
static getInstance()
Get instance.
static _lookupObjId($a_id)
global $DIC
Definition: saml.php:7

References $_GET, $DIC, ilObject\_lookupObjId(), and ilCalendarActions\getInstance().

+ Here is the call graph for this function:

Member Function Documentation

◆ acceptShared()

ilCalendarCategoryGUI::acceptShared ( )
protected

accept shared calendar

@access protected

Returns

Definition at line 1543 of file class.ilCalendarCategoryGUI.php.

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 }
$_POST["username"]
Stores status (accepted/declined) of shared calendars.
static isSharedWithUser($a_usr_id, $a_calendar_id)
is shared with user
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$ilUser
Definition: imgupload.php:18

References $_POST, $ilUser, ilCalendarShared\isSharedWithUser(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ add()

ilCalendarCategoryGUI::add ( ilPropertyFormGUI  $form = null)
protected

add new calendar

@access protected

Returns

Definition at line 165 of file class.ilCalendarCategoryGUI.php.

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 }
initFormCategory($a_mode)
init edit/create category form
This class represents a property form user interface.
special template class to simplify handling of ITX/PEAR
if(isset($_POST['submit'])) $form

References $form, $tpl, and initFormCategory().

Referenced by save().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addReferenceLinks()

ilCalendarCategoryGUI::addReferenceLinks (   $a_obj_id)
protected

Show links to references.

Parameters
int$a_obj_id$obj_id
Returns

Definition at line 1313 of file class.ilCalendarCategoryGUI.php.

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 }
static _lookupTitle($a_id)
lookup object title
static _getAllReferences($a_id)
get all reference ids of object
static _lookupType($a_id, $a_reference=false)
lookup object type
$type

References $title, $tpl, $type, ilObject\_getAllReferences(), ilLink\_getLink(), ilObject\_lookupObjId(), ilObject\_lookupTitle(), and ilObject\_lookupType().

Referenced by initFormCategory().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addSubTabs()

ilCalendarCategoryGUI::addSubTabs (   $a_active)

Add subtabs.

Parameters

return

Definition at line 1487 of file class.ilCalendarCategoryGUI.php.

1488 {
1489 $ilTabs = $this->tabs;
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 }
global $ilCtrl
Definition: ilias.php:18

References $ctrl, $ilCtrl, $lng, and $tabs.

Referenced by invitations(), and manage().

+ Here is the caller graph for this function:

◆ appendCalendarSelection()

ilCalendarCategoryGUI::appendCalendarSelection ( )
protected
Parameters

return

Definition at line 1160 of file class.ilCalendarCategoryGUI.php.

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 }
const IL_CAL_DATE
static _getInstance()
get instance for logged in user

References $ilUser, $tpl, ilCalendarUserSettings\_getInstance(), ilCalendarUserSettings\CAL_SELECTION_ITEMS, ilCalendarUserSettings\CAL_SELECTION_MEMBERSHIP, and IL_CAL_DATE.

+ Here is the call graph for this function:

◆ askDeleteAppointments()

ilCalendarCategoryGUI::askDeleteAppointments ( )
protected

ask delete appointments

@access protected

Returns

Definition at line 1089 of file class.ilCalendarCategoryGUI.php.

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 }
Model for a calendar entry.
Confirmation screen class.

References $_POST, $tpl, details(), and ilUtil\sendFailure().

+ Here is the call graph for this function:

◆ cancel()

ilCalendarCategoryGUI::cancel ( )
protected

cancel

@access protected

Returns

Definition at line 153 of file class.ilCalendarCategoryGUI.php.

154 {
155 $this->ctrl->returnToParent($this);
156 }

◆ checkVisible()

ilCalendarCategoryGUI::checkVisible ( )
protected
Parameters

return

Definition at line 1283 of file class.ilCalendarCategoryGUI.php.

1284 {
1285 global $ilErr;
1286
1287 if (!$this->visible) {
1288 $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->FATAL);
1289 }
1290 }
global $ilErr
Definition: raiseError.php:16

References $ilErr.

Referenced by details(), importAppointments(), and unshare().

+ Here is the caller graph for this function:

◆ confirmDelete()

ilCalendarCategoryGUI::confirmDelete ( )
protected

confirm delete

@access protected

Returns

Definition at line 374 of file class.ilCalendarCategoryGUI.php.

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 }
manage($a_reset_offsets=false)
Manage calendars @global type $lng @global type $ilCtrl @global type $tpl.
Stores calendar categories.

References $_GET, $_POST, $tpl, manage(), and ilUtil\sendFailure().

+ Here is the call graph for this function:

◆ declineShared()

ilCalendarCategoryGUI::declineShared ( )
protected

accept shared calendar

@access protected

Returns

Definition at line 1577 of file class.ilCalendarCategoryGUI.php.

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 }

References $_POST, $ilUser, ilCalendarShared\isSharedWithUser(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ delete()

ilCalendarCategoryGUI::delete ( )
protected

Delete.

@access protected

Parameters

return

Definition at line 421 of file class.ilCalendarCategoryGUI.php.

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 }

References $_POST, $ilCtrl, manage(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ deleteAppointments()

ilCalendarCategoryGUI::deleteAppointments ( )
protected

delete appointments

@access protected

Returns

Definition at line 1123 of file class.ilCalendarCategoryGUI.php.

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 }
static _deleteByAppointmentId($a_app_id)
Delete appointment assignment.

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

+ Here is the call graph for this function:

◆ details()

ilCalendarCategoryGUI::details ( )
protected

show calendar details

@access protected

Definition at line 273 of file class.ilCalendarCategoryGUI.php.

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 }
Class ilInfoScreenGUI.
$info
Definition: index.php:5

References $info, $tpl, checkVisible(), readPermissions(), and ilUtil\sendFailure().

Referenced by askDeleteAppointments(), and deleteAppointments().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ doImportFile()

ilCalendarCategoryGUI::doImportFile (   $file,
  $category_id 
)
protected

Import ics.

Parameters
type$file
type$category_id

Definition at line 1463 of file class.ilCalendarCategoryGUI.php.

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 }
$parser
Definition: BPMN2Parser.php:23
static lookupNumberOfAssignedAppointments($a_cat_ids)
Get number of assigned appoitments.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file

References $category_id, $file, $GLOBALS, $parser, ilICalParser\INPUT_FILE, and ilCalendarCategoryAssignments\lookupNumberOfAssignedAppointments().

Referenced by uploadAppointments().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ doSynchronisation()

ilCalendarCategoryGUI::doSynchronisation ( ilCalendarCategory  $category)
protected

Sync calendar.

Parameters
ilCalendarCategory$cat

Definition at line 318 of file class.ilCalendarCategoryGUI.php.

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 }
Reader for remote ical calendars.

References ilCalendarCategory\getRemotePass(), ilCalendarCategory\getRemoteUrl(), and ilCalendarCategory\getRemoteUser().

Referenced by save(), and synchroniseCalendar().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ edit()

ilCalendarCategoryGUI::edit ( ilPropertyFormGUI  $form = null)
protected

edit category

@access protected

Definition at line 242 of file class.ilCalendarCategoryGUI.php.

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 }

References $DIC, $form, $tabs, $tpl, initFormCategory(), readPermissions(), and ilUtil\sendFailure().

Referenced by update().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilCalendarCategoryGUI::executeCommand ( )

Execute command.

@access public

Parameters

Definition at line 121 of file class.ilCalendarCategoryGUI.php.

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 }
Administrate calendar appointments.
global $ilSetting
Definition: privfeed.php:17

References $_GET, $ilSetting, $ilUser, $tpl, and IL_CAL_DATE.

◆ getHTML()

ilCalendarCategoryGUI::getHTML ( )

Definition at line 1144 of file class.ilCalendarCategoryGUI.php.

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 }
BlockGUI class calendar selection.
$html
Definition: example_001.php:87

References $html, $ilCtrl, and $ilUser.

◆ getSearchToolbar()

ilCalendarCategoryGUI::getSearchToolbar ( )

Get search toolbar.

Parameters

Definition at line 848 of file class.ilCalendarCategoryGUI.php.

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 }
if(!isset( $_REQUEST[ 'ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
Definition: as_login.php:20
This class represents a selection list property in a property form.
This class represents a text property in a property form.

References $_POST, $DIC, $lng, $options, and $si.

Referenced by sharePerformSearch(), and shareSearch().

+ Here is the caller graph for this function:

◆ importAppointments()

ilCalendarCategoryGUI::importAppointments ( ilPropertyFormGUI  $form = null)
protected

import appointments

Definition at line 1377 of file class.ilCalendarCategoryGUI.php.

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 }

References $form, $tpl, checkVisible(), initImportForm(), isImportable(), readPermissions(), and ilUtil\sendFailure().

+ Here is the call graph for this function:

◆ initFormCategory()

ilCalendarCategoryGUI::initFormCategory (   $a_mode)
protected

init edit/create category form

@access protected

Returns

Definition at line 890 of file class.ilCalendarCategoryGUI.php.

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 }
$location
Definition: buildRTE.php:44
static _getInstance($a_usr_id=0)
get singleton instance
isEditable()
check if calendar is editable @access private
addReferenceLinks($a_obj_id)
Show links to references.
static _getInstance()
get singleton instance
Color picker form for selecting color hexcodes using yui library.
This class represents a non editable value in a property form.
This class represents a password property in a property form.
This class represents a property in a property form.
This class represents an option in a radio group.
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:
$url

References $form, $ilUser, $location, $pass, $title, $type, $url, ilCalendarCategories\_getInstance(), ilCalendarSettings\_getInstance(), addReferenceLinks(), ilUserUtil\getNamePresentation(), isEditable(), ilCalendarCategory\LTYPE_LOCAL, ilCalendarCategory\LTYPE_REMOTE, ilCalendarCategory\TYPE_GLOBAL, ilCalendarCategory\TYPE_OBJ, and ilCalendarCategory\TYPE_USR.

Referenced by add(), edit(), save(), and update().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initImportForm()

ilCalendarCategoryGUI::initImportForm ( )
protected

Create import form.

Definition at line 1413 of file class.ilCalendarCategoryGUI.php.

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 }
This class represents a file property in a property form.

References $form.

Referenced by importAppointments(), and uploadAppointments().

+ Here is the caller graph for this function:

◆ invitations()

ilCalendarCategoryGUI::invitations ( )

Invitations.

Parameters

return

Definition at line 1520 of file class.ilCalendarCategoryGUI.php.

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 }
Show shared calendars for a specific user.
static getSharedCalendarsForUser($a_usr_id=0)
get shared calendars of user
if(empty($password)) $table
Definition: pwgen.php:24

References $table, addSubTabs(), and ilCalendarShared\getSharedCalendarsForUser().

+ Here is the call graph for this function:

◆ isEditable()

ilCalendarCategoryGUI::isEditable ( )
private

check if calendar is editable @access private

Returns

Definition at line 1297 of file class.ilCalendarCategoryGUI.php.

References $editable.

Referenced by initFormCategory(), shareAssign(), shareAssignRoles(), shareDeassign(), shareSearch(), and update().

+ Here is the caller graph for this function:

◆ isImportable()

ilCalendarCategoryGUI::isImportable ( )
protected

Definition at line 1302 of file class.ilCalendarCategoryGUI.php.

1303 {
1304 return $this->importable;
1305 }

Referenced by importAppointments().

+ Here is the caller graph for this function:

◆ manage()

ilCalendarCategoryGUI::manage (   $a_reset_offsets = false)
protected

Manage calendars @global type $lng @global type $ilCtrl @global type $tpl.

Definition at line 1351 of file class.ilCalendarCategoryGUI.php.

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 }
show list of alle calendars to manage

References $ilCtrl, $lng, $tpl, and addSubTabs().

Referenced by confirmDelete(), delete(), and shareSearch().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readPermissions()

ilCalendarCategoryGUI::readPermissions ( )
private

read permissions

@access private

Parameters

return

Definition at line 1221 of file class.ilCalendarCategoryGUI.php.

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
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 }

References $ilUser, ilObject\_getAllReferences(), ilCalendarSettings\_getInstance(), ilCalendarShared\getSharedCalendarsForUser(), ilCalendarCategory\TYPE_BOOK, ilCalendarCategory\TYPE_CH, ilCalendarCategory\TYPE_GLOBAL, ilCalendarCategory\TYPE_OBJ, and ilCalendarCategory\TYPE_USR.

Referenced by details(), edit(), importAppointments(), shareAssign(), shareAssignRoles(), shareDeassign(), shareSearch(), unshare(), and update().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ save()

ilCalendarCategoryGUI::save ( )
protected

save new calendar

@access protected

Definition at line 193 of file class.ilCalendarCategoryGUI.php.

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 }
user()
Definition: user.php:4
add(ilPropertyFormGUI $form=null)
add new calendar
doSynchronisation(ilCalendarCategory $category)
Sync calendar.

References $form, $GLOBALS, add(), doSynchronisation(), initFormCategory(), ilCalendarCategory\LTYPE_REMOTE, ilUtil\sendFailure(), ilUtil\sendSuccess(), ilCalendarCategory\TYPE_GLOBAL, ilCalendarCategory\TYPE_USR, and user().

+ Here is the call graph for this function:

◆ saveSelection()

ilCalendarCategoryGUI::saveSelection ( )

save selection of categories

@access public

Parameters

return

Definition at line 459 of file class.ilCalendarCategoryGUI.php.

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
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 }
static _getInstanceByUserId($a_user_id, $a_ref_id=0)
get instance by user id

References $_POST, $ilUser, ilCalendarCategories\_getInstance(), ilCalendarVisibility\_getInstanceByUserId(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ shareAssign()

ilCalendarCategoryGUI::shareAssign (   $a_editable = false)

share assign

@access public

Returns

Definition at line 674 of file class.ilCalendarCategoryGUI.php.

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 }
sharePerformSearch()
share perform search
Handles shared calendars.

References $_POST, $ilUser, $user_id, isEditable(), readPermissions(), ilUtil\sendFailure(), ilUtil\sendSuccess(), sharePerformSearch(), shareSearch(), and ilCalendarShared\TYPE_USR.

Referenced by shareAssignEditable().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ shareAssignEditable()

ilCalendarCategoryGUI::shareAssignEditable ( )

Share with write access.

Definition at line 663 of file class.ilCalendarCategoryGUI.php.

664 {
665 return $this->shareAssign(true);
666 }
shareAssign($a_editable=false)
share assign

References shareAssign().

+ Here is the call graph for this function:

◆ shareAssignRoles()

ilCalendarCategoryGUI::shareAssignRoles (   $a_editable = false)

share assign roles

@access public

Parameters

return

Definition at line 723 of file class.ilCalendarCategoryGUI.php.

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 }

References $_POST, $ilUser, isEditable(), readPermissions(), ilUtil\sendFailure(), ilUtil\sendSuccess(), sharePerformSearch(), shareSearch(), and ilCalendarShared\TYPE_ROLE.

Referenced by shareAssignRolesEditable().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ shareAssignRolesEditable()

ilCalendarCategoryGUI::shareAssignRolesEditable ( )
protected

Share editable.

Definition at line 711 of file class.ilCalendarCategoryGUI.php.

712 {
713 return $this->shareAssignRoles(true);
714 }
shareAssignRoles($a_editable=false)
share assign roles

References shareAssignRoles().

+ Here is the call graph for this function:

◆ shareDeassign()

ilCalendarCategoryGUI::shareDeassign ( )

desassign users/roles from calendar

@access public

Parameters

return

Definition at line 761 of file class.ilCalendarCategoryGUI.php.

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 }

References $_POST, isEditable(), readPermissions(), ilUtil\sendFailure(), ilUtil\sendSuccess(), and shareSearch().

+ Here is the call graph for this function:

◆ sharePerformSearch()

ilCalendarCategoryGUI::sharePerformSearch ( )

share perform search

@access public

Returns

Definition at line 565 of file class.ilCalendarCategoryGUI.php.

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) {
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
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) {
651 $this->showUserList($res_sum->getResultIds());
652 break;
653
655 $this->showRoleList($res_sum->getResultIds());
656 break;
657 }
658 }
$_SESSION["AccountId"]
const QP_COMBINATION_OR
showUserList($a_ids=array())
show user list
getSearchToolbar()
Get search toolbar.
showRoleList($a_ids=array())
show role list
static _getUserSearchInstance($query_parser)
get reference of ilLikeUserSearch
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
$query
foreach($_POST as $key=> $value) $res

References $_POST, $_SESSION, $DIC, $query, $res, $tabs, $type, ilObjectSearchFactory\_getUserSearchInstance(), getSearchToolbar(), QP_COMBINATION_OR, SEARCH_ROLE, SEARCH_USER, ilUtil\sendFailure(), shareSearch(), showRoleList(), showUserList(), and ilUtil\stripSlashes().

Referenced by shareAssign(), and shareAssignRoles().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ shareSearch()

ilCalendarCategoryGUI::shareSearch ( )

share calendar

@access public

Parameters

return

Definition at line 525 of file class.ilCalendarCategoryGUI.php.

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 }

References $_SESSION, $DIC, $table, $tabs, $tpl, getSearchToolbar(), isEditable(), manage(), readPermissions(), and ilUtil\sendFailure().

Referenced by shareAssign(), shareAssignRoles(), shareDeassign(), and sharePerformSearch().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showAssignedAppointments()

ilCalendarCategoryGUI::showAssignedAppointments ( )
protected

show assigned aapointments

@access protected

Returns

Definition at line 1067 of file class.ilCalendarCategoryGUI.php.

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 }
static _getAssignedAppointments($a_cat_id)
Get assigned apointments.

References ilCalendarCategoryAssignments\_getAssignedAppointments(), and ilCalendarCategories\_getInstance().

+ Here is the call graph for this function:

◆ showRoleList()

ilCalendarCategoryGUI::showRoleList (   $a_ids = array())
protected

show role list

@access protected

Parameters
arrayarray of role ids
Returns

Definition at line 825 of file class.ilCalendarCategoryGUI.php.

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 }

References $table, and $tpl.

Referenced by sharePerformSearch().

+ Here is the caller graph for this function:

◆ showUserList()

ilCalendarCategoryGUI::showUserList (   $a_ids = array())
protected

show user list

@access protected

Parameters
arrayarray of user ids
Returns

Definition at line 800 of file class.ilCalendarCategoryGUI.php.

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 }

References $table, and $tpl.

Referenced by sharePerformSearch().

+ Here is the caller graph for this function:

◆ switchCalendarMode()

ilCalendarCategoryGUI::switchCalendarMode ( )
protected

Switch calendar selection nmode.

Returns

Definition at line 1204 of file class.ilCalendarCategoryGUI.php.

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 }

References $_GET, and ilCalendarUserSettings\_getInstance().

+ Here is the call graph for this function:

◆ synchroniseCalendar()

ilCalendarCategoryGUI::synchroniseCalendar ( )
protected

Definition at line 295 of file class.ilCalendarCategoryGUI.php.

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 }

References doSynchronisation(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ unshare()

ilCalendarCategoryGUI::unshare ( )
protected

Stop calendar sharing.

Definition at line 1034 of file class.ilCalendarCategoryGUI.php.

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 }

References $ilUser, checkVisible(), ilCalendarShared\isSharedWithUser(), readPermissions(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ update()

ilCalendarCategoryGUI::update ( )
protected

update

@access protected

Returns

Definition at line 334 of file class.ilCalendarCategoryGUI.php.

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 }
edit(ilPropertyFormGUI $form=null)
edit category

References $form, edit(), initFormCategory(), isEditable(), readPermissions(), ilUtil\sendFailure(), ilUtil\sendSuccess(), and ilCalendarCategory\TYPE_OBJ.

+ Here is the call graph for this function:

◆ uploadAppointments()

ilCalendarCategoryGUI::uploadAppointments ( )
protected

Upload appointments.

Definition at line 1434 of file class.ilCalendarCategoryGUI.php.

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 }
sprintf('%.4f', $callTime)
doImportFile($file, $category_id)
Import ics.
static ilTempnam($a_temp_path=null)
Create a temporary file in an ILIAS writable directory.

References $file, $form, doImportFile(), ilUtil\ilTempnam(), initImportForm(), ilUtil\sendFailure(), ilUtil\sendSuccess(), and sprintf.

+ Here is the call graph for this function:

Field Documentation

◆ $category_id

ilCalendarCategoryGUI::$category_id = 0
protected

Definition at line 65 of file class.ilCalendarCategoryGUI.php.

Referenced by doImportFile().

◆ $ctrl

ilCalendarCategoryGUI::$ctrl
protected

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

Referenced by addSubTabs().

◆ $editable

ilCalendarCategoryGUI::$editable = false
protected

Definition at line 59 of file class.ilCalendarCategoryGUI.php.

Referenced by isEditable().

◆ $lng

ilCalendarCategoryGUI::$lng
protected

Definition at line 52 of file class.ilCalendarCategoryGUI.php.

Referenced by addSubTabs(), getSearchToolbar(), and manage().

◆ $tabs

ilCalendarCategoryGUI::$tabs
protected

Definition at line 57 of file class.ilCalendarCategoryGUI.php.

Referenced by addSubTabs(), edit(), sharePerformSearch(), and shareSearch().

◆ $tpl

◆ $user_id

ilCalendarCategoryGUI::$user_id
protected

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

Referenced by shareAssign().

◆ $visible

ilCalendarCategoryGUI::$visible = false
protected

Definition at line 60 of file class.ilCalendarCategoryGUI.php.

◆ SEARCH_ROLE

const ilCalendarCategoryGUI::SEARCH_ROLE = 2

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

Referenced by sharePerformSearch().

◆ SEARCH_USER

const ilCalendarCategoryGUI::SEARCH_USER = 1

Definition at line 37 of file class.ilCalendarCategoryGUI.php.

Referenced by sharePerformSearch().

◆ VIEW_MANAGE

const ilCalendarCategoryGUI::VIEW_MANAGE = 1

Definition at line 40 of file class.ilCalendarCategoryGUI.php.

Referenced by ilCalendarManageTableGUI\fillRow().


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