19 declare(strict_types=1);
    43         0 => self::TYPE_GLOBAL,
    52     protected int $type = self::TYPE_USR;
    69         $this->db = $DIC->database();
    70         $this->cat_id = $a_cat_id;
    83         $query = 
"SELECT cat_id FROM cal_categories " .
    84             "WHERE obj_id = " . 
$ilDB->quote($a_obj_id, 
'integer') . 
" " .
    85             "AND type = " . 
$ilDB->quote(self::TYPE_OBJ, 
'integer');
    95         if (!isset(self::$instances[$a_cat_id])) {
    98         return self::$instances[$a_cat_id];
   106         return (
int) array_search($a_type_id, self::$SORTED_TYPES);
   117         $ilDB = $DIC[
'ilDB'];
   118         $query = 
"SELECT * FROM cal_cat_assignments " .
   119             'WHERE cat_id = ' . 
$ilDB->quote($a_category_id, 
'integer');
   123             $apps[] = (
int) $row->cal_id;
   135         $this->title = $a_title;
   145         $this->color = $a_color;
   155         $this->type = $a_type;
   165         $this->obj_id = $a_obj_id;
   185         $this->location = $a_type;
   190         $this->remote_url = $a_url;
   200         $this->remote_user = $a_user;
   210         $this->remote_pass = $a_pass;
   223         $this->remote_sync = $dt;
   231         if ($this->remote_sync instanceof 
ilDateTime) {
   234         return new ilDateTime();
   239         $next_id = $this->db->nextId(
'cal_categories');
   240         $query = 
"INSERT INTO cal_categories (cat_id,obj_id,color,type,title,loc_type,remote_url,remote_user,remote_pass,remote_sync) " .
   242             $this->db->quote($next_id, 
'integer') . 
", " .
   243             $this->db->quote($this->
getObjId(), 
'integer') . 
", " .
   244             $this->db->quote($this->
getColor(), 
'text') . 
", " .
   245             $this->db->quote($this->
getType(), 
'integer') . 
", " .
   250             $this->db->quote(mb_substr($this->
getTitle(), 0, 128), 
'text') . 
", " .
   252             $this->db->quote($this->
getRemoteUrl(), 
'text') . 
', ' .
   261         $this->db->manipulate($query);
   263         $this->cat_id = $next_id;
   269         $query = 
"UPDATE cal_categories " .
   270             "SET obj_id = " . $this->db->quote($this->
getObjId(), 
'integer') . 
", " .
   271             "color = " . $this->db->quote($this->
getColor(), 
'text') . 
", " .
   272             "type = " . $this->db->quote($this->
getType(), 
'integer') . 
", " .
   277             "title = " . $this->db->quote(mb_substr($this->
getTitle(), 0, 128), 
'text') . 
", " .
   278             "loc_type = " . $this->db->quote($this->
getLocationType(), 
'integer') . 
', ' .
   279             "remote_url = " . $this->db->quote($this->
getRemoteUrl(), 
'text') . 
', ' .
   280             "remote_user = " . $this->db->quote($this->
getRemoteUser(), 
'text') . 
', ' .
   281             "remote_pass = " . $this->db->quote($this->
getRemotePass(), 
'text') . 
', ' .
   286             ), 
'timestamp') . 
' ' .
   287             "WHERE cat_id = " . $this->db->quote($this->cat_id, 
'integer') . 
" ";
   288         $res = $this->db->manipulate($query);
   291     public function delete(): 
void   293         $query = 
"DELETE FROM cal_categories " .
   294             "WHERE cat_id = " . $this->db->quote($this->cat_id, 
'integer') . 
" ";
   295         $res = $this->db->manipulate($query);
   318         if (!$this->cat_id) {
   322         $query = 
"SELECT * FROM cal_categories " .
   323             "WHERE cat_id = " . $this->db->quote($this->
getCategoryID(), 
'integer') . 
" ";
   324         $res = $this->db->query($query);
   326             $this->cat_id = (
int) $row->cat_id;
   327             $this->obj_id = (
int) $row->obj_id;
   328             $this->type = (
int) $row->type;
   329             $this->color = (
string) $row->color;
   330             $this->title = (string) $row->title;
   331             $this->location = (
int) $row->loc_type;
   332             $this->remote_url = (string) $row->remote_url;
   333             $this->remote_user = (
string) $row->remote_user;
   334             $this->remote_pass = (string) $row->remote_pass;
   336             if ($row->remote_sync) {
   342         if ($this->
getType() == self::TYPE_OBJ) {
 
setTitle(string $a_title)
 
setRemoteSyncLastExecution(ilDateTime $dt)
Set remote sync last execution. 
 
if(!file_exists('../ilias.ini.php'))
 
getRemoteSyncLastExecution()
Get last execution date of remote sync. 
 
setColor(string $a_color)
 
Stores calendar categories. 
 
static _getInstanceByObjId(int $a_obj_id)
get instance by obj_id 
 
static _delete(int $a_entry_id)
 
static _deleteCategories(int $a_cat_id)
 
setRemoteUrl(string $a_url)
 
static _lookupTitle(int $obj_id)
 
static array $SORTED_TYPES
 
setRemotePass(string $a_pass)
 
setRemoteUser(string $a_user)
 
__construct(int $a_cat_id=0)
 
static lookupCategorySortIndex(int $a_type_id)
Lookup sort index of calendar type. 
 
static lookupAppointments(int $a_category_id)
get all assigned appointment ids 
 
static getInstanceByCategoryId(int $a_cat_id)
 
static _getAssignedAppointments(array $a_cat_id)
Get assigned apointments. 
 
static _deleteByCategoryId(int $a_cat_id)
Delete assignments by category id  public. 
 
static _lookupType(int $id, bool $reference=false)
 
setLocationType(int $a_type)