42 $lng = $DIC->language();
43 $ilAccess = $DIC->access();
44 $this->obj_definition = $DIC[
"objDefinition"];
52 $this->dynamic =
false;
54 $this->std_request = $DIC->news()
60 $cres = unserialize((
string) $this->acache->getEntry($this->user->getId() .
":0"), [
"allowed_classes" =>
false]);
61 $this->cache_hit =
false;
62 if (is_array($cres) && $this->acache->getLastAccessStatus() ===
"hit") {
64 $this->cache_hit =
true;
68 if (empty(self::$st_data)) {
71 $data = self::$st_data;
74 $this->
setRowTemplate(
"tpl.block_row_news_for_context.html",
"Services/News");
81 $ilAccess->setResults((array) $this->acc_results);
100 $this->acache->storeEntry(
101 $ilUser->getId() .
":0",
110 return self::$block_type;
117 $cmd = $DIC->ctrl()->getCmd();
123 case "changeFeedSettings":
136 $cmd = $ilCtrl->getCmd(
"getHTML");
138 switch ($next_class) {
140 return $this->$cmd();
154 $enable_internal_rss = $news_set->get(
"enable_rss_for_internal");
155 $allow_shorter_periods = $news_set->get(
"allow_shorter_periods");
156 $allow_longer_periods = $news_set->get(
"allow_longer_periods");
157 $enable_private_feed = $news_set->get(
"enable_private_feed");
159 if ($enable_internal_rss) {
162 $ilCtrl->getLinkTarget($this,
"showFeedUrl"),
167 if ($allow_shorter_periods || $allow_longer_periods || $enable_private_feed) {
169 $ilCtrl->getLinkTarget($this,
"editSettings"),
175 if ($ilUser->getPref(
"il_feed_js") ===
"n") {
191 if ($news_set->get(
"enable_private_feed")) {
192 $tpl =
new ilTemplate(
"tpl.show_priv_feed_url.html",
true,
true,
"Services/News");
202 str_replace(
"://",
"://" . $ilUser->getLogin() .
":-password-@", ILIAS_HTTP_PATH) .
"/privfeed.php?client_id=" . rawurlencode(
CLIENT_ID) .
"&user_id=" . $ilUser->getId() .
206 "VAL_PRIV_FEED_URL_TXT",
207 str_replace(
"://",
"://" . $ilUser->getLogin() .
":-password-@", ILIAS_HTTP_PATH) .
"/privfeed.php?client_id=" . rawurlencode(
CLIENT_ID) .
"&<br />user_id=" . $ilUser->getId() .
212 $tpl->
setVariable(
"EDIT_SETTINGS_URL", $ilCtrl->getLinkTarget($this,
"editSettings"));
216 $tpl =
new ilTemplate(
"tpl.show_feed_url.html",
true,
true,
"Services/News");
223 ILIAS_HTTP_PATH .
"/feed.php?client_id=" . rawurlencode(
CLIENT_ID) .
"&user_id=" . $ilUser->getId() .
228 ILIAS_HTTP_PATH .
"/feed.php?client_id=" . rawurlencode(
CLIENT_ID) .
"&<br />user_id=" . $ilUser->getId() .
233 $panel = $this->
ui->factory()->panel()->standard(
234 $lng->
txt(
"news_internal_news"),
235 $this->
ui->factory()->legacy(
$tpl->
get())
238 return $this->
ui->renderer()->render($panel);
249 $allow_shorter_periods = $news_set->get(
"allow_shorter_periods");
250 $allow_longer_periods = $news_set->get(
"allow_longer_periods");
251 $enable_private_feed = $news_set->get(
"enable_private_feed");
253 if (!$a_private_form && ($allow_shorter_periods || $allow_longer_periods)) {
255 $form->setFormAction($ilCtrl->getFormAction($this));
256 $form->setTitle(
$lng->
txt(
"news_settings"));
261 $form->setTableWidth(
"100%");
268 14 =>
"2 " .
$lng->
txt(
"weeks"),
269 30 =>
"1 " .
$lng->
txt(
"month"),
270 60 =>
"2 " .
$lng->
txt(
"months"),
271 120 =>
"4 " .
$lng->
txt(
"months"),
272 180 =>
"6 " .
$lng->
txt(
"months"),
273 366 =>
"1 " .
$lng->
txt(
"year")
277 foreach ($per_opts as $k => $opt) {
278 if (!$allow_shorter_periods && ($k < $default_per)) {
281 if (!$allow_longer_periods && ($k > $default_per)) {
285 foreach ($unset as $k) {
286 unset($per_opts[$k]);
294 $per_sel->setValue((
string) $per);
295 $form->addItem($per_sel);
297 $form->addCommandButton(
"saveSettings",
$lng->
txt(
"save"));
298 $form->addCommandButton(
"cancelSettings",
$lng->
txt(
"cancel"));
300 $returnForm = $form->getHTML();
303 if ($enable_private_feed) {
304 if (!$a_private_form) {
307 $returnForm .= ($returnForm ===
"")
308 ? $a_private_form->getHTML()
309 :
"<br>" . $a_private_form->getHTML();
322 $feed_form->setFormAction($ilCtrl->getFormAction($this));
323 $feed_form->setTitle(
$lng->
txt(
"priv_feed_settings"));
325 $feed_form->setTableWidth(
"100%");
329 $feed_form->addItem($enable_private_feed);
334 $enable_private_feed->addSubItem($passwd);
336 $feed_form->addCommandButton(
"changeFeedSettings",
$lng->
txt(
"save"));
337 $feed_form->addCommandButton(
"cancelSettings",
$lng->
txt(
"cancel"));
352 $this->std_request->getDashboardPeriod(),
358 $cache->deleteEntry($ilUser->getId() .
":0");
360 $ilCtrl->returnToParent($this);
371 if ($form->checkInput()) {
373 if (!$form->getInput(
"enable_private_feed")) {
375 $this->main_tpl->setOnScreenMessage(
'success',
$lng->
txt(
"priv_feed_disabled"),
true);
377 $ilCtrl->redirect($this,
"showFeedUrl");
379 $passwd = $form->getInput(
"desired_password");
381 $form->getItemByPostVar(
"desired_password")->setAlert(
$lng->
txt(
"passwd_equals_ilpasswd"));
382 $this->main_tpl->setOnScreenMessage(
'failure',
$lng->
txt(
"form_input_not_valid"));
385 $this->main_tpl->setOnScreenMessage(
'success',
$lng->
txt(
"saved_successfully"),
true);
386 $ilCtrl->redirect($this,
"showFeedUrl");
391 $form->setValuesByPost();
initPrivateSettingsForm()
static string $block_type
static _setFeedPass(int $a_user_id, string $a_password)
Set news feed password for user.
static _lookupUserPDPeriod(int $a_user_id)
StandardGUIRequest $std_request
get(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
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...
handleView()
Handles show/hide notification view and removes notifications if hidden.
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.
editSettings()
Show settings screen.
loadLanguageModule(string $a_module)
Load language module.
BlockGUI class for block NewsForContext.
editSettings(ilPropertyFormGUI $a_private_form=null)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setRowTemplate(string $a_rowtemplatename, string $a_rowtemplatedir="")
Set Row Template Name.
getNextClass($a_gui_class=null)
setVariable($variable, $value='')
Sets a variable value.
static _getFeedPass(int $a_user_id)
Lookup news feed password for user.
static _write(string $a_type, string $a_setting, string $a_value, int $a_user=0, int $a_block_id=0)
Write setting to database.
addBlockCommand(string $a_href, string $a_text, string $a_onclick="", RoundTrip $modal=null)
static getPasswordRequirementsInfo()
infotext for ilPasswordInputGUI setInfo()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupFeedHash(int $a_user_id, bool $a_create=false)
Lookup news feed hash for user.
setTitle(string $a_title)
static prepareNewsDataFromCache(array $a_cres)
Prepare news data from cache.
BlockGUI class for block NewsForContext.
static getInstance()
Singleton method to reduce footprint (included files, created instances)
setPresentation(int $type)
static _lookupDefaultPDPeriod()