24 include_once(
"./Services/Block/classes/class.ilBlockGUI.php");
25 include_once(
"./Services/Block/classes/class.ilExternalFeedBlockGUIGen.php");
26 include_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();
60 $lng = $DIC->language();
62 parent::__construct();
64 $lng->loadLanguageModule(
"feed");
67 $this->
setRowTemplate(
"tpl.block_external_feed_row.html",
"Services/Feeds");
75 return self::$block_type;
99 case "updateFeedBlock":
100 case "editFeedBlock":
102 case "confirmDeleteFeedBlock":
120 $this->feed_block = $a_block;
121 $this->
setTitle($this->feed_block->getTitle());
122 $this->
setBlockId($this->feed_block->getId());
125 include_once(
"./Services/Feeds/classes/class.ilExternalFeed.php");
127 $this->feed->setUrl($this->feed_block->getFeedUrl());
132 $ilCtrl->setParameter($this,
"block_id", $this->feed_block->getId());
142 $next_class =
$ilCtrl->getNextClass();
143 $cmd =
$ilCtrl->getCmd(
"getHTML");
145 switch ($next_class) {
147 return $this->$cmd();
159 parent::fillDataSection();
176 if (
$ilSetting->get(
"block_limit_pdfeed") == 0) {
187 $this->feed->fetch();
188 $this->
setData($this->feed->getItems());
193 "external_feed_block_id",
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()) {
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();
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(
"ilpersonaldesktopgui",
"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",
"");
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());
385 include_once(
"./Services/PersonalDesktop/classes/class.ilPDContentBlockGUI.php");
387 $content_block->setContent(
$tpl->get());
388 $content_block->setTitle($this->
getTitle());
390 $content_block->addHeaderCommand(
391 $ilCtrl->getParentReturn($this),
392 $lng->txt(
"selected_items_back")
395 return $content_block->getHTML();
416 $lng->loadLanguageModule(
"block");
418 require_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
425 $text_input->setRequired(
true);
426 $text_input->setMaxLength(200);
427 $this->form_gui->addItem($text_input);
431 $text_input->
setInfo(
$lng->txt(
"block_feed_block_feed_url_info"));
432 $text_input->setRequired(
true);
433 $text_input->setMaxLength(250);
434 $this->form_gui->addItem($text_input);
439 $this->form_gui->addCommandButton(
"saveFeedBlock",
$lng->txt(
"save"));
440 $this->form_gui->addCommandButton(
"cancelSaveFeedBlock",
$lng->txt(
"cancel"));
442 $this->form_gui->addCommandButton(
"updateFeedBlock",
$lng->txt(
"save"));
443 $this->form_gui->addCommandButton(
"cancelUpdateFeedBlock",
$lng->txt(
"cancel"));
446 $this->form_gui->setTitle(
$lng->txt(
"block_feed_block_head"));
447 $this->form_gui->setFormAction($this->ctrl->getFormAction($this));
461 $a_feed_block->setContextObjId(
$ilCtrl->getContextObjId());
462 $a_feed_block->setContextObjType(
$ilCtrl->getContextObjType());
463 $a_feed_block->setType(
"pdfeed");
474 include_once(
"Services/Utilities/classes/class.ilConfirmationGUI.php");
478 $c_gui->setFormAction(
$ilCtrl->getFormAction($this,
"deleteFeedBlock"));
479 $c_gui->setHeaderText(
$lng->txt(
"info_delete_sure"));
480 $c_gui->setCancel(
$lng->txt(
"cancel"),
"exitDeleteFeedBlock");
481 $c_gui->setConfirm(
$lng->txt(
"confirm"),
"deleteFeedBlock");
485 "external_feed_block_id",
486 $this->feed_block->getId(),
487 $this->feed_block->getTitle(),
491 return $c_gui->getHTML();
501 $ilCtrl->returnToParent($this);
511 $this->feed_block->delete();
512 $ilCtrl->returnToParent($this);
createFeedBlock()
FORM FeedBlock: Create ExternalFeedBlock.
fillRow($item)
Fill feed item row.
prepareFormFeedBlock(&$a_form_gui)
FORM FeedBlock: Prepare form.
getOverview()
Get overview.
setDataSection($a_content)
Call this from overwritten fillDataSection(), if standard row based data is not used.
setBlock($a_block)
Do most of the initialisation.
BlockGUI class for external feed block on the personal desktop.
setEnableNumInfo($a_enablenuminfo)
Set Enable Item Number Info.
confirmDeleteFeedBlock()
Confirmation of feed block deletion.
Handles external Feeds via Magpie library.
deleteFeedBlock()
Delete feed block.
GUI class for external news feed custom block.
getHTML()
Get block HTML code.
setTitle($a_title)
Set Title.
fillDataSection()
Fill data section.
setBlockId($a_block_id=0)
Set Block Id.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static getScreenMode()
Get Screen Mode for current command.
setData($a_data)
Set Data.
prepareSaveFeedBlock(&$a_feed_block)
FORM FeedBlock: Prepare Saving of FeedBlock.
special template class to simplify handling of ITX/PEAR
setAvailableDetailLevels($a_max, $a_min=0)
Set Available Detail Levels.
This class represents a text property in a property form.
getBlockId()
Get Block Id.
showFeedItem()
Show Feed Item.
create()
Create Form for Block.
addBlockCommand( $a_href, $a_text, $a_target="", $a_img="", $a_right_aligned=false, $a_checked=false, $a_html="")
Add Block Command.
initFormFeedBlock($a_mode)
FORM FeedBlock: Init form.
setLimit($a_limit)
Set Limit.
exitDeleteFeedBlock()
Cancel deletion of feed block.
executeCommand()
execute command
BlockGUI class for (centered) Content on Personal Desktop.
setRowTemplate($a_rowtemplatename, $a_rowtemplatedir="")
Set Row Template Name.
getCurrentDetailLevel()
Get Current Detail Level.
Confirmation screen class.
__construct()
Constructor.