24include_once(
"./Services/Block/classes/class.ilBlockGUI.php");
25include_once(
"./Services/Block/classes/class.ilExternalFeedBlockGUIGen.php");
26include_once(
"./Services/Feeds/classes/class.ilExternalFeed.php");
50 parent::__construct();
53 $lng->loadLanguageModule(
"feed");
56 $this->
setRowTemplate(
"tpl.block_external_feed_row.html",
"Services/Feeds");
91 case "updateFeedBlock":
94 case "confirmDeleteFeedBlock":
112 $this->feed_block = $a_block;
113 $this->
setTitle($this->feed_block->getTitle());
114 $this->
setBlockId($this->feed_block->getId());
117 include_once(
"./Services/Feeds/classes/class.ilExternalFeed.php");
119 $this->feed->setUrl($this->feed_block->getFeedUrl());
124 $ilCtrl->setParameter($this,
"block_id", $this->feed_block->getId());
134 $next_class =
$ilCtrl->getNextClass();
140 return $this->
$cmd();
155 parent::fillDataSection();
172 if (
$ilSetting->get(
"block_limit_pdfeed") == 0)
186 $this->feed->fetch();
187 $this->
setData($this->feed->getItems());
190 $ilCtrl->setParameter($this,
"external_feed_block_id",
193 $ilCtrl->getLinkTarget($this,
197 $ilCtrl->getLinkTarget($this,
198 "confirmDeleteFeedBlock"),
199 $lng->txt(
"delete"));
200 $ilCtrl->setParameter($this,
"external_feed_block_id",
"");
210 return parent::getHTML().$add;
217 if (
$ilCtrl->getCmdClass() !=
"ilcolumngui" &&
$ilCtrl->getCmd() !=
"enableJS")
224 if ($sess_feed_js !=
"n" &&
225 (
$ilUser->getPref(
"il_feed_js") !=
"n" || $sess_feed_js ==
"y"))
228 if (!$this->feed->checkCacheHit())
242 $ilCtrl->setParameterByClass(
"ilcolumngui",
"block_id",
245 $rel_tpl =
new ilTemplate(
"tpl.dynamic_reload.html",
true,
true,
"Services/Feeds");
246 $rel_tpl->setVariable(
"TXT_LOADING",
$lng->txt(
"feed_loading_feed"));
247 $rel_tpl->setVariable(
"BLOCK_ID",
"block_pdfeed_".$this->
getBlockId());
248 $rel_tpl->setVariable(
"TARGET",
249 $ilCtrl->getLinkTargetByClass(
"ilcolumngui",
"updateBlock",
"",
true));
252 $rel_tpl->setVariable(
"TXT_FEED_CLICK_HERE",
$lng->txt(
"feed_no_js_click_here"));
253 $rel_tpl->setVariable(
"TARGET_NO_JS",
254 $ilCtrl->getLinkTargetByClass(
"ilpdexternalfeedblockgui",
"disableJS"));
256 return $rel_tpl->get();
263 $ilCtrl->setParameterByClass(
"ilcolumngui",
"block_id",
266 $rel_tpl =
new ilTemplate(
"tpl.js_enabler.html",
true,
true,
"Services/Feeds");
267 $rel_tpl->setVariable(
"BLOCK_ID",
"block_pdfeed_".$this->
getBlockId());
268 $rel_tpl->setVariable(
"TARGET",
269 $ilCtrl->getLinkTargetByClass(
"ilpdexternalfeedblockgui",
"enableJS",
true));
271 return $rel_tpl->get();
280 $ilUser->writePref(
"il_feed_js",
"n");
281 $ilCtrl->redirectByClass(
"ilpersonaldesktopgui",
"show");
289 $ilUser->writePref(
"il_feed_js",
"y");
301 $ilCtrl->setParameter($this,
"feed_item_id", $item->getId());
302 $this->tpl->setVariable(
"VAL_TITLE", $item->getTitle());
303 $this->tpl->setVariable(
"HREF_SHOW",
304 $ilCtrl->getLinkTarget($this,
"showFeedItem"));
305 $ilCtrl->setParameter($this,
"feed_item_id",
"");
316 return '<div class="small">'.((int) count($this->
getData())).
" ".$lng->txt(
"feed_feed_items").
"</div>";
326 include_once(
"./Services/News/classes/class.ilNewsItem.php");
328 $this->feed->fetch();
329 foreach($this->feed->getItems() as $item)
331 if ($item->getId() ==
$_GET[
"feed_item_id"])
338 $tpl =
new ilTemplate(
"tpl.show_feed_item.html",
true,
true,
"Services/Feeds");
340 if (is_object($c_item))
342 if (trim($c_item->getSummary()) !=
"")
344 $tpl->setCurrentBlock(
"content");
345 $tpl->setVariable(
"VAL_CONTENT", $c_item->getSummary());
346 $tpl->parseCurrentBlock();
348 if (trim($c_item->getDate()) !=
"" || trim($c_item->getAuthor()) !=
"")
350 $tpl->setCurrentBlock(
"date_author");
351 if (trim($c_item->getAuthor()) !=
"")
353 $tpl->setVariable(
"VAL_AUTHOR", $c_item->getAuthor().
" - ");
355 $tpl->setVariable(
"VAL_DATE", $c_item->getDate());
356 $tpl->parseCurrentBlock();
359 if (trim($c_item->getLink()) !=
"")
361 $tpl->setCurrentBlock(
"plink");
362 $tpl->setVariable(
"HREF_LINK", $c_item->getLink());
363 $tpl->setVariable(
"TXT_LINK",
$lng->txt(
"feed_open_source_page"));
364 $tpl->parseCurrentBlock();
366 $tpl->setVariable(
"VAL_TITLE", $c_item->getTitle());
369 include_once(
"./Services/PersonalDesktop/classes/class.ilPDContentBlockGUI.php");
371 $content_block->setContent(
$tpl->get());
372 $content_block->setTitle($this->
getTitle());
374 $content_block->addHeaderCommand(
$ilCtrl->getParentReturn($this),
375 $lng->txt(
"selected_items_back"));
377 return $content_block->getHTML();
398 $lng->loadLanguageModule(
"block");
400 include(
"Services/Form/classes/class.ilPropertyFormGUI.php");
406 $text_input->setInfo(
"");
407 $text_input->setRequired(
true);
408 $text_input->setMaxLength(200);
409 $this->form_gui->addItem($text_input);
413 $text_input->setInfo(
$lng->txt(
"block_feed_block_feed_url_info"));
414 $text_input->setRequired(
true);
415 $text_input->setMaxLength(250);
416 $this->form_gui->addItem($text_input);
422 $this->form_gui->addCommandButton(
"saveFeedBlock",
$lng->txt(
"save"));
423 $this->form_gui->addCommandButton(
"cancelSaveFeedBlock",
$lng->txt(
"cancel"));
427 $this->form_gui->addCommandButton(
"updateFeedBlock",
$lng->txt(
"save"));
428 $this->form_gui->addCommandButton(
"cancelUpdateFeedBlock",
$lng->txt(
"cancel"));
431 $this->form_gui->setTitle(
$lng->txt(
"block_feed_block_head"));
432 $this->form_gui->setFormAction($this->ctrl->getFormAction($this));
447 $a_feed_block->setContextObjId(
$ilCtrl->getContextObjId());
448 $a_feed_block->setContextObjType(
$ilCtrl->getContextObjType());
449 $a_feed_block->setType(
"pdfeed");
459 include_once(
"Services/Utilities/classes/class.ilConfirmationGUI.php");
463 $c_gui->setFormAction(
$ilCtrl->getFormAction($this,
"deleteFeedBlock"));
464 $c_gui->setHeaderText(
$lng->txt(
"info_delete_sure"));
465 $c_gui->setCancel(
$lng->txt(
"cancel"),
"exitDeleteFeedBlock");
466 $c_gui->setConfirm(
$lng->txt(
"confirm"),
"deleteFeedBlock");
469 $c_gui->addItem(
"external_feed_block_id",
470 $this->feed_block->getId(), $this->feed_block->getTitle(),
473 return $c_gui->getHTML();
483 $ilCtrl->returnToParent($this);
493 $this->feed_block->delete();
494 $ilCtrl->returnToParent($this);
setRowTemplate($a_rowtemplatename, $a_rowtemplatedir="")
Set Row Template Name.
setLimit($a_limit)
Set Limit.
getCurrentDetailLevel()
Get Current Detail Level.
getBlockId()
Get Block Id.
setAvailableDetailLevels($a_max, $a_min=0)
Set Available Detail Levels.
setData($a_data)
Set Data.
setDataSection($a_content)
Call this from overwritten fillDataSection(), if standard row based data is not used.
addBlockCommand($a_href, $a_text, $a_target="", $a_img="", $a_right_aligned=false, $a_checked=false, $a_html="")
Add Block Command.
setTitle($a_title)
Set Title.
setBlockId($a_block_id=0)
Set Block Id.
setEnableNumInfo($a_enablenuminfo)
Set Enable Item Number Info.
Confirmation screen class.
GUI class for external news feed custom block.
createFeedBlock()
FORM FeedBlock: Create ExternalFeedBlock.
prepareFormFeedBlock(&$a_form_gui)
FORM FeedBlock: Prepare form.
Handles external Feeds via Magpie libaray.
BlockGUI class for (centered) Content on Personal Desktop.
BlockGUI class for external feed block on the personal desktop.
static isRepositoryObject()
Get block type.
static getBlockType()
Get block type.
setBlock($a_block)
Do most of the initialisation.
showFeedItem()
Show Feed Item.
static getScreenMode()
Get Screen Mode for current command.
getOverview()
Get overview.
getHTML()
Get block HTML code.
create()
Create Form for Block.
initFormFeedBlock($a_mode)
FORM FeedBlock: Init form.
exitDeleteFeedBlock()
Cancel deletion of feed block.
& executeCommand()
execute command
fillRow($item)
Fill feed item row.
deleteFeedBlock()
Delete feed block.
confirmDeleteFeedBlock()
Confirmation of feed block deletion.
fillDataSection()
Fill data section.
prepareSaveFeedBlock(&$a_feed_block)
FORM FeedBlock: Prepare Saving of FeedBlock.
ilPDExternalFeedBlockGUI()
Constructor.
special template class to simplify handling of ITX/PEAR
This class represents a text property in a property form.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)