ILIAS  trunk Revision v11.0_alpha-1761-g6dbbfa7b760
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilCalendarActions Class Reference

Checks if certain actions can be performed. More...

+ Collaboration diagram for ilCalendarActions:

Public Member Functions

 checkSettingsCal (int $a_cat_id)
 Check calendar editing. More...
 
 checkShareCal (int $a_cat_id)
 Check sharing (own) calendar. More...
 
 checkUnshareCal (int $a_cat_id)
 Check un-sharing (other users) calendar. More...
 
 checkSynchronizeCal (int $a_cat_id)
 Check synchronize remote calendar. More...
 
 checkAddEvent (int $a_cat_id)
 Check if adding an event is possible. More...
 
 checkDeleteCal (int $a_cat_id)
 Check if adding an event is possible. More...
 

Static Public Member Functions

static getInstance ()
 Get instance. More...
 

Protected Member Functions

 __construct ()
 Constructor. More...
 

Protected Attributes

ilCalendarCategories $cats
 

Static Protected Attributes

static ilCalendarActions $instance = null
 

Private Attributes

int $user_id
 

Detailed Description

Checks if certain actions can be performed.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e

Definition at line 25 of file class.ilCalendarActions.php.

Constructor & Destructor Documentation

◆ __construct()

ilCalendarActions::__construct ( )
protected

Constructor.

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

References $DIC, ilCalendarCategories\_getInstance(), and ilCalendarCategories\MODE_UNDEFINED.

36  {
37  global $DIC;
38 
39  $this->user_id = $DIC->user()->getId();
40  $this->cats = ilCalendarCategories::_getInstance($this->user_id);
41  if ($this->cats->getMode() == ilCalendarCategories::MODE_UNDEFINED) {
43  "ilCalendarActions needs ilCalendarCategories to be initialized for user " . $this->user_id
44  );
45  }
46  }
global $DIC
Definition: shib_login.php:22
static _getInstance($a_usr_id=0)
get singleton instance
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

Member Function Documentation

◆ checkAddEvent()

ilCalendarActions::checkAddEvent ( int  $a_cat_id)

Check if adding an event is possible.

Definition at line 106 of file class.ilCalendarActions.php.

106  : bool
107  {
108  $info = $this->cats->getCategoryInfo($a_cat_id);
109  return $info['editable'] ?? false;
110  }

◆ checkDeleteCal()

ilCalendarActions::checkDeleteCal ( int  $a_cat_id)

Check if adding an event is possible.

Definition at line 115 of file class.ilCalendarActions.php.

References ilCalendarCategory\TYPE_GLOBAL, and ilCalendarCategory\TYPE_USR.

115  : bool
116  {
117  $info = $this->cats->getCategoryInfo($a_cat_id);
118  if (($info['type'] ?? 0) == ilCalendarCategory::TYPE_USR && ($info['obj_id'] ?? 0) == $this->user_id) {
119  return true;
120  }
121  if (($info['type'] ?? 0) == ilCalendarCategory::TYPE_GLOBAL && ($info['settings'] ?? false)) {
122  return true;
123  }
124  return false;
125  }

◆ checkSettingsCal()

ilCalendarActions::checkSettingsCal ( int  $a_cat_id)

Check calendar editing.

Definition at line 62 of file class.ilCalendarActions.php.

62  : bool
63  {
64  $info = $this->cats->getCategoryInfo($a_cat_id);
65  return (bool) ($info['settings'] ?? false);
66  }

◆ checkShareCal()

ilCalendarActions::checkShareCal ( int  $a_cat_id)

Check sharing (own) calendar.

Definition at line 71 of file class.ilCalendarActions.php.

References ilCalendarCategory\TYPE_USR.

71  : bool
72  {
73  $info = $this->cats->getCategoryInfo($a_cat_id);
74  return
75  ($info['type'] ?? 0) == ilCalendarCategory::TYPE_USR &&
76  ($info['obj_id'] ?? '') == $this->user_id;
77  }

◆ checkSynchronizeCal()

ilCalendarActions::checkSynchronizeCal ( int  $a_cat_id)

Check synchronize remote calendar.

Definition at line 94 of file class.ilCalendarActions.php.

94  : bool
95  {
96  $info = $this->cats->getCategoryInfo($a_cat_id);
97  if ($info['remote'] ?? false) {
98  return true;
99  }
100  return false;
101  }

◆ checkUnshareCal()

ilCalendarActions::checkUnshareCal ( int  $a_cat_id)

Check un-sharing (other users) calendar.

Definition at line 82 of file class.ilCalendarActions.php.

82  : bool
83  {
84  $info = $this->cats->getCategoryInfo($a_cat_id);
85  if ($info['accepted'] ?? false) {
86  return true;
87  }
88  return false;
89  }

◆ getInstance()

static ilCalendarActions::getInstance ( )
static

Get instance.

Definition at line 51 of file class.ilCalendarActions.php.

Referenced by ilCalendarManageTableGUI\__construct(), ilCalendarPresentationGUI\__construct(), and ilCalendarCategoryGUI\__construct().

52  {
53  if (!self::$instance instanceof self) {
54  self::$instance = new self();
55  }
56  return self::$instance;
57  }
Checks if certain actions can be performed.
+ Here is the caller graph for this function:

Field Documentation

◆ $cats

ilCalendarCategories ilCalendarActions::$cats
protected

Definition at line 29 of file class.ilCalendarActions.php.

◆ $instance

ilCalendarActions ilCalendarActions::$instance = null
staticprotected

Definition at line 27 of file class.ilCalendarActions.php.

◆ $user_id

int ilCalendarActions::$user_id
private

Definition at line 30 of file class.ilCalendarActions.php.


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