3 declare(strict_types=1);
41 $this->db = $DIC->database();
42 $this->cal_entry_id = $a_cal_entry_id;
51 $query =
"SELECT cat_id FROM cal_cat_assignments " .
52 "WHERE cal_id = " .
$ilDB->quote($a_cal_id,
'integer') .
" ";
56 $cat_ids[] = (
int) $row->cat_id;
63 if (count($cats = self::_lookupCategories($a_cal_id))) {
78 $query =
"SELECT * FROM cal_cat_assignments " .
79 "WHERE " .
$ilDB->in(
'cal_id', $a_cal_ids,
false,
'integer');
83 $map[(
int) $row->cal_id] = (
int) $row->cat_id;
98 $query =
"SELECT * FROM cal_cat_assignments " .
99 "WHERE " .
$ilDB->in(
'cat_id', $a_cat_id,
false,
'integer');
104 $cal_ids[] = (
int) $row->cal_id;
117 $ilDB = $DIC[
'ilDB'];
118 $query =
'SELECT COUNT(*) num FROM cal_cat_assignments ' .
119 'WHERE ' .
$ilDB->in(
'cat_id', $a_cat_ids,
false,
'integer');
122 return (
int) $row->num;
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') .
" ";
144 $apps[] = (
int) $row->cal_id;
156 $ilDB = $DIC[
'ilDB'];
157 $query =
"DELETE FROM cal_cat_assignments " .
158 "WHERE cal_id = " .
$ilDB->quote($a_app_id,
'integer') .
" ";
173 $ilDB = $DIC[
'ilDB'];
174 $query =
"DELETE FROM cal_cat_assignments " .
175 "WHERE cat_id = " .
$ilDB->quote($a_cat_id,
'integer') .
" ";
184 return $this->assignments[0] ?? null;
197 $query =
"INSERT INTO cal_cat_assignments (cal_id,cat_id) " .
199 $this->db->quote($this->cal_entry_id,
'integer') .
", " .
200 $this->db->quote($a_cal_cat_id,
'integer') .
" " .
203 $this->assignments[] = $a_cal_cat_id;
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') .
" ";
213 if ((
$key = array_search($a_cat_id, $this->assignments)) !==
false) {
214 unset($this->assignments[
$key]);
220 $query =
"DELETE FROM cal_cat_assignments " .
221 "WHERE cal_id = " . $this->db->quote($this->cal_entry_id,
'integer') .
" ";
227 $query =
"SELECT * FROM cal_cat_assignments " .
228 "WHERE cal_id = " . $this->db->quote($this->cal_entry_id,
'integer') .
" ";
232 $this->assignments[] = (
int) $row->cat_id;
static _lookupCategory(int $a_cal_id)
__construct(int $a_cal_entry_id)
static _getAppointmentCalendars(array $a_cal_ids)
deleteAssignment(int $a_cat_id)
static _deleteByAppointmentId(int $a_app_id)
Delete appointment assignment.
static _lookupCategories(int $a_cal_id)
addAssignment(int $a_cal_cat_id)
static _getAssignedAppointments(array $a_cat_id)
Get assigned apointments.
static _deleteByCategoryId(int $a_cat_id)
Delete assignments by category id public.
static lookupNumberOfAssignedAppointments(array $a_cat_ids)
static _getAutoGeneratedAppointmentsByObjId(int $a_obj_id)
get automatic generated appointments of category
getFirstAssignment()
get first assignment