41 $this->
help = $DIC[
"ilHelp"];
42 $this->
user = $DIC->user();
43 $tpl = $DIC->ui()->mainTemplate();
44 $lng = $DIC->language();
45 $ilCtrl = $DIC->ctrl();
46 $ilHelp = $DIC[
"ilHelp"];
48 $ilHelp->setScreenIdComponent(
"news");
58 $this->
ctrl = $ilCtrl;
62 $this->
ctrl->saveParameter($this,
"news_ref_id");
68 $next_class = $this->
ctrl->getNextClass();
70 switch ($next_class) {
73 $cmd = $this->
ctrl->getCmd(
"view");
78 $this->tpl->printToStdout();
84 $this->tpl->setTitle($this->
lng->txt(
"news"));
88 public function view(): void
96 $pd_items = $this->fav_manager->getFavouritesOfUser(
$ilUser->getId());
97 foreach ($pd_items as $item) {
98 $ref_ids[] = (
int) $item[
"ref_id"];
99 $obj_ids[] = (
int) $item[
"obj_id"];
102 $sel_ref_id = ($this->std_request->getNewsRefId() > 0)
103 ? $this->std_request->getNewsRefId()
104 :
$ilUser->getPref(
"news_sel_ref_id");
112 $contexts[0] = $lng->
txt(
"news_all_items");
115 $sel_has_news =
false;
116 foreach ($ref_ids as
$ref_id) {
121 if ((
int) $sel_ref_id === $ref_id) {
122 $sel_has_news =
true;
137 if (!$sel_has_news) {
141 foreach ($conts as $ref_id => $title) {
142 $contexts[
$ref_id] = $title .
" (" . (
int) ($cnt[$ref_id] ?? 0) .
")";
146 if ($sel_ref_id > 0) {
149 $nitem->setContextObjId($obj_id);
150 $nitem->setContextObjType($obj_type);
151 $news_items = $nitem->getNewsForRefId(
160 $pd_news_table =
new ilPDNewsTableGUI($this,
"view", $contexts, $sel_ref_id);
161 $pd_news_table->setData($news_items);
162 $pd_news_table->setNoEntriesText($lng->
txt(
"news_no_news_items"));
171 $news_ref_id = $this->std_request->getNewsRefId();
172 $news_per = $this->std_request->getNewsPer();
174 $this->
ctrl->setParameter($this,
"news_ref_id", $news_ref_id);
175 $ilUser->writePref(
"news_sel_ref_id", (
string) $news_ref_id);
179 $this->
ctrl->redirect($this,
"view");
185 $this->
ctrl->setParameter($this,
"news_ref_id", 0);
186 $ilUser->writePref(
"news_sel_ref_id",
'0');
188 $this->
ctrl->redirect($this,
"view");
static get(string $a_var)
static _lookupUserPDPeriod(int $a_user_id)
static _getNewsItemsOfUser(int $a_user_id, bool $a_only_public=false, bool $a_prevent_aggregation=false, int $a_per=0, array &$a_cnt=[])
Get all news items for a user.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static filterObjIdsPerNews(array $a_obj_ids, $a_time_period=0, string $a_starting_date="", string $a_ending_date='', bool $ignore_period=false)
Checks whether news are available for.
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
loadLanguageModule(string $a_module)
Load language module.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Personal desktop news table.
static _lookupObjId(int $ref_id)
ilFavouritesManager $fav_manager
ilGlobalTemplateInterface $tpl
static _lookupTitle(int $obj_id)
setContent(string $a_html)
Sets content for standard template.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
A news item can be created by different sources.
StandardGUIRequest $std_request
static _lookupType(int $id, bool $reference=false)
static clear(string $a_var)
static set(string $a_var, $a_val)
Set a value.