ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilCalendarCategoryGUI Class Reference

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

+ Collaboration diagram for ilCalendarCategoryGUI:

Public Member Functions

 __construct ($a_user_id, $seed)
 Constructor. More...
 
 executeCommand ()
 Execute command. More...
 
 saveSelection ()
 save selection of categories More...
 
 showCategories ()
 @access public 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...
 
 getHTML ()
 

Data Fields

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

Protected Member Functions

 cancel ()
 cancel More...
 
 add ()
 add new calendar More...
 
 save ()
 save new calendar More...
 
 edit ()
 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...
 
 initFormSearch ()
 init form search 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...
 

Protected Attributes

 $user_id
 
 $tpl
 
 $ctrl
 
 $lng
 
 $editable = false
 
 $visible = false
 

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 
)

Constructor.

@access public

Parameters
intuser id
Returns

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

58 {
59 global $lng,$ilCtrl;
60
61 $this->user_id = $a_user_id;
62 $this->seed = $seed;
63 $this->lng = $lng;
64 $this->lng->loadLanguageModule('dateplaner');
65 $this->ctrl = $ilCtrl;
66 }
global $ilCtrl
Definition: ilias.php:18

References $ilCtrl, and $lng.

Member Function Documentation

◆ add()

ilCalendarCategoryGUI::add ( )
protected

add new calendar

@access protected

Returns

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

121 {
122 global $tpl, $ilTabs;
123
124 $ilTabs->clearTargets();
125
126 if($_REQUEST['backv'] == self::VIEW_MANAGE)
127 {
128 $back = 'manage';
129 }
130 else
131 {
132 $back = 'cancel';
133 }
134
135 $ilTabs->setBackTarget($this->lng->txt("cal_back_to_list"), $this->ctrl->getLinkTarget($this, $back));
136
137 $this->tpl = new ilTemplate('tpl.edit_category.html',true,true,'Services/Calendar');
138 $this->initFormCategory('create');
139 $this->tpl->setVariable('EDIT_CAT',$this->form->getHTML());
140 $tpl->setContent($this->tpl->get());
141 }
initFormCategory($a_mode)
init edit/create category form
special template class to simplify handling of ITX/PEAR
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7

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

1371 {
1372 global $tree;
1373
1374 $tpl = new ilTemplate('tpl.cal_reference_links.html',true,true,'Services/Calendar');
1375
1376 foreach(ilObject::_getAllReferences($a_obj_id) as $ref_id => $ref_id)
1377 {
1378 include_once('./Services/Link/classes/class.ilLink.php');
1379
1380 $parent_ref_id = $tree->getParentId($ref_id);
1381 $parent_obj_id = ilObject::_lookupObjId($parent_ref_id);
1382 $parent_type = ilObject::_lookupType($parent_obj_id);
1383 $parent_title = ilObject::_lookupTitle($parent_obj_id);
1384
1385 $type = ilObject::_lookupType($a_obj_id);
1386 $title = ilObject::_lookupTitle($a_obj_id);
1387
1388 $tpl->setCurrentBlock('reference');
1389 $tpl->setVariable('PIMG_SRC',ilUtil::getTypeIconPath($parent_type,$parent_obj_id,'tiny'));
1390 $tpl->setVariable('PIMG_ALT',$this->lng->txt('obj_'.$parent_type));
1391 $tpl->setVariable('PARENT_TITLE',$parent_title);
1392 $tpl->setVariable('PARENT_HREF',ilLink::_getLink($parent_ref_id));
1393
1394 $tpl->setVariable('SRC',ilUtil::getTypeIconPath($type,$a_obj_id,'tiny'));
1395 $tpl->setVariable('ALT',$this->lng->txt('obj_'.$type));
1396 $tpl->setVariable('TITLE',$title);
1397 $tpl->setVariable('HREF',ilLink::_getLink($ref_id));
1398 $tpl->parseCurrentBlock();
1399 }
1400 return $tpl->get();
1401 }
static _lookupObjId($a_id)
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
static getTypeIconPath($a_type, $a_obj_id, $a_size='small')
Get type icon path path Return image path for icon_xxx.pngs Or (if enabled) path to custom icon Depre...
$ref_id
Definition: sahs_server.php:39

References $ref_id, $tpl, ilObject\_getAllReferences(), ilLink\_getLink(), ilObject\_lookupObjId(), ilObject\_lookupTitle(), ilObject\_lookupType(), and ilUtil\getTypeIconPath().

+ Here is the call graph for this function:

◆ appendCalendarSelection()

ilCalendarCategoryGUI::appendCalendarSelection ( )
protected
Parameters

return

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

1211 {
1212 global $ilUser;
1213
1214 $this->lng->loadLanguageModule('pd');
1215
1216 $tpl = new ilTemplate('tpl.calendar_selection.html',true,true,'Services/Calendar');
1217 include_once('./Services/Calendar/classes/class.ilCalendarUserSettings.php');
1218 switch(ilCalendarUserSettings::_getInstance()->getCalendarSelectionType())
1219 {
1221 $tpl->setVariable('HTEXT',$this->lng->txt('pd_my_memberships'));
1222 $tpl->touchBlock('head_item');
1223 $tpl->touchBlock('head_delim');
1224 $tpl->touchBlock('head_item');
1225
1226 $this->ctrl->setParameter($this,'calendar_mode',ilCalendarUserSettings::CAL_SELECTION_ITEMS);
1227 $this->ctrl->setParameter($this,'seed',$this->seed->get(IL_CAL_DATE));
1228 $tpl->setVariable('HHREF',$this->ctrl->getLinkTarget($this,'switchCalendarMode'));
1229 $tpl->setVariable('HLINK',$this->lng->txt('pd_my_offers'));
1230 $tpl->touchBlock('head_item');
1231 break;
1232
1234 $this->ctrl->setParameter($this,'calendar_mode',ilCalendarUserSettings::CAL_SELECTION_MEMBERSHIP);
1235 $this->ctrl->setParameter($this,'seed',$this->seed->get(IL_CAL_DATE));
1236 $tpl->setVariable('HHREF',$this->ctrl->getLinkTarget($this,'switchCalendarMode'));
1237 $tpl->setVariable('HLINK',$this->lng->txt('pd_my_memberships'));
1238 $tpl->touchBlock('head_item');
1239 $tpl->touchBlock('head_delim');
1240 $tpl->touchBlock('head_item');
1241
1242 $tpl->setVariable('HTEXT',$this->lng->txt('pd_my_offers'));
1243 $tpl->touchBlock('head_item');
1244 break;
1245
1246
1247 }
1248 return $tpl->get();
1249 }
const IL_CAL_DATE
static _getInstance()
get instance for logged in user
global $ilUser
Definition: imgupload.php:15

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

+ Here is the call graph for this function:

◆ askDeleteAppointments()

ilCalendarCategoryGUI::askDeleteAppointments ( )
protected

ask delete appointments

@access protected

Returns

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

1135 {
1136 global $tpl;
1137
1138 if(!count($_POST['appointments']))
1139 {
1140 ilUtil::sendFailure($this->lng->txt('select_one'));
1141 $this->details();
1142 return true;
1143 }
1144
1145 include_once('./Services/Utilities/classes/class.ilConfirmationGUI.php');
1146 $confirmation_gui = new ilConfirmationGUI();
1147
1148 $this->ctrl->setParameter($this,'category_id',(int) $_GET['category_id']);
1149 $confirmation_gui->setFormAction($this->ctrl->getFormAction($this));
1150 $confirmation_gui->setHeaderText($this->lng->txt('cal_del_app_sure'));
1151 $confirmation_gui->setConfirm($this->lng->txt('delete'),'deleteAppointments');
1152 $confirmation_gui->setCancel($this->lng->txt('cancel'),'details');
1153
1154 include_once('./Services/Calendar/classes/class.ilCalendarEntry.php');
1155 foreach($_POST['appointments'] as $app_id)
1156 {
1157 $app = new ilCalendarEntry($app_id);
1158 $confirmation_gui->addItem('appointments[]',(int) $app_id,$app->getTitle());
1159 }
1160
1161 $tpl->setContent($confirmation_gui->getHTML());
1162 }
$_GET["client_id"]
Model for a calendar entry.
Confirmation screen class.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$_POST['username']
Definition: cron.php:12

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

+ Here is the call graph for this function:

◆ cancel()

ilCalendarCategoryGUI::cancel ( )
protected

cancel

@access protected

Returns

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

110 {
111 $this->ctrl->returnToParent($this);
112 }

◆ checkVisible()

ilCalendarCategoryGUI::checkVisible ( )
protected
Parameters

return

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

1340 {
1341 global $ilErr;
1342
1343 if(!$this->visible)
1344 {
1345 $ilErr->raiseError($this->lng->txt('permission_denied'),$ilErr->FATAL);
1346 }
1347 }

References $ilErr.

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

+ Here is the caller graph for this function:

◆ confirmDelete()

ilCalendarCategoryGUI::confirmDelete ( )
protected

confirm delete

@access protected

Returns

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

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

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

+ Here is the call graph for this function:

◆ delete()

ilCalendarCategoryGUI::delete ( )
protected

Delete.

@access protected

Parameters

return

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

431 {
432 global $ilCtrl;
433
434 if(!$_POST['category_id'])
435 {
436 ilUtil::sendFailure($this->lng->txt('select_one'),true);
437 $this->manage();
438 }
439
440 /*
441 $this->readPermissions();
442 if(!$this->isEditable())
443 {
444 ilUtil::sendFailure($this->lng->txt('permission_denied'));
445 $this->edit();
446 return false;
447 }
448 */
449
450 include_once('./Services/Calendar/classes/class.ilCalendarCategory.php');
451 foreach($_POST['category_id'] as $cat_id)
452 {
453 $category = new ilCalendarCategory((int)$cat_id);
454 $category->delete();
455 }
456
457 ilUtil::sendSuccess($this->lng->txt('cal_cal_deleted'), true);
458 $ilCtrl->redirect($this, 'manage');
459 }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.

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

+ Here is the call graph for this function:

◆ deleteAppointments()

ilCalendarCategoryGUI::deleteAppointments ( )
protected

delete appointments

@access protected

Returns

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

1171 {
1172 if(!count($_POST['appointments']))
1173 {
1174 ilUtil::sendFailure($this->lng->txt('select_one'));
1175 $this->details();
1176 return true;
1177 }
1178 include_once('./Services/Calendar/classes/class.ilCalendarEntry.php');
1179 foreach($_POST['appointments'] as $app_id)
1180 {
1181 $app = new ilCalendarEntry($app_id);
1182 $app->delete();
1183
1184 include_once('./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
1186 }
1187
1188 ilUtil::sendSuccess($this->lng->txt('settings_saved'));
1189 $this->details();
1190 return true;
1191
1192 }
static _deleteByAppointmentId($a_app_id)
Delete appointment assignment.

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

+ Here is the call graph for this function:

◆ details()

ilCalendarCategoryGUI::details ( )
protected

show calendar details

@access protected

Returns

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

242 {
243 global $tpl;
244
245 if(!$_GET['category_id'])
246 {
247 ilUtil::sendFailure($this->lng->txt('select_one'),true);
248 $this->ctrl->returnToParent($this);
249 }
250
251 $this->readPermissions();
252 $this->checkVisible();
253
254 $category = new ilCalendarCategory((int) $_GET['category_id']);
255 if(!in_array($category->getType(), array(ilCalendarCategory::TYPE_CH, ilCalendarCategory::TYPE_BOOK)))
256 {
257 include_once "./Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php";
258 $toolbar = new ilToolbarGui();
259 $toolbar->addButton($this->lng->txt("cal_add_appointment"), $this->ctrl->getLinkTargetByClass("ilcalendarappointmentgui", "add"));
260
261 if(!in_array($category->getType(), array(ilCalendarCategory::TYPE_CH, ilCalendarCategory::TYPE_BOOK)))
262 {
263 $toolbar->addButton($this->lng->txt("cal_import_appointments"), $this->ctrl->getLinkTarget($this, "importAppointments"));
264 }
265 $toolbar = $toolbar->getHTML();
266 }
267
268 // Non editable category
269 include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
270 $info = new ilInfoScreenGUI($this);
271 $info->setFormAction($this->ctrl->getFormAction($this));
272
273 $info->addSection($this->lng->txt('cal_cal_details'));
274
275 // Calendar Name
276 $info->addProperty($this->lng->txt('cal_calendar_name'),$category->getTitle());
277 switch($category->getType())
278 {
280 $info->addProperty($this->lng->txt('cal_cal_type'),$this->lng->txt('cal_type_personal'));
281 break;
282
284 $info->addProperty($this->lng->txt('cal_cal_type'),$this->lng->txt('cal_type_system'));
285 break;
286
288 $info->addProperty($this->lng->txt('cal_cal_type'),$this->lng->txt('cal_type_'.$category->getObjType()));
289
290 $info->addSection($this->lng->txt('additional_info'));
291 $info->addProperty($this->lng->txt('perma_link'),$this->addReferenceLinks($category->getObjId()));
292 break;
293
296 // nothing to do
297 break;
298 }
299
300 // Ical link
301 include_once("./Services/News/classes/class.ilRSSButtonGUI.php");
302 $this->ctrl->setParameterByClass('ilcalendarsubscriptiongui','cal_id',(int) $_GET['category_id']);
303 $info->addProperty(
304 $this->lng->txt('cal_ical_infoscreen'),
306 $this->ctrl->getLinkTargetByClass(array('ilcalendarpresentationgui','ilcalendarsubscriptiongui'))
307 );
308
309 $tpl->setContent($toolbar.$info->getHTML().$this->showAssignedAppointments());
310 }
Class ilInfoScreenGUI.
static get($a_type, $a_href="")
Get icon html.
$info
Definition: example_052.php:80

References $_GET, $info, $tpl, checkVisible(), ilRSSButtonGUI\get(), ilRSSButtonGUI\ICON_ICAL, readPermissions(), ilUtil\sendFailure(), ilCalendarCategory\TYPE_BOOK, ilCalendarCategory\TYPE_CH, ilCalendarCategory\TYPE_GLOBAL, ilCalendarCategory\TYPE_OBJ, and ilCalendarCategory\TYPE_USR.

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

1520 {
1521 include_once './Services/Calendar/classes/../classes/iCal/class.ilICalParser.php';
1522 include_once './Services/Calendar/classes/class.ilCalendarCategoryAssignments.php';
1523
1524 $GLOBALS['ilLog']->write(__METHOD__.': Starting ical import...');
1525
1526 $assigned_before = ilCalendarCategoryAssignments::lookupNumberOfAssignedAppointments(array($category_id));
1527
1529 $parser->setCategoryId($category_id);
1530 $parser->parse();
1531
1532 $assigned_after = ilCalendarCategoryAssignments::lookupNumberOfAssignedAppointments(array($category_id));
1533
1534 return $assigned_after - $assigned_before;
1535 }
print $file
static lookupNumberOfAssignedAppointments($a_cat_ids)
Get number of assigned appoitments.
$GLOBALS['PHPCAS_CLIENT']
This global variable is used by the interface class phpCAS.
Definition: CAS.php:276

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

338 {
339 include_once './Services/Calendar/classes/class.ilCalendarRemoteReader.php';
340 $remote = new ilCalendarRemoteReader($category->getRemoteUrl());
341 $remote->setUser($category->getRemoteUser());
342 $remote->setPass($category->getRemotePass());
343 $remote->read();
344 $remote->import($category);
345 }
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 ( )
protected

edit category

@access protected

Returns

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

209 {
210 global $tpl, $ilTabs;
211
212 if(!$_GET['category_id'])
213 {
214 ilUtil::sendFailure($this->lng->txt('select_one'),true);
215 $this->ctrl->returnToParent($this);
216 }
217
218 $this->readPermissions();
219 $this->checkVisible();
220
221 if(!$this->isEditable())
222 {
223 ilUtil::sendFailure($this->lng->txt('permission_denied'));
224 $this->manage();
225 return false;
226 }
227
228 $ilTabs->clearTargets();
229 $ilTabs->setBackTarget($this->lng->txt("cal_back_to_list"), $this->ctrl->getLinkTarget($this, "manage"));
230
231 $this->initFormCategory('edit');
232 $tpl->setContent($this->form->getHTML());
233 }
isEditable()
check if calendar is editable @access private

References $_GET, $tpl, checkVisible(), initFormCategory(), isEditable(), manage(), 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 75 of file class.ilCalendarCategoryGUI.php.

76 {
77 global $ilUser, $ilSetting,$tpl;
78
79 $next_class = $this->ctrl->getNextClass($this);
80 $this->ctrl->saveParameter($this,'category_id');
81 $this->ctrl->setParameter($this,'seed',$this->seed->get(IL_CAL_DATE));
82 switch($next_class)
83 {
84 case 'ilcalendarappointmentgui':
85 $this->ctrl->setReturn($this,'details');
86
87 include_once('./Services/Calendar/classes/class.ilCalendarAppointmentGUI.php');
88 $app = new ilCalendarAppointmentGUI($this->seed,$this->seed, (int) $_GET['app_id']);
89 $this->ctrl->forwardCommand($app);
90 break;
91
92 default:
93 $cmd = $this->ctrl->getCmd("show");
94 $this->$cmd();
95 if(!in_array($cmd, array("details", "askDeleteAppointments", "deleteAppointments")))
96 {
97 return true;
98 }
99 }
100 return false;
101 }
Administrate calendar appointments.
global $ilSetting
Definition: privfeed.php:40
$cmd
Definition: sahs_server.php:35

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

◆ getHTML()

ilCalendarCategoryGUI::getHTML ( )

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

1195 {
1196 global $ilUser, $ilCtrl;
1197
1198 include_once("./Services/Calendar/classes/class.ilCalendarSelectionBlockGUI.php");
1199 $block_gui = new ilCalendarSelectionBlockGUI($this->seed);
1200 $html = $ilCtrl->getHTML($block_gui);
1201 return $html;
1202 }
BlockGUI class calendar selection.
$html
Definition: example_001.php:87

References $html, $ilCtrl, and $ilUser.

◆ importAppointments()

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

import appointments

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

1435 {
1436 global $ilTabs, $tpl;
1437
1438 if(!$_GET['category_id'])
1439 {
1440 ilUtil::sendFailure($this->lng->txt('select_one'),true);
1441 $this->ctrl->returnToParent($this);
1442 }
1443
1444 $this->ctrl->setParameter($this,'category_id',(int) $_GET['category_id']);
1445
1446 // Check permissions
1447 $this->readPermissions();
1448 $this->checkVisible();
1449
1450 if(!$this->isImportable())
1451 {
1452 ilUtil::sendFailure($this->lng->txt('permission_denied'));
1453 $this->manage();
1454 return false;
1455 }
1456
1457 $ilTabs->clearTargets();
1458 $ilTabs->setBackTarget($this->lng->txt("cal_back_to_list"), $this->ctrl->getLinkTarget($this, "manage"));
1459
1460
1461 if(!$form instanceof ilPropertyFormGUI)
1462 {
1463 $form = $this->initImportForm();
1464 }
1465 $tpl->setContent($form->getHTML());
1466 }
This class represents a property form user interface.

References $_GET, $tpl, checkVisible(), initImportForm(), isImportable(), manage(), 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 943 of file class.ilCalendarCategoryGUI.php.

944 {
945 global $rbacsystem,$ilUser, $ilHelp;
946
947 $ilHelp->setScreenIdComponent("cal");
948 $ilHelp->setScreenId("cal");
949 if ($a_mode == "edit")
950 {
951 $ilHelp->setSubScreenId("edit");
952 }
953 else
954 {
955 $ilHelp->setSubScreenId("create");
956 }
957
958 include_once('./Services/Form/classes/class.ilPropertyFormGUI.php');
959 include_once('./Services/Calendar/classes/class.ilCalendarCategory.php');
960
961 include_once('./Services/Calendar/classes/class.ilCalendarCategories.php');
962 $cat_info = ilCalendarCategories::_getInstance()->getCategoryInfo((int) $_GET['category_id']);
963
964 $this->form = new ilPropertyFormGUI();
965 #$this->form->setTableWidth('40%');
966 switch($a_mode)
967 {
968 case 'edit':
969 $category = new ilCalendarCategory((int) $_GET['category_id']);
970 $this->form->setTitle($this->lng->txt('cal_edit_category'));
971 $this->ctrl->saveParameter($this,array('seed','category_id'));
972 $this->form->setFormAction($this->ctrl->getFormAction($this));
973 if($this->isEditable())
974 {
975 $this->form->addCommandButton('update',$this->lng->txt('save'));
976
977 /*
978 if($cat_info['type'] == ilCalendarCategory::TYPE_USR)
979 {
980 $this->form->addCommandButton('shareSearch',$this->lng->txt('cal_share'));
981 }
982 $this->form->addCommandButton('confirmDelete',$this->lng->txt('delete'));
983 */
984
985 $this->form->addCommandButton('manage',$this->lng->txt('cancel'));
986 }
987 break;
988 case 'create':
989 $this->editable = true;
990 $category = new ilCalendarCategory(0);
991 $this->ctrl->saveParameter($this,array('category_id'));
992 $this->form->setFormAction($this->ctrl->getFormAction($this));
993 $this->form->setTitle($this->lng->txt('cal_add_category'));
994 $this->form->addCommandButton('save',$this->lng->txt('save'));
995 $this->form->addCommandButton('manage',$this->lng->txt('cancel'));
996 break;
997 }
998
999 // Calendar name
1000 $title = new ilTextInputGUI($this->lng->txt('cal_calendar_name'),'title');
1001 if($a_mode == 'edit')
1002 {
1003 $title->setDisabled(!$this->isEditable());
1004 }
1005 $title->setRequired(true);
1006 $title->setMaxLength(64);
1007 $title->setSize(32);
1008 $title->setValue($category->getTitle());
1009 $this->form->addItem($title);
1010
1011
1012 include_once('./Services/Calendar/classes/class.ilCalendarSettings.php');
1013 if($a_mode == 'create' and $rbacsystem->checkAccess('edit_event',ilCalendarSettings::_getInstance()->getCalendarSettingsId()))
1014 {
1015 $type = new ilRadioGroupInputGUI($this->lng->txt('cal_cal_type'),'type');
1016 $type->setValue($category->getType());
1017 $type->setRequired(true);
1018
1019 $opt = new ilRadioOption($this->lng->txt('cal_type_personal'),ilCalendarCategory::TYPE_USR);
1020 $type->addOption($opt);
1021
1022 $opt = new ilRadioOption($this->lng->txt('cal_type_system'),ilCalendarCategory::TYPE_GLOBAL);
1023 $type->addOption($opt);
1024 $type->setInfo($this->lng->txt('cal_type_info'));
1025 $this->form->addItem($type);
1026 }
1027
1028
1029 $color = new ilColorPickerInputGUI($this->lng->txt('cal_calendar_color'),'color');
1030 $color->setValue($category->getColor());
1031 if(!$this->isEditable())
1032 {
1033 $color->setDisabled(true);
1034 }
1035 $color->setRequired(true);
1036 $this->form->addItem($color);
1037
1038 $location = new ilRadioGroupInputGUI($this->lng->txt('cal_type_rl'), 'type_rl');
1039 $location->setDisabled($a_mode == 'edit');
1040 $location_local = new ilRadioOption($this->lng->txt('cal_type_local'), ilCalendarCategory::LTYPE_LOCAL);
1041 $location->addOption($location_local);
1042 $location_remote = new ilRadioOption($this->lng->txt('cal_type_remote'), ilCalendarCategory::LTYPE_REMOTE);
1043 $location->addOption($location_remote);
1044 $location->setValue($category->getLocationType());
1045
1046
1047 $url = new ilTextInputGUI($this->lng->txt('cal_remote_url'), 'remote_url');
1048 $url->setDisabled($a_mode == 'edit');
1049 $url->setValue($category->getRemoteUrl());
1050 $url->setMaxLength(500);
1051 $url->setSize(60);
1052 $url->setRequired(true);
1053 $location_remote->addSubItem($url);
1054
1055 $user = new ilTextInputGUI($this->lng->txt('username'),'remote_user');
1056 $user->setDisabled($a_mode == 'edit');
1057 $user->setValue($category->getRemoteUser());
1058 $user->setMaxLength(50);
1059 $user->setSize(20);
1060 $user->setRequired(false);
1061 $location_remote->addSubItem($user);
1062
1063 $pass = new ilPasswordInputGUI($this->lng->txt('password'),'remote_pass');
1064 $pass->setDisabled($a_mode == 'edit');
1065 $pass->setValue($category->getRemotePass());
1066 $pass->setMaxLength(50);
1067 $pass->setSize(20);
1068 $pass->setRetype(false);
1069 $pass->setInfo($this->lng->txt('remote_pass_info'));
1070 $location_remote->addSubItem($pass);
1071
1072 $this->form->addItem($location);
1073
1074 }
$location
Definition: buildRTE.php:44
static _getInstance($a_usr_id=0)
get singleton instance
static _getInstance()
get singleton instance
Color picker form for selecting color hexcodes using yui library.
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.
This class represents a text property in a property form.
$url
Definition: shib_logout.php:72

References $_GET, $ilUser, $location, $pass, $url, ilCalendarCategories\_getInstance(), ilCalendarSettings\_getInstance(), isEditable(), ilCalendarCategory\LTYPE_LOCAL, ilCalendarCategory\LTYPE_REMOTE, ilCalendarCategory\TYPE_GLOBAL, and ilCalendarCategory\TYPE_USR.

Referenced by add(), and edit().

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

◆ initFormSearch()

ilCalendarCategoryGUI::initFormSearch ( )
protected

init form search

@access protected

Parameters

return

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

900 {
901 global $lng;
902
903 $lng->loadLanguageModule('search');
904
905 if(!is_object($this->form))
906 {
907 include_once('Services/Form/classes/class.ilPropertyFormGUI.php');
908 $this->form = new ilPropertyFormGUI();
909 $this->form->setFormAction($this->ctrl->getFormAction($this));
910 $this->form->setTitle($this->lng->txt('cal_share_search_header'));
911 }
912
913 $type = new ilRadioGroupInputGUI($this->lng->txt('search_type'),'query_type');
914 $type->setValue($_POST['query_type'] ? $_POST['query_type'] : self::SEARCH_USER);
915 $type->setRequired(true);
916
917 $user = new ilRadioOption($this->lng->txt('obj_user'),self::SEARCH_USER);
918 $type->addOption($user);
919
920 $role = new ilRadioOption($this->lng->txt('obj_role'),self::SEARCH_ROLE);
921 $type->addOption($role);
922
923 $this->form->addItem($type);
924
925 $search = new ilTextInputGUI($this->lng->txt('cal_search'),'query');
926 $search->setValue($_POST['query']);
927 $search->setSize(16);
928 $search->setMaxLength(128);
929 $search->setRequired(true);
930 $search->setInfo($this->lng->txt('cal_search_info_share'));
931
932 $this->form->addItem($search);
933 $this->form->addCommandButton('sharePerformSearch',$this->lng->txt('search'));
934 // $this->form->addCommandButton('manage',$this->lng->txt('cancel'));
935 }

References $_POST, and $lng.

Referenced by shareSearch().

+ Here is the caller graph for this function:

◆ initImportForm()

ilCalendarCategoryGUI::initImportForm ( )
protected

Create import form.

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

1472 {
1473 include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
1474 $form = new ilPropertyFormGUI();
1475 $form->setTitle($this->lng->txt('cal_import_tbl'));
1476 $form->setFormAction($this->ctrl->getFormAction($this));
1477
1478 $form->addCommandButton('uploadAppointments',$this->lng->txt('import'));
1479
1480 $ics = new ilFileInputGUI($this->lng->txt('cal_import_file'), 'file');
1481 $ics->setALlowDeletion(false);
1482 $ics->setSuffixes(array('ics'));
1483 $ics->setInfo($this->lng->txt('cal_import_file_info'));
1484 $form->addItem($ics);
1485
1486 return $form;
1487 }
This class represents a file property in a property form.

Referenced by importAppointments(), and uploadAppointments().

+ Here is the caller graph for this function:

◆ isEditable()

ilCalendarCategoryGUI::isEditable ( )
private

check if calendar is editable @access private

Returns

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

References $editable.

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

+ Here is the caller graph for this function:

◆ isImportable()

ilCalendarCategoryGUI::isImportable ( )
protected

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

1360 {
1361 return $this->importable;
1362 }

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

1410 {
1411 global $lng, $ilCtrl, $tpl;
1412
1413 include_once('./Services/Calendar/classes/class.ilCalendarManageTableGUI.php');
1414 $table_gui = new ilCalendarManageTableGUI($this);
1415
1416 if($a_reset_offsets)
1417 {
1418 $table_gui->resetToDefaults();
1419 }
1420
1421 $table_gui->parse();
1422
1423 include_once "./Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php";
1424 $toolbar = new ilToolbarGui();
1425 $ilCtrl->setParameter($this,'backv',self::VIEW_MANAGE);
1426 $toolbar->addButton($lng->txt("cal_add_calendar"), $ilCtrl->getLinkTarget($this, "add"));
1427
1428 $tpl->setContent($toolbar->getHTML().$table_gui->getHTML());
1429 }
show list of alle calendars to manage

References $ilCtrl, $lng, and $tpl.

Referenced by confirmDelete(), delete(), edit(), importAppointments(), save(), shareSearch(), and update().

+ Here is the caller graph for this function:

◆ readPermissions()

ilCalendarCategoryGUI::readPermissions ( )
private

read permissions

@access private

Parameters

return

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

1274 {
1275 global $ilUser,$rbacsystem,$ilAccess;
1276
1277 $this->editable = false;
1278 $this->visible = false;
1279 $this->importable = false;
1280
1281 include_once('./Services/Calendar/classes/class.ilCalendarShared.php');
1282
1284 $cat = new ilCalendarCategory((int) $_GET['category_id']);
1285
1286 switch($cat->getType())
1287 {
1289
1290 if($cat->getObjId() == $ilUser->getId())
1291 {
1292 $this->visible = true;
1293 $this->editable = true;
1294 $this->importable = true;
1295 }
1296 elseif(isset($shared[$cat->getCategoryID()]))
1297 {
1298 $this->visible = true;
1299 }
1300 break;
1301
1303 $this->importable = $this->editable = $rbacsystem->checkAccess('edit_event',ilCalendarSettings::_getInstance()->getCalendarSettingsId());
1304 $this->visible = true;
1305 break;
1306
1308 $this->editable = false;
1309
1310 $refs = ilObject::_getAllReferences($cat->getObjId());
1311 foreach($refs as $ref)
1312 {
1313 if($ilAccess->checkAccess('read','',$ref))
1314 {
1315 $this->visible = true;
1316 }
1317 if($ilAccess->checkAccess('edit_event','',$ref))
1318 {
1319 $this->importable = true;
1320 }
1321 }
1322 break;
1323
1326 $this->editable = $ilUser->getId() == $cat->getCategoryID();
1327 $this->visible = true;
1328 $this->importable = false;
1329 break;
1330 }
1331
1332 }
static getSharedCalendarsForUser($a_usr_id=0)
get shared calendars of user

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

149 {
150 global $ilUser;
151
152 include_once('./Services/Calendar/classes/class.ilCalendarCategory.php');
153 $category = new ilCalendarCategory(0);
154 $category->setTitle(ilUtil::stripSlashes($_POST['title']));
155 $category->setColor('#'.ilUtil::stripSlashes($_POST['color']));
156 $category->setLocationType((int) $_POST['type_rl']);
157 $category->setRemoteUrl(ilUtil::stripSlashes($_POST['remote_url']));
158 $category->setRemoteUser(ilUtil::stripSlashes($_POST['remote_user']));
159 $category->setRemotePass(ilUtil::stripSlashes($_POST['remote_pass']));
160
161 if(isset($_POST['type']) and $_POST['type'] == ilCalendarCategory::TYPE_GLOBAL)
162 {
163 $category->setType((int) $_POST['type']);
164 $category->setObjId(0);
165 }
166 else
167 {
168 $category->setType(ilCalendarCategory::TYPE_USR);
169 $category->setObjId($ilUser->getId());
170 }
171
172 if(!$category->validate())
173 {
174 ilUtil::sendFailure($this->lng->txt('err_check_input'));
175 $this->add();
176 return false;
177 }
178 $category->add();
179
180
181 try {
182
183 if($category->getLocationType() == ilCalendarCategory::LTYPE_REMOTE)
184 {
185 $this->doSynchronisation($category);
186 }
187 }
188 catch(Exception $e)
189 {
190 // Delete calendar if creation failed
191 $category->delete();
192 ilUtil::sendFailure($e->getMessage());
193 $this->manage();
194 return true;
195 }
196
197 ilUtil::sendSuccess($this->lng->txt('settings_saved'),true);
198 // $this->ctrl->returnToParent($this);
199 $this->manage(true);
200 }
doSynchronisation(ilCalendarCategory $category)
Sync calendar.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled

References $_POST, $ilUser, add(), doSynchronisation(), ilCalendarCategory\LTYPE_REMOTE, manage(), ilUtil\sendFailure(), ilUtil\sendSuccess(), ilUtil\stripSlashes(), ilCalendarCategory\TYPE_GLOBAL, and ilCalendarCategory\TYPE_USR.

+ Here is the call graph for this function:

◆ saveSelection()

ilCalendarCategoryGUI::saveSelection ( )

save selection of categories

@access public

Parameters

return

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

471 {
472 global $ilUser;
473
474 include_once('./Services/Calendar/classes/class.ilCalendarCategories.php');
475 include_once('./Services/Calendar/classes/class.ilCalendarHidden.php');
476
477 $selected_cat_ids = $_POST['selected_cat_ids'] ? $_POST['selected_cat_ids'] : array();
478 $shown_cat_ids = $_POST['shown_cat_ids'] ? $_POST['shown_cat_ids'] : array();
479
481 $cat_ids = $cats->getCategories();
482
483 $hidden_cats = ilCalendarHidden::_getInstanceByUserId($ilUser->getId());
484 $hidden_cat_ids = $hidden_cats->getHidden();
485
486 $hidden = array();
487
488 foreach($hidden_cat_ids as $hidden_cat_id)
489 {
490 if( !in_array($hidden_cat_id,$shown_cat_ids) )
491 {
492 $hidden[] = $hidden_cat_id;
493 }
494 }
495
496 foreach($shown_cat_ids as $shown_cat_id)
497 {
498 $shown_cat_id = (int)$shown_cat_id;
499 if( !in_array($shown_cat_id, $selected_cat_ids) )
500 {
501 $hidden[] = $shown_cat_id;
502 }
503 }
504
505 $hidden_categories = ilCalendarHidden::_getInstanceByUserId($this->user_id);
506 $hidden_categories->hideSelected($hidden);
507 $hidden_categories->save();
508
509 ilUtil::sendSuccess($this->lng->txt('settings_saved'),true);
510 $this->ctrl->returnToParent($this);
511 }
static _getInstanceByUserId($a_user_id)
get instance by user id

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

+ Here is the call graph for this function:

◆ shareAssign()

ilCalendarCategoryGUI::shareAssign (   $a_editable = false)

share assign

@access public

Returns

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

711 {
712 global $ilUser;
713
714 if(!$_GET['category_id'])
715 {
716 ilUtil::sendFailure($this->lng->txt('select_one'),true);
717 $this->ctrl->returnToParent($this);
718 }
719 if(!count($_POST['user_ids']))
720 {
721 ilUtil::sendFailure($this->lng->txt('select_one'));
722 $this->sharePerformSearch();
723 return false;
724 }
725
726 $this->readPermissions();
727 if(!$this->isEditable())
728 {
729 ilUtil::sendFailure($this->lng->txt('permission_denied'));
730 $this->shareSearch();
731 return false;
732 }
733
734
735 include_once('./Services/Calendar/classes/class.ilCalendarShared.php');
736 $shared = new ilCalendarShared((int) $_GET['category_id']);
737
738 foreach($_POST['user_ids'] as $user_id)
739 {
740 if($ilUser->getId() != $user_id)
741 {
742 $shared->share($user_id,ilCalendarShared::TYPE_USR,$a_editable);
743 }
744 }
745 ilUtil::sendSuccess($this->lng->txt('cal_shared_selected_usr'));
746 $this->shareSearch();
747 }
sharePerformSearch()
share perform search
Handles shared calendars.

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

Referenced by shareAssignEditable().

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

◆ shareAssignEditable()

ilCalendarCategoryGUI::shareAssignEditable ( )

Share with write access.

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

700 {
701 return $this->shareAssign(true);
702 }
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 764 of file class.ilCalendarCategoryGUI.php.

765 {
766 global $ilUser;
767
768 if(!$_GET['category_id'])
769 {
770 ilUtil::sendFailure($this->lng->txt('select_one'),true);
771 $this->ctrl->returnToParent($this);
772 }
773 if(!count($_POST['role_ids']))
774 {
775 ilUtil::sendFailure($this->lng->txt('select_one'));
776 $this->sharePerformSearch();
777 return false;
778 }
779
780 $this->readPermissions();
781 if(!$this->isEditable())
782 {
783 ilUtil::sendFailure($this->lng->txt('permission_denied'));
784 $this->shareSearch();
785 return false;
786 }
787
788 include_once('./Services/Calendar/classes/class.ilCalendarShared.php');
789 $shared = new ilCalendarShared((int) $_GET['category_id']);
790
791 foreach($_POST['role_ids'] as $role_id)
792 {
793 $shared->share($role_id,ilCalendarShared::TYPE_ROLE,$a_editable);
794 }
795 ilUtil::sendSuccess($this->lng->txt('cal_shared_selected_usr'));
796 $this->shareSearch();
797 }

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

Referenced by shareAssignRolesEditable().

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

◆ shareAssignRolesEditable()

ilCalendarCategoryGUI::shareAssignRolesEditable ( )
protected

Share editable.

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

753 {
754 return $this->shareAssignRoles(true);
755 }
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 806 of file class.ilCalendarCategoryGUI.php.

807 {
808 if(!$_GET['category_id'])
809 {
810 ilUtil::sendFailure($this->lng->txt('select_one'),true);
811 $this->ctrl->returnToParent($this);
812 }
813 if(!count($_POST['obj_ids']))
814 {
815 ilUtil::sendFailure($this->lng->txt('select_one'));
816 $this->shareSearch();
817 return false;
818 }
819
820 $this->readPermissions();
821 if(!$this->isEditable())
822 {
823 ilUtil::sendFailure($this->lng->txt('permission_denied'));
824 $this->shareSearch();
825 return false;
826 }
827
828
829 include_once('./Services/Calendar/classes/class.ilCalendarShared.php');
830 $shared = new ilCalendarShared((int) $_GET['category_id']);
831
832 foreach($_POST['obj_ids'] as $obj_id)
833 {
834 $shared->stopSharing($obj_id);
835 }
836 ilUtil::sendSuccess($this->lng->txt('cal_unshared_selected_usr'));
837 $this->shareSearch();
838 return true;
839 }

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

+ Here is the call graph for this function:

◆ sharePerformSearch()

ilCalendarCategoryGUI::sharePerformSearch ( )

share perform search

@access public

Returns

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

596 {
597 global $ilTabs;
598
599 $this->lng->loadLanguageModule('search');
600
601 if(!$_GET['category_id'])
602 {
603 ilUtil::sendFailure($this->lng->txt('select_one'),true);
604 $this->ctrl->returnToParent($this);
605 }
606 $this->ctrl->saveParameter($this,'category_id');
607
608
609 if(!isset($_POST['query']))
610 {
611 $query = $_SESSION['cal_query'];
612 $type = $_SESSION['cal_type'];
613 }
614 elseif($_POST['query'])
615 {
616 $query = $_SESSION['cal_query'] = $_POST['query'];
617 $type = $_SESSION['cal_type'] = $_POST['query_type'];
618 }
619
620 if(!$query)
621 {
622 ilUtil::sendFailure($this->lng->txt('msg_no_search_string'));
623 $this->shareSearch();
624 return false;
625 }
626
627
628 include_once 'Services/Search/classes/class.ilQueryParser.php';
629 include_once 'Services/Search/classes/class.ilObjectSearchFactory.php';
630 include_once 'Services/Search/classes/class.ilSearchResult.php';
631
632 $res_sum = new ilSearchResult();
633
634 $query_parser = new ilQueryParser(ilUtil::stripSlashes($query));
635 $query_parser->setCombination(QP_COMBINATION_OR);
636 $query_parser->setMinWordLength(3);
637 $query_parser->parse();
638
639
640 switch($type)
641 {
643 $search = ilObjectSearchFactory::_getUserSearchInstance($query_parser);
644 $search->enableActiveCheck(true);
645
646 $search->setFields(array('login'));
647 $res = $search->performSearch();
648 $res_sum->mergeEntries($res);
649
650 $search->setFields(array('firstname'));
651 $res = $search->performSearch();
652 $res_sum->mergeEntries($res);
653
654 $search->setFields(array('lastname'));
655 $res = $search->performSearch();
656 $res_sum->mergeEntries($res);
657
658 $res_sum->filter(ROOT_FOLDER_ID,QP_COMBINATION_OR);
659 break;
660
662
663 include_once 'Services/Search/classes/Like/class.ilLikeObjectSearch.php';
664 $search = new ilLikeObjectSearch($query_parser);
665 $search->setFilter(array('role'));
666
667 $res = $search->performSearch();
668 $res_sum->mergeEntries($res);
669
670 $res_sum->filter(ROOT_FOLDER_ID,QP_COMBINATION_OR);
671 break;
672 }
673
674 if(!count($res_sum->getResults()))
675 {
676 ilUtil::sendFailure($this->lng->txt('search_no_match'));
677 $this->shareSearch();
678 return true;
679 }
680
681 $ilTabs->clearTargets();
682 $ilTabs->setBackTarget($this->lng->txt("cal_back_to_search"), $this->ctrl->getLinkTarget($this, "shareSearch"));
683
684 switch($type)
685 {
687 $this->showUserList($res_sum->getResultIds());
688 break;
689
691 $this->showRoleList($res_sum->getResultIds());
692 break;
693 }
694 }
$_SESSION["AccountId"]
const QP_COMBINATION_OR
showUserList($a_ids=array())
show user list
showRoleList($a_ids=array())
show role list
static _getUserSearchInstance($query_parser)
get reference of ilLikeUserSearch

References $_GET, $_POST, $_SESSION, $query, $res, ilObjectSearchFactory\_getUserSearchInstance(), 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 554 of file class.ilCalendarCategoryGUI.php.

555 {
556 global $tpl, $ilTabs;
557
558 if(!$_GET['category_id'])
559 {
560 ilUtil::sendFailure($this->lng->txt('select_one'),true);
561 $this->ctrl->returnToParent($this);
562 }
563
564 $this->readPermissions();
565 if(!$this->isEditable())
566 {
567 ilUtil::sendFailure($this->lng->txt('permission_denied'));
568 $this->manage();
569 return false;
570 }
571
572 $ilTabs->clearTargets();
573 $ilTabs->setBackTarget($this->lng->txt("cal_back_to_list"), $this->ctrl->getLinkTarget($this, "manage"));
574
575 $_SESSION['cal_query'] = '';
576
577 $this->ctrl->saveParameter($this,'category_id');
578 $this->initFormSearch();
579
580 include_once('./Services/Calendar/classes/class.ilCalendarSharedListTableGUI.php');
581 $table = new ilCalendarSharedListTableGUI($this,'shareSearch');
582 $table->setTitle($this->lng->txt('cal_shared_header'));
583 $table->setCalendarId((int) $_GET['category_id']);
584 $table->parse();
585
586 $tpl->setContent($this->form->getHTML().'<br />'.$table->getHTML());
587 }

References $_GET, $_SESSION, $tpl, initFormSearch(), 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 1114 of file class.ilCalendarCategoryGUI.php.

1115 {
1116 include_once('./Services/Calendar/classes/class.ilCalendarCategoryTableGUI.php');
1117 include_once('./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
1118 include_once('./Services/Calendar/classes/class.ilCalendarAppointmentsTableGUI.php');
1119
1120 $table_gui = new ilCalendarAppointmentsTableGUI($this, 'details', (int)$_GET['category_id']);
1121 $table_gui->setTitle($this->lng->txt('cal_assigned_appointments'));
1122 $table_gui->setAppointments(
1124 ilCalendarCategories::_getInstance()->getSubitemCategories((int) $_GET['category_id'])));
1125 return $table_gui->getHTML();
1126 }
static _getAssignedAppointments($a_cat_id)
Get assigned apointments.

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

+ Here is the call graph for this function:

◆ showCategories()

ilCalendarCategoryGUI::showCategories ( )

@access public

Parameters

return

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

521 {
522 include_once('./Services/Calendar/classes/class.ilCalendarCategoryTableGUI.php');
523 $table_gui = new ilCalendarCategoryTableGUI($this,$this->seed);
524 $nav_parameter = $table_gui->getNavParameter();
525
526 if($_POST[$nav_parameter] != "")
527 {
528 if($_POST[$nav_parameter."1"] != $_POST[$nav_parameter])
529 {
530 $nav_value = $_POST[$nav_parameter."1"];
531 }
532 elseif($_POST[$nav_parameter."2"] != $_POST[$nav_parameter])
533 {
534 $nav_value = $_POST[$nav_parameter."2"];
535 }
536 }
537 else
538 {
539 $nav_value = $_GET[$nav_parameter];
540 }
541
542 $_SESSION[$nav_parameter] = $nav_value;
543
544 $this->ctrl->returnToParent($this);
545 }
show presentation of calendar category side block

References $_GET, $_POST, and $_SESSION.

◆ showRoleList()

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

show role list

@access protected

Parameters
arrayarray of role ids
Returns

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

875 {
876 global $tpl;
877
878 include_once('./Services/Calendar/classes/class.ilCalendarSharedRoleListTableGUI.php');
879
880 $table = new ilCalendarSharedRoleListTableGUI($this,'sharePerformSearch');
881 $table->setTitle($this->lng->txt('cal_share_search_role_header'));
882 $table->setFormAction($this->ctrl->getFormAction($this));
883 $table->setRoles($a_ids);
884 $table->parse();
885
886 // $table->addCommandButton('shareSearch',$this->lng->txt('search_new'));
887 // $table->addCommandButton('manage',$this->lng->txt('cancel'));
888
889 $tpl->setContent($table->getHTML());
890 }

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

850 {
851 global $tpl;
852
853 include_once('./Services/Calendar/classes/class.ilCalendarSharedUserListTableGUI.php');
854
855 $table = new ilCalendarSharedUserListTableGUI($this,'sharePerformSearch');
856 $table->setTitle($this->lng->txt('cal_share_search_usr_header'));
857 $table->setFormAction($this->ctrl->getFormAction($this));
858 $table->setUsers($a_ids);
859 $table->parse();
860
861 // $table->addCommandButton('shareSearch',$this->lng->txt('search_new'));
862 // $table->addCommandButton('manage',$this->lng->txt('cancel'));
863
864 $tpl->setContent($table->getHTML());
865 }

References $tpl.

Referenced by sharePerformSearch().

+ Here is the caller graph for this function:

◆ switchCalendarMode()

ilCalendarCategoryGUI::switchCalendarMode ( )
protected

Switch calendar selection nmode.

Returns

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

1256 {
1257 include_once('./Services/Calendar/classes/class.ilCalendarUserSettings.php');
1258 ilCalendarUserSettings::_getInstance()->setCalendarSelectionType((int) $_GET['calendar_mode']);
1260
1261 $this->ctrl->returnToParent($this);
1262
1263 }

References $_GET, and ilCalendarUserSettings\_getInstance().

+ Here is the call graph for this function:

◆ synchroniseCalendar()

ilCalendarCategoryGUI::synchroniseCalendar ( )
protected

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

313 {
314 if(!$_GET['category_id'])
315 {
316 ilUtil::sendFailure($this->lng->txt('select_one'),true);
317 $this->ctrl->returnToParent($this);
318 }
319
320 $category = new ilCalendarCategory((int) $_GET['category_id']);
321
322 try {
323 $this->doSynchronisation($category);
324 }
325 catch(Exception $e) {
326 ilUtil::sendFailure($e->getMessage(),true);
327 $this->ctrl->redirect($this,'manage');
328 }
329 ilUtil::sendSuccess($this->lng->txt('cal_cal_sync_success'),true);
330 $this->ctrl->redirect($this,'manage');
331 }

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

+ Here is the call graph for this function:

◆ unshare()

ilCalendarCategoryGUI::unshare ( )
protected

Stop calendar sharing.

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

1080 {
1081 global $ilUser;
1082
1083 if(!$_GET['category_id'])
1084 {
1085 ilUtil::sendFailure($this->lng->txt('select_one'),true);
1086 $this->ctrl->returnToParent($this);
1087 }
1088
1089 $this->readPermissions();
1090 $this->checkVisible();
1091
1092 include_once('./Services/Calendar/classes/class.ilCalendarSharedStatus.php');
1093 $status = new ilCalendarSharedStatus($ilUser->getId());
1094
1095 include_once('./Services/Calendar/classes/class.ilCalendarShared.php');
1096 if(!ilCalendarShared::isSharedWithUser($ilUser->getId(), $_GET['category_id']))
1097 {
1098 ilUtil::sendFailure($this->lng->txt('permission_denied'));
1099 $this->inbox();
1100 return false;
1101 }
1102 $status->decline($_GET['category_id']);
1103
1104 ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
1105 $this->ctrl->redirect($this, 'manage');
1106 }
Stores status (accepted/declined) of shared calendars.
static isSharedWithUser($a_usr_id, $a_calendar_id)
is shared with user

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

+ Here is the call graph for this function:

◆ update()

ilCalendarCategoryGUI::update ( )
protected

update

@access protected

Returns

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

354 {
355 if(!$_GET['category_id'])
356 {
357 ilUtil::sendFailure($this->lng->txt('select_one'),true);
358 $this->ctrl->returnToParent($this);
359 }
360 $this->readPermissions();
361 if(!$this->isEditable())
362 {
363 ilUtil::sendFailure($this->lng->txt('permission_denied'));
364 $this->edit();
365 return false;
366 }
367
368 include_once('./Services/Calendar/classes/class.ilCalendarCategory.php');
369 $category = new ilCalendarCategory((int) $_GET['category_id']);
370 $category->setTitle(ilUtil::stripSlashes($_POST['title']));
371 $category->setColor('#'.ilUtil::stripSlashes($_POST['color']));
372 $category->update();
373
374 ilUtil::sendSuccess($this->lng->txt('settings_saved'),true);
375 // $this->ctrl->returnToParent($this);
376 $this->manage();
377 }

References $_GET, $_POST, edit(), isEditable(), manage(), readPermissions(), ilUtil\sendFailure(), ilUtil\sendSuccess(), and ilUtil\stripSlashes().

+ Here is the call graph for this function:

◆ uploadAppointments()

ilCalendarCategoryGUI::uploadAppointments ( )
protected

Upload appointments.

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

1493 {
1494 // @todo permission check
1495
1496 $form = $this->initImportForm();
1497 if($form->checkInput())
1498 {
1499 $file = $form->getInput('file');
1500 $tmp = ilUtil::ilTempnam();
1501
1502 ilUtil::moveUploadedFile($file['tmp_name'], $file['name'], $tmp);
1503
1504 $num = $this->doImportFile($tmp, (int) $_REQUEST['category_id']);
1505
1506 ilUtil::sendSuccess(sprintf($this->lng->txt('cal_imported_success'), (int) $num),true);
1507 $this->ctrl->redirect($this,'manage');
1508 }
1509
1510 ilUtil::sendFailure($this->lng->txt('cal_err_file_upload'),true);
1511 $this->initImportForm($form);
1512 }
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)
Create a temporary file in an ILIAS writable directory.

References $_REQUEST, $file, doImportFile(), ilUtil\ilTempnam(), initImportForm(), ilUtil\moveUploadedFile(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

ilCalendarCategoryGUI::$ctrl
protected

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

◆ $editable

ilCalendarCategoryGUI::$editable = false
protected

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

Referenced by isEditable().

◆ $lng

ilCalendarCategoryGUI::$lng
protected

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

Referenced by __construct(), initFormSearch(), and manage().

◆ $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 48 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: