ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
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)
 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 Public Member Functions inherited from ilNewsForContextBlockGUI
static getBlockType ()
 Get block type. More...
 
static isRepositoryObject ()
 Is this a repository object. More...
 
static getScreenMode ()
 Get Screen Mode for current command. More...
 
- Static Public Member Functions inherited from ilBlockGUI
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

ilPDNewsBlockGUI: ilColumnGUI

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

Member Function Documentation

◆ addCloseCommand()

ilPDNewsBlockGUI::addCloseCommand (   $a_content_block)

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

References $ilCtrl, and $lng.

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

◆ cancelSettings()

ilPDNewsBlockGUI::cancelSettings ( )

Cancel settings.

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

References $ilCtrl.

487  {
488  global $ilCtrl;
489 
490  $ilCtrl->returnToParent($this);
491  }
global $ilCtrl
Definition: ilias.php:18

◆ changeFeedSettings()

ilPDNewsBlockGUI::changeFeedSettings ( )

change user password

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

References $ilCtrl, $ilUser, $lng, ilNewsForContextBlockGUI\editSettings(), initPrivateSettingsForm(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

518  {
519  global $ilCtrl, $lng, $ilUser;
520 
521  $form = $this->initPrivateSettingsForm();
522  if($form->checkInput())
523  {
524  // Deactivate private Feed - just delete the password
525  if (!$form->getInput("enable_private_feed"))
526  {
527  $ilUser->_setFeedPass($ilUser->getId(), "");
528  ilUtil::sendSuccess($lng->txt("priv_feed_disabled"),true);
529  // $ilCtrl->returnToParent($this);
530  $ilCtrl->redirect($this, "showFeedUrl");
531  }
532  else
533  {
534  $passwd = $form->getInput("desired_password");
535  if (md5($passwd) == $ilUser->getPasswd())
536  {
537  $form->getItemByPostVar("desired_password")->setAlert($lng->txt("passwd_equals_ilpasswd"));
538  ilUtil::sendFailure($lng->txt("form_input_not_valid"));
539  }
540  else
541  {
542  $ilUser->_setFeedPass($ilUser->getId(), $passwd);
543  ilUtil::sendSuccess($lng->txt("saved_successfully"),true);
544  // $ilCtrl->returnToParent($this);
545  $ilCtrl->redirect($this, "showFeedUrl");
546  }
547  }
548  }
549 
550  $form->setValuesByPost();
551  return $this->editSettings($form);
552  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
global $ilCtrl
Definition: ilias.php:18
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
global $ilUser
Definition: imgupload.php:15
global $lng
Definition: privfeed.php:40
+ Here is the call graph for this function:

◆ editSettings()

ilPDNewsBlockGUI::editSettings ( ilPropertyFormGUI  $a_private_form = null)

Show settings screen.

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

References $ilCtrl, $ilSetting, $ilUser, $lng, ilNewsItem\_lookupDefaultPDPeriod(), ilNewsItem\_lookupUserPDPeriod(), ilUtil\getImagePath(), initPrivateSettingsForm(), and ilSelectInputGUI\setOptions().

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

◆ executeCommand()

& ilPDNewsBlockGUI::executeCommand ( )

execute command

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

References $cmd, and $ilCtrl.

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

◆ fillDataSection()

ilPDNewsBlockGUI::fillDataSection ( )

Fill data section.

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

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

190  {
191  global $ilBench;
192 
193  if ($this->dynamic)
194  {
195  $this->setDataSection($this->getDynamicReload());
196  }
197  else if ($this->getCurrentDetailLevel() > 1 && count($this->getData()) > 0)
198  {
199  $ilBench->start("News", "ilPDNewsBlockGUI_fillDataSection");
200  parent::fillDataSection();
201  $ilBench->stop("News", "ilPDNewsBlockGUI_fillDataSection");
202  }
203  else
204  {
205  $this->setEnableNumInfo(false);
206  if (count($this->getData()) == 0)
207  {
208  $this->setEnableDetailRow(false);
209  }
210  $this->setDataSection($this->getOverview());
211  }
212  }
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
setEnableDetailRow($a_enabledetailrow)
Set EnableDetailRow.
getCurrentDetailLevel()
Get Current Detail Level.
+ Here is the call graph for this function:

◆ getBlockType()

static ilPDNewsBlockGUI::getBlockType ( )
static

Get block type.

Returns
string Block type.

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

Referenced by saveSettings().

129  {
130  return self::$block_type;
131  }
+ Here is the caller graph for this function:

◆ getHTML()

ilPDNewsBlockGUI::getHTML ( )

Get bloch HTML code.

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

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

218  {
219  global $ilCtrl, $lng, $ilUser;
220 
221  // set footer info
222  $this->setFooterInfo($lng->txt("news_block_information"), true);
223 
224  $news_set = new ilSetting("news");
225  $enable_internal_rss = $news_set->get("enable_rss_for_internal");
226  $allow_shorter_periods = $news_set->get("allow_shorter_periods");
227  $allow_longer_periods = $news_set->get("allow_longer_periods");
228  $enable_private_feed = $news_set->get("enable_private_feed");
229 
230  // subscribe/unsibscribe link
231  include_once("./Services/News/classes/class.ilNewsSubscription.php");
232 
233  // show feed url
234  if ($enable_internal_rss)
235  {
236  $this->addBlockCommand(
237  $ilCtrl->getLinkTarget($this, "showFeedUrl"),
238  $lng->txt("news_get_feed_url"), "", ilUtil::getImagePath("rss.png"), true);
239  }
240 
241  if ($allow_shorter_periods || $allow_longer_periods || $enable_private_feed)
242  {
243  $this->addBlockCommand(
244  $ilCtrl->getLinkTarget($this, "editSettings"),
245  $lng->txt("settings"));
246  }
247 
248  $per = ilNewsItem::_lookupUserPDPeriod($ilUser->getId());
249 
250  if ($per > 0)
251  {
252  switch ($per)
253  {
254  case 2:
255  case 3:
256  case 5: $per_str = sprintf($lng->txt("news_period_x_days"), $per); break;
257  case 7: $per_str = $lng->txt("news_period_1_week"); break;
258  case 14: $per_str = sprintf($lng->txt("news_period_x_weeks"), 2); break;
259  case 30: $per_str = $lng->txt("news_period_1_month"); break;
260  case 60: $per_str = sprintf($lng->txt("news_period_x_months"), 2); break;
261  case 120: $per_str = sprintf($lng->txt("news_period_x_months"), 4); break;
262  case 180: $per_str = sprintf($lng->txt("news_period_x_months"), 6); break;
263  case 366: $per_str = $lng->txt("news_period_1_year"); break;
264  }
265  if ($per_str != "")
266  {
267  $this->setTitle($this->getTitle().' <span style="font-weight:normal;">- '.$per_str."</span>");
268  }
269  }
270 
271  if ($this->getCurrentDetailLevel() == 0)
272  {
273  return "";
274  }
275 
276  $en = "";
277  if ($ilUser->getPref("il_feed_js") == "n")
278  {
279  $en = $this->getJSEnabler();
280  }
281 
282  return ilBlockGUI::getHTML().$en;
283  }
addBlockCommand($a_href, $a_text, $a_target="", $a_img="", $a_right_aligned=false, $a_checked=false)
Add Block Command.
ILIAS Setting Class.
setFooterInfo($a_footerinfo, $a_hide_and_icon=false)
Set Footer Info.
global $ilCtrl
Definition: ilias.php:18
setTitle($a_title)
Set Title.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
getHTML()
Handle config status.
global $ilUser
Definition: imgupload.php:15
global $lng
Definition: privfeed.php:40
getTitle()
Get Title.
_lookupUserPDPeriod($a_user_id)
getCurrentDetailLevel()
Get Current Detail Level.
+ Here is the call graph for this function:

◆ getNewsData()

ilPDNewsBlockGUI::getNewsData ( )

Get news for context.

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

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

Referenced by ilPDNewsBlockGUI().

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

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

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

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

◆ ilPDNewsBlockGUI()

ilPDNewsBlockGUI::ilPDNewsBlockGUI ( )

Constructor.

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

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

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  $this->setImage(ilUtil::getImagePath("icon_news_s.png"));
35 
36  $lng->loadLanguageModule("news");
37  include_once("./Services/News/classes/class.ilNewsItem.php");
38 
39  $this->setLimit(5);
40  $this->setAvailableDetailLevels(3);
41 
42  $this->dynamic = false;
43 
44  // store current access check results
45 // $this->acc_results = $ilAccess->getResults();
46 
47  // read access cache
48 // $this->acc_cache_hit = $ilAccess->readCache(
49 // ((int) $news_set->get("acc_cache_mins")) * 60);
50 
51  include_once("./Services/News/classes/class.ilNewsCache.php");
52  $this->acache = new ilNewsCache();
53  $cres = $this->acache->getEntry($ilUser->getId().":0");
54  $this->cache_hit = false;
55  if ($this->acache->getLastAccessStatus() == "hit")
56  {
57  self::$st_data = unserialize($cres);
58  $this->cache_hit = true;
59  }
60 
61  if ($this->getDynamic() && !$this->cache_hit)
62  {
63  $this->dynamic = true;
64  $data = array();
65  }
66  else if ($this->getCurrentDetailLevel() > 0)
67  {
68  // do not ask two times for the data (e.g. if user displays a
69  // single item on the personal desktop and the news block is
70  // displayed at the same time)
71  if (empty(self::$st_data))
72  {
73  self::$st_data = $this->getNewsData();
74  $data = self::$st_data;
75  }
76  else
77  {
78  $data = self::$st_data;
79  }
80  }
81  else
82  {
83  $data = array();
84  }
85 
86  $this->setTitle($lng->txt("news_internal_news"));
87  $this->setRowTemplate("tpl.block_row_news_for_context.html", "Services/News");
88 
89  $this->setData($data);
90 
91  $this->handleView();
92 
93  // reset access check results
94  $ilAccess->setResults($this->acc_results);
95 
96  $ilBench->stop("News", "ilPDNewsBlockGUI_Constructor");
97  }
ILIAS Setting Class.
handleView()
Handles show/hide notification view and removes notifications if hidden.
News cache.
global $ilCtrl
Definition: ilias.php:18
setImage($a_image)
Set Image.
setTitle($a_title)
Set Title.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
setData($a_data)
Set Data.
setAvailableDetailLevels($a_max, $a_min=0)
Set Available Detail Levels.
getNewsData()
Get news for context.
setLimit($a_limit)
Set Limit.
global $ilUser
Definition: imgupload.php:15
global $lng
Definition: privfeed.php:40
global $ilBench
Definition: ilias.php:18
setRowTemplate($a_rowtemplatename, $a_rowtemplatedir="")
Set Row Template Name.
getCurrentDetailLevel()
Get Current Detail Level.
+ Here is the call graph for this function:

◆ initPrivateSettingsForm()

ilPDNewsBlockGUI::initPrivateSettingsForm ( )
protected

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

References $ilCtrl, $ilUser, $lng, ilUtil\getImagePath(), ilUtil\getPasswordRequirementsInfo(), ilCheckboxInputGUI\setChecked(), and ilFormPropertyGUI\setRequired().

Referenced by changeFeedSettings(), and editSettings().

457  {
458  global $ilCtrl, $lng, $ilUser;
459 
460  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
461  $feed_form = new ilPropertyFormGUI();
462  $feed_form->setFormAction($ilCtrl->getFormaction($this));
463  $feed_form->setTitle($lng->txt("priv_feed_settings"));
464  $feed_form->setTitleIcon(ilUtil::getImagePath("privrss.png"));
465 
466  $feed_form->setTableWidth("100%");
467 
468  $enable_private_feed = new ilCheckboxInputGUI($lng->txt("news_enable_private_feed"), "enable_private_feed");
469  $enable_private_feed->setChecked($ilUser->_getFeedPass($ilUser->getId()));
470  $feed_form->addItem($enable_private_feed);
471 
472  $passwd = new ilPasswordInputGUI($lng->txt("password"), "desired_password");
473  $passwd->setRequired(true);
474  $passwd->setInfo(ilUtil::getPasswordRequirementsInfo());
475  $enable_private_feed->addSubItem($passwd);
476 
477  $feed_form->addCommandButton("changeFeedSettings", $lng->txt("save"));
478  $feed_form->addCommandButton("cancelSettings", $lng->txt("cancel"));
479 
480  return $feed_form;
481  }
This class represents a property form user interface.
This class represents a checkbox property in a property form.
static getPasswordRequirementsInfo()
infotext for ilPasswordInputGUI setInfo()
global $ilCtrl
Definition: ilias.php:18
setChecked($a_checked)
Set Checked.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
This class represents a password property in a property form.
global $ilUser
Definition: imgupload.php:15
global $lng
Definition: privfeed.php:40
setRequired($a_required)
Set Required.
+ 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.

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

139  {
140  return false;
141  }

◆ saveSettings()

ilPDNewsBlockGUI::saveSettings ( )

Save settings.

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

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

497  {
498  global $ilCtrl, $ilUser;
499 
500  $news_set = new ilSetting("news");
501  $enable_internal_rss = $news_set->get("enable_rss_for_internal");
502 
503  ilBlockSetting::_write($this->getBlockType(), "news_pd_period",
504  $_POST["news_pd_period"],
505  $ilUser->getId(), $this->block_id);
506 
507  include_once("./Services/News/classes/class.ilNewsCache.php");
508  $cache = new ilNewsCache();
509  $cache->deleteEntry($ilUser->getId().":0");
510 
511  $ilCtrl->returnToParent($this);
512  }
ILIAS Setting Class.
$_POST['username']
Definition: cron.php:12
static _write($a_type, $a_setting, $a_value, $a_user=0, $a_block_id=0)
Write setting to database.
News cache.
global $ilCtrl
Definition: ilias.php:18
global $ilUser
Definition: imgupload.php:15
static getBlockType()
Get block type.
+ Here is the call graph for this function:

◆ showFeedUrl()

ilPDNewsBlockGUI::showFeedUrl ( )

Show feed URL.

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

References $_SESSION, $ilCtrl, $ilSetting, $ilUser, $lng, $tpl, and ilUtil\getImagePath().

290  {
291  global $lng, $ilCtrl, $ilUser, $ilSetting;
292 
293  $news_set = new ilSetting("news");
294 
295 
296  include_once("./Services/News/classes/class.ilNewsItem.php");
297 
298  if ($news_set->get("enable_private_feed"))
299  {
300  $tpl = new ilTemplate("tpl.show_priv_feed_url.html", true, true, "Services/News");
301 
302  // $tpl->setVariable("IMG_PRIV_RSS", ilUtil::getImagePath("privrss.png"));
303  $tpl->setVariable("TXT_PRIV_TITLE", $lng->txt("news_get_priv_feed_title"));
304 
305  // #14365
306  if($ilUser->_getFeedPass($_SESSION["AccountId"]))
307  {
308  $tpl->setVariable("TXT_PRIV_INFO", $lng->txt("news_get_priv_feed_info"));
309  $tpl->setVariable("TXT_PRIV_FEED_URL", $lng->txt("news_feed_url"));
310  $tpl->setVariable("VAL_PRIV_FEED_URL",
311  str_replace("://", "://" . $ilUser->getLogin() . ":-password-@", ILIAS_HTTP_PATH)."/privfeed.php?client_id=".rawurlencode(CLIENT_ID)."&user_id=".$ilUser->getId().
312  "&hash=".ilObjUser::_lookupFeedHash($ilUser->getId(), true));
313  $tpl->setVariable("VAL_PRIV_FEED_URL_TXT",
314  str_replace("://", "://" . $ilUser->getLogin() . ":-password-@", ILIAS_HTTP_PATH)."/privfeed.php?client_id=".rawurlencode(CLIENT_ID)."&<br />user_id=".$ilUser->getId().
315  "&hash=".ilObjUser::_lookupFeedHash($ilUser->getId(), true));
316  }
317  else
318  {
319  $tpl->setVariable("TXT_PRIV_INFO", $lng->txt("news_inactive_private_feed_info"));
320  $tpl->setVariable("EDIT_SETTINGS_URL", $ilCtrl->getLinkTarget($this, "editSettings"));
321  $tpl->setVariable("EDIT_SETTINGS_TXT", $lng->txt("news_edit_news_settings"));
322  }
323  }
324  else
325  {
326  $tpl = new ilTemplate("tpl.show_feed_url.html", true, true, "Services/News");
327  }
328  $tpl->setVariable("TXT_TITLE", $lng->txt("news_get_feed_title"));
329  $tpl->setVariable("TXT_INFO", $lng->txt("news_get_feed_info"));
330  $tpl->setVariable("TXT_FEED_URL", $lng->txt("news_feed_url"));
331  $tpl->setVariable("VAL_FEED_URL",
332  ILIAS_HTTP_PATH."/feed.php?client_id=".rawurlencode(CLIENT_ID)."&user_id=".$ilUser->getId().
333  "&hash=".ilObjUser::_lookupFeedHash($ilUser->getId(), true));
334  $tpl->setVariable("VAL_FEED_URL_TXT",
335  ILIAS_HTTP_PATH."/feed.php?client_id=".rawurlencode(CLIENT_ID)."&<br />user_id=".$ilUser->getId().
336  "&hash=".ilObjUser::_lookupFeedHash($ilUser->getId(), true));
337 
338  include_once("./Services/PersonalDesktop/classes/class.ilPDContentBlockGUI.php");
339  $content_block = new ilPDContentBlockGUI();
340  $content_block->setContent($tpl->get());
341  $content_block->setTitle($lng->txt("news_internal_news"));
342  $content_block->setImage(ilUtil::getImagePath("icon_news.png"));
343  $content_block->addHeaderCommand($ilCtrl->getParentReturn($this),
344  $lng->txt("selected_items_back"));
345 
346  return $content_block->getHTML();
347  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
ILIAS Setting Class.
global $ilCtrl
Definition: ilias.php:18
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
special template class to simplify handling of ITX/PEAR
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
global $ilUser
Definition: imgupload.php:15
global $ilSetting
Definition: privfeed.php:40
global $lng
Definition: privfeed.php:40
BlockGUI class for (centered) Content on Personal Desktop.
+ Here is the call graph for this function:

◆ showNews()

ilPDNewsBlockGUI::showNews ( )

show news

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

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

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.

◆ $st_data

ilPDNewsBlockGUI::$st_data
static

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


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