ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
ilNewsForContextBlockGUI Class Reference

BlockGUI class for block NewsForContext. More...

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

Public Member Functions

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

Static Public Member Functions

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

Data Fields

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

Static Public Attributes

static string $block_type = "news"
 
static array $st_data
 

Protected Member Functions

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

Protected Attributes

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

Detailed Description

BlockGUI class for block NewsForContext.

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

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

Constructor & Destructor Documentation

◆ __construct()

ilNewsForContextBlockGUI::__construct ( )

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

References ilBlockGUI\$data, $DIC, $ilUser, ilBlockGUI\$lng, ILIAS\GlobalScreen\Provider\__construct(), ILIAS\Repository\access(), ILIAS\Repository\ctrl(), getDynamic(), getNewsData(), handleView(), ILIAS\Repository\help(), ILIAS\Repository\lng(), ilLanguage\loadLanguageModule(), ilNewsItem\prepareNewsDataFromCache(), ilBlockGUI\setBlockId(), ilBlockGUI\setData(), ilBlockGUI\setEnableNumInfo(), ilBlockGUI\setLimit(), ilBlockGUI\setPresentation(), ilBlockGUI\setRowTemplate(), ILIAS\Repository\settings(), ilBlockGUI\setTitle(), ILIAS\Repository\tabs(), ilLanguage\txt(), and ILIAS\Repository\user().

56  {
57  global $DIC;
58  $this->ctrl = $DIC->ctrl();
59  $this->lng = $DIC->language();
60  $this->user = $DIC->user();
61  $this->help = $DIC["ilHelp"];
62  $this->access = $DIC->access();
63  $this->settings = $DIC->settings();
64  $this->tabs = $DIC->tabs();
65  $this->obj_definition = $DIC["objDefinition"];
66  $this->std_request = new StandardGUIRequest(
67  $DIC->http(),
68  $DIC->refinery()
69  );
70 
71  $this->news_access = new NewsAccess($this->std_request->getRefId());
72 
73  $ilCtrl = $DIC->ctrl();
74  $lng = $DIC->language();
75  $ilUser = $DIC->user();
76  $ilHelp = $DIC["ilHelp"];
77 
79 
80  $lng->loadLanguageModule("news");
81  $ilHelp->addHelpSection("news_block");
82 
83  $this->setBlockId((string) $ilCtrl->getContextObjId());
84  $this->setLimit(5);
85  $this->setEnableNumInfo(true);
86 
87  $this->dynamic = false;
88  $this->acache = new ilNewsCache();
89  $cres = unserialize(
90  $this->acache->getEntry($ilUser->getId() . ":" . $this->std_request->getRefId()),
91  ["allowed_classes" => false]
92  );
93  $this->cache_hit = false;
94 
95  if ($this->acache->getLastAccessStatus() === "hit" && is_array($cres)) {
96  self::$st_data = ilNewsItem::prepareNewsDataFromCache($cres);
97  $this->cache_hit = true;
98  }
99  if ($this->getDynamic() && !$this->cache_hit) {
100  $this->dynamic = true;
101  $data = [];
102  } elseif (!empty(self::$st_data)) {
103  $data = self::$st_data;
104  } else {
105  $data = $this->getNewsData();
106  self::$st_data = $data;
107  }
108 
109  $this->setTitle($lng->txt("news_internal_news"));
110  $this->setRowTemplate("tpl.block_row_news_for_context.html", "Services/News");
111  $this->setData($data);
112  $this->allow_moving = false;
113  $this->handleView();
114 
115  $this->setPresentation(self::PRES_SEC_LIST);
116  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
ilLanguage $lng
handleView()
Handles show/hide notification view and removes notifications if hidden.
setLimit(int $a_limit)
setBlockId(string $a_block_id="0")
setEnableNumInfo(bool $a_enablenuminfo)
loadLanguageModule(string $a_module)
Load language module.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: feed.php:28
setRowTemplate(string $a_rowtemplatename, string $a_rowtemplatedir="")
Set Row Template Name.
__construct(Container $dic, ilPlugin $plugin)
$ilUser
Definition: imgupload.php:34
setTitle(string $a_title)
static prepareNewsDataFromCache(array $a_cres)
Prepare news data from cache.
setData(array $a_data)
setPresentation(int $type)
+ Here is the call graph for this function:

Member Function Documentation

◆ addToSettingsForm()

static ilNewsForContextBlockGUI::addToSettingsForm ( ilFormPropertyGUI  $a_input)
static

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

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

References ilBlockGUI\$block_id, $DIC, ilBlockGUI\$lng, ilNewsItem\_getDefaultVisibilityForRefId(), ilBlockSetting\_lookup(), ILIAS\News\StandardGUIRequest\getRefId(), ilRadioOption\setInfo(), and ilFormPropertyGUI\setInfo().

Referenced by ilContainerNewsSettingsGUI\initForm().

1057  : void
1058  {
1059  global $DIC;
1060 
1062  $DIC->http(),
1063  $DIC->refinery()
1064  );
1065 
1066  $lng = $DIC->language();
1067  $block_id = $DIC->ctrl()->getContextObjId();
1068 
1069  $news_set = new ilSetting("news");
1070  $enable_internal_rss = $news_set->get("enable_rss_for_internal");
1071 
1072  $public_feed = ilBlockSetting::_lookup(
1073  self::$block_type,
1074  "public_feed",
1075  0,
1076  $block_id
1077  );
1078  $default_visibility = ilBlockSetting::_lookup(self::$block_type, "default_visibility", 0, $block_id);
1079  if ($default_visibility == "") {
1080  $default_visibility =
1082  }
1083  $radio_group = new ilRadioGroupInputGUI($lng->txt("news_default_visibility"), "default_visibility");
1084  $radio_option = new ilRadioOption($lng->txt("news_visibility_users"), "users");
1085  $radio_group->addOption($radio_option);
1086  $radio_option = new ilRadioOption($lng->txt("news_visibility_public"), "public");
1087  $radio_group->addOption($radio_option);
1088  $radio_group->setInfo($lng->txt("news_news_item_visibility_info"));
1089  $radio_group->setRequired(false);
1090  $radio_group->setValue($default_visibility);
1091  $a_input->addSubItem($radio_group);
1092 
1093  // extra rss feed
1094  if ($enable_internal_rss) {
1095  $radio_rss = new ilCheckboxInputGUI(
1096  $lng->txt("news_public_feed"),
1097  "notifications_public_feed"
1098  );
1099  $radio_rss->setInfo($lng->txt("news_public_feed_info"));
1100  $radio_rss->setChecked((bool) $public_feed);
1101  $a_input->addSubItem($radio_rss);
1102  }
1103  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getDefaultVisibilityForRefId(int $a_ref_id)
Get default visibility for reference id.
ilLanguage $lng
setInfo(string $a_info)
This class represents a checkbox property in a property form.
global $DIC
Definition: feed.php:28
This class represents a property in a property form.
static _lookup(string $a_type, string $a_setting, int $a_user=0, int $a_block_id=0)
Lookup setting from database.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cancelSettings()

ilNewsForContextBlockGUI::cancelSettings ( )

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

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

1115  : void
1116  {
1117  $ilCtrl = $this->ctrl;
1118 
1119  $ilCtrl->returnToParent($this);
1120  }
returnToParent(object $a_gui_obj, string $a_anchor=null)
+ Here is the call graph for this function:

◆ disableJS()

ilNewsForContextBlockGUI::disableJS ( )

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

References ilBlockGUI\$ctrl, $ilUser, ilBlockGUI\$user, and ilSession\set().

1325  : void
1326  {
1327  $ilCtrl = $this->ctrl;
1328  $ilUser = $this->user;
1329 
1330  ilSession::set("il_feed_js", "n");
1331  $ilUser->writePref("il_feed_js", "n");
1332  $ilCtrl->returnToParent($this);
1333  }
ilObjUser $user
$ilUser
Definition: imgupload.php:34
static set(string $a_var, $a_val)
Set a value.
+ Here is the call graph for this function:

◆ editSettings()

ilNewsForContextBlockGUI::editSettings ( )

Show settings screen.

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

References initSettingsForm().

Referenced by ilPDNewsBlockGUI\changeFeedSettings().

913  : string
914  {
915  $this->initSettingsForm();
916  return $this->settings_form->getHTML();
917  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ enableJS()

ilNewsForContextBlockGUI::enableJS ( )

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

References $ilUser, ilBlockGUI\$user, getHTML(), ilBlockGUI\send(), and ilSession\set().

1335  : void
1336  {
1337  $ilUser = $this->user;
1338  ilSession::set("il_feed_js", "y");
1339  $ilUser->writePref("il_feed_js", "y");
1340  $this->send($this->getHTML());
1341  }
ilObjUser $user
send(string $output)
Send.
$ilUser
Definition: imgupload.php:34
static set(string $a_var, $a_val)
Set a value.
+ Here is the call graph for this function:

◆ executeCommand()

ilNewsForContextBlockGUI::executeCommand ( )

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

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

199  {
200  $ilCtrl = $this->ctrl;
201 
202  $next_class = $ilCtrl->getNextClass();
203  $cmd = $ilCtrl->getCmd("getHTML");
204 
205  switch ($next_class) {
206  case "ilnewsitemgui":
207  $news_item_gui = new ilNewsItemGUI();
208  $news_item_gui->setEnableEdit($this->getEnableEdit());
209  $html = $ilCtrl->forwardCommand($news_item_gui);
210  return $html;
211 
212  default:
213  return $this->$cmd();
214  }
215  }
User Interface for NewsItem entities.
getNextClass($a_gui_class=null)
+ Here is the call graph for this function:

◆ fillDataSection()

ilNewsForContextBlockGUI::fillDataSection ( )

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

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

217  : void
218  {
219  if ($this->dynamic) {
220  $this->setDataSection($this->getDynamicReload());
221  } elseif (count($this->getData()) > 0) {
222  parent::fillDataSection();
223  } else {
224  $this->setDataSection($this->getOverview());
225  }
226  }
setDataSection(string $a_content)
Call this from overwritten fillDataSection(), if standard row based data is not used.
+ Here is the call graph for this function:

◆ fillRow()

ilNewsForContextBlockGUI::fillRow ( array  $a_set)

get flat list for dashboard

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

References getInfoForData().

376  : void
377  {
378  $info = $this->getInfoForData($a_set);
379 
380  $this->tpl->setCurrentBlock("long");
381  $this->tpl->setVariable("VAL_CREATION_DATE", $info["creation_date"]);
382  $this->tpl->parseCurrentBlock();
383 
384  if ($info["ref_id"] > 0) {
385  $this->tpl->setCurrentBlock("news_context");
386  $this->tpl->setVariable("TYPE", $info["type_txt"]);
387  $this->tpl->setVariable("IMG_TYPE", $info["type_icon"]);
388  $this->tpl->setVariable("TITLE", $info["obj_title"]);
389  if ($info["user_read"] > 0) {
390  $this->tpl->setVariable("TITLE_CLASS", 'class="light"');
391  }
392 
393  $this->tpl->parseCurrentBlock();
394  }
395 
396  // title
397  $this->tpl->setVariable("VAL_TITLE", $info["news_title"]);
398 
399  if ($info["user_read"] > 0) {
400  $this->tpl->setVariable("A_CLASS", 'class="light"');
401  }
402 
403  $this->tpl->setVariable("HREF_SHOW", $info["url"]);
404  }
+ Here is the call graph for this function:

◆ getBlockType()

ilNewsForContextBlockGUI::getBlockType ( )

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

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

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

◆ getDynamic()

ilNewsForContextBlockGUI::getDynamic ( )

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

References ilBlockGUI\$ctrl, $ilUser, ilBlockGUI\$user, and ilSession\get().

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

1241  : bool
1242  {
1243  $ilCtrl = $this->ctrl;
1244  $ilUser = $this->user;
1245 
1246  // @todo: enable js loading
1247  if ($this->new_rendering) {
1248  return false;
1249  }
1250 
1251  if ($ilCtrl->getCmd() === "hideNotifications" ||
1252  $ilCtrl->getCmd() === "showNotifications") {
1253  return false;
1254  }
1255 
1256  if ($ilCtrl->getCmdClass() !== "ilcolumngui" && $ilCtrl->getCmd() !== "enableJS") {
1257  $sess_feed_js = "";
1258  if (ilSession::get("il_feed_js") != "") {
1259  $sess_feed_js = ilSession::get("il_feed_js");
1260  }
1261 
1262  if ($sess_feed_js !== "n" &&
1263  ($ilUser->getPref("il_feed_js") !== "n" || $sess_feed_js === "y")) {
1264  // do not get feed dynamically, if cache hit is given.
1265  // if (!$this->feed->checkCacheHit())
1266  // {
1267  return true;
1268  // }
1269  }
1270  }
1271 
1272  return false;
1273  }
static get(string $a_var)
ilObjUser $user
$ilUser
Definition: imgupload.php:34
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDynamicReload()

ilNewsForContextBlockGUI::getDynamicReload ( )

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

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

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

1275  : string
1276  {
1277  $ilCtrl = $this->ctrl;
1278  $lng = $this->lng;
1279 
1280  $ilCtrl->setParameterByClass(
1281  "ilcolumngui",
1282  "block_id",
1283  "block_" . $this->getBlockType() . "_" . $this->getBlockId()
1284  );
1285 
1286  $rel_tpl = new ilTemplate("tpl.dynamic_reload.html", true, true, "Services/News");
1287  $rel_tpl->setVariable("TXT_LOADING", $lng->txt("news_loading_news"));
1288  $rel_tpl->setVariable("BLOCK_ID", "block_" . $this->getBlockType() . "_" . $this->getBlockId());
1289  $rel_tpl->setVariable(
1290  "TARGET",
1291  $ilCtrl->getLinkTargetByClass("ilcolumngui", "updateBlock", "", true)
1292  );
1293 
1294  // no JS
1295  $rel_tpl->setVariable("TXT_NEWS_CLICK_HERE", $lng->txt("news_no_js_click_here"));
1296  $rel_tpl->setVariable(
1297  "TARGET_NO_JS",
1298  $ilCtrl->getLinkTargetByClass(strtolower(get_class($this)), "disableJS")
1299  );
1300 
1301  return $rel_tpl->get();
1302  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
ilLanguage $lng
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getHTML()

ilNewsForContextBlockGUI::getHTML ( )

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

References ilBlockGUI\$ctrl, $DIC, $ilUser, ilBlockGUI\$lng, ilBlockGUI\$obj_def, $ref_id, ilBlockGUI\$user, ilBlockSetting\_lookup(), ilObject\_lookupObjectId(), ilObject\_lookupType(), ilBlockGUI\addBlockCommand(), CLIENT_ID, getBlockType(), ilObjectDefinition\getClassName(), ilBlockGUI\getData(), ilBlockGUI\getEnableEdit(), ilBlockGUI\getProperty(), ilBlockGUI\getRepositoryMode(), ilBlockGUI\setTitle(), and ilLanguage\txt().

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

228  : string
229  {
230  global $DIC;
231 
232  $ilCtrl = $this->ctrl;
233  $lng = $this->lng;
235 
236  $news_set = new ilSetting("news");
237  $enable_internal_rss = $news_set->get("enable_rss_for_internal");
238 
239  $hide_block = ilBlockSetting::_lookup(
240  $this->getBlockType(),
241  "hide_news_block",
242  0,
243  (int) $this->block_id
244  );
245 
246  if ($this->getProperty("title") != "") {
247  $this->setTitle($this->getProperty("title"));
248  }
249 
250  $public_feed = ilBlockSetting::_lookup(
251  $this->getBlockType(),
252  "public_feed",
253  0,
254  (int) $this->block_id
255  );
256  if ($public_feed && $enable_internal_rss) {
257  // @todo: rss icon HTML: ilRSSButtonGUI::get(ilRSSButtonGUI::ICON_RSS)
258  $this->addBlockCommand(
259  ILIAS_HTTP_PATH . "/feed.php?client_id=" . rawurlencode(CLIENT_ID) . "&" .
260  "ref_id=" . $this->std_request->getRefId(),
261  $lng->txt("news_feed_url")
262  );
263  }
264 
265  // add edit commands
266  if ($this->news_access->canAdd()) {
267  $this->addBlockCommand(
268  $ilCtrl->getLinkTargetByClass("ilnewsitemgui", "editNews"),
269  $lng->txt("edit")
270  );
271 
272  $ilCtrl->setParameter($this, "add_mode", "block");
273  $this->addBlockCommand(
274  $ilCtrl->getLinkTargetByClass("ilnewsitemgui", "createNewsItem"),
275  $lng->txt("add")
276  );
277  $ilCtrl->setParameter($this, "add_mode", "");
278  }
279 
280  if ($this->getProperty("settings")) {
281  $ref_id = $this->std_request->getRefId();
282  $obj_def = $DIC["objDefinition"];
284  $obj_type = ilObject::_lookupType($ref_id, true);
285  $obj_class = strtolower($obj_def->getClassName($obj_type));
286  $parent_gui = "ilobj" . $obj_class . "gui";
287 
288  $ilCtrl->setParameterByClass("ilcontainernewssettingsgui", "ref_id", $ref_id);
289 
290  if (in_array($obj_class, self::OBJECTS_WITH_NEWS_SUBTAB)) {
291  $this->addBlockCommand(
292  $ilCtrl->getLinkTargetByClass(["ilrepositorygui", $parent_gui, "ilcontainernewssettingsgui"], "show"),
293  $lng->txt("settings")
294  );
295  } else {
296  // not sure if this code is still used anywhere, see discussion at
297  // https://mantis.ilias.de/view.php?id=31801
298  // If ILIAS 8 beta phase does not throw this exception, we can remove this part.
299  //throw new ilException("News settings are deprecated.");
300  // the info screen will call this
301  $this->addBlockCommand(
302  $ilCtrl->getLinkTarget($this, "editSettings"),
303  $lng->txt("settings")
304  );
305  }
306  }
307 
308  // do not display hidden repository news blocks for users
309  // who do not have write permission
310  if (!$this->getEnableEdit() && $this->getRepositoryMode() &&
312  $this->getBlockType(),
313  "hide_news_block",
314  0,
315  (int) $this->block_id
316  )) {
317  return "";
318  }
319 
320  // do not display empty news blocks for users
321  // who do not have write permission
322  if (!$this->dynamic && !$this->getEnableEdit() && $this->getRepositoryMode() && count($this->getData()) === 0 &&
323  (
324  !$news_set->get("enable_rss_for_internal") ||
326  $this->getBlockType(),
327  "public_feed",
328  0,
329  (int) $this->block_id
330  )
331  )) {
332  return "";
333  }
334 
335  $en = "";
336 
337  return parent::getHTML() . $en;
338  }
ilObjUser $user
ilObjectDefinition $obj_def
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
ilLanguage $lng
global $DIC
Definition: feed.php:28
$ref_id
Definition: ltiauth.php:67
static _lookup(string $a_type, string $a_setting, int $a_user=0, int $a_block_id=0)
Lookup setting from database.
const CLIENT_ID
Definition: constants.php:41
getClassName(string $obj_name)
static _lookupObjectId(int $ref_id)
$ilUser
Definition: imgupload.php:34
setTitle(string $a_title)
addBlockCommand(string $a_href, string $a_text, string $a_onclick="")
static _lookupType(int $id, bool $reference=false)
getProperty(string $a_property)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getInfoForData()

ilNewsForContextBlockGUI::getInfoForData ( array  $news)

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

References ilBlockGUI\$ctrl, ilBlockGUI\$lng, $obj_definition, $type, ilObject\_getIcon(), ilObject\_lookupObjId(), ilObject\_lookupTitle(), ilObject\_lookupType(), ilNewsItem\determineNewsTitle(), ilDatePresentation\formatDate(), IL_CAL_DATETIME, ilObjectDefinition\isPlugin(), ilObjectPlugin\lookupTxtById(), ilStr\shortenWords(), and ilLanguage\txt().

Referenced by fillRow(), and getListItemForData().

406  : array
407  {
408  $ilCtrl = $this->ctrl;
409  $lng = $this->lng;
411 
412  $info = [];
413 
414  $info["ref_id"] = $news["ref_id"] ?? 0;
415  $info["creation_date"] =
416  ilDatePresentation::formatDate(new ilDateTime($news["creation_date"], IL_CAL_DATETIME));
417 
418  // title image type
419  if (($news["ref_id"] ?? 0) > 0) {
420  if (isset($news["agg_ref_id"]) && $news["agg_ref_id"] > 0) {
421  $obj_id = ilObject::_lookupObjId($news["agg_ref_id"]);
422  $type = ilObject::_lookupType($obj_id);
423  $context_ref = $news["agg_ref_id"];
424  } else {
425  $obj_id = $news["context_obj_id"];
426  $type = $news["context_obj_type"];
427  $context_ref = $news["ref_id"];
428  }
429 
430  $lang_type = in_array($type, ["sahs", "lm", "htlm"])
431  ? "lres"
432  : "obj_" . $type;
433 
434  $type_txt = ($obj_definition->isPlugin($news["context_obj_type"]))
435  ? ilObjectPlugin::lookupTxtById($news["context_obj_type"], $lang_type)
436  : $lng->txt($lang_type);
437 
438 
439  $info["type_txt"] = $type_txt;
440  $info["type_icon"] = ilObject::_getIcon($obj_id, "tiny", $type);
441  $info["obj_title"] = ilStr::shortenWords(ilObject::_lookupTitle($obj_id));
442  $info["user_read"] = $news["user_read"];
443 
444  $ilCtrl->setParameter($this, "news_context", $context_ref);
445  } else {
446  $ilCtrl->setParameter($this, "news_context", "");
447  }
448 
449  // title
450  $info["news_title"] =
453  $news["context_obj_type"] ?? "",
454  $news["title"] ?? "",
455  $news["content_is_lang_var"] ?? false,
456  $news["agg_ref_id"] ?? 0,
457  $news["aggregation"] ?? []
458  )
459  );
460 
461 
462  $ilCtrl->setParameter($this, "news_id", $news["id"]);
463  $info["url"] =
464  $ilCtrl->getLinkTarget($this, "showNews");
465  $ilCtrl->clearParameters($this);
466 
467  return $info;
468  }
const IL_CAL_DATETIME
static _getIcon(int $obj_id=0, string $size="big", string $type="", bool $offline=false)
Get icon for repository item.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static determineNewsTitle(string $a_context_obj_type, string $a_title, bool $a_content_is_lang_var, int $a_agg_ref_id=0, array $a_aggregation=[])
Determine title for news item entry.
$type
ilLanguage $lng
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)
static lookupTxtById(string $plugin_id, string $lang_var)
isPlugin(string $obj_name)
get RBAC status by type returns true if object type is an (activated) plugin type ...
static _lookupType(int $id, bool $reference=false)
static shortenWords(string $a_str, int $a_len=30, bool $a_dots=true)
Ensure that the maximum word lenght within a text is not longer than $a_len.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getJSEnabler()

ilNewsForContextBlockGUI::getJSEnabler ( )

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

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

Referenced by ilPDNewsBlockGUI\getHTML().

1304  : string
1305  {
1306  $ilCtrl = $this->ctrl;
1307 
1308  $ilCtrl->setParameterByClass(
1309  "ilcolumngui",
1310  "block_id",
1311  "block_" . $this->getBlockType() . "_" . $this->getBlockId()
1312  );
1313  //echo "hh";
1314  $rel_tpl = new ilTemplate("tpl.js_enabler.html", true, true, "Services/News");
1315  $rel_tpl->setVariable("BLOCK_ID", "block_" . $this->getBlockType() . "_" . $this->getBlockId());
1316  $rel_tpl->setVariable(
1317  "TARGET",
1318  $ilCtrl->getLinkTargetByClass(strtolower(get_class($this)), "enableJS", "", true, false)
1319  );
1320 
1321  return $rel_tpl->get();
1322  }
setParameterByClass(string $a_class, string $a_parameter, $a_value)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getListItemForData()

ilNewsForContextBlockGUI::getListItemForData ( array  $data)
protected

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

References $factory, getInfoForData(), ILIAS\Repository\lng(), and ILIAS\Repository\ui().

1350  {
1351  if ((int) ($data["id"] ?? 0) === 0) {
1352  return null;
1353  }
1354  $info = $this->getInfoForData($data);
1355 
1356  $props = [
1357  $this->lng->txt("date") => $info["creation_date"] ?? ""
1358  ];
1359 
1360  $factory = $this->ui->factory();
1361  $item = $factory->item()->standard($factory->link()->standard($info["news_title"] ?? "", $info["url"] ?? ""))
1362  ->withProperties($props);
1363  if (($info["ref_id"] ?? 0) > 0) {
1364  $item = $item->withDescription($info["type_txt"] . ": " . $info["obj_title"]);
1365  }
1366  return $item;
1367  }
Common interface to all items.
Definition: Item.php:31
$factory
Definition: metadata.php:75
+ Here is the call graph for this function:

◆ getMediaPath()

ilNewsForContextBlockGUI::getMediaPath ( int  $mob_id)
protected

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

References ilObjMediaObject\_getURL().

Referenced by showNews().

834  : string
835  {
836  $media_path = "";
837  if ($mob_id > 0) {
838  $mob = new ilObjMediaObject($mob_id);
839  $med = $mob->getMediaItem("Standard");
840  if (strcasecmp("Reference", $med->getLocationType()) === 0) {
841  $media_path = $med->getLocation();
842  } else {
843  $media_path = ilObjMediaObject::_getURL($mob->getId()) . "/" . $med->getLocation();
844  }
845  }
846  return $media_path;
847  }
static _getURL(int $a_mob_id)
get directory for files of media object
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getNewsData()

ilNewsForContextBlockGUI::getNewsData ( )

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

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

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

118  : array
119  {
120  $ilCtrl = $this->ctrl;
122 
123  $this->acache = new ilNewsCache();
124  /* $cres = $this->acache->getEntry($ilUser->getId().":".$_GET["ref_id"]);
125  if ($this->acache->getLastAccessStatus() == "hit" && false)
126  {
127  $news_data = unserialize($cres);
128  }
129  else
130  {*/
131  $news_item = new ilNewsItem();
132  $news_item->setContextObjId($ilCtrl->getContextObjId());
133  $news_item->setContextObjType($ilCtrl->getContextObjType());
134 
135  // workaround, better: reduce constructor and introduce
136  //$prevent_aggregation = $this->getProperty("prevent_aggregation");
137  $prevent_aggregation = true;
138  if ($ilCtrl->getContextObjType() !== "frm") {
139  $forum_grouping = true;
140  } else {
141  $forum_grouping = false;
142  }
143 
144 
145  $news_data = $news_item->getNewsForRefId(
146  $this->std_request->getRefId(),
147  false,
148  false,
149  0,
150  $prevent_aggregation,
151  $forum_grouping
152  );
153 
154  $this->acache->storeEntry(
155  $ilUser->getId() . ":" . $this->std_request->getRefId(),
156  serialize($news_data)
157  );
158 
159  // }
160  //var_dump($news_data);
161  return $news_data;
162  }
ilObjUser $user
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
A news item can be created by different sources.
$ilUser
Definition: imgupload.php:34
+ Here is the caller graph for this function:

◆ getNoItemFoundContent()

ilNewsForContextBlockGUI::getNoItemFoundContent ( )

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

References ILIAS\Repository\lng().

1369  : string
1370  {
1371  return $this->lng->txt("news_no_news_items");
1372  }
+ Here is the call graph for this function:

◆ getOverview()

ilNewsForContextBlockGUI::getOverview ( )

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

References ilBlockGUI\$lng, ilBlockGUI\getData(), and ilLanguage\txt().

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

470  : string
471  {
472  $lng = $this->lng;
473 
474  return '<div class="small">' . (count($this->getData())) . " " . $lng->txt("news_news_items") . "</div>";
475  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
ilLanguage $lng
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getScreenMode()

static ilNewsForContextBlockGUI::getScreenMode ( )
static

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

References $DIC, IL_SCREEN_CENTER, IL_SCREEN_FULL, and IL_SCREEN_SIDE.

174  : string
175  {
176  global $DIC;
177 
178  $ilCtrl = $DIC->ctrl();
179 
180  if (strtolower($ilCtrl->getCmdClass()) === "ilnewsitemgui") {
181  return IL_SCREEN_FULL;
182  }
183 
184  switch ($ilCtrl->getCmd()) {
185  case "showNews":
186  case "showFeedUrl":
187  return IL_SCREEN_CENTER;
188 
189  case "editSettings":
190  case "saveSettings":
191  return IL_SCREEN_FULL;
192 
193  default:
194  return IL_SCREEN_SIDE;
195  }
196  }
global $DIC
Definition: feed.php:28
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 343 of file class.ilNewsForContextBlockGUI.php.

References $ilUser, ilBlockGUI\$user, ilBlockSetting\_lookup(), getBlockType(), and ILIAS\Repository\int().

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

343  : void
344  {
346 
347  $this->view = (string) ilBlockSetting::_lookup(
348  $this->getBlockType(),
349  "view",
350  $ilUser->getId(),
351  (int) $this->block_id
352  );
353 
354  // check whether notices and messages exist
355  $got_notices = $got_messages = false;
356  foreach ($this->data as $row) {
357  if ((int) ($row["priority"] ?? 0) === 0) {
358  $got_notices = true;
359  }
360  if ((int) ($row["priority"] ?? 0) === 1) {
361  $got_messages = true;
362  }
363  }
364  $this->show_view_selection = false;
365 
366  if ($got_notices && $got_messages) {
367  $this->show_view_selection = true;
368  } elseif ($got_notices) {
369  $this->view = "";
370  }
371  }
ilObjUser $user
static _lookup(string $a_type, string $a_setting, int $a_user=0, int $a_block_id=0)
Lookup setting from database.
$ilUser
Definition: imgupload.php:34
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hideNotifications()

ilNewsForContextBlockGUI::hideNotifications ( )

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

References ilBlockGUI\$ctrl, ilBlockGUI\$data, $ilUser, ilBlockGUI\$user, ilBlockSetting\_write(), getBlockType(), getHTML(), getNewsData(), handleView(), ILIAS\Repository\int(), ilBlockGUI\send(), and ilBlockGUI\setData().

885  : void
886  {
887  $ilCtrl = $this->ctrl;
889 
891  $this->getBlockType(),
892  "view",
893  "hide_notifications",
894  $ilUser->getId(),
895  (int) $this->block_id
896  );
897 
898  // reload data
899  $data = $this->getNewsData();
900  $this->setData($data);
901  $this->handleView();
902 
903  if ($ilCtrl->isAsynch()) {
904  $this->send($this->getHTML());
905  }
906 
907  $ilCtrl->returnToParent($this);
908  }
ilObjUser $user
handleView()
Handles show/hide notification view and removes notifications if hidden.
send(string $output)
Send.
static _write(string $a_type, string $a_setting, string $a_value, int $a_user=0, int $a_block_id=0)
Write setting to database.
$ilUser
Definition: imgupload.php:34
setData(array $a_data)
+ Here is the call graph for this function:

◆ initSettingsForm()

ilNewsForContextBlockGUI::initSettingsForm ( )

Init setting form.

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

References ilBlockGUI\$ctrl, ilBlockGUI\$lng, $tabs, ilNewsItem\_getDefaultVisibilityForRefId(), ilBlockSetting\_lookup(), ilTabsGUI\clearTargets(), getBlockType(), ilBlockGUI\getProperty(), IL_CAL_DATETIME, ilRadioOption\setInfo(), ilFormPropertyGUI\setInfo(), ilFormPropertyGUI\setRequired(), and ilLanguage\txt().

Referenced by editSettings(), and saveSettings().

922  : void
923  {
924  $lng = $this->lng;
925  $ilCtrl = $this->ctrl;
926  $ilTabs = $this->tabs;
927 
928  $ilTabs->clearTargets();
929 
930  $news_set = new ilSetting("news");
931  $enable_internal_rss = $news_set->get("enable_rss_for_internal");
932 
933  $public = ilBlockSetting::_lookup(
934  $this->getBlockType(),
935  "public_notifications",
936  0,
937  (int) $this->block_id
938  );
939  $public_feed = ilBlockSetting::_lookup(
940  $this->getBlockType(),
941  "public_feed",
942  0,
943  (int) $this->block_id
944  );
945  $hide_block = ilBlockSetting::_lookup(
946  $this->getBlockType(),
947  "hide_news_block",
948  0,
949  (int) $this->block_id
950  );
951  $hide_news_per_date = ilBlockSetting::_lookup(
952  $this->getBlockType(),
953  "hide_news_per_date",
954  0,
955  (int) $this->block_id
956  );
957  $hide_news_date = ilBlockSetting::_lookup(
958  $this->getBlockType(),
959  "hide_news_date",
960  0,
961  (int) $this->block_id
962  );
963 
964  if (is_string($hide_news_date) && $hide_news_date !== '') {
965  $hide_news_date = explode(" ", $hide_news_date);
966  }
967 
968  $this->settings_form = new ilPropertyFormGUI();
969  $this->settings_form->setTitle($lng->txt("news_settings"));
970 
971  // hide news block for learners
972  if ($this->getProperty("hide_news_block_option")) {
973  $ch = new ilCheckboxInputGUI(
974  $lng->txt("news_hide_news_block"),
975  "hide_news_block"
976  );
977  $ch->setInfo($lng->txt("news_hide_news_block_info"));
978  $ch->setChecked((bool) $hide_block);
979  $this->settings_form->addItem($ch);
980 
981  $hnpd = new ilCheckboxInputGUI(
982  $lng->txt("news_hide_news_per_date"),
983  "hide_news_per_date"
984  );
985  $hnpd->setInfo($lng->txt("news_hide_news_per_date_info"));
986  $hnpd->setChecked((bool) $hide_news_per_date);
987 
988  $dt_prop = new ilDateTimeInputGUI(
989  $lng->txt("news_hide_news_date"),
990  "hide_news_date"
991  );
992  $dt_prop->setRequired(true);
993  if (is_array($hide_news_date) && count($hide_news_date) === 2) {
994  $dt_prop->setDate(new ilDateTime($hide_news_date[0] . ' ' . $hide_news_date[1], IL_CAL_DATETIME));
995  }
996  $dt_prop->setShowTime(true);
997  $hnpd->addSubItem($dt_prop);
998 
999  $this->settings_form->addItem($hnpd);
1000  }
1001 
1002  // default visibility
1003  if ($enable_internal_rss && $this->getProperty("default_visibility_option")) {
1004  $default_visibility = ilBlockSetting::_lookup(
1005  $this->getBlockType(),
1006  "default_visibility",
1007  0,
1008  (int) $this->block_id
1009  );
1010  if ($default_visibility == "") {
1011  $default_visibility =
1012  ilNewsItem::_getDefaultVisibilityForRefId($this->std_request->getRefId());
1013  }
1014 
1015  // Default Visibility
1016  $radio_group = new ilRadioGroupInputGUI($lng->txt("news_default_visibility"), "default_visibility");
1017  $radio_option = new ilRadioOption($lng->txt("news_visibility_users"), "users");
1018  $radio_group->addOption($radio_option);
1019  $radio_option = new ilRadioOption($lng->txt("news_visibility_public"), "public");
1020  $radio_group->addOption($radio_option);
1021  $radio_group->setInfo($lng->txt("news_news_item_visibility_info"));
1022  $radio_group->setRequired(false);
1023  $radio_group->setValue($default_visibility);
1024  $this->settings_form->addItem($radio_group);
1025  }
1026 
1027  // public notifications
1028  if ($enable_internal_rss && $this->getProperty("public_notifications_option")) {
1029  $ch = new ilCheckboxInputGUI(
1030  $lng->txt("news_notifications_public"),
1031  "notifications_public"
1032  );
1033  $ch->setInfo($lng->txt("news_notifications_public_info"));
1034  $ch->setChecked((bool) $public);
1035  $this->settings_form->addItem($ch);
1036  }
1037 
1038  // extra rss feed
1039  if ($enable_internal_rss) {
1040  $ch = new ilCheckboxInputGUI(
1041  $lng->txt("news_public_feed"),
1042  "notifications_public_feed"
1043  );
1044  $ch->setInfo($lng->txt("news_public_feed_info"));
1045  $ch->setChecked((bool) $public_feed);
1046  $this->settings_form->addItem($ch);
1047  }
1048 
1049  $this->settings_form->addCommandButton("saveSettings", $lng->txt("save"));
1050  $this->settings_form->addCommandButton("cancelSettings", $lng->txt("cancel"));
1051  $this->settings_form->setFormAction($ilCtrl->getFormAction($this));
1052  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getDefaultVisibilityForRefId(int $a_ref_id)
Get default visibility for reference id.
const IL_CAL_DATETIME
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
ilLanguage $lng
setInfo(string $a_info)
This class represents a checkbox property in a property form.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a property in a property form.
static _lookup(string $a_type, string $a_setting, int $a_user=0, int $a_block_id=0)
Lookup setting from database.
clearTargets()
clear all targets
setRequired(bool $a_required)
getProperty(string $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 169 of file class.ilNewsForContextBlockGUI.php.

169  : bool
170  {
171  return false;
172  }

◆ makeClickable()

ilNewsForContextBlockGUI::makeClickable ( string  $a_str)

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

References ilUtil\makeClickable().

849  : string
850  {
851  // this fixes bug 8744. We assume that strings that contain < and >
852  // already contain html, we do not handle these
853  if (is_int(strpos($a_str, ">")) && is_int(strpos($a_str, "<"))) {
854  return $a_str;
855  }
856 
857  return ilUtil::makeClickable($a_str);
858  }
static makeClickable(string $a_text, bool $detectGotoLinks=false)
+ Here is the call graph for this function:

◆ saveSettings()

ilNewsForContextBlockGUI::saveSettings ( )

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

References ilBlockGUI\$ctrl, $ilUser, $settings_form, ilBlockGUI\$user, ilBlockSetting\_write(), getBlockType(), ilBlockGUI\getProperty(), IL_CAL_DATETIME, initSettingsForm(), and ILIAS\Repository\int().

1122  : string
1123  {
1124  $ilCtrl = $this->ctrl;
1125  $ilUser = $this->user;
1126 
1127  $this->initSettingsForm();
1128  $form = $this->settings_form;
1129  if ($form->checkInput()) {
1130  $news_set = new ilSetting("news");
1131  $enable_internal_rss = $news_set->get("enable_rss_for_internal");
1132 
1133  if ($enable_internal_rss) {
1135  $this->getBlockType(),
1136  "public_notifications",
1137  $form->getInput("notifications_public"),
1138  0,
1139  (int) $this->block_id
1140  );
1142  $this->getBlockType(),
1143  "public_feed",
1144  $form->getInput("notifications_public_feed"),
1145  0,
1146  (int) $this->block_id
1147  );
1149  $this->getBlockType(),
1150  "default_visibility",
1151  $form->getInput("default_visibility"),
1152  0,
1153  (int) $this->block_id
1154  );
1155  }
1156 
1157  if ($this->getProperty("hide_news_block_option")) {
1159  $this->getBlockType(),
1160  "hide_news_block",
1161  $form->getInput("hide_news_block"),
1162  0,
1163  (int) $this->block_id
1164  );
1166  $this->getBlockType(),
1167  "hide_news_per_date",
1168  $form->getInput("hide_news_per_date"),
1169  0,
1170  (int) $this->block_id
1171  );
1172 
1173  // hide date
1174  $hd = $this->settings_form->getItemByPostVar("hide_news_date");
1175  $hide_date = $hd->getDate();
1176  if ($hide_date instanceof ilDateTime && $form->getInput("hide_news_per_date")) {
1178  $this->getBlockType(),
1179  "hide_news_date",
1180  $hide_date->get(IL_CAL_DATETIME),
1181  0,
1182  (int) $this->block_id
1183  );
1184  } else {
1186  $this->getBlockType(),
1187  "hide_news_date",
1188  "",
1189  0,
1190  (int) $this->block_id
1191  );
1192  }
1193  }
1194 
1195  $cache = new ilNewsCache();
1196  $cache->deleteEntry($ilUser->getId() . ":" . $this->std_request->getRefId());
1197 
1198  $ilCtrl->returnToParent($this);
1199  } else {
1200  $this->settings_form->setValuesByPost();
1201  return $this->settings_form->getHTML();
1202  }
1203  return "";
1204  }
ilObjUser $user
const IL_CAL_DATETIME
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _write(string $a_type, string $a_setting, string $a_value, int $a_user=0, int $a_block_id=0)
Write setting to database.
$ilUser
Definition: imgupload.php:34
getProperty(string $a_property)
+ Here is the call graph for this function:

◆ showFeedUrl()

ilNewsForContextBlockGUI::showFeedUrl ( )

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

References $ilUser, ilBlockGUI\$lng, $panel, ilBlockGUI\$title, ilBlockGUI\$tpl, ilBlockGUI\$user, ilObjUser\_lookupFeedHash(), ilObject\_lookupTitle(), CLIENT_ID, ilTemplate\get(), HTML_Template_IT\setVariable(), ilLanguage\txt(), and ILIAS\Repository\ui().

1206  : string
1207  {
1208  $lng = $this->lng;
1209  $ilUser = $this->user;
1210 
1211  $title = ilObject::_lookupTitle((int) $this->block_id);
1212 
1213  $tpl = new ilTemplate("tpl.show_feed_url.html", true, true, "Services/News");
1214  $tpl->setVariable(
1215  "TXT_TITLE",
1216  sprintf($lng->txt("news_feed_url_for"), $title)
1217  );
1218  $tpl->setVariable("TXT_INFO", $lng->txt("news_get_feed_info"));
1219  $tpl->setVariable("TXT_FEED_URL", $lng->txt("news_feed_url"));
1220  $tpl->setVariable(
1221  "VAL_FEED_URL",
1222  ILIAS_HTTP_PATH . "/feed.php?client_id=" . rawurlencode(CLIENT_ID) . "&user_id=" . $ilUser->getId() .
1223  "&obj_id=" . $this->block_id .
1224  "&hash=" . ilObjUser::_lookupFeedHash($ilUser->getId(), true)
1225  );
1226  $tpl->setVariable(
1227  "VAL_FEED_URL_TXT",
1228  ILIAS_HTTP_PATH . "/feed.php?client_id=" . rawurlencode(CLIENT_ID) . "&<br />user_id=" . $ilUser->getId() .
1229  "&obj_id=" . $this->block_id .
1230  "&hash=" . ilObjUser::_lookupFeedHash($ilUser->getId(), true)
1231  );
1232 
1233  $panel = $this->ui->factory()->panel()->standard(
1234  $lng->txt("news_internal_news"),
1235  $this->ui->factory()->legacy($tpl->get())
1236  );
1237 
1238  return $this->ui->renderer()->render($panel);
1239  }
ilObjUser $user
get(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
ilLanguage $lng
if(isset($_FILES['img_file']) &&is_array($_FILES['img_file'])) $panel
Definition: imgupload.php:198
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:514
ilTemplate $tpl
static _lookupTitle(int $obj_id)
const CLIENT_ID
Definition: constants.php:41
static _lookupFeedHash(int $a_user_id, bool $a_create=false)
Lookup news feed hash for user.
$ilUser
Definition: imgupload.php:34
+ Here is the call graph for this function:

◆ showNews()

ilNewsForContextBlockGUI::showNews ( )

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

References ilBlockGUI\$access, $c, ilBlockGUI\$ctrl, $ilUser, ilBlockGUI\$lng, $panel, ilBlockGUI\$title, ilBlockGUI\$tpl, $url, ilBlockGUI\$user, ilObject\_exists(), ilObject\_getIcon(), ilObjForumAccess\_getThreadForPosting(), ilBlockSetting\_lookup(), ilNewsItem\_lookupContextObjId(), ilObject\_lookupObjId(), ilObject\_lookupTitle(), ilObject\_lookupType(), ilNewsItem\_setRead(), CLIENT_ID, ilNewsItem\determineNewsTitle(), ilDatePresentation\formatDate(), ilTemplate\get(), ilBlockGUI\getData(), ilLinkButton\getInstance(), ilObjUser\getLogin(), getMediaPath(), ilObjMediaObject\getMimeType(), getNewsData(), ilBlockGUI\getProperty(), ilNewsRendererFactory\getRenderer(), IL_CAL_DATETIME, ILIAS\Repository\int(), ilWikiPage\lookupTitle(), ilWikiUtil\makeUrlTitle(), NEWS_PUBLIC, ilTemplate\parseCurrentBlock(), ilTemplate\setCurrentBlock(), ilBlockGUI\setData(), HTML_Template_IT\setVariable(), ilLanguage\txt(), ILIAS\Repository\ui(), and ilObjUser\userExists().

477  : string
478  {
479  $lng = $this->lng;
480  $ilCtrl = $this->ctrl;
482  $ilAccess = $this->access;
483 
484  // workaround for dynamic mode (if cache is disabled, showNews has no data)
485  if (empty(self::$st_data)) {
486  $this->setData($this->getNewsData());
487  }
488 
489  $news_set = new ilSetting("news");
490  $enable_internal_rss = $news_set->get("enable_rss_for_internal");
491 
492 
493  $tpl = new ilTemplate("tpl.show_news.html", true, true, "Services/News");
494 
495  // get current item in data set
496  $previous = "";
497  reset($this->data);
498  $c = current($this->data);
499  $curr_cnt = 1;
500 
501  if ($this->std_request->getNewsId() > 0) {
502  $news = new ilNewsItem($this->std_request->getNewsId());
503  $news_context = $this->std_request->getNewsContext();
504  while ($c["id"] > 0 && (int) $c["id"] !== $this->std_request->getNewsId()) {
505  $previous = $c;
506  $c = next($this->data);
507  $curr_cnt++;
508  }
509  } else {
510  $news_page = $this->std_request->getNewsPage();
511  $news_context = 0;
512  while ($curr_cnt - 1 < $news_page) {
513  $previous = $c;
514  $c = next($this->data);
515  if ($curr_cnt - 1 === $news_page) {
516  }
517  $curr_cnt++;
518  }
519  $news = new ilNewsItem($c["id"] ?? 0);
520  if (($c["ref_id"] ?? 0) > 0) {
521  $news_context = (int) $c["ref_id"];
522  }
523  }
524 
525 
526  if (!is_array($c) && is_object($news) && $news->getId() > 0
527  && ilNewsItem::_lookupContextObjId($news->getId()) !== $ilCtrl->getContextObjId()) {
528  throw new ilException("News ID does not match object context.");
529  }
530 
531 
532  // collect news items to show
533  $news_list = [];
534  if (isset($c["aggregation"]) && is_array($c["aggregation"])) { // we have an aggregation
535  $news_list[] = [
536  "ref_id" => $c["agg_ref_id"],
537  "agg_ref_id" => $c["agg_ref_id"],
538  "aggregation" => $c["aggregation"],
539  "user_id" => "",
540  "content_type" => "text",
541  "mob_id" => 0,
542  "visibility" => "",
543  "content" => "",
544  "content_long" => "",
545  "update_date" => $news->getUpdateDate(),
546  "creation_date" => "",
547  "content_is_lang_var" => false,
548  "loc_context" => $news_context,
549  "context_obj_type" => $news->getContextObjType(),
550  "title" => ""
551  ];
552 
553  foreach ($c["aggregation"] as $c_item) {
554  ilNewsItem::_setRead($ilUser->getId(), $c_item["id"]);
555  $c_item["loc_context"] = $c_item["ref_id"];
556  $c_item["loc_stop"] = $news_context;
557  $news_list[] = $c_item;
558  }
559  } else { // no aggregation, simple news item
560  $news_list[] = [
561  "id" => $news->getId(),
562  "ref_id" => $news_context,
563  "user_id" => $news->getUserId(),
564  "content_type" => $news->getContentType(),
565  "mob_id" => $news->getMobId(),
566  "visibility" => $news->getVisibility(),
567  "priority" => $news->getPriority(),
568  "content" => $news->getContent(),
569  "content_long" => $news->getContentLong(),
570  "update_date" => $news->getUpdateDate(),
571  "creation_date" => $news->getCreationDate(),
572  "context_sub_obj_type" => $news->getContextSubObjType(),
573  "context_obj_type" => $news->getContextObjType(),
574  "context_sub_obj_id" => $news->getContextSubObjId(),
575  "content_is_lang_var" => $news->getContentIsLangVar(),
576  "content_text_is_lang_var" => $news->getContentTextIsLangVar(),
577  "loc_context" => $news_context,
578  "title" => $news->getTitle()
579  ];
580  ilNewsItem::_setRead($ilUser->getId(), $this->std_request->getNewsId());
581  }
582 
583  $row_css = "";
584  $cache_deleted = false;
585  foreach ($news_list as $item) {
586  $row_css = ($row_css !== "tblrow1")
587  ? "tblrow1"
588  : "tblrow2";
589 
590  if ($item["ref_id"] > 0 && !$ilAccess->checkAccess("read", "", $item["ref_id"])) {
591  $tpl->setCurrentBlock("content");
592  $tpl->setVariable("VAL_CONTENT", $lng->txt("news_sorry_not_accessible_anymore"));
594  $tpl->setCurrentBlock("item");
595  $tpl->setVariable("ITEM_ROW_CSS", $row_css);
597  if (!$cache_deleted) {
598  $this->acache->deleteEntry($ilUser->getId() . ":" . $this->std_request->getRefId());
599  $cache_deleted = true;
600  }
601  continue;
602  }
603 
604  // user
605  if ($item["user_id"] > 0 &&
606  \ilObjUser::userExists([$item["user_id"]])
607  ) {
608  // get login
609  if (ilObjUser::_exists($item["user_id"])) {
610  $user = new ilObjUser($item["user_id"]);
611  $displayname = $user->getLogin();
612  } else {
613  // this should actually not happen, since news entries
614  // should be deleted when the user is going to be removed
615  $displayname = "&lt;" . strtolower($lng->txt("deleted")) . "&gt;";
616  }
617 
618  $tpl->setCurrentBlock("user_info");
619  $tpl->setVariable("VAL_AUTHOR", $displayname);
620  $tpl->setVariable("TXT_AUTHOR", $lng->txt("author"));
622  }
623 
624  // media player
625  $ui_renderer = $this->ui->renderer();
626  $ui_factory = $this->ui->factory();
627 
628  if ($item["mob_id"] > 0 && ilObject::_exists((int) $item["mob_id"])) {
629  $media_path = $this->getMediaPath((int) $item["mob_id"]);
630  $mime = ilObjMediaObject::getMimeType($media_path);
631  if (in_array($mime, ["image/jpeg", "image/svg+xml", "image/gif", "image/png"])) {
632  $title = basename($media_path);
633  $html = $ui_renderer->render($ui_factory->image()->responsive($media_path, $title));
634  } elseif (in_array($mime, ["video/mp4"])) {
635  $video = $ui_factory->player()->video($media_path);
636  $html = $ui_renderer->render($video);
637  } elseif (in_array($mime, ["audio/mpeg"])) {
638  $audio = $ui_factory->player()->audio($media_path);
639  $html = $ui_renderer->render($audio);
640  } else {
641  // download?
642  $html = "";
643  }
644 
645 
646  $tpl->setCurrentBlock("player");
647  $tpl->setVariable(
648  "PLAYER",
649  $html
650  );
652  }
653 
654  // access
655  if ($enable_internal_rss && $item["visibility"] != "") {
656  $obj_id = ilObject::_lookupObjId($item["ref_id"]);
657  $tpl->setCurrentBlock("access");
658  $tpl->setVariable("TXT_ACCESS", $lng->txt("news_news_item_visibility"));
659  if ($item["visibility"] === NEWS_PUBLIC ||
660  ((int) $item["priority"] === 0 &&
662  "news",
663  "public_notifications",
664  0,
665  $obj_id
666  ))) {
667  $tpl->setVariable("VAL_ACCESS", $lng->txt("news_visibility_public"));
668  } else {
669  $tpl->setVariable("VAL_ACCESS", $lng->txt("news_visibility_users"));
670  }
672  }
673 
674  // content
675  $renderer = ilNewsRendererFactory::getRenderer($item["context_obj_type"]);
676  if (trim($item["content"]) != "") { // content
677  $it = new ilNewsItem($item["id"]);
678  $renderer->setNewsItem($it, $item["ref_id"]);
679  $tpl->setCurrentBlock("content");
680  $tpl->setVariable("VAL_CONTENT", $renderer->getDetailContent());
682  }
683  if ($item["update_date"] != $item["creation_date"]) { // update date
684  $tpl->setCurrentBlock("ni_update");
685  $tpl->setVariable("TXT_LAST_UPDATE", $lng->txt("last_update"));
686  $tpl->setVariable(
687  "VAL_LAST_UPDATE",
688  ilDatePresentation::formatDate(new ilDateTime($item["update_date"], IL_CAL_DATETIME))
689  );
691  }
692 
693  // creation date
694  if ($item["creation_date"] != "") {
695  $tpl->setCurrentBlock("ni_update");
696  $tpl->setVariable(
697  "VAL_CREATION_DATE",
698  ilDatePresentation::formatDate(new ilDateTime($item["creation_date"], IL_CAL_DATETIME))
699  );
700  $tpl->setVariable("TXT_CREATED", $lng->txt("created"));
702  }
703 
704 
705  // context / title
706  if ($news_context > 0) {
707  //$obj_id = ilObject::_lookupObjId($_GET["news_context"]);
708  $obj_id = ilObject::_lookupObjId($item["ref_id"]);
709  $obj_type = ilObject::_lookupType($obj_id);
710  $obj_title = ilObject::_lookupTitle($obj_id);
711 
712  // file hack, not nice
713  if ($obj_type === "file") {
714  $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $item["ref_id"]);
715  $url = $ilCtrl->getLinkTargetByClass("ilrepositorygui", "sendfile");
716  $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $this->std_request->getRefId());
717 
718  $button = ilLinkButton::getInstance();
719  $button->setUrl($url);
720  $button->setCaption("download");
721 
722  $tpl->setCurrentBlock("download");
723  $tpl->setVariable("BUTTON_DOWNLOAD", $button->render());
725  }
726 
727  // forum hack, not nice
728  $add = "";
729  if ($obj_type === "frm" && ($item["context_sub_obj_type"] ?? "") === "pos"
730  && $item["context_sub_obj_id"] > 0) {
731  $pos = $item["context_sub_obj_id"];
733  if ($thread > 0) {
734  $add = "_" . $thread . "_" . $pos;
735  }
736  }
737 
738  // wiki hack, not nice
739  if ($obj_type === "wiki" && $item["context_sub_obj_type"] === "wpg"
740  && $item["context_sub_obj_id"] > 0) {
741  $wptitle = ilWikiPage::lookupTitle($item["context_sub_obj_id"]);
742  if ($wptitle != "") {
743  $add = "_" . ilWikiUtil::makeUrlTitle($wptitle);
744  }
745  }
746 
747  $url_target = "./goto.php?client_id=" . rawurlencode(CLIENT_ID) . "&target=" .
748  $obj_type . "_" . $item["ref_id"] . $add;
749 
750  // lm page hack, not nice
751  if (
752  ($item["context_sub_obj_type"] ?? "") === "pg" &&
753  $item["context_sub_obj_id"] > 0 &&
754  in_array($obj_type, ["lm"], true)) {
755  $url_target = "./goto.php?client_id=" . rawurlencode(CLIENT_ID) . "&target=" .
756  "pg_" . $item["context_sub_obj_id"] . "_" . $item["ref_id"];
757  }
758 
759  // blog posting hack, not nice
760  if ($obj_type === "blog" && ($item["context_sub_obj_type"] ?? "") === "blp"
761  && $item["context_sub_obj_id"] > 0) {
762  $url_target = "./goto.php?client_id=" . rawurlencode(CLIENT_ID) . "&target=" .
763  "blog_" . $item["ref_id"] . "_" . $item["context_sub_obj_id"];
764  }
765 
766  $context_opened = false;
767  $loc_stop = $item["loc_stop"] ?? "";
768  if ($item["loc_context"] != null &&
769  $item["loc_context"] != $loc_stop
770  ) {
771  $tpl->setCurrentBlock("context");
772  $context_opened = true;
773  $cont_loc = new ilLocatorGUI();
774  $cont_loc->addContextItems($item["loc_context"], true, (int) $loc_stop);
775  $tpl->setVariable("CONTEXT_LOCATOR", $cont_loc->getHTML());
776  }
777 
778  //var_dump($item);
779  $no_context_title = $item["no_context_title"] ?? false;
780  if ($no_context_title !== true) {
781  if (!$context_opened) {
782  $tpl->setCurrentBlock("context");
783  }
784  $tpl->setVariable("HREF_CONTEXT_TITLE", $url_target);
785  $tpl->setVariable("CONTEXT_TITLE", $obj_title);
786  $tpl->setVariable("IMG_CONTEXT_TITLE", ilObject::_getIcon($obj_id, "big", $obj_type));
787  }
788  if ($context_opened) {
790  }
791 
792  $tpl->setVariable("HREF_TITLE", $url_target);
793  }
794 
795  // title
796  $tpl->setVariable(
797  "VAL_TITLE",
799  $item["context_obj_type"] ?? "",
800  $item["title"] ?? "",
801  $item["content_is_lang_var"] ?? false,
802  $item["agg_ref_id"] ?? 0,
803  $item["aggregation"] ?? []
804  )
805  );
806 
807 
808  $tpl->setCurrentBlock("item");
809  $tpl->setVariable("ITEM_ROW_CSS", $row_css);
811  }
812 
813  $content = $tpl->get();
814  if ($this->getProperty("title") != "") {
815  $title = $this->getProperty("title");
816  } else {
817  $title = $lng->txt("news_internal_news");
818  }
819  $panel = $this->ui->factory()->panel()->standard($title, $this->ui->factory()->legacy($content));
820 
821  $parameter_name = 'news_page';
822 
823  $pagination = $this->ui->factory()->viewControl()->pagination()
824  ->withTargetURL($ilCtrl->getLinkTarget($this, "showNews"), "news_page")
825  ->withTotalEntries(count($this->getData()))
826  ->withPageSize(1)
827  ->withMaxPaginationButtons(10)
828  ->withCurrentPage($curr_cnt - 1);
829  $panel = $panel->withViewControls([$pagination]);
830 
831  return $this->ui->renderer()->render($panel);
832  }
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
ilObjUser $user
const IL_CAL_DATETIME
$c
Definition: cli.php:38
static _getIcon(int $obj_id=0, string $size="big", string $type="", bool $offline=false)
Get icon for repository item.
get(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static determineNewsTitle(string $a_context_obj_type, string $a_title, bool $a_content_is_lang_var, int $a_agg_ref_id=0, array $a_aggregation=[])
Determine title for news item entry.
ilLanguage $lng
if(isset($_FILES['img_file']) &&is_array($_FILES['img_file'])) $panel
Definition: imgupload.php:198
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
static _lookupObjId(int $ref_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getRenderer(string $a_context_obj_type)
static _exists(int $id, bool $reference=false, ?string $type=null)
checks if an object exists in object_data
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:514
const NEWS_PUBLIC
static _lookup(string $a_type, string $a_setting, int $a_user=0, int $a_block_id=0)
Lookup setting from database.
static getMimeType(string $a_file, bool $a_external=false)
get mime type for file
ilTemplate $tpl
static _lookupTitle(int $obj_id)
const CLIENT_ID
Definition: constants.php:41
static userExists(array $a_usr_ids=array())
static _getThreadForPosting(int $a_pos_id)
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
static lookupTitle(int $a_page_id)
static makeUrlTitle(string $a_par)
A news item can be created by different sources.
$ilUser
Definition: imgupload.php:34
$url
static _setRead(int $a_user_id, int $a_news_id)
Set item read.
setData(array $a_data)
ilAccessHandler $access
static _lookupType(int $id, bool $reference=false)
static _lookupContextObjId(int $a_news_id)
Context Object ID.
getProperty(string $a_property)
+ Here is the call graph for this function:

◆ showNotifications()

ilNewsForContextBlockGUI::showNotifications ( )

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

References ilBlockGUI\$ctrl, ilBlockGUI\$data, $ilUser, ilBlockGUI\$user, ilBlockSetting\_write(), getBlockType(), getHTML(), getNewsData(), handleView(), ILIAS\Repository\int(), ilBlockGUI\send(), and ilBlockGUI\setData().

860  : void
861  {
862  $ilCtrl = $this->ctrl;
864 
866  $this->getBlockType(),
867  "view",
868  "",
869  $ilUser->getId(),
870  (int) $this->block_id
871  );
872 
873  // reload data
874  $data = $this->getNewsData();
875  $this->setData($data);
876  $this->handleView();
877 
878  if ($ilCtrl->isAsynch()) {
879  $this->send($this->getHTML());
880  }
881 
882  $ilCtrl->returnToParent($this);
883  }
ilObjUser $user
handleView()
Handles show/hide notification view and removes notifications if hidden.
send(string $output)
Send.
static _write(string $a_type, string $a_setting, string $a_value, int $a_user=0, int $a_block_id=0)
Write setting to database.
$ilUser
Definition: imgupload.php:34
setData(array $a_data)
+ Here is the call graph for this function:

◆ writeSettings()

static ilNewsForContextBlockGUI::writeSettings ( array  $a_values)
static

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

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

Referenced by ilContainerNewsSettingsGUI\save().

1105  : void
1106  {
1107  global $DIC;
1108 
1109  $block_id = $DIC->ctrl()->getContextObjId();
1110  foreach ($a_values as $key => $value) {
1111  ilBlockSetting::_write(self::$block_type, (string) $key, (string) $value, 0, $block_id);
1112  }
1113  }
global $DIC
Definition: feed.php:28
static _write(string $a_type, string $a_setting, string $a_value, int $a_user=0, int $a_block_id=0)
Write setting to database.
string $key
Consumer key/client ID value.
Definition: System.php:193
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $acache

ilNewsCache ilNewsForContextBlockGUI::$acache
protected

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

◆ $block_type

string ilNewsForContextBlockGUI::$block_type = "news"
static

◆ $cache_hit

bool ilNewsForContextBlockGUI::$cache_hit = false
protected

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

◆ $dynamic

bool ilNewsForContextBlockGUI::$dynamic = false
protected

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

◆ $help

ilHelpGUI ilNewsForContextBlockGUI::$help
protected

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

◆ $new_rendering

bool ilNewsForContextBlockGUI::$new_rendering = true
protected

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

◆ $news_access

NewsAccess ilNewsForContextBlockGUI::$news_access
protected

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

◆ $obj_definition

ilObjectDefinition ilNewsForContextBlockGUI::$obj_definition
protected

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

Referenced by getInfoForData().

◆ $settings

ilSetting ilNewsForContextBlockGUI::$settings
protected

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

◆ $settings_form

ilPropertyFormGUI ilNewsForContextBlockGUI::$settings_form
protected

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

Referenced by saveSettings().

◆ $show_view_selection

bool ilNewsForContextBlockGUI::$show_view_selection
protected

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

◆ $st_data

array ilNewsForContextBlockGUI::$st_data
static

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

◆ $std_request

StandardGUIRequest ilNewsForContextBlockGUI::$std_request
protected

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

◆ $tabs

ilTabsGUI ilNewsForContextBlockGUI::$tabs
protected

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

Referenced by initSettingsForm().

◆ $view

string ilNewsForContextBlockGUI::$view
protected

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

◆ 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 34 of file class.ilNewsForContextBlockGUI.php.


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