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

BlockGUI class for external feed block. More...

+ Inheritance diagram for ilExternalFeedBlockGUI:
+ Collaboration diagram for ilExternalFeedBlockGUI:

Public Member Functions

 __construct ()
 Constructor. More...
 
 getBlockType ()
 
 setBlock ($a_block)
 Do most of the initialisation. More...
 
 setGuiObject (&$a_gui_object)
 Set GuiObject. More...
 
 getGuiObject ()
 Get GuiObject. More...
 
 setFormEditMode ($a_form_edit_mode)
 Set FormEditMode. More...
 
 getFormEditMode ()
 Get FormEditMode. More...
 
 createFeedBlock ()
 FORM FeedBlock: Create ExternalFeedBlock. More...
 
 editFeedBlock ()
 FORM FeedBlock: Edit form. More...
 
 saveFeedBlock ()
 FORM FeedBlock: Save ExternalFeedBlock. More...
 
 updateFeedBlock ()
 FORM FeedBlock: Update ExternalFeedBlock. More...
 
 getValuesFeedBlock ()
 FORM FeedBlock: Get current values for ExternalFeedBlock form. More...
 
 cancelSaveFeedBlock ()
 FORM FeedBlock: Cancel save. 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...
 
 initImportForm ($a_new_type="")
 Init object import form. More...
 
 importFile ()
 Import. More...
 
 initFormFeedBlock ($a_mode)
 FORM FeedBlock: Init form. More...
 
 prepareSaveFeedBlock (&$a_feed_block)
 FORM FeedBlock: Prepare Saving of FeedBlock. More...
 
 exitSaveFeedBlock ()
 FORM FeedBlock: Exit save. More...
 
 cancelUpdateFeedBlock ()
 FORM FeedBlock: Exit save. More...
 
 exitUpdateFeedBlock ()
 FORM FeedBlock: Exit save. More...
 
- Public Member Functions inherited from ilBlockGUI
 getBlockType ()
 
 __construct ()
 Constructor. More...
 
 setData ($a_data)
 Set Data. More...
 
 getData ()
 Get Data. More...
 
 setPresentation (int $type)
 Set presentation. More...
 
 getPresentation ()
 Get presentation type. More...
 
 setBlockId ($a_block_id=0)
 Set Block Id. More...
 
 getBlockId ()
 Get Block Id. More...
 
 setGuiObject (&$a_gui_object)
 Set GuiObject. More...
 
 getGuiObject ()
 Get GuiObject. More...
 
 setTitle ($a_title)
 Set Title. More...
 
 getTitle ()
 Get Title. More...
 
 setOffset ($a_offset)
 Set Offset. More...
 
 getOffset ()
 Get Offset. More...
 
 correctOffset ()
 
 setLimit ($a_limit)
 Set Limit. More...
 
 getLimit ()
 Get Limit. More...
 
 setEnableEdit ($a_enableedit)
 Set EnableEdit. More...
 
 getEnableEdit ()
 Get EnableEdit. More...
 
 setRepositoryMode ($a_repositorymode)
 Set RepositoryMode. More...
 
 getRepositoryMode ()
 Get RepositoryMode. More...
 
 setSubtitle ($a_subtitle)
 Set Subtitle. More...
 
 getSubtitle ()
 Get Subtitle. More...
 
 setRefId ($a_refid)
 Set Ref Id (only used if isRepositoryObject() is true). More...
 
 getRefId ()
 Get Ref Id (only used if isRepositoryObject() is true). More...
 
 setAdminCommands (bool $a_admincommands)
 Set Administration Commmands. More...
 
 getAdminCommands ()
 Get Administration Commmands. More...
 
 setEnableNumInfo ($a_enablenuminfo)
 Set Enable Item Number Info. More...
 
 getEnableNumInfo ()
 Get Enable Item Number Info. More...
 
 setProperties ($a_properties)
 This function is supposed to be used for block type specific properties, that should be inherited through ilColumnGUI->setBlockProperties. More...
 
 getProperty ($a_property)
 
 setProperty ($a_property, $a_value)
 
 setRowTemplate ($a_rowtemplatename, $a_rowtemplatedir="")
 Set Row Template Name. More...
 
 getNavParameter ()
 
 getConfigParameter ()
 
 getMoveParameter ()
 
 getRowTemplateName ()
 Get Row Template Name. More...
 
 getRowTemplateDir ()
 Get Row Template Directory. More...
 
 addBlockCommand (string $a_href, string $a_text, string $a_onclick="")
 Add Block Command. More...
 
 getBlockCommands ()
 Get Block commands. More...
 
 getHTML ()
 Get HTML. More...
 
 fillHeaderCommands ()
 Fill header commands block. More...
 
 fillHeaderTitleBlock ()
 Fill header title block (title and. More...
 
 setDataSection ($a_content)
 Call this from overwritten fillDataSection(), if standard row based data is not used. More...
 
 fillDataSection ()
 Standard implementation for row based data. More...
 
 fillRow ($a_set)
 
 fillFooter ()
 
 fillPreviousNext ()
 Fill previous/next row. More...
 
 setPreviousNextLinks ()
 Get previous/next linkbar. More...
 
 getAsynch ()
 Use this for final get before sending asynchronous output (ajax) per echo to output. More...
 
 getPaginationViewControl ()
 Fill previous/next row. More...
 
 getHTMLNew ()
 Get HTML. More...
 

Static Public Member Functions

static getScreenMode ()
 Get Screen Mode for current command. More...
 
- Static Public Member Functions inherited from ilBlockGUI
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
 
- Data Fields inherited from ilBlockGUI
const PRES_MAIN_LEG = 0
 
const PRES_SEC_LEG = 1
 
const PRES_SEC_LIST = 2
 
const PRES_MAIN_LIST = 3
 

Static Public Attributes

static $block_type = "feed"
 

Protected Member Functions

 isRepositoryObject ()
 
 getListItemForData (array $data)
 
- Protected Member Functions inherited from ilBlockGUI
 isRepositoryObject ()
 Returns whether block has a corresponding repository object. More...
 
 initCommands ()
 Init commands. More...
 
 fillRowColor ($a_placeholder="CSS_ROW")
 
 preloadData (array $data)
 Can be overwritten in subclasses. More...
 
 getLegacyContent ()
 Get legacy content. More...
 
 getViewControls ()
 Get view controls. More...
 
 getListItemForData (array $data)
 Get list item for data array. More...
 
 handleNavigation ()
 Handle navigation. More...
 
 loadData ()
 Load data for current page. More...
 
 getListItemGroups ()
 Get items. More...
 
 addRepoCommands ()
 Add repo commands. More...
 
 getNoItemFoundContent ()
 No item entry. More...
 

Protected Attributes

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

Detailed Description

BlockGUI class for external feed block.

This is the one that is used within the repository. On the personal desktop ilPDExternalFeedBlockGUI is used.

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

ilExternalFeedBlockGUI: ilColumnGUI

Definition at line 17 of file class.ilExternalFeedBlockGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilExternalFeedBlockGUI::__construct ( )

Constructor.

Definition at line 47 of file class.ilExternalFeedBlockGUI.php.

References $_GET, $DIC, ilBlockGUI\$lng, ILIAS\GlobalScreen\Provider\__construct(), ilBlockGUI\setLimit(), ilBlockGUI\setPresentation(), ilBlockGUI\setRowTemplate(), settings(), and user().

48  {
49  global $DIC;
50 
51  $this->ctrl = $DIC->ctrl();
52  $this->lng = $DIC->language();
53  $this->user = $DIC->user();
54  $this->access = $DIC->access();
55  $this->settings = $DIC->settings();
56  $this->rbacsystem = $DIC->rbac()->system();
57  $this->obj_definition = $DIC["objDefinition"];
58  $lng = $DIC->language();
59 
61 
62  $lng->loadLanguageModule("feed");
63  $this->setLimit(5);
64  $this->setRowTemplate("tpl.block_external_feed_row.html", "Services/Feeds");
65 
66  if (isset($_GET["external_feed_block_id"]) && $_GET["external_feed_block_id"] > 0) {
67  $this->external_feed_block = new ilExternalFeedBlock($_GET["external_feed_block_id"]);
68  }
69 
70  $this->ctrl->saveParameter($this, array("external_feed_block_id"));
71 
72  $this->setPresentation(self::PRES_SEC_LIST);
73  }
settings()
Definition: settings.php:2
$_GET["client_id"]
Custom block for external feeds.
user()
Definition: user.php:4
setLimit($a_limit)
Set Limit.
__construct(Container $dic, ilPlugin $plugin)
$DIC
Definition: xapitoken.php:46
setRowTemplate($a_rowtemplatename, $a_rowtemplatedir="")
Set Row Template Name.
setPresentation(int $type)
Set presentation.
+ Here is the call graph for this function:

Member Function Documentation

◆ cancelSaveFeedBlock()

ilExternalFeedBlockGUI::cancelSaveFeedBlock ( )

FORM FeedBlock: Cancel save.

(Can be overwritten in derived classes)

Definition at line 269 of file class.ilExternalFeedBlockGUI.php.

References ilBlockGUI\$ctrl, and $ilCtrl.

270  {
272 
273  $ilCtrl->returnToParent($this);
274  }
global $ilCtrl
Definition: ilias.php:18

◆ cancelUpdateFeedBlock()

ilExternalFeedBlockGUI::cancelUpdateFeedBlock ( )

FORM FeedBlock: Exit save.

(Can be overwritten in derived classes)

Definition at line 703 of file class.ilExternalFeedBlockGUI.php.

References getGuiObject().

704  {
705  $this->getGuiObject()->cancelUpdate();
706  }
+ Here is the call graph for this function:

◆ create()

ilExternalFeedBlockGUI::create ( )

Create Form for Block.

Definition at line 544 of file class.ilExternalFeedBlockGUI.php.

References createFeedBlock(), and initImportForm().

545  {
546  $html1 = $this->createFeedBlock();
547 
548  $html2 = "";
549  if (DEVMODE == 1) {
550  $this->initImportForm("feed");
551  $html2 = "<br/>" . $this->form->getHTML();
552  }
553 
554  return $html1 . $html2;
555  }
createFeedBlock()
FORM FeedBlock: Create ExternalFeedBlock.
initImportForm($a_new_type="")
Init object import form.
+ Here is the call graph for this function:

◆ createFeedBlock()

ilExternalFeedBlockGUI::createFeedBlock ( )

FORM FeedBlock: Create ExternalFeedBlock.

Definition at line 185 of file class.ilExternalFeedBlockGUI.php.

References initFormFeedBlock().

Referenced by create().

186  {
187  $this->initFormFeedBlock(self::FORM_CREATE);
188  return $this->form_gui->getHtml();
189  }
initFormFeedBlock($a_mode)
FORM FeedBlock: Init form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ disableJS()

ilExternalFeedBlockGUI::disableJS ( )

Definition at line 434 of file class.ilExternalFeedBlockGUI.php.

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

435  {
438 
439  $_SESSION["il_feed_js"] = "n";
440  $ilUser->writePref("il_feed_js", "n");
441  $ilCtrl->returnToParent($this);
442  }
$_SESSION["AccountId"]
global $ilCtrl
Definition: ilias.php:18
$ilUser
Definition: imgupload.php:18

◆ editFeedBlock()

ilExternalFeedBlockGUI::editFeedBlock ( )

FORM FeedBlock: Edit form.

Definition at line 195 of file class.ilExternalFeedBlockGUI.php.

References getValuesFeedBlock(), and initFormFeedBlock().

196  {
197  $this->initFormFeedBlock(self::FORM_EDIT);
198  $this->getValuesFeedBlock();
199  return $this->form_gui->getHtml();
200  }
getValuesFeedBlock()
FORM FeedBlock: Get current values for ExternalFeedBlock form.
initFormFeedBlock($a_mode)
FORM FeedBlock: Init form.
+ Here is the call graph for this function:

◆ enableJS()

ilExternalFeedBlockGUI::enableJS ( )

Definition at line 444 of file class.ilExternalFeedBlockGUI.php.

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

445  {
447 
448  $_SESSION["il_feed_js"] = "y";
449  $ilUser->writePref("il_feed_js", "y");
450  echo $this->getHTML();
451  exit;
452  }
exit
Definition: login.php:29
$_SESSION["AccountId"]
$ilUser
Definition: imgupload.php:18
+ Here is the call graph for this function:

◆ executeCommand()

ilExternalFeedBlockGUI::executeCommand ( )

execute command

Definition at line 280 of file class.ilExternalFeedBlockGUI.php.

References ilBlockGUI\$ctrl, and $ilCtrl.

281  {
283 
284  $next_class = $ilCtrl->getNextClass();
285  $cmd = $ilCtrl->getCmd("getHTML");
286  switch ($next_class) {
287  default:
288  return $this->$cmd();
289  }
290  }
global $ilCtrl
Definition: ilias.php:18

◆ exitSaveFeedBlock()

ilExternalFeedBlockGUI::exitSaveFeedBlock ( )

FORM FeedBlock: Exit save.

(Can be overwritten in derived classes)

Definition at line 694 of file class.ilExternalFeedBlockGUI.php.

References getGuiObject().

Referenced by importFile(), and saveFeedBlock().

695  {
696  $this->getGuiObject()->exitSave();
697  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ exitUpdateFeedBlock()

ilExternalFeedBlockGUI::exitUpdateFeedBlock ( )

FORM FeedBlock: Exit save.

(Can be overwritten in derived classes)

Definition at line 712 of file class.ilExternalFeedBlockGUI.php.

References getGuiObject().

Referenced by updateFeedBlock().

713  {
714  $this->getGuiObject()->update($this->external_feed_block);
715  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fillDataSection()

ilExternalFeedBlockGUI::fillDataSection ( )

Fill data section.

Definition at line 295 of file class.ilExternalFeedBlockGUI.php.

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

296  {
297  if ($this->getDynamic()) {
298  $this->setDataSection($this->getDynamicReload());
299  } elseif (count($this->getData()) > 0) {
300  parent::fillDataSection();
301  } else {
302  $this->setDataSection($this->getOverview());
303  }
304  }
setDataSection($a_content)
Call this from overwritten fillDataSection(), if standard row based data is not used.
getData()
Get Data.
+ Here is the call graph for this function:

◆ fillRow()

ilExternalFeedBlockGUI::fillRow (   $item)

Fill feed item row.

Definition at line 457 of file class.ilExternalFeedBlockGUI.php.

References ilBlockGUI\$access, ilBlockGUI\$ctrl, $ilCtrl, and isRepositoryObject().

458  {
460  $ilAccess = $this->access;
461 
462  if ($this->isRepositoryObject() && !$ilAccess->checkAccess("read", "", $this->getRefId())) {
463  $this->tpl->setVariable("TXT_TITLE", $item->getTitle());
464  } else {
465  $ilCtrl->setParameter($this, "feed_item_id", $item->getId());
466  $this->tpl->setCurrentBlock("feed_link");
467  $this->tpl->setVariable("VAL_TITLE", $item->getTitle());
468  $this->tpl->setVariable(
469  "HREF_SHOW",
470  $ilCtrl->getLinkTarget($this, "showFeedItem")
471  );
472  $ilCtrl->setParameter($this, "feed_item_id", "");
473  $this->tpl->parseCurrentBlock();
474  }
475  }
global $ilCtrl
Definition: ilias.php:18
+ Here is the call graph for this function:

◆ getBlockType()

ilExternalFeedBlockGUI::getBlockType ( )

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

Referenced by prepareSaveFeedBlock().

78  : string
79  {
80  return self::$block_type;
81  }
+ Here is the caller graph for this function:

◆ getDynamic()

ilExternalFeedBlockGUI::getDynamic ( )

Definition at line 362 of file class.ilExternalFeedBlockGUI.php.

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

Referenced by fillDataSection(), and getHTML().

363  {
366 
367  // @todo
368  return false;
369 
370  if ($ilCtrl->getCmdClass() != "ilcolumngui" && $ilCtrl->getCmd() != "enableJS") {
371  if ($_SESSION["il_feed_js"] != "n" &&
372  ($ilUser->getPref("il_feed_js") != "n" || $_SESSION["il_feed_js"] == "y")) {
373  // do not get feed dynamically, if cache hit is given.
374  if (!$this->feed->checkCacheHit()) {
375  return true;
376  }
377  }
378  }
379 
380  return false;
381  }
$_SESSION["AccountId"]
global $ilCtrl
Definition: ilias.php:18
$ilUser
Definition: imgupload.php:18
+ Here is the caller graph for this function:

◆ getDynamicReload()

ilExternalFeedBlockGUI::getDynamicReload ( )

Definition at line 383 of file class.ilExternalFeedBlockGUI.php.

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

Referenced by fillDataSection().

384  {
386  $lng = $this->lng;
387 
388  $ilCtrl->setParameterByClass(
389  "ilcolumngui",
390  "block_id",
391  "block_feed_" . $this->getBlockId()
392  );
393 
394  $rel_tpl = new ilTemplate("tpl.dynamic_reload.html", true, true, "Services/Feeds");
395  $rel_tpl->setVariable("TXT_LOADING", $lng->txt("feed_loading_feed"));
396  $rel_tpl->setVariable("BLOCK_ID", "block_feed_" . $this->getBlockId());
397  $rel_tpl->setVariable(
398  "TARGET",
399  $ilCtrl->getLinkTargetByClass("ilcolumngui", "updateBlock", "", true)
400  );
401 
402  // no JS
403  $rel_tpl->setVariable("TXT_FEED_CLICK_HERE", $lng->txt("feed_no_js_click_here"));
404  $rel_tpl->setVariable(
405  "TARGET_NO_JS",
406  $ilCtrl->getLinkTargetByClass("ilexternalfeedblockgui", "disableJS")
407  );
408 
409  return $rel_tpl->get();
410  }
global $ilCtrl
Definition: ilias.php:18
getBlockId()
Get Block Id.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getFormEditMode()

ilExternalFeedBlockGUI::getFormEditMode ( )

Get FormEditMode.

Returns
int Form Edit Mode

Definition at line 176 of file class.ilExternalFeedBlockGUI.php.

References $form_edit_mode.

◆ getGuiObject()

ilExternalFeedBlockGUI::getGuiObject ( )

Get GuiObject.

Returns
object GUI object

Definition at line 156 of file class.ilExternalFeedBlockGUI.php.

References $gui_object.

Referenced by cancelUpdateFeedBlock(), exitSaveFeedBlock(), exitUpdateFeedBlock(), and prepareSaveFeedBlock().

+ Here is the caller graph for this function:

◆ getHTML()

ilExternalFeedBlockGUI::getHTML ( )

Get block HTML code.

Definition at line 309 of file class.ilExternalFeedBlockGUI.php.

References $_SESSION, ilBlockGUI\$access, ilBlockGUI\$ctrl, $feed_set, $i, $ilCtrl, $ilUser, ilBlockGUI\$lng, ilBlockGUI\$user, ilBlockGUI\addBlockCommand(), ilBlockGUI\getBlockId(), getDynamic(), getJSEnabler(), ilBlockGUI\getRefId(), and ilBlockGUI\setData().

Referenced by enableJS().

310  {
312  $lng = $this->lng;
314  $ilAccess = $this->access;
315 
316 
317  $feed_set = new ilSetting("feed");
318 
319  if ($feed_set->get("disable_rep_feeds")) {
320  return "";
321  }
322 
323  // if no dynamic reload
324  if (!$this->getDynamic()) {
325  $this->feed->fetch();
326  $this->setData(array_map(function ($i) {
327  return ["item" => $i];
328  }, $this->feed->getItems()));
329  }
330 
331  //$this->setTitle($this->feed->getChannelTitle());
332  //$this->setData($this->feed->getItems());
333 
334  if ($ilAccess->checkAccess("write", "", $this->getRefId())) {
335  $ilCtrl->setParameterByClass(
336  "ilobjexternalfeedgui",
337  "ref_id",
338  $this->getRefId()
339  );
340  $ilCtrl->setParameter($this, "external_feed_block_id", $this->getBlockId());
341  $this->addBlockCommand(
342  $ilCtrl->getLinkTargetByClass(
343  array("ilrepositorygui", "ilobjexternalfeedgui",
344  "ilexternalfeedblockgui"),
345  "editFeedBlock"
346  ),
347  $lng->txt("settings")
348  );
349  $ilCtrl->clearParametersByClass("ilobjexternalfeedgui");
350  }
351 
352  // JS enabler
353  $add = "";
354  if ($_SESSION["il_feed_js"] == "n" ||
355  ($ilUser->getPref("il_feed_js") == "n" && $_SESSION["il_feed_js"] != "y")) {
356  $add = $this->getJSEnabler();
357  }
358 
359  return parent::getHTML() . $add;
360  }
$_SESSION["AccountId"]
global $ilCtrl
Definition: ilias.php:18
setData($a_data)
Set Data.
$ilUser
Definition: imgupload.php:18
$feed_set
Definition: privfeed.php:19
getBlockId()
Get Block Id.
getRefId()
Get Ref Id (only used if isRepositoryObject() is true).
addBlockCommand(string $a_href, string $a_text, string $a_onclick="")
Add Block Command.
$i
Definition: metadata.php:24
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getJSEnabler()

ilExternalFeedBlockGUI::getJSEnabler ( )

Definition at line 412 of file class.ilExternalFeedBlockGUI.php.

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

Referenced by getHTML().

413  {
415  $lng = $this->lng;
416 
417  $ilCtrl->setParameterByClass(
418  "ilcolumngui",
419  "block_id",
420  "block_feed_" . $this->getBlockId()
421  );
422 
423  $rel_tpl = new ilTemplate("tpl.js_enabler.html", true, true, "Services/Feeds");
424  $rel_tpl->setVariable("BLOCK_ID", "block_feed_" . $this->getBlockId());
425  $rel_tpl->setVariable(
426  "TARGET",
427  $ilCtrl->getLinkTargetByClass("ilexternalfeedblockgui", "enableJS", true, "", false)
428  );
429 
430  return $rel_tpl->get();
431  }
global $ilCtrl
Definition: ilias.php:18
getBlockId()
Get Block Id.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getListItemForData()

ilExternalFeedBlockGUI::getListItemForData ( array  $data)
protected

Definition at line 737 of file class.ilExternalFeedBlockGUI.php.

References ilBlockGUI\$ctrl, Vendor\Package\$f, and ui().

738  {
739  $ctrl = $this->ctrl;
740  $f = $this->ui->factory();
741 
742  $item = $data["item"];
743 
744  //if ($this->isRepositoryObject() && !$ilAccess->checkAccess("read", "", $this->getRefId()))
745  $ctrl->setParameter($this, "feed_item_id", $item->getId());
746  $button = $f->button()->shy(
747  $item->getTitle(),
748  $ctrl->getLinkTarget($this, "showFeedItem", "", false, false)
749  );
750  $ctrl->setParameter($this, "feed_item_id", "");
751 
752  return $f->item()->standard($button);
753  }
Common interface to all items.
Definition: Item.php:10
ui()
Definition: ui.php:5
+ Here is the call graph for this function:

◆ getOverview()

ilExternalFeedBlockGUI::getOverview ( )

Get overview.

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

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

Referenced by fillDataSection().

481  {
483  $lng = $this->lng;
485 
486  $this->setEnableNumInfo(false);
487  return '<div class="small">' . ((int) count($this->getData())) . " " . $lng->txt("feed_feed_items") . "</div>";
488  }
setEnableNumInfo($a_enablenuminfo)
Set Enable Item Number Info.
global $ilCtrl
Definition: ilias.php:18
$ilUser
Definition: imgupload.php:18
getData()
Get Data.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getScreenMode()

static ilExternalFeedBlockGUI::getScreenMode ( )
static

Get Screen Mode for current command.

Definition at line 94 of file class.ilExternalFeedBlockGUI.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

◆ getValuesFeedBlock()

ilExternalFeedBlockGUI::getValuesFeedBlock ( )

FORM FeedBlock: Get current values for ExternalFeedBlock form.

Definition at line 255 of file class.ilExternalFeedBlockGUI.php.

Referenced by editFeedBlock().

256  {
257  $values = array();
258 
259  $values["block_title"] = $this->external_feed_block->getTitle();
260  $values["block_feed_url"] = $this->external_feed_block->getFeedUrl();
261 
262  $this->form_gui->setValuesByArray($values);
263  }
+ Here is the caller graph for this function:

◆ importFile()

ilExternalFeedBlockGUI::importFile ( )

Import.

public

Definition at line 593 of file class.ilExternalFeedBlockGUI.php.

References $_GET, $_POST, ilBlockGUI\$lng, ilBlockGUI\$main_tpl, $rbacsystem, ilBlockGUI\$tpl, exitSaveFeedBlock(), ilObjectFactory\getInstanceByObjId(), and initImportForm().

594  {
597  $lng = $this->lng;
598 
599  $new_type = $_POST["new_type"] ? $_POST["new_type"] : $_GET["new_type"];
600 
601  // create permission is already checked in createObject. This check here is done to prevent hacking attempts
602  if (!$rbacsystem->checkAccess("create", $_GET["ref_id"], $new_type)) {
603  $this->ilias->raiseError($this->lng->txt("no_create_permission"), $this->ilias->error_obj->MESSAGE);
604  }
605  $this->ctrl->setParameter($this, "new_type", $new_type);
606  $this->initImportForm($new_type);
607  if ($this->form->checkInput()) {
608  // todo: make some check on manifest file
609  include_once("./Services/Export/classes/class.ilImport.php");
610  $imp = new ilImport((int) $_GET['ref_id']);
611  $new_id = $imp->importObject(
612  $newObj,
613  $_FILES["importfile"]["tmp_name"],
614  $_FILES["importfile"]["name"],
615  $new_type
616  );
617 
618  // put new object id into tree
619  if ($new_id > 0) {
620  $newObj = ilObjectFactory::getInstanceByObjId($new_id);
621  $newObj->createReference();
622  $newObj->putInTree($_GET["ref_id"]);
623  $newObj->setPermissions($_GET["ref_id"]);
624  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
625  $this->exitSaveFeedBlock();
626  }
627  return;
628  }
629 
630  $this->form->setValuesByPost();
631  $tpl->setContent($this->form->getHtml());
632  }
exitSaveFeedBlock()
FORM FeedBlock: Exit save.
$_GET["client_id"]
Import class.
initImportForm($a_new_type="")
Init object import form.
redirection script todo: (a better solution should control the processing via a xml file) ...
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
$_POST["username"]
+ Here is the call graph for this function:

◆ initFormFeedBlock()

ilExternalFeedBlockGUI::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 641 of file class.ilExternalFeedBlockGUI.php.

References ilBlockGUI\$lng, and ilFormPropertyGUI\setInfo().

Referenced by createFeedBlock(), editFeedBlock(), saveFeedBlock(), and updateFeedBlock().

642  {
643  $lng = $this->lng;
644 
645  $lng->loadLanguageModule("block");
646 
647  require_once("Services/Form/classes/class.ilPropertyFormGUI.php");
648 
649  $this->form_gui = new ilPropertyFormGUI();
650 
651  // Property Title
652  $text_input = new ilTextInputGUI($lng->txt("block_feed_block_title"), "block_title");
653  $text_input->setInfo("");
654  $text_input->setRequired(true);
655  $text_input->setMaxLength(200);
656  $this->form_gui->addItem($text_input);
657 
658  // Property FeedUrl
659  $text_input = new ilFeedUrlInputGUI($lng->txt("block_feed_block_feed_url"), "block_feed_url");
660  $text_input->setInfo($lng->txt("block_feed_block_feed_url_info"));
661  $text_input->setRequired(true);
662  $text_input->setMaxLength(250);
663  $this->form_gui->addItem($text_input);
664 
665 
666  // save and cancel commands
667  if (in_array($a_mode, array(self::FORM_CREATE,self::FORM_RE_CREATE))) {
668  $this->form_gui->addCommandButton("saveFeedBlock", $lng->txt("save"));
669  $this->form_gui->addCommandButton("cancelSaveFeedBlock", $lng->txt("cancel"));
670  } else {
671  $this->form_gui->addCommandButton("updateFeedBlock", $lng->txt("save"));
672  $this->form_gui->addCommandButton("cancelUpdateFeedBlock", $lng->txt("cancel"));
673  }
674 
675  $this->form_gui->setTitle($lng->txt("block_feed_block_head"));
676  $this->form_gui->setFormAction($this->ctrl->getFormAction($this));
677  }
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.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initImportForm()

ilExternalFeedBlockGUI::initImportForm (   $a_new_type = "")

Init object import form.

Parameters
stringnew type

Definition at line 562 of file class.ilExternalFeedBlockGUI.php.

References ilBlockGUI\$ctrl, $ilCtrl, ilBlockGUI\$lng, and ilFileInputGUI\setSuffixes().

Referenced by create(), and importFile().

563  {
564  $lng = $this->lng;
566 
567  $lng->loadLanguageModule("feed");
568 
569  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
570  $this->form = new ilPropertyFormGUI();
571  $this->form->setTarget("_top");
572 
573  // Import file
574  include_once("./Services/Form/classes/class.ilFileInputGUI.php");
575  $fi = new ilFileInputGUI($lng->txt("import_file"), "importfile");
576  $fi->setSuffixes(array("zip"));
577  $fi->setRequired(true);
578  $this->form->addItem($fi);
579 
580  $this->form->addCommandButton("importFile", $lng->txt("import"));
581  $this->form->addCommandButton("cancelSaveFeedBlock", $lng->txt("cancel"));
582  $this->form->setTitle($lng->txt($a_new_type . "_import"));
583 
584  $ilCtrl->setParameter($this, "new_type", $a_new_type);
585  $this->form->setFormAction($ilCtrl->getFormAction($this));
586  }
This class represents a property form user interface.
This class represents a file property in a property form.
global $ilCtrl
Definition: ilias.php:18
setSuffixes($a_suffixes)
Set Accepted Suffixes.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isRepositoryObject()

ilExternalFeedBlockGUI::isRepositoryObject ( )
protected

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

Referenced by fillRow().

86  : bool
87  {
88  return true;
89  }
+ Here is the caller graph for this function:

◆ prepareSaveFeedBlock()

ilExternalFeedBlockGUI::prepareSaveFeedBlock ( $a_feed_block)

FORM FeedBlock: Prepare Saving of FeedBlock.

Parameters
object$a_feed_blockFeedBlock object.

Definition at line 684 of file class.ilExternalFeedBlockGUI.php.

References getBlockType(), and getGuiObject().

Referenced by saveFeedBlock().

685  {
686  $this->getGuiObject()->save($a_feed_block);
687  $a_feed_block->setType($this->getBlockType());
688  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveFeedBlock()

ilExternalFeedBlockGUI::saveFeedBlock ( )

FORM FeedBlock: Save ExternalFeedBlock.

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

References exitSaveFeedBlock(), initFormFeedBlock(), prepareSaveFeedBlock(), and ilUtil\sendFailure().

207  {
208  $this->initFormFeedBlock(self::FORM_CREATE);
209 
210  $this->external_feed_block = new ilExternalFeedBlock();
211 
212  if ($this->form_gui->checkInput() &&
213  !$this->external_feed_block->isFeedUrlLocal($this->form_gui->getInput("block_feed_url"))) {
214  $this->external_feed_block->setTitle($this->form_gui->getInput("block_title"));
215  $this->external_feed_block->setFeedUrl($this->form_gui->getInput("block_feed_url"));
216  $this->prepareSaveFeedBlock($this->external_feed_block);
217  $this->external_feed_block->create();
218  $this->exitSaveFeedBlock();
219  } else {
220  if ($this->external_feed_block->isFeedUrlLocal($this->form_gui->getInput("block_feed_url"))) {
221  ilUtil::sendFailure($this->lng->txt("feed_no_local_url"), true);
222  }
223  $this->form_gui->setValuesByPost();
224  return $this->form_gui->getHtml();
225  }
226  }
exitSaveFeedBlock()
FORM FeedBlock: Exit save.
Custom block for external feeds.
prepareSaveFeedBlock(&$a_feed_block)
FORM FeedBlock: Prepare Saving of FeedBlock.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
initFormFeedBlock($a_mode)
FORM FeedBlock: Init form.
+ Here is the call graph for this function:

◆ setBlock()

ilExternalFeedBlockGUI::setBlock (   $a_block)

Do most of the initialisation.

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

References ilBlockGUI\$ctrl, $ilCtrl, ilBlockGUI\setBlockId(), and ilBlockGUI\setTitle().

121  {
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
setTitle($a_title)
Set Title.
setBlockId($a_block_id=0)
Set Block Id.
+ Here is the call graph for this function:

◆ setFormEditMode()

ilExternalFeedBlockGUI::setFormEditMode (   $a_form_edit_mode)

Set FormEditMode.

Parameters
int$a_form_edit_modeForm Edit Mode

Definition at line 166 of file class.ilExternalFeedBlockGUI.php.

167  {
168  $this->form_edit_mode = $a_form_edit_mode;
169  }

◆ setGuiObject()

ilExternalFeedBlockGUI::setGuiObject ( $a_gui_object)

Set GuiObject.

Parameters
object$a_gui_objectGUI object

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

147  {
148  $this->gui_object = $a_gui_object;
149  }

◆ showFeedItem()

ilExternalFeedBlockGUI::showFeedItem ( )

Show Feed Item.

Definition at line 493 of file class.ilExternalFeedBlockGUI.php.

References $_GET, ilBlockGUI\$ctrl, $ilCtrl, ilBlockGUI\$lng, ilBlockGUI\$tpl, and ilBlockGUI\getTitle().

494  {
495  $lng = $this->lng;
497 
498  include_once("./Services/News/classes/class.ilNewsItem.php");
499 
500  $this->feed->fetch();
501  foreach ($this->feed->getItems() as $item) {
502  if ($item->getId() == $_GET["feed_item_id"]) {
503  $c_item = $item;
504  break;
505  }
506  }
507 
508  $tpl = new ilTemplate("tpl.show_feed_item.html", true, true, "Services/Feeds");
509 
510  if (is_object($c_item)) {
511  if (trim($c_item->getSummary()) != "") { // summary
512  $tpl->setCurrentBlock("content");
513  $tpl->setVariable("VAL_CONTENT", $c_item->getSummary());
514  $tpl->parseCurrentBlock();
515  }
516  if (trim($c_item->getDate()) != "" || trim($c_item->getAuthor()) != "") { // date
517  $tpl->setCurrentBlock("date_author");
518  if (trim($c_item->getAuthor()) != "") {
519  $tpl->setVariable("VAL_AUTHOR", $c_item->getAuthor() . " - ");
520  }
521  $tpl->setVariable("VAL_DATE", $c_item->getDate());
522  $tpl->parseCurrentBlock();
523  }
524 
525  if (trim($c_item->getLink()) != "") { // link
526  $tpl->setCurrentBlock("plink");
527  $tpl->setVariable("HREF_LINK", $c_item->getLink());
528  $tpl->setVariable("TXT_LINK", $lng->txt("feed_open_source_page"));
529  $tpl->parseCurrentBlock();
530  }
531  $tpl->setVariable("VAL_TITLE", $c_item->getTitle()); // title
532  }
533 
534  $content_block = new ilDashboardContentBlockGUI();
535  $content_block->setContent($tpl->get());
536  $content_block->setTitle($this->getTitle());
537 
538  return $content_block->getHTML();
539  }
$_GET["client_id"]
global $ilCtrl
Definition: ilias.php:18
BlockGUI class for (centered) Content on Personal Desktop.
getTitle()
Get Title.
+ Here is the call graph for this function:

◆ updateFeedBlock()

ilExternalFeedBlockGUI::updateFeedBlock ( )

FORM FeedBlock: Update ExternalFeedBlock.

Definition at line 232 of file class.ilExternalFeedBlockGUI.php.

References exitUpdateFeedBlock(), initFormFeedBlock(), and ilUtil\sendFailure().

233  {
234  $this->initFormFeedBlock(self::FORM_EDIT);
235  if ($this->form_gui->checkInput() &&
236  !$this->external_feed_block->isFeedUrlLocal($this->form_gui->getInput("block_feed_url"))) {
237  $this->external_feed_block->setTitle($this->form_gui->getInput("block_title"));
238  $this->external_feed_block->setFeedUrl($this->form_gui->getInput("block_feed_url"));
239  $this->external_feed_block->update();
240  $this->exitUpdateFeedBlock();
241  } else {
242  if ($this->external_feed_block->isFeedUrlLocal($this->form_gui->getInput("block_feed_url"))) {
243  ilUtil::sendFailure($this->lng->txt("feed_no_local_url"));
244  }
245  $this->form_gui->setValuesByPost();
246  return $this->form_gui->getHtml();
247  }
248  }
exitUpdateFeedBlock()
FORM FeedBlock: Exit save.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
initFormFeedBlock($a_mode)
FORM FeedBlock: Init form.
+ Here is the call graph for this function:

Field Documentation

◆ $block_type

ilExternalFeedBlockGUI::$block_type = "feed"
static

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

◆ $form_edit_mode

ilExternalFeedBlockGUI::$form_edit_mode
protected

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

Referenced by getFormEditMode().

◆ $gui_object

ilExternalFeedBlockGUI::$gui_object
protected

Definition at line 24 of file class.ilExternalFeedBlockGUI.php.

Referenced by getGuiObject().

◆ $new_rendering

ilExternalFeedBlockGUI::$new_rendering = true
protected

Definition at line 721 of file class.ilExternalFeedBlockGUI.php.

◆ $obj_definition

ilExternalFeedBlockGUI::$obj_definition
protected

Definition at line 40 of file class.ilExternalFeedBlockGUI.php.

◆ $rbacsystem

ilExternalFeedBlockGUI::$rbacsystem
protected

Definition at line 35 of file class.ilExternalFeedBlockGUI.php.

Referenced by importFile().

◆ $settings

ilExternalFeedBlockGUI::$settings
protected

Definition at line 30 of file class.ilExternalFeedBlockGUI.php.

◆ FORM_CREATE

const ilExternalFeedBlockGUI::FORM_CREATE = 1

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

◆ FORM_EDIT

const ilExternalFeedBlockGUI::FORM_EDIT = 0

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

◆ FORM_RE_CREATE

const ilExternalFeedBlockGUI::FORM_RE_CREATE = 2

Definition at line 22 of file class.ilExternalFeedBlockGUI.php.

◆ FORM_RE_EDIT

const ilExternalFeedBlockGUI::FORM_RE_EDIT = 2

Definition at line 21 of file class.ilExternalFeedBlockGUI.php.


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