/** * Distribute mail notifications * @return */ protected function distributeNotifications($a_cat_id, $app_id, $a_new_appointment = true) { include_once './Services/Calendar/classes/class.ilCalendarCategory.php'; $cat_info = ilCalendarCategories::_getInstance()->getCategoryInfo($a_cat_id); include_once './Services/Calendar/classes/class.ilCalendarMailNotification.php'; $notification = new ilCalendarMailNotification(); $notification->setAppointmentId($app_id); switch ($cat_info['type']) { case ilCalendarCategory::TYPE_OBJ: switch ($cat_info['obj_type']) { case 'crs': $ref_ids = ilObject::_getAllReferences($cat_info['obj_id']); $ref_id = current($ref_ids); $notification->setRefId($ref_id); $notification->setType($a_new_appointment ? ilCalendarMailNotification::TYPE_CRS_NEW_NOTIFICATION : ilCalendarMailNotification::TYPE_CRS_NOTIFICATION); break; case 'grp': $ref_ids = ilObject::_getAllReferences($cat_info['obj_id']); $ref_id = current($ref_ids); $notification->setRefId($ref_id); $notification->setType($a_new_appointment ? ilCalendarMailNotification::TYPE_GRP_NEW_NOTIFICATION : ilCalendarMailNotification::TYPE_GRP_NOTIFICATION); break; } break; } $notification->send(); }