ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilPDNewsBlockGUI Class Reference

BlockGUI class for block NewsForContext. More...

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

Public Member Functions

 __construct ()
 Constructor. More...
 
 getNewsData ()
 Get news for context. More...
 
 getBlockType ()
 
 executeCommand ()
 execute command More...
 
 fillDataSection ()
 Fill data section. More...
 
 getHTML ()
 Get bloch HTML code. More...
 
 showFeedUrl ()
 Show feed URL. More...
 
 addCloseCommand ($a_content_block)
 
 showNews ()
 show news More...
 
 editSettings (ilPropertyFormGUI $a_private_form=null)
 Show settings screen. More...
 
 cancelSettings ()
 Cancel settings. More...
 
 saveSettings ()
 Save settings. More...
 
 changeFeedSettings ()
 change user password More...
 
- Public Member Functions inherited from ilNewsForContextBlockGUI
 __construct ()
 Constructor. More...
 
 getNewsData ()
 Get news for context. More...
 
 getBlockType ()
 
 executeCommand ()
 execute command More...
 
 setEnableEdit ($a_enable_edit=0)
 Set EnableEdit. More...
 
 getEnableEdit ()
 Get EnableEdit. More...
 
 fillDataSection ()
 Fill data section. More...
 
 getHTML ()
 Get bloch HTML code. More...
 
 handleView ()
 Handles show/hide notification view and removes notifications if hidden. More...
 
 fillRow ($news)
 get flat bookmark list for personal desktop More...
 
 getOverview ()
 Get overview. More...
 
 showNews ()
 show news More...
 
 makeClickable ($a_str)
 Make clickable. More...
 
 unsubscribeNews ()
 Unsubscribe current user from news. More...
 
 subscribeNews ()
 Subscribe current user from news. More...
 
 fillFooter ()
 block footer More...
 
 showViewFooter ()
 Show additional footer for show/hide notifications. More...
 
 showNotifications ()
 
 hideNotifications ()
 
 editSettings ()
 Show settings screen. More...
 
 initSettingsForm ()
 Init setting form. More...
 
 cancelSettings ()
 Cancel settings. More...
 
 saveSettings ()
 Save settings. More...
 
 showFeedUrl ()
 Show feed URL. More...
 
 addCloseCommand ($a_content_block)
 
 getDynamic ()
 
 getDynamicReload ()
 
 getJSEnabler ()
 
 disableJS ()
 
 enableJS ()
 
- Public Member Functions inherited from ilBlockGUI
 getBlockType ()
 
 __construct ()
 Constructor. More...
 
 addHeaderLink ($a_href, $a_text, $status=true)
 
 getHeaderLinks ()
 
 setData ($a_data)
 Set Data. More...
 
 getData ()
 Get Data. More...
 
 setBigMode ($a_bigmode)
 Set Big Mode. More...
 
 getBigMode ()
 Get Big Mode. More...
 
 setBlockId ($a_block_id=0)
 Set Block Id. More...
 
 getBlockId ()
 Get Block Id. More...
 
 setAvailableDetailLevels ($a_max, $a_min=0)
 Set Available Detail Levels. More...
 
 setCurrentDetailLevel ($a_currentdetaillevel)
 Set Current Detail Level. More...
 
 setGuiObject (&$a_gui_object)
 Set GuiObject. More...
 
 getGuiObject ()
 Get GuiObject. More...
 
 getCurrentDetailLevel ()
 Get Current Detail Level. More...
 
 setTitle ($a_title)
 Set Title. More...
 
 getTitle ()
 Get Title. More...
 
 setImage ($a_image)
 Set Image. More...
 
 getImage ()
 Get Image. More...
 
 setOffset ($a_offset)
 Set Offset. More...
 
 getOffset ()
 Get Offset. More...
 
 correctOffset ()
 
 setLimit ($a_limit)
 Set Limit. More...
 
 getLimit ()
 Get Limit. More...
 
 setEnableEdit ($a_enableedit)
 Set EnableEdit. More...
 
 getEnableEdit ()
 Get EnableEdit. More...
 
 setRepositoryMode ($a_repositorymode)
 Set RepositoryMode. More...
 
 getRepositoryMode ()
 Get RepositoryMode. More...
 
 setFooterInfo ($a_footerinfo, $a_hide_and_icon=false)
 Set Footer Info. More...
 
 getFooterInfo ($a_hide_and_icon=false)
 Get Footer Info. More...
 
 setSubtitle ($a_subtitle)
 Set Subtitle. More...
 
 getSubtitle ()
 Get Subtitle. More...
 
 setRefId ($a_refid)
 Set Ref Id (only used if isRepositoryObject() is true). More...
 
 getRefId ()
 Get Ref Id (only used if isRepositoryObject() is true). More...
 
 setAdminCommands ($a_admincommands)
 Set Administration Commmands. More...
 
 getAdminCommands ()
 Get Administration Commmands. More...
 
 setColSpan ($a_colspan)
 Set Columns Span. More...
 
 getColSpan ()
 Get Columns Span. More...
 
 setEnableDetailRow ($a_enabledetailrow)
 Set EnableDetailRow. More...
 
 getEnableDetailRow ()
 Get EnableDetailRow. More...
 
 setEnableNumInfo ($a_enablenuminfo)
 Set Enable Item Number Info. More...
 
 getEnableNumInfo ()
 Get Enable Item Number Info. More...
 
 setProperties ($a_properties)
 This function is supposed to be used for block type specific properties, that should be inherited through ilColumnGUI->setBlockProperties. More...
 
 getProperty ($a_property)
 
 setProperty ($a_property, $a_value)
 
 setRowTemplate ($a_rowtemplatename, $a_rowtemplatedir="")
 Set Row Template Name. More...
 
 getNavParameter ()
 
 getDetailParameter ()
 
 getConfigParameter ()
 
 getMoveParameter ()
 
 getRowTemplateName ()
 Get Row Template Name. More...
 
 getRowTemplateDir ()
 Get Row Template Directory. More...
 
 addBlockCommand ( $a_href, $a_text, $a_target="", $a_img="", $a_right_aligned=false, $a_checked=false, $a_html="")
 Add Block Command. More...
 
 getBlockCommands ()
 Get Block commands. More...
 
 addHeaderCommand ($a_href, $a_text, $a_as_close=false)
 Add Header Block Command. More...
 
 getHeaderCommands ()
 Get Header Block commands. More...
 
 addFooterLink ( $a_text, $a_href="", $a_onclick="", $a_block_id="", $a_top=false, $a_omit_separator=false, $a_checked=false)
 Add a footer text/link. More...
 
 getFooterLinks ()
 Get footer links. More...
 
 clearFooterLinks ()
 Clear footer links. More...
 
 handleDetailLevel ()
 Handle read/write current detail level. More...
 
 getHTML ()
 Handle config status. More...
 
 fillHeaderCommands ()
 Fill header commands block. More...
 
 fillHeaderTitleBlock ()
 Fill header title block (title and. More...
 
 setDataSection ($a_content)
 Call this from overwritten fillDataSection(), if standard row based data is not used. More...
 
 fillDataSection ()
 Standard implementation for row based data. More...
 
 fillRow ($a_set)
 
 fillFooter ()
 
 fillPreviousNext ()
 Fill previous/next row. More...
 
 setPreviousNextLinks ()
 Get previous/next linkbar. More...
 
 fillFooterLinks ($a_top=false, $a_numinfo="")
 Fill footer links. More...
 
 fillDetailRow ()
 Fill Detail Setting Row. More...
 

Static Public Member Functions

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

Static Public Attributes

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

Protected Member Functions

 isRepositoryObject ()
 
 initPrivateSettingsForm ()
 
- Protected Member Functions inherited from ilNewsForContextBlockGUI
 isRepositoryObject ()
 
 getMediaPath (int $mob_id)
 
- Protected Member Functions inherited from ilBlockGUI
 isRepositoryObject ()
 Returns whether block has a corresponding repository object. More...
 
 fillRowColor ($a_placeholder="CSS_ROW")
 
 preloadData (array $data)
 Can be overwritten in subclasses. More...
 

Protected Attributes

 $acc_results = false
 
- Protected Attributes inherited from ilNewsForContextBlockGUI
 $help
 
 $settings
 
 $tabs
 
 $obj_definition
 
- Protected Attributes inherited from ilBlockGUI
 $data = array()
 
 $colspan = 1
 
 $enablenuminfo = true
 
 $detail_min = 0
 
 $detail_max = 0
 
 $bigmode = false
 
 $footer_links = array()
 
 $block_id = 0
 
 $header_commands = array()
 
 $allow_moving = true
 
 $move = array("left" => false, "right" => false, "up" => false, "down" => false)
 
 $enabledetailrow = true
 
 $header_links = array()
 
 $footerinfo = false
 
 $footerinfo_icon = false
 
 $block_commands = array()
 
 $max_count = false
 
 $close_command = false
 
 $image = false
 
 $property = false
 
 $nav_value = ""
 
 $css_row = ""
 
 $dropdown
 
 $tpl
 
 $main_tpl
 
 $user
 
 $ctrl
 
 $access
 
 $lng
 
 $obj_def
 

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...
 

Detailed Description

BlockGUI class for block NewsForContext.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
Id
class.ilNewsForContextBlockGUI.php 12920 2007-01-03 19:13:46Z akill

ilPDNewsBlockGUI: ilColumnGUI

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

Constructor & Destructor Documentation

◆ __construct()

ilPDNewsBlockGUI::__construct ( )

Constructor.

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

References ilBlockGUI\$data, $DIC, $ilUser, ilBlockGUI\$lng, ilBlockGUI\__construct(), ilBlockGUI\getCurrentDetailLevel(), ilNewsForContextBlockGUI\getDynamic(), getNewsData(), ilNewsForContextBlockGUI\handleView(), ilNewsItem\prepareNewsDataFromCache(), ilBlockGUI\setAvailableDetailLevels(), ilBlockGUI\setData(), ilBlockGUI\setLimit(), ilBlockGUI\setRowTemplate(), settings(), ilBlockGUI\setTitle(), and user().

26  {
27  global $DIC;
28 
29  $this->lng = $DIC->language();
30  $this->user = $DIC->user();
31  $this->access = $DIC->access();
32  $this->ctrl = $DIC->ctrl();
33  $this->settings = $DIC->settings();
34  $lng = $DIC->language();
35  $ilUser = $DIC->user();
36  $ilAccess = $DIC->access();
37  $this->obj_definition = $DIC["objDefinition"];
38  $this->ui = $DIC->ui();
39 
40  // NOT ilNewsForContextBlockGUI::__construct() !
42 
43  $lng->loadLanguageModule("news");
44  include_once("./Services/News/classes/class.ilNewsItem.php");
45 
46  $this->setLimit(5);
47  $this->setAvailableDetailLevels(3);
48 
49  $this->dynamic = false;
50 
51  include_once("./Services/News/classes/class.ilNewsCache.php");
52  $this->acache = new ilNewsCache();
53  $cres = unserialize($this->acache->getEntry($ilUser->getId() . ":0"));
54  $this->cache_hit = false;
55  if ($this->acache->getLastAccessStatus() == "hit" && is_array($cres)) {
56  self::$st_data = ilNewsItem::prepareNewsDataFromCache($cres);
57  ;
58  $this->cache_hit = true;
59  }
60 
61  if ($this->getDynamic() && !$this->cache_hit) {
62  $this->dynamic = true;
63  $data = array();
64  } elseif ($this->getCurrentDetailLevel() > 0) {
65  // do not ask two times for the data (e.g. if user displays a
66  // single item on the personal desktop and the news block is
67  // displayed at the same time)
68  if (empty(self::$st_data)) {
69  self::$st_data = $this->getNewsData();
70  $data = self::$st_data;
71  } else {
72  $data = self::$st_data;
73  }
74  } else {
75  $data = array();
76  }
77 
78  $this->setTitle($lng->txt("news_internal_news"));
79  $this->setRowTemplate("tpl.block_row_news_for_context.html", "Services/News");
80 
81  $this->setData($data);
82 
83  $this->handleView();
84 
85  // reset access check results
86  $ilAccess->setResults($this->acc_results);
87  }
settings()
Definition: settings.php:2
global $DIC
Definition: saml.php:7
handleView()
Handles show/hide notification view and removes notifications if hidden.
static prepareNewsDataFromCache($a_cres)
Prepare news data from cache.
user()
Definition: user.php:4
News cache.
setTitle($a_title)
Set Title.
setData($a_data)
Set Data.
setAvailableDetailLevels($a_max, $a_min=0)
Set Available Detail Levels.
$ilUser
Definition: imgupload.php:18
__construct()
Constructor.
getNewsData()
Get news for context.
setLimit($a_limit)
Set Limit.
setRowTemplate($a_rowtemplatename, $a_rowtemplatedir="")
Set Row Template Name.
getCurrentDetailLevel()
Get Current Detail Level.
+ Here is the call graph for this function:

Member Function Documentation

◆ addCloseCommand()

ilPDNewsBlockGUI::addCloseCommand (   $a_content_block)

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

References ilBlockGUI\$ctrl, $ilCtrl, and ilBlockGUI\$lng.

335  {
336  $lng = $this->lng;
338 
339  $a_content_block->addHeaderCommand(
340  $ilCtrl->getParentReturn($this),
341  $lng->txt("selected_items_back")
342  );
343  }
global $ilCtrl
Definition: ilias.php:18

◆ cancelSettings()

ilPDNewsBlockGUI::cancelSettings ( )

Cancel settings.

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

References ilBlockGUI\$ctrl, and $ilCtrl.

479  {
481 
482  $ilCtrl->returnToParent($this);
483  }
global $ilCtrl
Definition: ilias.php:18

◆ changeFeedSettings()

ilPDNewsBlockGUI::changeFeedSettings ( )

change user password

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

References ilBlockGUI\$ctrl, $form, $ilCtrl, $ilUser, ilBlockGUI\$lng, ilBlockGUI\$user, ilNewsForContextBlockGUI\editSettings(), ilUserPasswordManager\getInstance(), initPrivateSettingsForm(), and ilUtil\sendFailure().

515  {
517  $lng = $this->lng;
519 
520  $form = $this->initPrivateSettingsForm();
521  if ($form->checkInput()) {
522  // Deactivate private Feed - just delete the password
523  if (!$form->getInput("enable_private_feed")) {
524  $ilUser->_setFeedPass($ilUser->getId(), "");
525  ilUtil::sendSuccess($lng->txt("priv_feed_disabled"), true);
526  // $ilCtrl->returnToParent($this);
527  $ilCtrl->redirect($this, "showFeedUrl");
528  } else {
529  $passwd = $form->getInput("desired_password");
530  require_once 'Services/User/classes/class.ilUserPasswordManager.php';
531  if (ilUserPasswordManager::getInstance()->verifyPassword($ilUser, $passwd)) {
532  $form->getItemByPostVar("desired_password")->setAlert($lng->txt("passwd_equals_ilpasswd"));
533  ilUtil::sendFailure($lng->txt("form_input_not_valid"));
534  } else {
535  $ilUser->_setFeedPass($ilUser->getId(), $passwd);
536  ilUtil::sendSuccess($lng->txt("saved_successfully"), true);
537  // $ilCtrl->returnToParent($this);
538  $ilCtrl->redirect($this, "showFeedUrl");
539  }
540  }
541  }
542 
543  $form->setValuesByPost();
544  return $this->editSettings($form);
545  }
global $ilCtrl
Definition: ilias.php:18
if(isset($_POST['submit'])) $form
$ilUser
Definition: imgupload.php:18
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static getInstance()
Single method to reduce footprint (included files, created instances)
+ Here is the call graph for this function:

◆ editSettings()

ilPDNewsBlockGUI::editSettings ( ilPropertyFormGUI  $a_private_form = null)

Show settings screen.

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

References ilBlockGUI\$ctrl, $form, $ilCtrl, $ilSetting, $ilUser, ilBlockGUI\$lng, ilNewsForContextBlockGUI\$settings, ilBlockGUI\$user, ilNewsItem\_lookupDefaultPDPeriod(), ilNewsItem\_lookupUserPDPeriod(), initPrivateSettingsForm(), and ilSelectInputGUI\setOptions().

364  {
366  $lng = $this->lng;
369 
370  $news_set = new ilSetting("news");
371  $enable_internal_rss = $news_set->get("enable_rss_for_internal");
372  $allow_shorter_periods = $news_set->get("allow_shorter_periods");
373  $allow_longer_periods = $news_set->get("allow_longer_periods");
374  $enable_private_feed = $news_set->get("enable_private_feed");
375 
376  if (!$a_private_form && ($allow_shorter_periods || $allow_longer_periods)) {
377  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
378  $form = new ilPropertyFormGUI();
379  $form->setFormAction($ilCtrl->getFormaction($this));
380  $form->setTitle($lng->txt("news_settings"));
381 
382  include_once("./Services/News/classes/class.ilNewsItem.php");
383  $default_per = ilNewsItem::_lookupDefaultPDPeriod();
384  $per = ilNewsItem::_lookupUserPDPeriod($ilUser->getId());
385 
386  $form->setTableWidth("100%");
387 
388  $per_opts = array(
389  2 => "2 " . $lng->txt("days"),
390  3 => "3 " . $lng->txt("days"),
391  5 => "5 " . $lng->txt("days"),
392  7 => "1 " . $lng->txt("week"),
393  14 => "2 " . $lng->txt("weeks"),
394  30 => "1 " . $lng->txt("month"),
395  60 => "2 " . $lng->txt("months"),
396  120 => "4 " . $lng->txt("months"),
397  180 => "6 " . $lng->txt("months"),
398  366 => "1 " . $lng->txt("year"));
399 
400  $unset = array();
401  foreach ($per_opts as $k => $opt) {
402  if (!$allow_shorter_periods && ($k < $default_per)) {
403  $unset[$k] = $k;
404  }
405  if (!$allow_longer_periods && ($k > $default_per)) {
406  $unset[$k] = $k;
407  }
408  }
409  foreach ($unset as $k) {
410  unset($per_opts[$k]);
411  }
412 
413  $per_sel = new ilSelectInputGUI(
414  $lng->txt("news_pd_period"),
415  "news_pd_period"
416  );
417  //$per_sel->setInfo($lng->txt("news_pd_period_info"));
418  $per_sel->setOptions($per_opts);
419  $per_sel->setValue((int) $per);
420  $form->addItem($per_sel);
421 
422  //$form->addCheckboxProperty($lng->txt("news_public_feed"), "notifications_public_feed",
423  // "1", $public_feed, $lng->txt("news_public_feed_info"));
424  //if ($this->getProperty("public_notifications_option"))
425  //{
426  // $form->addCheckboxProperty($lng->txt("news_notifications_public"), "notifications_public",
427  // "1", $public, $lng->txt("news_notifications_public_info"));
428  //}
429  $form->addCommandButton("saveSettings", $lng->txt("save"));
430  $form->addCommandButton("cancelSettings", $lng->txt("cancel"));
431 
432  $returnForm = $form->getHTML();
433  }
434 
435  if ($enable_private_feed) {
436  if (!$a_private_form) {
437  $a_private_form = $this->initPrivateSettingsForm();
438  }
439  $returnForm .= ($returnForm == "")
440  ? $a_private_form->getHTML()
441  : "<br>" . $a_private_form->getHTML();
442  }
443 
444  return $returnForm;
445  }
This class represents a selection list property in a property form.
This class represents a property form user interface.
static _lookupUserPDPeriod($a_user_id)
global $ilCtrl
Definition: ilias.php:18
if(isset($_POST['submit'])) $form
$ilUser
Definition: imgupload.php:18
setOptions($a_options)
Set Options.
global $ilSetting
Definition: privfeed.php:17
static _lookupDefaultPDPeriod()
+ Here is the call graph for this function:

◆ executeCommand()

ilPDNewsBlockGUI::executeCommand ( )

execute command

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

References ilBlockGUI\$ctrl, and $ilCtrl.

161  {
163 
164  $next_class = $ilCtrl->getNextClass();
165  $cmd = $ilCtrl->getCmd("getHTML");
166 
167  switch ($next_class) {
168  default:
169  return $this->$cmd();
170  }
171  }
global $ilCtrl
Definition: ilias.php:18

◆ fillDataSection()

ilPDNewsBlockGUI::fillDataSection ( )

Fill data section.

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

References ilBlockGUI\getCurrentDetailLevel(), ilBlockGUI\getData(), ilNewsForContextBlockGUI\getDynamicReload(), ilNewsForContextBlockGUI\getOverview(), ilBlockGUI\setDataSection(), ilBlockGUI\setEnableDetailRow(), and ilBlockGUI\setEnableNumInfo().

177  {
178  if ($this->dynamic) {
179  $this->setDataSection($this->getDynamicReload());
180  } elseif ($this->getCurrentDetailLevel() > 1 && count($this->getData()) > 0) {
181  parent::fillDataSection();
182  } else {
183  $this->setEnableNumInfo(false);
184  if (count($this->getData()) == 0) {
185  $this->setEnableDetailRow(false);
186  }
187  $this->setDataSection($this->getOverview());
188  }
189  }
setDataSection($a_content)
Call this from overwritten fillDataSection(), if standard row based data is not used.
setEnableNumInfo($a_enablenuminfo)
Set Enable Item Number Info.
getData()
Get Data.
setEnableDetailRow($a_enabledetailrow)
Set EnableDetailRow.
getCurrentDetailLevel()
Get Current Detail Level.
+ Here is the call graph for this function:

◆ getBlockType()

ilPDNewsBlockGUI::getBlockType ( )

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

Referenced by saveSettings().

118  : string
119  {
120  return self::$block_type;
121  }
+ Here is the caller graph for this function:

◆ getHTML()

ilPDNewsBlockGUI::getHTML ( )

Get bloch HTML code.

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

References ilBlockGUI\$ctrl, $ilCtrl, $ilUser, ilBlockGUI\$lng, ilBlockGUI\$user, ilNewsItem\_lookupUserPDPeriod(), ilBlockGUI\addBlockCommand(), ilRSSButtonGUI\get(), ilBlockGUI\getCurrentDetailLevel(), ilBlockGUI\getHTML(), ilNewsForContextBlockGUI\getJSEnabler(), ilBlockGUI\getTitle(), ilRSSButtonGUI\ICON_RSS, ilBlockGUI\setFooterInfo(), and ilBlockGUI\setTitle().

195  {
197  $lng = $this->lng;
199 
200  // set footer info
201  $this->setFooterInfo($lng->txt("news_block_information"), true);
202 
203  $news_set = new ilSetting("news");
204  $enable_internal_rss = $news_set->get("enable_rss_for_internal");
205  $allow_shorter_periods = $news_set->get("allow_shorter_periods");
206  $allow_longer_periods = $news_set->get("allow_longer_periods");
207  $enable_private_feed = $news_set->get("enable_private_feed");
208 
209  // subscribe/unsibscribe link
210  include_once("./Services/News/classes/class.ilNewsSubscription.php");
211 
212  // show feed url
213  if ($enable_internal_rss) {
214  include_once("./Services/News/classes/class.ilRSSButtonGUI.php");
215  $this->addBlockCommand(
216  $ilCtrl->getLinkTarget($this, "showFeedUrl"),
217  $lng->txt("news_get_feed_url"),
218  "",
219  "",
220  true,
221  false,
223  );
224  }
225 
226  if ($allow_shorter_periods || $allow_longer_periods || $enable_private_feed) {
227  $this->addBlockCommand(
228  $ilCtrl->getLinkTarget($this, "editSettings"),
229  $lng->txt("settings")
230  );
231  }
232 
233  $per = ilNewsItem::_lookupUserPDPeriod($ilUser->getId());
234 
235  if ($per > 0) {
236  switch ($per) {
237  case 2:
238  case 3:
239  case 5: $per_str = sprintf($lng->txt("news_period_x_days"), $per); break;
240  case 7: $per_str = $lng->txt("news_period_1_week"); break;
241  case 14: $per_str = sprintf($lng->txt("news_period_x_weeks"), 2); break;
242  case 30: $per_str = $lng->txt("news_period_1_month"); break;
243  case 60: $per_str = sprintf($lng->txt("news_period_x_months"), 2); break;
244  case 120: $per_str = sprintf($lng->txt("news_period_x_months"), 4); break;
245  case 180: $per_str = sprintf($lng->txt("news_period_x_months"), 6); break;
246  case 366: $per_str = $lng->txt("news_period_1_year"); break;
247  }
248  if ($per_str != "") {
249  $this->setTitle($this->getTitle() . ' <span style="font-weight:normal;">- ' . $per_str . "</span>");
250  }
251  }
252 
253  if ($this->getCurrentDetailLevel() == 0) {
254  return "";
255  }
256 
257  $en = "";
258  if ($ilUser->getPref("il_feed_js") == "n") {
259  $en = $this->getJSEnabler();
260  }
261 
262  return ilBlockGUI::getHTML() . $en;
263  }
static get($a_type, $a_href="")
Get icon html.
setFooterInfo($a_footerinfo, $a_hide_and_icon=false)
Set Footer Info.
static _lookupUserPDPeriod($a_user_id)
global $ilCtrl
Definition: ilias.php:18
setTitle($a_title)
Set Title.
$ilUser
Definition: imgupload.php:18
getHTML()
Handle config status.
addBlockCommand( $a_href, $a_text, $a_target="", $a_img="", $a_right_aligned=false, $a_checked=false, $a_html="")
Add Block Command.
getTitle()
Get Title.
getCurrentDetailLevel()
Get Current Detail Level.
+ Here is the call graph for this function:

◆ getNewsData()

ilPDNewsBlockGUI::getNewsData ( )

Get news for context.

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

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

Referenced by __construct().

93  {
95 
96  include_once("./Services/News/classes/class.ilNewsCache.php");
97  $this->acache = new ilNewsCache();
98 
101  $ilUser->getId(),
102  false,
103  false,
104  $per
105  );
106 
107  $this->acache->storeEntry(
108  $ilUser->getId() . ":0",
109  serialize($data)
110  );
111 
112  return $data;
113  }
static _getNewsItemsOfUser( $a_user_id, $a_only_public=false, $a_prevent_aggregation=false, $a_per=0, &$a_cnt=null)
Get all news items for a user.
static _lookupUserPDPeriod($a_user_id)
News cache.
$ilUser
Definition: imgupload.php:18
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getScreenMode()

static ilPDNewsBlockGUI::getScreenMode ( )
static

Get Screen Mode for current command.

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

References $_GET, $_POST, $DIC, $ilCtrl, IL_SCREEN_CENTER, and IL_SCREEN_SIDE.

135  {
136  global $DIC;
137 
138  $ilCtrl = $DIC->ctrl();
139 
140  $cmd = $_GET["cmd"];
141  if ($cmd == "post" && is_array($_POST["cmd"])) {
142  $cmd = array_pop(array_keys($_POST["cmd"]));
143  }
144 
145  switch ($cmd) {
146  case "showNews":
147  case "showFeedUrl":
148  case "editSettings":
149  case "changeFeedSettings":
150  return IL_SCREEN_CENTER;
151 
152  default:
153  return IL_SCREEN_SIDE;
154  }
155  }
global $DIC
Definition: saml.php:7
$_GET["client_id"]
global $ilCtrl
Definition: ilias.php:18
const IL_SCREEN_CENTER
const IL_SCREEN_SIDE
$_POST["username"]

◆ initPrivateSettingsForm()

ilPDNewsBlockGUI::initPrivateSettingsForm ( )
protected

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

References ilBlockGUI\$ctrl, $ilCtrl, $ilUser, ilBlockGUI\$lng, ilBlockGUI\$user, ilUtil\getPasswordRequirementsInfo(), ilCheckboxInputGUI\setChecked(), and ilFormPropertyGUI\setRequired().

Referenced by changeFeedSettings(), and editSettings().

448  {
450  $lng = $this->lng;
452 
453  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
454  $feed_form = new ilPropertyFormGUI();
455  $feed_form->setFormAction($ilCtrl->getFormaction($this));
456  $feed_form->setTitle($lng->txt("priv_feed_settings"));
457 
458  $feed_form->setTableWidth("100%");
459 
460  $enable_private_feed = new ilCheckboxInputGUI($lng->txt("news_enable_private_feed"), "enable_private_feed");
461  $enable_private_feed->setChecked($ilUser->_getFeedPass($ilUser->getId()));
462  $feed_form->addItem($enable_private_feed);
463 
464  $passwd = new ilPasswordInputGUI($lng->txt("password"), "desired_password");
465  $passwd->setRequired(true);
466  $passwd->setInfo(ilUtil::getPasswordRequirementsInfo());
467  $enable_private_feed->addSubItem($passwd);
468 
469  $feed_form->addCommandButton("changeFeedSettings", $lng->txt("save"));
470  $feed_form->addCommandButton("cancelSettings", $lng->txt("cancel"));
471 
472  return $feed_form;
473  }
This class represents a property form user interface.
This class represents a checkbox property in a property form.
static getPasswordRequirementsInfo()
infotext for ilPasswordInputGUI setInfo()
global $ilCtrl
Definition: ilias.php:18
setChecked($a_checked)
Set Checked.
This class represents a password property in a property form.
$ilUser
Definition: imgupload.php:18
setRequired($a_required)
Set Required.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isRepositoryObject()

ilPDNewsBlockGUI::isRepositoryObject ( )
protected

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

126  : bool
127  {
128  return false;
129  }

◆ saveSettings()

ilPDNewsBlockGUI::saveSettings ( )

Save settings.

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

References $_POST, ilBlockGUI\$block_id, ilBlockGUI\$ctrl, $ilCtrl, $ilUser, ilBlockGUI\$user, ilBlockSetting\_write(), and getBlockType().

489  {
492 
493  $news_set = new ilSetting("news");
494  $enable_internal_rss = $news_set->get("enable_rss_for_internal");
495 
497  $this->getBlockType(),
498  "news_pd_period",
499  $_POST["news_pd_period"],
500  $ilUser->getId(),
502  );
503 
504  include_once("./Services/News/classes/class.ilNewsCache.php");
505  $cache = new ilNewsCache();
506  $cache->deleteEntry($ilUser->getId() . ":0");
507 
508  $ilCtrl->returnToParent($this);
509  }
static _write($a_type, $a_setting, $a_value, $a_user=0, $a_block_id=0)
Write setting to database.
News cache.
global $ilCtrl
Definition: ilias.php:18
$ilUser
Definition: imgupload.php:18
$_POST["username"]
+ Here is the call graph for this function:

◆ showFeedUrl()

ilPDNewsBlockGUI::showFeedUrl ( )

Show feed URL.

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

References ilBlockGUI\$ctrl, $GLOBALS, $ilCtrl, $ilSetting, $ilUser, ilBlockGUI\$lng, ilNewsForContextBlockGUI\$settings, ilBlockGUI\$tpl, ilBlockGUI\$user, and ilObjUser\_lookupFeedHash().

270  {
271  $lng = $this->lng;
275 
276  $news_set = new ilSetting("news");
277 
278 
279  include_once("./Services/News/classes/class.ilNewsItem.php");
280 
281  if ($news_set->get("enable_private_feed")) {
282  $tpl = new ilTemplate("tpl.show_priv_feed_url.html", true, true, "Services/News");
283 
284  $tpl->setVariable("TXT_PRIV_TITLE", $lng->txt("news_get_priv_feed_title"));
285 
286  // #14365
287  if ($ilUser->_getFeedPass($GLOBALS['DIC']['ilUser']->getId())) {
288  $tpl->setVariable("TXT_PRIV_INFO", $lng->txt("news_get_priv_feed_info"));
289  $tpl->setVariable("TXT_PRIV_FEED_URL", $lng->txt("news_feed_url"));
290  $tpl->setVariable(
291  "VAL_PRIV_FEED_URL",
292  str_replace("://", "://" . $ilUser->getLogin() . ":-password-@", ILIAS_HTTP_PATH) . "/privfeed.php?client_id=" . rawurlencode(CLIENT_ID) . "&user_id=" . $ilUser->getId() .
293  "&hash=" . ilObjUser::_lookupFeedHash($ilUser->getId(), true)
294  );
295  $tpl->setVariable(
296  "VAL_PRIV_FEED_URL_TXT",
297  str_replace("://", "://" . $ilUser->getLogin() . ":-password-@", ILIAS_HTTP_PATH) . "/privfeed.php?client_id=" . rawurlencode(CLIENT_ID) . "&<br />user_id=" . $ilUser->getId() .
298  "&hash=" . ilObjUser::_lookupFeedHash($ilUser->getId(), true)
299  );
300  } else {
301  $tpl->setVariable("TXT_PRIV_INFO", $lng->txt("news_inactive_private_feed_info"));
302  $tpl->setVariable("EDIT_SETTINGS_URL", $ilCtrl->getLinkTarget($this, "editSettings"));
303  $tpl->setVariable("EDIT_SETTINGS_TXT", $lng->txt("news_edit_news_settings"));
304  }
305  } else {
306  $tpl = new ilTemplate("tpl.show_feed_url.html", true, true, "Services/News");
307  }
308  $tpl->setVariable("TXT_TITLE", $lng->txt("news_get_feed_title"));
309  $tpl->setVariable("TXT_INFO", $lng->txt("news_get_feed_info"));
310  $tpl->setVariable("TXT_FEED_URL", $lng->txt("news_feed_url"));
311  $tpl->setVariable(
312  "VAL_FEED_URL",
313  ILIAS_HTTP_PATH . "/feed.php?client_id=" . rawurlencode(CLIENT_ID) . "&user_id=" . $ilUser->getId() .
314  "&hash=" . ilObjUser::_lookupFeedHash($ilUser->getId(), true)
315  );
316  $tpl->setVariable(
317  "VAL_FEED_URL_TXT",
318  ILIAS_HTTP_PATH . "/feed.php?client_id=" . rawurlencode(CLIENT_ID) . "&<br />user_id=" . $ilUser->getId() .
319  "&hash=" . ilObjUser::_lookupFeedHash($ilUser->getId(), true)
320  );
321 
322  include_once("./Services/PersonalDesktop/classes/class.ilPDContentBlockGUI.php");
323  $content_block = new ilPDContentBlockGUI();
324  $content_block->setContent($tpl->get());
325  $content_block->setTitle($lng->txt("news_internal_news"));
326  $content_block->addHeaderCommand(
327  $ilCtrl->getParentReturn($this),
328  $lng->txt("selected_items_back")
329  );
330 
331  return $content_block->getHTML();
332  }
global $ilCtrl
Definition: ilias.php:18
special template class to simplify handling of ITX/PEAR
$ilUser
Definition: imgupload.php:18
global $ilSetting
Definition: privfeed.php:17
static _lookupFeedHash($a_user_id, $a_create=false)
Lookup news feed hash for user.
BlockGUI class for (centered) Content on Personal Desktop.
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
+ Here is the call graph for this function:

◆ showNews()

ilPDNewsBlockGUI::showNews ( )

show news

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

350  {
351  // workaround for dynamic mode (if cache is disabled, showNews has no data)
352  // if (empty(self::$st_data))
353  // {
354  // $this->setData($this->getNewsData());
355  // }
356 
357  return parent::showNews();
358  }

Field Documentation

◆ $acc_results

ilPDNewsBlockGUI::$acc_results = false
protected

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

◆ $block_type

ilPDNewsBlockGUI::$block_type = "pdnews"
static

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

◆ $st_data

ilPDNewsBlockGUI::$st_data
static

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


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