24include_once(
"./Services/Block/classes/class.ilBlockGUI.php");
25include_once(
"./Services/Block/classes/class.ilExternalFeedBlockGUIGen.php");
26include_once(
"./Services/Feeds/classes/class.ilExternalFeed.php");
60 $this->ctrl =
$DIC->ctrl();
61 $this->lng =
$DIC->language();
62 $this->
user = $DIC->user();
63 $this->access =
$DIC->access();
69 $lng->loadLanguageModule(
"feed");
72 $this->setRowTemplate(
"tpl.block_external_feed_row.html",
"Services/Feeds");
103 case "saveFeedBlock":
104 case "updateFeedBlock":
105 case "editFeedBlock":
107 case "confirmDeleteFeedBlock":
125 $this->feed_block = $a_block;
126 $this->setTitle($this->feed_block->getTitle());
127 $this->setBlockId($this->feed_block->getId());
130 include_once(
"./Services/Feeds/classes/class.ilExternalFeed.php");
132 $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();
162 } elseif (count($this->getData()) > 0) {
163 parent::fillDataSection();
180 if (
$ilSetting->get(
"block_limit_pdfeed") == 0) {
187 $this->feed->fetch();
188 $this->setData($this->feed->getItems());
193 "external_feed_block_id",
196 $this->addBlockCommand(
203 $this->addBlockCommand(
206 "confirmDeleteFeedBlock"
210 $ilCtrl->setParameter($this,
"external_feed_block_id",
"");
215 (
$ilUser->getPref(
"il_feed_js") ==
"n" &&
$_SESSION[
"il_feed_js"] !=
"y")) {
219 return parent::getHTML() . $add;
227 if (
$ilCtrl->getCmdClass() !=
"ilcolumngui" &&
$ilCtrl->getCmd() !=
"enableJS") {
232 if ($sess_feed_js !=
"n" &&
233 (
$ilUser->getPref(
"il_feed_js") !=
"n" || $sess_feed_js ==
"y")) {
235 if (!$this->feed->checkCacheHit()) {
252 "block_pdfeed_" . $this->getBlockId()
255 $rel_tpl =
new ilTemplate(
"tpl.dynamic_reload.html",
true,
true,
"Services/Feeds");
256 $rel_tpl->setVariable(
"TXT_LOADING",
$lng->txt(
"feed_loading_feed"));
257 $rel_tpl->setVariable(
"BLOCK_ID",
"block_pdfeed_" . $this->getBlockId());
258 $rel_tpl->setVariable(
260 $ilCtrl->getLinkTargetByClass(
"ilcolumngui",
"updateBlock",
"",
true)
264 $rel_tpl->setVariable(
"TXT_FEED_CLICK_HERE",
$lng->txt(
"feed_no_js_click_here"));
265 $rel_tpl->setVariable(
267 $ilCtrl->getLinkTargetByClass(
"ilpdexternalfeedblockgui",
"disableJS")
270 return $rel_tpl->get();
280 "block_pdfeed_" . $this->getBlockId()
283 $rel_tpl =
new ilTemplate(
"tpl.js_enabler.html",
true,
true,
"Services/Feeds");
284 $rel_tpl->setVariable(
"BLOCK_ID",
"block_pdfeed_" . $this->getBlockId());
285 $rel_tpl->setVariable(
287 $ilCtrl->getLinkTargetByClass(
"ilpdexternalfeedblockgui",
"enableJS",
true)
290 return $rel_tpl->get();
300 $ilUser->writePref(
"il_feed_js",
"n");
301 $ilCtrl->redirectByClass(
"ildashboardgui",
"show");
309 $ilUser->writePref(
"il_feed_js",
"y");
321 $ilCtrl->setParameter($this,
"feed_item_id", $item->getId());
322 $this->tpl->setVariable(
"VAL_TITLE", $item->getTitle());
323 $this->tpl->setVariable(
325 $ilCtrl->getLinkTarget($this,
"showFeedItem")
327 $ilCtrl->setParameter($this,
"feed_item_id",
"");
337 $this->setEnableNumInfo(
false);
338 return '<div class="small">' . ((int) count($this->getData())) .
" " .
$lng->txt(
"feed_feed_items") .
"</div>";
349 include_once(
"./Services/News/classes/class.ilNewsItem.php");
351 $this->feed->fetch();
352 foreach ($this->feed->getItems() as $item) {
353 if ($item->getId() ==
$_GET[
"feed_item_id"]) {
359 $tpl =
new ilTemplate(
"tpl.show_feed_item.html",
true,
true,
"Services/Feeds");
361 if (is_object($c_item)) {
362 if (trim($c_item->getSummary()) !=
"") {
363 $tpl->setCurrentBlock(
"content");
364 $tpl->setVariable(
"VAL_CONTENT", $c_item->getSummary());
365 $tpl->parseCurrentBlock();
367 if (trim($c_item->getDate()) !=
"" || trim($c_item->getAuthor()) !=
"") {
368 $tpl->setCurrentBlock(
"date_author");
369 if (trim($c_item->getAuthor()) !=
"") {
370 $tpl->setVariable(
"VAL_AUTHOR", $c_item->getAuthor() .
" - ");
372 $tpl->setVariable(
"VAL_DATE", $c_item->getDate());
373 $tpl->parseCurrentBlock();
376 if (trim($c_item->getLink()) !=
"") {
377 $tpl->setCurrentBlock(
"plink");
378 $tpl->setVariable(
"HREF_LINK", $c_item->getLink());
379 $tpl->setVariable(
"TXT_LINK",
$lng->txt(
"feed_open_source_page"));
380 $tpl->parseCurrentBlock();
382 $tpl->setVariable(
"VAL_TITLE", $c_item->getTitle());
386 $content_block->setContent(
$tpl->get());
387 $content_block->setTitle($this->getTitle());
389 return $content_block->getHTML();
397 return $this->createFeedBlock();
410 $lng->loadLanguageModule(
"block");
412 require_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
418 $text_input->setInfo(
"");
419 $text_input->setRequired(
true);
420 $text_input->setMaxLength(200);
421 $this->form_gui->addItem($text_input);
425 $text_input->setInfo(
$lng->txt(
"block_feed_block_feed_url_info"));
426 $text_input->setRequired(
true);
427 $text_input->setMaxLength(250);
428 $this->form_gui->addItem($text_input);
432 if (in_array($a_mode, array(self::FORM_CREATE, self::FORM_RE_CREATE))) {
433 $this->form_gui->addCommandButton(
"saveFeedBlock",
$lng->txt(
"save"));
434 $this->form_gui->addCommandButton(
"cancelSaveFeedBlock",
$lng->txt(
"cancel"));
436 $this->form_gui->addCommandButton(
"updateFeedBlock",
$lng->txt(
"save"));
437 $this->form_gui->addCommandButton(
"cancelUpdateFeedBlock",
$lng->txt(
"cancel"));
440 $this->form_gui->setTitle(
$lng->txt(
"block_feed_block_head"));
441 $this->form_gui->setFormAction($this->ctrl->getFormAction($this));
443 $this->prepareFormFeedBlock($this->form_gui);
455 $a_feed_block->setContextObjId(
$ilCtrl->getContextObjId());
456 $a_feed_block->setContextObjType(
$ilCtrl->getContextObjType());
457 $a_feed_block->setType(
"pdfeed");
468 include_once(
"Services/Utilities/classes/class.ilConfirmationGUI.php");
472 $c_gui->setFormAction(
$ilCtrl->getFormAction($this,
"deleteFeedBlock"));
473 $c_gui->setHeaderText(
$lng->txt(
"info_delete_sure"));
474 $c_gui->setCancel(
$lng->txt(
"cancel"),
"exitDeleteFeedBlock");
475 $c_gui->setConfirm(
$lng->txt(
"confirm"),
"deleteFeedBlock");
479 "external_feed_block_id",
480 $this->feed_block->getId(),
481 $this->feed_block->getTitle(),
485 return $c_gui->getHTML();
495 $ilCtrl->returnToParent($this);
505 $this->feed_block->delete();
506 $ilCtrl->returnToParent($this);
An exception for terminatinating execution or to throw for unit testing.
Confirmation screen class.
BlockGUI class for (centered) Content on Personal Desktop.
Handles external Feeds via Magpie library.
BlockGUI class for external feed block on the personal desktop.
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)
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl