ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
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 27 of file class.ilPDNewsBlockGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilPDNewsBlockGUI::__construct ( )

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

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

37  {
38  global $DIC;
39 
41 
42  $lng = $DIC->language();
43  $ilAccess = $DIC->access();
44  $this->obj_definition = $DIC["objDefinition"];
45 
46  // NOT ilNewsForContextBlockGUI::__construct() !
48 
49  $lng->loadLanguageModule("news");
50  $this->setLimit(5);
51 
52  $this->dynamic = false;
53 
54  $this->std_request = $DIC->news()
55  ->internal()
56  ->gui()
57  ->standardRequest();
58 
59  $this->acache = new ilNewsCache();
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") {
63  self::$st_data = ilNewsItem::prepareNewsDataFromCache($cres);
64  $this->cache_hit = true;
65  }
66 
67 
68  if (empty(self::$st_data)) {
69  self::$st_data = $this->getNewsData();
70  }
71  $data = self::$st_data;
72 
73  $this->setTitle($lng->txt("news_internal_news"));
74  $this->setRowTemplate("tpl.block_row_news_for_context.html", "Services/News");
75 
76  $this->setData($data);
77 
78  $this->handleView();
79 
80  // reset access check results
81  $ilAccess->setResults((array) $this->acc_results);
82 
83  $this->setPresentation(self::PRES_SEC_LIST);
84  }
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...
global $DIC
Definition: feed.php:28
setRowTemplate(string $a_rowtemplatename, string $a_rowtemplatedir="")
Set Row Template Name.
__construct(VocabulariesInterface $vocabularies)
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 364 of file class.ilPDNewsBlockGUI.php.

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

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

◆ editSettings()

ilPDNewsBlockGUI::editSettings ( ilPropertyFormGUI  $a_private_form = null)

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

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

241  : string
242  {
243  $ilUser = $this->user;
244  $lng = $this->lng;
245  $ilCtrl = $this->ctrl;
246  $returnForm = "";
247 
248  $news_set = new ilSetting("news");
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");
252 
253  if (!$a_private_form && ($allow_shorter_periods || $allow_longer_periods)) {
254  $form = new ilPropertyFormGUI();
255  $form->setFormAction($ilCtrl->getFormAction($this));
256  $form->setTitle($lng->txt("news_settings"));
257 
258  $default_per = ilNewsItem::_lookupDefaultPDPeriod();
259  $per = ilNewsItem::_lookupUserPDPeriod($ilUser->getId());
260 
261  $form->setTableWidth("100%");
262 
263  $per_opts = [
264  2 => "2 " . $lng->txt("days"),
265  3 => "3 " . $lng->txt("days"),
266  5 => "5 " . $lng->txt("days"),
267  7 => "1 " . $lng->txt("week"),
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")
274  ];
275 
276  $unset = [];
277  foreach ($per_opts as $k => $opt) {
278  if (!$allow_shorter_periods && ($k < $default_per)) {
279  $unset[$k] = $k;
280  }
281  if (!$allow_longer_periods && ($k > $default_per)) {
282  $unset[$k] = $k;
283  }
284  }
285  foreach ($unset as $k) {
286  unset($per_opts[$k]);
287  }
288 
289  $per_sel = new ilSelectInputGUI(
290  $lng->txt("news_pd_period"),
291  "news_pd_period"
292  );
293  $per_sel->setOptions($per_opts);
294  $per_sel->setValue((string) $per);
295  $form->addItem($per_sel);
296 
297  $form->addCommandButton("saveSettings", $lng->txt("save"));
298  $form->addCommandButton("cancelSettings", $lng->txt("cancel"));
299 
300  $returnForm = $form->getHTML();
301  }
302 
303  if ($enable_private_feed) {
304  if (!$a_private_form) {
305  $a_private_form = $this->initPrivateSettingsForm();
306  }
307  $returnForm .= ($returnForm === "")
308  ? $a_private_form->getHTML()
309  : "<br>" . $a_private_form->getHTML();
310  }
311 
312  return $returnForm;
313  }
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 131 of file class.ilPDNewsBlockGUI.php.

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

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

◆ getBlockType()

ilPDNewsBlockGUI::getBlockType ( )

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

Referenced by saveSettings().

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

◆ getHTML()

ilPDNewsBlockGUI::getHTML ( )

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

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

144  : string
145  {
146  $ilCtrl = $this->ctrl;
147  $lng = $this->lng;
148  $ilUser = $this->user;
149 
150  // @todo: find another solution for this
151  //$this->setFooterInfo($lng->txt("news_block_information"), true);
152 
153  $news_set = new ilSetting("news");
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");
158  // show feed url
159  if ($enable_internal_rss) {
160  // @todo: rss icon html ilRSSButtonGUI::get(ilRSSButtonGUI::ICON_RSS)
161  $this->addBlockCommand(
162  $ilCtrl->getLinkTarget($this, "showFeedUrl"),
163  $lng->txt("news_get_feed_url")
164  );
165  }
166 
167  if ($allow_shorter_periods || $allow_longer_periods || $enable_private_feed) {
168  $this->addBlockCommand(
169  $ilCtrl->getLinkTarget($this, "editSettings"),
170  $lng->txt("settings")
171  );
172  }
173 
174  $en = "";
175  if ($ilUser->getPref("il_feed_js") === "n") {
176  $en = $this->getJSEnabler();
177  }
178 
179  return ilBlockGUI::getHTML() . $en;
180  }
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 86 of file class.ilPDNewsBlockGUI.php.

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

Referenced by __construct().

86  : array
87  {
88  $ilUser = $this->user;
89 
90  $this->acache = new ilNewsCache();
91 
92  $per = ilNewsItem::_lookupUserPDPeriod($ilUser->getId());
94  $ilUser->getId(),
95  false,
96  false,
97  $per
98  );
99 
100  $this->acache->storeEntry(
101  $ilUser->getId() . ":0",
102  serialize($data)
103  );
104 
105  return $data;
106  }
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 113 of file class.ilPDNewsBlockGUI.php.

References $DIC, IL_SCREEN_CENTER, and IL_SCREEN_SIDE.

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

◆ initPrivateSettingsForm()

ilPDNewsBlockGUI::initPrivateSettingsForm ( )
protected

Definition at line 315 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().

316  {
317  $ilCtrl = $this->ctrl;
318  $lng = $this->lng;
319  $ilUser = $this->user;
320 
321  $feed_form = new ilPropertyFormGUI();
322  $feed_form->setFormAction($ilCtrl->getFormAction($this));
323  $feed_form->setTitle($lng->txt("priv_feed_settings"));
324 
325  $feed_form->setTableWidth("100%");
326 
327  $enable_private_feed = new ilCheckboxInputGUI($lng->txt("news_enable_private_feed"), "enable_private_feed");
328  $enable_private_feed->setChecked((bool) ilObjUser::_getFeedPass($ilUser->getId()));
329  $feed_form->addItem($enable_private_feed);
330 
331  $passwd = new ilPasswordInputGUI($lng->txt("password"), "desired_password");
332  $passwd->setRequired(true);
334  $enable_private_feed->addSubItem($passwd);
335 
336  $feed_form->addCommandButton("changeFeedSettings", $lng->txt("save"));
337  $feed_form->addCommandButton("cancelSettings", $lng->txt("cancel"));
338 
339  return $feed_form;
340  }
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 file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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 342 of file class.ilPDNewsBlockGUI.php.

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

342  : string
343  {
344  $ilCtrl = $this->ctrl;
345  $ilUser = $this->user;
346 
347  $news_set = new ilSetting("news");
348 
350  $this->getBlockType(),
351  "news_pd_period",
352  $this->std_request->getDashboardPeriod(),
353  $ilUser->getId(),
354  0
355  );
356 
357  $cache = new ilNewsCache();
358  $cache->deleteEntry($ilUser->getId() . ":0");
359 
360  $ilCtrl->returnToParent($this);
361  return "";
362  }
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 183 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().

183  : string
184  {
185  $lng = $this->lng;
186  $ilCtrl = $this->ctrl;
187  $ilUser = $this->user;
188 
189  $news_set = new ilSetting("news");
190 
191  if ($news_set->get("enable_private_feed")) {
192  $tpl = new ilTemplate("tpl.show_priv_feed_url.html", true, true, "Services/News");
193 
194  $tpl->setVariable("TXT_PRIV_TITLE", $lng->txt("news_get_priv_feed_title"));
195 
196  // #14365
197  if (ilObjUser::_getFeedPass($GLOBALS['DIC']['ilUser']->getId())) {
198  $tpl->setVariable("TXT_PRIV_INFO", $lng->txt("news_get_priv_feed_info"));
199  $tpl->setVariable("TXT_PRIV_FEED_URL", $lng->txt("news_feed_url"));
200  $tpl->setVariable(
201  "VAL_PRIV_FEED_URL",
202  str_replace("://", "://" . $ilUser->getLogin() . ":-password-@", ILIAS_HTTP_PATH) . "/privfeed.php?client_id=" . rawurlencode(CLIENT_ID) . "&user_id=" . $ilUser->getId() .
203  "&hash=" . ilObjUser::_lookupFeedHash($ilUser->getId(), true)
204  );
205  $tpl->setVariable(
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() .
208  "&hash=" . ilObjUser::_lookupFeedHash($ilUser->getId(), true)
209  );
210  } else {
211  $tpl->setVariable("TXT_PRIV_INFO", $lng->txt("news_inactive_private_feed_info"));
212  $tpl->setVariable("EDIT_SETTINGS_URL", $ilCtrl->getLinkTarget($this, "editSettings"));
213  $tpl->setVariable("EDIT_SETTINGS_TXT", $lng->txt("news_edit_news_settings"));
214  }
215  } else {
216  $tpl = new ilTemplate("tpl.show_feed_url.html", true, true, "Services/News");
217  }
218  $tpl->setVariable("TXT_TITLE", $lng->txt("news_get_feed_title"));
219  $tpl->setVariable("TXT_INFO", $lng->txt("news_get_feed_info"));
220  $tpl->setVariable("TXT_FEED_URL", $lng->txt("news_feed_url"));
221  $tpl->setVariable(
222  "VAL_FEED_URL",
223  ILIAS_HTTP_PATH . "/feed.php?client_id=" . rawurlencode(CLIENT_ID) . "&user_id=" . $ilUser->getId() .
224  "&hash=" . ilObjUser::_lookupFeedHash($ilUser->getId(), true)
225  );
226  $tpl->setVariable(
227  "VAL_FEED_URL_TXT",
228  ILIAS_HTTP_PATH . "/feed.php?client_id=" . rawurlencode(CLIENT_ID) . "&<br />user_id=" . $ilUser->getId() .
229  "&hash=" . ilObjUser::_lookupFeedHash($ilUser->getId(), true)
230  );
231 
232 
233  $panel = $this->ui->factory()->panel()->standard(
234  $lng->txt("news_internal_news"),
235  $this->ui->factory()->legacy($tpl->get())
236  );
237 
238  return $this->ui->renderer()->render($panel);
239  }
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:546
ilTemplate $tpl
$GLOBALS["DIC"]
Definition: wac.php:31
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 31 of file class.ilPDNewsBlockGUI.php.

◆ $acc_results

bool ilPDNewsBlockGUI::$acc_results = false
protected

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

◆ $block_type

string ilPDNewsBlockGUI::$block_type = "pdnews"
static

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

◆ $cache_hit

bool ilPDNewsBlockGUI::$cache_hit = false
protected

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

◆ $dynamic

bool ilPDNewsBlockGUI::$dynamic = false
protected

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

◆ $std_request

StandardGUIRequest ilPDNewsBlockGUI::$std_request
protected

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


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