ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilPDNewsBlockGUI Class Reference

BlockGUI class for block NewsForContext. More...

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

Public Member Functions

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

Static Public Member Functions

static getBlockType ()
 Get block type. More...
 
static isRepositoryObject ()
 Is block used in repository object? More...
 
static getScreenMode ()
 Get Screen Mode for current command. More...
 
static getBlockType ()
 Get block type. More...
 
static isRepositoryObject ()
 Is this a repository object. More...
 
static getScreenMode ()
 Get Screen Mode for current command. More...
 
static getBlockType ()
 
static isRepositoryObject ()
 
static getScreenMode ()
 Get Screen Mode for current command. More...
 

Static Public Attributes

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

Protected Member Functions

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

Protected Attributes

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

Detailed Description

BlockGUI class for block NewsForContext.

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

@ilCtrl_IsCalledBy ilPDNewsBlockGUI: ilColumnGUI

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

Constructor & Destructor Documentation

◆ __construct()

ilPDNewsBlockGUI::__construct ( )

Constructor.

Reimplemented from ilNewsForContextBlockGUI.

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

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

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

+ Here is the call graph for this function:

Member Function Documentation

◆ addCloseCommand()

ilPDNewsBlockGUI::addCloseCommand (   $a_content_block)

Reimplemented from ilNewsForContextBlockGUI.

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

337 {
340
341 $a_content_block->addHeaderCommand(
342 $ilCtrl->getParentReturn($this),
343 $lng->txt("selected_items_back")
344 );
345 }
global $ilCtrl
Definition: ilias.php:18

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

◆ cancelSettings()

ilPDNewsBlockGUI::cancelSettings ( )

Cancel settings.

Reimplemented from ilNewsForContextBlockGUI.

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

481 {
483
484 $ilCtrl->returnToParent($this);
485 }

References ilBlockGUI\$ctrl, and $ilCtrl.

◆ changeFeedSettings()

ilPDNewsBlockGUI::changeFeedSettings ( )

change user password

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

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

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

+ Here is the call graph for this function:

◆ editSettings()

ilPDNewsBlockGUI::editSettings ( ilPropertyFormGUI  $a_private_form = null)

Show settings screen.

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

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

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

+ Here is the call graph for this function:

◆ executeCommand()

ilPDNewsBlockGUI::executeCommand ( )

execute command

Reimplemented from ilNewsForContextBlockGUI.

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

163 {
165
166 $next_class = $ilCtrl->getNextClass();
167 $cmd = $ilCtrl->getCmd("getHTML");
168
169 switch ($next_class) {
170 default:
171 return $this->$cmd();
172 }
173 }

References ilBlockGUI\$ctrl, and $ilCtrl.

◆ fillDataSection()

ilPDNewsBlockGUI::fillDataSection ( )

Fill data section.

Reimplemented from ilNewsForContextBlockGUI.

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

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

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

+ Here is the call graph for this function:

◆ getBlockType()

static ilPDNewsBlockGUI::getBlockType ( )
static

Get block type.

Returns
string Block type.

Reimplemented from ilNewsForContextBlockGUI.

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

119 {
120 return self::$block_type;
121 }

References $block_type.

Referenced by saveSettings().

+ Here is the caller graph for this function:

◆ getHTML()

ilPDNewsBlockGUI::getHTML ( )

Get bloch HTML code.

Reimplemented from ilNewsForContextBlockGUI.

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

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

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

+ Here is the call graph for this function:

◆ getNewsData()

ilPDNewsBlockGUI::getNewsData ( )

Get news for context.

Reimplemented from ilNewsForContextBlockGUI.

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

91 {
93
94 include_once("./Services/News/classes/class.ilNewsCache.php");
95 $this->acache = new ilNewsCache();
96
99 $ilUser->getId(),
100 false,
101 false,
102 $per
103 );
104
105 $this->acache->storeEntry(
106 $ilUser->getId() . ":0",
107 serialize($data)
108 );
109
110 return $data;
111 }
static _getNewsItemsOfUser( $a_user_id, $a_only_public=false, $a_prevent_aggregation=false, $a_per=0, &$a_cnt=null)
Get all news items for a user.

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

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getScreenMode()

static ilPDNewsBlockGUI::getScreenMode ( )
static

Get Screen Mode for current command.

Reimplemented from ilNewsForContextBlockGUI.

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

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

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

◆ initPrivateSettingsForm()

ilPDNewsBlockGUI::initPrivateSettingsForm ( )
protected

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

450 {
454
455 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
456 $feed_form = new ilPropertyFormGUI();
457 $feed_form->setFormAction($ilCtrl->getFormaction($this));
458 $feed_form->setTitle($lng->txt("priv_feed_settings"));
459
460 $feed_form->setTableWidth("100%");
461
462 $enable_private_feed = new ilCheckboxInputGUI($lng->txt("news_enable_private_feed"), "enable_private_feed");
463 $enable_private_feed->setChecked($ilUser->_getFeedPass($ilUser->getId()));
464 $feed_form->addItem($enable_private_feed);
465
466 $passwd = new ilPasswordInputGUI($lng->txt("password"), "desired_password");
467 $passwd->setRequired(true);
468 $passwd->setInfo(ilUtil::getPasswordRequirementsInfo());
469 $enable_private_feed->addSubItem($passwd);
470
471 $feed_form->addCommandButton("changeFeedSettings", $lng->txt("save"));
472 $feed_form->addCommandButton("cancelSettings", $lng->txt("cancel"));
473
474 return $feed_form;
475 }
This class represents a checkbox property in a property form.
This class represents a password property in a property form.
static getPasswordRequirementsInfo()
infotext for ilPasswordInputGUI setInfo()

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

Referenced by changeFeedSettings(), and editSettings().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isRepositoryObject()

static ilPDNewsBlockGUI::isRepositoryObject ( )
static

Is block used in repository object?

Returns
string Block type.

Reimplemented from ilNewsForContextBlockGUI.

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

129 {
130 return false;
131 }

◆ saveSettings()

ilPDNewsBlockGUI::saveSettings ( )

Save settings.

Reimplemented from ilNewsForContextBlockGUI.

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

491 {
494
495 $news_set = new ilSetting("news");
496 $enable_internal_rss = $news_set->get("enable_rss_for_internal");
497
499 $this->getBlockType(),
500 "news_pd_period",
501 $_POST["news_pd_period"],
502 $ilUser->getId(),
503 $this->block_id
504 );
505
506 include_once("./Services/News/classes/class.ilNewsCache.php");
507 $cache = new ilNewsCache();
508 $cache->deleteEntry($ilUser->getId() . ":0");
509
510 $ilCtrl->returnToParent($this);
511 }
static _write($a_type, $a_setting, $a_value, $a_user=0, $a_block_id=0)
Write setting to database.
static getBlockType()
Get block type.

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

+ Here is the call graph for this function:

◆ showFeedUrl()

ilPDNewsBlockGUI::showFeedUrl ( )

Show feed URL.

Reimplemented from ilNewsForContextBlockGUI.

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

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

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

+ Here is the call graph for this function:

◆ showNews()

ilPDNewsBlockGUI::showNews ( )

show news

Reimplemented from ilNewsForContextBlockGUI.

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

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

Field Documentation

◆ $acc_results

ilPDNewsBlockGUI::$acc_results = false
protected

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

◆ $block_type

ilPDNewsBlockGUI::$block_type = "pdnews"
static

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

Referenced by getBlockType().

◆ $st_data

ilPDNewsBlockGUI::$st_data
static

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

Referenced by __construct().


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