24include_once(
"./Services/Block/classes/class.ilBlockGUI.php");
25include_once(
"./Services/Block/classes/class.ilExternalFeedBlockGUIGen.php");
26include_once(
"./Services/Feeds/classes/class.ilExternalFeed.php");
55 $this->ctrl =
$DIC->ctrl();
56 $this->lng =
$DIC->language();
57 $this->
user = $DIC->user();
58 $this->access =
$DIC->access();
62 parent::__construct();
64 $lng->loadLanguageModule(
"feed");
67 $this->
setRowTemplate(
"tpl.block_external_feed_row.html",
"Services/Feeds");
102 case "saveFeedBlock":
103 case "updateFeedBlock":
104 case "editFeedBlock":
106 case "confirmDeleteFeedBlock":
124 $this->feed_block = $a_block;
125 $this->
setTitle($this->feed_block->getTitle());
126 $this->
setBlockId($this->feed_block->getId());
129 include_once(
"./Services/Feeds/classes/class.ilExternalFeed.php");
131 $this->feed->setUrl($this->feed_block->getFeedUrl());
136 $ilCtrl->setParameter($this,
"block_id", $this->feed_block->getId());
146 $next_class =
$ilCtrl->getNextClass();
147 $cmd =
$ilCtrl->getCmd(
"getHTML");
149 switch ($next_class) {
151 return $this->$cmd();
163 parent::fillDataSection();
180 if (
$ilSetting->get(
"block_limit_pdfeed") == 0) {
191 $this->feed->fetch();
192 $this->
setData($this->feed->getItems());
197 "external_feed_block_id",
210 "confirmDeleteFeedBlock"
214 $ilCtrl->setParameter($this,
"external_feed_block_id",
"");
219 (
$ilUser->getPref(
"il_feed_js") ==
"n" &&
$_SESSION[
"il_feed_js"] !=
"y")) {
223 return parent::getHTML() . $add;
231 if (
$ilCtrl->getCmdClass() !=
"ilcolumngui" &&
$ilCtrl->getCmd() !=
"enableJS") {
236 if ($sess_feed_js !=
"n" &&
237 (
$ilUser->getPref(
"il_feed_js") !=
"n" || $sess_feed_js ==
"y")) {
239 if (!$this->feed->checkCacheHit()) {
259 $rel_tpl =
new ilTemplate(
"tpl.dynamic_reload.html",
true,
true,
"Services/Feeds");
260 $rel_tpl->setVariable(
"TXT_LOADING",
$lng->txt(
"feed_loading_feed"));
261 $rel_tpl->setVariable(
"BLOCK_ID",
"block_pdfeed_" . $this->
getBlockId());
262 $rel_tpl->setVariable(
264 $ilCtrl->getLinkTargetByClass(
"ilcolumngui",
"updateBlock",
"",
true)
268 $rel_tpl->setVariable(
"TXT_FEED_CLICK_HERE",
$lng->txt(
"feed_no_js_click_here"));
269 $rel_tpl->setVariable(
271 $ilCtrl->getLinkTargetByClass(
"ilpdexternalfeedblockgui",
"disableJS")
274 return $rel_tpl->get();
287 $rel_tpl =
new ilTemplate(
"tpl.js_enabler.html",
true,
true,
"Services/Feeds");
288 $rel_tpl->setVariable(
"BLOCK_ID",
"block_pdfeed_" . $this->
getBlockId());
289 $rel_tpl->setVariable(
291 $ilCtrl->getLinkTargetByClass(
"ilpdexternalfeedblockgui",
"enableJS",
true)
294 return $rel_tpl->get();
304 $ilUser->writePref(
"il_feed_js",
"n");
305 $ilCtrl->redirectByClass(
"ilpersonaldesktopgui",
"show");
313 $ilUser->writePref(
"il_feed_js",
"y");
325 $ilCtrl->setParameter($this,
"feed_item_id", $item->getId());
326 $this->tpl->setVariable(
"VAL_TITLE", $item->getTitle());
327 $this->tpl->setVariable(
329 $ilCtrl->getLinkTarget($this,
"showFeedItem")
331 $ilCtrl->setParameter($this,
"feed_item_id",
"");
342 return '<div class="small">' . ((int) count($this->
getData())) .
" " .
$lng->txt(
"feed_feed_items") .
"</div>";
353 include_once(
"./Services/News/classes/class.ilNewsItem.php");
355 $this->feed->fetch();
356 foreach ($this->feed->getItems() as $item) {
357 if ($item->getId() ==
$_GET[
"feed_item_id"]) {
363 $tpl =
new ilTemplate(
"tpl.show_feed_item.html",
true,
true,
"Services/Feeds");
365 if (is_object($c_item)) {
366 if (trim($c_item->getSummary()) !=
"") {
367 $tpl->setCurrentBlock(
"content");
368 $tpl->setVariable(
"VAL_CONTENT", $c_item->getSummary());
369 $tpl->parseCurrentBlock();
371 if (trim($c_item->getDate()) !=
"" || trim($c_item->getAuthor()) !=
"") {
372 $tpl->setCurrentBlock(
"date_author");
373 if (trim($c_item->getAuthor()) !=
"") {
374 $tpl->setVariable(
"VAL_AUTHOR", $c_item->getAuthor() .
" - ");
376 $tpl->setVariable(
"VAL_DATE", $c_item->getDate());
377 $tpl->parseCurrentBlock();
380 if (trim($c_item->getLink()) !=
"") {
381 $tpl->setCurrentBlock(
"plink");
382 $tpl->setVariable(
"HREF_LINK", $c_item->getLink());
383 $tpl->setVariable(
"TXT_LINK",
$lng->txt(
"feed_open_source_page"));
384 $tpl->parseCurrentBlock();
386 $tpl->setVariable(
"VAL_TITLE", $c_item->getTitle());
389 include_once(
"./Services/PersonalDesktop/classes/class.ilPDContentBlockGUI.php");
391 $content_block->setContent(
$tpl->get());
392 $content_block->setTitle($this->
getTitle());
394 $content_block->addHeaderCommand(
395 $ilCtrl->getParentReturn($this),
396 $lng->txt(
"selected_items_back")
399 return $content_block->getHTML();
420 $lng->loadLanguageModule(
"block");
422 require_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
428 $text_input->setInfo(
"");
429 $text_input->setRequired(
true);
430 $text_input->setMaxLength(200);
431 $this->form_gui->addItem($text_input);
435 $text_input->setInfo(
$lng->txt(
"block_feed_block_feed_url_info"));
436 $text_input->setRequired(
true);
437 $text_input->setMaxLength(250);
438 $this->form_gui->addItem($text_input);
443 $this->form_gui->addCommandButton(
"saveFeedBlock",
$lng->txt(
"save"));
444 $this->form_gui->addCommandButton(
"cancelSaveFeedBlock",
$lng->txt(
"cancel"));
446 $this->form_gui->addCommandButton(
"updateFeedBlock",
$lng->txt(
"save"));
447 $this->form_gui->addCommandButton(
"cancelUpdateFeedBlock",
$lng->txt(
"cancel"));
450 $this->form_gui->setTitle(
$lng->txt(
"block_feed_block_head"));
451 $this->form_gui->setFormAction($this->ctrl->getFormAction($this));
465 $a_feed_block->setContextObjId(
$ilCtrl->getContextObjId());
466 $a_feed_block->setContextObjType(
$ilCtrl->getContextObjType());
467 $a_feed_block->setType(
"pdfeed");
478 include_once(
"Services/Utilities/classes/class.ilConfirmationGUI.php");
482 $c_gui->setFormAction(
$ilCtrl->getFormAction($this,
"deleteFeedBlock"));
483 $c_gui->setHeaderText(
$lng->txt(
"info_delete_sure"));
484 $c_gui->setCancel(
$lng->txt(
"cancel"),
"exitDeleteFeedBlock");
485 $c_gui->setConfirm(
$lng->txt(
"confirm"),
"deleteFeedBlock");
489 "external_feed_block_id",
490 $this->feed_block->getId(),
491 $this->feed_block->getTitle(),
495 return $c_gui->getHTML();
505 $ilCtrl->returnToParent($this);
515 $this->feed_block->delete();
516 $ilCtrl->returnToParent($this);
An exception for terminatinating execution or to throw for unit testing.
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.
setTitle($a_title)
Set Title.
setBlockId($a_block_id=0)
Set Block Id.
setEnableNumInfo($a_enablenuminfo)
Set Enable Item Number Info.
addBlockCommand( $a_href, $a_text, $a_target="", $a_img="", $a_right_aligned=false, $a_checked=false, $a_html="")
Add Block Command.
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 library.
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.
__construct()
Constructor.
exitDeleteFeedBlock()
Cancel deletion of feed block.
fillRow($item)
Fill feed item row.
deleteFeedBlock()
Delete feed block.
executeCommand()
execute command
confirmDeleteFeedBlock()
Confirmation of feed block deletion.
fillDataSection()
Fill data section.
prepareSaveFeedBlock(&$a_feed_block)
FORM FeedBlock: Prepare Saving of FeedBlock.
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)