ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilCalendarCategoryAssignments Class Reference
+ Collaboration diagram for ilCalendarCategoryAssignments:

Public Member Functions

 __construct ($a_cal_entry_id)
 Constructor. More...
 
 getFirstAssignment ()
 get first assignment More...
 
 getAssignments ()
 get assignments More...
 
 addAssignment ($a_cal_cat_id)
 add assignment More...
 
 deleteAssignment ($a_cat_id)
 delete assignment More...
 
 deleteAssignments ()
 delete assignments More...
 

Static Public Member Functions

static _lookupCategories ($a_cal_id)
 lookup categories More...
 
static _lookupCategory ($a_cal_id)
 Lookup category id. More...
 
static _getAppointmentCalendars ($a_cal_ids)
 lookup calendars for appointment ids More...
 
static _getAssignedAppointments ($a_cat_id)
 Get assigned apointments. More...
 
static lookupNumberOfAssignedAppointments ($a_cat_ids)
 Get number of assigned appoitments. More...
 
static _getAutoGeneratedAppointmentsByObjId ($a_obj_id)
 get automatic generated appointments of category More...
 
static _deleteByAppointmentId ($a_app_id)
 Delete appointment assignment. More...
 
static _deleteByCategoryId ($a_cat_id)
 Delete assignments by category id. More...
 

Protected Attributes

 $db
 
 $cal_entry_id = 0
 
 $assignments = array()
 

Private Member Functions

 read ()
 read assignments More...
 

Detailed Description

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

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

Constructor & Destructor Documentation

◆ __construct()

ilCalendarCategoryAssignments::__construct (   $a_cal_entry_id)

Constructor.

@access public

Parameters
intcalendar entry id

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

46 {
47 global $DIC;
48
49 $ilDB = $DIC['ilDB'];
50
51 $this->db = $ilDB;
52 $this->cal_entry_id = $a_cal_entry_id;
53
54 $this->read();
55 }
global $DIC
Definition: saml.php:7
global $ilDB

References $DIC, $ilDB, and read().

+ Here is the call graph for this function:

Member Function Documentation

◆ _deleteByAppointmentId()

static ilCalendarCategoryAssignments::_deleteByAppointmentId (   $a_app_id)
static

Delete appointment assignment.

@access public

Parameters
intappointment id

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

194 {
195 global $DIC;
196
197 $ilDB = $DIC['ilDB'];
198
199 $query = "DELETE FROM cal_cat_assignments " .
200 "WHERE cal_id = " . $ilDB->quote($a_app_id, 'integer') . " ";
201 $res = $ilDB->manipulate($query);
202
203 return true;
204 }
$query
foreach($_POST as $key=> $value) $res

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

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

+ Here is the caller graph for this function:

◆ _deleteByCategoryId()

static ilCalendarCategoryAssignments::_deleteByCategoryId (   $a_cat_id)
static

Delete assignments by category id.

@access public

Parameters
intcategory_id
Returns

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

215 {
216 global $DIC;
217
218 $ilDB = $DIC['ilDB'];
219
220 $query = "DELETE FROM cal_cat_assignments " .
221 "WHERE cat_id = " . $ilDB->quote($a_cat_id, 'integer') . " ";
222 $res = $ilDB->manipulate($query);
223 return true;
224 }

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 (   $a_cal_ids)
static

lookup calendars for appointment ids

@access public

Parameters
array$a_cal_ids

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

104 {
105 global $DIC;
106
107 $ilDB = $DIC['ilDB'];
108
109 $query = "SELECT * FROM cal_cat_assignments " .
110 "WHERE " . $ilDB->in('cal_id', $a_cal_ids, false, 'integer');
111 $res = $ilDB->query($query);
112 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
113 $map[$row->cal_id] = $row->cat_id;
114 }
115 return $map ? $map : array();
116 }
$row

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

Referenced by ilCalendarSchedule\calculate().

+ Here is the caller graph for this function:

◆ _getAssignedAppointments()

static ilCalendarCategoryAssignments::_getAssignedAppointments (   $a_cat_id)
static

Get assigned apointments.

@access public

Parameters
array$a_cat_id

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

126 {
127 global $DIC;
128
129 $ilDB = $DIC['ilDB'];
130
131 $query = "SELECT * FROM cal_cat_assignments " .
132 "WHERE " . $ilDB->in('cat_id', $a_cat_id, false, 'integer');
133
134 $res = $ilDB->query($query);
135 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
136 $cal_ids[] = $row->cal_id;
137 }
138 return $cal_ids ? $cal_ids : array();
139 }

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

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

+ Here is the caller graph for this function:

◆ _getAutoGeneratedAppointmentsByObjId()

static ilCalendarCategoryAssignments::_getAutoGeneratedAppointmentsByObjId (   $a_obj_id)
static

get automatic generated appointments of category

@access public

Parameters
intobj_id
Returns

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

169 {
170 global $DIC;
171
172 $ilDB = $DIC['ilDB'];
173
174 $query = "SELECT ce.cal_id FROM cal_categories cc " .
175 "JOIN cal_cat_assignments cca ON cc.cat_id = cca.cat_id " .
176 "JOIN cal_entries ce ON cca.cal_id = ce.cal_id " .
177 "WHERE auto_generated = 1 " .
178 "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " ";
179 $res = $ilDB->query($query);
180 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
181 $apps[] = $row->cal_id;
182 }
183 return $apps ? $apps : array();
184 }

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

Referenced by ilCalendarAppEventListener\deleteAppointments().

+ Here is the caller graph for this function:

◆ _lookupCategories()

static ilCalendarCategoryAssignments::_lookupCategories (   $a_cal_id)
static

lookup categories

@access public

Parameters
intcal_id
Returns
array of categories

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

66 {
67 global $DIC;
68
69 $ilDB = $DIC['ilDB'];
70
71 $query = "SELECT cat_id FROM cal_cat_assignments " .
72 "WHERE cal_id = " . $ilDB->quote($a_cal_id, 'integer') . " ";
73 $res = $ilDB->query($query);
74 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
75 $cat_ids[] = $row->cat_id;
76 }
77 return $cat_ids ? $cat_ids : array();
78 }

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

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

+ Here is the caller graph for this function:

◆ _lookupCategory()

◆ addAssignment()

ilCalendarCategoryAssignments::addAssignment (   $a_cal_cat_id)

add assignment

@access public

Parameters
intcalendar category id
Returns

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

256 {
257 global $DIC;
258
259 $ilDB = $DIC['ilDB'];
260
261 $query = "INSERT INTO cal_cat_assignments (cal_id,cat_id) " .
262 "VALUES ( " .
263 $this->db->quote($this->cal_entry_id, 'integer') . ", " .
264 $this->db->quote($a_cal_cat_id, 'integer') . " " .
265 ")";
266 $res = $ilDB->manipulate($query);
267 $this->assignments[] = (int) $a_cal_cat_id;
268
269 return true;
270 }

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

◆ deleteAssignment()

ilCalendarCategoryAssignments::deleteAssignment (   $a_cat_id)

delete assignment

@access public

Parameters
intcalendar category id
Returns

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

280 {
281 global $DIC;
282
283 $ilDB = $DIC['ilDB'];
284
285 $query = "DELETE FROM cal_cat_assignments " .
286 "WHERE cal_id = " . $this->db->quote($this->cal_entry_id, 'integer') . ", " .
287 "AND cat_id = " . $this->db->quote($a_cat_id, 'integer') . " ";
288 $res = $ilDB->manipulate($query);
289
290 if (($key = array_search($a_cat_id, $this->assignments)) !== false) {
291 unset($this->assignments[$key]);
292 }
293 return true;
294 }
$key
Definition: croninfo.php:18

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

◆ deleteAssignments()

ilCalendarCategoryAssignments::deleteAssignments ( )

delete assignments

@access public

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

302 {
303 global $DIC;
304
305 $ilDB = $DIC['ilDB'];
306
307 $query = "DELETE FROM cal_cat_assignments " .
308 "WHERE cal_id = " . $this->db->quote($this->cal_entry_id, 'integer') . " ";
309 $res = $ilDB->manipulate($query);
310 return true;
311 }

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

◆ getAssignments()

ilCalendarCategoryAssignments::getAssignments ( )

get assignments

@access public

Returns

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

244 {
245 return $this->assignments ? $this->assignments : array();
246 }

◆ getFirstAssignment()

ilCalendarCategoryAssignments::getFirstAssignment ( )

get first assignment

@access public

Returns

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

233 {
234 return isset($this->assignments[0]) ? $this->assignments[0] : false;
235 }

◆ lookupNumberOfAssignedAppointments()

static ilCalendarCategoryAssignments::lookupNumberOfAssignedAppointments (   $a_cat_ids)
static

Get number of assigned appoitments.

Parameters
type$a_cat_id

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

146 {
147 global $DIC;
148
149 $ilDB = $DIC['ilDB'];
150
151 $query = 'SELECT COUNT(*) num FROM cal_cat_assignments ' .
152 'WHERE ' . $ilDB->in('cat_id', $a_cat_ids, false, 'integer');
153 $res = $ilDB->query($query);
154 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
155 return $row->num;
156 }
157 return 0;
158 }

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

Referenced by ilCalendarCategoryGUI\doImportFile().

+ Here is the caller graph for this function:

◆ read()

ilCalendarCategoryAssignments::read ( )
private

read assignments

@access private

Returns

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

321 {
322 global $DIC;
323
324 $ilDB = $DIC['ilDB'];
325
326 $query = "SELECT * FROM cal_cat_assignments " .
327 "WHERE cal_id = " . $this->db->quote($this->cal_entry_id, 'integer') . " ";
328
329 $res = $this->db->query($query);
330 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
331 $this->assignments[] = $row->cat_id;
332 }
333 }

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

Referenced by __construct().

+ Here is the caller graph for this function:

Field Documentation

◆ $assignments

ilCalendarCategoryAssignments::$assignments = array()
protected

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

◆ $cal_entry_id

ilCalendarCategoryAssignments::$cal_entry_id = 0
protected

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

◆ $db

ilCalendarCategoryAssignments::$db
protected

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


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