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");
50 parent::__construct();
52 $lng->loadLanguageModule(
"feed");
55 $this->
setRowTemplate(
"tpl.block_external_feed_row.html",
"Services/Feeds");
65 return self::$block_type;
85 switch($ilCtrl->getCmd())
90 case "updateFeedBlock":
93 case "confirmDeleteFeedBlock":
111 $this->feed_block = $a_block;
112 $this->
setTitle($this->feed_block->getTitle());
113 $this->
setBlockId($this->feed_block->getId());
116 include_once(
"./Services/Feeds/classes/class.ilExternalFeed.php");
118 $this->feed->setUrl($this->feed_block->getFeedUrl());
123 $ilCtrl->setParameter($this,
"block_id", $this->feed_block->getId());
133 $next_class = $ilCtrl->getNextClass();
134 $cmd = $ilCtrl->getCmd(
"getHTML");
139 return $this->
$cmd();
154 parent::fillDataSection();
171 if ($ilSetting->get(
"block_limit_pdfeed") == 0)
185 $this->feed->fetch();
186 $this->
setData($this->feed->getItems());
189 $ilCtrl->setParameter($this,
"external_feed_block_id",
192 $ilCtrl->getLinkTarget($this,
196 $ilCtrl->getLinkTarget($this,
197 "confirmDeleteFeedBlock"),
198 $lng->txt(
"delete"));
199 $ilCtrl->setParameter($this,
"external_feed_block_id",
"");
204 ($ilUser->getPref(
"il_feed_js") ==
"n" &&
$_SESSION[
"il_feed_js"] !=
"y"))
209 return parent::getHTML().$add;
216 if ($ilCtrl->getCmdClass() !=
"ilcolumngui" && $ilCtrl->getCmd() !=
"enableJS")
223 if ($sess_feed_js !=
"n" &&
224 ($ilUser->getPref(
"il_feed_js") !=
"n" || $sess_feed_js ==
"y"))
227 if (!$this->feed->checkCacheHit())
241 $ilCtrl->setParameterByClass(
"ilcolumngui",
"block_id",
244 $rel_tpl =
new ilTemplate(
"tpl.dynamic_reload.html",
true,
true,
"Services/Feeds");
245 $rel_tpl->setVariable(
"TXT_LOADING", $lng->txt(
"feed_loading_feed"));
246 $rel_tpl->setVariable(
"BLOCK_ID",
"block_pdfeed_".$this->
getBlockId());
247 $rel_tpl->setVariable(
"TARGET",
248 $ilCtrl->getLinkTargetByClass(
"ilcolumngui",
"updateBlock",
"",
true));
251 $rel_tpl->setVariable(
"TXT_FEED_CLICK_HERE", $lng->txt(
"feed_no_js_click_here"));
252 $rel_tpl->setVariable(
"TARGET_NO_JS",
253 $ilCtrl->getLinkTargetByClass(
"ilpdexternalfeedblockgui",
"disableJS"));
255 return $rel_tpl->get();
262 $ilCtrl->setParameterByClass(
"ilcolumngui",
"block_id",
265 $rel_tpl =
new ilTemplate(
"tpl.js_enabler.html",
true,
true,
"Services/Feeds");
266 $rel_tpl->setVariable(
"BLOCK_ID",
"block_pdfeed_".$this->
getBlockId());
267 $rel_tpl->setVariable(
"TARGET",
268 $ilCtrl->getLinkTargetByClass(
"ilpdexternalfeedblockgui",
"enableJS",
true));
270 return $rel_tpl->get();
279 $ilUser->writePref(
"il_feed_js",
"n");
280 $ilCtrl->redirectByClass(
"ilpersonaldesktopgui",
"show");
288 $ilUser->writePref(
"il_feed_js",
"y");
300 $ilCtrl->setParameter($this,
"feed_item_id", $item->getId());
301 $this->tpl->setVariable(
"VAL_TITLE", $item->getTitle());
302 $this->tpl->setVariable(
"HREF_SHOW",
303 $ilCtrl->getLinkTarget($this,
"showFeedItem"));
304 $ilCtrl->setParameter($this,
"feed_item_id",
"");
315 return '<div class="small">'.((int) count($this->
getData())).
" ".$lng->txt(
"feed_feed_items").
"</div>";
325 include_once(
"./Services/News/classes/class.ilNewsItem.php");
327 $this->feed->fetch();
328 foreach($this->feed->getItems() as $item)
330 if ($item->getId() ==
$_GET[
"feed_item_id"])
337 $tpl =
new ilTemplate(
"tpl.show_feed_item.html",
true,
true,
"Services/Feeds");
339 if (is_object($c_item))
341 if (trim($c_item->getSummary()) !=
"")
343 $tpl->setCurrentBlock(
"content");
344 $tpl->setVariable(
"VAL_CONTENT", $c_item->getSummary());
345 $tpl->parseCurrentBlock();
347 if (trim($c_item->getDate()) !=
"" || trim($c_item->getAuthor()) !=
"")
349 $tpl->setCurrentBlock(
"date_author");
350 if (trim($c_item->getAuthor()) !=
"")
352 $tpl->setVariable(
"VAL_AUTHOR", $c_item->getAuthor().
" - ");
354 $tpl->setVariable(
"VAL_DATE", $c_item->getDate());
355 $tpl->parseCurrentBlock();
358 if (trim($c_item->getLink()) !=
"")
360 $tpl->setCurrentBlock(
"plink");
361 $tpl->setVariable(
"HREF_LINK", $c_item->getLink());
362 $tpl->setVariable(
"TXT_LINK", $lng->txt(
"feed_open_source_page"));
363 $tpl->parseCurrentBlock();
365 $tpl->setVariable(
"VAL_TITLE", $c_item->getTitle());
368 include_once(
"./Services/PersonalDesktop/classes/class.ilPDContentBlockGUI.php");
370 $content_block->setContent(
$tpl->get());
371 $content_block->setTitle($this->
getTitle());
373 $content_block->addHeaderCommand($ilCtrl->getParentReturn($this),
374 $lng->txt(
"selected_items_back"));
376 return $content_block->getHTML();
397 $lng->loadLanguageModule(
"block");
399 require_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
404 $text_input =
new ilTextInputGUI($lng->txt(
"block_feed_block_title"),
"block_title");
406 $text_input->setRequired(
true);
407 $text_input->setMaxLength(200);
408 $this->form_gui->addItem($text_input);
411 $text_input =
new ilFeedUrlInputGUI($lng->txt(
"block_feed_block_feed_url"),
"block_feed_url");
412 $text_input->
setInfo($lng->txt(
"block_feed_block_feed_url_info"));
413 $text_input->setRequired(
true);
414 $text_input->setMaxLength(250);
415 $this->form_gui->addItem($text_input);
421 $this->form_gui->addCommandButton(
"saveFeedBlock", $lng->txt(
"save"));
422 $this->form_gui->addCommandButton(
"cancelSaveFeedBlock", $lng->txt(
"cancel"));
426 $this->form_gui->addCommandButton(
"updateFeedBlock", $lng->txt(
"save"));
427 $this->form_gui->addCommandButton(
"cancelUpdateFeedBlock", $lng->txt(
"cancel"));
430 $this->form_gui->setTitle($lng->txt(
"block_feed_block_head"));
431 $this->form_gui->setFormAction($this->ctrl->getFormAction($this));
446 $a_feed_block->setContextObjId($ilCtrl->getContextObjId());
447 $a_feed_block->setContextObjType($ilCtrl->getContextObjType());
448 $a_feed_block->setType(
"pdfeed");
458 include_once(
"Services/Utilities/classes/class.ilConfirmationGUI.php");
462 $c_gui->setFormAction($ilCtrl->getFormAction($this,
"deleteFeedBlock"));
463 $c_gui->setHeaderText($lng->txt(
"info_delete_sure"));
464 $c_gui->setCancel($lng->txt(
"cancel"),
"exitDeleteFeedBlock");
465 $c_gui->setConfirm($lng->txt(
"confirm"),
"deleteFeedBlock");
468 $c_gui->addItem(
"external_feed_block_id",
469 $this->feed_block->getId(), $this->feed_block->getTitle(),
472 return $c_gui->getHTML();
482 $ilCtrl->returnToParent($this);
492 $this->feed_block->delete();
493 $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.
addBlockCommand($a_href, $a_text, $a_target="", $a_img="", $a_right_aligned=false, $a_checked=false, $a_html="")
Add Block Command.
setEnableNumInfo($a_enablenuminfo)
Set Enable Item Number Info.
confirmDeleteFeedBlock()
Confirmation of feed block deletion.
static getBlockType()
Get block type.
Handles external Feeds via Magpie libaray.
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.
static isRepositoryObject()
Get block type.
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.
Create styles array
The data for the language used.
getBlockId()
Get Block Id.
showFeedItem()
Show Feed Item.
create()
Create Form for Block.
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.