ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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 $ilDB;
48
49 $this->db = $ilDB;
50 $this->cal_entry_id = $a_cal_entry_id;
51
52 $this->read();
53 }
global $ilDB

References $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 187 of file class.ilCalendarCategoryAssignments.php.

188 {
189 global $ilDB;
190
191 $query = "DELETE FROM cal_cat_assignments ".
192 "WHERE cal_id = ".$ilDB->quote($a_app_id ,'integer')." ";
193 $res = $ilDB->manipulate($query);
194
195 return true;
196 }

References $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 206 of file class.ilCalendarCategoryAssignments.php.

207 {
208 global $ilDB;
209
210 $query = "DELETE FROM cal_cat_assignments ".
211 "WHERE cat_id = ".$ilDB->quote($a_cat_id ,'integer')." ";
212 $res = $ilDB->manipulate($query);
213 return true;
214 }

References $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 101 of file class.ilCalendarCategoryAssignments.php.

102 {
103 global $ilDB;
104
105 $query = "SELECT * FROM cal_cat_assignments ".
106 "WHERE ".$ilDB->in('cal_id',$a_cal_ids,false,'integer');
107 $res = $ilDB->query($query);
108 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
109 {
110 $map[$row->cal_id] = $row->cat_id;
111 }
112 return $map ? $map : array();
113 }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11

References $ilDB, $query, $res, $row, and DB_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 122 of file class.ilCalendarCategoryAssignments.php.

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

References $ilDB, $query, $res, $row, and DB_FETCHMODE_OBJECT.

Referenced by ilCalendarExport\addCategories(), ilCalendarCategory\delete(), ilCalendarDataSet\getDependencies(), ilCalendarRemoteReader\importIcal(), ilCalendarInboxSharedTableGUI\parse(), 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 163 of file class.ilCalendarCategoryAssignments.php.

164 {
165 global $ilDB;
166
167 $query = "SELECT ce.cal_id FROM cal_categories cc ".
168 "JOIN cal_cat_assignments cca ON cc.cat_id = cca.cat_id ".
169 "JOIN cal_entries ce ON cca.cal_id = ce.cal_id ".
170 "WHERE auto_generated = 1 ".
171 "AND obj_id = ".$ilDB->quote($a_obj_id ,'integer')." ";
172 $res = $ilDB->query($query);
173 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
174 {
175 $apps[] = $row->cal_id;
176 }
177 return $apps ? $apps : array();
178 }

References $ilDB, $query, $res, $row, and DB_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 63 of file class.ilCalendarCategoryAssignments.php.

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

References $ilDB, $query, $res, $row, and DB_FETCHMODE_OBJECT.

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

+ Here is the caller graph for this function:

◆ _lookupCategory()

static ilCalendarCategoryAssignments::_lookupCategory (   $a_cal_id)
static

Lookup category id.

@access public

Parameters

return

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

86 {
87 if(count($cats = self::_lookupCategories($a_cal_id)))
88 {
89 return $cats[0];
90 }
91 return 0;
92 }

Referenced by ilCalendarAppointmentGUI\edit(), ilCalendarAppointmentGUI\editResponsibleUsers(), ilCalendarAppointmentPanelGUI\getHTML(), and ilCalendarAppointmentGUI\showInfoScreen().

+ Here is the caller graph for this function:

◆ addAssignment()

ilCalendarCategoryAssignments::addAssignment (   $a_cal_cat_id)

add assignment

@access public

Parameters
intcalendar category id
Returns

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

246 {
247 global $ilDB;
248
249 $query = "INSERT INTO cal_cat_assignments (cal_id,cat_id) ".
250 "VALUES ( ".
251 $this->db->quote($this->cal_entry_id ,'integer').", ".
252 $this->db->quote($a_cal_cat_id ,'integer')." ".
253 ")";
254 $res = $ilDB->manipulate($query);
255 $this->assignments[] = (int) $a_cal_cat_id;
256
257 return true;
258 }

References $ilDB, $query, and $res.

◆ deleteAssignment()

ilCalendarCategoryAssignments::deleteAssignment (   $a_cat_id)

delete assignment

@access public

Parameters
intcalendar category id
Returns

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

268 {
269 global $ilDB;
270
271 $query = "DELETE FROM cal_cat_assignments ".
272 "WHERE cal_id = ".$this->db->quote($this->cal_entry_id ,'integer').", ".
273 "AND cat_id = ".$this->db->quote($a_cat_id ,'integer')." ";
274 $res = $ilDB->manipulate($query);
275
276 if(($key = array_search($a_cat_id,$this->assignments)) !== false)
277 {
278 unset($this->assignments[$key]);
279 }
280 return true;
281 }

References $ilDB, $query, and $res.

◆ deleteAssignments()

ilCalendarCategoryAssignments::deleteAssignments ( )

delete assignments

@access public

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

289 {
290 global $ilDB;
291
292 $query = "DELETE FROM cal_cat_assignments ".
293 "WHERE cal_id = ".$this->db->quote($this->cal_entry_id ,'integer')." ";
294 $res = $ilDB->manipulate($query);
295 return true;
296 }

References $ilDB, $query, and $res.

◆ getAssignments()

ilCalendarCategoryAssignments::getAssignments ( )

get assignments

@access public

Returns

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

234 {
235 return $this->assignments ? $this->assignments : array();
236 }

◆ getFirstAssignment()

ilCalendarCategoryAssignments::getFirstAssignment ( )

get first assignment

@access public

Returns

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

223 {
224 return isset($this->assignments[0]) ? $this->assignments[0] : false;
225 }

◆ lookupNumberOfAssignedAppointments()

static ilCalendarCategoryAssignments::lookupNumberOfAssignedAppointments (   $a_cat_ids)
static

Get number of assigned appoitments.

Parameters
type$a_cat_id

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

142 {
143 global $ilDB;
144
145 $query = 'SELECT COUNT(*) num FROM cal_cat_assignments '.
146 'WHERE '.$ilDB->in('cat_id', $a_cat_ids, false, 'integer');
147 $res = $ilDB->query($query);
148 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
149 {
150 return $row->num;
151 }
152 return 0;
153 }

References $ilDB, $query, $res, $row, and DB_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 305 of file class.ilCalendarCategoryAssignments.php.

306 {
307 global $ilDB;
308
309 $query = "SELECT * FROM cal_cat_assignments ".
310 "WHERE cal_id = ".$this->db->quote($this->cal_entry_id ,'integer')." ";
311
312 $res = $this->db->query($query);
313 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
314 {
315 $this->assignments[] = $row->cat_id;
316 }
317 }

References $ilDB, $query, $res, $row, and DB_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: