ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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->lng->loadLanguageModule('dash');
89 $this->ctrl = $DIC->ctrl();
90 $this->ref_id = $a_ref_id;
91 $this->obj_id = ilObject::_lookupObjId($a_ref_id);
92 $this->tabs = $DIC->tabs();
93 $this->tpl = $DIC->ui()->mainTemplate();
94
95 $this->lng->loadLanguageModule("dateplaner");
96
97 if (in_array($this->ctrl->getNextClass(), array("", "ilcalendarcategorygui")) && $this->ctrl->getCmd() == "manage") {
98 if ($a_ref_id > 0) { // no manage screen in repository
99 $this->ctrl->returnToParent($this);
100 }
101 if ((int) $_GET['category_id'] > 0) {
102 // reset category id on manage screen (redirect needed to initialize categories correctly)
103 $this->ctrl->setParameter($this, "category_id", "");
104 $this->ctrl->setParameterByClass("ilcalendarpresentationgui", "category_id", "");
105 $this->ctrl->redirect($this, "manage");
106 }
107 }
108
109 $this->category_id = (int) $_GET['category_id'];
110
111 include_once("./Services/Calendar/classes/class.ilCalendarActions.php");
112 $this->actions = ilCalendarActions::getInstance();
113 }
$_GET["client_id"]
static getInstance()
Get instance.
static _lookupObjId($a_id)
$DIC
Definition: xapitoken.php:46

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 1585 of file class.ilCalendarCategoryGUI.php.

1586 {
1587 global $DIC;
1588
1589 $ilUser = $DIC['ilUser'];
1590
1591 if (!$_POST['cal_ids'] or !is_array($_POST['cal_ids'])) {
1592 ilUtil::sendFailure($this->lng->txt('select_one'));
1593 $this->inbox();
1594 return false;
1595 }
1596
1597 include_once('./Services/Calendar/classes/class.ilCalendarSharedStatus.php');
1598 $status = new ilCalendarSharedStatus($ilUser->getId());
1599
1600 include_once('./Services/Calendar/classes/class.ilCalendarShared.php');
1601 foreach ($_POST['cal_ids'] as $calendar_id) {
1602 if (!ilCalendarShared::isSharedWithUser($ilUser->getId(), $calendar_id)) {
1603 ilUtil::sendFailure($this->lng->txt('permission_denied'));
1604 $this->inbox();
1605 return false;
1606 }
1607 $status->accept($calendar_id);
1608 }
1609
1610 ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
1611
1612 $this->ctrl->redirect($this, 'invitations');
1613 }
$_POST["username"]
Stores status (accepted/declined) of shared calendars.
static isSharedWithUser($a_usr_id, $a_calendar_id)
is shared with user
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$ilUser
Definition: imgupload.php:18

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

+ Here is the call graph for this function:

◆ add()

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

add new calendar

@access protected

Returns

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

181 {
182 global $DIC;
183
184 $tpl = $DIC['tpl'];
185 $ilTabs = $DIC['ilTabs'];
186
187 $ilTabs->clearTargets();
188 $ilTabs->setBackTarget($this->lng->txt("cal_back_to_list"), $this->ctrl->getLinkTarget($this, 'cancel'));
189
190 $ed_tpl = new ilTemplate('tpl.edit_category.html', true, true, 'Services/Calendar');
191
192 if (!$form instanceof ilPropertyFormGUI) {
193 $form = $this->initFormCategory('create');
194 }
195 $ed_tpl->setVariable('EDIT_CAT', $form->getHTML());
196 $tpl->setContent($ed_tpl->get());
197 }
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

References $DIC, $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 1357 of file class.ilCalendarCategoryGUI.php.

1358 {
1359 global $DIC;
1360
1361 $tree = $DIC['tree'];
1362
1363 $tpl = new ilTemplate('tpl.cal_reference_links.html', true, true, 'Services/Calendar');
1364
1365 foreach (ilObject::_getAllReferences($a_obj_id) as $ref_id => $ref_id) {
1366 include_once('./Services/Link/classes/class.ilLink.php');
1367
1368 $parent_ref_id = $tree->getParentId($ref_id);
1369 $parent_obj_id = ilObject::_lookupObjId($parent_ref_id);
1370 $parent_type = ilObject::_lookupType($parent_obj_id);
1371 $parent_title = ilObject::_lookupTitle($parent_obj_id);
1372
1373 $type = ilObject::_lookupType($a_obj_id);
1374 $title = ilObject::_lookupTitle($a_obj_id);
1375
1376 $tpl->setCurrentBlock('reference');
1377 //$tpl->setVariable('PIMG_SRC',ilUtil::getTypeIconPath($parent_type,$parent_obj_id,'tiny'));
1378 //$tpl->setVariable('PIMG_ALT',$this->lng->txt('obj_'.$parent_type));
1379 $tpl->setVariable('PARENT_TITLE', $parent_title);
1380 $tpl->setVariable('PARENT_HREF', ilLink::_getLink($parent_ref_id));
1381
1382 //$tpl->setVariable('SRC',ilUtil::getTypeIconPath($type,$a_obj_id,'tiny'));
1383 //$tpl->setVariable('ALT',$this->lng->txt('obj_'.$type));
1384 $tpl->setVariable('TITLE', $title);
1385 $tpl->setVariable('HREF', ilLink::_getLink($ref_id));
1386 $tpl->parseCurrentBlock();
1387 }
1388 return $tpl->get();
1389 }
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 $DIC, $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 1529 of file class.ilCalendarCategoryGUI.php.

1530 {
1531 $ilTabs = $this->tabs;
1533 $lng = $this->lng;
1534
1535 $ilTabs->addSubTab(
1536 "manage",
1537 $lng->txt("calendar"),
1538 $ilCtrl->getLinkTarget($this, "manage")
1539 );
1540
1541 $status = new ilCalendarSharedStatus($this->user_id);
1542 $calendars = $status->getOpenInvitations();
1543
1544 //if (count($calendars) > 0)
1545 //{
1546 $ilTabs->addSubTab(
1547 "invitations",
1548 $lng->txt("cal_shared_calendars"),
1549 $ilCtrl->getLinkTarget($this, "invitations")
1550 );
1551 //}
1552
1553 $ilTabs->activateSubTab($a_active);
1554 }
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 1196 of file class.ilCalendarCategoryGUI.php.

