ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilPDNewsBlockGUI Class Reference

BlockGUI class for block NewsForContext. More...

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

Public Member Functions

 ilPDNewsBlockGUI ()
 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
 ilNewsForContextBlockGUI ()
 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
 ilBlockGUI ()
 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 ilBlockGUI
 $data = array()
 
 $colspan = 1
 
 $enablenuminfo = true
 
 $detail_min = 0
 
 $detail_max = 0
 
 $bigmode = false
 
 $footer_links = array()
 
 $block_id = 0
 
 $header_commands = array()
 
 $allow_moving = true
 
 $move = array("left" => false, "right" => false, "up" => false, "down" => false)
 
 $enabledetailrow = true
 
 $header_links = array()
 
 $footerinfo = false
 
 $footerinfo_icon = false
 
 $block_commands = array()
 
 $max_count = false
 
 $close_command = false
 
 $image = false
 
 $property = false
 
 $nav_value = ""
 
 $css_row = ""
 
 $dropdown
 

Detailed Description

BlockGUI class for block NewsForContext.

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

@ilCtrl_IsCalledBy ilPDNewsBlockGUI: ilColumnGUI

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

Member Function Documentation

◆ addCloseCommand()

ilPDNewsBlockGUI::addCloseCommand (   $a_content_block)

Reimplemented from ilNewsForContextBlockGUI.

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

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

References $ilCtrl, and $lng.

◆ cancelSettings()

ilPDNewsBlockGUI::cancelSettings ( )

Cancel settings.

Reimplemented from ilNewsForContextBlockGUI.

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

482 {
483 global $ilCtrl;
484
485 $ilCtrl->returnToParent($this);
486 }

References $ilCtrl.

◆ changeFeedSettings()

ilPDNewsBlockGUI::changeFeedSettings ( )

change user password

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

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

References $ilCtrl, $ilUser, $lng, 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 372 of file class.ilPDNewsBlockGUI.php.

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

References $ilCtrl, $ilSetting, $ilUser, $lng, 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 170 of file class.ilPDNewsBlockGUI.php.

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

References $cmd, and $ilCtrl.

◆ fillDataSection()

ilPDNewsBlockGUI::fillDataSection ( )

Fill data section.

Reimplemented from ilNewsForContextBlockGUI.

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

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

References $ilBench, 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 126 of file class.ilPDNewsBlockGUI.php.

127 {
128 return self::$block_type;
129 }

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 215 of file class.ilPDNewsBlockGUI.php.

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

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

+ Here is the call graph for this function:

◆ getNewsData()

ilPDNewsBlockGUI::getNewsData ( )

Get news for context.

Reimplemented from ilNewsForContextBlockGUI.

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

101 {
102 global $ilUser, $ilAccess;
103
104 include_once("./Services/News/classes/class.ilNewsCache.php");
105 $this->acache = new ilNewsCache();
106
109 false, $per);
110// if (!$this->acc_cache_hit)
111// {
112// $ilAccess->storeCache();
113// }
114
115 $this->acache->storeEntry($ilUser->getId().":0",
116 serialize($data));
117
118 return $data;
119 }
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, ilNewsItem\_getNewsItemsOfUser(), and ilNewsItem\_lookupUserPDPeriod().

Referenced by ilPDNewsBlockGUI().

+ 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 144 of file class.ilPDNewsBlockGUI.php.

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

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

◆ ilPDNewsBlockGUI()

ilPDNewsBlockGUI::ilPDNewsBlockGUI ( )

Constructor.

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

26 {
27 global $ilCtrl, $lng, $ilUser, $ilBench, $ilAccess, $ilCtrl;
28
29 $ilBench->start("News", "ilPDNewsBlockGUI_Constructor");
30 $news_set = new ilSetting("news");
31
32 parent::ilBlockGUI();
33
34 $lng->loadLanguageModule("news");
35 include_once("./Services/News/classes/class.ilNewsItem.php");
36
37 $this->setLimit(5);
39
40 $this->dynamic = false;
41
42 // store current access check results
43// $this->acc_results = $ilAccess->getResults();
44
45 // read access cache
46// $this->acc_cache_hit = $ilAccess->readCache(
47// ((int) $news_set->get("acc_cache_mins")) * 60);
48
49 include_once("./Services/News/classes/class.ilNewsCache.php");
50 $this->acache = new ilNewsCache();
51 $cres = $this->acache->getEntry($ilUser->getId().":0");
52 $this->cache_hit = false;
53 if ($this->acache->getLastAccessStatus() == "hit")
54 {
55 self::$st_data = ilNewsItem::prepareNewsDataFromCache($cres);;
56 $this->cache_hit = true;
57 }
58
59 if ($this->getDynamic() && !$this->cache_hit)
60 {
61 $this->dynamic = true;
62 $data = array();
63 }
64 else if ($this->getCurrentDetailLevel() > 0)
65 {
66 // do not ask two times for the data (e.g. if user displays a
67 // single item on the personal desktop and the news block is
68 // displayed at the same time)
69 if (empty(self::$st_data))
70 {
71 self::$st_data = $this->getNewsData();
73 }
74 else
75 {
77 }
78 }
79 else
80 {
81 $data = array();
82 }
83
84 $this->setTitle($lng->txt("news_internal_news"));
85 $this->setRowTemplate("tpl.block_row_news_for_context.html", "Services/News");
86
87 $this->setData($data);
88
89 $this->handleView();
90
91 // reset access check results
92 $ilAccess->setResults($this->acc_results);
93
94 $ilBench->stop("News", "ilPDNewsBlockGUI_Constructor");
95 }
setRowTemplate($a_rowtemplatename, $a_rowtemplatedir="")
Set Row Template Name.
setLimit($a_limit)
Set Limit.
setAvailableDetailLevels($a_max, $a_min=0)
Set Available Detail Levels.
setData($a_data)
Set Data.
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.

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

+ Here is the call graph for this function:

◆ initPrivateSettingsForm()

ilPDNewsBlockGUI::initPrivateSettingsForm ( )
protected

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

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

References $ilCtrl, $ilUser, $lng, 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 136 of file class.ilPDNewsBlockGUI.php.

137 {
138 return false;
139 }

◆ saveSettings()

ilPDNewsBlockGUI::saveSettings ( )

Save settings.

Reimplemented from ilNewsForContextBlockGUI.

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

492 {
493 global $ilCtrl, $ilUser;
494
495 $news_set = new ilSetting("news");
496 $enable_internal_rss = $news_set->get("enable_rss_for_internal");
497
498 ilBlockSetting::_write($this->getBlockType(), "news_pd_period",
499 $_POST["news_pd_period"],
500 $ilUser->getId(), $this->block_id);
501
502 include_once("./Services/News/classes/class.ilNewsCache.php");
503 $cache = new ilNewsCache();
504 $cache->deleteEntry($ilUser->getId().":0");
505
506 $ilCtrl->returnToParent($this);
507 }
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, $ilCtrl, $ilUser, ilBlockSetting\_write(), and getBlockType().

+ Here is the call graph for this function:

◆ showFeedUrl()

ilPDNewsBlockGUI::showFeedUrl ( )

Show feed URL.

Reimplemented from ilNewsForContextBlockGUI.

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

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

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

◆ showNews()

ilPDNewsBlockGUI::showNews ( )

show news

Reimplemented from ilNewsForContextBlockGUI.

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

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

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 ilPDNewsBlockGUI().


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