72        $this->db = 
$DIC->database();
 
   73        $this->user_id = $a_user_id;
 
   74        $this->ref_id = $a_ref_id;
 
   88        if (!isset(self::$instances[$a_user_id][$a_ref_id])) {
 
   91        return self::$instances[$a_user_id][$a_ref_id];
 
  107        $query = 
"DELETE FROM cal_cat_visibility " .
 
  108            "WHERE cat_id = " . 
$ilDB->quote($a_cat_id, 
'integer') . 
" ";
 
  125        $query = 
"DELETE FROM cal_cat_visibility " .
 
  126            "WHERE user_id = " . 
$ilDB->quote($a_user_id, 
'integer') . 
" ";
 
  139        foreach ($category_info as $cat_id => 
$info) {
 
  144        return array_diff((array) $categories, 
$hidden);
 
  155        if ($this->obj_id == 0) {
 
  156            return in_array($a_cat_id, $this->hidden);
 
  162            || 
$info[
"source_ref_id"] == $this->ref_id)) {
 
  166        return !in_array($a_cat_id, $this->visible);
 
  178        include_once(
'./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
 
  181            if (in_array($cat_id, $this->hidden)) {
 
  196        return $this->hidden ? $this->hidden : array();
 
  207        return $this->visible ? $this->visible : array();
 
  219        $this->hidden = $a_hidden;
 
  232        $this->visible = $a_visible;
 
  249        foreach ($this->hidden as 
$hidden) {
 
  250            $query = 
"INSERT INTO cal_cat_visibility (user_id, cat_id, obj_id, visible) " .
 
  252                $this->db->quote($this->user_id, 
'integer') . 
", " .
 
  253                $this->db->quote(
$hidden, 
'integer') . 
", " .
 
  254                $this->db->quote($this->obj_id, 
'integer') . 
", " .
 
  255                $this->db->quote(self::HIDDEN, 
'integer') .
 
  259        foreach ($this->visible as 
$visible) {
 
  260            $query = 
"INSERT INTO cal_cat_visibility (user_id, cat_id, obj_id, visible) " .
 
  262                $this->db->quote($this->user_id, 
'integer') . 
", " .
 
  263                $this->db->quote(
$visible, 
'integer') . 
", " .
 
  264                $this->db->quote($this->obj_id, 
'integer') . 
", " .
 
  265                $this->db->quote(self::VISIBLE, 
'integer') .
 
  279    public function delete($a_cat_id = 
null)
 
  282            $query = 
"DELETE FROM cal_cat_visibility " .
 
  283                "WHERE user_id = " . $this->db->quote($this->user_id, 
'integer') . 
" " .
 
  284                "AND obj_id = " . $this->db->quote($this->obj_id, 
'integer') . 
" " .
 
  285                "AND cat_id = " . $this->db->quote($a_cat_id, 
'integer') . 
" ";
 
  287            $query = 
"DELETE FROM cal_cat_visibility " .
 
  288                "WHERE user_id = " . $this->db->quote($this->user_id, 
'integer') . 
" " .
 
  289                "AND obj_id = " . $this->db->quote($this->obj_id, 
'integer');
 
  291        $this->db->manipulate(
$query);
 
  303        $query = 
"SELECT * FROM cal_cat_visibility " .
 
  304            "WHERE user_id = " . $this->db->quote($this->user_id, 
'integer') . 
" " .
 
  305            " AND obj_id = " . $this->db->quote($this->obj_id, 
'integer');
 
  308            if (
$row->visible == self::HIDDEN) {
 
  309                $this->hidden[] = 
$row->cat_id;
 
  311            if (
$row->visible == self::VISIBLE) {
 
  312                $this->visible[] = 
$row->cat_id;
 
  325        if ((
$key = array_search($a_cat_id, $this->hidden)) !== 
false) {
 
  326            unset($this->hidden[
$key]);
 
  328        if (!in_array($a_cat_id, $this->visible)) {
 
  329            $this->visible[] = $a_cat_id;
 
An exception for terminatinating execution or to throw for unit testing.
static _lookupCategories($a_cal_id)
lookup categories
Stores selection of hidden calendars for a specific user.
hideSelected($a_hidden)
hide selected
getHidden()
get hidden categories
isAppointmentVisible($a_cal_id)
check whether an appoinment is visible or not
__construct($a_user_id, $a_ref_id=0)
Constructor.
isHidden($a_cat_id, $info)
Check if category is hidden.
read()
read user selection
static _deleteCategories($a_cat_id)
delete by category
forceVisibility($a_cat_id)
Force visibility.
filterHidden($categories, $category_info)
Filter hidden categories (and hidden subitem categories) from category array.
static _deleteUser($a_user_id)
Delete by user.
save()
save hidden selection
static _getInstanceByUserId($a_user_id, $a_ref_id=0)
get instance by user id
showSelected($a_visible)
Show selected.
getVisible()
get visible categories
static _lookupObjId($a_id)
foreach($_POST as $key=> $value) $res