ILIAS  release_8 Revision v8.24
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 @access 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 37 of file class.ilCalendarCategoryAssignments.php.

38 {
39 global $DIC;
40
41 $this->db = $DIC->database();
42 $this->cal_entry_id = $a_cal_entry_id;
43 $this->read();
44 }
global $DIC
Definition: feed.php:28

References $DIC, and read().

+ 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 152 of file class.ilCalendarCategoryAssignments.php.

152 : void
153 {
154 global $DIC;
155
156 $ilDB = $DIC['ilDB'];
157 $query = "DELETE FROM cal_cat_assignments " .
158 "WHERE cal_id = " . $ilDB->quote($a_app_id, 'integer') . " ";
159 $res = $ilDB->manipulate($query);
160 }
$res
Definition: ltiservices.php:69
$query

References $DIC, $ilDB, $query, and $res.

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

+ Here is the caller graph for this function:

◆ _deleteByCategoryId()

static ilCalendarCategoryAssignments::_deleteByCategoryId ( int  $a_cat_id)
static

Delete assignments by category id @access public.

Parameters
intcategory_id
Returns

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

169 : void
170 {
171 global $DIC;
172
173 $ilDB = $DIC['ilDB'];
174 $query = "DELETE FROM cal_cat_assignments " .
175 "WHERE cat_id = " . $ilDB->quote($a_cat_id, 'integer') . " ";
176 $res = $ilDB->manipulate($query);
177 }

References $DIC, $ilDB, $query, and $res.

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

+ 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 73 of file class.ilCalendarCategoryAssignments.php.

73 : array
74 {
75 global $DIC;
76
77 $ilDB = $DIC['ilDB'];
78 $query = "SELECT * FROM cal_cat_assignments " .
79 "WHERE " . $ilDB->in('cal_id', $a_cal_ids, false, 'integer');
80 $res = $ilDB->query($query);
81 $map = [];
82 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
83 $map[(int) $row->cal_id] = (int) $row->cat_id;
84 }
85 return $map;
86 }

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

Referenced by ilCalendarSchedule\calculate().

+ 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 93 of file class.ilCalendarCategoryAssignments.php.

93 : array
94 {
95 global $DIC;
96
97 $ilDB = $DIC['ilDB'];
98 $query = "SELECT * FROM cal_cat_assignments " .
99 "WHERE " . $ilDB->in('cat_id', $a_cat_id, false, 'integer');
100
101 $res = $ilDB->query($query);
102 $cal_ids = [];
103 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
104 $cal_ids[] = (int) $row->cal_id;
105 }
106 return $cal_ids;
107 }

References $DIC, $ilDB, $query, $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().

+ 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 131 of file class.ilCalendarCategoryAssignments.php.

131 : array
132 {
133 global $DIC;
134
135 $ilDB = $DIC['ilDB'];
136 $query = "SELECT ce.cal_id FROM cal_categories cc " .
137 "JOIN cal_cat_assignments cca ON cc.cat_id = cca.cat_id " .
138 "JOIN cal_entries ce ON cca.cal_id = ce.cal_id " .
139 "WHERE auto_generated = 1 " .
140 "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " ";
141 $res = $ilDB->query($query);
142 $apps = [];
143 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
144 $apps[] = (int) $row->cal_id;
145 }
146 return $apps;
147 }

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

Referenced by ilCalendarAppEventListener\deleteAppointments().

+ 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 46 of file class.ilCalendarCategoryAssignments.php.

46 : array
47 {
48 global $DIC;
49
50 $ilDB = $DIC['ilDB'];
51 $query = "SELECT cat_id FROM cal_cat_assignments " .
52 "WHERE cal_id = " . $ilDB->quote($a_cal_id, 'integer') . " ";
53 $res = $ilDB->query($query);
54 $cat_ids = [];
55 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
56 $cat_ids[] = (int) $row->cat_id;
57 }
58 return $cat_ids;
59 }

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

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

+ 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 195 of file class.ilCalendarCategoryAssignments.php.

195 : void
196 {
197 $query = "INSERT INTO cal_cat_assignments (cal_id,cat_id) " .
198 "VALUES ( " .
199 $this->db->quote($this->cal_entry_id, 'integer') . ", " .
200 $this->db->quote($a_cal_cat_id, 'integer') . " " .
201 ")";
202 $res = $this->db->manipulate($query);
203 $this->assignments[] = $a_cal_cat_id;
204 }

References $query, and $res.

◆ deleteAssignment()

ilCalendarCategoryAssignments::deleteAssignment ( int  $a_cat_id)

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

206 : void
207 {
208 $query = "DELETE FROM cal_cat_assignments " .
209 "WHERE cal_id = " . $this->db->quote($this->cal_entry_id, 'integer') . ", " .
210 "AND cat_id = " . $this->db->quote($a_cat_id, 'integer') . " ";
211 $res = $this->db->manipulate($query);
212
213 if (($key = array_search($a_cat_id, $this->assignments)) !== false) {
214 unset($this->assignments[$key]);
215 }
216 }
string $key
Consumer key/client ID value.
Definition: System.php:193

References ILIAS\LTI\ToolProvider\$key, $query, and $res.

◆ deleteAssignments()

ilCalendarCategoryAssignments::deleteAssignments ( )

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

218 : void
219 {
220 $query = "DELETE FROM cal_cat_assignments " .
221 "WHERE cal_id = " . $this->db->quote($this->cal_entry_id, 'integer') . " ";
222 $res = $this->db->manipulate($query);
223 }

References $query, and $res.

◆ getAssignments()

ilCalendarCategoryAssignments::getAssignments ( )
Returns
int[]

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

190 : array
191 {
192 return $this->assignments;
193 }

References $assignments.

◆ getFirstAssignment()

ilCalendarCategoryAssignments::getFirstAssignment ( )

get first assignment

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

182 : ?int
183 {
184 return $this->assignments[0] ?? null;
185 }

◆ lookupNumberOfAssignedAppointments()

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

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

113 : int
114 {
115 global $DIC;
116
117 $ilDB = $DIC['ilDB'];
118 $query = 'SELECT COUNT(*) num FROM cal_cat_assignments ' .
119 'WHERE ' . $ilDB->in('cat_id', $a_cat_ids, false, 'integer');
120 $res = $ilDB->query($query);
121 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
122 return (int) $row->num;
123 }
124 return 0;
125 }

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

Referenced by ilCalendarCategoryGUI\doImportFile().

+ Here is the caller graph for this function:

◆ read()

ilCalendarCategoryAssignments::read ( )
private

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

226 {
227 $query = "SELECT * FROM cal_cat_assignments " .
228 "WHERE cal_id = " . $this->db->quote($this->cal_entry_id, 'integer') . " ";
229
230 $res = $this->db->query($query);
231 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
232 $this->assignments[] = (int) $row->cat_id;
233 }
234 }

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

Referenced by __construct().

+ 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 35 of file class.ilCalendarCategoryAssignments.php.

Referenced by getAssignments().

◆ $cal_entry_id

int ilCalendarCategoryAssignments::$cal_entry_id = 0
protected

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

◆ $db

ilDBInterface ilCalendarCategoryAssignments::$db
protected

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


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