1197 {
1198 global $DIC;
1199
1200 $ilUser = $DIC['ilUser'];
1201
1202 $this->lng->loadLanguageModule('pd');
1203
1204 $tpl = new ilTemplate('tpl.calendar_selection.html', true, true, 'Services/Calendar');
1205 include_once('./Services/Calendar/classes/class.ilCalendarUserSettings.php');
1206 switch (ilCalendarUserSettings::_getInstance()->getCalendarSelectionType()) {
1208 $tpl->setVariable('HTEXT', $this->lng->txt('dash_memberships'));
1209 $tpl->touchBlock('head_item');
1210 $tpl->touchBlock('head_delim');
1211 $tpl->touchBlock('head_item');
1212
1213 $this->ctrl->setParameter($this, 'calendar_mode', ilCalendarUserSettings::CAL_SELECTION_ITEMS);
1214 $this->ctrl->setParameter($this, 'seed', $this->seed->get(IL_CAL_DATE));
1215 $tpl->setVariable('HHREF', $this->ctrl->getLinkTarget($this, 'switchCalendarMode'));
1216 $tpl->setVariable('HLINK', $this->lng->txt('dash_favourites'));
1217 $tpl->touchBlock('head_item');
1218 break;
1219
1221 $this->ctrl->setParameter($this, 'calendar_mode', ilCalendarUserSettings::CAL_SELECTION_MEMBERSHIP);
1222 $this->ctrl->setParameter($this, 'seed', $this->seed->get(IL_CAL_DATE));
1223 $tpl->setVariable('HHREF', $this->ctrl->getLinkTarget($this, 'switchCalendarMode'));
1224 $tpl->setVariable('HLINK', $this->lng->txt('dash_memberships'));
1225 $tpl->touchBlock('head_item');
1226 $tpl->touchBlock('head_delim');
1227 $tpl->touchBlock('head_item');
1228
1229 $tpl->setVariable('HTEXT', $this->lng->txt('dash_favourites'));
1230 $tpl->touchBlock('head_item');
1231 break;
1232
1233
1234 }
1235 return $tpl->get();
1236 }
const IL_CAL_DATE
static _getInstance()
get instance for logged in user

References $DIC, $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 1120 of file class.ilCalendarCategoryGUI.php.

1121 {
1122 global $DIC;
1123
1124 $tpl = $DIC['tpl'];
1125
1126 if (!count($_POST['appointments'])) {
1127 ilUtil::sendFailure($this->lng->txt('select_one'));
1128 $this->details();
1129 return true;
1130 }
1131
1132 include_once('./Services/Utilities/classes/class.ilConfirmationGUI.php');
1133 $confirmation_gui = new ilConfirmationGUI();
1134
1135 $this->ctrl->setParameter($this, 'category_id', $this->category_id);
1136 $confirmation_gui->setFormAction($this->ctrl->getFormAction($this));
1137 $confirmation_gui->setHeaderText($this->lng->txt('cal_del_app_sure'));
1138 $confirmation_gui->setConfirm($this->lng->txt('delete'), 'deleteAppointments');
1139 $confirmation_gui->setCancel($this->lng->txt('cancel'), 'details');
1140
1141 include_once('./Services/Calendar/classes/class.ilCalendarEntry.php');
1142 foreach ($_POST['appointments'] as $app_id) {
1143 $app = new ilCalendarEntry($app_id);
1144 $confirmation_gui->addItem('appointments[]', (int) $app_id, $app->getTitle());
1145 }
1146
1147 $tpl->setContent($confirmation_gui->getHTML());
1148 }
Model for a calendar entry.
Confirmation screen class.
$app
Definition: cli.php:38

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

+ Here is the call graph for this function:

◆ cancel()

ilCalendarCategoryGUI::cancel ( )
protected

cancel

@access protected

Returns

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

163 {
164 if (array_key_exists('backvm', $_REQUEST)) {
165 $this->ctrl->redirect($this, 'manage');
166 return true;
167 }
168
169 $this->ctrl->returnToParent($this);
170 return true;
171 }

◆ checkVisible()

ilCalendarCategoryGUI::checkVisible ( )
protected
Parameters

return

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

1326 {
1327 global $DIC;
1328
1329 $ilErr = $DIC['ilErr'];
1330
1331 if (!$this->visible) {
1332 $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->FATAL);
1333 }
1334 }
$ilErr
Definition: raiseError.php:18

References $DIC, and $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 387 of file class.ilCalendarCategoryGUI.php.

388 {
389 global $DIC;
390
391 $tpl = $DIC['tpl'];
392
393 $cat_ids = (is_array($_POST['selected_cat_ids']) && count($_POST['selected_cat_ids']) > 0)
394 ? $_POST['selected_cat_ids']
395 : ($_GET["category_id"] > 0 ? array($_GET["category_id"]) : null);
396
397 if (!is_array($cat_ids)) {
398 ilUtil::sendFailure($this->lng->txt('select_one'), true);
399 $this->manage();
400 }
401
402 /*
403 $this->readPermissions();
404 if(!$this->isEditable())
405 {
406 ilUtil::sendFailure($this->lng->txt('permission_denied'));
407 $this->manage();
408 return false;
409 }
410 */
411
412 include_once('./Services/Utilities/classes/class.ilConfirmationGUI.php');
413 $confirmation_gui = new ilConfirmationGUI();
414
415 $confirmation_gui->setFormAction($this->ctrl->getFormAction($this));
416 $confirmation_gui->setHeaderText($this->lng->txt('cal_del_cal_sure'));
417 $confirmation_gui->setConfirm($this->lng->txt('delete'), 'delete');
418 $confirmation_gui->setCancel($this->lng->txt('cancel'), 'manage');
419
420 include_once('./Services/Calendar/classes/class.ilCalendarCategory.php');
421 foreach ($cat_ids as $cat_id) {
422 $category = new ilCalendarCategory((int) $cat_id);
423 $confirmation_gui->addItem('category_id[]', $cat_id, $category->getTitle());
424 }
425
426 $tpl->setContent($confirmation_gui->getHTML());
427 }
manage($a_reset_offsets=false)
Manage calendars @global type $lng @global type $ilCtrl @global type $tpl.
Stores calendar categories.

References $_GET, $_POST, $DIC, $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 1621 of file class.ilCalendarCategoryGUI.php.

1622 {
1623 global $DIC;
1624
1625 $ilUser = $DIC['ilUser'];
1626
1627 if (!$_POST['cal_ids'] or !is_array($_POST['cal_ids'])) {
1628 ilUtil::sendFailure($this->lng->txt('select_one'));
1629 $this->inbox();
1630 return false;
1631 }
1632
1633 include_once('./Services/Calendar/classes/class.ilCalendarSharedStatus.php');
1634 $status = new ilCalendarSharedStatus($ilUser->getId());
1635
1636 include_once('./Services/Calendar/classes/class.ilCalendarShared.php');
1637 foreach ($_POST['cal_ids'] as $calendar_id) {
1638 if (!ilCalendarShared::isSharedWithUser($ilUser->getId(), $calendar_id)) {
1639 ilUtil::sendFailure($this->lng->txt('permission_denied'));
1640 $this->inbox();
1641 return false;
1642 }
1643 $status->decline($calendar_id);
1644 }
1645
1646 ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
1647
1648 $this->ctrl->redirect($this, 'invitations');
1649 }

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

+ Here is the call graph for this function:

◆ delete()

ilCalendarCategoryGUI::delete ( )
protected

Delete.

@access protected

Parameters

return

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

437 {
438 global $DIC;
439
440 $ilCtrl = $DIC['ilCtrl'];
441
442 if (!$_POST['category_id']) {
443 ilUtil::sendFailure($this->lng->txt('select_one'), true);
444 $this->manage();
445 }
446
447 /*
448 $this->readPermissions();
449 if(!$this->isEditable())
450 {
451 ilUtil::sendFailure($this->lng->txt('permission_denied'));
452 $this->edit();
453 return false;
454 }
455 */
456
457 include_once('./Services/Calendar/classes/class.ilCalendarCategory.php');
458 foreach ($_POST['category_id'] as $cat_id) {
459 $category = new ilCalendarCategory((int) $cat_id);
460 $category->delete();
461 }
462
463 ilUtil::sendSuccess($this->lng->txt('cal_cal_deleted'), true);
464 $ilCtrl->redirect($this, 'manage');
465 }

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

+ Here is the call graph for this function:

◆ deleteAppointments()

ilCalendarCategoryGUI::deleteAppointments ( )
protected

delete appointments

@access protected

Returns

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

1157 {
1158 if (!count($_POST['appointments'])) {
1159 ilUtil::sendFailure($this->lng->txt('select_one'));
1160 $this->details();
1161 return true;
1162 }
1163 include_once('./Services/Calendar/classes/class.ilCalendarEntry.php');
1164 foreach ($_POST['appointments'] as $app_id) {
1165 $app = new ilCalendarEntry($app_id);
1166 $app->delete();
1167
1168 include_once('./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
1170 }
1171
1172 ilUtil::sendSuccess($this->lng->txt('settings_saved'));
1173 $this->details();
1174 return true;
1175 }
static _deleteByAppointmentId($a_app_id)
Delete appointment assignment.

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

+ Here is the call graph for this function:

◆ details()

ilCalendarCategoryGUI::details ( )
protected

show calendar details

@access protected

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

285 {
286 global $DIC;
287
288 $tpl = $DIC['tpl'];
289
290 if (!$this->category_id) {
291 ilUtil::sendFailure($this->lng->txt('select_one'), true);
292 $this->ctrl->returnToParent($this);
293 }
294
295 $this->readPermissions();
296 $this->checkVisible();
297
298 // Non editable category
299 include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
300 $info = new ilInfoScreenGUI($this);
301 $info->setFormAction($this->ctrl->getFormAction($this));
302
303 $info->addSection($this->lng->txt('cal_cal_details'));
304
305 $tpl->setContent($info->getHTML() . $this->showAssignedAppointments());
306 }
Class ilInfoScreenGUI.

References $DIC, $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 1507 of file class.ilCalendarCategoryGUI.php.

1508 {
1509 include_once './Services/Calendar/classes/../classes/iCal/class.ilICalParser.php';
1510 include_once './Services/Calendar/classes/class.ilCalendarCategoryAssignments.php';
1511
1513
1515 $parser->setCategoryId($category_id);
1516 $parser->parse();
1517
1519
1520 return $assigned_after - $assigned_before;
1521 }
$parser
Definition: BPMN2Parser.php:23
static lookupNumberOfAssignedAppointments($a_cat_ids)
Get number of assigned appoitments.

References $category_id, $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 331 of file class.ilCalendarCategoryGUI.php.

332 {
333 include_once './Services/Calendar/classes/class.ilCalendarRemoteReader.php';
334 $remote = new ilCalendarRemoteReader($category->getRemoteUrl());
335 $remote->setUser($category->getRemoteUser());
336 $remote->setPass($category->getRemotePass());
337 $remote->read();
338 $remote->import($category);
339 }
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 253 of file class.ilCalendarCategoryGUI.php.

254 {
255 global $DIC;
256
257 $tpl = $DIC["tpl"];
258 $tabs = $DIC->tabs();
259 $tabs->activateTab("edit");
260
261 $this->readPermissions();
262
263 if (!$this->category_id) {
264 ilUtil::sendFailure($this->lng->txt('select_one'), true);
265 $this->ctrl->returnToParent($this);
266 }
267
268 if (!$this->actions->checkSettingsCal($this->category_id)) {
269 ilUtil::sendFailure($this->lng->txt('permission_denied'), true);
270 $this->ctrl->returnToParent($this);
271 }
272
273 if (!$form instanceof ilPropertyFormGUI) {
274 $form = $this->initFormCategory('edit');
275 }
276 $tpl->setContent($form->getHTML());
277 }

References $DIC, $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 122 of file class.ilCalendarCategoryGUI.php.

123 {
124 global $DIC;
125
126 $ilUser = $DIC['ilUser'];
127 $ilSetting = $DIC['ilSetting'];
128 $tpl = $DIC['tpl'];
129
130 $next_class = $this->ctrl->getNextClass($this);
131 $this->ctrl->saveParameter($this, 'category_id');
132 $this->ctrl->setParameter($this, 'seed', $this->seed->get(IL_CAL_DATE));
133
134 if (array_key_exists('backvm', $_REQUEST)) {
135 $this->ctrl->setParameter($this, 'backvm', 1);
136 }
137 switch ($next_class) {
138 case 'ilcalendarappointmentgui':
139 $this->ctrl->setReturn($this, 'details');
140
141 include_once('./Services/Calendar/classes/class.ilCalendarAppointmentGUI.php');
142 $app = new ilCalendarAppointmentGUI($this->seed, $this->seed, (int) $_GET['app_id']);
143 $this->ctrl->forwardCommand($app);
144 break;
145
146 default:
147 $cmd = $this->ctrl->getCmd("show");
148 $this->$cmd();
149 if (!in_array($cmd, array("details", "askDeleteAppointments", "deleteAppointments"))) {
150 return true;
151 }
152 }
153 return false;
154 }
Administrate calendar appointments.
global $ilSetting
Definition: privfeed.php:17

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

◆ getHTML()

ilCalendarCategoryGUI::getHTML ( )

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

1178 {
1179 global $DIC;
1180
1181 $ilUser = $DIC['ilUser'];
1182 $ilCtrl = $DIC['ilCtrl'];
1183
1184 include_once("./Services/Calendar/classes/class.ilCalendarSelectionBlockGUI.php");
1185 $block_gui = new ilCalendarSelectionBlockGUI($this->seed, $this->ref_id);
1186 $html = $ilCtrl->getHTML($block_gui);
1187 return $html;
1188 }
BlockGUI class calendar selection.

References $DIC, $ilCtrl, and $ilUser.

◆ getSearchToolbar()

ilCalendarCategoryGUI::getSearchToolbar ( )

Get search toolbar.

Parameters

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

878 {
879 global $DIC;
880
881 $tb = $DIC->toolbar();
882 $lng = $DIC->language();
883
884 $lng->loadLanguageModule('search');
885
886 $tb->setFormAction($this->ctrl->getFormAction($this));
887
888 // search term
889 $search = new ilTextInputGUI($this->lng->txt('cal_search'), 'query');
890 $search->setValue($_POST['query']);
891 $search->setSize(16);
892 $search->setMaxLength(128);
893
894 $tb->addInputItem($search, true);
895
896 // search type
897 include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
898 $options = array(
899 self::SEARCH_USER => $this->lng->txt('obj_user'),
900 self::SEARCH_ROLE => $this->lng->txt('obj_role'),
901 );
902 $si = new ilSelectInputGUI($this->lng->txt('search_type'), "query_type");
903 $si->setValue($_POST['query_type']);
904 $si->setOptions($options);
905 $si->setInfo($this->lng->txt(""));
906 $tb->addInputItem($si);
907
908
909 $tb->addFormButton($this->lng->txt('search'), "sharePerformSearch");
910 }
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, 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 1427 of file class.ilCalendarCategoryGUI.php.

1428 {
1429 global $DIC;
1430
1431 $ilTabs = $DIC['ilTabs'];
1432 $tpl = $DIC['tpl'];
1433
1434 if (!$this->category_id) {
1435 ilUtil::sendFailure($this->lng->txt('select_one'), true);
1436 $this->ctrl->returnToParent($this);
1437 }
1438 $this->ctrl->setParameter($this, 'category_id', $this->category_id);
1439
1440 // Check permissions
1441 $this->readPermissions();
1442 $this->checkVisible();
1443
1444 if (!$this->isImportable()) {
1445 ilUtil::sendFailure($this->lng->txt('permission_denied'), true);
1446 $this->ctrl->returnToParent($this);
1447 }
1448
1449 $ilTabs->clearTargets();
1450 $ilTabs->setBackTarget($this->lng->txt("back"), $this->ctrl->getLinkTarget($this, "cancel"));
1451
1452
1453 if (!$form instanceof ilPropertyFormGUI) {
1454 $form = $this->initImportForm();
1455 }
1456 $tpl->setContent($form->getHTML());
1457 }

References $DIC, $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 919 of file class.ilCalendarCategoryGUI.php.

920 {
921 global $DIC;
922
923 $rbacsystem = $DIC['rbacsystem'];
924 $ilUser = $DIC['ilUser'];
925 $ilHelp = $DIC['ilHelp'];
926
927 $ilHelp->setScreenIdComponent("cal");
928 $ilHelp->setScreenId("cal");
929 if ($a_mode == "edit") {
930 $ilHelp->setSubScreenId("edit");
931 } else {
932 $ilHelp->setSubScreenId("create");
933 }
934
935 include_once('./Services/Calendar/classes/class.ilCalendarCategories.php');
936 $cat_info = ilCalendarCategories::_getInstance()->getCategoryInfo($this->category_id);
937
938 $this->form = new ilPropertyFormGUI();
939 #$this->form->setTableWidth('40%');
940 switch ($a_mode) {
941 case 'edit':
942 $category = new ilCalendarCategory($this->category_id);
943 $this->form->setTitle($this->lng->txt('cal_edit_category'));
944 $this->ctrl->saveParameter($this, array('seed','category_id'));
945 $this->form->setFormAction($this->ctrl->getFormAction($this));
946 if ($this->isEditable()) {
947 $this->form->addCommandButton('update', $this->lng->txt('save'));
948
949 /*
950 if($cat_info['type'] == ilCalendarCategory::TYPE_USR)
951 {
952 $this->form->addCommandButton('shareSearch',$this->lng->txt('cal_share'));
953 }
954 $this->form->addCommandButton('confirmDelete',$this->lng->txt('delete'));
955 */
956 }
957 break;
958 case 'create':
959 $this->editable = true;
960 $category = new ilCalendarCategory(0);
961 $this->ctrl->saveParameter($this, array('category_id'));
962 $this->form->setFormAction($this->ctrl->getFormAction($this));
963 $this->form->setTitle($this->lng->txt('cal_add_category'));
964 $this->form->addCommandButton('save', $this->lng->txt('save'));
965 break;
966 }
967
968 $this->form->addCommandButton('cancel', $this->lng->txt('cancel'));
969
970 // Calendar name
971 $title = new ilTextInputGUI($this->lng->txt('cal_calendar_name'), 'title');
972 if ($a_mode == 'edit') {
973 if (!$this->isEditable() || $category->getType() == ilCalendarCategory::TYPE_OBJ) {
974 $title->setDisabled(true);
975 }
976 }
977 $title->setRequired(true);
978 $title->setMaxLength(64);
979 $title->setSize(32);
980 $title->setValue($category->getTitle());
981 $this->form->addItem($title);
982
983
984 include_once('./Services/Calendar/classes/class.ilCalendarSettings.php');
985 if ($a_mode == 'create' and $rbacsystem->checkAccess('edit_event', ilCalendarSettings::_getInstance()->getCalendarSettingsId())) {
986 $type = new ilRadioGroupInputGUI($this->lng->txt('cal_cal_type'), 'type');
987 $type->setValue($category->getType());
988 $type->setRequired(true);
989
990 $opt = new ilRadioOption($this->lng->txt('cal_type_personal'), ilCalendarCategory::TYPE_USR);
991 $type->addOption($opt);
992
993 $opt = new ilRadioOption($this->lng->txt('cal_type_system'), ilCalendarCategory::TYPE_GLOBAL);
994 $type->addOption($opt);
995 $type->setInfo($this->lng->txt('cal_type_info'));
996 $this->form->addItem($type);
997 }
998
999 // color
1000 $color = new ilColorPickerInputGUI($this->lng->txt('cal_calendar_color'), 'color');
1001 $color->setValue($category->getColor());
1002 if (!$this->isEditable()) {
1003 $color->setDisabled(true);
1004 }
1005 $color->setRequired(true);
1006 $this->form->addItem($color);
1007
1008 $location = new ilRadioGroupInputGUI($this->lng->txt('cal_type_rl'), 'type_rl');
1009 $location->setDisabled($a_mode == 'edit');
1010 $location_local = new ilRadioOption($this->lng->txt('cal_type_local'), ilCalendarCategory::LTYPE_LOCAL);
1011 $location->addOption($location_local);
1012 $location_remote = new ilRadioOption($this->lng->txt('cal_type_remote'), ilCalendarCategory::LTYPE_REMOTE);
1013 $location->addOption($location_remote);
1014 $location->setValue($category->getLocationType());
1015
1016
1017 $url = new ilTextInputGUI($this->lng->txt('cal_remote_url'), 'remote_url');
1018 $url->setDisabled($a_mode == 'edit');
1019 $url->setValue($category->getRemoteUrl());
1020 $url->setMaxLength(500);
1021 $url->setSize(60);
1022 $url->setRequired(true);
1023 $location_remote->addSubItem($url);
1024
1025 $user = new ilTextInputGUI($this->lng->txt('username'), 'remote_user');
1026 $user->setDisabled($a_mode == 'edit');
1027 $user->setValue($category->getRemoteUser());
1028 $user->setMaxLength(50);
1029 $user->setSize(20);
1030 $user->setRequired(false);
1031 $location_remote->addSubItem($user);
1032
1033 $pass = new ilPasswordInputGUI($this->lng->txt('password'), 'remote_pass');
1034 $pass->setDisabled($a_mode == 'edit');
1035 $pass->setValue($category->getRemotePass());
1036 $pass->setMaxLength(50);
1037 $pass->setSize(20);
1038 $pass->setRetype(false);
1039 $pass->setInfo($this->lng->txt('remote_pass_info'));
1040 $location_remote->addSubItem($pass);
1041
1042 // permalink
1043 if ($a_mode == "edit" && $category->getType() == ilCalendarCategory::TYPE_OBJ) {
1044 $ne = new ilNonEditableValueGUI($this->lng->txt("perma_link"), "", true);
1045 $ne->setValue($this->addReferenceLinks($category->getObjId()));
1046 $this->form->addItem($ne);
1047 }
1048
1049 // owner
1050 if ($a_mode == "edit" && $category->getType() == ilCalendarCategory::TYPE_USR) {
1051 $ne = new ilNonEditableValueGUI($this->lng->txt("cal_owner"), "", true);
1052 $ne->setValue(ilUserUtil::getNamePresentation($category->getObjId()));
1053 $this->form->addItem($ne);
1054 }
1055
1056 $this->form->addItem($location);
1057 return $this->form;
1058 }
$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 $DIC, $ilUser, $location, $pass, $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 1462 of file class.ilCalendarCategoryGUI.php.

1463 {
1464 include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
1465 $form = new ilPropertyFormGUI();
1466 $form->setTitle($this->lng->txt('cal_import_tbl'));
1467 $form->setFormAction($this->ctrl->getFormAction($this));
1468
1469 $form->addCommandButton('uploadAppointments', $this->lng->txt('import'));
1470
1471 $ics = new ilFileInputGUI($this->lng->txt('cal_import_file'), 'file');
1472 $ics->setALlowDeletion(false);
1473 $ics->setSuffixes(array('ics'));
1474 $ics->setInfo($this->lng->txt('cal_import_file_info'));
1475 $form->addItem($ics);
1476
1477 return $form;
1478 }
This class represents a file property in a property form.

Referenced by importAppointments(), and uploadAppointments().

+ Here is the caller graph for this function:

◆ invitations()

ilCalendarCategoryGUI::invitations ( )

Invitations.

Parameters

return

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

1563 {
1564 $this->addSubTabs("invitations");
1565
1566 // shared calendar invitations: @todo needs to be moved
1567 include_once('./Services/Calendar/classes/class.ilCalendarInboxSharedTableGUI.php');
1568 include_once('./Services/Calendar/classes/class.ilCalendarShared.php');
1569
1570 $table = new ilCalendarInboxSharedTableGUI($this, 'inbox');
1571 $table->setCalendars(ilCalendarShared::getSharedCalendarsForUser());
1572
1573 //if($table->parse())
1574 //{
1575 $this->tpl->setContent($table->getHTML());
1576 //}
1577 }
Show shared calendars for a specific user.
static getSharedCalendarsForUser($a_usr_id=0)
get shared calendars of user

References 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 1341 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 1346 of file class.ilCalendarCategoryGUI.php.

1347 {
1348 return $this->importable;
1349 }

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 1397 of file class.ilCalendarCategoryGUI.php.

1398 {
1399 global $DIC;
1400
1401 $lng = $DIC['lng'];
1402 $ilCtrl = $DIC['ilCtrl'];
1403 $tpl = $DIC['tpl'];
1404
1405 $this->addSubTabs("manage");
1406
1407 include_once('./Services/Calendar/classes/class.ilCalendarManageTableGUI.php');
1408 $table_gui = new ilCalendarManageTableGUI($this);
1409
1410 if ($a_reset_offsets) {
1411 $table_gui->resetToDefaults();
1412 }
1413
1414 $table_gui->parse();
1415
1416 include_once "./Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php";
1417 $toolbar = new ilToolbarGui();
1418 $ilCtrl->setParameter($this, 'backvm', 1);
1419 $toolbar->addButton($lng->txt("cal_add_calendar"), $ilCtrl->getLinkTarget($this, "add"));
1420
1421 $tpl->setContent($toolbar->getHTML() . $table_gui->getHTML());
1422 }
show list of alle calendars to manage

References $DIC, $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 1259 of file class.ilCalendarCategoryGUI.php.

1260 {
1261 global $DIC;
1262
1263 $ilUser = $DIC['ilUser'];
1264 $rbacsystem = $DIC['rbacsystem'];
1265 $ilAccess = $DIC['ilAccess'];
1266
1267 $this->editable = false;
1268
1269 $this->visible = false;
1270 $this->importable = false;
1271
1272 include_once('./Services/Calendar/classes/class.ilCalendarShared.php');
1273
1275 $cat = new ilCalendarCategory($this->category_id);
1276
1277 switch ($cat->getType()) {
1279
1280 if ($cat->getObjId() == $ilUser->getId()) {
1281 $this->visible = true;
1282 $this->editable = true;
1283 $this->importable = true;
1284 } elseif (isset($shared[$cat->getCategoryID()])) {
1285 $this->visible = true;
1286 }
1287 break;
1288
1290 $this->importable = $this->editable = $rbacsystem->checkAccess('edit_event', ilCalendarSettings::_getInstance()->getCalendarSettingsId());
1291 $this->visible = true;
1292 break;
1293
1295 $this->editable = false;
1296
1297 $refs = ilObject::_getAllReferences($cat->getObjId());
1298 foreach ($refs as $ref) {
1299 if ($ilAccess->checkAccess('read', '', $ref)) {
1300 $this->visible = true;
1301 }
1302 if ($ilAccess->checkAccess('edit_event', '', $ref)) {
1303 $this->importable = true;
1304 }
1305 if ($ilAccess->checkAccess('write', '', $ref)) {
1306 $this->editable = true;
1307 }
1308 }
1309 break;
1310
1313 $this->editable = $ilUser->getId() == $cat->getCategoryID();
1314 $this->visible = true;
1315 $this->importable = false;
1316 break;
1317 }
1318 }

References $DIC, $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 204 of file class.ilCalendarCategoryGUI.php.

205 {
206 $form = $this->initFormCategory('create');
207 if ($form->checkInput()) {
208 $category = new ilCalendarCategory(0);
209 $category->setTitle($form->getInput('title'));
210 $category->setColor('#' . $form->getInput('color'));
211 $category->setLocationType($form->getInput('type_rl'));
212 $category->setRemoteUrl($form->getInput('remote_url'));
213 $category->setRemoteUser($form->getInput('remote_user'));
214 $category->setRemotePass($form->getInput('remote_pass'));
215 if ($form->getInput('type') == ilCalendarCategory::TYPE_GLOBAL) {
216 $category->setType((int) $form->getInput('type'));
217 $category->setObjId(0);
218 } else {
219 $category->setType(ilCalendarCategory::TYPE_USR);
220 $category->setObjId($GLOBALS['DIC']->user()->getId());
221 }
222 $category->add();
223 } else {
224 ilUtil::sendFailure($this->lng->txt('err_check_input'));
225 $form->setValuesByPost();
226 $this->add($form);
227 return false;
228 }
229
230 // try sync
231 try {
232 if ($category->getLocationType() == ilCalendarCategory::LTYPE_REMOTE) {
233 $this->doSynchronisation($category);
234 }
235 } catch (Exception $e) {
236 // Delete calendar if creation failed
237 $category->delete();
238 ilUtil::sendFailure($e->getMessage());
239 $form->setValuesByPost();
240 $this->add($form);
241 return false;
242 }
243
244 ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
245 $GLOBALS['DIC']->ctrl()->redirect($this, 'manage');
246 }
user()
Definition: user.php:4
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
add(ilPropertyFormGUI $form=null)
add new calendar
doSynchronisation(ilCalendarCategory $category)
Sync calendar.

References Vendor\Package\$e, $GLOBALS, add(), doSynchronisation(), initFormCategory(), ilCalendarCategory\LTYPE_REMOTE, ilUtil\sendFailure(), 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 476 of file class.ilCalendarCategoryGUI.php.

477 {
478 global $DIC;
479
480 $ilUser = $DIC['ilUser'];
481
482 include_once('./Services/Calendar/classes/class.ilCalendarCategories.php');
483 include_once('./Services/Calendar/classes/class.ilCalendarVisibility.php');
484
485 $selected_cat_ids = $_POST['selected_cat_ids'] ? $_POST['selected_cat_ids'] : array();
486 $shown_cat_ids = $_POST['shown_cat_ids'] ? $_POST['shown_cat_ids'] : array();
487
489 $cat_ids = $cats->getCategories();
490
491 $cat_visibility = ilCalendarVisibility::_getInstanceByUserId($ilUser->getId(), $this->ref_id);
492
493
494
495 if ($this->obj_id > 0) {
496 $old_selection = $cat_visibility->getVisible();
497 } else {
498 $old_selection = $cat_visibility->getHidden();
499 }
500
501
502 $new_selection = array();
503
504 // put all entries from the old selection into the new one
505 // that are not presented on the screen
506 foreach ($old_selection as $cat_id) {
507 if (!in_array($cat_id, $shown_cat_ids)) {
508 $new_selection[] = $cat_id;
509 }
510 }
511
512 foreach ($shown_cat_ids as $shown_cat_id) {
513 $shown_cat_id = (int) $shown_cat_id;
514 if ($this->obj_id > 0) {
515 if (in_array($shown_cat_id, $selected_cat_ids)) {
516 $new_selection[] = $shown_cat_id;
517 }
518 } else {
519 if (!in_array($shown_cat_id, $selected_cat_ids)) {
520 $new_selection[] = $shown_cat_id;
521 }
522 }
523 }
524
525 if ($this->obj_id > 0) {
526 $cat_visibility->showSelected($new_selection);
527 } else {
528 $cat_visibility->hideSelected($new_selection);
529 }
530
531 $cat_visibility->save();
532
533 ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
534 $this->ctrl->returnToParent($this);
535 }
static _getInstanceByUserId($a_user_id, $a_ref_id=0)
get instance by user id

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

+ Here is the call graph for this function:

◆ shareAssign()

ilCalendarCategoryGUI::shareAssign (   $a_editable = false)

share assign

@access public

Returns

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

696 {
697 global $DIC;
698
699 $ilUser = $DIC['ilUser'];
700
701 if (!$this->category_id) {
702 ilUtil::sendFailure($this->lng->txt('select_one'), true);
703 $this->ctrl->returnToParent($this);
704 }
705 if (!count($_POST['user_ids'])) {
706 ilUtil::sendFailure($this->lng->txt('select_one'));
707 $this->sharePerformSearch();
708 return false;
709 }
710
711 $this->readPermissions();
712 if (!$this->isEditable()) {
713 ilUtil::sendFailure($this->lng->txt('permission_denied'));
714 $this->shareSearch();
715 return false;
716 }
717
718
719 include_once('./Services/Calendar/classes/class.ilCalendarShared.php');
720 $shared = new ilCalendarShared($this->category_id);
721
722 foreach ($_POST['user_ids'] as $user_id) {
723 if ($ilUser->getId() != $user_id) {
724 $shared->share($user_id, ilCalendarShared::TYPE_USR, $a_editable);
725 }
726 }
727 ilUtil::sendSuccess($this->lng->txt('cal_shared_selected_usr'));
728 $this->shareSearch();
729 }
sharePerformSearch()
share perform search
Handles shared calendars.

References $_POST, $DIC, $ilUser, $user_id, isEditable(), readPermissions(), ilUtil\sendFailure(), 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 684 of file class.ilCalendarCategoryGUI.php.

685 {
686 return $this->shareAssign(true);
687 }
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 746 of file class.ilCalendarCategoryGUI.php.

747 {
748 global $DIC;
749
750 $ilUser = $DIC['ilUser'];
751
752 if (!$this->category_id) {
753 ilUtil::sendFailure($this->lng->txt('select_one'), true);
754 $this->ctrl->returnToParent($this);
755 }
756 if (!count($_POST['role_ids'])) {
757 ilUtil::sendFailure($this->lng->txt('select_one'));
758 $this->sharePerformSearch();
759 return false;
760 }
761
762 $this->readPermissions();
763 if (!$this->isEditable()) {
764 ilUtil::sendFailure($this->lng->txt('permission_denied'));
765 $this->shareSearch();
766 return false;
767 }
768
769 include_once('./Services/Calendar/classes/class.ilCalendarShared.php');
770 $shared = new ilCalendarShared($this->category_id);
771
772 foreach ($_POST['role_ids'] as $role_id) {
773 $shared->share($role_id, ilCalendarShared::TYPE_ROLE, $a_editable);
774 }
775 ilUtil::sendSuccess($this->lng->txt('cal_shared_selected_usr'));
776 $this->shareSearch();
777 }

References $_POST, $DIC, $ilUser, isEditable(), readPermissions(), ilUtil\sendFailure(), 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 734 of file class.ilCalendarCategoryGUI.php.

735 {
736 return $this->shareAssignRoles(true);
737 }
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 786 of file class.ilCalendarCategoryGUI.php.

787 {
788 if (!$this->category_id) {
789 ilUtil::sendFailure($this->lng->txt('select_one'), true);
790 $this->ctrl->returnToParent($this);
791 }
792 if (!count($_POST['obj_ids'])) {
793 ilUtil::sendFailure($this->lng->txt('select_one'));
794 $this->shareSearch();
795 return false;
796 }
797
798 $this->readPermissions();
799 if (!$this->isEditable()) {
800 ilUtil::sendFailure($this->lng->txt('permission_denied'));
801 $this->shareSearch();
802 return false;
803 }
804
805
806 include_once('./Services/Calendar/classes/class.ilCalendarShared.php');
807 $shared = new ilCalendarShared($this->category_id);
808
809 foreach ($_POST['obj_ids'] as $obj_id) {
810 $shared->stopSharing($obj_id);
811 }
812 ilUtil::sendSuccess($this->lng->txt('cal_unshared_selected_usr'));
813 $this->shareSearch();
814 return true;
815 }

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

+ Here is the call graph for this function:

◆ sharePerformSearch()

ilCalendarCategoryGUI::sharePerformSearch ( )

share perform search

@access public

Returns

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

587 {
588 global $DIC;
589
590 $tabs = $DIC->tabs();
591 $tabs->activateTab("share");
592
593 $this->lng->loadLanguageModule('search');
594
595 if (!$this->category_id) {
596 ilUtil::sendFailure($this->lng->txt('select_one'), true);
597 $this->ctrl->returnToParent($this);
598 }
599 $this->ctrl->saveParameter($this, 'category_id');
600
601
602 if (!isset($_POST['query'])) {
603 $query = $_SESSION['cal_query'];
604 $type = $_SESSION['cal_type'];
605 } elseif ($_POST['query']) {
606 $query = $_SESSION['cal_query'] = $_POST['query'];
607 $type = $_SESSION['cal_type'] = $_POST['query_type'];
608 }
609
610 if (!$query) {
611 ilUtil::sendFailure($this->lng->txt('msg_no_search_string'));
612 $this->shareSearch();
613 return false;
614 }
615
616 $this->getSearchToolbar();
617
618 include_once 'Services/Search/classes/class.ilQueryParser.php';
619 include_once 'Services/Search/classes/class.ilObjectSearchFactory.php';
620 include_once 'Services/Search/classes/class.ilSearchResult.php';
621
622 $res_sum = new ilSearchResult();
623
624 $query_parser = new ilQueryParser(ilUtil::stripSlashes($query));
625 $query_parser->setCombination(QP_COMBINATION_OR);
626 $query_parser->setMinWordLength(3);
627 $query_parser->parse();
628
629
630 switch ($type) {
632 $search = ilObjectSearchFactory::_getUserSearchInstance($query_parser);
633 $search->enableActiveCheck(true);
634
635 $search->setFields(array('login'));
636 $res = $search->performSearch();
637 $res_sum->mergeEntries($res);
638
639 $search->setFields(array('firstname'));
640 $res = $search->performSearch();
641 $res_sum->mergeEntries($res);
642
643 $search->setFields(array('lastname'));
644 $res = $search->performSearch();
645 $res_sum->mergeEntries($res);
646
647 $res_sum->filter(ROOT_FOLDER_ID, QP_COMBINATION_OR);
648 break;
649
651
652 include_once 'Services/Search/classes/Like/class.ilLikeObjectSearch.php';
653 $search = new ilLikeObjectSearch($query_parser);
654 $search->setFilter(array('role'));
655
656 $res = $search->performSearch();
657 $res_sum->mergeEntries($res);
658
659 $res_sum->filter(ROOT_FOLDER_ID, QP_COMBINATION_OR);
660 break;
661 }
662
663 if (!count($res_sum->getResults())) {
664 ilUtil::sendFailure($this->lng->txt('search_no_match'));
665 $this->shareSearch();
666 return true;
667 }
668
669
670 switch ($type) {
672 $this->showUserList($res_sum->getResultIds());
673 break;
674
676 $this->showRoleList($res_sum->getResultIds());
677 break;
678 }
679 }
$_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 544 of file class.ilCalendarCategoryGUI.php.

545 {
546 global $DIC;
547
548 $tpl = $DIC['tpl'];
549
550 $tabs = $DIC->tabs();
551 $tabs->activateTab("share");
552
553 if (!$this->category_id) {
554 ilUtil::sendFailure($this->lng->txt('select_one'), true);
555 $this->ctrl->returnToParent($this);
556 }
557
558 $this->readPermissions();
559 if (!$this->isEditable()) {
560 ilUtil::sendFailure($this->lng->txt('permission_denied'));
561 $this->manage();
562 return false;
563 }
564
565
566 $_SESSION['cal_query'] = '';
567
568 $this->ctrl->saveParameter($this, 'category_id');
569
570 include_once('./Services/Calendar/classes/class.ilCalendarSharedListTableGUI.php');
571 $table = new ilCalendarSharedListTableGUI($this, 'shareSearch');
572 $table->setTitle($this->lng->txt('cal_cal_shared_with'));
573 $table->setCalendarId($this->category_id);
574 $table->parse();
575
576 $this->getSearchToolbar();
577 $tpl->setContent($table->getHTML());
578 }

References $_SESSION, $DIC, $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 1098 of file class.ilCalendarCategoryGUI.php.

1099 {
1100 include_once('./Services/Calendar/classes/class.ilCalendarCategoryTableGUI.php');
1101 include_once('./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
1102 include_once('./Services/Calendar/classes/class.ilCalendarAppointmentsTableGUI.php');
1103
1104 $table_gui = new ilCalendarAppointmentsTableGUI($this, 'details', $this->category_id);
1105 $table_gui->setTitle($this->lng->txt('cal_assigned_appointments'));
1106 $table_gui->setAppointments(
1108 ilCalendarCategories::_getInstance()->getSubitemCategories($this->category_id)
1109 )
1110 );
1111 return $table_gui->getHTML();
1112 }
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 852 of file class.ilCalendarCategoryGUI.php.

853 {
854 global $DIC;
855
856 $tpl = $DIC['tpl'];
857
858 include_once('./Services/Calendar/classes/class.ilCalendarSharedRoleListTableGUI.php');
859
860 $table = new ilCalendarSharedRoleListTableGUI($this, 'sharePerformSearch');
861 $table->setTitle($this->lng->txt('cal_share_search_role_header'));
862 $table->setFormAction($this->ctrl->getFormAction($this));
863 $table->setRoles($a_ids);
864 $table->parse();
865
866 // $table->addCommandButton('shareSearch',$this->lng->txt('search_new'));
867 // $table->addCommandButton('manage',$this->lng->txt('cancel'));
868
869 $tpl->setContent($table->getHTML());
870 }

References $DIC, 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 825 of file class.ilCalendarCategoryGUI.php.

826 {
827 global $DIC;
828
829 $tpl = $DIC['tpl'];
830
831 include_once('./Services/Calendar/classes/class.ilCalendarSharedUserListTableGUI.php');
832
833 $table = new ilCalendarSharedUserListTableGUI($this, 'sharePerformSearch');
834 $table->setTitle($this->lng->txt('cal_share_search_usr_header'));
835 $table->setFormAction($this->ctrl->getFormAction($this));
836 $table->setUsers($a_ids);
837 $table->parse();
838
839 // $table->addCommandButton('shareSearch',$this->lng->txt('search_new'));
840 // $table->addCommandButton('manage',$this->lng->txt('cancel'));
841
842 $tpl->setContent($table->getHTML());
843 }

References $DIC, 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 1242 of file class.ilCalendarCategoryGUI.php.

1243 {
1244 include_once('./Services/Calendar/classes/class.ilCalendarUserSettings.php');
1245 ilCalendarUserSettings::_getInstance()->setCalendarSelectionType((int) $_GET['calendar_mode']);
1247
1248 $this->ctrl->returnToParent($this);
1249 }

References $_GET, and ilCalendarUserSettings\_getInstance().

+ Here is the call graph for this function:

◆ synchroniseCalendar()

ilCalendarCategoryGUI::synchroniseCalendar ( )
protected

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

309 {
310 if (!$this->category_id) {
311 ilUtil::sendFailure($this->lng->txt('select_one'), true);
312 $this->ctrl->returnToParent($this);
313 }
314
315 $category = new ilCalendarCategory($this->category_id);
316
317 try {
318 $this->doSynchronisation($category);
319 } catch (Exception $e) {
320 ilUtil::sendFailure($e->getMessage(), true);
321 $this->ctrl->redirect($this, 'manage');
322 }
323 ilUtil::sendSuccess($this->lng->txt('cal_cal_sync_success'), true);
324 $this->ctrl->redirect($this, 'manage');
325 }

References Vendor\Package\$e, doSynchronisation(), and ilUtil\sendFailure().

+ Here is the call graph for this function:

◆ unshare()

ilCalendarCategoryGUI::unshare ( )
protected

Stop calendar sharing.

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

1064 {
1065 global $DIC;
1066
1067 $ilUser = $DIC['ilUser'];
1068
1069 if (!$this->category_id) {
1070 ilUtil::sendFailure($this->lng->txt('select_one'), true);
1071 $this->ctrl->returnToParent($this);
1072 }
1073
1074 $this->readPermissions();
1075 $this->checkVisible();
1076
1077 include_once('./Services/Calendar/classes/class.ilCalendarSharedStatus.php');
1078 $status = new ilCalendarSharedStatus($ilUser->getId());
1079
1080 include_once('./Services/Calendar/classes/class.ilCalendarShared.php');
1081 if (!ilCalendarShared::isSharedWithUser($ilUser->getId(), $this->category_id)) {
1082 ilUtil::sendFailure($this->lng->txt('permission_denied'));
1083 $this->inbox();
1084 return false;
1085 }
1086 $status->decline($this->category_id);
1087
1088 ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
1089 $this->ctrl->redirect($this, 'manage');
1090 }

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

+ Here is the call graph for this function:

◆ update()

ilCalendarCategoryGUI::update ( )
protected

update

@access protected

Returns

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

348 {
349 if (!$this->category_id) {
350 ilUtil::sendFailure($this->lng->txt('select_one'), true);
351 $this->ctrl->returnToParent($this);
352 }
353 $this->readPermissions();
354 if (!$this->isEditable()) {
355 ilUtil::sendFailure($this->lng->txt('permission_denied'));
356 $this->edit();
357 return false;
358 }
359
360 $form = $this->initFormCategory('edit');
361 if ($form->checkInput()) {
362 $category = new ilCalendarCategory($this->category_id);
363 if ($category->getType() != ilCalendarCategory::TYPE_OBJ) {
364 $category->setTitle($form->getInput('title'));
365 }
366 $category->setColor('#' . $form->getInput('color'));
367 $category->update();
368 ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
369 if ($this->ref_id > 0) {
370 $this->ctrl->returnToParent($this);
371 } else {
372 $this->ctrl->redirect($this, "manage");
373 }
374 } else {
375 $form->setValuesByPost();
376 ilUtil::sendFailure($this->lng->txt('err_check_input'));
377 $this->edit($form);
378 }
379 }
edit(ilPropertyFormGUI $form=null)
edit category

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

+ Here is the call graph for this function:

◆ uploadAppointments()

ilCalendarCategoryGUI::uploadAppointments ( )
protected

Upload appointments.

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

1484 {
1485 $form = $this->initImportForm();
1486 if ($form->checkInput()) {
1487 $file = $form->getInput('file');
1488 $tmp = ilUtil::ilTempnam();
1489
1490 ilUtil::moveUploadedFile($file['tmp_name'], $file['name'], $tmp);
1491
1492 $num = $this->doImportFile($tmp, (int) $_REQUEST['category_id']);
1493
1494 ilUtil::sendSuccess(sprintf($this->lng->txt('cal_imported_success'), (int) $num), true);
1495 $this->ctrl->redirect($this, 'cancel');
1496 }
1497
1498 ilUtil::sendFailure($this->lng->txt('cal_err_file_upload'), true);
1499 $this->initImportForm($form);
1500 }
doImportFile($file, $category_id)
Import ics.
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
static ilTempnam($a_temp_path=null)
Returns a unique and non existing Path for e temporary file or directory.

References doImportFile(), ilUtil\ilTempnam(), initImportForm(), ilUtil\moveUploadedFile(), and ilUtil\sendFailure().

+ 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.


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