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");
53 $lng->loadLanguageModule(
"feed");
56 $this->
setRowTemplate(
"tpl.block_external_feed_row.html",
"Services/Feeds");
86 switch($ilCtrl->getCmd())
91 case "updateFeedBlock":
94 case "confirmDeleteFeedBlock":
112 $this->feed_block = $a_block;
113 $this->
setTitle($this->feed_block->getTitle());
114 $this->
setBlockId($this->feed_block->getId());
117 include_once(
"./Services/Feeds/classes/class.ilExternalFeed.php");
119 $this->feed->setUrl($this->feed_block->getFeedUrl());
124 $ilCtrl->setParameter($this,
"block_id", $this->feed_block->getId());
134 $next_class = $ilCtrl->getNextClass();
135 $cmd = $ilCtrl->getCmd(
"getHTML");
140 return $this->
$cmd();
172 if ($ilSetting->get(
"block_limit_pdfeed") == 0)
186 $this->feed->fetch();
187 $this->
setData($this->feed->getItems());
190 $ilCtrl->setParameter($this,
"external_feed_block_id",
193 $ilCtrl->getLinkTarget($this,
197 $ilCtrl->getLinkTarget($this,
198 "confirmDeleteFeedBlock"),
199 $lng->txt(
"delete"));
200 $ilCtrl->setParameter($this,
"external_feed_block_id",
"");
205 ($ilUser->getPref(
"il_feed_js") ==
"n" &&
$_SESSION[
"il_feed_js"] !=
"y"))
217 if ($ilCtrl->getCmdClass() !=
"ilcolumngui" && $ilCtrl->getCmd() !=
"enableJS")
224 if ($sess_feed_js !=
"n" &&
225 ($ilUser->getPref(
"il_feed_js") !=
"n" || $sess_feed_js ==
"y"))
228 if (!$this->feed->checkCacheHit())
242 $ilCtrl->setParameterByClass(
"ilcolumngui",
"block_id",
245 $rel_tpl =
new ilTemplate(
"tpl.dynamic_reload.html",
true,
true,
"Services/Feeds");
246 $rel_tpl->setVariable(
"TXT_LOADING", $lng->txt(
"feed_loading_feed"));
247 $rel_tpl->setVariable(
"BLOCK_ID",
"block_pdfeed_".$this->
getBlockId());
248 $rel_tpl->setVariable(
"TARGET",
249 $ilCtrl->getLinkTargetByClass(
"ilcolumngui",
"updateBlock",
"",
true));
252 $rel_tpl->setVariable(
"TXT_FEED_CLICK_HERE", $lng->txt(
"feed_no_js_click_here"));
253 $rel_tpl->setVariable(
"TARGET_NO_JS",
254 $ilCtrl->getLinkTargetByClass(
"ilpdexternalfeedblockgui",
"disableJS"));
256 return $rel_tpl->get();
263 $ilCtrl->setParameterByClass(
"ilcolumngui",
"block_id",
266 $rel_tpl =
new ilTemplate(
"tpl.js_enabler.html",
true,
true,
"Services/Feeds");
267 $rel_tpl->setVariable(
"BLOCK_ID",
"block_pdfeed_".$this->
getBlockId());
268 $rel_tpl->setVariable(
"TARGET",
269 $ilCtrl->getLinkTargetByClass(
"ilpdexternalfeedblockgui",
"enableJS",
true));
271 return $rel_tpl->get();
280 $ilUser->writePref(
"il_feed_js",
"n");
281 $ilCtrl->redirectByClass(
"ilpersonaldesktopgui",
"show");
289 $ilUser->writePref(
"il_feed_js",
"y");
301 $ilCtrl->setParameter($this,
"feed_item_id", $item->getId());
302 $this->tpl->setVariable(
"VAL_TITLE", $item->getTitle());
303 $this->tpl->setVariable(
"HREF_SHOW",
304 $ilCtrl->getLinkTarget($this,
"showFeedItem"));
305 $ilCtrl->setParameter($this,
"feed_item_id",
"");
316 return '<div class="small">'.((int) count($this->
getData())).
" ".$lng->txt(
"feed_feed_items").
"</div>";
326 include_once(
"./Services/News/classes/class.ilNewsItem.php");
328 $this->feed->fetch();
329 foreach($this->feed->getItems() as $item)
331 if ($item->getId() ==
$_GET[
"feed_item_id"])
338 $tpl =
new ilTemplate(
"tpl.show_feed_item.html",
true,
true,
"Services/Feeds");
340 if (is_object($c_item))
342 if (trim($c_item->getSummary()) !=
"")
344 $tpl->setCurrentBlock(
"content");
345 $tpl->setVariable(
"VAL_CONTENT", $c_item->getSummary());
346 $tpl->parseCurrentBlock();
348 if (trim($c_item->getDate()) !=
"" || trim($c_item->getAuthor()) !=
"")
350 $tpl->setCurrentBlock(
"date_author");
351 if (trim($c_item->getAuthor()) !=
"")
353 $tpl->setVariable(
"VAL_AUTHOR", $c_item->getAuthor().
" - ");
355 $tpl->setVariable(
"VAL_DATE", $c_item->getDate());
356 $tpl->parseCurrentBlock();
359 if (trim($c_item->getLink()) !=
"")
361 $tpl->setCurrentBlock(
"plink");
362 $tpl->setVariable(
"HREF_LINK", $c_item->getLink());
363 $tpl->setVariable(
"TXT_LINK", $lng->txt(
"feed_open_source_page"));
364 $tpl->parseCurrentBlock();
366 $tpl->setVariable(
"VAL_TITLE", $c_item->getTitle());
369 include_once(
"./Services/PersonalDesktop/classes/class.ilPDContentBlockGUI.php");
371 $content_block->setContent(
$tpl->get());
372 $content_block->setTitle($this->
getTitle());
374 $content_block->addHeaderCommand($ilCtrl->getParentReturn($this),
375 $lng->txt(
"selected_items_back"));
377 return $content_block->getHTML();
398 $lng->loadLanguageModule(
"block");
400 include(
"Services/Form/classes/class.ilPropertyFormGUI.php");
405 $text_input =
new ilTextInputGUI($lng->txt(
"block_feed_block_title"),
"block_title");
407 $text_input->setRequired(
true);
408 $text_input->setMaxLength(200);
409 $this->form_gui->addItem($text_input);
412 $text_input =
new ilFeedUrlInputGUI($lng->txt(
"block_feed_block_feed_url"),
"block_feed_url");
413 $text_input->
setInfo($lng->txt(
"block_feed_block_feed_url_info"));
414 $text_input->setRequired(
true);
415 $text_input->setMaxLength(250);
416 $this->form_gui->addItem($text_input);
422 $this->form_gui->addCommandButton(
"saveFeedBlock", $lng->txt(
"save"));
423 $this->form_gui->addCommandButton(
"cancelSaveFeedBlock", $lng->txt(
"cancel"));
427 $this->form_gui->addCommandButton(
"updateFeedBlock", $lng->txt(
"save"));
428 $this->form_gui->addCommandButton(
"cancelUpdateFeedBlock", $lng->txt(
"cancel"));
431 $this->form_gui->setTitle($lng->txt(
"block_feed_block_head"));
432 $this->form_gui->setFormAction($this->ctrl->getFormAction($this));
447 $a_feed_block->setContextObjId($ilCtrl->getContextObjId());
448 $a_feed_block->setContextObjType($ilCtrl->getContextObjType());
449 $a_feed_block->setType(
"pdfeed");
459 include_once(
"Services/Utilities/classes/class.ilConfirmationGUI.php");
463 $c_gui->setFormAction($ilCtrl->getFormAction($this,
"deleteFeedBlock"));
464 $c_gui->setHeaderText($lng->txt(
"info_delete_sure"));
465 $c_gui->setCancel($lng->txt(
"cancel"),
"exitDeleteFeedBlock");
466 $c_gui->setConfirm($lng->txt(
"confirm"),
"deleteFeedBlock");
469 $c_gui->addItem(
"external_feed_block_id",
470 $this->feed_block->getId(), $this->feed_block->getTitle(),
473 return $c_gui->getHTML();
483 $ilCtrl->returnToParent($this);
493 $this->feed_block->delete();
494 $ilCtrl->returnToParent($this);