ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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.

public

Parameters
intcalendar entry id

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

References $ilDB, and read().

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
+ Here is the call graph for this function:

Member Function Documentation

◆ _deleteByAppointmentId()

static ilCalendarCategoryAssignments::_deleteByAppointmentId (   $a_app_id)
static

Delete appointment assignment.

public

Parameters
intappointment id

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

References $ilDB, $query, and $res.

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

182  {
183  global $ilDB;
184 
185  $query = "DELETE FROM cal_cat_assignments " .
186  "WHERE cal_id = " . $ilDB->quote($a_app_id, 'integer') . " ";
187  $res = $ilDB->manipulate($query);
188 
189  return true;
190  }
foreach($_POST as $key=> $value) $res
$query
global $ilDB
+ Here is the caller graph for this function:

◆ _deleteByCategoryId()

static ilCalendarCategoryAssignments::_deleteByCategoryId (   $a_cat_id)
static

Delete assignments by category id.

public

Parameters
intcategory_id
Returns

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

References $ilDB, $query, and $res.

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

201  {
202  global $ilDB;
203 
204  $query = "DELETE FROM cal_cat_assignments " .
205  "WHERE cat_id = " . $ilDB->quote($a_cat_id, 'integer') . " ";
206  $res = $ilDB->manipulate($query);
207  return true;
208  }
foreach($_POST as $key=> $value) $res
$query
global $ilDB
+ Here is the caller graph for this function:

◆ _getAppointmentCalendars()

static ilCalendarCategoryAssignments::_getAppointmentCalendars (   $a_cal_ids)
static

lookup calendars for appointment ids

public

Parameters
array$a_cal_ids

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

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

Referenced by ilCalendarSchedule\calculate().

100  {
101  global $ilDB;
102 
103  $query = "SELECT * FROM cal_cat_assignments " .
104  "WHERE " . $ilDB->in('cal_id', $a_cal_ids, false, 'integer');
105  $res = $ilDB->query($query);
106  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
107  $map[$row->cal_id] = $row->cat_id;
108  }
109  return $map ? $map : array();
110  }
foreach($_POST as $key=> $value) $res
$query
Create styles array
The data for the language used.
global $ilDB
+ Here is the caller graph for this function:

◆ _getAssignedAppointments()

static ilCalendarCategoryAssignments::_getAssignedAppointments (   $a_cat_id)
static

Get assigned apointments.

public

Parameters
array$a_cat_id

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

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

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

120  {
121  global $ilDB;
122 
123  $query = "SELECT * FROM cal_cat_assignments " .
124  "WHERE " . $ilDB->in('cat_id', $a_cat_id, false, 'integer');
125 
126  $res = $ilDB->query($query);
127  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
128  $cal_ids[] = $row->cal_id;
129  }
130  return $cal_ids ? $cal_ids : array();
131  }
foreach($_POST as $key=> $value) $res
$query
Create styles array
The data for the language used.
global $ilDB
+ Here is the caller graph for this function:

◆ _getAutoGeneratedAppointmentsByObjId()

static ilCalendarCategoryAssignments::_getAutoGeneratedAppointmentsByObjId (   $a_obj_id)
static

get automatic generated appointments of category

public

Parameters
intobj_id
Returns

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

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

Referenced by ilCalendarAppEventListener\deleteAppointments().

159  {
160  global $ilDB;
161 
162  $query = "SELECT ce.cal_id FROM cal_categories cc " .
163  "JOIN cal_cat_assignments cca ON cc.cat_id = cca.cat_id " .
164  "JOIN cal_entries ce ON cca.cal_id = ce.cal_id " .
165  "WHERE auto_generated = 1 " .
166  "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " ";
167  $res = $ilDB->query($query);
168  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
169  $apps[] = $row->cal_id;
170  }
171  return $apps ? $apps : array();
172  }
foreach($_POST as $key=> $value) $res
$query
Create styles array
The data for the language used.
global $ilDB
+ Here is the caller graph for this function:

◆ _lookupCategories()

static ilCalendarCategoryAssignments::_lookupCategories (   $a_cal_id)
static

lookup categories

public

Parameters
intcal_id
Returns
array of categories

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

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

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

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(ilDBConstants::FETCHMODE_OBJECT)) {
71  $cat_ids[] = $row->cat_id;
72  }
73  return $cat_ids ? $cat_ids : array();
74  }
foreach($_POST as $key=> $value) $res
$query
Create styles array
The data for the language used.
global $ilDB
+ Here is the caller graph for this function:

◆ _lookupCategory()

◆ addAssignment()

ilCalendarCategoryAssignments::addAssignment (   $a_cal_cat_id)

add assignment

public

Parameters
intcalendar category id
Returns

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

References $ilDB, $query, and $res.

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

240  {
241  global $ilDB;
242 
243  $query = "INSERT INTO cal_cat_assignments (cal_id,cat_id) " .
244  "VALUES ( " .
245  $this->db->quote($this->cal_entry_id, 'integer') . ", " .
246  $this->db->quote($a_cal_cat_id, 'integer') . " " .
247  ")";
248  $res = $ilDB->manipulate($query);
249  $this->assignments[] = (int) $a_cal_cat_id;
250 
251  return true;
252  }
foreach($_POST as $key=> $value) $res
$query
global $ilDB
+ Here is the caller graph for this function:

◆ deleteAssignment()

ilCalendarCategoryAssignments::deleteAssignment (   $a_cat_id)

delete assignment

public

Parameters
intcalendar category id
Returns

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

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

262  {
263  global $ilDB;
264 
265  $query = "DELETE FROM cal_cat_assignments " .
266  "WHERE cal_id = " . $this->db->quote($this->cal_entry_id, 'integer') . ", " .
267  "AND cat_id = " . $this->db->quote($a_cat_id, 'integer') . " ";
268  $res = $ilDB->manipulate($query);
269 
270  if (($key = array_search($a_cat_id, $this->assignments)) !== false) {
271  unset($this->assignments[$key]);
272  }
273  return true;
274  }
foreach($_POST as $key=> $value) $res
$query
global $ilDB
$key
Definition: croninfo.php:18

◆ deleteAssignments()

ilCalendarCategoryAssignments::deleteAssignments ( )

delete assignments

public

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

References $ilDB, $query, and $res.

282  {
283  global $ilDB;
284 
285  $query = "DELETE FROM cal_cat_assignments " .
286  "WHERE cal_id = " . $this->db->quote($this->cal_entry_id, 'integer') . " ";
287  $res = $ilDB->manipulate($query);
288  return true;
289  }
foreach($_POST as $key=> $value) $res
$query
global $ilDB

◆ getAssignments()

ilCalendarCategoryAssignments::getAssignments ( )

get assignments

public

Returns

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

References array.

228  {
229  return $this->assignments ? $this->assignments : array();
230  }
Create styles array
The data for the language used.

◆ getFirstAssignment()

ilCalendarCategoryAssignments::getFirstAssignment ( )

get first assignment

public

Returns

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

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

217  {
218  return isset($this->assignments[0]) ? $this->assignments[0] : false;
219  }
+ Here is the caller graph for this function:

◆ lookupNumberOfAssignedAppointments()

static ilCalendarCategoryAssignments::lookupNumberOfAssignedAppointments (   $a_cat_ids)
static

Get number of assigned appoitments.

Parameters
type$a_cat_id

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

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

Referenced by ilCalendarCategoryGUI\doImportFile().

138  {
139  global $ilDB;
140 
141  $query = 'SELECT COUNT(*) num FROM cal_cat_assignments ' .
142  'WHERE ' . $ilDB->in('cat_id', $a_cat_ids, false, 'integer');
143  $res = $ilDB->query($query);
144  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
145  return $row->num;
146  }
147  return 0;
148  }
foreach($_POST as $key=> $value) $res
$query
global $ilDB
+ Here is the caller graph for this function:

◆ read()

ilCalendarCategoryAssignments::read ( )
private

read assignments

private

Returns

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

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

Referenced by __construct().

299  {
300  global $ilDB;
301 
302  $query = "SELECT * FROM cal_cat_assignments " .
303  "WHERE cal_id = " . $this->db->quote($this->cal_entry_id, 'integer') . " ";
304 
305  $res = $this->db->query($query);
306  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
307  $this->assignments[] = $row->cat_id;
308  }
309  }
foreach($_POST as $key=> $value) $res
$query
global $ilDB
+ 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: