52 $this->cal_entry_id = $a_cal_entry_id;
71 $query =
"SELECT cat_id FROM cal_cat_assignments " .
72 "WHERE cal_id = " .
$ilDB->quote($a_cal_id,
'integer') .
" ";
75 $cat_ids[] =
$row->cat_id;
77 return $cat_ids ? $cat_ids : array();
90 if (count($cats = self::_lookupCategories($a_cal_id))) {
107 $ilDB = $DIC[
'ilDB'];
109 $query =
"SELECT * FROM cal_cat_assignments " .
110 "WHERE " .
$ilDB->in(
'cal_id', $a_cal_ids,
false,
'integer');
129 $ilDB = $DIC[
'ilDB'];
131 $query =
"SELECT * FROM cal_cat_assignments " .
132 "WHERE " .
$ilDB->in(
'cat_id', $a_cat_id,
false,
'integer');
136 $cal_ids[] =
$row->cal_id;
138 return $cal_ids ? $cal_ids : array();
149 $ilDB = $DIC[
'ilDB'];
151 $query =
'SELECT COUNT(*) num FROM cal_cat_assignments ' .
152 'WHERE ' .
$ilDB->in(
'cat_id', $a_cat_ids,
false,
'integer');
172 $ilDB = $DIC[
'ilDB'];
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') .
" ";
181 $apps[] =
$row->cal_id;
183 return $apps ? $apps : array();
197 $ilDB = $DIC[
'ilDB'];
199 $query =
"DELETE FROM cal_cat_assignments " .
200 "WHERE cal_id = " .
$ilDB->quote($a_app_id,
'integer') .
" ";
218 $ilDB = $DIC[
'ilDB'];
220 $query =
"DELETE FROM cal_cat_assignments " .
221 "WHERE cat_id = " .
$ilDB->quote($a_cat_id,
'integer') .
" ";
234 return isset($this->assignments[0]) ? $this->assignments[0] :
false;
245 return $this->assignments ? $this->assignments : array();
259 $ilDB = $DIC[
'ilDB'];
261 $query =
"INSERT INTO cal_cat_assignments (cal_id,cat_id) " .
263 $this->db->quote($this->cal_entry_id,
'integer') .
", " .
264 $this->db->quote($a_cal_cat_id,
'integer') .
" " .
267 $this->assignments[] = (int) $a_cal_cat_id;
283 $ilDB = $DIC[
'ilDB'];
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') .
" ";
290 if ((
$key = array_search($a_cat_id, $this->assignments)) !==
false) {
291 unset($this->assignments[
$key]);
305 $ilDB = $DIC[
'ilDB'];
307 $query =
"DELETE FROM cal_cat_assignments " .
308 "WHERE cal_id = " . $this->db->quote($this->cal_entry_id,
'integer') .
" ";
324 $ilDB = $DIC[
'ilDB'];
326 $query =
"SELECT * FROM cal_cat_assignments " .
327 "WHERE cal_id = " . $this->db->quote($this->cal_entry_id,
'integer') .
" ";
331 $this->assignments[] =
$row->cat_id;
__construct($a_cal_entry_id)
Constructor.
static _lookupCategory($a_cal_id)
Lookup category id.
getAssignments()
get assignments
static lookupNumberOfAssignedAppointments($a_cat_ids)
Get number of assigned appoitments.
static _lookupCategories($a_cal_id)
lookup categories
deleteAssignments()
delete assignments
foreach($_POST as $key=> $value) $res
static _getAutoGeneratedAppointmentsByObjId($a_obj_id)
get automatic generated appointments of category
deleteAssignment($a_cat_id)
delete assignment
static _deleteByAppointmentId($a_app_id)
Delete appointment assignment.
static _deleteByCategoryId($a_cat_id)
Delete assignments by category id.
addAssignment($a_cal_cat_id)
add assignment
static _getAssignedAppointments($a_cat_id)
Get assigned apointments.
getFirstAssignment()
get first assignment
static _getAppointmentCalendars($a_cal_ids)
lookup calendars for appointment ids