49 0 => self::TYPE_GLOBAL,
59 protected $type = self::TYPE_USR;
85 $this->cat_id = $a_cat_id;
101 $ilDB = $DIC[
'ilDB'];
103 $query =
"SELECT cat_id FROM cal_categories " .
104 "WHERE obj_id = " .
$ilDB->quote($a_obj_id,
'integer') .
" " .
105 "AND type = " .
$ilDB->quote(self::TYPE_OBJ,
'integer');
120 if (!self::$instances[$a_cat_id]) {
123 return self::$instances[$a_cat_id];
131 return array_search($a_type_id, self::$SORTED_TYPES);
142 $ilDB = $DIC[
'ilDB'];
144 $query =
"SELECT * FROM cal_cat_assignments " .
145 'WHERE cat_id = ' .
$ilDB->quote($a_category_id,
'integer');
148 $apps[] =
$row->cal_id;
150 return $apps ? $apps : array();
174 $this->title = $a_title;
197 $this->
color = $a_color;
241 $this->obj_id = $a_obj_id;
277 $this->remote_url = $a_url;
287 $this->remote_user = $a_user;
297 $this->remote_pass = $a_pass;
311 $this->remote_sync = $dt;
320 if ($this->remote_sync instanceof
ilDateTime) {
323 return new ilDateTime();
337 $ilDB = $DIC[
'ilDB'];
339 $next_id =
$ilDB->nextId(
'cal_categories');
341 $query =
"INSERT INTO cal_categories (cat_id,obj_id,color,type,title,loc_type,remote_url,remote_user,remote_pass,remote_sync) " .
343 $ilDB->quote($next_id,
'integer') .
", " .
344 $this->db->quote($this->
getObjId(),
'integer') .
", " .
345 $this->db->quote($this->
getColor(),
'text') .
", " .
346 $this->db->quote($this->
getType(),
'integer') .
", " .
347 $this->db->quote($this->
getTitle(),
'text') .
", " .
349 $this->db->quote($this->
getRemoteUrl(),
'text') .
', ' .
357 $this->cat_id = $next_id;
371 $ilDB = $DIC[
'ilDB'];
373 $query =
"UPDATE cal_categories " .
374 "SET obj_id = " . $this->db->quote($this->
getObjId(),
'integer') .
", " .
375 "color = " . $this->db->quote($this->
getColor(),
'text') .
", " .
376 "type = " . $this->db->quote($this->
getType(),
'integer') .
", " .
377 "title = " . $this->db->quote($this->
getTitle(),
'text') .
", " .
378 "loc_type = " . $this->db->quote($this->
getLocationType(),
'integer') .
', ' .
379 "remote_url = " . $this->db->quote($this->
getRemoteUrl(),
'text') .
', ' .
380 "remote_user = " . $this->db->quote($this->
getRemoteUser(),
'text') .
', ' .
381 "remote_pass = " . $this->db->quote($this->
getRemotePass(),
'text') .
', ' .
383 "WHERE cat_id = " . $this->db->quote($this->cat_id,
'integer') .
" ";
394 public function delete()
398 $ilDB = $DIC[
'ilDB'];
400 $query =
"DELETE FROM cal_categories " .
401 "WHERE cat_id = " . $this->db->quote($this->cat_id,
'integer') .
" ";
404 include_once(
'./Services/Calendar/classes/class.ilCalendarVisibility.php');
407 include_once(
'./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
409 include_once(
'./Services/Calendar/classes/class.ilCalendarEntry.php');
441 $ilDB = $DIC[
'ilDB'];
443 if (!$this->cat_id) {
447 $query =
"SELECT * FROM cal_categories " .
448 "WHERE cat_id = " . $this->db->quote($this->
getCategoryID(),
'integer') .
" ";
451 $this->cat_id =
$row->cat_id;
452 $this->obj_id =
$row->obj_id;
453 $this->type =
$row->type;
455 $this->title =
$row->title;
456 $this->location =
$row->loc_type;
457 $this->remote_url =
$row->remote_url;
458 $this->remote_user =
$row->remote_user;
459 $this->remote_pass =
$row->remote_pass;
461 if (
$row->remote_sync) {
467 if ($this->
getType() == self::TYPE_OBJ) {
static lookupCategorySortIndex($a_type_id)
Lookup sort index of calendar type.
if(PHP_SAPI !='cli') color
static _deleteCategories($a_cat_id)
delete by category
setObjId($a_obj_id)
set obj id
setColor($a_color)
set color
getRemoteSyncLastExecution()
Get last execution date of remote sync.
static _lookupTitle($a_id)
lookup object title
Stores calendar categories.
__construct($a_cat_id=0)
Constructor.
static _delete($a_entry_id)
delete entry
static lookupAppointments($a_category_id)
get all assigned appointment ids
foreach($_POST as $key=> $value) $res
static _getInstanceByObjId($a_obj_id)
get instance by obj_id
static getInstanceByCategoryId($a_cat_id)
Get instance by category id.
static _lookupType($a_id, $a_reference=false)
lookup object type
static _deleteByCategoryId($a_cat_id)
Delete assignments by category id.
static _getAssignedAppointments($a_cat_id)
Get assigned apointments.
setTitle($a_title)
set title
getCategoryID()
get category id
setRemoteSyncLastExecution(ilDateTime $dt=null)
Set remote sync last execution.