19declare(strict_types=1);
42 $this->fav_manager = new \ilFavouritesManager();
47 $user = $this->domain->user();
48 $period = $this->session_repo->getDashboardNewsPeriod();
57 $user = $this->domain->user();
58 return (
int) $user->getPref(
"news_sel_ref_id");
63 $user = $this->domain->user();
64 if (!is_null(
$data) && !is_null(
$data[
"news_ref_id"])) {
65 $user->writePref(
"news_sel_ref_id", (
string) (
int)
$data[
"news_ref_id"]);
67 $user->writePref(
"news_sel_ref_id",
"0");
69 $this->session_repo->setDashboardNewsPeriod((
int) (
$data[
"news_per"] ?? 0));
77 $lng = $this->domain->lng();
78 $news_set = new \ilSetting(
"news");
79 $allow_shorter_periods = $news_set->get(
"allow_shorter_periods");
80 $allow_longer_periods = $news_set->get(
"allow_longer_periods");
84 "7" =>
$lng->txt(
"news_period_1_week"),
85 "30" =>
$lng->txt(
"news_period_1_month"),
86 "366" =>
$lng->txt(
"news_period_1_year")
113 $context_count = $this->repo->news()->countByContextsBatch(
114 $this->domain->resolver()->getAccessibleContexts(
115 $this->domain->user(),
121 foreach ($context_count as [$context, $count]) {
126 return [0 => $this->domain->lng()->txt(
'news_all_items')] +
$options;
DashboardSessionRepository $session_repo
ilFavouritesManager $fav_manager
getDashboardSelectedRefId()
saveFilterData(?array $data)
__construct(protected InternalDataService $data, protected InternalRepoService $repo, protected InternalDomainService $domain)
News Criteria DTO for querying news items supports caching, JSON serialization, and validation.
Repository internal data service.
Notes internal repo service.
static _lookupUserPDPeriod(int $a_user_id)
static _lookupDefaultPDPeriod()
static _lookupTitle(int $obj_id)