ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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...
 
 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...
 
 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
 __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 getBlockType ()
 Get block type. More...
 
static isRepositoryObject ()
 Is block used in repository object? More...
 
static getScreenMode ()
 Get Screen Mode for current command. More...
 
- Static Public Member Functions inherited from ilNewsForContextBlockGUI
static getBlockType ()
 Get block type. More...
 
static isRepositoryObject ()
 Is this a repository object. More...
 
static getScreenMode ()
 Get Screen Mode for current command. More...
 
- Static Public Member Functions inherited from ilBlockGUI
static getBlockType ()
 
static isRepositoryObject ()
 
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

 initPrivateSettingsForm ()
 
- Protected Member Functions inherited from ilBlockGUI
 fillRowColor ($a_placeholder="CSS_ROW")
 
 preloadData (array $data)
 Can be overwritten in subclasses. More...
 

Protected Attributes

 $acc_results = false
 
- 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
 

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, $ilBench, $ilCtrl, $ilUser, $lng, ilBlockGUI\__construct(), array, ilBlockGUI\getCurrentDetailLevel(), ilNewsForContextBlockGUI\getDynamic(), getNewsData(), ilNewsForContextBlockGUI\handleView(), ilNewsItem\prepareNewsDataFromCache(), ilBlockGUI\setAvailableDetailLevels(), ilBlockGUI\setData(), ilBlockGUI\setLimit(), ilBlockGUI\setRowTemplate(), and ilBlockGUI\setTitle().

26  {
27  global $ilCtrl, $lng, $ilUser, $ilBench, $ilAccess, $ilCtrl;
28 
29  $ilBench->start("News", "ilPDNewsBlockGUI_Constructor");
30  $news_set = new ilSetting("news");
31 
32  // NOT ilNewsForContextBlockGUI::__construct() !
34 
35  $lng->loadLanguageModule("news");
36  include_once("./Services/News/classes/class.ilNewsItem.php");
37 
38  $this->setLimit(5);
39  $this->setAvailableDetailLevels(3);
40 
41  $this->dynamic = false;
42 
43  // store current access check results
44 // $this->acc_results = $ilAccess->getResults();
45 
46  // read access cache
47 // $this->acc_cache_hit = $ilAccess->readCache(
48 // ((int) $news_set->get("acc_cache_mins")) * 60);
49 
50  include_once("./Services/News/classes/class.ilNewsCache.php");
51  $this->acache = new ilNewsCache();
52  $cres = unserialize($this->acache->getEntry($ilUser->getId().":0"));
53  $this->cache_hit = false;
54  if ($this->acache->getLastAccessStatus() == "hit" && is_array($cres))
55  {
56  self::$st_data = ilNewsItem::prepareNewsDataFromCache($cres);;
57  $this->cache_hit = true;
58  }
59 
60  if ($this->getDynamic() && !$this->cache_hit)
61  {
62  $this->dynamic = true;
63  $data = array();
64  }
65  else if ($this->getCurrentDetailLevel() > 0)
66  {
67  // do not ask two times for the data (e.g. if user displays a
68  // single item on the personal desktop and the news block is
69  // displayed at the same time)
70  if (empty(self::$st_data))
71  {
72  self::$st_data = $this->getNewsData();
73  $data = self::$st_data;
74  }
75  else
76  {
77  $data = self::$st_data;
78  }
79  }
80  else
81  {
82  $data = array();
83  }
84 
85  $this->setTitle($lng->txt("news_internal_news"));
86  $this->setRowTemplate("tpl.block_row_news_for_context.html", "Services/News");
87 
88  $this->setData($data);
89 
90  $this->handleView();
91 
92  // reset access check results
93  $ilAccess->setResults($this->acc_results);
94 
95  $ilBench->stop("News", "ilPDNewsBlockGUI_Constructor");
96  }
ILIAS Setting Class.
handleView()
Handles show/hide notification view and removes notifications if hidden.
static prepareNewsDataFromCache($a_cres)
Prepare news data from cache.
News cache.
global $ilCtrl
Definition: ilias.php:18
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
Create styles array
The data for the language used.
__construct()
Constructor.
getNewsData()
Get news for context.
setLimit($a_limit)
Set Limit.
global $lng
Definition: privfeed.php:17
global $ilBench
Definition: ilias.php:18
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 347 of file class.ilPDNewsBlockGUI.php.

References $ilCtrl, and $lng.

348  {
349  global $lng, $ilCtrl;
350 
351  $a_content_block->addHeaderCommand($ilCtrl->getParentReturn($this),
352  $lng->txt("selected_items_back"));
353  }
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:17

◆ cancelSettings()

ilPDNewsBlockGUI::cancelSettings ( )

Cancel settings.

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

References $ilCtrl.

483  {
484  global $ilCtrl;
485 
486  $ilCtrl->returnToParent($this);
487  }
global $ilCtrl
Definition: ilias.php:18

◆ changeFeedSettings()

ilPDNewsBlockGUI::changeFeedSettings ( )

change user password

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

References $ilCtrl, $ilUser, $lng, ilNewsForContextBlockGUI\editSettings(), ilUserPasswordManager\getInstance(), initPrivateSettingsForm(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

514  {
515  global $ilCtrl, $lng, $ilUser;
516 
517  $form = $this->initPrivateSettingsForm();
518  if($form->checkInput())
519  {
520  // Deactivate private Feed - just delete the password
521  if (!$form->getInput("enable_private_feed"))
522  {
523  $ilUser->_setFeedPass($ilUser->getId(), "");
524  ilUtil::sendSuccess($lng->txt("priv_feed_disabled"),true);
525  // $ilCtrl->returnToParent($this);
526  $ilCtrl->redirect($this, "showFeedUrl");
527  }
528  else
529  {
530  $passwd = $form->getInput("desired_password");
531  require_once 'Services/User/classes/class.ilUserPasswordManager.php';
532  if(ilUserPasswordManager::getInstance()->verifyPassword($ilUser, $passwd))
533  {
534  $form->getItemByPostVar("desired_password")->setAlert($lng->txt("passwd_equals_ilpasswd"));
535  ilUtil::sendFailure($lng->txt("form_input_not_valid"));
536  }
537  else
538  {
539  $ilUser->_setFeedPass($ilUser->getId(), $passwd);
540  ilUtil::sendSuccess($lng->txt("saved_successfully"),true);
541  // $ilCtrl->returnToParent($this);
542  $ilCtrl->redirect($this, "showFeedUrl");
543  }
544  }
545  }
546 
547  $form->setValuesByPost();
548  return $this->editSettings($form);
549  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
global $ilCtrl
Definition: ilias.php:18
$ilUser
Definition: imgupload.php:18
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
global $lng
Definition: privfeed.php:17
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 373 of file class.ilPDNewsBlockGUI.php.

References $ilCtrl, $ilSetting, $ilUser, $lng, ilNewsItem\_lookupDefaultPDPeriod(), ilNewsItem\_lookupUserPDPeriod(), array, initPrivateSettingsForm(), and ilSelectInputGUI\setOptions().

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

◆ executeCommand()

ilPDNewsBlockGUI::executeCommand ( )

execute command

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

References $cmd, and $ilCtrl.

172  {
173  global $ilCtrl;
174 
175  $next_class = $ilCtrl->getNextClass();
176  $cmd = $ilCtrl->getCmd("getHTML");
177 
178  switch ($next_class)
179  {
180  default:
181  return $this->$cmd();
182  }
183  }
$cmd
Definition: sahs_server.php:35
global $ilCtrl
Definition: ilias.php:18

◆ fillDataSection()

ilPDNewsBlockGUI::fillDataSection ( )

Fill data section.

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

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

189  {
190  global $ilBench;
191 
192  if ($this->dynamic)
193  {
194  $this->setDataSection($this->getDynamicReload());
195  }
196  else if ($this->getCurrentDetailLevel() > 1 && count($this->getData()) > 0)
197  {
198  $ilBench->start("News", "ilPDNewsBlockGUI_fillDataSection");
199  parent::fillDataSection();
200  $ilBench->stop("News", "ilPDNewsBlockGUI_fillDataSection");
201  }
202  else
203  {
204  $this->setEnableNumInfo(false);
205  if (count($this->getData()) == 0)
206  {
207  $this->setEnableDetailRow(false);
208  }
209  $this->setDataSection($this->getOverview());
210  }
211  }
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.
global $ilBench
Definition: ilias.php:18
setEnableDetailRow($a_enabledetailrow)
Set EnableDetailRow.
getCurrentDetailLevel()
Get Current Detail Level.
+ Here is the call graph for this function:

◆ getBlockType()

static ilPDNewsBlockGUI::getBlockType ( )
static

Get block type.

Returns
string Block type.

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

Referenced by saveSettings().

128  {
129  return self::$block_type;
130  }
+ Here is the caller graph for this function:

◆ getHTML()

ilPDNewsBlockGUI::getHTML ( )

Get bloch HTML code.

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

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

217  {
218  global $ilCtrl, $lng, $ilUser;
219 
220  // set footer info
221  $this->setFooterInfo($lng->txt("news_block_information"), true);
222 
223  $news_set = new ilSetting("news");
224  $enable_internal_rss = $news_set->get("enable_rss_for_internal");
225  $allow_shorter_periods = $news_set->get("allow_shorter_periods");
226  $allow_longer_periods = $news_set->get("allow_longer_periods");
227  $enable_private_feed = $news_set->get("enable_private_feed");
228 
229  // subscribe/unsibscribe link
230  include_once("./Services/News/classes/class.ilNewsSubscription.php");
231 
232  // show feed url
233  if ($enable_internal_rss)
234  {
235  include_once("./Services/News/classes/class.ilRSSButtonGUI.php");
236  $this->addBlockCommand(
237  $ilCtrl->getLinkTarget($this, "showFeedUrl"),
238  $lng->txt("news_get_feed_url"), "", "", true, false, ilRSSButtonGUI::get(ilRSSButtonGUI::ICON_RSS));
239  }
240 
241  if ($allow_shorter_periods || $allow_longer_periods || $enable_private_feed)
242  {
243  $this->addBlockCommand(
244  $ilCtrl->getLinkTarget($this, "editSettings"),
245  $lng->txt("settings"));
246  }
247 
248  $per = ilNewsItem::_lookupUserPDPeriod($ilUser->getId());
249 
250  if ($per > 0)
251  {
252  switch ($per)
253  {
254  case 2:
255  case 3:
256  case 5: $per_str = sprintf($lng->txt("news_period_x_days"), $per); break;
257  case 7: $per_str = $lng->txt("news_period_1_week"); break;
258  case 14: $per_str = sprintf($lng->txt("news_period_x_weeks"), 2); break;
259  case 30: $per_str = $lng->txt("news_period_1_month"); break;
260  case 60: $per_str = sprintf($lng->txt("news_period_x_months"), 2); break;
261  case 120: $per_str = sprintf($lng->txt("news_period_x_months"), 4); break;
262  case 180: $per_str = sprintf($lng->txt("news_period_x_months"), 6); break;
263  case 366: $per_str = $lng->txt("news_period_1_year"); break;
264  }
265  if ($per_str != "")
266  {
267  $this->setTitle($this->getTitle().' <span style="font-weight:normal;">- '.$per_str."</span>");
268  }
269  }
270 
271  if ($this->getCurrentDetailLevel() == 0)
272  {
273  return "";
274  }
275 
276  $en = "";
277  if ($ilUser->getPref("il_feed_js") == "n")
278  {
279  $en = $this->getJSEnabler();
280  }
281 
282  return ilBlockGUI::getHTML().$en;
283  }
ILIAS Setting Class.
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)
addBlockCommand($a_href, $a_text, $a_target="", $a_img="", $a_right_aligned=false, $a_checked=false, $a_html="")
Add Block Command.
global $ilCtrl
Definition: ilias.php:18
setTitle($a_title)
Set Title.
$ilUser
Definition: imgupload.php:18
getHTML()
Handle config status.
global $lng
Definition: privfeed.php:17
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 101 of file class.ilPDNewsBlockGUI.php.

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

Referenced by __construct().

102  {
103  global $ilUser, $ilAccess;
104 
105  include_once("./Services/News/classes/class.ilNewsCache.php");
106  $this->acache = new ilNewsCache();
107 
108  $per = ilNewsItem::_lookupUserPDPeriod($ilUser->getId());
109  $data = ilNewsItem::_getNewsItemsOfUser($ilUser->getId(), false,
110  false, $per);
111 // if (!$this->acc_cache_hit)
112 // {
113 // $ilAccess->storeCache();
114 // }
115 
116  $this->acache->storeEntry($ilUser->getId().":0",
117  serialize($data));
118 
119  return $data;
120  }
static _lookupUserPDPeriod($a_user_id)
News cache.
$ilUser
Definition: imgupload.php:18
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.
+ 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 145 of file class.ilPDNewsBlockGUI.php.

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

146  {
147  global $ilCtrl;
148 
149  $cmd = $_GET["cmd"];
150  if($cmd == "post" && is_array($_POST["cmd"]))
151  {
152  $cmd = array_pop(array_keys($_POST["cmd"]));
153  }
154 
155  switch($cmd)
156  {
157  case "showNews":
158  case "showFeedUrl":
159  case "editSettings":
160  case "changeFeedSettings":
161  return IL_SCREEN_CENTER;
162 
163  default:
164  return IL_SCREEN_SIDE;
165  }
166  }
$_GET["client_id"]
$cmd
Definition: sahs_server.php:35
global $ilCtrl
Definition: ilias.php:18
const IL_SCREEN_CENTER
const IL_SCREEN_SIDE
$_POST["username"]

◆ initPrivateSettingsForm()

ilPDNewsBlockGUI::initPrivateSettingsForm ( )
protected

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

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

Referenced by changeFeedSettings(), and editSettings().

454  {
455  global $ilCtrl, $lng, $ilUser;
456 
457  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
458  $feed_form = new ilPropertyFormGUI();
459  $feed_form->setFormAction($ilCtrl->getFormaction($this));
460  $feed_form->setTitle($lng->txt("priv_feed_settings"));
461 
462  $feed_form->setTableWidth("100%");
463 
464  $enable_private_feed = new ilCheckboxInputGUI($lng->txt("news_enable_private_feed"), "enable_private_feed");
465  $enable_private_feed->setChecked($ilUser->_getFeedPass($ilUser->getId()));
466  $feed_form->addItem($enable_private_feed);
467 
468  $passwd = new ilPasswordInputGUI($lng->txt("password"), "desired_password");
469  $passwd->setRequired(true);
470  $passwd->setInfo(ilUtil::getPasswordRequirementsInfo());
471  $enable_private_feed->addSubItem($passwd);
472 
473  $feed_form->addCommandButton("changeFeedSettings", $lng->txt("save"));
474  $feed_form->addCommandButton("cancelSettings", $lng->txt("cancel"));
475 
476  return $feed_form;
477  }
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
global $lng
Definition: privfeed.php:17
setRequired($a_required)
Set Required.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isRepositoryObject()

static ilPDNewsBlockGUI::isRepositoryObject ( )
static

Is block used in repository object?

Returns
string Block type.

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

138  {
139  return false;
140  }

◆ saveSettings()

ilPDNewsBlockGUI::saveSettings ( )

Save settings.

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

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

493  {
494  global $ilCtrl, $ilUser;
495 
496  $news_set = new ilSetting("news");
497  $enable_internal_rss = $news_set->get("enable_rss_for_internal");
498 
499  ilBlockSetting::_write($this->getBlockType(), "news_pd_period",
500  $_POST["news_pd_period"],
501  $ilUser->getId(), $this->block_id);
502 
503  include_once("./Services/News/classes/class.ilNewsCache.php");
504  $cache = new ilNewsCache();
505  $cache->deleteEntry($ilUser->getId().":0");
506 
507  $ilCtrl->returnToParent($this);
508  }
ILIAS Setting Class.
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
static getBlockType()
Get block type.
$_POST["username"]
+ Here is the call graph for this function:

◆ showFeedUrl()

ilPDNewsBlockGUI::showFeedUrl ( )

Show feed URL.

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

References $GLOBALS, $ilCtrl, $ilSetting, $ilUser, $lng, and $tpl.

290  {
291  global $lng, $ilCtrl, $ilUser, $ilSetting;
292 
293  $news_set = new ilSetting("news");
294 
295 
296  include_once("./Services/News/classes/class.ilNewsItem.php");
297 
298  if ($news_set->get("enable_private_feed"))
299  {
300  $tpl = new ilTemplate("tpl.show_priv_feed_url.html", true, true, "Services/News");
301 
302  $tpl->setVariable("TXT_PRIV_TITLE", $lng->txt("news_get_priv_feed_title"));
303 
304  // #14365
305  if($ilUser->_getFeedPass($GLOBALS['DIC']['ilUser']->getId()))
306  {
307  $tpl->setVariable("TXT_PRIV_INFO", $lng->txt("news_get_priv_feed_info"));
308  $tpl->setVariable("TXT_PRIV_FEED_URL", $lng->txt("news_feed_url"));
309  $tpl->setVariable("VAL_PRIV_FEED_URL",
310  str_replace("://", "://" . $ilUser->getLogin() . ":-password-@", ILIAS_HTTP_PATH)."/privfeed.php?client_id=".rawurlencode(CLIENT_ID)."&user_id=".$ilUser->getId().
311  "&hash=".ilObjUser::_lookupFeedHash($ilUser->getId(), true));
312  $tpl->setVariable("VAL_PRIV_FEED_URL_TXT",
313  str_replace("://", "://" . $ilUser->getLogin() . ":-password-@", ILIAS_HTTP_PATH)."/privfeed.php?client_id=".rawurlencode(CLIENT_ID)."&<br />user_id=".$ilUser->getId().
314  "&hash=".ilObjUser::_lookupFeedHash($ilUser->getId(), true));
315  }
316  else
317  {
318  $tpl->setVariable("TXT_PRIV_INFO", $lng->txt("news_inactive_private_feed_info"));
319  $tpl->setVariable("EDIT_SETTINGS_URL", $ilCtrl->getLinkTarget($this, "editSettings"));
320  $tpl->setVariable("EDIT_SETTINGS_TXT", $lng->txt("news_edit_news_settings"));
321  }
322  }
323  else
324  {
325  $tpl = new ilTemplate("tpl.show_feed_url.html", true, true, "Services/News");
326  }
327  $tpl->setVariable("TXT_TITLE", $lng->txt("news_get_feed_title"));
328  $tpl->setVariable("TXT_INFO", $lng->txt("news_get_feed_info"));
329  $tpl->setVariable("TXT_FEED_URL", $lng->txt("news_feed_url"));
330  $tpl->setVariable("VAL_FEED_URL",
331  ILIAS_HTTP_PATH."/feed.php?client_id=".rawurlencode(CLIENT_ID)."&user_id=".$ilUser->getId().
332  "&hash=".ilObjUser::_lookupFeedHash($ilUser->getId(), true));
333  $tpl->setVariable("VAL_FEED_URL_TXT",
334  ILIAS_HTTP_PATH."/feed.php?client_id=".rawurlencode(CLIENT_ID)."&<br />user_id=".$ilUser->getId().
335  "&hash=".ilObjUser::_lookupFeedHash($ilUser->getId(), true));
336 
337  include_once("./Services/PersonalDesktop/classes/class.ilPDContentBlockGUI.php");
338  $content_block = new ilPDContentBlockGUI();
339  $content_block->setContent($tpl->get());
340  $content_block->setTitle($lng->txt("news_internal_news"));
341  $content_block->addHeaderCommand($ilCtrl->getParentReturn($this),
342  $lng->txt("selected_items_back"));
343 
344  return $content_block->getHTML();
345  }
ILIAS Setting Class.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
global $tpl
Definition: ilias.php:8
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
global $lng
Definition: privfeed.php:17
BlockGUI class for (centered) Content on Personal Desktop.

◆ showNews()

ilPDNewsBlockGUI::showNews ( )

show news

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

360  {
361  // workaround for dynamic mode (if cache is disabled, showNews has no data)
362 // if (empty(self::$st_data))
363 // {
364 // $this->setData($this->getNewsData());
365 // }
366 
367  return parent::showNews();
368  }

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: