ILIAS  trunk Revision v11.0_alpha-1749-g1a06bdef097
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilPDNewsBlockGUI Class Reference

BlockGUI class for block NewsForContext. More...

+ Inheritance diagram for ilPDNewsBlockGUI:
+ Collaboration diagram for ilPDNewsBlockGUI:

Public Member Functions

 __construct ()
 
 getNewsData ()
 
 getBlockType ()
 
 executeCommand ()
 
 getHTML ()
 
 showFeedUrl ()
 
 editSettings (?ilPropertyFormGUI $a_private_form=null)
 
 saveSettings ()
 
 changeFeedSettings ()
 
- Public Member Functions inherited from ilNewsForContextBlockGUI
 __construct ()
 
 getNewsData ()
 
 getBlockType ()
 
 executeCommand ()
 
 getHTML ()
 
 handleView ()
 Handles show/hide notification view and removes notifications if hidden. More...
 
 getInfoForData (array $news)
 
 getOverview ()
 
 showNews ()
 
 makeClickable (string $a_str)
 
 showNotifications ()
 
 hideNotifications ()
 
 editSettings ()
 Show settings screen. More...
 
 initSettingsForm ()
 Init setting form. More...
 
 cancelSettings ()
 
 saveSettings ()
 
 showFeedUrl ()
 
 getDynamicReload ()
 
 getJSEnabler ()
 
 disableJS ()
 
 enableJS ()
 
 getNoItemFoundContent ()
 
- Public Member Functions inherited from ilBlockGUI
 __construct ()
 
 getBlockType ()
 
 setData (array $a_data)
 
 getData ()
 
 setPresentation (int $type)
 
 getPresentation ()
 
 setBlockId (string $a_block_id="0")
 
 getBlockId ()
 
 setGuiObject (object $a_gui_object)
 Set GuiObject. More...
 
 getGuiObject ()
 
 setTitle (string $a_title)
 
 getTitle ()
 
 setOffset (int $a_offset)
 
 getOffset ()
 
 checkOffset (int $offset)
 
 setLimit (int $a_limit)
 
 getLimit ()
 
 setEnableEdit (bool $a_enableedit)
 
 getEnableEdit ()
 
 setRepositoryMode (bool $a_repositorymode)
 
 getRepositoryMode ()
 
 setSubtitle (string $a_subtitle)
 
 getSubtitle ()
 
 setRefId (int $a_refid)
 Set Ref Id (only used if isRepositoryObject() is true). More...
 
 getRefId ()
 
 setAdminCommands (bool $a_admincommands)
 
 getAdminCommands ()
 
 setEnableNumInfo (bool $a_enablenuminfo)
 
 getEnableNumInfo ()
 
 setProperties (array $a_properties)
 This function is supposed to be used for block type specific properties, that should be inherited through ilColumnGUI->setBlockProperties. More...
 
 getProperty (string $a_property)
 
 setProperty (string $a_property, string $a_value)
 
 setRowTemplate (string $a_rowtemplatename, string $a_rowtemplatedir="")
 Set Row Template Name. More...
 
 getNavParameter ()
 
 getConfigParameter ()
 
 getMoveParameter ()
 
 getRowTemplateName ()
 
 getRowTemplateDir ()
 
 addBlockCommand (string $a_href, string $a_text, string $a_onclick="", ?RoundTrip $modal=null)
 
 getBlockCommands ()
 
 getHTML ()
 
 getAsynch ()
 Use this for final get before sending asynchronous output (ajax) per echo to output. More...
 
 getPaginationViewControl ()
 Fill previous/next row. More...
 
 getViewControlsForPanel ()
 
 sortObject ()
 
 addSortOption (string $option, string $label, bool $active)
 
 setSortTarget (string $target)
 
 addPresentation (string $label, string $target, bool $active)
 
 getNoItemFoundContent ()
 

Static Public Member Functions

static getScreenMode ()
 
- Static Public Member Functions inherited from ilNewsForContextBlockGUI
static getScreenMode ()
 
static addToSettingsForm (ilFormPropertyGUI $a_input)
 Add inputs to the container news settings form to configure also the contextBlock options. More...
 
static writeSettings (array $a_values)
 
- Static Public Member Functions inherited from ilBlockGUI
static getScreenMode ()
 

Static Public Attributes

static string $block_type = "pdnews"
 
- Static Public Attributes inherited from ilNewsForContextBlockGUI
static string $block_type = "news"
 
static array $st_data
 

Protected Member Functions

 initPrivateSettingsForm ()
 
- Protected Member Functions inherited from ilNewsForContextBlockGUI
 isRepositoryObject ()
 
 getMediaPath (int $mob_id)
 
 getListItemForData (array $data)
 
 downloadMob ()
 
- Protected Member Functions inherited from ilBlockGUI
 isRepositoryObject ()
 Returns whether block has a corresponding repository object. More...
 
 specialCharsAsEntities (string $string)
 
 initCommands ()
 
 preloadData (array $data)
 Can be overwritten in subclasses. More...
 
 getLegacyContent ()
 Get legacy content. More...
 
 getListItemForData (array $data)
 Get list item for data array. More...
 
 handleNavigation ()
 Handle navigation. More...
 
 loadData ()
 Load data for current page. More...
 
 getListItemGroups ()
 Get items. More...
 
 addRepoCommands ()
 Add repo commands. More...
 
 getActionsForPanel ()
 
 send (string $output)
 Send. More...
 

Protected Attributes

bool $cache_hit = false
 
ilNewsCache $acache
 
bool $dynamic = false
 
bool $acc_results = false
 
StandardGUIRequest $std_request
 
- Protected Attributes inherited from ilNewsForContextBlockGUI
ILIAS News InternalGUIService $gui
 
NewsAccess $news_access
 
bool $cache_hit = false
 
bool $dynamic = false
 
ilNewsCache $acache
 
bool $show_view_selection
 
string $view
 
ilPropertyFormGUI $settings_form
 
ilHelpGUI $help
 
ilSetting $settings
 
ilTabsGUI $tabs
 
ilObjectDefinition $obj_definition
 
StandardGUIRequest $std_request
 
- Protected Attributes inherited from ilBlockGUI
ILIAS UI Renderer $renderer
 
Factory $factory
 
object $gui_object
 
ILIAS Block StandardGUIRequest $request
 
ILIAS Block BlockManager $block_manager
 
bool $repositorymode = false
 
ILIAS DI UIServices $ui
 
array $data = array()
 
bool $enablenuminfo = true
 
array $footer_links = array()
 
string $block_id = "0"
 
bool $allow_moving = true
 
array $move = array("left" => false, "right" => false, "up" => false, "down" => false)
 
array $block_commands = array()
 
int $max_count = 0
 
bool $close_command = false
 
bool $image = false
 
array $property = []
 
string $nav_value = ""
 
string $css_row = ""
 
string $title = ""
 
bool $admincommands = false
 
array $dropdown
 
ilTemplate $tpl
 
ilGlobalTemplateInterface $main_tpl
 
ilObjUser $user
 
ilCtrl $ctrl
 
ilAccessHandler $access
 
ilLanguage $lng
 
ilObjectDefinition $obj_def
 
int $presentation
 
int $requested_ref_id
 

Additional Inherited Members

- Data Fields inherited from ilNewsForContextBlockGUI
const OBJECTS_WITH_NEWS_SUBTAB = ["category", "course", "group", "forum"]
 object type names with settings->news settings subtab More...
 
- Data Fields inherited from ilBlockGUI
const PRES_MAIN_LEG = 0
 
const PRES_SEC_LEG = 1
 
const PRES_SEC_LIST = 2
 
const PRES_MAIN_LIST = 3
 
const PRES_MAIN_TILE = 4
 

Detailed Description

BlockGUI class for block NewsForContext.

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de ilPDNewsBlockGUI: ilColumnGUI

Definition at line 28 of file class.ilPDNewsBlockGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilPDNewsBlockGUI::__construct ( )

Definition at line 37 of file class.ilPDNewsBlockGUI.php.

References ilBlockGUI\$data, $DIC, ilBlockGUI\$lng, ILIAS\GlobalScreen\Provider\__construct(), ilBlockGUI\__construct(), getNewsData(), ilNewsForContextBlockGUI\handleView(), ilLanguage\loadLanguageModule(), ilNewsItem\prepareNewsDataFromCache(), ilBlockGUI\setData(), ilBlockGUI\setLimit(), ilBlockGUI\setPresentation(), ilBlockGUI\setRowTemplate(), ilBlockGUI\setTitle(), and ilLanguage\txt().

38  {
39  global $DIC;
40 
42 
43  $lng = $DIC->language();
44  $ilAccess = $DIC->access();
45  $this->obj_definition = $DIC["objDefinition"];
46 
47  // NOT ilNewsForContextBlockGUI::__construct() !
49 
50  $lng->loadLanguageModule("news");
51  $this->setLimit(5);
52 
53  $this->dynamic = false;
54 
55  $this->std_request = $DIC->news()
56  ->internal()
57  ->gui()
58  ->standardRequest();
59 
60  $this->acache = new ilNewsCache();
61  $cres = unserialize((string) $this->acache->getEntry($this->user->getId() . ":0"), ["allowed_classes" => false]);
62  $this->cache_hit = false;
63  if (is_array($cres) && $this->acache->getLastAccessStatus() === "hit") {
64  self::$st_data = ilNewsItem::prepareNewsDataFromCache($cres);
65  $this->cache_hit = true;
66  }
67 
68 
69  if (empty(self::$st_data)) {
70  self::$st_data = $this->getNewsData();
71  }
72  $data = self::$st_data;
73 
74  $this->setTitle($lng->txt("news_internal_news"));
75  $this->setRowTemplate("tpl.block_row_news_for_context.html", "components/ILIAS/News");
76 
77  $this->setData($data);
78 
79  $this->handleView();
80 
81  // reset access check results
82  $ilAccess->setResults((array) $this->acc_results);
83 
84  $this->setPresentation(self::PRES_SEC_LIST);
85  }
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...
ilLanguage $lng
handleView()
Handles show/hide notification view and removes notifications if hidden.
setLimit(int $a_limit)
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...
setRowTemplate(string $a_rowtemplatename, string $a_rowtemplatedir="")
Set Row Template Name.
global $DIC
Definition: shib_login.php:22
__construct(Container $dic, ilPlugin $plugin)
setTitle(string $a_title)
static prepareNewsDataFromCache(array $a_cres)
Prepare news data from cache.
setData(array $a_data)
setPresentation(int $type)
+ Here is the call graph for this function:

Member Function Documentation

◆ changeFeedSettings()

ilPDNewsBlockGUI::changeFeedSettings ( )

Definition at line 365 of file class.ilPDNewsBlockGUI.php.

References ilBlockGUI\$ctrl, ilBlockGUI\$lng, ilBlockGUI\$user, ilObjUser\_setFeedPass(), ilNewsForContextBlockGUI\editSettings(), initPrivateSettingsForm(), and ilLanguage\txt().

365  : string
366  {
367  $ilCtrl = $this->ctrl;
368  $lng = $this->lng;
369  $ilUser = $this->user;
370 
371  $form = $this->initPrivateSettingsForm();
372  if ($form->checkInput()) {
373  // Deactivate private Feed - just delete the password
374  if (!$form->getInput("enable_private_feed")) {
375  ilObjUser::_setFeedPass($ilUser->getId(), "");
376  $this->main_tpl->setOnScreenMessage('success', $lng->txt("priv_feed_disabled"), true);
377  // $ilCtrl->returnToParent($this);
378  $ilCtrl->redirect($this, "showFeedUrl");
379  } else {
380  $passwd = $form->getInput("desired_password");
381  if (LocalUserPasswordManager::getInstance()->verifyPassword($ilUser, $passwd)) {
382  $form->getItemByPostVar("desired_password")->setAlert($lng->txt("passwd_equals_ilpasswd"));
383  $this->main_tpl->setOnScreenMessage('failure', $lng->txt("form_input_not_valid"));
384  } else {
385  ilObjUser::_setFeedPass($ilUser->getId(), $passwd);
386  $this->main_tpl->setOnScreenMessage('success', $lng->txt("saved_successfully"), true);
387  $ilCtrl->redirect($this, "showFeedUrl");
388  }
389  }
390  }
391 
392  $form->setValuesByPost();
393  return $this->editSettings($form);
394  }
static _setFeedPass(int $a_user_id, string $a_password)
Set news feed password for user.
ilObjUser $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...
ilLanguage $lng
+ Here is the call graph for this function:

◆ editSettings()

ilPDNewsBlockGUI::editSettings ( ?ilPropertyFormGUI  $a_private_form = null)

Definition at line 242 of file class.ilPDNewsBlockGUI.php.

References ilBlockGUI\$ctrl, ilBlockGUI\$lng, ilBlockGUI\$user, ilNewsItem\_lookupDefaultPDPeriod(), ilNewsItem\_lookupUserPDPeriod(), initPrivateSettingsForm(), ilSelectInputGUI\setOptions(), and ilLanguage\txt().

242  : string
243  {
244  $ilUser = $this->user;
245  $lng = $this->lng;
246  $ilCtrl = $this->ctrl;
247  $returnForm = "";
248 
249  $news_set = new ilSetting("news");
250  $allow_shorter_periods = $news_set->get("allow_shorter_periods");
251  $allow_longer_periods = $news_set->get("allow_longer_periods");
252  $enable_private_feed = $news_set->get("enable_private_feed");
253 
254  if (!$a_private_form && ($allow_shorter_periods || $allow_longer_periods)) {
255  $form = new ilPropertyFormGUI();
256  $form->setFormAction($ilCtrl->getFormAction($this));
257  $form->setTitle($lng->txt("news_settings"));
258 
259  $default_per = ilNewsItem::_lookupDefaultPDPeriod();
260  $per = ilNewsItem::_lookupUserPDPeriod($ilUser->getId());
261 
262  $form->setTableWidth("100%");
263 
264  $per_opts = [
265  2 => "2 " . $lng->txt("days"),
266  3 => "3 " . $lng->txt("days"),
267  5 => "5 " . $lng->txt("days"),
268  7 => "1 " . $lng->txt("week"),
269  14 => "2 " . $lng->txt("weeks"),
270  30 => "1 " . $lng->txt("month"),
271  60 => "2 " . $lng->txt("months"),
272  120 => "4 " . $lng->txt("months"),
273  180 => "6 " . $lng->txt("months"),
274  366 => "1 " . $lng->txt("year")
275  ];
276 
277  $unset = [];
278  foreach ($per_opts as $k => $opt) {
279  if (!$allow_shorter_periods && ($k < $default_per)) {
280  $unset[$k] = $k;
281  }
282  if (!$allow_longer_periods && ($k > $default_per)) {
283  $unset[$k] = $k;
284  }
285  }
286  foreach ($unset as $k) {
287  unset($per_opts[$k]);
288  }
289 
290  $per_sel = new ilSelectInputGUI(
291  $lng->txt("news_pd_period"),
292  "news_pd_period"
293  );
294  $per_sel->setOptions($per_opts);
295  $per_sel->setValue((string) $per);
296  $form->addItem($per_sel);
297 
298  $form->addCommandButton("saveSettings", $lng->txt("save"));
299  $form->addCommandButton("cancelSettings", $lng->txt("cancel"));
300 
301  $returnForm = $form->getHTML();
302  }
303 
304  if ($enable_private_feed) {
305  if (!$a_private_form) {
306  $a_private_form = $this->initPrivateSettingsForm();
307  }
308  $returnForm .= ($returnForm === "")
309  ? $a_private_form->getHTML()
310  : "<br>" . $a_private_form->getHTML();
311  }
312 
313  return $returnForm;
314  }
ilObjUser $user
static _lookupUserPDPeriod(int $a_user_id)
This class represents a selection list property in a property form.
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...
ilLanguage $lng
setOptions(array $a_options)
static _lookupDefaultPDPeriod()
+ Here is the call graph for this function:

◆ executeCommand()

ilPDNewsBlockGUI::executeCommand ( )

Definition at line 132 of file class.ilPDNewsBlockGUI.php.

References ilBlockGUI\$ctrl, and ilCtrl\getNextClass().

133  {
134  $ilCtrl = $this->ctrl;
135 
136  $next_class = $ilCtrl->getNextClass();
137  $cmd = $ilCtrl->getCmd("getHTML");
138 
139  switch ($next_class) {
140  default:
141  return $this->$cmd();
142  }
143  }
getNextClass($a_gui_class=null)
+ Here is the call graph for this function:

◆ getBlockType()

ilPDNewsBlockGUI::getBlockType ( )

Definition at line 109 of file class.ilPDNewsBlockGUI.php.

Referenced by saveSettings().

109  : string
110  {
111  return self::$block_type;
112  }
+ Here is the caller graph for this function:

◆ getHTML()

ilPDNewsBlockGUI::getHTML ( )

Definition at line 145 of file class.ilPDNewsBlockGUI.php.

References ilBlockGUI\$ctrl, ilBlockGUI\$lng, ilBlockGUI\$user, ilBlockGUI\addBlockCommand(), ilBlockGUI\getHTML(), ilNewsForContextBlockGUI\getJSEnabler(), and ilLanguage\txt().

145  : string
146  {
147  $ilCtrl = $this->ctrl;
148  $lng = $this->lng;
149  $ilUser = $this->user;
150 
151  // @todo: find another solution for this
152  //$this->setFooterInfo($lng->txt("news_block_information"), true);
153 
154  $news_set = new ilSetting("news");
155  $enable_internal_rss = $news_set->get("enable_rss_for_internal");
156  $allow_shorter_periods = $news_set->get("allow_shorter_periods");
157  $allow_longer_periods = $news_set->get("allow_longer_periods");
158  $enable_private_feed = $news_set->get("enable_private_feed");
159  // show feed url
160  if ($enable_internal_rss) {
161  // @todo: rss icon html ilRSSButtonGUI::get(ilRSSButtonGUI::ICON_RSS)
162  $this->addBlockCommand(
163  $ilCtrl->getLinkTarget($this, "showFeedUrl"),
164  $lng->txt("news_get_feed_url")
165  );
166  }
167 
168  if ($allow_shorter_periods || $allow_longer_periods || $enable_private_feed) {
169  $this->addBlockCommand(
170  $ilCtrl->getLinkTarget($this, "editSettings"),
171  $lng->txt("settings")
172  );
173  }
174 
175  $en = "";
176  if ($ilUser->getPref("il_feed_js") === "n") {
177  $en = $this->getJSEnabler();
178  }
179 
180  return ilBlockGUI::getHTML() . $en;
181  }
ilObjUser $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...
ilLanguage $lng
addBlockCommand(string $a_href, string $a_text, string $a_onclick="", ?RoundTrip $modal=null)
+ Here is the call graph for this function:

◆ getNewsData()

ilPDNewsBlockGUI::getNewsData ( )

Definition at line 87 of file class.ilPDNewsBlockGUI.php.

References ilBlockGUI\$data, ilBlockGUI\$user, ilNewsItem\_getNewsItemsOfUser(), and ilNewsItem\_lookupUserPDPeriod().

Referenced by __construct().

87  : array
88  {
89  $ilUser = $this->user;
90 
91  $this->acache = new ilNewsCache();
92 
93  $per = ilNewsItem::_lookupUserPDPeriod($ilUser->getId());
95  $ilUser->getId(),
96  false,
97  false,
98  $per
99  );
100 
101  $this->acache->storeEntry(
102  $ilUser->getId() . ":0",
103  serialize($data)
104  );
105 
106  return $data;
107  }
ilObjUser $user
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=[], bool $no_auto_generated=false, array $excluded=[], int $a_limit=0)
Get all news items for a user.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getScreenMode()

static ilPDNewsBlockGUI::getScreenMode ( )
static

Definition at line 114 of file class.ilPDNewsBlockGUI.php.

References $DIC, IL_SCREEN_CENTER, and IL_SCREEN_SIDE.

114  : string
115  {
116  global $DIC;
117 
118  $cmd = $DIC->ctrl()->getCmd();
119 
120  switch ($cmd) {
121  case "showNews":
122  case "showFeedUrl":
123  case "editSettings":
124  case "changeFeedSettings":
125  return IL_SCREEN_CENTER;
126 
127  default:
128  return IL_SCREEN_SIDE;
129  }
130  }
global $DIC
Definition: shib_login.php:22
const IL_SCREEN_CENTER
const IL_SCREEN_SIDE

◆ initPrivateSettingsForm()

ilPDNewsBlockGUI::initPrivateSettingsForm ( )
protected

