ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilCalendarActions Class Reference

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

+ Collaboration diagram for ilCalendarActions:

Public Member Functions

 checkSettingsCal ($a_cat_id)
 Check calendar editing. More...
 
 checkShareCal ($a_cat_id)
 Check sharing (own) calendar. More...
 
 checkUnshareCal ($a_cat_id)
 Check un-sharing (other users) calendar. More...
 
 checkSynchronizeCal ($a_cat_id)
 Check synchronize remote calendar. More...
 
 checkAddEvent ($a_cat_id)
 Check if adding an event is possible. More...
 
 checkDeleteCal ($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

 $cats = null
 
 $user_id
 

Static Protected Attributes

static $instance = null
 

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
Version
$Id$

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

Constructor & Destructor Documentation

◆ __construct()

ilCalendarActions::__construct ( )
protected

Constructor.

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

References $DIC, and ilCalendarCategories\_getInstance().

33  {
34  global $DIC;
35 
36  $this->user_id = $DIC->user()->getId();
37 
38  include_once("./Services/Calendar/classes/class.ilCalendarCategories.php");
39  $this->cats = ilCalendarCategories::_getInstance($this->user_id);
40  if ($this->cats->getMode() == 0) {
41  include_once("./Services/Calendar/exceptions/class.ilCalCategoriesNotInitializedException.php");
42  throw new ilCalCategoriesNotInitializedException("ilCalendarActions needs ilCalendarCategories to be initialized for user " . $this->user_id . ".");
43  }
44  }
global $DIC
Definition: saml.php:7
static _getInstance($a_usr_id=0)
get singleton instance
Exception being thrown if code relies on initialization of calendar categories but no initialization ...
+ Here is the call graph for this function:

Member Function Documentation

◆ checkAddEvent()

ilCalendarActions::checkAddEvent (   $a_cat_id)

Check if adding an event is possible.

Parameters
int$a_cat_idcalendar category id
Returns
bool

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

References $info.

126  {
127  $info = $this->cats->getCategoryInfo($a_cat_id);
128  return $info['editable'];
129  }
$info
Definition: index.php:5

◆ checkDeleteCal()

ilCalendarActions::checkDeleteCal (   $a_cat_id)

Check if adding an event is possible.

Parameters
int$a_cat_idcalendar category id
Returns
bool

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

References $info, ilCalendarCategory\TYPE_GLOBAL, and ilCalendarCategory\TYPE_USR.

138  {
139  $info = $this->cats->getCategoryInfo($a_cat_id);
140  if ($info['type'] == ilCalendarCategory::TYPE_USR && $info['obj_id'] == $this->user_id) {
141  return true;
142  }
143  if ($info['type'] == ilCalendarCategory::TYPE_GLOBAL && $info['settings']) {
144  return true;
145  }
146 
147  return false;
148  }
$info
Definition: index.php:5

◆ checkSettingsCal()

ilCalendarActions::checkSettingsCal (   $a_cat_id)

Check calendar editing.

Parameters
int$a_cat_idcalendar category id
Returns
bool

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

References $info.

66  {
67  $info = $this->cats->getCategoryInfo($a_cat_id);
68  return $info['settings'];
69  }
$info
Definition: index.php:5

◆ checkShareCal()

ilCalendarActions::checkShareCal (   $a_cat_id)

Check sharing (own) calendar.

Parameters
int$a_cat_idcalendar category id
Returns
bool

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

References $info, and ilCalendarCategory\TYPE_USR.

78  {
79  $info = $this->cats->getCategoryInfo($a_cat_id);
80  if ($info['type'] == ilCalendarCategory::TYPE_USR && $info['obj_id'] == $this->user_id) {
81  return true;
82  }
83 
84  return false;
85  }
$info
Definition: index.php:5

◆ checkSynchronizeCal()

ilCalendarActions::checkSynchronizeCal (   $a_cat_id)

Check synchronize remote calendar.

Parameters
int$a_cat_idcalendar category id
Returns
bool

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

References $info.

110  {
111  $info = $this->cats->getCategoryInfo($a_cat_id);
112  if ($info['remote']) {
113  return true;
114  }
115 
116  return false;
117  }
$info
Definition: index.php:5

◆ checkUnshareCal()

ilCalendarActions::checkUnshareCal (   $a_cat_id)

Check un-sharing (other users) calendar.

Parameters
int$a_cat_idcalendar category id
Returns
bool

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

References $info.

94  {
95  $info = $this->cats->getCategoryInfo($a_cat_id);
96  if ($info['accepted']) {
97  return true;
98  }
99 
100  return false;
101  }
$info
Definition: index.php:5

◆ getInstance()

static ilCalendarActions::getInstance ( )
static

Get instance.

Returns
ilCalendarActions

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

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

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

Field Documentation

◆ $cats

ilCalendarActions::$cats = null
protected

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

◆ $instance

ilCalendarActions::$instance = null
staticprotected

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

◆ $user_id

ilCalendarActions::$user_id
protected

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


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