ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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"
 

Additional Inherited Members

- Protected Member Functions inherited from ilBlockGUI
 fillRowColor ($a_placeholder="CSS_ROW")
 
 preloadData (array $data)
 Can be overwritten in subclasses. More...
 
- 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
 

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

References $ilCtrl, $lng, ilBlockGUI\setLimit(), and ilBlockGUI\setRowTemplate().

28  {
29  global $ilCtrl, $lng;
30 
31  parent::__construct();
32 
33  $lng->loadLanguageModule("feed");
34  $this->setLimit(5);
35  $this->setRowTemplate("tpl.block_external_feed_row.html", "Services/Feeds");
36  }
global $ilCtrl
Definition: ilias.php:18
setLimit($a_limit)
Set Limit.
global $lng
Definition: privfeed.php:17
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 537 of file class.ilExternalFeedBlockGUI.php.

References $ilCtrl, and ilExternalFeedBlockGUIGen\getGuiObject().

538  {
539  global $ilCtrl;
540 
541  $this->getGuiObject()->cancelUpdate();
542  }
global $ilCtrl
Definition: ilias.php:18
+ Here is the call graph for this function:

◆ create()

ilExternalFeedBlockGUI::create ( )

Create Form for Block.

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

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

370  {
371  $html1 = $this->createFeedBlock();
372 
373  $html2 = "";
374  if (DEVMODE == 1)
375  {
376  $this->initImportForm("feed");
377  $html2 = "<br/>".$this->form->getHTML();
378  }
379 
380  return $html1.$html2;
381  }
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 252 of file class.ilExternalFeedBlockGUI.php.

References $_SESSION, $ilCtrl, and $ilUser.

253  {
254  global $ilCtrl, $ilUser;
255 
256  $_SESSION["il_feed_js"] = "n";
257  $ilUser->writePref("il_feed_js", "n");
258  $ilCtrl->returnToParent($this);
259  }
$_SESSION["AccountId"]
global $ilCtrl
Definition: ilias.php:18
$ilUser
Definition: imgupload.php:18

◆ enableJS()

ilExternalFeedBlockGUI::enableJS ( )

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

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

262  {
263  global $ilUser;
264 
265  $_SESSION["il_feed_js"] = "y";
266  $ilUser->writePref("il_feed_js", "y");
267  echo $this->getHTML();
268  exit;
269  }
$_SESSION["AccountId"]
$ilUser
Definition: imgupload.php:18
+ Here is the call graph for this function:

◆ executeCommand()

ilExternalFeedBlockGUI::executeCommand ( )

execute command

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

References $cmd, and $ilCtrl.

110  {
111  global $ilCtrl;
112 
113  $next_class = $ilCtrl->getNextClass();
114  $cmd = $ilCtrl->getCmd("getHTML");
115 
116  switch ($next_class)
117  {
118  default:
119  return $this->$cmd();
120  }
121  }
$cmd
Definition: sahs_server.php:35
global $ilCtrl
Definition: ilias.php:18

◆ exitSaveFeedBlock()

ilExternalFeedBlockGUI::exitSaveFeedBlock ( )

FORM FeedBlock: Exit save.

(Can be overwritten in derived classes)

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

References $ilCtrl, and ilExternalFeedBlockGUIGen\getGuiObject().

Referenced by importFile().

527  {
528  global $ilCtrl;
529 
530  $this->getGuiObject()->exitSave();
531  }
global $ilCtrl
Definition: ilias.php:18
+ 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 548 of file class.ilExternalFeedBlockGUI.php.

References $ilCtrl, and ilExternalFeedBlockGUIGen\getGuiObject().

549  {
550  global $ilCtrl;
551 
552  $this->getGuiObject()->update($this->external_feed_block);
553  }
global $ilCtrl
Definition: ilias.php:18
+ Here is the call graph for this function:

◆ fillDataSection()

ilExternalFeedBlockGUI::fillDataSection ( )

Fill data section.

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

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

127  {
128  if ($this->getDynamic())
129  {
130  $this->setDataSection($this->getDynamicReload());
131  }
132  else if ($this->getCurrentDetailLevel() > 1 && count($this->getData()) > 0)
133  {
134  parent::fillDataSection();
135  }
136  else
137  {
138  $this->setDataSection($this->getOverview());
139  }
140  }
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 274 of file class.ilExternalFeedBlockGUI.php.

References $ilCtrl, $ilUser, $lng, and isRepositoryObject().

275  {
276  global $ilUser, $ilCtrl, $lng, $ilAccess;
277 
278  if ($this->isRepositoryObject() && !$ilAccess->checkAccess("read", "", $this->getRefId()))
279  {
280  $this->tpl->setVariable("TXT_TITLE", $item->getTitle());
281  }
282  else
283  {
284  $ilCtrl->setParameter($this, "feed_item_id", $item->getId());
285  $this->tpl->setCurrentBlock("feed_link");
286  $this->tpl->setVariable("VAL_TITLE", $item->getTitle());
287  $this->tpl->setVariable("HREF_SHOW",
288  $ilCtrl->getLinkTarget($this, "showFeedItem"));
289  $ilCtrl->setParameter($this, "feed_item_id", "");
290  $this->tpl->parseCurrentBlock();
291  }
292  }
static isRepositoryObject()
Get block type.
global $ilCtrl
Definition: ilias.php:18
$ilUser
Definition: imgupload.php:18
global $lng
Definition: privfeed.php:17
+ Here is the call graph for this function:

◆ getBlockType()

static ilExternalFeedBlockGUI::getBlockType ( )
static

Get block type.

Returns
string Block type.

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

Referenced by prepareSaveFeedBlock().

44  {
45  return self::$block_type;
46  }
+ Here is the caller graph for this function:

◆ getDynamic()

ilExternalFeedBlockGUI::getDynamic ( )

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

References $_SESSION, $ilCtrl, and $ilUser.

Referenced by fillDataSection(), and getHTML().

196  {
197  global $ilCtrl, $ilUser;
198 
199  if ($ilCtrl->getCmdClass() != "ilcolumngui" && $ilCtrl->getCmd() != "enableJS")
200  {
201  if ($_SESSION["il_feed_js"] != "n" &&
202  ($ilUser->getPref("il_feed_js") != "n" || $_SESSION["il_feed_js"] == "y"))
203  {
204  // do not get feed dynamically, if cache hit is given.
205  if (!$this->feed->checkCacheHit())
206  {
207  return true;
208  }
209  }
210  }
211 
212  return false;
213  }
$_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 215 of file class.ilExternalFeedBlockGUI.php.

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

Referenced by fillDataSection().

216  {
217  global $ilCtrl, $lng;
218 
219  $ilCtrl->setParameterByClass("ilcolumngui", "block_id",
220  "block_feed_".$this->getBlockId());
221 
222  $rel_tpl = new ilTemplate("tpl.dynamic_reload.html", true, true, "Services/Feeds");
223  $rel_tpl->setVariable("TXT_LOADING", $lng->txt("feed_loading_feed"));
224  $rel_tpl->setVariable("BLOCK_ID", "block_feed_".$this->getBlockId());
225  $rel_tpl->setVariable("TARGET",
226  $ilCtrl->getLinkTargetByClass("ilcolumngui", "updateBlock", "", true));
227 
228  // no JS
229  $rel_tpl->setVariable("TXT_FEED_CLICK_HERE", $lng->txt("feed_no_js_click_here"));
230  $rel_tpl->setVariable("TARGET_NO_JS",
231  $ilCtrl->getLinkTargetByClass("ilexternalfeedblockgui", "disableJS"));
232 
233  return $rel_tpl->get();
234  }
global $ilCtrl
Definition: ilias.php:18
special template class to simplify handling of ITX/PEAR
getBlockId()
Get Block Id.
global $lng
Definition: privfeed.php:17
+ 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 145 of file class.ilExternalFeedBlockGUI.php.

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

Referenced by enableJS().

146  {
147  global $ilCtrl, $lng, $ilUser, $ilAccess, $ilSetting;
148 
149  if ($this->getCurrentDetailLevel() == 0)
150  {
151  return "";
152  }
153 
154  $feed_set = new ilSetting("feed");
155 
156  if ($feed_set->get("disable_rep_feeds"))
157  {
158  return "";
159  }
160 
161  // if no dynamic reload
162  if (!$this->getDynamic())
163  {
164  $this->feed->fetch();
165  $this->setData($this->feed->getItems());
166  }
167 
168  //$this->setTitle($this->feed->getChannelTitle());
169  $this->setData($this->feed->getItems());
170 
171  if ($ilAccess->checkAccess("write", "", $this->getRefId()))
172  {
173  $ilCtrl->setParameterByClass("ilobjexternalfeedgui",
174  "ref_id", $this->getRefId());
175  $ilCtrl->setParameter($this, "external_feed_block_id", $this->getBlockId());
176  $this->addBlockCommand(
177  $ilCtrl->getLinkTargetByClass(array("ilrepositorygui", "ilobjexternalfeedgui",
178  "ilexternalfeedblockgui"),
179  "editFeedBlock"),
180  $lng->txt("settings"));
181  $ilCtrl->clearParametersByClass("ilobjexternalfeedgui");
182  }
183 
184  // JS enabler
185  $add = "";
186  if ($_SESSION["il_feed_js"] == "n" ||
187  ($ilUser->getPref("il_feed_js") == "n" && $_SESSION["il_feed_js"] != "y"))
188  {
189  $add = $this->getJSEnabler();
190  }
191 
192  return parent::getHTML().$add;
193  }
ILIAS Setting Class.
$_SESSION["AccountId"]
addBlockCommand($a_href, $a_text, $a_target="", $a_img="", $a_right_aligned=false, $a_checked=false, $a_html="")
Add Block Command.
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.
getRefId()
Get Ref Id (only used if isRepositoryObject() is true).
global $ilSetting
Definition: privfeed.php:17
global $lng
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 236 of file class.ilExternalFeedBlockGUI.php.

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

Referenced by getHTML().

237  {
238  global $ilCtrl, $lng;
239 
240  $ilCtrl->setParameterByClass("ilcolumngui", "block_id",
241  "block_feed_".$this->getBlockId());
242 
243  $rel_tpl = new ilTemplate("tpl.js_enabler.html", true, true, "Services/Feeds");
244  $rel_tpl->setVariable("BLOCK_ID", "block_feed_".$this->getBlockId());
245  $rel_tpl->setVariable("TARGET",
246  $ilCtrl->getLinkTargetByClass("ilexternalfeedblockgui", "enableJS", true, "", false));
247 
248  return $rel_tpl->get();
249  }
global $ilCtrl
Definition: ilias.php:18
special template class to simplify handling of ITX/PEAR
getBlockId()
Get Block Id.
global $lng
Definition: privfeed.php:17
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getOverview()

ilExternalFeedBlockGUI::getOverview ( )

Get overview.

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

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

Referenced by fillDataSection().

298  {
299  global $ilUser, $lng, $ilCtrl;
300 
301  $this->setEnableNumInfo(false);
302  return '<div class="small">'.((int) count($this->getData()))." ".$lng->txt("feed_feed_items")."</div>";
303  }
setEnableNumInfo($a_enablenuminfo)
Set Enable Item Number Info.
global $ilCtrl
Definition: ilias.php:18
$ilUser
Definition: imgupload.php:18
getData()
Get Data.
global $lng
Definition: privfeed.php:17
+ 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 61 of file class.ilExternalFeedBlockGUI.php.

References $ilCtrl, IL_SCREEN_CENTER, and IL_SCREEN_SIDE.

62  {
63  global $ilCtrl;
64 
65  switch($ilCtrl->getCmd())
66  {
67  case "create":
68  case "edit":
69  case "saveFeedBlock":
70  case "updateFeedBlock":
71  case "editFeedBlock":
72  case "showFeedItem":
73  case "confirmDeleteFeedBlock":
74  return IL_SCREEN_CENTER;
75  break;
76 
77  default:
78  return IL_SCREEN_SIDE;
79  break;
80  }
81  }
global $ilCtrl
Definition: ilias.php:18
const IL_SCREEN_CENTER
const IL_SCREEN_SIDE

◆ importFile()

ilExternalFeedBlockGUI::importFile ( )

Import.

public

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

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

419  {
420  global $rbacsystem, $objDefinition, $tpl, $lng;
421 
422  $new_type = $_POST["new_type"] ? $_POST["new_type"] : $_GET["new_type"];
423 
424  // create permission is already checked in createObject. This check here is done to prevent hacking attempts
425  if (!$rbacsystem->checkAccess("create", $_GET["ref_id"], $new_type))
426  {
427  $this->ilias->raiseError($this->lng->txt("no_create_permission"), $this->ilias->error_obj->MESSAGE);
428  }
429  $this->ctrl->setParameter($this, "new_type", $new_type);
430  $this->initImportForm($new_type);
431  if ($this->form->checkInput())
432  {
433  // todo: make some check on manifest file
434  include_once("./Services/Export/classes/class.ilImport.php");
435  $imp = new ilImport((int) $_GET['ref_id']);
436  $new_id = $imp->importObject($newObj, $_FILES["importfile"]["tmp_name"],
437  $_FILES["importfile"]["name"], $new_type);
438 
439  // put new object id into tree
440  if ($new_id > 0)
441  {
442  $newObj = ilObjectFactory::getInstanceByObjId($new_id);
443  $newObj->createReference();
444  $newObj->putInTree($_GET["ref_id"]);
445  $newObj->setPermissions($_GET["ref_id"]);
446  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
447  $this->exitSaveFeedBlock();
448  }
449  return;
450  }
451 
452  $this->form->setValuesByPost();
453  $tpl->setContent($this->form->getHtml());
454  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
exitSaveFeedBlock()
FORM FeedBlock: Exit save.
$_GET["client_id"]
Import class.
global $tpl
Definition: ilias.php:8
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
global $lng
Definition: privfeed.php:17
$_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 463 of file class.ilExternalFeedBlockGUI.php.

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

464  {
465  global $lng;
466 
467  $lng->loadLanguageModule("block");
468 
469  require_once("Services/Form/classes/class.ilPropertyFormGUI.php");
470 
471  $this->form_gui = new ilPropertyFormGUI();
472 
473  // Property Title
474  $text_input = new ilTextInputGUI($lng->txt("block_feed_block_title"), "block_title");
475  $text_input->setInfo("");
476  $text_input->setRequired(true);
477  $text_input->setMaxLength(200);
478  $this->form_gui->addItem($text_input);
479 
480  // Property FeedUrl
481  $text_input = new ilFeedUrlInputGUI($lng->txt("block_feed_block_feed_url"), "block_feed_url");
482  $text_input->setInfo($lng->txt("block_feed_block_feed_url_info"));
483  $text_input->setRequired(true);
484  $text_input->setMaxLength(250);
485  $this->form_gui->addItem($text_input);
486 
487 
488  // save and cancel commands
489  if (in_array($a_mode, array(IL_FORM_CREATE,IL_FORM_RE_CREATE)))
490  {
491  $this->form_gui->addCommandButton("saveFeedBlock", $lng->txt("save"));
492  $this->form_gui->addCommandButton("cancelSaveFeedBlock", $lng->txt("cancel"));
493  }
494  else
495  {
496  $this->form_gui->addCommandButton("updateFeedBlock", $lng->txt("save"));
497  $this->form_gui->addCommandButton("cancelUpdateFeedBlock", $lng->txt("cancel"));
498  }
499 
500  $this->form_gui->setTitle($lng->txt("block_feed_block_head"));
501  $this->form_gui->setFormAction($this->ctrl->getFormAction($this));
502 
503  $this->prepareFormFeedBlock($this->form_gui);
504 
505  }
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.
global $lng
Definition: privfeed.php:17
+ Here is the call graph for this function:

◆ initImportForm()

ilExternalFeedBlockGUI::initImportForm (   $a_new_type = "")

Init object import form.

Parameters
stringnew type

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

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

Referenced by create(), and importFile().

389  {
390  global $lng, $ilCtrl;
391 
392  $lng->loadLanguageModule("feed");
393 
394  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
395  $this->form = new ilPropertyFormGUI();
396  $this->form->setTarget("_top");
397 
398  // Import file
399  include_once("./Services/Form/classes/class.ilFileInputGUI.php");
400  $fi = new ilFileInputGUI($lng->txt("import_file"), "importfile");
401  $fi->setSuffixes(array("zip"));
402  $fi->setRequired(true);
403  $this->form->addItem($fi);
404 
405  $this->form->addCommandButton("importFile", $lng->txt("import"));
406  $this->form->addCommandButton("cancelSaveFeedBlock", $lng->txt("cancel"));
407  $this->form->setTitle($lng->txt($a_new_type."_import"));
408 
409  $ilCtrl->setParameter($this, "new_type", $a_new_type);
410  $this->form->setFormAction($ilCtrl->getFormAction($this));
411  }
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.
global $lng
Definition: privfeed.php:17
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 53 of file class.ilExternalFeedBlockGUI.php.

Referenced by fillRow().

54  {
55  return true;
56  }
+ 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 512 of file class.ilExternalFeedBlockGUI.php.

References $ilCtrl, $ref_id, getBlockType(), and ilExternalFeedBlockGUIGen\getGuiObject().

513  {
514  global $ilCtrl;
515 
516  $ref_id = $this->getGuiObject()->save($a_feed_block);
517  $a_feed_block->setType($this->getBlockType());
518  //$a_feed_block->setContextObjId($ilCtrl->getContextObjId());
519  //$a_feed_block->setContextObjType($ilCtrl->getContextObjType());
520  }
global $ilCtrl
Definition: ilias.php:18
$ref_id
Definition: sahs_server.php:39
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 86 of file class.ilExternalFeedBlockGUI.php.

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

87  {
88  global $ilCtrl;
89 
90  // init block
91  $this->feed_block = $a_block;
92  $this->setTitle($this->feed_block->getTitle());
93  $this->setBlockId($this->feed_block->getId());
94 
95  // get feed object
96  include_once("./Services/Feeds/classes/class.ilExternalFeed.php");
97  $this->feed = new ilExternalFeed();
98  $this->feed->setUrl($this->feed_block->getFeedUrl());
99 
100  // init details
101  $this->setAvailableDetailLevels(2);
102 
103  $ilCtrl->setParameter($this, "block_id", $this->feed_block->getId());
104  }
Handles external Feeds via Magpie libaray.
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 308 of file class.ilExternalFeedBlockGUI.php.

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

309  {
310  global $lng, $ilCtrl;
311 
312  include_once("./Services/News/classes/class.ilNewsItem.php");
313 
314  $this->feed->fetch();
315  foreach($this->feed->getItems() as $item)
316  {
317  if ($item->getId() == $_GET["feed_item_id"])
318  {
319  $c_item = $item;
320  break;
321  }
322  }
323 
324  $tpl = new ilTemplate("tpl.show_feed_item.html", true, true, "Services/Feeds");
325 
326  if (is_object($c_item))
327  {
328  if (trim($c_item->getSummary()) != "") // summary
329  {
330  $tpl->setCurrentBlock("content");
331  $tpl->setVariable("VAL_CONTENT", $c_item->getSummary());
332  $tpl->parseCurrentBlock();
333  }
334  if (trim($c_item->getDate()) != "" || trim($c_item->getAuthor()) != "") // date
335  {
336  $tpl->setCurrentBlock("date_author");
337  if (trim($c_item->getAuthor()) != "")
338  {
339  $tpl->setVariable("VAL_AUTHOR", $c_item->getAuthor()." - ");
340  }
341  $tpl->setVariable("VAL_DATE", $c_item->getDate());
342  $tpl->parseCurrentBlock();
343  }
344 
345  if (trim($c_item->getLink()) != "") // link
346  {
347  $tpl->setCurrentBlock("plink");
348  $tpl->setVariable("HREF_LINK", $c_item->getLink());
349  $tpl->setVariable("TXT_LINK", $lng->txt("feed_open_source_page"));
350  $tpl->parseCurrentBlock();
351  }
352  $tpl->setVariable("VAL_TITLE", $c_item->getTitle()); // title
353  }
354 
355  include_once("./Services/PersonalDesktop/classes/class.ilPDContentBlockGUI.php");
356  $content_block = new ilPDContentBlockGUI();
357  $content_block->setContent($tpl->get());
358  $content_block->setTitle($this->getTitle());
359  $content_block->setImage(ilUtil::getImagePath("icon_feed.svg"));
360  $content_block->addHeaderCommand($ilCtrl->getParentReturn($this),
361  $lng->txt("close"), true);
362 
363  return $content_block->getHTML();
364  }
$_GET["client_id"]
global $tpl
Definition: ilias.php:8
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
global $lng
Definition: privfeed.php:17
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 22 of file class.ilExternalFeedBlockGUI.php.


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