Definition at line 316 of file class.ilPDNewsBlockGUI.php.

References ilBlockGUI\$ctrl, ilBlockGUI\$lng, ilBlockGUI\$user, ilObjUser\_getFeedPass(), ilSecuritySettingsChecker\getPasswordRequirementsInfo(), ilFormPropertyGUI\setRequired(), and ilLanguage\txt().

Referenced by changeFeedSettings(), and editSettings().

317  {
318  $ilCtrl = $this->ctrl;
319  $lng = $this->lng;
320  $ilUser = $this->user;
321 
322  $feed_form = new ilPropertyFormGUI();
323  $feed_form->setFormAction($ilCtrl->getFormAction($this));
324  $feed_form->setTitle($lng->txt("priv_feed_settings"));
325 
326  $feed_form->setTableWidth("100%");
327 
328  $enable_private_feed = new ilCheckboxInputGUI($lng->txt("news_enable_private_feed"), "enable_private_feed");
329  $enable_private_feed->setChecked((bool) ilObjUser::_getFeedPass($ilUser->getId()));
330  $feed_form->addItem($enable_private_feed);
331 
332  $passwd = new ilPasswordInputGUI($lng->txt("password"), "desired_password");
333  $passwd->setRequired(true);
335  $enable_private_feed->addSubItem($passwd);
336 
337  $feed_form->addCommandButton("changeFeedSettings", $lng->txt("save"));
338  $feed_form->addCommandButton("cancelSettings", $lng->txt("cancel"));
339 
340  return $feed_form;
341  }
ilObjUser $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...
ilLanguage $lng
static _getFeedPass(int $a_user_id)
Lookup news feed password for user.
This class represents a password property in a property form.
setRequired(bool $a_required)
static getPasswordRequirementsInfo()
infotext for ilPasswordInputGUI setInfo()
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveSettings()

ilPDNewsBlockGUI::saveSettings ( )

Definition at line 343 of file class.ilPDNewsBlockGUI.php.

References ilBlockGUI\$ctrl, ilBlockGUI\$user, ilBlockSetting\_write(), and getBlockType().

343  : string
344  {
345  $ilCtrl = $this->ctrl;
346  $ilUser = $this->user;
347 
348  $news_set = new ilSetting("news");
349 
351  $this->getBlockType(),
352  "news_pd_period",
353  $this->std_request->getDashboardPeriod(),
354  $ilUser->getId(),
355  0
356  );
357 
358  $cache = new ilNewsCache();
359  $cache->deleteEntry($ilUser->getId() . ":0");
360 
361  $ilCtrl->returnToParent($this);
362  return "";
363  }
ilObjUser $user
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _write(string $a_type, string $a_setting, string $a_value, int $a_user=0, int $a_block_id=0)
Write setting to database.
+ Here is the call graph for this function:

◆ showFeedUrl()

ilPDNewsBlockGUI::showFeedUrl ( )

Definition at line 184 of file class.ilPDNewsBlockGUI.php.

References ilBlockGUI\$ctrl, $GLOBALS, ilBlockGUI\$lng, ilBlockGUI\$tpl, ilBlockGUI\$user, ilObjUser\_getFeedPass(), ilObjUser\_lookupFeedHash(), CLIENT_ID, ilTemplate\get(), ILIAS\Survey\Mode\getId(), HTML_Template_IT\setVariable(), ilLanguage\txt(), and ILIAS\Repository\ui().

184  : string
185  {
186  $lng = $this->lng;
187  $ilCtrl = $this->ctrl;
188  $ilUser = $this->user;
189 
190  $news_set = new ilSetting("news");
191 
192  if ($news_set->get("enable_private_feed")) {
193  $tpl = new ilTemplate("tpl.show_priv_feed_url.html", true, true, "components/ILIAS/News");
194 
195  $tpl->setVariable("TXT_PRIV_TITLE", $lng->txt("news_get_priv_feed_title"));
196 
197  // #14365
198  if (ilObjUser::_getFeedPass($GLOBALS['DIC']['ilUser']->getId())) {
199  $tpl->setVariable("TXT_PRIV_INFO", $lng->txt("news_get_priv_feed_info"));
200  $tpl->setVariable("TXT_PRIV_FEED_URL", $lng->txt("news_feed_url"));
201  $tpl->setVariable(
202  "VAL_PRIV_FEED_URL",
203  str_replace("://", "://" . $ilUser->getLogin() . ":-password-@", ILIAS_HTTP_PATH) . "/privfeed.php?client_id=" . rawurlencode(CLIENT_ID) . "&user_id=" . $ilUser->getId() .
204  "&hash=" . ilObjUser::_lookupFeedHash($ilUser->getId(), true)
205  );
206  $tpl->setVariable(
207  "VAL_PRIV_FEED_URL_TXT",
208  str_replace("://", "://" . $ilUser->getLogin() . ":-password-@", ILIAS_HTTP_PATH) . "/privfeed.php?client_id=" . rawurlencode(CLIENT_ID) . "&<br />user_id=" . $ilUser->getId() .
209  "&hash=" . ilObjUser::_lookupFeedHash($ilUser->getId(), true)
210  );
211  } else {
212  $tpl->setVariable("TXT_PRIV_INFO", $lng->txt("news_inactive_private_feed_info"));
213  $tpl->setVariable("EDIT_SETTINGS_URL", $ilCtrl->getLinkTarget($this, "editSettings"));
214  $tpl->setVariable("EDIT_SETTINGS_TXT", $lng->txt("news_edit_news_settings"));
215  }
216  } else {
217  $tpl = new ilTemplate("tpl.show_feed_url.html", true, true, "components/ILIAS/News");
218  }
219  $tpl->setVariable("TXT_TITLE", $lng->txt("news_get_feed_title"));
220  $tpl->setVariable("TXT_INFO", $lng->txt("news_get_feed_info"));
221  $tpl->setVariable("TXT_FEED_URL", $lng->txt("news_feed_url"));
222  $tpl->setVariable(
223  "VAL_FEED_URL",
224  ILIAS_HTTP_PATH . "/feed.php?client_id=" . rawurlencode(CLIENT_ID) . "&user_id=" . $ilUser->getId() .
225  "&hash=" . ilObjUser::_lookupFeedHash($ilUser->getId(), true)
226  );
227  $tpl->setVariable(
228  "VAL_FEED_URL_TXT",
229  ILIAS_HTTP_PATH . "/feed.php?client_id=" . rawurlencode(CLIENT_ID) . "&<br />user_id=" . $ilUser->getId() .
230  "&hash=" . ilObjUser::_lookupFeedHash($ilUser->getId(), true)
231  );
232 
233 
234  $panel = $this->ui->factory()->panel()->standard(
235  $lng->txt("news_internal_news"),
236  $this->ui->factory()->legacy()->content($tpl->get())
237  );
238 
239  return $this->ui->renderer()->render($panel);
240  }
ilObjUser $user
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...
ilLanguage $lng
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:544
ilTemplate $tpl
$GLOBALS["DIC"]
Definition: wac.php:53
static _getFeedPass(int $a_user_id)
Lookup news feed password for user.
const CLIENT_ID
Definition: constants.php:41
static _lookupFeedHash(int $a_user_id, bool $a_create=false)
Lookup news feed hash for user.
+ Here is the call graph for this function:

Field Documentation

◆ $acache

ilNewsCache ilPDNewsBlockGUI::$acache
protected

Definition at line 32 of file class.ilPDNewsBlockGUI.php.

◆ $acc_results

bool ilPDNewsBlockGUI::$acc_results = false
protected

Definition at line 34 of file class.ilPDNewsBlockGUI.php.

◆ $block_type

string ilPDNewsBlockGUI::$block_type = "pdnews"
static

Definition at line 30 of file class.ilPDNewsBlockGUI.php.

◆ $cache_hit

bool ilPDNewsBlockGUI::$cache_hit = false
protected

Definition at line 31 of file class.ilPDNewsBlockGUI.php.

◆ $dynamic

bool ilPDNewsBlockGUI::$dynamic = false
protected

Definition at line 33 of file class.ilPDNewsBlockGUI.php.

◆ $std_request

StandardGUIRequest ilPDNewsBlockGUI::$std_request
protected

Definition at line 35 of file class.ilPDNewsBlockGUI.php.


The documentation for this class was generated from the following file: