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

BlockGUI class for external feed block. More...

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

Public Member Functions

 __construct ()
 Constructor. More...
 
 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...
 
 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 ilExternalFeedBlockGUIGen
 __construct ()
 Constructor. More...
 
 executeCommand ()
 Execute command. 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...
 
 initFormFeedBlock ($a_mode)
 FORM FeedBlock: Init form. More...
 
 getValuesFeedBlock ()
 FORM FeedBlock: Get current values for ExternalFeedBlock form. More...
 
 cancelSaveFeedBlock ()
 FORM FeedBlock: Cancel save. More...
 
 cancelUpdateFeedBlock ()
 FORM FeedBlock: Cancel update. More...
 
 exitSaveFeedBlock ()
 FORM FeedBlock: Exit save. More...
 
 exitUpdateFeedBlock ()
 FORM FeedBlock: Exit update. More...
 
 prepareSaveFeedBlock (&$a_external_feed_block)
 FORM FeedBlock: Prepare Saving of ExternalFeedBlock. More...
 
 prepareFormFeedBlock (&$a_form_gui)
 FORM FeedBlock: Prepare form. More...
 
- Public Member Functions inherited from ilBlockGUI
 __construct ()
 Constructor. More...
 
 addHeaderLink ($a_href, $a_text, $status=true)
 
 getHeaderLinks ()
 
 setData ($a_data)
 Set Data. More...
 
 getData ()
 Get Data. More...
 
 setBigMode ($a_bigmode)
 Set Big Mode. More...
 
 getBigMode ()
 Get Big Mode. More...
 
 setBlockId ($a_block_id=0)
 Set Block Id. More...
 
 getBlockId ()
 Get Block Id. More...
 
 setAvailableDetailLevels ($a_max, $a_min=0)
 Set Available Detail Levels. More...
 
 setCurrentDetailLevel ($a_currentdetaillevel)
 Set Current Detail Level. More...
 
 setGuiObject (&$a_gui_object)
 Set GuiObject. More...
 
 getGuiObject ()
 Get GuiObject. More...
 
 getCurrentDetailLevel ()
 Get Current Detail Level. More...
 
 setTitle ($a_title)
 Set Title. More...
 
 getTitle ()
 Get Title. More...
 
 setImage ($a_image)
 Set Image. More...
 
 getImage ()
 Get Image. More...
 
 setOffset ($a_offset)
 Set Offset. More...
 
 getOffset ()
 Get Offset. More...
 
 correctOffset ()
 
 setLimit ($a_limit)
 Set Limit. More...
 
 getLimit ()
 Get Limit. More...
 
 setEnableEdit ($a_enableedit)
 Set EnableEdit. More...
 
 getEnableEdit ()
 Get EnableEdit. More...
 
 setRepositoryMode ($a_repositorymode)
 Set RepositoryMode. More...
 
 getRepositoryMode ()
 Get RepositoryMode. More...
 
 setFooterInfo ($a_footerinfo, $a_hide_and_icon=false)
 Set Footer Info. More...
 
 getFooterInfo ($a_hide_and_icon=false)
 Get Footer Info. More...
 
 setSubtitle ($a_subtitle)
 Set Subtitle. More...
 
 getSubtitle ()
 Get Subtitle. More...
 
 setRefId ($a_refid)
 Set Ref Id (only used if isRepositoryObject() is true). More...
 
 getRefId ()
 Get Ref Id (only used if isRepositoryObject() is true). More...
 
 setAdminCommands ($a_admincommands)
 Set Administration Commmands. More...
 
 getAdminCommands ()
 Get Administration Commmands. More...
 
 setColSpan ($a_colspan)
 Set Columns Span. More...
 
 getColSpan ()
 Get Columns Span. More...
 
 setEnableDetailRow ($a_enabledetailrow)
 Set EnableDetailRow. More...
 
 getEnableDetailRow ()
 Get EnableDetailRow. More...
 
 setEnableNumInfo ($a_enablenuminfo)
 Set Enable Item Number Info. More...
 
 getEnableNumInfo ()
 Get Enable Item Number Info. More...
 
 setProperties ($a_properties)
 This function is supposed to be used for block type specific properties, that should be inherited through ilColumnGUI->setBlockProperties. More...
 
 getProperty ($a_property)
 
 setProperty ($a_property, $a_value)
 
 setRowTemplate ($a_rowtemplatename, $a_rowtemplatedir="")
 Set Row Template Name. More...
 
 getNavParameter ()
 
 getDetailParameter ()
 
 getConfigParameter ()
 
 getMoveParameter ()
 
 getRowTemplateName ()
 Get Row Template Name. More...
 
 getRowTemplateDir ()
 Get Row Template Directory. More...
 
 addBlockCommand ( $a_href, $a_text, $a_target="", $a_img="", $a_right_aligned=false, $a_checked=false, $a_html="")
 Add Block Command. More...
 
 getBlockCommands ()
 Get Block commands. More...
 
 addHeaderCommand ($a_href, $a_text, $a_as_close=false)
 Add Header Block Command. More...
 
 getHeaderCommands ()
 Get Header Block commands. More...
 
 addFooterLink ( $a_text, $a_href="", $a_onclick="", $a_block_id="", $a_top=false, $a_omit_separator=false, $a_checked=false)
 Add a footer text/link. More...
 
 getFooterLinks ()
 Get footer links. More...
 
 clearFooterLinks ()
 Clear footer links. More...
 
 handleDetailLevel ()
 Handle read/write current detail level. More...
 
 getHTML ()
 Handle config status. More...
 
 fillHeaderCommands ()
 Fill header commands block. More...
 
 fillHeaderTitleBlock ()
 Fill header title block (title and. More...
 
 setDataSection ($a_content)
 Call this from overwritten fillDataSection(), if standard row based data is not used. More...
 
 fillDataSection ()
 Standard implementation for row based data. More...
 
 fillRow ($a_set)
 
 fillFooter ()
 
 fillPreviousNext ()
 Fill previous/next row. More...
 
 setPreviousNextLinks ()
 Get previous/next linkbar. More...
 
 fillFooterLinks ($a_top=false, $a_numinfo="")
 Fill footer links. More...
 
 fillDetailRow ()
 Fill Detail Setting Row. More...
 

Static Public Member Functions

static getBlockType ()
 Get block type. More...
 
static isRepositoryObject ()
 Get block type. 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 = "feed"
 

Protected Attributes

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

Additional Inherited Members

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

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

Constructor & Destructor Documentation

◆ __construct()

ilExternalFeedBlockGUI::__construct ( )

Constructor.

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

References $DIC, ilBlockGUI\$lng, ilBlockGUI\setLimit(), ilBlockGUI\setRowTemplate(), settings(), and user().

43  {
44  global $DIC;
45 
46  $this->ctrl = $DIC->ctrl();
47  $this->lng = $DIC->language();
48  $this->user = $DIC->user();
49  $this->access = $DIC->access();
50  $this->settings = $DIC->settings();
51  $this->rbacsystem = $DIC->rbac()->system();
52  $this->obj_definition = $DIC["objDefinition"];
53  $lng = $DIC->language();
54 
55  parent::__construct();
56 
57  $lng->loadLanguageModule("feed");
58  $this->setLimit(5);
59  $this->setRowTemplate("tpl.block_external_feed_row.html", "Services/Feeds");
60  }
global $DIC
Definition: saml.php:7
user()
Definition: user.php:4
setLimit($a_limit)
Set Limit.
settings()
Definition: settings.php:2
setRowTemplate($a_rowtemplatename, $a_rowtemplatedir="")
Set Row Template Name.
+ Here is the call graph for this function:

Member Function Documentation

◆ cancelUpdateFeedBlock()

ilExternalFeedBlockGUI::cancelUpdateFeedBlock ( )

FORM FeedBlock: Exit save.

(Can be overwritten in derived classes)

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

References ilExternalFeedBlockGUIGen\getGuiObject().

566  {
567  $this->getGuiObject()->cancelUpdate();
568  }
+ Here is the call graph for this function:

◆ create()

ilExternalFeedBlockGUI::create ( )

Create Form for Block.

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

References $html1, $html2, ilExternalFeedBlockGUIGen\createFeedBlock(), and initImportForm().

405  {
406  $html1 = $this->createFeedBlock();
407 
408  $html2 = "";
409  if (DEVMODE == 1) {
410  $this->initImportForm("feed");
411  $html2 = "<br/>" . $this->form->getHTML();
412  }
413 
414  return $html1 . $html2;
415  }
createFeedBlock()
FORM FeedBlock: Create ExternalFeedBlock.
$html1
Definition: 42richText.php:58
$html2
Definition: 42richText.php:71
initImportForm($a_new_type="")
Init object import form.
+ Here is the call graph for this function:

◆ disableJS()

ilExternalFeedBlockGUI::disableJS ( )

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

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

288  {
291 
292  $_SESSION["il_feed_js"] = "n";
293  $ilUser->writePref("il_feed_js", "n");
294  $ilCtrl->returnToParent($this);
295  }
$_SESSION["AccountId"]
global $ilCtrl
Definition: ilias.php:18
$ilUser
Definition: imgupload.php:18

◆ enableJS()

ilExternalFeedBlockGUI::enableJS ( )

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

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

298  {
300 
301  $_SESSION["il_feed_js"] = "y";
302  $ilUser->writePref("il_feed_js", "y");
303  echo $this->getHTML();
304  exit;
305  }
$_SESSION["AccountId"]
$ilUser
Definition: imgupload.php:18
+ Here is the call graph for this function:

◆ executeCommand()

ilExternalFeedBlockGUI::executeCommand ( )

execute command

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

References ilBlockGUI\$ctrl, and $ilCtrl.

135  {
137 
138  $next_class = $ilCtrl->getNextClass();
139  $cmd = $ilCtrl->getCmd("getHTML");
140  switch ($next_class) {
141  default:
142  return $this->$cmd();
143  }
144  }
global $ilCtrl
Definition: ilias.php:18

◆ exitSaveFeedBlock()

ilExternalFeedBlockGUI::exitSaveFeedBlock ( )

FORM FeedBlock: Exit save.

(Can be overwritten in derived classes)

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

References ilExternalFeedBlockGUIGen\getGuiObject().

Referenced by importFile().

557  {
558  $this->getGuiObject()->exitSave();
559  }
+ 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 574 of file class.ilExternalFeedBlockGUI.php.

References ilExternalFeedBlockGUIGen\getGuiObject().

575  {
576  $this->getGuiObject()->update($this->external_feed_block);
577  }
+ Here is the call graph for this function:

◆ fillDataSection()

ilExternalFeedBlockGUI::fillDataSection ( )

Fill data section.

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

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

150  {
151  if ($this->getDynamic()) {
152  $this->setDataSection($this->getDynamicReload());
153  } elseif ($this->getCurrentDetailLevel() > 1 && count($this->getData()) > 0) {
154  parent::fillDataSection();
155  } else {
156  $this->setDataSection($this->getOverview());
157  }
158  }
setDataSection($a_content)
Call this from overwritten fillDataSection(), if standard row based data is not used.
getData()
Get Data.
getCurrentDetailLevel()
Get Current Detail Level.
+ Here is the call graph for this function:

◆ fillRow()

ilExternalFeedBlockGUI::fillRow (   $item)

Fill feed item row.

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

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

311  {
313  $ilAccess = $this->access;
314 
315  if ($this->isRepositoryObject() && !$ilAccess->checkAccess("read", "", $this->getRefId())) {
316  $this->tpl->setVariable("TXT_TITLE", $item->getTitle());
317  } else {
318  $ilCtrl->setParameter($this, "feed_item_id", $item->getId());
319  $this->tpl->setCurrentBlock("feed_link");
320  $this->tpl->setVariable("VAL_TITLE", $item->getTitle());
321  $this->tpl->setVariable(
322  "HREF_SHOW",
323  $ilCtrl->getLinkTarget($this, "showFeedItem")
324  );
325  $ilCtrl->setParameter($this, "feed_item_id", "");
326  $this->tpl->parseCurrentBlock();
327  }
328  }
static isRepositoryObject()
Get block type.
global $ilCtrl
Definition: ilias.php:18
+ Here is the call graph for this function:

◆ getBlockType()

static ilExternalFeedBlockGUI::getBlockType ( )
static

Get block type.

Returns
string Block type.

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

Referenced by prepareSaveFeedBlock().

68  {
69  return self::$block_type;
70  }
+ Here is the caller graph for this function:

◆ getDynamic()

ilExternalFeedBlockGUI::getDynamic ( )

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

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

Referenced by fillDataSection(), and getHTML().

219  {
222 
223  if ($ilCtrl->getCmdClass() != "ilcolumngui" && $ilCtrl->getCmd() != "enableJS") {
224  if ($_SESSION["il_feed_js"] != "n" &&
225  ($ilUser->getPref("il_feed_js") != "n" || $_SESSION["il_feed_js"] == "y")) {
226  // do not get feed dynamically, if cache hit is given.
227  if (!$this->feed->checkCacheHit()) {
228  return true;
229  }
230  }
231  }
232 
233  return false;
234  }
$_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 236 of file class.ilExternalFeedBlockGUI.php.

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

Referenced by fillDataSection().

237  {
239  $lng = $this->lng;
240 
241  $ilCtrl->setParameterByClass(
242  "ilcolumngui",
243  "block_id",
244  "block_feed_" . $this->getBlockId()
245  );
246 
247  $rel_tpl = new ilTemplate("tpl.dynamic_reload.html", true, true, "Services/Feeds");
248  $rel_tpl->setVariable("TXT_LOADING", $lng->txt("feed_loading_feed"));
249  $rel_tpl->setVariable("BLOCK_ID", "block_feed_" . $this->getBlockId());
250  $rel_tpl->setVariable(
251  "TARGET",
252  $ilCtrl->getLinkTargetByClass("ilcolumngui", "updateBlock", "", true)
253  );
254 
255  // no JS
256  $rel_tpl->setVariable("TXT_FEED_CLICK_HERE", $lng->txt("feed_no_js_click_here"));
257  $rel_tpl->setVariable(
258  "TARGET_NO_JS",
259  $ilCtrl->getLinkTargetByClass("ilexternalfeedblockgui", "disableJS")
260  );
261 
262  return $rel_tpl->get();
263  }
global $ilCtrl
Definition: ilias.php:18
special template class to simplify handling of ITX/PEAR
getBlockId()
Get Block Id.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getHTML()

ilExternalFeedBlockGUI::getHTML ( )

Get block HTML code.

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

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

Referenced by enableJS().

164  {
166  $lng = $this->lng;
168  $ilAccess = $this->access;
170 
171  if ($this->getCurrentDetailLevel() == 0) {
172  return "";
173  }
174 
175  $feed_set = new ilSetting("feed");
176 
177  if ($feed_set->get("disable_rep_feeds")) {
178  return "";
179  }
180 
181  // if no dynamic reload
182  if (!$this->getDynamic()) {
183  $this->feed->fetch();
184  $this->setData($this->feed->getItems());
185  }
186 
187  //$this->setTitle($this->feed->getChannelTitle());
188  $this->setData($this->feed->getItems());
189 
190  if ($ilAccess->checkAccess("write", "", $this->getRefId())) {
191  $ilCtrl->setParameterByClass(
192  "ilobjexternalfeedgui",
193  "ref_id",
194  $this->getRefId()
195  );
196  $ilCtrl->setParameter($this, "external_feed_block_id", $this->getBlockId());
197  $this->addBlockCommand(
198  $ilCtrl->getLinkTargetByClass(
199  array("ilrepositorygui", "ilobjexternalfeedgui",
200  "ilexternalfeedblockgui"),
201  "editFeedBlock"
202  ),
203  $lng->txt("settings")
204  );
205  $ilCtrl->clearParametersByClass("ilobjexternalfeedgui");
206  }
207 
208  // JS enabler
209  $add = "";
210  if ($_SESSION["il_feed_js"] == "n" ||
211  ($ilUser->getPref("il_feed_js") == "n" && $_SESSION["il_feed_js"] != "y")) {
212  $add = $this->getJSEnabler();
213  }
214 
215  return parent::getHTML() . $add;
216  }
$_SESSION["AccountId"]
global $ilCtrl
Definition: ilias.php:18
setData($a_data)
Set Data.
$ilUser
Definition: imgupload.php:18
$feed_set
Definition: privfeed.php:19
Create styles array
The data for the language used.
getBlockId()
Get Block Id.
addBlockCommand( $a_href, $a_text, $a_target="", $a_img="", $a_right_aligned=false, $a_checked=false, $a_html="")
Add Block Command.
getRefId()
Get Ref Id (only used if isRepositoryObject() is true).
global $ilSetting
Definition: privfeed.php:17
getCurrentDetailLevel()
Get Current Detail Level.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getJSEnabler()

ilExternalFeedBlockGUI::getJSEnabler ( )

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

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

Referenced by getHTML().

266  {
268  $lng = $this->lng;
269 
270  $ilCtrl->setParameterByClass(
271  "ilcolumngui",
272  "block_id",
273  "block_feed_" . $this->getBlockId()
274  );
275 
276  $rel_tpl = new ilTemplate("tpl.js_enabler.html", true, true, "Services/Feeds");
277  $rel_tpl->setVariable("BLOCK_ID", "block_feed_" . $this->getBlockId());
278  $rel_tpl->setVariable(
279  "TARGET",
280  $ilCtrl->getLinkTargetByClass("ilexternalfeedblockgui", "enableJS", true, "", false)
281  );
282 
283  return $rel_tpl->get();
284  }
global $ilCtrl
Definition: ilias.php:18
special template class to simplify handling of ITX/PEAR
getBlockId()
Get Block Id.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getOverview()

ilExternalFeedBlockGUI::getOverview ( )

Get overview.

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

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

Referenced by fillDataSection().

334  {
336  $lng = $this->lng;
338 
339  $this->setEnableNumInfo(false);
340  return '<div class="small">' . ((int) count($this->getData())) . " " . $lng->txt("feed_feed_items") . "</div>";
341  }
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 85 of file class.ilExternalFeedBlockGUI.php.

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

86  {
87  global $DIC;
88 
89  $ilCtrl = $DIC->ctrl();
90 
91  switch ($ilCtrl->getCmd()) {
92  case "create":
93  case "edit":
94  case "saveFeedBlock":
95  case "updateFeedBlock":
96  case "editFeedBlock":
97  case "showFeedItem":
98  case "confirmDeleteFeedBlock":
99  return IL_SCREEN_CENTER;
100  break;
101 
102  default:
103  return IL_SCREEN_SIDE;
104  break;
105  }
106  }
global $DIC
Definition: saml.php:7
global $ilCtrl
Definition: ilias.php:18
const IL_SCREEN_CENTER
const IL_SCREEN_SIDE

◆ importFile()

ilExternalFeedBlockGUI::importFile ( )

Import.

public

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

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

454  {
457  $lng = $this->lng;
458 
459  $new_type = $_POST["new_type"] ? $_POST["new_type"] : $_GET["new_type"];
460 
461  // create permission is already checked in createObject. This check here is done to prevent hacking attempts
462  if (!$rbacsystem->checkAccess("create", $_GET["ref_id"], $new_type)) {
463  $this->ilias->raiseError($this->lng->txt("no_create_permission"), $this->ilias->error_obj->MESSAGE);
464  }
465  $this->ctrl->setParameter($this, "new_type", $new_type);
466  $this->initImportForm($new_type);
467  if ($this->form->checkInput()) {
468  // todo: make some check on manifest file
469  include_once("./Services/Export/classes/class.ilImport.php");
470  $imp = new ilImport((int) $_GET['ref_id']);
471  $new_id = $imp->importObject(
472  $newObj,
473  $_FILES["importfile"]["tmp_name"],
474  $_FILES["importfile"]["name"],
475  $new_type
476  );
477 
478  // put new object id into tree
479  if ($new_id > 0) {
480  $newObj = ilObjectFactory::getInstanceByObjId($new_id);
481  $newObj->createReference();
482  $newObj->putInTree($_GET["ref_id"]);
483  $newObj->setPermissions($_GET["ref_id"]);
484  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
485  $this->exitSaveFeedBlock();
486  }
487  return;
488  }
489 
490  $this->form->setValuesByPost();
491  $tpl->setContent($this->form->getHtml());
492  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
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 (IL_FORM_EDIT | IL_FORM_CREATE)

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

References ilBlockGUI\$lng, array, IL_FORM_CREATE, IL_FORM_RE_CREATE, ilExternalFeedBlockGUIGen\prepareFormFeedBlock(), and ilFormPropertyGUI\setInfo().

502  {
503  $lng = $this->lng;
504 
505  $lng->loadLanguageModule("block");
506 
507  require_once("Services/Form/classes/class.ilPropertyFormGUI.php");
508 
509  $this->form_gui = new ilPropertyFormGUI();
510 
511  // Property Title
512  $text_input = new ilTextInputGUI($lng->txt("block_feed_block_title"), "block_title");
513  $text_input->setInfo("");
514  $text_input->setRequired(true);
515  $text_input->setMaxLength(200);
516  $this->form_gui->addItem($text_input);
517 
518  // Property FeedUrl
519  $text_input = new ilFeedUrlInputGUI($lng->txt("block_feed_block_feed_url"), "block_feed_url");
520  $text_input->setInfo($lng->txt("block_feed_block_feed_url_info"));
521  $text_input->setRequired(true);
522  $text_input->setMaxLength(250);
523  $this->form_gui->addItem($text_input);
524 
525 
526  // save and cancel commands
527  if (in_array($a_mode, array(IL_FORM_CREATE,IL_FORM_RE_CREATE))) {
528  $this->form_gui->addCommandButton("saveFeedBlock", $lng->txt("save"));
529  $this->form_gui->addCommandButton("cancelSaveFeedBlock", $lng->txt("cancel"));
530  } else {
531  $this->form_gui->addCommandButton("updateFeedBlock", $lng->txt("save"));
532  $this->form_gui->addCommandButton("cancelUpdateFeedBlock", $lng->txt("cancel"));
533  }
534 
535  $this->form_gui->setTitle($lng->txt("block_feed_block_head"));
536  $this->form_gui->setFormAction($this->ctrl->getFormAction($this));
537 
538  $this->prepareFormFeedBlock($this->form_gui);
539  }
This class represents a feed url property in a property form.
prepareFormFeedBlock(&$a_form_gui)
FORM FeedBlock: Prepare form.
This class represents a property form user interface.
setInfo($a_info)
Set Information Text.
This class represents a text property in a property form.
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ initImportForm()

ilExternalFeedBlockGUI::initImportForm (   $a_new_type = "")

Init object import form.

Parameters
stringnew type

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

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

Referenced by create(), and importFile().

423  {
424  $lng = $this->lng;
426 
427  $lng->loadLanguageModule("feed");
428 
429  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
430  $this->form = new ilPropertyFormGUI();
431  $this->form->setTarget("_top");
432 
433  // Import file
434  include_once("./Services/Form/classes/class.ilFileInputGUI.php");
435  $fi = new ilFileInputGUI($lng->txt("import_file"), "importfile");
436  $fi->setSuffixes(array("zip"));
437  $fi->setRequired(true);
438  $this->form->addItem($fi);
439 
440  $this->form->addCommandButton("importFile", $lng->txt("import"));
441  $this->form->addCommandButton("cancelSaveFeedBlock", $lng->txt("cancel"));
442  $this->form->setTitle($lng->txt($a_new_type . "_import"));
443 
444  $ilCtrl->setParameter($this, "new_type", $a_new_type);
445  $this->form->setFormAction($ilCtrl->getFormAction($this));
446  }
This class represents a property form user interface.
This class represents a file property in a property form.
global $ilCtrl
Definition: ilias.php:18
Create styles array
The data for the language used.
setSuffixes($a_suffixes)
Set Accepted Suffixes.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isRepositoryObject()

static ilExternalFeedBlockGUI::isRepositoryObject ( )
static

Get block type.

Returns
string Block type.

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

Referenced by fillRow().

78  {
79  return true;
80  }
+ 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 546 of file class.ilExternalFeedBlockGUI.php.

References getBlockType(), and ilExternalFeedBlockGUIGen\getGuiObject().

547  {
548  $this->getGuiObject()->save($a_feed_block);
549  $a_feed_block->setType($this->getBlockType());
550  }
static getBlockType()
Get block type.
+ Here is the call graph for this function:

◆ setBlock()

ilExternalFeedBlockGUI::setBlock (   $a_block)

Do most of the initialisation.

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

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

112  {
114 
115  // init block
116  $this->feed_block = $a_block;
117  $this->setTitle($this->feed_block->getTitle());
118  $this->setBlockId($this->feed_block->getId());
119 
120  // get feed object
121  include_once("./Services/Feeds/classes/class.ilExternalFeed.php");
122  $this->feed = new ilExternalFeed();
123  $this->feed->setUrl($this->feed_block->getFeedUrl());
124 
125  // init details
126  $this->setAvailableDetailLevels(2);
127 
128  $ilCtrl->setParameter($this, "block_id", $this->feed_block->getId());
129  }
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.
setAvailableDetailLevels($a_max, $a_min=0)
Set Available Detail Levels.
+ Here is the call graph for this function:

◆ showFeedItem()

ilExternalFeedBlockGUI::showFeedItem ( )

Show Feed Item.

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

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

347  {
348  $lng = $this->lng;
350 
351  include_once("./Services/News/classes/class.ilNewsItem.php");
352 
353  $this->feed->fetch();
354  foreach ($this->feed->getItems() as $item) {
355  if ($item->getId() == $_GET["feed_item_id"]) {
356  $c_item = $item;
357  break;
358  }
359  }
360 
361  $tpl = new ilTemplate("tpl.show_feed_item.html", true, true, "Services/Feeds");
362 
363  if (is_object($c_item)) {
364  if (trim($c_item->getSummary()) != "") { // summary
365  $tpl->setCurrentBlock("content");
366  $tpl->setVariable("VAL_CONTENT", $c_item->getSummary());
367  $tpl->parseCurrentBlock();
368  }
369  if (trim($c_item->getDate()) != "" || trim($c_item->getAuthor()) != "") { // date
370  $tpl->setCurrentBlock("date_author");
371  if (trim($c_item->getAuthor()) != "") {
372  $tpl->setVariable("VAL_AUTHOR", $c_item->getAuthor() . " - ");
373  }
374  $tpl->setVariable("VAL_DATE", $c_item->getDate());
375  $tpl->parseCurrentBlock();
376  }
377 
378  if (trim($c_item->getLink()) != "") { // link
379  $tpl->setCurrentBlock("plink");
380  $tpl->setVariable("HREF_LINK", $c_item->getLink());
381  $tpl->setVariable("TXT_LINK", $lng->txt("feed_open_source_page"));
382  $tpl->parseCurrentBlock();
383  }
384  $tpl->setVariable("VAL_TITLE", $c_item->getTitle()); // title
385  }
386 
387  include_once("./Services/PersonalDesktop/classes/class.ilPDContentBlockGUI.php");
388  $content_block = new ilPDContentBlockGUI();
389  $content_block->setContent($tpl->get());
390  $content_block->setTitle($this->getTitle());
391  $content_block->setImage(ilUtil::getImagePath("icon_feed.svg"));
392  $content_block->addHeaderCommand(
393  $ilCtrl->getParentReturn($this),
394  $lng->txt("close"),
395  true
396  );
397 
398  return $content_block->getHTML();
399  }
$_GET["client_id"]
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
BlockGUI class for (centered) Content on Personal Desktop.
getTitle()
Get Title.
+ Here is the call graph for this function:

Field Documentation

◆ $block_type

ilExternalFeedBlockGUI::$block_type = "feed"
static

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

◆ $obj_definition

ilExternalFeedBlockGUI::$obj_definition
protected

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

◆ $rbacsystem

ilExternalFeedBlockGUI::$rbacsystem
protected

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

Referenced by importFile().

◆ $settings

ilExternalFeedBlockGUI::$settings
protected

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

Referenced by getHTML().


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