19 declare(strict_types=1);
50 $this->fav_manager = new \ilFavouritesManager();
55 $user = $this->domain->user();
56 $period = $this->session_repo->getDashboardNewsPeriod();
65 $user = $this->domain->user();
66 return (
int) $user->getPref(
"news_sel_ref_id");
71 $user = $this->domain->user();
72 if (!is_null($data) && !is_null($data[
"news_ref_id"])) {
73 $user->writePref(
"news_sel_ref_id", (
string) (
int) $data[
"news_ref_id"]);
75 $user->writePref(
"news_sel_ref_id",
"0");
77 $this->session_repo->setDashboardNewsPeriod((
int) ($data[
"news_per"] ?? 0));
85 $lng = $this->domain->lng();
86 $news_set = new \ilSetting(
"news");
87 $allow_shorter_periods = $news_set->get(
"allow_shorter_periods");
88 $allow_longer_periods = $news_set->get(
"allow_longer_periods");
92 7 =>
$lng->txt(
"news_period_1_week"),
93 30 =>
$lng->txt(
"news_period_1_month"),
94 366 =>
$lng->txt(
"news_period_1_year")
121 $lng = $this->domain->lng();
122 $user = $this->domain->user();
137 $contexts[0] =
$lng->txt(
"news_all_items");
140 foreach ($ref_ids as
$ref_id) {
147 foreach ($conts as $ref_id => $title) {
148 $contexts[
$ref_id] = $title .
" (" . (
int) ($cnt[$ref_id] ?? 0) .
")";
161 if (is_null(self::$user_object_ref_ids)) {
163 $user = $this->domain->user();
167 $fav_items = $this->fav_manager->getFavouritesOfUser(
$user_id);
168 foreach ($fav_items as $item) {
169 if (!in_array($item[
"ref_id"], $ref_ids)) {
170 $ref_ids[] = (
int) $item[
"ref_id"];
177 $items = array_merge($crs_mbs, $grp_mbs);
178 foreach ($items as $i) {
180 $ref_ids = array_unique(array_merge($ref_ids, $item_references));
182 self::$user_object_ref_ids = $ref_ids;
184 return self::$user_object_ref_ids;
190 bool $include_auto_entries,
193 $user = $this->domain->user();
194 $news_item = new \ilNewsItem();
199 $news_data = $news_item->getNewsForRefId(
206 !$include_auto_entries,
219 !$include_auto_entries
ilFavouritesManager $fav_manager
static _lookupUserPDPeriod(int $a_user_id)
getUserNewsObjectRefIds()
User news on the daashboard/news overview are presented for all favourites and all memberships of the...
getDashboardSelectedRefId()
static _getNewsItemsOfUser(int $a_user_id, bool $a_only_public=false, bool $a_prevent_aggregation=false, int $a_per=0, array &$a_cnt=[], bool $no_auto_generated=false, array $excluded=[], int $a_limit=0)
Get all news items for a user.
static _getAllReferences(int $id)
get all reference ids for object ID
saveFilterData(?array $data)
InternalDomainService $domain
Notes internal repo service.
static _lookupObjId(int $ref_id)
InternalRepoService $repo
static array $user_object_ref_ids
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
DashboardSessionRepository $session_repo
static _lookupTitle(int $obj_id)
getNewsForOverview(int $ref_id, int $period, bool $include_auto_entries, int $items_per_load)
InternalDataService $data
__construct(InternalDataService $data, InternalRepoService $repo, InternalDomainService $domain)
static _getMembershipByType(int $a_usr_id, array $a_type, bool $a_only_member_role=false)
get membership by type Get course or group membership
static _lookupDefaultPDPeriod()
Repository internal data service.