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

BlockGUI class for block NewsForContext. More...

+ Inheritance diagram for ilNewsForContextBlockGUI:
+ Collaboration diagram for ilNewsForContextBlockGUI:

Public Member Functions

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

Data Fields

const OBJECTS_WITH_NEWS_SUBTAB = ["category", "course", "group", "forum"]
 object type names with settings->news settings subtab More...
 

Static Public Attributes

static $block_type = "news"
 
static $st_data
 

Protected Member Functions

 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

 $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
 

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$

ilNewsForContextBlockGUI: ilColumnGUI ilNewsForContextBlockGUI: ilNewsItemGUI

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

Constructor & Destructor Documentation

◆ __construct()

ilNewsForContextBlockGUI::__construct ( )

Constructor.

Definition at line 48 of file class.ilNewsForContextBlockGUI.php.

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

49  {
50  global $DIC;
51 
52  $this->ctrl = $DIC->ctrl();
53  $this->lng = $DIC->language();
54  $this->user = $DIC->user();
55  $this->help = $DIC["ilHelp"];
56  $this->access = $DIC->access();
57  $this->settings = $DIC->settings();
58  $this->tabs = $DIC->tabs();
59  $this->obj_definition = $DIC["objDefinition"];
60  $this->ui = $DIC->ui();
61 
62  $ilCtrl = $DIC->ctrl();
63  $lng = $DIC->language();
64  $ilUser = $DIC->user();
65  $ilHelp = $DIC["ilHelp"];
66 
67  parent::__construct();
68 
69  $lng->loadLanguageModule("news");
70  $ilHelp->addHelpSection("news_block");
71 
72  include_once("./Services/News/classes/class.ilNewsItem.php");
73  $this->setBlockId($ilCtrl->getContextObjId());
74  $this->setLimit(5);
75  $this->setAvailableDetailLevels(3);
76  $this->setEnableNumInfo(true);
77 
78  $this->dynamic = false;
79  include_once("./Services/News/classes/class.ilNewsCache.php");
80  $this->acache = new ilNewsCache();
81  $cres = unserialize($this->acache->getEntry($ilUser->getId() . ":" . $_GET["ref_id"]));
82  $this->cache_hit = false;
83 
84  if ($this->acache->getLastAccessStatus() == "hit" && is_array($cres)) {
85  self::$st_data = ilNewsItem::prepareNewsDataFromCache($cres);
86  $this->cache_hit = true;
87  }
88  if ($this->getDynamic() && !$this->cache_hit) {
89  $this->dynamic = true;
90  $data = array();
91  } elseif ($this->getCurrentDetailLevel() > 0) {
92  if (!empty(self::$st_data)) {
93  $data = self::$st_data;
94  } else {
95  $data = $this->getNewsData();
96  self::$st_data = $data;
97  }
98  } else {
99  $data = array();
100  }
101 
102  $this->setTitle($lng->txt("news_internal_news"));
103  $this->setRowTemplate("tpl.block_row_news_for_context.html", "Services/News");
104  $this->setData($data);
105  $this->allow_moving = false;
106  $this->handleView();
107  }
settings()
Definition: settings.php:2
global $DIC
Definition: saml.php:7
handleView()
Handles show/hide notification view and removes notifications if hidden.
$_GET["client_id"]
setEnableNumInfo($a_enablenuminfo)
Set Enable Item Number Info.
static prepareNewsDataFromCache($a_cres)
Prepare news data from cache.
user()
Definition: user.php:4
News cache.
global $ilCtrl
Definition: ilias.php:18
setTitle($a_title)
Set Title.
setBlockId($a_block_id=0)
Set Block Id.
setData($a_data)
Set Data.
setAvailableDetailLevels($a_max, $a_min=0)
Set Available Detail Levels.
$ilUser
Definition: imgupload.php:18
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()

ilNewsForContextBlockGUI::addCloseCommand (   $a_content_block)

Definition at line 1456 of file class.ilNewsForContextBlockGUI.php.

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

Referenced by showNews().

1457  {
1458  $lng = $this->lng;
1459  $ilCtrl = $this->ctrl;
1460 
1461  $a_content_block->addHeaderCommand(
1462  $ilCtrl->getParentReturn($this),
1463  $lng->txt("close"),
1464  true
1465  );
1466  }
global $ilCtrl
Definition: ilias.php:18
+ Here is the caller graph for this function:

◆ addToSettingsForm()

static ilNewsForContextBlockGUI::addToSettingsForm ( ilFormPropertyGUI  $a_input)
static

Add inputs to the container news settings form to configure also the contextBlock options.

Parameters
ilFormPropertyGUI$a_input

Definition at line 1259 of file class.ilNewsForContextBlockGUI.php.

References $_GET, ilBlockGUI\$block_id, $DIC, ilBlockGUI\$lng, ilNewsItem\_getDefaultVisibilityForRefId(), ilBlockSetting\_lookup(), ilRadioOption\setInfo(), and ilFormPropertyGUI\setInfo().

Referenced by ilContainerNewsSettingsGUI\initForm().

1260  {
1261  global $DIC;
1262 
1263  $lng = $DIC->language();
1264  $block_id = $DIC->ctrl()->getContextObjId();
1265 
1266  $news_set = new ilSetting("news");
1267  $enable_internal_rss = $news_set->get("enable_rss_for_internal");
1268 
1269  //$public_notification = ilBlockSetting::_lookup(self::$block_type, "public_notifications",0, $block_id);
1270  $public_feed = ilBlockSetting::_lookup(
1271  self::$block_type,
1272  "public_feed",
1273  0,
1274  $block_id
1275  );
1276 
1277  $default_visibility = ilBlockSetting::_lookup(self::$block_type, "default_visibility", 0, $block_id);
1278  if ($default_visibility == "") {
1279  $default_visibility =
1281  }
1282  $radio_group = new ilRadioGroupInputGUI($lng->txt("news_default_visibility"), "default_visibility");
1283  $radio_option = new ilRadioOption($lng->txt("news_visibility_users"), "users");
1284  $radio_group->addOption($radio_option);
1285  $radio_option = new ilRadioOption($lng->txt("news_visibility_public"), "public");
1286  $radio_group->addOption($radio_option);
1287  $radio_group->setInfo($lng->txt("news_news_item_visibility_info"));
1288  $radio_group->setRequired(false);
1289  $radio_group->setValue($default_visibility);
1290  $a_input->addSubItem($radio_group);
1291 
1292  // extra rss feed
1293  if ($enable_internal_rss) {
1294  $radio_rss = new ilCheckboxInputGUI(
1295  $lng->txt("news_public_feed"),
1296  "notifications_public_feed"
1297  );
1298  $radio_rss->setInfo($lng->txt("news_public_feed_info"));
1299  $radio_rss->setChecked($public_feed);
1300  $a_input->addSubItem($radio_rss);
1301  }
1302  }
This class represents an option in a radio group.
global $DIC
Definition: saml.php:7
$_GET["client_id"]
This class represents a checkbox property in a property form.
setInfo($a_info)
Set Info.
setInfo($a_info)
Set Information Text.
This class represents a property in a property form.
static _lookup($a_type, $a_setting, $a_user=0, $a_block_id=0)
Lookup setting from database.
static _getDefaultVisibilityForRefId($a_ref_id)
Get default visibility for reference id.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cancelSettings()

ilNewsForContextBlockGUI::cancelSettings ( )

Cancel settings.

Definition at line 1317 of file class.ilNewsForContextBlockGUI.php.

References ilBlockGUI\$ctrl, and $ilCtrl.

1318  {
1319  $ilCtrl = $this->ctrl;
1320 
1321  $ilCtrl->returnToParent($this);
1322  }
global $ilCtrl
Definition: ilias.php:18

◆ disableJS()

ilNewsForContextBlockGUI::disableJS ( )

Definition at line 1548 of file class.ilNewsForContextBlockGUI.php.

References $_SESSION, ilBlockGUI\$ctrl, $ilCtrl, $ilUser, and ilBlockGUI\$user.

1549  {
1550  $ilCtrl = $this->ctrl;
1551  $ilUser = $this->user;
1552 
1553  $_SESSION["il_feed_js"] = "n";
1554  $ilUser->writePref("il_feed_js", "n");
1555  $ilCtrl->returnToParent($this);
1556  //$ilCtrl->redirectByClass("ilpersonaldesktopgui", "show");
1557  }
$_SESSION["AccountId"]
global $ilCtrl
Definition: ilias.php:18
$ilUser
Definition: imgupload.php:18

◆ editSettings()

ilNewsForContextBlockGUI::editSettings ( )

Show settings screen.

Definition at line 1098 of file class.ilNewsForContextBlockGUI.php.

References initSettingsForm().

Referenced by ilPDNewsBlockGUI\changeFeedSettings().

1099  {
1100  $this->initSettingsForm();
1101  return $this->settings_form->getHTML();
1102  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ enableJS()

ilNewsForContextBlockGUI::enableJS ( )

Definition at line 1559 of file class.ilNewsForContextBlockGUI.php.

References $_SESSION, $ilUser, ilBlockGUI\$user, exit, and getHTML().

1560  {
1561  $ilUser = $this->user;
1562  //echo "enableJS";
1563  $_SESSION["il_feed_js"] = "y";
1564  $ilUser->writePref("il_feed_js", "y");
1565  echo $this->getHTML();
1566  exit;
1567  }
$_SESSION["AccountId"]
$ilUser
Definition: imgupload.php:18
exit
Definition: backend.php:16
+ Here is the call graph for this function:

◆ executeCommand()

ilNewsForContextBlockGUI::executeCommand ( )

execute command

Definition at line 208 of file class.ilNewsForContextBlockGUI.php.

References ilBlockGUI\$ctrl, $html, $ilCtrl, and getEnableEdit().

209  {
211 
212  $next_class = $ilCtrl->getNextClass();
213  $cmd = $ilCtrl->getCmd("getHTML");
214 
215  switch ($next_class) {
216  case "ilnewsitemgui":
217  include_once("./Services/News/classes/class.ilNewsItemGUI.php");
218  $news_item_gui = new ilNewsItemGUI();
219  $news_item_gui->setEnableEdit($this->getEnableEdit());
220  $html = $ilCtrl->forwardCommand($news_item_gui);
221  return $html;
222 
223  default:
224  return $this->$cmd();
225  }
226  }
User Interface for NewsItem entities.
global $ilCtrl
Definition: ilias.php:18
$html
Definition: example_001.php:87
+ Here is the call graph for this function:

◆ fillDataSection()

ilNewsForContextBlockGUI::fillDataSection ( )

Fill data section.

Definition at line 251 of file class.ilNewsForContextBlockGUI.php.

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

252  {
253  if ($this->dynamic) {
254  $this->setDataSection($this->getDynamicReload());
255  } elseif ($this->getCurrentDetailLevel() > 1 && count($this->getData()) > 0) {
256  parent::fillDataSection();
257  } else {
258  $this->setDataSection($this->getOverview());
259  }
260  }
setDataSection($a_content)
Call this from overwritten fillDataSection(), if standard row based data is not used.
getData()
Get Data.
getCurrentDetailLevel()
Get Current Detail Level.
+ Here is the call graph for this function:

◆ fillFooter()

ilNewsForContextBlockGUI::fillFooter ( )

block footer

Definition at line 977 of file class.ilNewsForContextBlockGUI.php.

References ilBlockGUI\$ctrl, $ilCtrl, $ilUser, ilBlockGUI\$lng, ilBlockGUI\$user, and showViewFooter().

978  {
980  $lng = $this->lng;
982 
983  parent::fillFooter();
984 
985  if ($this->show_view_selection) {
986  $this->showViewFooter();
987  }
988  }
global $ilCtrl
Definition: ilias.php:18
$ilUser
Definition: imgupload.php:18
showViewFooter()
Show additional footer for show/hide notifications.
+ Here is the call graph for this function:

◆ fillRow()

ilNewsForContextBlockGUI::fillRow (   $news)

get flat bookmark list for personal desktop

Definition at line 454 of file class.ilNewsForContextBlockGUI.php.

References ilBlockGUI\$ctrl, $ilCtrl, ilBlockGUI\$lng, $obj_definition, $type, ilObject\_lookupObjId(), ilObject\_lookupTitle(), ilObject\_lookupType(), ilNewsItem\determineNewsTitle(), ilDatePresentation\formatDate(), ilBlockGUI\getCurrentDetailLevel(), IL_CAL_DATETIME, ilObjectPlugin\lookupTxtById(), and ilUtil\shortenWords().

455  {
457  $lng = $this->lng;
459 
460  if ($this->getCurrentDetailLevel() > 2) {
461  $this->tpl->setCurrentBlock("long");
462  //$this->tpl->setVariable("VAL_CONTENT", $news["content"]);
463  $this->tpl->setVariable(
464  "VAL_CREATION_DATE",
465  ilDatePresentation::formatDate(new ilDateTime($news["creation_date"], IL_CAL_DATETIME))
466  );
467  $this->tpl->parseCurrentBlock();
468  }
469 
470  // title image type
471  if ($news["ref_id"] > 0) {
472  if ($news["agg_ref_id"] > 0) {
473  $obj_id = ilObject::_lookupObjId($news["agg_ref_id"]);
474  $type = ilObject::_lookupType($obj_id);
475  $context_ref = $news["agg_ref_id"];
476  } else {
477  $obj_id = $news["context_obj_id"];
478  $type = $news["context_obj_type"];
479  $context_ref = $news["ref_id"];
480  }
481 
482  $lang_type = in_array($type, array("sahs", "lm", "htlm"))
483  ? "lres"
484  : "obj_" . $type;
485 
486  $type_txt = ($obj_definition->isPlugin($news["context_obj_type"]))
487  ? ilObjectPlugin::lookupTxtById($news["context_obj_type"], $lang_type)
488  : $lng->txt($lang_type);
489 
490  $this->tpl->setCurrentBlock("news_context");
491  $this->tpl->setVariable("TYPE", $type_txt);
492  $this->tpl->setVariable(
493  "IMG_TYPE",
494  ilObject::_getIcon($obj_id, "tiny", $type)
495  );
496  $this->tpl->setVariable(
497  "TITLE",
499  );
500  if ($news["user_read"] > 0) {
501  $this->tpl->setVariable("TITLE_CLASS", 'class="light"');
502  }
503 
504  $this->tpl->parseCurrentBlock();
505  $ilCtrl->setParameter($this, "news_context", $context_ref);
506  } else {
507  $ilCtrl->setParameter($this, "news_context", "");
508  }
509 
510  // title
511  $this->tpl->setVariable(
512  "VAL_TITLE",
514  $news["context_obj_type"],
515  $news["title"],
516  $news["content_is_lang_var"],
517  $news["agg_ref_id"],
518  $news["aggregation"]
519  ))
520  );
521 
522 
523  if ($news["user_read"] > 0) {
524  $this->tpl->setVariable("A_CLASS", 'class="light"');
525  }
526 
527  $ilCtrl->setParameter($this, "news_id", $news["id"]);
528  $this->tpl->setVariable(
529  "HREF_SHOW",
530  $ilCtrl->getLinkTarget($this, "showNews")
531  );
532  $ilCtrl->clearParameters($this);
533  }
static shortenWords($a_str, $a_len=30, $a_dots=true)
Ensure that the maximum word lenght within a text is not longer than $a_len.
const IL_CAL_DATETIME
static lookupTxtById($plugin_id, $lang_var)
$type
static _lookupTitle($a_id)
lookup object title
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
global $ilCtrl
Definition: ilias.php:18
static _lookupObjId($a_id)
Date and time handling
static _lookupType($a_id, $a_reference=false)
lookup object type
static determineNewsTitle( $a_context_obj_type, $a_title, $a_content_is_lang_var, $a_agg_ref_id=0, $a_aggregation="")
Determine title for news item entry.
getCurrentDetailLevel()
Get Current Detail Level.
+ Here is the call graph for this function:

◆ getBlockType()

ilNewsForContextBlockGUI::getBlockType ( )

Definition at line 162 of file class.ilNewsForContextBlockGUI.php.

Referenced by getDynamicReload(), getHTML(), getJSEnabler(), handleView(), hideNotifications(), initSettingsForm(), saveSettings(), showNotifications(), and showViewFooter().

162  : string
163  {
164  return self::$block_type;
165  }
+ Here is the caller graph for this function:

◆ getDynamic()

ilNewsForContextBlockGUI::getDynamic ( )

Definition at line 1468 of file class.ilNewsForContextBlockGUI.php.

References $_SESSION, ilBlockGUI\$ctrl, $ilCtrl, $ilUser, and ilBlockGUI\$user.

Referenced by ilPDNewsBlockGUI\__construct(), and __construct().

1469  {
1470  $ilCtrl = $this->ctrl;
1471  $ilUser = $this->user;
1472 
1473  if ($ilCtrl->getCmd() == "hideNotifications" ||
1474  $ilCtrl->getCmd() == "showNotifications") {
1475  return false;
1476  }
1477 
1478  if ($ilCtrl->getCmdClass() != "ilcolumngui" && $ilCtrl->getCmd() != "enableJS") {
1479  $sess_feed_js = "";
1480  if (isset($_SESSION["il_feed_js"])) {
1481  $sess_feed_js = $_SESSION["il_feed_js"];
1482  }
1483 
1484  if ($sess_feed_js != "n" &&
1485  ($ilUser->getPref("il_feed_js") != "n" || $sess_feed_js == "y")) {
1486  // do not get feed dynamically, if cache hit is given.
1487  // if (!$this->feed->checkCacheHit())
1488  // {
1489  return true;
1490  // }
1491  }
1492  }
1493 
1494  return false;
1495  }
$_SESSION["AccountId"]
global $ilCtrl
Definition: ilias.php:18
$ilUser
Definition: imgupload.php:18
+ Here is the caller graph for this function:

◆ getDynamicReload()

ilNewsForContextBlockGUI::getDynamicReload ( )

Definition at line 1497 of file class.ilNewsForContextBlockGUI.php.

References ilBlockGUI\$ctrl, $ilCtrl, ilBlockGUI\$lng, ilBlockGUI\getBlockId(), and getBlockType().

Referenced by ilPDNewsBlockGUI\fillDataSection(), and fillDataSection().

1498  {
1499  $ilCtrl = $this->ctrl;
1500  $lng = $this->lng;
1501 
1502  $ilCtrl->setParameterByClass(
1503  "ilcolumngui",
1504  "block_id",
1505  "block_" . $this->getBlockType() . "_" . $this->getBlockId()
1506  );
1507 
1508  $rel_tpl = new ilTemplate("tpl.dynamic_reload.html", true, true, "Services/News");
1509  $rel_tpl->setVariable("TXT_LOADING", $lng->txt("news_loading_news"));
1510  $rel_tpl->setVariable("BLOCK_ID", "block_" . $this->getBlockType() . "_" . $this->getBlockId());
1511  $rel_tpl->setVariable(
1512  "TARGET",
1513  $ilCtrl->getLinkTargetByClass("ilcolumngui", "updateBlock", "", true)
1514  );
1515 
1516  // no JS
1517  $rel_tpl->setVariable("TXT_NEWS_CLICK_HERE", $lng->txt("news_no_js_click_here"));
1518  $rel_tpl->setVariable(
1519  "TARGET_NO_JS",
1520  $ilCtrl->getLinkTargetByClass(strtolower(get_class($this)), "disableJS")
1521  );
1522 
1523  return $rel_tpl->get();
1524  }
global $ilCtrl
Definition: ilias.php:18
special template class to simplify handling of ITX/PEAR
getBlockId()
Get Block Id.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getEnableEdit()

ilNewsForContextBlockGUI::getEnableEdit ( )

Get EnableEdit.

Returns
boolean Edit mode on/off

Definition at line 243 of file class.ilNewsForContextBlockGUI.php.

Referenced by executeCommand(), and getHTML().

244  {
245  return $this->enable_edit;
246  }
+ Here is the caller graph for this function:

◆ getHTML()

ilNewsForContextBlockGUI::getHTML ( )

Get bloch HTML code.

Definition at line 265 of file class.ilNewsForContextBlockGUI.php.

References $_GET, ilBlockGUI\$ctrl, $DIC, $ilCtrl, $ilUser, ilBlockGUI\$lng, ilBlockGUI\$obj_def, ilBlockGUI\$user, ilBlockSetting\_lookup(), ilObject\_lookupObjectId(), ilObject\_lookupType(), ilBlockGUI\addBlockCommand(), ilRSSButtonGUI\get(), getBlockType(), ilBlockGUI\getData(), getEnableEdit(), ilBlockGUI\getProperty(), ilBlockGUI\getRepositoryMode(), ilRSSButtonGUI\ICON_RSS, OBJECTS_WITH_NEWS_SUBTAB, ilBlockGUI\setFooterInfo(), and ilBlockGUI\setTitle().

Referenced by enableJS(), hideNotifications(), and showNotifications().

266  {
267  global $DIC;
268 
270  $lng = $this->lng;
272 
273  $news_set = new ilSetting("news");
274  $enable_internal_rss = $news_set->get("enable_rss_for_internal");
275 
276  $hide_block = ilBlockSetting::_lookup(
277  $this->getBlockType(),
278  "hide_news_block",
279  0,
280  $this->block_id
281  );
282  if ($hide_block) {
283  $this->setFooterInfo($lng->txt("news_hidden_news_block"));
284  }
285 
286  if ($this->getProperty("title") != "") {
287  $this->setTitle($this->getProperty("title"));
288  }
289 
290  $public_feed = ilBlockSetting::_lookup(
291  $this->getBlockType(),
292  "public_feed",
293  0,
294  $this->block_id
295  );
296  if ($public_feed) {
297  if ($enable_internal_rss) {
298  include_once("./Services/News/classes/class.ilRSSButtonGUI.php");
299  $this->addBlockCommand(
300  ILIAS_HTTP_PATH . "/feed.php?client_id=" . rawurlencode(CLIENT_ID) . "&" .
301  "ref_id=" . $_GET["ref_id"],
302  $lng->txt("news_feed_url"),
303  "",
304  "",
305  true,
306  false,
308  );
309  }
310  }
311 
312  /* Subscription Concept is abandonded for now (Alex)
313  // subscribe/unsibscribe link
314  include_once("./Services/News/classes/class.ilNewsSubscription.php");
315  if (ilNewsSubscription::_hasSubscribed($_GET["ref_id"], $ilUser->getId()))
316  {
317  $this->addBlockCommand(
318  $ilCtrl->getLinkTarget($this, "unsubscribeNews"),
319  $lng->txt("news_unsubscribe"));
320  }
321  else
322  {
323  $this->addBlockCommand(
324  $ilCtrl->getLinkTarget($this, "subscribeNews"),
325  $lng->txt("news_subscribe"));
326  }
327  */
328 
329  // add edit commands
330  if ($this->getEnableEdit()) {
331  $this->addBlockCommand(
332  $ilCtrl->getLinkTargetByClass("ilnewsitemgui", "editNews"),
333  $lng->txt("edit")
334  );
335 
336  $ilCtrl->setParameter($this, "add_mode", "block");
337  $this->addBlockCommand(
338  $ilCtrl->getLinkTargetByClass("ilnewsitemgui", "createNewsItem"),
339  $lng->txt("add")
340  );
341  $ilCtrl->setParameter($this, "add_mode", "");
342  }
343 
344  if ($this->getProperty("settings") == true) {
345  $ref_id = $_GET["ref_id"];
346  $obj_def = $DIC["objDefinition"];
347  $obj_id = ilObject::_lookupObjectId($ref_id);
348  $obj_type = ilObject::_lookupType($ref_id, true);
349  $obj_class = strtolower($obj_def->getClassName($obj_type));
350  $parent_gui = "ilobj" . $obj_class . "gui";
351 
352  $ilCtrl->setParameterByClass("ilcontainernewssettingsgui", "ref_id", $ref_id);
353 
354  if (in_array($obj_class, ilNewsForContextBlockGUI::OBJECTS_WITH_NEWS_SUBTAB)) {
355  $this->addBlockCommand(
356  $ilCtrl->getLinkTargetByClass(array("ilrepositorygui", $parent_gui, "ilcontainernewssettingsgui"), "show"),
357  $lng->txt("settings")
358  );
359  } else {
360  $this->addBlockCommand(
361  $ilCtrl->getLinkTarget($this, "editSettings"),
362  $lng->txt("settings")
363  );
364  }
365  }
366 
367  // do not display hidden repository news blocks for users
368  // who do not have write permission
369  if (!$this->getEnableEdit() && $this->getRepositoryMode() &&
371  $this->getBlockType(),
372  "hide_news_block",
373  0,
374  $this->block_id
375  )) {
376  return "";
377  }
378 
379  // do not display empty news blocks for users
380  // who do not have write permission
381  if (count($this->getData()) == 0 && !$this->getEnableEdit() &&
382  $this->getRepositoryMode() && !$this->dynamic
383  && (!$news_set->get("enable_rss_for_internal") ||
385  $this->getBlockType(),
386  "public_feed",
387  0,
388  $this->block_id
389  ))) {
390  return "";
391  }
392 
393  $en = "";
394  if ($ilUser->getPref("il_feed_js") == "n") {
395  // $en = getJSEnabler();
396  }
397 
398  return parent::getHTML() . $en;
399  }
static get($a_type, $a_href="")
Get icon html.
global $DIC
Definition: saml.php:7
$_GET["client_id"]
setFooterInfo($a_footerinfo, $a_hide_and_icon=false)
Set Footer Info.
getRepositoryMode()
Get RepositoryMode.
static _lookupObjectId($a_ref_id)
lookup object id
global $ilCtrl
Definition: ilias.php:18
setTitle($a_title)
Set Title.
static _lookup($a_type, $a_setting, $a_user=0, $a_block_id=0)
Lookup setting from database.
$ilUser
Definition: imgupload.php:18
static _lookupType($a_id, $a_reference=false)
lookup object type
addBlockCommand( $a_href, $a_text, $a_target="", $a_img="", $a_right_aligned=false, $a_checked=false, $a_html="")
Add Block Command.
getData()
Get Data.
const OBJECTS_WITH_NEWS_SUBTAB
object type names with settings->news settings subtab
getProperty($a_property)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getJSEnabler()

ilNewsForContextBlockGUI::getJSEnabler ( )

Definition at line 1526 of file class.ilNewsForContextBlockGUI.php.

References ilBlockGUI\$ctrl, $ilCtrl, ilBlockGUI\$lng, ilBlockGUI\getBlockId(), and getBlockType().

Referenced by ilPDNewsBlockGUI\getHTML().

1527  {
1528  $ilCtrl = $this->ctrl;
1529  $lng = $this->lng;
1530 
1531  $ilCtrl->setParameterByClass(
1532  "ilcolumngui",
1533  "block_id",
1534  "block_" . $this->getBlockType() . "_" . $this->getBlockId()
1535  );
1536  //echo "hh";
1537  $rel_tpl = new ilTemplate("tpl.js_enabler.html", true, true, "Services/News");
1538  $rel_tpl->setVariable("BLOCK_ID", "block_" . $this->getBlockType() . "_" . $this->getBlockId());
1539  $rel_tpl->setVariable(
1540  "TARGET",
1541  $ilCtrl->getLinkTargetByClass(strtolower(get_class($this)), "enableJS", true, "", false)
1542  );
1543 
1544  return $rel_tpl->get();
1545  }
global $ilCtrl
Definition: ilias.php:18
special template class to simplify handling of ITX/PEAR
getBlockId()
Get Block Id.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMediaPath()

ilNewsForContextBlockGUI::getMediaPath ( int  $mob_id)
protected
Parameters
int$mob_id
Returns
string

Definition at line 915 of file class.ilNewsForContextBlockGUI.php.

References ilObjMediaObject\_getURL().

Referenced by showNews().

916  {
917  $media_path = "";
918  if ($mob_id > 0) {
919  $mob = new ilObjMediaObject($mob_id);
920  $med = $mob->getMediaItem("Standard");
921  if (strcasecmp("Reference", $med->getLocationType()) == 0) {
922  $media_path = $med->getLocation();
923  } else {
924  $media_path = ilObjMediaObject::_getURL($mob->getId()) . "/" . $med->getLocation();
925  }
926  }
927  return $media_path;
928  }
static _getURL($a_mob_id)
get directory for files of media object (static)
Class ilObjMediaObject.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getNewsData()

ilNewsForContextBlockGUI::getNewsData ( )

Get news for context.

Definition at line 112 of file class.ilNewsForContextBlockGUI.php.

References $_GET, ilBlockGUI\$ctrl, $ilCtrl, $ilUser, and ilBlockGUI\$user.

Referenced by __construct(), hideNotifications(), showNews(), and showNotifications().

113  {
116 
117  include_once("./Services/News/classes/class.ilNewsCache.php");
118  $this->acache = new ilNewsCache();
119  /* $cres = $this->acache->getEntry($ilUser->getId().":".$_GET["ref_id"]);
120  if ($this->acache->getLastAccessStatus() == "hit" && false)
121  {
122  $news_data = unserialize($cres);
123  }
124  else
125  {*/
126  $news_item = new ilNewsItem();
127  $news_item->setContextObjId($ilCtrl->getContextObjId());
128  $news_item->setContextObjType($ilCtrl->getContextObjType());
129 
130  // workaround, better: reduce constructor and introduce
131  //$prevent_aggregation = $this->getProperty("prevent_aggregation");
132  $prevent_aggregation = true;
133  if ($ilCtrl->getContextObjType() != "frm") {
134  $forum_grouping = true;
135  } else {
136  $forum_grouping = false;
137  }
138 
139 
140  $news_data = $news_item->getNewsForRefId(
141  $_GET["ref_id"],
142  false,
143  false,
144  0,
145  $prevent_aggregation,
146  $forum_grouping
147  );
148 
149  $this->acache->storeEntry(
150  $ilUser->getId() . ":" . $_GET["ref_id"],
151  serialize($news_data)
152  );
153 
154  // }
155  //var_dump($news_data);
156  return $news_data;
157  }
$_GET["client_id"]
News cache.
global $ilCtrl
Definition: ilias.php:18
$ilUser
Definition: imgupload.php:18
+ Here is the caller graph for this function:

◆ getOverview()

ilNewsForContextBlockGUI::getOverview ( )

Get overview.

Definition at line 538 of file class.ilNewsForContextBlockGUI.php.

References ilBlockGUI\$ctrl, $ilCtrl, $ilUser, ilBlockGUI\$lng, ilBlockGUI\$user, and ilBlockGUI\getData().

Referenced by ilPDNewsBlockGUI\fillDataSection(), and fillDataSection().

539  {
541  $lng = $this->lng;
543 
544  return '<div class="small">' . ((int) count($this->getData())) . " " . $lng->txt("news_news_items") . "</div>";
545  }
global $ilCtrl
Definition: ilias.php:18
$ilUser
Definition: imgupload.php:18
getData()
Get Data.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getScreenMode()

static ilNewsForContextBlockGUI::getScreenMode ( )
static

Get Screen Mode for current command.

Definition at line 178 of file class.ilNewsForContextBlockGUI.php.

References $DIC, $ilCtrl, IL_SCREEN_CENTER, IL_SCREEN_FULL, and IL_SCREEN_SIDE.

179  {
180  global $DIC;
181 
182  $ilCtrl = $DIC->ctrl();
183 
184  if ($ilCtrl->getCmdClass() == "ilnewsitemgui") {
185  return IL_SCREEN_FULL;
186  }
187 
188  switch ($ilCtrl->getCmd()) {
189  case "showNews":
190  case "showFeedUrl":
191  return IL_SCREEN_CENTER;
192  break;
193 
194  case "editSettings":
195  case "saveSettings":
196  return IL_SCREEN_FULL;
197  break;
198 
199  default:
200  return IL_SCREEN_SIDE;
201  break;
202  }
203  }
global $DIC
Definition: saml.php:7
global $ilCtrl
Definition: ilias.php:18
const IL_SCREEN_FULL
const IL_SCREEN_CENTER
const IL_SCREEN_SIDE

◆ handleView()

ilNewsForContextBlockGUI::handleView ( )

Handles show/hide notification view and removes notifications if hidden.

Definition at line 404 of file class.ilNewsForContextBlockGUI.php.

References ilBlockGUI\$block_id, $ilUser, $row, ilBlockGUI\$user, ilBlockSetting\_lookup(), data, and getBlockType().

Referenced by ilPDNewsBlockGUI\__construct(), __construct(), hideNotifications(), and showNotifications().

405  {
407 
408  include_once("Services/Block/classes/class.ilBlockSetting.php");
409  $this->view = ilBlockSetting::_lookup(
410  $this->getBlockType(),
411  "view",
412  $ilUser->getId(),
414  );
415 
416  // check whether notices and messages exist
417  $got_notices = $got_messages = false;
418  foreach ($this->data as $row) {
419  if ($row["priority"] == 0) {
420  $got_notices = true;
421  }
422  if ($row["priority"] == 1) {
423  $got_messages = true;
424  }
425  }
426  $this->show_view_selection = false;
427 
428  if ($got_notices && $got_messages) {
429  $this->show_view_selection = true;
430  } elseif ($got_notices) {
431  $this->view = "";
432  }
433 
434  // remove notifications if hidden
435 /*
436  if (($this->view == "hide_notifications") && $this->show_view_selection)
437  {
438  $rset = array();
439  foreach($this->data as $k => $row)
440  {
441  if ($row["priority"] == 1)
442  {
443  $rset[$k] = $row;
444  }
445  }
446  $this->data = $rset;
447  }
448 */
449  }
static _lookup($a_type, $a_setting, $a_user=0, $a_block_id=0)
Lookup setting from database.
$ilUser
Definition: imgupload.php:18
$row
$this data['403_header']
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hideNotifications()

ilNewsForContextBlockGUI::hideNotifications ( )

Definition at line 1068 of file class.ilNewsForContextBlockGUI.php.

References ilBlockGUI\$block_id, ilBlockGUI\$ctrl, ilBlockGUI\$data, $ilCtrl, $ilUser, ilBlockGUI\$user, ilBlockSetting\_write(), exit, getBlockType(), getHTML(), getNewsData(), handleView(), and ilBlockGUI\setData().

1069  {
1070  $ilCtrl = $this->ctrl;
1071  $ilUser = $this->user;
1072 
1073  include_once("Services/Block/classes/class.ilBlockSetting.php");
1074  $view = ilBlockSetting::_write(
1075  $this->getBlockType(),
1076  "view",
1077  "hide_notifications",
1078  $ilUser->getId(),
1080  );
1081 
1082  // reload data
1083  $data = $this->getNewsData();
1084  $this->setData($data);
1085  $this->handleView();
1086 
1087  if ($ilCtrl->isAsynch()) {
1088  echo $this->getHTML();
1089  exit;
1090  } else {
1091  $ilCtrl->returnToParent($this);
1092  }
1093  }
static _write($a_type, $a_setting, $a_value, $a_user=0, $a_block_id=0)
Write setting to database.
handleView()
Handles show/hide notification view and removes notifications if hidden.
global $ilCtrl
Definition: ilias.php:18
setData($a_data)
Set Data.
$ilUser
Definition: imgupload.php:18
exit
Definition: backend.php:16
+ Here is the call graph for this function:

◆ initSettingsForm()

ilNewsForContextBlockGUI::initSettingsForm ( )

Init setting form.

Definition at line 1107 of file class.ilNewsForContextBlockGUI.php.

References $_GET, ilBlockGUI\$ctrl, $ilCtrl, $ilSetting, $ilUser, ilBlockGUI\$lng, $settings, $tabs, ilBlockGUI\$user, ilNewsItem\_getDefaultVisibilityForRefId(), ilBlockSetting\_lookup(), getBlockType(), ilBlockGUI\getProperty(), IL_CAL_DATETIME, ilRadioOption\setInfo(), ilFormPropertyGUI\setInfo(), and ilFormPropertyGUI\setRequired().

Referenced by editSettings(), and saveSettings().

1108  {
1109  $ilUser = $this->user;
1110  $lng = $this->lng;
1111  $ilCtrl = $this->ctrl;
1113  $ilTabs = $this->tabs;
1114 
1115  $ilTabs->clearTargets();
1116 
1117  $news_set = new ilSetting("news");
1118  $enable_internal_rss = $news_set->get("enable_rss_for_internal");
1119 
1120  $public = ilBlockSetting::_lookup(
1121  $this->getBlockType(),
1122  "public_notifications",
1123  0,
1124  $this->block_id
1125  );
1126  $public_feed = ilBlockSetting::_lookup(
1127  $this->getBlockType(),
1128  "public_feed",
1129  0,
1130  $this->block_id
1131  );
1132  $hide_block = ilBlockSetting::_lookup(
1133  $this->getBlockType(),
1134  "hide_news_block",
1135  0,
1136  $this->block_id
1137  );
1138  $hide_news_per_date = ilBlockSetting::_lookup(
1139  $this->getBlockType(),
1140  "hide_news_per_date",
1141  0,
1142  $this->block_id
1143  );
1144  $hide_news_date = ilBlockSetting::_lookup(
1145  $this->getBlockType(),
1146  "hide_news_date",
1147  0,
1148  $this->block_id
1149  );
1150 
1151  if ($hide_news_date != "") {
1152  $hide_news_date = explode(" ", $hide_news_date);
1153  }
1154 
1155  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
1156  $this->settings_form = new ilPropertyFormGUI();
1157  $this->settings_form->setTitle($lng->txt("news_settings"));
1158 
1159  // hide news block for learners
1160  if ($this->getProperty("hide_news_block_option")) {
1161  $ch = new ilCheckboxInputGUI(
1162  $lng->txt("news_hide_news_block"),
1163  "hide_news_block"
1164  );
1165  $ch->setInfo($lng->txt("news_hide_news_block_info"));
1166  $ch->setChecked($hide_block);
1167  $this->settings_form->addItem($ch);
1168 
1169  $hnpd = new ilCheckboxInputGUI(
1170  $lng->txt("news_hide_news_per_date"),
1171  "hide_news_per_date"
1172  );
1173  $hnpd->setInfo($lng->txt("news_hide_news_per_date_info"));
1174  $hnpd->setChecked($hide_news_per_date);
1175 
1176  $dt_prop = new ilDateTimeInputGUI(
1177  $lng->txt("news_hide_news_date"),
1178  "hide_news_date"
1179  );
1180  $dt_prop->setRequired(true);
1181  if ($hide_news_date != "") {
1182  $dt_prop->setDate(new ilDateTime($hide_news_date[0] . ' ' . $hide_news_date[1], IL_CAL_DATETIME));
1183  }
1184  #$dt_prop->setDate($hide_news_date[0]);
1185  #$dt_prop->setTime($hide_news_date[1]);
1186  $dt_prop->setShowTime(true);
1187  //$dt_prop->setInfo($lng->txt("news_hide_news_date_info"));
1188  $hnpd->addSubItem($dt_prop);
1189 
1190  $this->settings_form->addItem($hnpd);
1191  }
1192 
1193  // default visibility
1194  if ($this->getProperty("default_visibility_option") &&
1195  $enable_internal_rss) {
1196  $default_visibility = ilBlockSetting::_lookup(
1197  $this->getBlockType(),
1198  "default_visibility",
1199  0,
1200  $this->block_id
1201  );
1202  if ($default_visibility == "") {
1203  $default_visibility =
1205  }
1206 
1207  // Default Visibility
1208  $radio_group = new ilRadioGroupInputGUI($lng->txt("news_default_visibility"), "default_visibility");
1209  $radio_option = new ilRadioOption($lng->txt("news_visibility_users"), "users");
1210  $radio_group->addOption($radio_option);
1211  $radio_option = new ilRadioOption($lng->txt("news_visibility_public"), "public");
1212  $radio_group->addOption($radio_option);
1213  $radio_group->setInfo($lng->txt("news_news_item_visibility_info"));
1214  $radio_group->setRequired(false);
1215  $radio_group->setValue($default_visibility);
1216  $this->settings_form->addItem($radio_group);
1217  }
1218 
1219  // public notifications
1220  if ($this->getProperty("public_notifications_option") &&
1221  $enable_internal_rss) {
1222  $ch = new ilCheckboxInputGUI(
1223  $lng->txt("news_notifications_public"),
1224  "notifications_public"
1225  );
1226  $ch->setInfo($lng->txt("news_notifications_public_info"));
1227  $ch->setChecked($public);
1228  $this->settings_form->addItem($ch);
1229  }
1230 
1231  // extra rss feed
1232  if ($enable_internal_rss) {
1233  $ch = new ilCheckboxInputGUI(
1234  $lng->txt("news_public_feed"),
1235  "notifications_public_feed"
1236  );
1237  $ch->setInfo($lng->txt("news_public_feed_info"));
1238  $ch->setChecked($public_feed);
1239  $this->settings_form->addItem($ch);
1240  }
1241 
1242 
1243  //$this->settings_form->addCheckboxProperty($lng->txt("news_public_feed"), "notifications_public_feed",
1244  // "1", $public_feed, $lng->txt("news_public_feed_info"));
1245  //if ($this->getProperty("public_notifications_option"))
1246  //{
1247  // $this->settings_form->addCheckboxProperty($lng->txt("news_notifications_public"), "notifications_public",
1248  // "1", $public, $lng->txt("news_notifications_public_info"));
1249  //}
1250  $this->settings_form->addCommandButton("saveSettings", $lng->txt("save"));
1251  $this->settings_form->addCommandButton("cancelSettings", $lng->txt("cancel"));
1252  $this->settings_form->setFormAction($ilCtrl->getFormaction($this));
1253  }
This class represents an option in a radio group.
const IL_CAL_DATETIME
This class represents a property form user interface.
$_GET["client_id"]
This class represents a checkbox property in a property form.
setInfo($a_info)
Set Info.
This class represents a date/time property in a property form.
global $ilCtrl
Definition: ilias.php:18
setInfo($a_info)
Set Information Text.
This class represents a property in a property form.
static _lookup($a_type, $a_setting, $a_user=0, $a_block_id=0)
Lookup setting from database.
Date and time handling
$ilUser
Definition: imgupload.php:18
global $ilSetting
Definition: privfeed.php:17
static _getDefaultVisibilityForRefId($a_ref_id)
Get default visibility for reference id.
setRequired($a_required)
Set Required.
getProperty($a_property)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isRepositoryObject()

ilNewsForContextBlockGUI::isRepositoryObject ( )
protected

Definition at line 170 of file class.ilNewsForContextBlockGUI.php.

170  : bool
171  {
172  return false;
173  }

◆ makeClickable()

ilNewsForContextBlockGUI::makeClickable (   $a_str)

Make clickable.

Parameters

Definition at line 936 of file class.ilNewsForContextBlockGUI.php.

References ilUtil\makeClickable().

937  {
938  // this fixes bug 8744. We assume that strings that contain < and >
939  // already contain html, we do not handle these
940  if (is_int(strpos($a_str, ">")) && is_int(strpos($a_str, "<"))) {
941  return $a_str;
942  }
943 
944  return ilUtil::makeClickable($a_str);
945  }
static makeClickable($a_text, $detectGotoLinks=false)
makeClickable In Texten enthaltene URLs und Mail-Adressen klickbar machen
+ Here is the call graph for this function:

◆ saveSettings()

ilNewsForContextBlockGUI::saveSettings ( )

Save settings.

Definition at line 1327 of file class.ilNewsForContextBlockGUI.php.

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

1328  {
1329  $ilCtrl = $this->ctrl;
1330  $ilUser = $this->user;
1331 
1332  $this->initSettingsForm();
1333  if ($this->settings_form->checkInput()) {
1334  $news_set = new ilSetting("news");
1335  $enable_internal_rss = $news_set->get("enable_rss_for_internal");
1336 
1337  if ($enable_internal_rss) {
1339  $this->getBlockType(),
1340  "public_notifications",
1341  $_POST["notifications_public"],
1342  0,
1343  $this->block_id
1344  );
1346  $this->getBlockType(),
1347  "public_feed",
1348  $_POST["notifications_public_feed"],
1349  0,
1350  $this->block_id
1351  );
1353  $this->getBlockType(),
1354  "default_visibility",
1355  $_POST["default_visibility"],
1356  0,
1357  $this->block_id
1358  );
1359  }
1360 
1361  if ($this->getProperty("hide_news_block_option")) {
1363  $this->getBlockType(),
1364  "hide_news_block",
1365  $_POST["hide_news_block"],
1366  0,
1367  $this->block_id
1368  );
1370  $this->getBlockType(),
1371  "hide_news_per_date",
1372  $_POST["hide_news_per_date"],
1373  0,
1374  $this->block_id
1375  );
1376 
1377  // hide date
1378  $hd = $this->settings_form->getItemByPostVar("hide_news_date");
1379  $hide_date = $hd->getDate();
1380  if ($_POST["hide_news_per_date"] && $hide_date != null) {
1382  $this->getBlockType(),
1383  "hide_news_date",
1384  $hide_date->get(IL_CAL_DATETIME),
1385  0,
1387  );
1388  } else {
1390  $this->getBlockType(),
1391  "hide_news_date",
1392  "",
1393  0,
1394  $this->block_id
1395  );
1396  }
1397  }
1398 
1399  include_once("./Services/News/classes/class.ilNewsCache.php");
1400  $cache = new ilNewsCache();
1401  $cache->deleteEntry($ilUser->getId() . ":" . $_GET["ref_id"]);
1402 
1403  $ilCtrl->returnToParent($this);
1404  } else {
1405  $this->settings_form->setValuesByPost();
1406  return $this->settings_form->getHtml();
1407  }
1408  }
static _write($a_type, $a_setting, $a_value, $a_user=0, $a_block_id=0)
Write setting to database.
const IL_CAL_DATETIME
$_GET["client_id"]
News cache.
global $ilCtrl
Definition: ilias.php:18
$ilUser
Definition: imgupload.php:18
$_POST["username"]
getProperty($a_property)
+ Here is the call graph for this function:

◆ setEnableEdit()

ilNewsForContextBlockGUI::setEnableEdit (   $a_enable_edit = 0)

Set EnableEdit.

Parameters
boolean$a_enable_editEdit mode on/off

Definition at line 233 of file class.ilNewsForContextBlockGUI.php.

234  {
235  $this->enable_edit = $a_enable_edit;
236  }

◆ showFeedUrl()

ilNewsForContextBlockGUI::showFeedUrl ( )

Show feed URL.

Definition at line 1413 of file class.ilNewsForContextBlockGUI.php.

References ilBlockGUI\$ctrl, $ilCtrl, $ilUser, ilBlockGUI\$lng, $title, ilBlockGUI\$tpl, ilBlockGUI\$user, ilObjUser\_lookupFeedHash(), and ilObject\_lookupTitle().

1414  {
1415  $lng = $this->lng;
1416  $ilCtrl = $this->ctrl;
1417  $ilUser = $this->user;
1418 
1419  include_once("./Services/News/classes/class.ilNewsItem.php");
1420 
1421  $title = ilObject::_lookupTitle($this->block_id);
1422 
1423  $tpl = new ilTemplate("tpl.show_feed_url.html", true, true, "Services/News");
1424  $tpl->setVariable(
1425  "TXT_TITLE",
1426  sprintf($lng->txt("news_feed_url_for"), $title)
1427  );
1428  $tpl->setVariable("TXT_INFO", $lng->txt("news_get_feed_info"));
1429  $tpl->setVariable("TXT_FEED_URL", $lng->txt("news_feed_url"));
1430  $tpl->setVariable(
1431  "VAL_FEED_URL",
1432  ILIAS_HTTP_PATH . "/feed.php?client_id=" . rawurlencode(CLIENT_ID) . "&user_id=" . $ilUser->getId() .
1433  "&obj_id=" . $this->block_id .
1434  "&hash=" . ilObjUser::_lookupFeedHash($ilUser->getId(), true)
1435  );
1436  $tpl->setVariable(
1437  "VAL_FEED_URL_TXT",
1438  ILIAS_HTTP_PATH . "/feed.php?client_id=" . rawurlencode(CLIENT_ID) . "&<br />user_id=" . $ilUser->getId() .
1439  "&obj_id=" . $this->block_id .
1440  "&hash=" . ilObjUser::_lookupFeedHash($ilUser->getId(), true)
1441  );
1442 
1443  include_once("./Services/PersonalDesktop/classes/class.ilPDContentBlockGUI.php");
1444  $content_block = new ilPDContentBlockGUI();
1445  $content_block->setContent($tpl->get());
1446  $content_block->setTitle($lng->txt("news_internal_news"));
1447  $content_block->addHeaderCommand(
1448  $ilCtrl->getParentReturn($this),
1449  $lng->txt("close"),
1450  true
1451  );
1452 
1453  return $content_block->getHTML();
1454  }
static _lookupTitle($a_id)
lookup object title
global $ilCtrl
Definition: ilias.php:18
special template class to simplify handling of ITX/PEAR
$ilUser
Definition: imgupload.php:18
static _lookupFeedHash($a_user_id, $a_create=false)
Lookup news feed hash for user.
BlockGUI class for (centered) Content on Personal Desktop.
+ Here is the call graph for this function:

◆ showNews()

ilNewsForContextBlockGUI::showNews ( )

show news

Definition at line 550 of file class.ilNewsForContextBlockGUI.php.

References $_GET, ilBlockGUI\$access, $c, ilBlockGUI\$ctrl, $html, $ilCtrl, $ilUser, ilBlockGUI\$lng, $title, ilBlockGUI\$tpl, $url, ilBlockGUI\$user, ilObject\_exists(), ilObjForumAccess\_getThreadForPosting(), ilBlockSetting\_lookup(), ilNewsItem\_lookupContextObjId(), ilObject\_lookupObjId(), ilObject\_lookupTitle(), ilObject\_lookupType(), ilNewsItem\_setRead(), addCloseCommand(), data, ilNewsItem\determineNewsTitle(), ilDatePresentation\formatDate(), ilBlockGUI\getData(), ilLinkButton\getInstance(), getMediaPath(), ilObjMediaObject\getMimeType(), getNewsData(), ilBlockGUI\getProperty(), ilNewsRendererFactory\getRenderer(), IL_CAL_DATETIME, ilWikiPage\lookupTitle(), ilWikiUtil\makeUrlTitle(), NEWS_PUBLIC, and ilBlockGUI\setData().

551  {
552  $lng = $this->lng;
555  $ilAccess = $this->access;
556 
557  // workaround for dynamic mode (if cache is disabled, showNews has no data)
558  if (empty(self::$st_data)) {
559  $this->setData($this->getNewsData());
560  }
561 
562  $news_set = new ilSetting("news");
563  $enable_internal_rss = $news_set->get("enable_rss_for_internal");
564 
565  include_once("./Services/News/classes/class.ilNewsItem.php");
566  $news = new ilNewsItem((int) $_GET["news_id"]);
567 
568  $tpl = new ilTemplate("tpl.show_news.html", true, true, "Services/News");
569 
570  // get current item in data set
571  $previous = $next = "";
572  reset($this->data);
573  $c = current($this->data);
574  $curr_cnt = 1;
575 
576  while ($c["id"] > 0 &&
577  $c["id"] != $_GET["news_id"]) {
578  $previous = $c;
579  $c = next($this->data);
580  $curr_cnt++;
581  }
582 
583  if (!is_array($c) && is_object($news) && $news->getId() > 0
584  && ilNewsItem::_lookupContextObjId($news->getId()) != $ilCtrl->getContextObjId()) {
585  throw new ilException("News ID does not match object context.");
586  }
587 
588 
589  // collect news items to show
590  $news_list = array();
591  if (is_array($c["aggregation"])) { // we have an aggregation
592  $news_list[] = array("ref_id" => $c["agg_ref_id"],
593  "agg_ref_id" => $c["agg_ref_id"],
594  "aggregation" => $c["aggregation"],
595  "user_id" => "",
596  "content_type" => "text",
597  "mob_id" => 0,
598  "visibility" => "",
599  "content" => "",
600  "content_long" => "",
601  "update_date" => $news->getUpdateDate(),
602  "creation_date" => "",
603  "content_is_lang_var" => false,
604  "loc_context" => $_GET["news_context"],
605  "context_obj_type" => $news->getContextObjType(),
606  "title" => "");
607 
608  foreach ($c["aggregation"] as $c_item) {
609  ilNewsItem::_setRead($ilUser->getId(), $c_item["id"]);
610  $c_item["loc_context"] = $c_item["ref_id"];
611  $c_item["loc_stop"] = $_GET["news_context"];
612  $news_list[] = $c_item;
613  }
614  } else { // no aggregation, simple news item
615  $news_list[] = array(
616  "id" => $news->getId(),
617  "ref_id" => $_GET["news_context"],
618  "user_id" => $news->getUserId(),
619  "content_type" => $news->getContentType(),
620  "mob_id" => $news->getMobId(),
621  "visibility" => $news->getVisibility(),
622  "priority" => $news->getPriority(),
623  "content" => $news->getContent(),
624  "content_long" => $news->getContentLong(),
625  "update_date" => $news->getUpdateDate(),
626  "creation_date" => $news->getCreationDate(),
627  "context_sub_obj_type" => $news->getContextSubObjType(),
628  "context_obj_type" => $news->getContextObjType(),
629  "context_sub_obj_id" => $news->getContextSubObjId(),
630  "content_is_lang_var" => $news->getContentIsLangVar(),
631  "content_text_is_lang_var" => $news->getContentTextIsLangVar(),
632  "loc_context" => $_GET["news_context"],
633  "title" => $news->getTitle());
634  ilNewsItem::_setRead($ilUser->getId(), $_GET["news_id"]);
635  }
636 
637  $row_css = "";
638  $cache_deleted = false;
639  foreach ($news_list as $item) {
640  $row_css = ($row_css != "tblrow1")
641  ? "tblrow1"
642  : "tblrow2";
643 
644  if ($item["ref_id"] > 0 && !$ilAccess->checkAccess("read", "", $item["ref_id"])) {
645  $tpl->setCurrentBlock("content");
646  $tpl->setVariable("VAL_CONTENT", $lng->txt("news_sorry_not_accessible_anymore"));
647  $tpl->parseCurrentBlock();
648  $tpl->setCurrentBlock("item");
649  $tpl->setVariable("ITEM_ROW_CSS", $row_css);
650  $tpl->parseCurrentBlock();
651  if (!$cache_deleted) {
652  $this->acache->deleteEntry($ilUser->getId() . ":" . $_GET["ref_id"]);
653  $cache_deleted = true;
654  }
655  continue;
656  }
657 
658  // user
659  if ($item["user_id"] > 0 && ilObject::_exists($item["user_id"])) {
660  // get login
661  if (ilObjUser::_exists($item["user_id"])) {
662  $user = new ilObjUser($item["user_id"]);
663  $displayname = $user->getLogin();
664  } else {
665  // this should actually not happen, since news entries
666  // should be deleted when the user is going to be removed
667  $displayname = "&lt;" . strtolower($lng->txt("deleted")) . "&gt;";
668  }
669 
670  $tpl->setCurrentBlock("user_info");
671  $tpl->setVariable("VAL_AUTHOR", $displayname);
672  $tpl->setVariable("TXT_AUTHOR", $lng->txt("author"));
673  $tpl->parseCurrentBlock();
674  }
675 
676  // media player
677  $ui_renderer = $this->ui->renderer();
678  $ui_factory = $this->ui->factory();
679  $this->ui->factory();
680  if ($item["mob_id"] > 0 && ilObject::_exists($item["mob_id"])) {
681  $media_path = $this->getMediaPath($item["mob_id"]);
682  $mime = ilObjMediaObject::getMimeType($media_path);
683  if (in_array($mime, array("image/jpeg", "image/svg+xml", "image/gif", "image/png"))) {
684  $title = basename($media_path);
685  $html = $ui_renderer->render($ui_factory->image()->responsive($media_path, $title));
686  } elseif (in_array($mime, array("audio/mpeg", "audio/ogg", "video/mp4", "video/x-flv", "video/webm"))) {
687  $mp = new ilMediaPlayerGUI();
688  $mp->setFile($media_path);
689  $mp->setDisplayHeight(200);
690  $html = $mp->getMediaPlayerHtml();
691  } else {
692  // download?
693  $html = "";
694  }
695 
696 
697  $tpl->setCurrentBlock("player");
698  $tpl->setVariable(
699  "PLAYER",
700  $html
701  );
702  $tpl->parseCurrentBlock();
703  }
704 
705  // access
706  if ($enable_internal_rss && $item["visibility"] != "") {
707  $obj_id = ilObject::_lookupObjId($item["ref_id"]);
708  $tpl->setCurrentBlock("access");
709  $tpl->setVariable("TXT_ACCESS", $lng->txt("news_news_item_visibility"));
710  if ($item["visibility"] == NEWS_PUBLIC ||
711  ($item["priority"] == 0 &&
713  "news",
714  "public_notifications",
715  0,
716  $obj_id
717  ))) {
718  $tpl->setVariable("VAL_ACCESS", $lng->txt("news_visibility_public"));
719  } else {
720  $tpl->setVariable("VAL_ACCESS", $lng->txt("news_visibility_users"));
721  }
722  $tpl->parseCurrentBlock();
723  }
724 
725  // content
726  include_once("./Services/News/classes/class.ilNewsRendererFactory.php");
727  $renderer = ilNewsRendererFactory::getRenderer($item["context_obj_type"]);
728  if (trim($item["content"]) != "") { // content
729  $it = new ilNewsItem($item["id"]);
730  $renderer->setNewsItem($it, $item["ref_id"]);
731  $tpl->setCurrentBlock("content");
732  $tpl->setVariable("VAL_CONTENT", $renderer->getDetailContent());
733  $tpl->parseCurrentBlock();
734  }
735  if ($item["update_date"] != $item["creation_date"]) { // update date
736  $tpl->setCurrentBlock("ni_update");
737  $tpl->setVariable("TXT_LAST_UPDATE", $lng->txt("last_update"));
738  $tpl->setVariable(
739  "VAL_LAST_UPDATE",
740  ilDatePresentation::formatDate(new ilDateTime($item["update_date"], IL_CAL_DATETIME))
741  );
742  $tpl->parseCurrentBlock();
743  }
744 
745  // creation date
746  if ($item["creation_date"] != "") {
747  $tpl->setCurrentBlock("ni_update");
748  $tpl->setVariable(
749  "VAL_CREATION_DATE",
750  ilDatePresentation::formatDate(new ilDateTime($item["creation_date"], IL_CAL_DATETIME))
751  );
752  $tpl->setVariable("TXT_CREATED", $lng->txt("created"));
753  $tpl->parseCurrentBlock();
754  }
755 
756 
757  // context / title
758  if ($_GET["news_context"] > 0) {
759  //$obj_id = ilObject::_lookupObjId($_GET["news_context"]);
760  $obj_id = ilObject::_lookupObjId($item["ref_id"]);
761  $obj_type = ilObject::_lookupType($obj_id);
762  $obj_title = ilObject::_lookupTitle($obj_id);
763 
764  // file hack, not nice
765  if ($obj_type == "file") {
766  $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $item["ref_id"]);
767  $url = $ilCtrl->getLinkTargetByClass("ilrepositorygui", "sendfile");
768  $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $_GET["ref_id"]);
769 
770  include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
771  $button = ilLinkButton::getInstance();
772  $button->setUrl($url);
773  $button->setCaption("download");
774 
775  $tpl->setCurrentBlock("download");
776  $tpl->setVariable("BUTTON_DOWNLOAD", $button->render());
777  $tpl->parseCurrentBlock();
778  }
779 
780  // forum hack, not nice
781  $add = "";
782  if ($obj_type == "frm" && $item["context_sub_obj_type"] == "pos"
783  && $item["context_sub_obj_id"] > 0) {
784  include_once("./Modules/Forum/classes/class.ilObjForumAccess.php");
785  $pos = $item["context_sub_obj_id"];
787  if ($thread > 0) {
788  $add = "_" . $thread . "_" . $pos;
789  }
790  }
791 
792  // wiki hack, not nice
793  if ($obj_type == "wiki" && $item["context_sub_obj_type"] == "wpg"
794  && $item["context_sub_obj_id"] > 0) {
795  include_once("./Modules/Wiki/classes/class.ilWikiPage.php");
796  $wptitle = ilWikiPage::lookupTitle($item["context_sub_obj_id"]);
797  if ($wptitle != "") {
798  $add = "_" . ilWikiUtil::makeUrlTitle($wptitle);
799  }
800  }
801 
802  $url_target = "./goto.php?client_id=" . rawurlencode(CLIENT_ID) . "&target=" .
803  $obj_type . "_" . $item["ref_id"] . $add;
804 
805  // lm page hack, not nice
806  if (in_array($obj_type, array("lm")) && $item["context_sub_obj_type"] == "pg"
807  && $item["context_sub_obj_id"] > 0) {
808  $url_target = "./goto.php?client_id=" . rawurlencode(CLIENT_ID) . "&target=" .
809  "pg_" . $item["context_sub_obj_id"] . "_" . $item["ref_id"];
810  }
811 
812  // blog posting hack, not nice
813  if ($obj_type == "blog" && $item["context_sub_obj_type"] == "blp"
814  && $item["context_sub_obj_id"] > 0) {
815  $url_target = "./goto.php?client_id=" . rawurlencode(CLIENT_ID) . "&target=" .
816  "blog_" . $item["ref_id"] . "_" . $item["context_sub_obj_id"];
817  }
818 
819  $context_opened = false;
820  if ($item["loc_context"] != null && $item["loc_context"] != $item["loc_stop"]) {
821  $tpl->setCurrentBlock("context");
822  $context_opened = true;
823  $cont_loc = new ilLocatorGUI();
824  $cont_loc->addContextItems($item["loc_context"], true, $item["loc_stop"]);
825  $tpl->setVariable("CONTEXT_LOCATOR", $cont_loc->getHTML());
826  }
827 
828  //var_dump($item);
829  if ($item["no_context_title"] !== true) {
830  if (!$context_opened) {
831  $tpl->setCurrentBlock("context");
832  }
833  $tpl->setVariable("HREF_CONTEXT_TITLE", $url_target);
834  $tpl->setVariable("CONTEXT_TITLE", $obj_title);
835  $tpl->setVariable("IMG_CONTEXT_TITLE", ilObject::_getIcon($obj_id, "big", $obj_type));
836  }
837  if ($context_opened) {
838  $tpl->parseCurrentBlock();
839  }
840 
841  $tpl->setVariable("HREF_TITLE", $url_target);
842  }
843 
844  // title
845  $tpl->setVariable(
846  "VAL_TITLE",
848  $item["context_obj_type"],
849  $item["title"],
850  $item["content_is_lang_var"],
851  $item["agg_ref_id"],
852  $item["aggregation"]
853  )
854  );
855 
856 
857  $tpl->setCurrentBlock("item");
858  $tpl->setVariable("ITEM_ROW_CSS", $row_css);
859  $tpl->parseCurrentBlock();
860  }
861 
862  include_once("./Services/PersonalDesktop/classes/class.ilPDContentBlockGUI.php");
863  $content_block = new ilPDContentBlockGUI();
864  $content_block->setContent($tpl->get());
865  if ($this->getProperty("title") != "") {
866  $content_block->setTitle($this->getProperty("title"));
867  } else {
868  $content_block->setTitle($lng->txt("news_internal_news"));
869  }
870  $this->addCloseCommand($content_block);
871 
872  // previous
873  if ($previous != "") {
874  if ($previous["ref_id"] > 0) {
875  $ilCtrl->setParameter($this, "news_context", $previous["ref_id"]);
876  }
877  $ilCtrl->setParameter($this, "news_id", $previous["id"]);
878  $content_block->addFooterLink(
879  $lng->txt("previous"),
880  $ilCtrl->getLinkTarget($this, "showNews"),
881  "",
882  "",
883  true
884  );
885  $ilCtrl->setParameter($this, "news_context", "");
886  }
887 
888  // next
889  if ($c = next($this->data)) {
890  if ($c["ref_id"] > 0) {
891  $ilCtrl->setParameter($this, "news_context", $c["ref_id"]);
892  }
893  $ilCtrl->setParameter($this, "news_id", $c["id"]);
894  $content_block->addFooterLink(
895  $lng->txt("next"),
896  $ilCtrl->getLinkTarget($this, "showNews"),
897  "",
898  "",
899  true
900  );
901  }
902  $ilCtrl->setParameter($this, "news_context", "");
903  $ilCtrl->setParameter($this, "news_id", "");
904  $content_block->setCurrentItemNumber($curr_cnt);
905  $content_block->setEnableNumInfo(true);
906  $content_block->setData($this->getData());
907 
908  return $content_block->getHTML();
909  }
static lookupTitle($a_page_id)
Checks whether a page with given title exists.
static getMimeType($a_file, $a_external=null)
get mime type for file
const IL_CAL_DATETIME
static _getThreadForPosting($a_pos_id)
Get thread id for posting.
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data
$_GET["client_id"]
static _lookupTitle($a_id)
lookup object title
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
locator handling class
global $ilCtrl
Definition: ilias.php:18
const NEWS_PUBLIC
static makeUrlTitle($a_par)
Set page parameter for Url Embedding.
static _setRead($a_user_id, $a_news_id)
Set item read.
setData($a_data)
Set Data.
static _lookupObjId($a_id)
special template class to simplify handling of ITX/PEAR
static _lookup($a_type, $a_setting, $a_user=0, $a_block_id=0)
Lookup setting from database.
Date and time handling
$ilUser
Definition: imgupload.php:18
static _lookupType($a_id, $a_reference=false)
lookup object type
getData()
Get Data.
User interface for media player.
$this data['403_header']
static getRenderer($a_context_obj_type)
Get renderer.
static _lookupContextObjId($a_news_id)
Context Object ID.
static determineNewsTitle( $a_context_obj_type, $a_title, $a_content_is_lang_var, $a_agg_ref_id=0, $a_aggregation="")
Determine title for news item entry.
$url
BlockGUI class for (centered) Content on Personal Desktop.
$html
Definition: example_001.php:87
getProperty($a_property)
+ Here is the call graph for this function:

◆ showNotifications()

ilNewsForContextBlockGUI::showNotifications ( )

Definition at line 1041 of file class.ilNewsForContextBlockGUI.php.

References ilBlockGUI\$block_id, ilBlockGUI\$ctrl, ilBlockGUI\$data, $ilCtrl, $ilUser, ilBlockGUI\$user, ilBlockSetting\_write(), exit, getBlockType(), getHTML(), getNewsData(), handleView(), and ilBlockGUI\setData().

1042  {
1043  $ilCtrl = $this->ctrl;
1044  $ilUser = $this->user;
1045 
1046  include_once("Services/Block/classes/class.ilBlockSetting.php");
1047  $view = ilBlockSetting::_write(
1048  $this->getBlockType(),
1049  "view",
1050  "",
1051  $ilUser->getId(),
1053  );
1054 
1055  // reload data
1056  $data = $this->getNewsData();
1057  $this->setData($data);
1058  $this->handleView();
1059 
1060  if ($ilCtrl->isAsynch()) {
1061  echo $this->getHTML();
1062  exit;
1063  } else {
1064  $ilCtrl->returnToParent($this);
1065  }
1066  }
static _write($a_type, $a_setting, $a_value, $a_user=0, $a_block_id=0)
Write setting to database.
handleView()
Handles show/hide notification view and removes notifications if hidden.
global $ilCtrl
Definition: ilias.php:18
setData($a_data)
Set Data.
$ilUser
Definition: imgupload.php:18
exit
Definition: backend.php:16
+ Here is the call graph for this function:

◆ showViewFooter()

ilNewsForContextBlockGUI::showViewFooter ( )

Show additional footer for show/hide notifications.

Definition at line 993 of file class.ilNewsForContextBlockGUI.php.

References ilBlockGUI\$block_id, ilBlockGUI\$ctrl, $ilCtrl, $ilUser, ilBlockGUI\$lng, ilBlockGUI\$user, ilBlockGUI\addFooterLink(), ilBlockGUI\clearFooterLinks(), ilBlockGUI\fillFooterLinks(), and getBlockType().

Referenced by fillFooter().

994  {
996  $lng = $this->lng;
998 
999  return; // notifications always shown
1000 
1001  $this->clearFooterLinks();
1002  $this->addFooterLink("[" . $lng->txt("news_first_letter_of_word_notification") . "] " .
1003  $lng->txt("news_notifications") . ": ", "", "", "", false, true);
1004  if ($this->view == "hide_notifications") {
1005  $this->addFooterLink(
1006  $lng->txt("show"),
1007  $ilCtrl->getLinkTarget(
1008  $this,
1009  "showNotifications"
1010  ),
1011  $ilCtrl->getLinkTarget(
1012  $this,
1013  "showNotifications",
1014  "",
1015  true
1016  ),
1017  "block_" . $this->getBlockType() . "_" . $this->block_id
1018  );
1019  $this->addFooterLink($lng->txt("hide"));
1020  } else {
1021  $this->addFooterLink($lng->txt("show"));
1022  $this->addFooterLink(
1023  $lng->txt("hide"),
1024  $ilCtrl->getLinkTarget(
1025  $this,
1026  "hideNotifications"
1027  ),
1028  $ilCtrl->getLinkTarget(
1029  $this,
1030  "hideNotifications",
1031  "",
1032  true
1033  ),
1034  "block_" . $this->getBlockType() . "_" . $this->block_id
1035  );
1036  }
1037 
1038  $this->fillFooterLinks();
1039  }
clearFooterLinks()
Clear footer links.
fillFooterLinks($a_top=false, $a_numinfo="")
Fill footer links.
global $ilCtrl
Definition: ilias.php:18
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.
$ilUser
Definition: imgupload.php:18
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ subscribeNews()

ilNewsForContextBlockGUI::subscribeNews ( )

Subscribe current user from news.

Definition at line 964 of file class.ilNewsForContextBlockGUI.php.

References $_GET, ilBlockGUI\$ctrl, $ilCtrl, $ilUser, ilBlockGUI\$user, and ilNewsSubscription\_subscribe().

965  {
968 
969  include_once("./Services/News/classes/class.ilNewsSubscription.php");
970  ilNewsSubscription::_subscribe($_GET["ref_id"], $ilUser->getId());
971  $ilCtrl->returnToParent($this);
972  }
$_GET["client_id"]
global $ilCtrl
Definition: ilias.php:18
$ilUser
Definition: imgupload.php:18
static _subscribe($a_ref_id, $a_user_id)
Subscribe a user to an object (ref id).
+ Here is the call graph for this function:

◆ unsubscribeNews()

ilNewsForContextBlockGUI::unsubscribeNews ( )

Unsubscribe current user from news.

Definition at line 951 of file class.ilNewsForContextBlockGUI.php.

References $_GET, ilBlockGUI\$ctrl, $ilCtrl, $ilUser, ilBlockGUI\$user, and ilNewsSubscription\_unsubscribe().

952  {
955 
956  include_once("./Services/News/classes/class.ilNewsSubscription.php");
957  ilNewsSubscription::_unsubscribe($_GET["ref_id"], $ilUser->getId());
958  $ilCtrl->returnToParent($this);
959  }
$_GET["client_id"]
static _unsubscribe($a_ref_id, $a_user_id)
Unsubscribe a user from an object (ref id).
global $ilCtrl
Definition: ilias.php:18
$ilUser
Definition: imgupload.php:18
+ Here is the call graph for this function:

◆ writeSettings()

static ilNewsForContextBlockGUI::writeSettings (   $a_values)
static

Definition at line 1304 of file class.ilNewsForContextBlockGUI.php.

References ilBlockGUI\$block_id, $DIC, $key, and ilBlockSetting\_write().

Referenced by ilContainerNewsSettingsGUI\save().

1305  {
1306  global $DIC;
1307 
1308  $block_id = $DIC->ctrl()->getContextObjId();
1309  foreach ($a_values as $key => $value) {
1310  ilBlockSetting::_write(self::$block_type, $key, $value, 0, $block_id);
1311  }
1312  }
static _write($a_type, $a_setting, $a_value, $a_user=0, $a_block_id=0)
Write setting to database.
global $DIC
Definition: saml.php:7
$key
Definition: croninfo.php:18
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $block_type

ilNewsForContextBlockGUI::$block_type = "news"
static

◆ $help

ilNewsForContextBlockGUI::$help
protected

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

◆ $obj_definition

ilNewsForContextBlockGUI::$obj_definition
protected

Definition at line 43 of file class.ilNewsForContextBlockGUI.php.

Referenced by fillRow().

◆ $settings

ilNewsForContextBlockGUI::$settings
protected

◆ $st_data

ilNewsForContextBlockGUI::$st_data
static

Definition at line 41 of file class.ilNewsForContextBlockGUI.php.

◆ $tabs

ilNewsForContextBlockGUI::$tabs
protected

Definition at line 38 of file class.ilNewsForContextBlockGUI.php.

Referenced by initSettingsForm().

◆ OBJECTS_WITH_NEWS_SUBTAB

const ilNewsForContextBlockGUI::OBJECTS_WITH_NEWS_SUBTAB = ["category", "course", "group", "forum"]

object type names with settings->news settings subtab

Definition at line 23 of file class.ilNewsForContextBlockGUI.php.

Referenced by getHTML().


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