ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
ilPDExternalFeedBlockGUI Class Reference

BlockGUI class for external feed block on the personal desktop. More...

+ Inheritance diagram for ilPDExternalFeedBlockGUI:
+ Collaboration diagram for ilPDExternalFeedBlockGUI:

Public Member Functions

 __construct ()
 Constructor. More...
 
 getBlockType ()
 
 setBlock ($a_block)
 Do most of the initialisation. More...
 
 executeCommand ()
 execute command More...
 
 fillDataSection ()
 Fill data section. More...
 
 getHTML ()
 Get block HTML code. More...
 
 getDynamic ()
 
 getDynamicReload ()
 
 getJSEnabler ()
 
 disableJS ()
 
 enableJS ()
 
 fillRow ($item)
 Fill feed item row. More...
 
 getOverview ()
 Get overview. More...
 
 showFeedItem ()
 Show Feed Item. More...
 
 create ()
 Create Form for Block. More...
 
 initFormFeedBlock ($a_mode)
 FORM FeedBlock: Init form. More...
 
 prepareSaveFeedBlock (&$a_feed_block)
 FORM FeedBlock: Prepare Saving of FeedBlock. More...
 
 confirmDeleteFeedBlock ()
 Confirmation of feed block deletion. More...
 
 exitDeleteFeedBlock ()
 Cancel deletion of feed block. More...
 
 deleteFeedBlock ()
 Delete feed block. More...
 

Static Public Member Functions

static getScreenMode ()
 Get Screen Mode for current command. More...
 

Data Fields

const FORM_EDIT = 0
 
const FORM_CREATE = 1
 
const FORM_RE_EDIT = 2
 
const FORM_RE_CREATE = 2
 

Static Public Attributes

static $block_type = "pdfeed"
 

Protected Member Functions

 isRepositoryObject ()
 

Protected Attributes

 $settings
 

Detailed Description

BlockGUI class for external feed block on the personal desktop.

Within the repository ilExternalFeedBlockGUI is used. is used.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

ilPDExternalFeedBlockGUI: ilColumnGUI

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

Constructor & Destructor Documentation

◆ __construct()

ilPDExternalFeedBlockGUI::__construct ( )

Constructor.

Definition at line 56 of file class.ilPDExternalFeedBlockGUI.php.

References $DIC, $lng, ILIAS\GlobalScreen\Provider\__construct(), settings(), and user().

57  {
58  global $DIC;
59 
60  $this->ctrl = $DIC->ctrl();
61  $this->lng = $DIC->language();
62  $this->user = $DIC->user();
63  $this->access = $DIC->access();
64  $this->settings = $DIC->settings();
65  $lng = $DIC->language();
66 
68 
69  $lng->loadLanguageModule("feed");
70 
71  $this->setLimit(5);
72  $this->setRowTemplate("tpl.block_external_feed_row.html", "Services/Feeds");
73  }
settings()
Definition: settings.php:2
user()
Definition: user.php:4
$lng
__construct(Container $dic, ilPlugin $plugin)
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:

Member Function Documentation

◆ confirmDeleteFeedBlock()

ilPDExternalFeedBlockGUI::confirmDeleteFeedBlock ( )

Confirmation of feed block deletion.

Definition at line 463 of file class.ilPDExternalFeedBlockGUI.php.

References $ilCtrl, $lng, and ilUtil\getImagePath().

464  {
465  $ilCtrl = $this->ctrl;
466  $lng = $this->lng;
467 
468  include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
469  $c_gui = new ilConfirmationGUI();
470 
471  // set confirm/cancel commands
472  $c_gui->setFormAction($ilCtrl->getFormAction($this, "deleteFeedBlock"));
473  $c_gui->setHeaderText($lng->txt("info_delete_sure"));
474  $c_gui->setCancel($lng->txt("cancel"), "exitDeleteFeedBlock");
475  $c_gui->setConfirm($lng->txt("confirm"), "deleteFeedBlock");
476 
477  // add items to delete
478  $c_gui->addItem(
479  "external_feed_block_id",
480  $this->feed_block->getId(),
481  $this->feed_block->getTitle(),
482  ilUtil::getImagePath("icon_feed.svg")
483  );
484 
485  return $c_gui->getHTML();
486  }
global $ilCtrl
Definition: ilias.php:18
$lng
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
Confirmation screen class.
+ Here is the call graph for this function:

◆ create()

ilPDExternalFeedBlockGUI::create ( )

Create Form for Block.

Definition at line 395 of file class.ilPDExternalFeedBlockGUI.php.

396  {
397  return $this->createFeedBlock();
398  }

◆ deleteFeedBlock()

ilPDExternalFeedBlockGUI::deleteFeedBlock ( )

Delete feed block.

Definition at line 501 of file class.ilPDExternalFeedBlockGUI.php.

References $ilCtrl.

502  {
503  $ilCtrl = $this->ctrl;
504 
505  $this->feed_block->delete();
506  $ilCtrl->returnToParent($this);
507  }
global $ilCtrl
Definition: ilias.php:18

◆ disableJS()

ilPDExternalFeedBlockGUI::disableJS ( )

Definition at line 294 of file class.ilPDExternalFeedBlockGUI.php.

References $_SESSION, $ilCtrl, and $ilUser.

295  {
296  $ilCtrl = $this->ctrl;
297  $ilUser = $this->user;
298 
299  $_SESSION["il_feed_js"] = "n";
300  $ilUser->writePref("il_feed_js", "n");
301  $ilCtrl->redirectByClass("ildashboardgui", "show");
302  }
$_SESSION["AccountId"]
global $ilCtrl
Definition: ilias.php:18
$ilUser
Definition: imgupload.php:18

◆ enableJS()

ilPDExternalFeedBlockGUI::enableJS ( )

Definition at line 304 of file class.ilPDExternalFeedBlockGUI.php.

References $_SESSION, $ilUser, exit, and getHTML().

305  {
306  $ilUser = $this->user;
307 
308  $_SESSION["il_feed_js"] = "y";
309  $ilUser->writePref("il_feed_js", "y");
310  echo $this->getHTML();
311  exit;
312  }
exit
Definition: login.php:29
$_SESSION["AccountId"]
$ilUser
Definition: imgupload.php:18
+ Here is the call graph for this function:

◆ executeCommand()

ilPDExternalFeedBlockGUI::executeCommand ( )

execute command

Definition at line 142 of file class.ilPDExternalFeedBlockGUI.php.

References $ilCtrl.

143  {
144  $ilCtrl = $this->ctrl;
145 
146  $next_class = $ilCtrl->getNextClass();
147  $cmd = $ilCtrl->getCmd("getHTML");
148 
149  switch ($next_class) {
150  default:
151  return $this->$cmd();
152  }
153  }
global $ilCtrl
Definition: ilias.php:18

◆ exitDeleteFeedBlock()

ilPDExternalFeedBlockGUI::exitDeleteFeedBlock ( )

Cancel deletion of feed block.

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

References $ilCtrl.

492  {
493  $ilCtrl = $this->ctrl;
494 
495  $ilCtrl->returnToParent($this);
496  }
global $ilCtrl
Definition: ilias.php:18

◆ fillDataSection()

ilPDExternalFeedBlockGUI::fillDataSection ( )

Fill data section.

Definition at line 158 of file class.ilPDExternalFeedBlockGUI.php.

References getDynamic(), getDynamicReload(), and getOverview().

159  {
160  if ($this->getDynamic()) {
161  $this->setDataSection($this->getDynamicReload());
162  } elseif (count($this->getData()) > 0) {
163  parent::fillDataSection();
164  } else {
165  $this->setDataSection($this->getOverview());
166  }
167  }
+ Here is the call graph for this function:

◆ fillRow()

ilPDExternalFeedBlockGUI::fillRow (   $item)

Fill feed item row.

Definition at line 317 of file class.ilPDExternalFeedBlockGUI.php.

References $ilCtrl.

318  {
319  $ilCtrl = $this->ctrl;
320 
321  $ilCtrl->setParameter($this, "feed_item_id", $item->getId());
322  $this->tpl->setVariable("VAL_TITLE", $item->getTitle());
323  $this->tpl->setVariable(
324  "HREF_SHOW",
325  $ilCtrl->getLinkTarget($this, "showFeedItem")
326  );
327  $ilCtrl->setParameter($this, "feed_item_id", "");
328  }
global $ilCtrl
Definition: ilias.php:18

◆ getBlockType()

ilPDExternalFeedBlockGUI::getBlockType ( )

Definition at line 78 of file class.ilPDExternalFeedBlockGUI.php.

78  : string
79  {
80  return self::$block_type;
81  }

◆ getDynamic()

ilPDExternalFeedBlockGUI::getDynamic ( )

Definition at line 222 of file class.ilPDExternalFeedBlockGUI.php.

References $_SESSION, $ilCtrl, and $ilUser.

Referenced by fillDataSection(), and getHTML().

223  {
224  $ilCtrl = $this->ctrl;
225  $ilUser = $this->user;
226 
227  if ($ilCtrl->getCmdClass() != "ilcolumngui" && $ilCtrl->getCmd() != "enableJS") {
228  $sess_feed_js = "";
229  if (isset($_SESSION["il_feed_js"])) {
230  $sess_feed_js = $_SESSION["il_feed_js"];
231  }
232  if ($sess_feed_js != "n" &&
233  ($ilUser->getPref("il_feed_js") != "n" || $sess_feed_js == "y")) {
234  // do not get feed dynamically, if cache hit is given.
235  if (!$this->feed->checkCacheHit()) {
236  return true;
237  }
238  }
239  }
240 
241  return false;
242  }
$_SESSION["AccountId"]
global $ilCtrl
Definition: ilias.php:18
$ilUser
Definition: imgupload.php:18
+ Here is the caller graph for this function:

◆ getDynamicReload()

ilPDExternalFeedBlockGUI::getDynamicReload ( )

Definition at line 244 of file class.ilPDExternalFeedBlockGUI.php.

References $ilCtrl, and $lng.

Referenced by fillDataSection().

245  {
246  $ilCtrl = $this->ctrl;
247  $lng = $this->lng;
248 
249  $ilCtrl->setParameterByClass(
250  "ilcolumngui",
251  "block_id",
252  "block_pdfeed_" . $this->getBlockId()
253  );
254 
255  $rel_tpl = new ilTemplate("tpl.dynamic_reload.html", true, true, "Services/Feeds");
256  $rel_tpl->setVariable("TXT_LOADING", $lng->txt("feed_loading_feed"));
257  $rel_tpl->setVariable("BLOCK_ID", "block_pdfeed_" . $this->getBlockId());
258  $rel_tpl->setVariable(
259  "TARGET",
260  $ilCtrl->getLinkTargetByClass("ilcolumngui", "updateBlock", "", true)
261  );
262 
263  // no JS
264  $rel_tpl->setVariable("TXT_FEED_CLICK_HERE", $lng->txt("feed_no_js_click_here"));
265  $rel_tpl->setVariable(
266  "TARGET_NO_JS",
267  $ilCtrl->getLinkTargetByClass("ilpdexternalfeedblockgui", "disableJS")
268  );
269 
270  return $rel_tpl->get();
271  }
global $ilCtrl
Definition: ilias.php:18
$lng
+ Here is the caller graph for this function:

◆ getHTML()

ilPDExternalFeedBlockGUI::getHTML ( )

Get block HTML code.

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

References $_SESSION, $ilCtrl, $ilSetting, $ilUser, $lng, $settings, getDynamic(), and getJSEnabler().

Referenced by enableJS().

173  {
174  $ilCtrl = $this->ctrl;
175  $lng = $this->lng;
176  $ilUser = $this->user;
178 
179 
180  if ($ilSetting->get("block_limit_pdfeed") == 0) {
181  return "";
182  }
183 
184 
185  // if no dynamic reload
186  if (!$this->getDynamic()) {
187  $this->feed->fetch();
188  $this->setData($this->feed->getItems());
189  }
190 
191  $ilCtrl->setParameter(
192  $this,
193  "external_feed_block_id",
194  $this->getBlockId()
195  );
196  $this->addBlockCommand(
197  $ilCtrl->getLinkTarget(
198  $this,
199  "editFeedBlock"
200  ),
201  $lng->txt("edit")
202  );
203  $this->addBlockCommand(
204  $ilCtrl->getLinkTarget(
205  $this,
206  "confirmDeleteFeedBlock"
207  ),
208  $lng->txt("delete")
209  );
210  $ilCtrl->setParameter($this, "external_feed_block_id", "");
211 
212  // JS enabler
213  $add = "";
214  if ($_SESSION["il_feed_js"] == "n" ||
215  ($ilUser->getPref("il_feed_js") == "n" && $_SESSION["il_feed_js"] != "y")) {
216  $add = $this->getJSEnabler();
217  }
218 
219  return parent::getHTML() . $add;
220  }
$_SESSION["AccountId"]
global $ilCtrl
Definition: ilias.php:18
$lng
$ilUser
Definition: imgupload.php:18
global $ilSetting
Definition: privfeed.php:17
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getJSEnabler()

ilPDExternalFeedBlockGUI::getJSEnabler ( )

Definition at line 273 of file class.ilPDExternalFeedBlockGUI.php.

References $ilCtrl.

Referenced by getHTML().

274  {
275  $ilCtrl = $this->ctrl;
276 
277  $ilCtrl->setParameterByClass(
278  "ilcolumngui",
279  "block_id",
280  "block_pdfeed_" . $this->getBlockId()
281  );
282 
283  $rel_tpl = new ilTemplate("tpl.js_enabler.html", true, true, "Services/Feeds");
284  $rel_tpl->setVariable("BLOCK_ID", "block_pdfeed_" . $this->getBlockId());
285  $rel_tpl->setVariable(
286  "TARGET",
287  $ilCtrl->getLinkTargetByClass("ilpdexternalfeedblockgui", "enableJS", true)
288  );
289 
290  return $rel_tpl->get();
291  }
global $ilCtrl
Definition: ilias.php:18
+ Here is the caller graph for this function:

◆ getOverview()

ilPDExternalFeedBlockGUI::getOverview ( )

Get overview.

Definition at line 333 of file class.ilPDExternalFeedBlockGUI.php.

References $lng.

Referenced by fillDataSection().

334  {
335  $lng = $this->lng;
336 
337  $this->setEnableNumInfo(false);
338  return '<div class="small">' . ((int) count($this->getData())) . " " . $lng->txt("feed_feed_items") . "</div>";
339  }
$lng
+ Here is the caller graph for this function:

◆ getScreenMode()

static ilPDExternalFeedBlockGUI::getScreenMode ( )
static

Get Screen Mode for current command.

Definition at line 94 of file class.ilPDExternalFeedBlockGUI.php.

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

95  {
96  global $DIC;
97 
98  $ilCtrl = $DIC->ctrl();
99 
100  switch ($ilCtrl->getCmd()) {
101  case "create":
102  case "edit":
103  case "saveFeedBlock":
104  case "updateFeedBlock":
105  case "editFeedBlock":
106  case "showFeedItem":
107  case "confirmDeleteFeedBlock":
108  return IL_SCREEN_CENTER;
109  break;
110 
111  default:
112  return IL_SCREEN_SIDE;
113  break;
114  }
115  }
global $ilCtrl
Definition: ilias.php:18
const IL_SCREEN_CENTER
$DIC
Definition: xapitoken.php:46
const IL_SCREEN_SIDE

◆ initFormFeedBlock()

ilPDExternalFeedBlockGUI::initFormFeedBlock (   $a_mode)

FORM FeedBlock: Init form.

(We need to overwrite, because Generator does not know FeedUrl Inputs yet.

Parameters
int$a_modeForm Edit Mode

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

References $lng, and ilFormPropertyGUI\setInfo().

407  {
408  $lng = $this->lng;
409 
410  $lng->loadLanguageModule("block");
411 
412  require_once("Services/Form/classes/class.ilPropertyFormGUI.php");
413 
414  $this->form_gui = new ilPropertyFormGUI();
415 
416  // Property Title
417  $text_input = new ilTextInputGUI($lng->txt("block_feed_block_title"), "block_title");
418  $text_input->setInfo("");
419  $text_input->setRequired(true);
420  $text_input->setMaxLength(200);
421  $this->form_gui->addItem($text_input);
422 
423  // Property FeedUrl
424  $text_input = new ilFeedUrlInputGUI($lng->txt("block_feed_block_feed_url"), "block_feed_url");
425  $text_input->setInfo($lng->txt("block_feed_block_feed_url_info"));
426  $text_input->setRequired(true);
427  $text_input->setMaxLength(250);
428  $this->form_gui->addItem($text_input);
429 
430 
431  // save and cancel commands
432  if (in_array($a_mode, array(self::FORM_CREATE, self::FORM_RE_CREATE))) {
433  $this->form_gui->addCommandButton("saveFeedBlock", $lng->txt("save"));
434  $this->form_gui->addCommandButton("cancelSaveFeedBlock", $lng->txt("cancel"));
435  } else {
436  $this->form_gui->addCommandButton("updateFeedBlock", $lng->txt("save"));
437  $this->form_gui->addCommandButton("cancelUpdateFeedBlock", $lng->txt("cancel"));
438  }
439 
440  $this->form_gui->setTitle($lng->txt("block_feed_block_head"));
441  $this->form_gui->setFormAction($this->ctrl->getFormAction($this));
442 
443  $this->prepareFormFeedBlock($this->form_gui);
444  }
This class represents a feed url property in a property form.
This class represents a property form user interface.
setInfo($a_info)
Set Information Text.
$lng
+ Here is the call graph for this function:

◆ isRepositoryObject()

ilPDExternalFeedBlockGUI::isRepositoryObject ( )
protected

Definition at line 86 of file class.ilPDExternalFeedBlockGUI.php.

86  : bool
87  {
88  return false;
89  }

◆ prepareSaveFeedBlock()

ilPDExternalFeedBlockGUI::prepareSaveFeedBlock ( $a_feed_block)

FORM FeedBlock: Prepare Saving of FeedBlock.

Parameters
object$a_feed_blockFeedBlock object.

Definition at line 451 of file class.ilPDExternalFeedBlockGUI.php.

References $ilCtrl.

452  {
453  $ilCtrl = $this->ctrl;
454 
455  $a_feed_block->setContextObjId($ilCtrl->getContextObjId());
456  $a_feed_block->setContextObjType($ilCtrl->getContextObjType());
457  $a_feed_block->setType("pdfeed");
458  }
global $ilCtrl
Definition: ilias.php:18

◆ setBlock()

ilPDExternalFeedBlockGUI::setBlock (   $a_block)

Do most of the initialisation.

Definition at line 120 of file class.ilPDExternalFeedBlockGUI.php.

References $ilCtrl.

121  {
122  $ilCtrl = $this->ctrl;
123 
124  // init block
125  $this->feed_block = $a_block;
126  $this->setTitle($this->feed_block->getTitle());
127  $this->setBlockId($this->feed_block->getId());
128 
129  // get feed object
130  include_once("./Services/Feeds/classes/class.ilExternalFeed.php");
131  $this->feed = new ilExternalFeed();
132  $this->feed->setUrl($this->feed_block->getFeedUrl());
133 
134  // init details
135 
136  $ilCtrl->setParameter($this, "block_id", $this->feed_block->getId());
137  }
Handles external Feeds via Magpie library.
global $ilCtrl
Definition: ilias.php:18

◆ showFeedItem()

ilPDExternalFeedBlockGUI::showFeedItem ( )

Show Feed Item.

Definition at line 344 of file class.ilPDExternalFeedBlockGUI.php.

References $_GET, $ilCtrl, $lng, and $tpl.

345  {
346  $lng = $this->lng;
347  $ilCtrl = $this->ctrl;
348 
349  include_once("./Services/News/classes/class.ilNewsItem.php");
350 
351  $this->feed->fetch();
352  foreach ($this->feed->getItems() as $item) {
353  if ($item->getId() == $_GET["feed_item_id"]) {
354  $c_item = $item;
355  break;
356  }
357  }
358 
359  $tpl = new ilTemplate("tpl.show_feed_item.html", true, true, "Services/Feeds");
360 
361  if (is_object($c_item)) {
362  if (trim($c_item->getSummary()) != "") { // summary
363  $tpl->setCurrentBlock("content");
364  $tpl->setVariable("VAL_CONTENT", $c_item->getSummary());
365  $tpl->parseCurrentBlock();
366  }
367  if (trim($c_item->getDate()) != "" || trim($c_item->getAuthor()) != "") { // date
368  $tpl->setCurrentBlock("date_author");
369  if (trim($c_item->getAuthor()) != "") {
370  $tpl->setVariable("VAL_AUTHOR", $c_item->getAuthor() . " - ");
371  }
372  $tpl->setVariable("VAL_DATE", $c_item->getDate());
373  $tpl->parseCurrentBlock();
374  }
375 
376  if (trim($c_item->getLink()) != "") { // link
377  $tpl->setCurrentBlock("plink");
378  $tpl->setVariable("HREF_LINK", $c_item->getLink());
379  $tpl->setVariable("TXT_LINK", $lng->txt("feed_open_source_page"));
380  $tpl->parseCurrentBlock();
381  }
382  $tpl->setVariable("VAL_TITLE", $c_item->getTitle()); // title
383  }
384 
385  $content_block = new ilDashboardContentBlockGUI();
386  $content_block->setContent($tpl->get());
387  $content_block->setTitle($this->getTitle());
388 
389  return $content_block->getHTML();
390  }
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
$_GET["client_id"]
global $ilCtrl
Definition: ilias.php:18
$lng
BlockGUI class for (centered) Content on Personal Desktop.

Field Documentation

◆ $block_type

ilPDExternalFeedBlockGUI::$block_type = "pdfeed"
static

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

◆ $settings

ilPDExternalFeedBlockGUI::$settings
protected

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

Referenced by getHTML().

◆ FORM_CREATE

const ilPDExternalFeedBlockGUI::FORM_CREATE = 1

Definition at line 42 of file class.ilPDExternalFeedBlockGUI.php.

◆ FORM_EDIT

const ilPDExternalFeedBlockGUI::FORM_EDIT = 0

Definition at line 41 of file class.ilPDExternalFeedBlockGUI.php.

◆ FORM_RE_CREATE

const ilPDExternalFeedBlockGUI::FORM_RE_CREATE = 2

Definition at line 44 of file class.ilPDExternalFeedBlockGUI.php.

◆ FORM_RE_EDIT

const ilPDExternalFeedBlockGUI::FORM_RE_EDIT = 2

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


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