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 $lng->loadLanguageModule(
"feed");
58 $this->
setRowTemplate(
"tpl.block_external_feed_row.html",
"Services/Feeds");
88 switch($ilCtrl->getCmd())
93 case "updateFeedBlock":
96 case "confirmDeleteFeedBlock":
114 $this->feed_block = $a_block;
115 $this->
setTitle($this->feed_block->getTitle());
116 $this->
setBlockId($this->feed_block->getId());
119 include_once(
"./Services/Feeds/classes/class.ilExternalFeed.php");
121 $this->feed->setUrl($this->feed_block->getFeedUrl());
126 $ilCtrl->setParameter($this,
"block_id", $this->feed_block->getId());
136 $next_class = $ilCtrl->getNextClass();
137 $cmd = $ilCtrl->getCmd(
"getHTML");
142 return $this->
$cmd();
174 if ($ilSetting->get(
"block_limit_pdfeed") == 0)
188 $this->feed->fetch();
189 $this->
setData($this->feed->getItems());
192 $ilCtrl->setParameter($this,
"external_feed_block_id",
195 $ilCtrl->getLinkTarget($this,
199 $ilCtrl->getLinkTarget($this,
200 "confirmDeleteFeedBlock"),
201 $lng->txt(
"delete"));
202 $ilCtrl->setParameter($this,
"external_feed_block_id",
"");
207 ($ilUser->getPref(
"il_feed_js") ==
"n" &&
$_SESSION[
"il_feed_js"] !=
"y"))
219 if ($ilCtrl->getCmdClass() !=
"ilcolumngui" && $ilCtrl->getCmd() !=
"enableJS")
226 if ($sess_feed_js !=
"n" &&
227 ($ilUser->getPref(
"il_feed_js") !=
"n" || $sess_feed_js ==
"y"))
230 if (!$this->feed->checkCacheHit())
244 $ilCtrl->setParameterByClass(
"ilcolumngui",
"block_id",
247 $rel_tpl =
new ilTemplate(
"tpl.dynamic_reload.html",
true,
true,
"Services/Feeds");
248 $rel_tpl->setVariable(
"TXT_LOADING", $lng->txt(
"feed_loading_feed"));
249 $rel_tpl->setVariable(
"BLOCK_ID",
"block_pdfeed_".$this->
getBlockId());
250 $rel_tpl->setVariable(
"TARGET",
251 $ilCtrl->getLinkTargetByClass(
"ilcolumngui",
"updateBlock",
"",
true));
254 $rel_tpl->setVariable(
"TXT_FEED_CLICK_HERE", $lng->txt(
"feed_no_js_click_here"));
255 $rel_tpl->setVariable(
"TARGET_NO_JS",
256 $ilCtrl->getLinkTargetByClass(
"ilpdexternalfeedblockgui",
"disableJS"));
258 return $rel_tpl->get();
265 $ilCtrl->setParameterByClass(
"ilcolumngui",
"block_id",
268 $rel_tpl =
new ilTemplate(
"tpl.js_enabler.html",
true,
true,
"Services/Feeds");
269 $rel_tpl->setVariable(
"BLOCK_ID",
"block_pdfeed_".$this->
getBlockId());
270 $rel_tpl->setVariable(
"TARGET",
271 $ilCtrl->getLinkTargetByClass(
"ilpdexternalfeedblockgui",
"enableJS",
true));
273 return $rel_tpl->get();
282 $ilUser->writePref(
"il_feed_js",
"n");
283 $ilCtrl->redirectByClass(
"ilpersonaldesktopgui",
"show");
291 $ilUser->writePref(
"il_feed_js",
"y");
303 $ilCtrl->setParameter($this,
"feed_item_id", $item->getId());
304 $this->tpl->setVariable(
"VAL_TITLE", $item->getTitle());
305 $this->tpl->setVariable(
"HREF_SHOW",
306 $ilCtrl->getLinkTarget($this,
"showFeedItem"));
307 $ilCtrl->setParameter($this,
"feed_item_id",
"");
318 return '<div class="small">'.((int) count($this->
getData())).
" ".$lng->txt(
"feed_feed_items").
"</div>";
328 include_once(
"./Services/News/classes/class.ilNewsItem.php");
330 $this->feed->fetch();
331 foreach($this->feed->getItems() as $item)
333 if ($item->getId() ==
$_GET[
"feed_item_id"])
340 $tpl =
new ilTemplate(
"tpl.show_feed_item.html",
true,
true,
"Services/Feeds");
342 if (is_object($c_item))
344 if (trim($c_item->getSummary()) !=
"")
346 $tpl->setCurrentBlock(
"content");
347 $tpl->setVariable(
"VAL_CONTENT", $c_item->getSummary());
348 $tpl->parseCurrentBlock();
350 if (trim($c_item->getDate()) !=
"" || trim($c_item->getAuthor()) !=
"")
352 $tpl->setCurrentBlock(
"date_author");
353 if (trim($c_item->getAuthor()) !=
"")
355 $tpl->setVariable(
"VAL_AUTHOR", $c_item->getAuthor().
" - ");
357 $tpl->setVariable(
"VAL_DATE", $c_item->getDate());
358 $tpl->parseCurrentBlock();
361 if (trim($c_item->getLink()) !=
"")
363 $tpl->setCurrentBlock(
"plink");
364 $tpl->setVariable(
"HREF_LINK", $c_item->getLink());
365 $tpl->setVariable(
"TXT_LINK", $lng->txt(
"feed_open_source_page"));
366 $tpl->parseCurrentBlock();
368 $tpl->setVariable(
"VAL_TITLE", $c_item->getTitle());
371 include_once(
"./Services/PersonalDesktop/classes/class.ilPDContentBlockGUI.php");
373 $content_block->setContent(
$tpl->get());
374 $content_block->setTitle($this->
getTitle());
376 $content_block->addHeaderCommand($ilCtrl->getParentReturn($this),
377 $lng->txt(
"selected_items_back"));
379 return $content_block->getHTML();
400 $lng->loadLanguageModule(
"block");
402 include(
"Services/Form/classes/class.ilPropertyFormGUI.php");
407 $text_input =
new ilTextInputGUI($lng->txt(
"block_feed_block_title"),
"block_title");
409 $text_input->setRequired(
true);
410 $text_input->setMaxLength(200);
411 $this->form_gui->addItem($text_input);
414 $text_input =
new ilFeedUrlInputGUI($lng->txt(
"block_feed_block_feed_url"),
"block_feed_url");
415 $text_input->
setInfo($lng->txt(
"block_feed_block_feed_url_info"));
416 $text_input->setRequired(
true);
417 $text_input->setMaxLength(250);
418 $this->form_gui->addItem($text_input);
424 $this->form_gui->addCommandButton(
"saveFeedBlock", $lng->txt(
"save"));
425 $this->form_gui->addCommandButton(
"cancelSaveFeedBlock", $lng->txt(
"cancel"));
429 $this->form_gui->addCommandButton(
"updateFeedBlock", $lng->txt(
"save"));
430 $this->form_gui->addCommandButton(
"cancelUpdateFeedBlock", $lng->txt(
"cancel"));
433 $this->form_gui->setTitle($lng->txt(
"block_feed_block_head"));
434 $this->form_gui->setFormAction($this->ctrl->getFormAction($this));
449 $a_feed_block->setContextObjId($ilCtrl->getContextObjId());
450 $a_feed_block->setContextObjType($ilCtrl->getContextObjType());
451 $a_feed_block->setType(
"pdfeed");
461 include_once(
"Services/Utilities/classes/class.ilConfirmationGUI.php");
465 $c_gui->setFormAction($ilCtrl->getFormAction($this,
"deleteFeedBlock"));
466 $c_gui->setHeaderText($lng->txt(
"info_delete_sure"));
467 $c_gui->setCancel($lng->txt(
"cancel"),
"exitDeleteFeedBlock");
468 $c_gui->setConfirm($lng->txt(
"confirm"),
"deleteFeedBlock");
471 $c_gui->addItem(
"external_feed_block_id",
472 $this->feed_block->getId(), $this->feed_block->getTitle(),
475 return $c_gui->getHTML();
485 $ilCtrl->returnToParent($this);
495 $this->feed_block->delete();
496 $ilCtrl->returnToParent($this);