ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 1584 of file class.ilCalendarCategoryGUI.php.

1585 {
1586 global $DIC;
1587
1588 $ilUser = $DIC['ilUser'];
1589
1590 if (!$_POST['cal_ids'] or !is_array($_POST['cal_ids'])) {
1591 ilUtil::sendFailure($this->lng->txt('select_one'));
1592 $this->inbox();
1593 return false;
1594 }
1595
1596 include_once('./Services/Calendar/classes/class.ilCalendarSharedStatus.php');
1597 $status = new ilCalendarSharedStatus($ilUser->getId());
1598
1599 include_once('./Services/Calendar/classes/class.ilCalendarShared.php');
1600 foreach ($_POST['cal_ids'] as $calendar_id) {
1601 if (!ilCalendarShared::isSharedWithUser($ilUser->getId(), $calendar_id)) {
1602 ilUtil::sendFailure($this->lng->txt('permission_denied'));
1603 $this->inbox();
1604 return false;
1605 }
1606 $status->accept($calendar_id);
1607 }
1608
1609 ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
1610
1611 $this->ctrl->redirect($this, 'invitations');
1612 }
$_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 179 of file class.ilCalendarCategoryGUI.php.

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

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

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

1196 {
1197 global $DIC;
1198
1199 $ilUser = $DIC['ilUser'];
1200
1201 $this->lng->loadLanguageModule('pd');
1202
1203 $tpl = new ilTemplate('tpl.calendar_selection.html', true, true, 'Services/Calendar');
1204 include_once('./Services/Calendar/classes/class.ilCalendarUserSettings.php');
1205 switch (ilCalendarUserSettings::_getInstance()->getCalendarSelectionType()) {
1207 $tpl->setVariable('HTEXT', $this->lng->txt('pd_my_memberships'));
1208 $tpl->touchBlock('head_item');
1209 $tpl->touchBlock('head_delim');
1210 $tpl->touchBlock('head_item');
1211
1212 $this->ctrl->setParameter($this, 'calendar_mode', ilCalendarUserSettings::CAL_SELECTION_ITEMS);
1213 $this->ctrl->setParameter($this, 'seed', $this->seed->get(IL_CAL_DATE));
1214 $tpl->setVariable('HHREF', $this->ctrl->getLinkTarget($this, 'switchCalendarMode'));
1215 $tpl->setVariable('HLINK', $this->lng->txt('pd_my_offers'));
1216 $tpl->touchBlock('head_item');
1217 break;
1218
1220 $this->ctrl->setParameter($this, 'calendar_mode', ilCalendarUserSettings::CAL_SELECTION_MEMBERSHIP);
1221 $this->ctrl->setParameter($this, 'seed', $this->seed->get(IL_CAL_DATE));
1222 $tpl->setVariable('HHREF', $this->ctrl->getLinkTarget($this, 'switchCalendarMode'));
1223 $tpl->setVariable('HLINK', $this->lng->txt('pd_my_memberships'));
1224 $tpl->touchBlock('head_item');
1225 $tpl->touchBlock('head_delim');
1226 $tpl->touchBlock('head_item');
1227
1228 $tpl->setVariable('HTEXT', $this->lng->txt('pd_my_offers'));
1229 $tpl->touchBlock('head_item');
1230 break;
1231
1232
1233 }
1234 return $tpl->get();
1235 }
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 1119 of file class.ilCalendarCategoryGUI.php.

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

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

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

◆ checkVisible()

ilCalendarCategoryGUI::checkVisible ( )
protected
Parameters

return

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

1325 {
1326 global $DIC;
1327
1328 $ilErr = $DIC['ilErr'];
1329
1330 if (!$this->visible) {
1331 $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->FATAL);
1332 }
1333 }
$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 386 of file class.ilCalendarCategoryGUI.php.

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

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

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

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

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

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

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

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

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

1507 {
1508 include_once './Services/Calendar/classes/../classes/iCal/class.ilICalParser.php';
1509 include_once './Services/Calendar/classes/class.ilCalendarCategoryAssignments.php';
1510
1512
1514 $parser->setCategoryId($category_id);
1515 $parser->parse();
1516
1518
1519 return $assigned_after - $assigned_before;
1520 }
$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 330 of file class.ilCalendarCategoryGUI.php.

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

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

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

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

◆ getHTML()

ilCalendarCategoryGUI::getHTML ( )

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

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

References $DIC, $html, $ilCtrl, and $ilUser.

◆ getSearchToolbar()

ilCalendarCategoryGUI::getSearchToolbar ( )

Get search toolbar.

Parameters

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

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

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

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

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

References $DIC, $form, $ilUser, $location, $pass, $title, $type, $url, $user, 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 1461 of file class.ilCalendarCategoryGUI.php.

1462 {
1463 include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
1464 $form = new ilPropertyFormGUI();
1465 $form->setTitle($this->lng->txt('cal_import_tbl'));
1466 $form->setFormAction($this->ctrl->getFormAction($this));
1467
1468 $form->addCommandButton('uploadAppointments', $this->lng->txt('import'));
1469
1470 $ics = new ilFileInputGUI($this->lng->txt('cal_import_file'), 'file');
1471 $ics->setALlowDeletion(false);
1472 $ics->setSuffixes(array('ics'));
1473 $ics->setInfo($this->lng->txt('cal_import_file_info'));
1474 $form->addItem($ics);
1475
1476 return $form;
1477 }
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 1561 of file class.ilCalendarCategoryGUI.php.

1562 {
1563 $this->addSubTabs("invitations");
1564
1565 // shared calendar invitations: @todo needs to be moved
1566 include_once('./Services/Calendar/classes/class.ilCalendarInboxSharedTableGUI.php');
1567 include_once('./Services/Calendar/classes/class.ilCalendarShared.php');
1568
1569 $table = new ilCalendarInboxSharedTableGUI($this, 'inbox');
1571
1572 //if($table->parse())
1573 //{
1574 $this->tpl->setContent($table->getHTML());
1575 //}
1576 }
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 1340 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 1345 of file class.ilCalendarCategoryGUI.php.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

References $_GET, and ilCalendarUserSettings\_getInstance().

+ Here is the call graph for this function:

◆ synchroniseCalendar()

ilCalendarCategoryGUI::synchroniseCalendar ( )
protected

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

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

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

+ Here is the call graph for this function:

◆ unshare()

ilCalendarCategoryGUI::unshare ( )
protected

Stop calendar sharing.

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

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

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

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

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

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

References $form, doImportFile(), ilUtil\ilTempnam(), initImportForm(), 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: