ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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 ()
 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 ($data)
 get flat list for personal desktop More...
 
 getInfoForData ($news)
 
 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...
 
 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...
 
 getDynamic ()
 
 getDynamicReload ()
 
 getJSEnabler ()
 
 disableJS ()
 
 enableJS ()
 
- Public Member Functions inherited from ilBlockGUI
 getBlockType ()
 
 __construct ()
 Constructor. More...
 
 setData ($a_data)
 Set Data. More...
 
 getData ()
 Get Data. More...
 
 setPresentation (int $type)
 Set presentation. More...
 
 getPresentation ()
 Get presentation type. More...
 
 setBlockId ($a_block_id=0)
 Set Block Id. More...
 
 getBlockId ()
 Get Block Id. More...
 
 setGuiObject (&$a_gui_object)
 Set GuiObject. More...
 
 getGuiObject ()
 Get GuiObject. More...
 
 setTitle ($a_title)
 Set Title. More...
 
 getTitle ()
 Get Title. 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...
 
 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 (bool $a_admincommands)
 Set Administration Commmands. More...
 
 getAdminCommands ()
 Get Administration Commmands. 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 ()
 
 getConfigParameter ()
 
 getMoveParameter ()
 
 getRowTemplateName ()
 Get Row Template Name. More...
 
 getRowTemplateDir ()
 Get Row Template Directory. More...
 
 addBlockCommand (string $a_href, string $a_text, string $a_onclick="")
 Add Block Command. More...
 
 getBlockCommands ()
 Get Block commands. More...
 
 getHTML ()
 Get HTML. 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...
 
 getAsynch ()
 Use this for final get before sending asynchronous output (ajax) per echo to output. More...
 
 getPaginationViewControl ()
 Fill previous/next row. More...
 
 getHTMLNew ()
 Get HTML. 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...
 
- 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
 

Static Public Attributes

static $block_type = "news"
 
static $st_data
 

Protected Member Functions

 isRepositoryObject ()
 
 getMediaPath (int $mob_id)
 
 getListItemForData (array $data)
 
 getNoItemFoundContent ()
 No item entry. More...
 
- Protected Member Functions inherited from ilBlockGUI
 isRepositoryObject ()
 Returns whether block has a corresponding repository object. More...
 
 initCommands ()
 Init commands. More...
 
 fillRowColor ($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...
 
 getNoItemFoundContent ()
 No item entry. More...
 

Protected Attributes

 $help
 
 $settings
 
 $tabs
 
 $obj_definition
 
 $new_rendering = true
 
- Protected Attributes inherited from ilBlockGUI
 $ui
 
 $data = array()
 
 $enablenuminfo = true
 
 $footer_links = array()
 
 $block_id = 0
 
 $allow_moving = true
 
 $move = array("left" => false, "right" => false, "up" => false, "down" => false)
 
 $block_commands = array()
 
 $max_count = false
 
 $close_command = false
 
 $image = false
 
 $property = false
 
 $nav_value = ""
 
 $css_row = ""
 
 $title = ""
 
 $admincommands = false
 
 $dropdown
 
 $tpl
 
 $main_tpl
 
 $user
 
 $ctrl
 
 $access
 
 $lng
 
 $obj_def
 
 $presentation
 
 $new_rendering = false
 

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, ILIAS\GlobalScreen\Provider\__construct(), getDynamic(), getNewsData(), handleView(), help(), ilNewsItem\prepareNewsDataFromCache(), ilBlockGUI\setBlockId(), ilBlockGUI\setData(), ilBlockGUI\setEnableNumInfo(), ilBlockGUI\setLimit(), ilBlockGUI\setPresentation(), 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 
61  $ilCtrl = $DIC->ctrl();
62  $lng = $DIC->language();
63  $ilUser = $DIC->user();
64  $ilHelp = $DIC["ilHelp"];
65 
67 
68  $lng->loadLanguageModule("news");
69  $ilHelp->addHelpSection("news_block");
70 
71  include_once("./Services/News/classes/class.ilNewsItem.php");
72  $this->setBlockId($ilCtrl->getContextObjId());
73  $this->setLimit(5);
74  $this->setEnableNumInfo(true);
75 
76  $this->dynamic = false;
77  include_once("./Services/News/classes/class.ilNewsCache.php");
78  $this->acache = new ilNewsCache();
79  $cres = unserialize($this->acache->getEntry($ilUser->getId() . ":" . $_GET["ref_id"]));
80  $this->cache_hit = false;
81 
82  if ($this->acache->getLastAccessStatus() == "hit" && is_array($cres)) {
83  self::$st_data = ilNewsItem::prepareNewsDataFromCache($cres);
84  $this->cache_hit = true;
85  }
86  if ($this->getDynamic() && !$this->cache_hit) {
87  $this->dynamic = true;
88  $data = array();
89  } else {
90  if (!empty(self::$st_data)) {
91  $data = self::$st_data;
92  } else {
93  $data = $this->getNewsData();
94  self::$st_data = $data;
95  }
96  }
97 
98  $this->setTitle($lng->txt("news_internal_news"));
99  $this->setRowTemplate("tpl.block_row_news_for_context.html", "Services/News");
100  $this->setData($data);
101  $this->allow_moving = false;
102  $this->handleView();
103 
104  $this->setPresentation(self::PRES_SEC_LIST);
105  }
settings()
Definition: settings.php:2
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
help()
Definition: help.php:2
setTitle($a_title)
Set Title.
setBlockId($a_block_id=0)
Set Block Id.
setData($a_data)
Set Data.
$ilUser
Definition: imgupload.php:18
setLimit($a_limit)
Set Limit.
__construct(Container $dic, ilPlugin $plugin)
$DIC
Definition: xapitoken.php:46
setRowTemplate($a_rowtemplatename, $a_rowtemplatedir="")
Set Row Template Name.
setPresentation(int $type)
Set presentation.
+ 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.

