ILIAS  trunk Revision v11.0_alpha-1749-g1a06bdef097
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilCalendarCategoryAssignments Class Reference
+ Collaboration diagram for ilCalendarCategoryAssignments:

Public Member Functions

 __construct (int $a_cal_entry_id)
 
 getFirstAssignment ()
 get first assignment More...
 
 getAssignments ()
 
 addAssignment (int $a_cal_cat_id)
 
 deleteAssignment (int $a_cat_id)
 
 deleteAssignments ()
 

Static Public Member Functions

static _lookupCategories (int $a_cal_id)
 
static _lookupCategory (int $a_cal_id)
 
static _getAppointmentCalendars (array $a_cal_ids)
 
static _getAssignedAppointments (array $a_cat_id)
 Get assigned apointments. More...
 
static lookupNumberOfAssignedAppointments (array $a_cat_ids)
 
static _getAutoGeneratedAppointmentsByObjId (int $a_obj_id)
 get automatic generated appointments of category More...
 
static _deleteByAppointmentId (int $a_app_id)
 Delete appointment assignment. More...
 
static _deleteByCategoryId (int $a_cat_id)
 Delete assignments by category id public. More...
 

Protected Attributes

ilDBInterface $db
 
int $cal_entry_id = 0
 
array $assignments = []
 

Private Member Functions

 read ()
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilCalendarCategoryAssignments::__construct ( int  $a_cal_entry_id)

Definition at line 31 of file class.ilCalendarCategoryAssignments.php.

References $DIC, and read().

32  {
33  global $DIC;
34 
35  $this->db = $DIC->database();
36  $this->cal_entry_id = $a_cal_entry_id;
37  $this->read();
38  }
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:

Member Function Documentation

◆ _deleteByAppointmentId()

static ilCalendarCategoryAssignments::_deleteByAppointmentId ( int  $a_app_id)
static

Delete appointment assignment.

Definition at line 146 of file class.ilCalendarCategoryAssignments.php.

References $DIC, $ilDB, and $res.

Referenced by ilConsultationHourUtils\cancelBooking(), ilCalendarEntry\delete(), ilCalendarAppointmentGUI\delete(), ilCalendarAppEventListener\deleteAppointments(), ilCalendarCategoryGUI\deleteAppointments(), and ilConsultationHoursGUI\deleteAppointments().

146  : void
147  {
148  global $DIC;
149 
150  $ilDB = $DIC['ilDB'];
151  $query = "DELETE FROM cal_cat_assignments " .
152  "WHERE cal_id = " . $ilDB->quote($a_app_id, 'integer') . " ";
153  $res = $ilDB->manipulate($query);
154  }
$res
Definition: ltiservices.php:66
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ _deleteByCategoryId()

static ilCalendarCategoryAssignments::_deleteByCategoryId ( int  $a_cat_id)
static

Delete assignments by category id public.

Parameters
intcategory_id
Returns

Definition at line 163 of file class.ilCalendarCategoryAssignments.php.

References $DIC, $ilDB, and $res.

Referenced by ilCalendarCategory\delete(), and ilCalendarRemoteReader\importIcal().

163  : void
164  {
165  global $DIC;
166 
167  $ilDB = $DIC['ilDB'];
168  $query = "DELETE FROM cal_cat_assignments " .
169  "WHERE cat_id = " . $ilDB->quote($a_cat_id, 'integer') . " ";
170  $res = $ilDB->manipulate($query);
171  }
$res
Definition: ltiservices.php:66
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ _getAppointmentCalendars()

static ilCalendarCategoryAssignments::_getAppointmentCalendars ( array  $a_cal_ids)
static
Parameters
int[]$a_cal_ids
Returns
array<int, int>

Definition at line 67 of file class.ilCalendarCategoryAssignments.php.

References $DIC, $ilDB, $res, ilDBConstants\FETCHMODE_OBJECT, and ILIAS\Repository\int().

Referenced by ilCalendarSchedule\calculate().

67  : array
68  {
69  global $DIC;
70 
71  $ilDB = $DIC['ilDB'];
72  $query = "SELECT * FROM cal_cat_assignments " .
73  "WHERE " . $ilDB->in('cal_id', $a_cal_ids, false, 'integer');
74  $res = $ilDB->query($query);
75  $map = [];
76  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
77  $map[(int) $row->cal_id] = (int) $row->cat_id;
78  }
79  return $map;
80  }
$res
Definition: ltiservices.php:66
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getAssignedAppointments()

static ilCalendarCategoryAssignments::_getAssignedAppointments ( array  $a_cat_id)
static

Get assigned apointments.

Parameters
int[]
Returns
int[]

Definition at line 87 of file class.ilCalendarCategoryAssignments.php.

References $DIC, $ilDB, $res, ilDBConstants\FETCHMODE_OBJECT, and ILIAS\Repository\int().

Referenced by ilCalendarExport\addCategories(), ilCalendarScheduleFilterExercise\addCustomEvents(), ilCalendarCategory\delete(), ilCalendarScheduleFilterTimings\findCalendarEntriesForItem(), ilCalendarDataSet\getDependencies(), ilCalendarSharedStatus\getOpenInvitations(), ilCalendarRemoteReader\importIcal(), and ilCalendarCategoryGUI\showAssignedAppointments().

87  : array
88  {
89  global $DIC;
90 
91  $ilDB = $DIC['ilDB'];
92  $query = "SELECT * FROM cal_cat_assignments " .
93  "WHERE " . $ilDB->in('cat_id', $a_cat_id, false, 'integer');
94 
95  $res = $ilDB->query($query);
96  $cal_ids = [];
97  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
98  $cal_ids[] = (int) $row->cal_id;
99  }
100  return $cal_ids;
101  }
$res
Definition: ltiservices.php:66
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getAutoGeneratedAppointmentsByObjId()

static ilCalendarCategoryAssignments::_getAutoGeneratedAppointmentsByObjId ( int  $a_obj_id)
static

get automatic generated appointments of category

Returns
int[]

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

References $DIC, $ilDB, $res, ilDBConstants\FETCHMODE_OBJECT, and ILIAS\Repository\int().

Referenced by ilCalendarAppEventListener\deleteAppointments().

125  : array
126  {
127  global $DIC;
128 
129  $ilDB = $DIC['ilDB'];
130  $query = "SELECT ce.cal_id FROM cal_categories cc " .
131  "JOIN cal_cat_assignments cca ON cc.cat_id = cca.cat_id " .
132  "JOIN cal_entries ce ON cca.cal_id = ce.cal_id " .
133  "WHERE auto_generated = 1 " .
134  "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " ";
135  $res = $ilDB->query($query);
136  $apps = [];
137  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
138  $apps[] = (int) $row->cal_id;
139  }
140  return $apps;
141  }
$res
Definition: ltiservices.php:66
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _lookupCategories()

static ilCalendarCategoryAssignments::_lookupCategories ( int  $a_cal_id)
static

Definition at line 40 of file class.ilCalendarCategoryAssignments.php.

References $DIC, $ilDB, $res, ilDBConstants\FETCHMODE_OBJECT, and ILIAS\Repository\int().

Referenced by ilCalendarExport\buildAppointmentUrl(), ilConsultationHourUtils\getConsultationHourLinksForRepositoryObject(), ilCalendarVisibility\isAppointmentVisible(), and ilCalendarScheduleFilterConsultationHourInRepository\modifyEvent().

40  : array
41  {
42  global $DIC;
43 
44  $ilDB = $DIC['ilDB'];
45  $query = "SELECT cat_id FROM cal_cat_assignments " .
46  "WHERE cal_id = " . $ilDB->quote($a_cal_id, 'integer') . " ";
47  $res = $ilDB->query($query);
48  $cat_ids = [];
49  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
50  $cat_ids[] = (int) $row->cat_id;
51  }
52  return $cat_ids;
53  }
$res
Definition: ltiservices.php:66
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _lookupCategory()

◆ addAssignment()

ilCalendarCategoryAssignments::addAssignment ( int  $a_cal_cat_id)

Definition at line 189 of file class.ilCalendarCategoryAssignments.php.

References $res.

Referenced by ilConsultationHourUtils\bookAppointment(), ilCalendarAppEventListener\createAppointments(), ilConsultationHoursGUI\createAppointments(), ilCalendarAppointmentGUI\save(), and ilICalParser\writeEvent().

189  : void
190  {
191  $query = "INSERT INTO cal_cat_assignments (cal_id,cat_id) " .
192  "VALUES ( " .
193  $this->db->quote($this->cal_entry_id, 'integer') . ", " .
194  $this->db->quote($a_cal_cat_id, 'integer') . " " .
195  ")";
196  $res = $this->db->manipulate($query);
197  $this->assignments[] = $a_cal_cat_id;
198  }
$res
Definition: ltiservices.php:66
+ Here is the caller graph for this function:

◆ deleteAssignment()

ilCalendarCategoryAssignments::deleteAssignment ( int  $a_cat_id)

Definition at line 200 of file class.ilCalendarCategoryAssignments.php.

References $res.

200  : void
201  {
202  $query = "DELETE FROM cal_cat_assignments " .
203  "WHERE cal_id = " . $this->db->quote($this->cal_entry_id, 'integer') . ", " .
204  "AND cat_id = " . $this->db->quote($a_cat_id, 'integer') . " ";
205  $res = $this->db->manipulate($query);
206 
207  if (($key = array_search($a_cat_id, $this->assignments)) !== false) {
208  unset($this->assignments[$key]);
209  }
210  }
$res
Definition: ltiservices.php:66

◆ deleteAssignments()

ilCalendarCategoryAssignments::deleteAssignments ( )

Definition at line 212 of file class.ilCalendarCategoryAssignments.php.

References $res.

Referenced by ilCalendarAppointmentGUI\update().

212  : void
213  {
214  $query = "DELETE FROM cal_cat_assignments " .
215  "WHERE cal_id = " . $this->db->quote($this->cal_entry_id, 'integer') . " ";
216  $res = $this->db->manipulate($query);
217  }
$res
Definition: ltiservices.php:66
+ Here is the caller graph for this function:

◆ getAssignments()

ilCalendarCategoryAssignments::getAssignments ( )
Returns
int[]

Definition at line 184 of file class.ilCalendarCategoryAssignments.php.

References $assignments.

184  : array
185  {
186  return $this->assignments;
187  }

◆ getFirstAssignment()

ilCalendarCategoryAssignments::getFirstAssignment ( )

get first assignment

Definition at line 176 of file class.ilCalendarCategoryAssignments.php.

References null.

Referenced by ilCalendarAppointmentGUI\calendarEntryToCategory(), and ilCalendarAppointmentGUI\initForm().

176  : ?int
177  {
178  return $this->assignments[0] ?? null;
179  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the caller graph for this function:

◆ lookupNumberOfAssignedAppointments()

static ilCalendarCategoryAssignments::lookupNumberOfAssignedAppointments ( array  $a_cat_ids)
static
Parameters
int[]$a_cat_ids
Returns
int

Definition at line 107 of file class.ilCalendarCategoryAssignments.php.

References $DIC, $ilDB, $res, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilCalendarCategoryGUI\doImportFile().

107  : int
108  {
109  global $DIC;
110 
111  $ilDB = $DIC['ilDB'];
112  $query = 'SELECT COUNT(*) num FROM cal_cat_assignments ' .
113  'WHERE ' . $ilDB->in('cat_id', $a_cat_ids, false, 'integer');
114  $res = $ilDB->query($query);
115  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
116  return (int) $row->num;
117  }
118  return 0;
119  }
$res
Definition: ltiservices.php:66
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ read()

ilCalendarCategoryAssignments::read ( )
private

Definition at line 219 of file class.ilCalendarCategoryAssignments.php.

References $res, ilDBConstants\FETCHMODE_OBJECT, and ILIAS\Repository\int().

Referenced by __construct().

220  {
221  $query = "SELECT * FROM cal_cat_assignments " .
222  "WHERE cal_id = " . $this->db->quote($this->cal_entry_id, 'integer') . " ";
223 
224  $res = $this->db->query($query);
225  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
226  $this->assignments[] = (int) $row->cat_id;
227  }
228  }
$res
Definition: ltiservices.php:66
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $assignments

array ilCalendarCategoryAssignments::$assignments = []
protected

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

Referenced by getAssignments().

◆ $cal_entry_id

int ilCalendarCategoryAssignments::$cal_entry_id = 0
protected

Definition at line 28 of file class.ilCalendarCategoryAssignments.php.

◆ $db

ilDBInterface ilCalendarCategoryAssignments::$db
protected

Definition at line 26 of file class.ilCalendarCategoryAssignments.php.


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