Parameters
ilFormPropertyGUI$a_input

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

1167  {
1168  global $DIC;
1169 
1170  $lng = $DIC->language();
1171  $block_id = $DIC->ctrl()->getContextObjId();
1172 
1173  $news_set = new ilSetting("news");
1174  $enable_internal_rss = $news_set->get("enable_rss_for_internal");
1175 
1176  //$public_notification = ilBlockSetting::_lookup(self::$block_type, "public_notifications",0, $block_id);
1177  $public_feed = ilBlockSetting::_lookup(
1178  self::$block_type,
1179  "public_feed",
1180  0,
1181  $block_id
1182  );
1183 
1184  $default_visibility = ilBlockSetting::_lookup(self::$block_type, "default_visibility", 0, $block_id);
1185  if ($default_visibility == "") {
1186  $default_visibility =
1188  }
1189  $radio_group = new ilRadioGroupInputGUI($lng->txt("news_default_visibility"), "default_visibility");
1190  $radio_option = new ilRadioOption($lng->txt("news_visibility_users"), "users");
1191  $radio_group->addOption($radio_option);
1192  $radio_option = new ilRadioOption($lng->txt("news_visibility_public"), "public");
1193  $radio_group->addOption($radio_option);
1194  $radio_group->setInfo($lng->txt("news_news_item_visibility_info"));
1195  $radio_group->setRequired(false);
1196  $radio_group->setValue($default_visibility);
1197  $a_input->addSubItem($radio_group);
1198 
1199  // extra rss feed
1200  if ($enable_internal_rss) {
1201  $radio_rss = new ilCheckboxInputGUI(
1202  $lng->txt("news_public_feed"),
1203  "notifications_public_feed"
1204  );
1205  $radio_rss->setInfo($lng->txt("news_public_feed_info"));
1206  $radio_rss->setChecked($public_feed);
1207  $a_input->addSubItem($radio_rss);
1208  }
1209  }
This class represents an option in a radio group.
$_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.
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cancelSettings()

ilNewsForContextBlockGUI::cancelSettings ( )

Cancel settings.

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

References ilBlockGUI\$ctrl, and $ilCtrl.

1225  {
1226  $ilCtrl = $this->ctrl;
1227 
1228  $ilCtrl->returnToParent($this);
1229  }
global $ilCtrl
Definition: ilias.php:18

◆ disableJS()

ilNewsForContextBlockGUI::disableJS ( )

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

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

1444  {
1445  $ilCtrl = $this->ctrl;
1446  $ilUser = $this->user;
1447 
1448  $_SESSION["il_feed_js"] = "n";
1449  $ilUser->writePref("il_feed_js", "n");
1450  $ilCtrl->returnToParent($this);
1451  }
$_SESSION["AccountId"]
global $ilCtrl
Definition: ilias.php:18
$ilUser
Definition: imgupload.php:18

◆ editSettings()

ilNewsForContextBlockGUI::editSettings ( )

Show settings screen.

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

References initSettingsForm().

Referenced by ilPDNewsBlockGUI\changeFeedSettings().

1006  {
1007  $this->initSettingsForm();
1008  return $this->settings_form->getHTML();
1009  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ enableJS()

ilNewsForContextBlockGUI::enableJS ( )

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

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

1454  {
1455  $ilUser = $this->user;
1456  //echo "enableJS";
1457  $_SESSION["il_feed_js"] = "y";
1458  $ilUser->writePref("il_feed_js", "y");
1459  echo $this->getHTML();
1460  exit;
1461  }
exit
Definition: login.php:29
$_SESSION["AccountId"]
$ilUser
Definition: imgupload.php:18
+ Here is the call graph for this function:

◆ executeCommand()

ilNewsForContextBlockGUI::executeCommand ( )

execute command

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

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

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

◆ fillDataSection()

ilNewsForContextBlockGUI::fillDataSection ( )

Fill data section.

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

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

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

◆ fillRow()

ilNewsForContextBlockGUI::fillRow (   $data)

get flat list for personal desktop

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

References ilBlockGUI\$data, and getInfoForData().

429  {
430  $info = $this->getInfoForData($data);
431 
432  $this->tpl->setCurrentBlock("long");
433  $this->tpl->setVariable("VAL_CREATION_DATE", $info["creation_date"]);
434  $this->tpl->parseCurrentBlock();
435 
436  if ($info["ref_id"] > 0) {
437  $this->tpl->setCurrentBlock("news_context");
438  $this->tpl->setVariable("TYPE", $info["type_txt"]);
439  $this->tpl->setVariable("IMG_TYPE", $info["type_icon"]);
440  $this->tpl->setVariable("TITLE", $info["obj_title"]);
441  if ($info["user_read"] > 0) {
442  $this->tpl->setVariable("TITLE_CLASS", 'class="light"');
443  }
444 
445  $this->tpl->parseCurrentBlock();
446  }
447 
448  // title
449  $this->tpl->setVariable("VAL_TITLE", $info["news_title"]);
450 
451  if ($info["user_read"] > 0) {
452  $this->tpl->setVariable("A_CLASS", 'class="light"');
453  }
454 
455  $this->tpl->setVariable("HREF_SHOW", $info["url"]);
456  }
+ Here is the call graph for this function:

◆ getBlockType()

ilNewsForContextBlockGUI::getBlockType ( )

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

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

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

◆ getDynamic()

ilNewsForContextBlockGUI::getDynamic ( )

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

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

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

1359  {
1360  $ilCtrl = $this->ctrl;
1361  $ilUser = $this->user;
1362 
1363  // @todo: enable js loading
1364  if ($this->new_rendering) {
1365  return false;
1366  }
1367 
1368  if ($ilCtrl->getCmd() == "hideNotifications" ||
1369  $ilCtrl->getCmd() == "showNotifications") {
1370  return false;
1371  }
1372 
1373  if ($ilCtrl->getCmdClass() != "ilcolumngui" && $ilCtrl->getCmd() != "enableJS") {
1374  $sess_feed_js = "";
1375  if (isset($_SESSION["il_feed_js"])) {
1376  $sess_feed_js = $_SESSION["il_feed_js"];
1377  }
1378 
1379  if ($sess_feed_js != "n" &&
1380  ($ilUser->getPref("il_feed_js") != "n" || $sess_feed_js == "y")) {
1381  // do not get feed dynamically, if cache hit is given.
1382  // if (!$this->feed->checkCacheHit())
1383  // {
1384  return true;
1385  // }
1386  }
1387  }
1388 
1389  return false;
1390  }
$_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 1392 of file class.ilNewsForContextBlockGUI.php.

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

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

1393  {
1394  $ilCtrl = $this->ctrl;
1395  $lng = $this->lng;
1396 
1397  $ilCtrl->setParameterByClass(
1398  "ilcolumngui",
1399  "block_id",
1400  "block_" . $this->getBlockType() . "_" . $this->getBlockId()
1401  );
1402 
1403  $rel_tpl = new ilTemplate("tpl.dynamic_reload.html", true, true, "Services/News");
1404  $rel_tpl->setVariable("TXT_LOADING", $lng->txt("news_loading_news"));
1405  $rel_tpl->setVariable("BLOCK_ID", "block_" . $this->getBlockType() . "_" . $this->getBlockId());
1406  $rel_tpl->setVariable(
1407  "TARGET",
1408  $ilCtrl->getLinkTargetByClass("ilcolumngui", "updateBlock", "", true)
1409  );
1410 
1411  // no JS
1412  $rel_tpl->setVariable("TXT_NEWS_CLICK_HERE", $lng->txt("news_no_js_click_here"));
1413  $rel_tpl->setVariable(
1414  "TARGET_NO_JS",
1415  $ilCtrl->getLinkTargetByClass(strtolower(get_class($this)), "disableJS")
1416  );
1417 
1418  return $rel_tpl->get();
1419  }
global $ilCtrl
Definition: ilias.php:18
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 241 of file class.ilNewsForContextBlockGUI.php.

Referenced by executeCommand(), and getHTML().

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

◆ getHTML()

ilNewsForContextBlockGUI::getHTML ( )

Get bloch HTML code.

Definition at line 263 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(), getBlockType(), ilBlockGUI\getData(), getEnableEdit(), ilBlockGUI\getProperty(), ilBlockGUI\getRepositoryMode(), ILIAS_HTTP_PATH, OBJECTS_WITH_NEWS_SUBTAB, and ilBlockGUI\setTitle().

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

264  {
265  global $DIC;
266 
268  $lng = $this->lng;
270 
271  $news_set = new ilSetting("news");
272  $enable_internal_rss = $news_set->get("enable_rss_for_internal");
273 
274  $hide_block = ilBlockSetting::_lookup(
275  $this->getBlockType(),
276  "hide_news_block",
277  0,
278  $this->block_id
279  );
280 
281  if ($this->getProperty("title") != "") {
282  $this->setTitle($this->getProperty("title"));
283  }
284 
285  $public_feed = ilBlockSetting::_lookup(
286  $this->getBlockType(),
287  "public_feed",
288  0,
289  $this->block_id
290  );
291  if ($public_feed) {
292  if ($enable_internal_rss) {
293  include_once("./Services/News/classes/class.ilRSSButtonGUI.php");
294  // @todo: rss icon HTML: ilRSSButtonGUI::get(ilRSSButtonGUI::ICON_RSS)
295  $this->addBlockCommand(
296  ILIAS_HTTP_PATH . "/feed.php?client_id=" . rawurlencode(CLIENT_ID) . "&" .
297  "ref_id=" . $_GET["ref_id"],
298  $lng->txt("news_feed_url")
299  );
300  }
301  }
302 
303  // add edit commands
304  if ($this->getEnableEdit()) {
305  $this->addBlockCommand(
306  $ilCtrl->getLinkTargetByClass("ilnewsitemgui", "editNews"),
307  $lng->txt("edit")
308  );
309 
310  $ilCtrl->setParameter($this, "add_mode", "block");
311  $this->addBlockCommand(
312  $ilCtrl->getLinkTargetByClass("ilnewsitemgui", "createNewsItem"),
313  $lng->txt("add")
314  );
315  $ilCtrl->setParameter($this, "add_mode", "");
316  }
317 
318  if ($this->getProperty("settings") == true) {
319  $ref_id = $_GET["ref_id"];
320  $obj_def = $DIC["objDefinition"];
321  $obj_id = ilObject::_lookupObjectId($ref_id);
322  $obj_type = ilObject::_lookupType($ref_id, true);
323  $obj_class = strtolower($obj_def->getClassName($obj_type));
324  $parent_gui = "ilobj" . $obj_class . "gui";
325 
326  $ilCtrl->setParameterByClass("ilcontainernewssettingsgui", "ref_id", $ref_id);
327 
328  if (in_array($obj_class, ilNewsForContextBlockGUI::OBJECTS_WITH_NEWS_SUBTAB)) {
329  $this->addBlockCommand(
330  $ilCtrl->getLinkTargetByClass(array("ilrepositorygui", $parent_gui, "ilcontainernewssettingsgui"), "show"),
331  $lng->txt("settings")
332  );
333  } else {
334  $this->addBlockCommand(
335  $ilCtrl->getLinkTarget($this, "editSettings"),
336  $lng->txt("settings")
337  );
338  }
339  }
340 
341  // do not display hidden repository news blocks for users
342  // who do not have write permission
343  if (!$this->getEnableEdit() && $this->getRepositoryMode() &&
345  $this->getBlockType(),
346  "hide_news_block",
347  0,
348  $this->block_id
349  )) {
350  return "";
351  }
352 
353  // do not display empty news blocks for users
354  // who do not have write permission
355  if (count($this->getData()) == 0 && !$this->getEnableEdit() &&
356  $this->getRepositoryMode() && !$this->dynamic
357  && (!$news_set->get("enable_rss_for_internal") ||
359  $this->getBlockType(),
360  "public_feed",
361  0,
362  $this->block_id
363  ))) {
364  return "";
365  }
366 
367  $en = "";
368  if ($ilUser->getPref("il_feed_js") == "n") {
369  // $en = getJSEnabler();
370  }
371 
372  return parent::getHTML() . $en;
373  }
$_GET["client_id"]
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
getData()
Get Data.
$DIC
Definition: xapitoken.php:46
addBlockCommand(string $a_href, string $a_text, string $a_onclick="")
Add Block Command.
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:

◆ getInfoForData()

ilNewsForContextBlockGUI::getInfoForData (   $news)

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

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

Referenced by fillRow(), and getListItemForData().

459  {
461  $lng = $this->lng;
463 
464  $info = [];
465 
466  $info["ref_id"] = $news["ref_id"];
467  $info["creation_date"] =
468  ilDatePresentation::formatDate(new ilDateTime($news["creation_date"], IL_CAL_DATETIME));
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 
491  $info["type_txt"] = $type_txt;
492  $info["type_icon"] = ilObject::_getIcon($obj_id, "tiny", $type);
493  $info["obj_title"] = ilUtil::shortenWords(ilObject::_lookupTitle($obj_id));
494  $info["user_read"] = $news["user_read"];
495 
496  $ilCtrl->setParameter($this, "news_context", $context_ref);
497  } else {
498  $ilCtrl->setParameter($this, "news_context", "");
499  }
500 
501  // title
502  $info["news_title"] =
504  $news["context_obj_type"],
505  $news["title"],
506  $news["content_is_lang_var"],
507  $news["agg_ref_id"],
508  $news["aggregation"]
509  ));
510 
511 
512  $ilCtrl->setParameter($this, "news_id", $news["id"]);
513  $info["url"] =
514  $ilCtrl->getLinkTarget($this, "showNews");
515  $ilCtrl->clearParameters($this);
516 
517  return $info;
518  }
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)
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.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getJSEnabler()

ilNewsForContextBlockGUI::getJSEnabler ( )

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

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

Referenced by ilPDNewsBlockGUI\getHTML().

1422  {
1423  $ilCtrl = $this->ctrl;
1424  $lng = $this->lng;
1425 
1426  $ilCtrl->setParameterByClass(
1427  "ilcolumngui",
1428  "block_id",
1429  "block_" . $this->getBlockType() . "_" . $this->getBlockId()
1430  );
1431  //echo "hh";
1432  $rel_tpl = new ilTemplate("tpl.js_enabler.html", true, true, "Services/News");
1433  $rel_tpl->setVariable("BLOCK_ID", "block_" . $this->getBlockType() . "_" . $this->getBlockId());
1434  $rel_tpl->setVariable(
1435  "TARGET",
1436  $ilCtrl->getLinkTargetByClass(strtolower(get_class($this)), "enableJS", true, "", false)
1437  );
1438 
1439  return $rel_tpl->get();
1440  }
global $ilCtrl
Definition: ilias.php:18
getBlockId()
Get Block Id.
+ 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 1473 of file class.ilNewsForContextBlockGUI.php.

References $factory, getInfoForData(), and ui().

1474  {
1475  $info = $this->getInfoForData($data);
1476 
1477 
1478  $props = [
1479  $this->lng->txt("news_date") => $info["creation_date"]
1480  ];
1481 
1482 
1483  // @todo: fix this
1484  // $info["user_read"]
1485 
1486  $factory = $this->ui->factory();
1487  $item = $factory->item()->standard($factory->link()->standard($info["news_title"], $info["url"]))
1488  ->withProperties($props);
1489  if ($info["ref_id"] > 0) {
1490  $item = $item->withDescription($info["type_txt"] . ": " . $info["obj_title"]);
1491  }
1492  return $item;
1493  }
Common interface to all items.
Definition: Item.php:10
ui()
Definition: ui.php:5
$factory
Definition: metadata.php:58
+ Here is the call graph for this function:

◆ getMediaPath()

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

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

References ilObjMediaObject\_getURL().

Referenced by showNews().

889  {
890  $media_path = "";
891  if ($mob_id > 0) {
892  $mob = new ilObjMediaObject($mob_id);
893  $med = $mob->getMediaItem("Standard");
894  if (strcasecmp("Reference", $med->getLocationType()) == 0) {
895  $media_path = $med->getLocation();
896  } else {
897  $media_path = ilObjMediaObject::_getURL($mob->getId()) . "/" . $med->getLocation();
898  }
899  }
900  return $media_path;
901  }
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 110 of file class.ilNewsForContextBlockGUI.php.

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

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

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

◆ getNoItemFoundContent()

ilNewsForContextBlockGUI::getNoItemFoundContent ( )
protected

No item entry.

Returns
string

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

1500  : string
1501  {
1502  return $this->lng->txt("news_no_news_items");
1503  }

◆ getOverview()

ilNewsForContextBlockGUI::getOverview ( )

Get overview.

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

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

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

524  {
526  $lng = $this->lng;
528 
529  return '<div class="small">' . ((int) count($this->getData())) . " " . $lng->txt("news_news_items") . "</div>";
530  }
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 176 of file class.ilNewsForContextBlockGUI.php.

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

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

◆ handleView()

ilNewsForContextBlockGUI::handleView ( )

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

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

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

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

379  {
381 
382  include_once("Services/Block/classes/class.ilBlockSetting.php");
383  $this->view = ilBlockSetting::_lookup(
384  $this->getBlockType(),
385  "view",
386  $ilUser->getId(),
388  );
389 
390  // check whether notices and messages exist
391  $got_notices = $got_messages = false;
392  foreach ($this->data as $row) {
393  if ($row["priority"] == 0) {
394  $got_notices = true;
395  }
396  if ($row["priority"] == 1) {
397  $got_messages = true;
398  }
399  }
400  $this->show_view_selection = false;
401 
402  if ($got_notices && $got_messages) {
403  $this->show_view_selection = true;
404  } elseif ($got_notices) {
405  $this->view = "";
406  }
407 
408  // remove notifications if hidden
409 /*
410  if (($this->view == "hide_notifications") && $this->show_view_selection)
411  {
412  $rset = array();
413  foreach($this->data as $k => $row)
414  {
415  if ($row["priority"] == 1)
416  {
417  $rset[$k] = $row;
418  }
419  }
420  $this->data = $rset;
421  }
422 */
423  }
static _lookup($a_type, $a_setting, $a_user=0, $a_block_id=0)
Lookup setting from database.
$ilUser
Definition: imgupload.php:18
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hideNotifications()

ilNewsForContextBlockGUI::hideNotifications ( )

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

976  {
979 
980  include_once("Services/Block/classes/class.ilBlockSetting.php");
982  $this->getBlockType(),
983  "view",
984  "hide_notifications",
985  $ilUser->getId(),
987  );
988 
989  // reload data
990  $data = $this->getNewsData();
991  $this->setData($data);
992  $this->handleView();
993 
994  if ($ilCtrl->isAsynch()) {
995  echo $this->getHTML();
996  exit;
997  } else {
998  $ilCtrl->returnToParent($this);
999  }
1000  }
exit
Definition: login.php:29
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
+ Here is the call graph for this function:

◆ initSettingsForm()

ilNewsForContextBlockGUI::initSettingsForm ( )

Init setting form.

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

1015  {
1016  $ilUser = $this->user;
1017  $lng = $this->lng;
1018  $ilCtrl = $this->ctrl;
1020  $ilTabs = $this->tabs;
1021 
1022  $ilTabs->clearTargets();
1023 
1024  $news_set = new ilSetting("news");
1025  $enable_internal_rss = $news_set->get("enable_rss_for_internal");
1026 
1027  $public = ilBlockSetting::_lookup(
1028  $this->getBlockType(),
1029  "public_notifications",
1030  0,
1031  $this->block_id
1032  );
1033  $public_feed = ilBlockSetting::_lookup(
1034  $this->getBlockType(),
1035  "public_feed",
1036  0,
1037  $this->block_id
1038  );
1039  $hide_block = ilBlockSetting::_lookup(
1040  $this->getBlockType(),
1041  "hide_news_block",
1042  0,
1043  $this->block_id
1044  );
1045  $hide_news_per_date = ilBlockSetting::_lookup(
1046  $this->getBlockType(),
1047  "hide_news_per_date",
1048  0,
1049  $this->block_id
1050  );
1051  $hide_news_date = ilBlockSetting::_lookup(
1052  $this->getBlockType(),
1053  "hide_news_date",
1054  0,
1055  $this->block_id
1056  );
1057 
1058  if ($hide_news_date != "") {
1059  $hide_news_date = explode(" ", $hide_news_date);
1060  }
1061 
1062  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
1063  $this->settings_form = new ilPropertyFormGUI();
1064  $this->settings_form->setTitle($lng->txt("news_settings"));
1065 
1066  // hide news block for learners
1067  if ($this->getProperty("hide_news_block_option")) {
1068  $ch = new ilCheckboxInputGUI(
1069  $lng->txt("news_hide_news_block"),
1070  "hide_news_block"
1071  );
1072  $ch->setInfo($lng->txt("news_hide_news_block_info"));
1073  $ch->setChecked($hide_block);
1074  $this->settings_form->addItem($ch);
1075 
1076  $hnpd = new ilCheckboxInputGUI(
1077  $lng->txt("news_hide_news_per_date"),
1078  "hide_news_per_date"
1079  );
1080  $hnpd->setInfo($lng->txt("news_hide_news_per_date_info"));
1081  $hnpd->setChecked($hide_news_per_date);
1082 
1083  $dt_prop = new ilDateTimeInputGUI(
1084  $lng->txt("news_hide_news_date"),
1085  "hide_news_date"
1086  );
1087  $dt_prop->setRequired(true);
1088  if ($hide_news_date != "") {
1089  $dt_prop->setDate(new ilDateTime($hide_news_date[0] . ' ' . $hide_news_date[1], IL_CAL_DATETIME));
1090  }
1091  #$dt_prop->setDate($hide_news_date[0]);
1092  #$dt_prop->setTime($hide_news_date[1]);
1093  $dt_prop->setShowTime(true);
1094  //$dt_prop->setInfo($lng->txt("news_hide_news_date_info"));
1095  $hnpd->addSubItem($dt_prop);
1096 
1097  $this->settings_form->addItem($hnpd);
1098  }
1099 
1100  // default visibility
1101  if ($this->getProperty("default_visibility_option") &&
1102  $enable_internal_rss) {
1103  $default_visibility = ilBlockSetting::_lookup(
1104  $this->getBlockType(),
1105  "default_visibility",
1106  0,
1107  $this->block_id
1108  );
1109  if ($default_visibility == "") {
1110  $default_visibility =
1112  }
1113 
1114  // Default Visibility
1115  $radio_group = new ilRadioGroupInputGUI($lng->txt("news_default_visibility"), "default_visibility");
1116  $radio_option = new ilRadioOption($lng->txt("news_visibility_users"), "users");
1117  $radio_group->addOption($radio_option);
1118  $radio_option = new ilRadioOption($lng->txt("news_visibility_public"), "public");
1119  $radio_group->addOption($radio_option);
1120  $radio_group->setInfo($lng->txt("news_news_item_visibility_info"));
1121  $radio_group->setRequired(false);
1122  $radio_group->setValue($default_visibility);
1123  $this->settings_form->addItem($radio_group);
1124  }
1125 
1126  // public notifications
1127  if ($this->getProperty("public_notifications_option") &&
1128  $enable_internal_rss) {
1129  $ch = new ilCheckboxInputGUI(
1130  $lng->txt("news_notifications_public"),
1131  "notifications_public"
1132  );
1133  $ch->setInfo($lng->txt("news_notifications_public_info"));
1134  $ch->setChecked($public);
1135  $this->settings_form->addItem($ch);
1136  }
1137 
1138  // extra rss feed
1139  if ($enable_internal_rss) {
1140  $ch = new ilCheckboxInputGUI(
1141  $lng->txt("news_public_feed"),
1142  "notifications_public_feed"
1143  );
1144  $ch->setInfo($lng->txt("news_public_feed_info"));
1145  $ch->setChecked($public_feed);
1146  $this->settings_form->addItem($ch);
1147  }
1148 
1149 
1150  //$this->settings_form->addCheckboxProperty($lng->txt("news_public_feed"), "notifications_public_feed",
1151  // "1", $public_feed, $lng->txt("news_public_feed_info"));
1152  //if ($this->getProperty("public_notifications_option"))
1153  //{
1154  // $this->settings_form->addCheckboxProperty($lng->txt("news_notifications_public"), "notifications_public",
1155  // "1", $public, $lng->txt("news_notifications_public_info"));
1156  //}
1157  $this->settings_form->addCommandButton("saveSettings", $lng->txt("save"));
1158  $this->settings_form->addCommandButton("cancelSettings", $lng->txt("cancel"));
1159  $this->settings_form->setFormAction($ilCtrl->getFormaction($this));
1160  }
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.
$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 168 of file class.ilNewsForContextBlockGUI.php.

168  : bool
169  {
170  return false;
171  }

◆ makeClickable()

ilNewsForContextBlockGUI::makeClickable (   $a_str)

Make clickable.

Parameters

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

References ilUtil\makeClickable().

910  {
911  // this fixes bug 8744. We assume that strings that contain < and >
912  // already contain html, we do not handle these
913  if (is_int(strpos($a_str, ">")) && is_int(strpos($a_str, "<"))) {
914  return $a_str;
915  }
916 
917  return ilUtil::makeClickable($a_str);
918  }
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 1234 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().

1235  {
1236  $ilCtrl = $this->ctrl;
1237  $ilUser = $this->user;
1238 
1239  $this->initSettingsForm();
1240  if ($this->settings_form->checkInput()) {
1241  $news_set = new ilSetting("news");
1242  $enable_internal_rss = $news_set->get("enable_rss_for_internal");
1243 
1244  if ($enable_internal_rss) {
1246  $this->getBlockType(),
1247  "public_notifications",
1248  $_POST["notifications_public"],
1249  0,
1250  $this->block_id
1251  );
1253  $this->getBlockType(),
1254  "public_feed",
1255  $_POST["notifications_public_feed"],
1256  0,
1257  $this->block_id
1258  );
1260  $this->getBlockType(),
1261  "default_visibility",
1262  $_POST["default_visibility"],
1263  0,
1264  $this->block_id
1265  );
1266  }
1267 
1268  if ($this->getProperty("hide_news_block_option")) {
1270  $this->getBlockType(),
1271  "hide_news_block",
1272  $_POST["hide_news_block"],
1273  0,
1274  $this->block_id
1275  );
1277  $this->getBlockType(),
1278  "hide_news_per_date",
1279  $_POST["hide_news_per_date"],
1280  0,
1281  $this->block_id
1282  );
1283 
1284  // hide date
1285  $hd = $this->settings_form->getItemByPostVar("hide_news_date");
1286  $hide_date = $hd->getDate();
1287  if ($_POST["hide_news_per_date"] && $hide_date != null) {
1289  $this->getBlockType(),
1290  "hide_news_date",
1291  $hide_date->get(IL_CAL_DATETIME),
1292  0,
1294  );
1295  } else {
1297  $this->getBlockType(),
1298  "hide_news_date",
1299  "",
1300  0,
1301  $this->block_id
1302  );
1303  }
1304  }
1305 
1306  include_once("./Services/News/classes/class.ilNewsCache.php");
1307  $cache = new ilNewsCache();
1308  $cache->deleteEntry($ilUser->getId() . ":" . $_GET["ref_id"]);
1309 
1310  $ilCtrl->returnToParent($this);
1311  } else {
1312  $this->settings_form->setValuesByPost();
1313  return $this->settings_form->getHtml();
1314  }
1315  }
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 231 of file class.ilNewsForContextBlockGUI.php.

232  {
233  $this->enable_edit = $a_enable_edit;
234  }

◆ showFeedUrl()

ilNewsForContextBlockGUI::showFeedUrl ( )

Show feed URL.

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

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

1321  {
1322  $lng = $this->lng;
1323  $ilCtrl = $this->ctrl;
1324  $ilUser = $this->user;
1325 
1326  include_once("./Services/News/classes/class.ilNewsItem.php");
1327 
1328  $title = ilObject::_lookupTitle($this->block_id);
1329 
1330  $tpl = new ilTemplate("tpl.show_feed_url.html", true, true, "Services/News");
1331  $tpl->setVariable(
1332  "TXT_TITLE",
1333  sprintf($lng->txt("news_feed_url_for"), $title)
1334  );
1335  $tpl->setVariable("TXT_INFO", $lng->txt("news_get_feed_info"));
1336  $tpl->setVariable("TXT_FEED_URL", $lng->txt("news_feed_url"));
1337  $tpl->setVariable(
1338  "VAL_FEED_URL",
1339  ILIAS_HTTP_PATH . "/feed.php?client_id=" . rawurlencode(CLIENT_ID) . "&user_id=" . $ilUser->getId() .
1340  "&obj_id=" . $this->block_id .
1341  "&hash=" . ilObjUser::_lookupFeedHash($ilUser->getId(), true)
1342  );
1343  $tpl->setVariable(
1344  "VAL_FEED_URL_TXT",
1345  ILIAS_HTTP_PATH . "/feed.php?client_id=" . rawurlencode(CLIENT_ID) . "&<br />user_id=" . $ilUser->getId() .
1346  "&obj_id=" . $this->block_id .
1347  "&hash=" . ilObjUser::_lookupFeedHash($ilUser->getId(), true)
1348  );
1349 
1350  $content_block = new ilDashboardContentBlockGUI();
1351  $content_block->setContent($tpl->get());
1352  $content_block->setTitle($lng->txt("news_internal_news"));
1353 
1354  return $content_block->getHTML();
1355  }
static _lookupTitle($a_id)
lookup object title
global $ilCtrl
Definition: ilias.php:18
$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 535 of file class.ilNewsForContextBlockGUI.php.

References $_GET, ilBlockGUI\$access, Vendor\Package\$c, ilBlockGUI\$ctrl, $ilCtrl, $ilUser, ilBlockGUI\$lng, ilBlockGUI\$title, ilBlockGUI\$tpl, $url, ilBlockGUI\$user, ilObject\_exists(), ilObjForumAccess\_getThreadForPosting(), ilBlockSetting\_lookup(), ilNewsItem\_lookupContextObjId(), ilObject\_lookupObjId(), ilObject\_lookupTitle(), ilObject\_lookupType(), ilNewsItem\_setRead(), 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, ilBlockGUI\setData(), and ui().

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

◆ showNotifications()

ilNewsForContextBlockGUI::showNotifications ( )

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

949  {
952 
953  include_once("Services/Block/classes/class.ilBlockSetting.php");
955  $this->getBlockType(),
956  "view",
957  "",
958  $ilUser->getId(),
960  );
961 
962  // reload data
963  $data = $this->getNewsData();
964  $this->setData($data);
965  $this->handleView();
966 
967  if ($ilCtrl->isAsynch()) {
968  echo $this->getHTML();
969  exit;
970  } else {
971  $ilCtrl->returnToParent($this);
972  }
973  }
exit
Definition: login.php:29
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
+ Here is the call graph for this function:

◆ subscribeNews()

ilNewsForContextBlockGUI::subscribeNews ( )

Subscribe current user from news.

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

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

938  {
941 
942  include_once("./Services/News/classes/class.ilNewsSubscription.php");
943  ilNewsSubscription::_subscribe($_GET["ref_id"], $ilUser->getId());
944  $ilCtrl->returnToParent($this);
945  }
$_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 924 of file class.ilNewsForContextBlockGUI.php.

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

925  {
928 
929  include_once("./Services/News/classes/class.ilNewsSubscription.php");
930  ilNewsSubscription::_unsubscribe($_GET["ref_id"], $ilUser->getId());
931  $ilCtrl->returnToParent($this);
932  }
$_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 1211 of file class.ilNewsForContextBlockGUI.php.

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

Referenced by ilContainerNewsSettingsGUI\save().

1212  {
1213  global $DIC;
1214 
1215  $block_id = $DIC->ctrl()->getContextObjId();
1216  foreach ($a_values as $key => $value) {
1217  ilBlockSetting::_write(self::$block_type, $key, $value, 0, $block_id);
1218  }
1219  }
static _write($a_type, $a_setting, $a_value, $a_user=0, $a_block_id=0)
Write setting to database.
$DIC
Definition: xapitoken.php:46
+ 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.

◆ $new_rendering

ilNewsForContextBlockGUI::$new_rendering = true
protected

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

◆ $obj_definition

ilNewsForContextBlockGUI::$obj_definition
protected

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

Referenced by getInfoForData().

◆ $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: