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")
222 ($ilUser->getPref(
"il_feed_js") !=
"n" ||
$_SESSION[
"il_feed_js"] ==
"y"))
225 if (!$this->feed->checkCacheHit())
239 $ilCtrl->setParameterByClass(
"ilcolumngui",
"block_id",
242 $rel_tpl =
new ilTemplate(
"tpl.dynamic_reload.html",
true,
true,
"Services/Feeds");
243 $rel_tpl->setVariable(
"TXT_LOADING", $lng->txt(
"feed_loading_feed"));
244 $rel_tpl->setVariable(
"BLOCK_ID",
"block_pdfeed_".$this->
getBlockId());
245 $rel_tpl->setVariable(
"TARGET",
246 $ilCtrl->getLinkTargetByClass(
"ilcolumngui",
"updateBlock",
"",
true));
249 $rel_tpl->setVariable(
"TXT_FEED_CLICK_HERE", $lng->txt(
"feed_no_js_click_here"));
250 $rel_tpl->setVariable(
"TARGET_NO_JS",
251 $ilCtrl->getLinkTargetByClass(
"ilpdexternalfeedblockgui",
"disableJS"));
253 return $rel_tpl->get();
260 $ilCtrl->setParameterByClass(
"ilcolumngui",
"block_id",
263 $rel_tpl =
new ilTemplate(
"tpl.js_enabler.html",
true,
true,
"Services/Feeds");
264 $rel_tpl->setVariable(
"BLOCK_ID",
"block_pdfeed_".$this->
getBlockId());
265 $rel_tpl->setVariable(
"TARGET",
266 $ilCtrl->getLinkTargetByClass(
"ilpdexternalfeedblockgui",
"enableJS",
true));
268 return $rel_tpl->get();
277 $ilUser->writePref(
"il_feed_js",
"n");
278 $ilCtrl->redirectByClass(
"ilpersonaldesktopgui",
"show");
286 $ilUser->writePref(
"il_feed_js",
"y");
298 $ilCtrl->setParameter($this,
"feed_item_id", $item->getId());
299 $this->tpl->setVariable(
"VAL_TITLE", $item->getTitle());
300 $this->tpl->setVariable(
"HREF_SHOW",
301 $ilCtrl->getLinkTarget($this,
"showFeedItem"));
302 $ilCtrl->setParameter($this,
"feed_item_id",
"");
313 return '<div class="small">'.((int) count($this->
getData())).
" ".$lng->txt(
"feed_feed_items").
"</div>";
323 include_once(
"./Services/News/classes/class.ilNewsItem.php");
325 $this->feed->fetch();
326 foreach($this->feed->getItems() as $item)
328 if ($item->getId() ==
$_GET[
"feed_item_id"])
335 $tpl =
new ilTemplate(
"tpl.show_feed_item.html",
true,
true,
"Services/Feeds");
337 if (is_object($c_item))
339 if (trim($c_item->getSummary()) !=
"")
341 $tpl->setCurrentBlock(
"content");
342 $tpl->setVariable(
"VAL_CONTENT", $c_item->getSummary());
343 $tpl->parseCurrentBlock();
345 if (trim($c_item->getDate()) !=
"" || trim($c_item->getAuthor()) !=
"")
347 $tpl->setCurrentBlock(
"date_author");
348 if (trim($c_item->getAuthor()) !=
"")
350 $tpl->setVariable(
"VAL_AUTHOR", $c_item->getAuthor().
" - ");
352 $tpl->setVariable(
"VAL_DATE", $c_item->getDate());
353 $tpl->parseCurrentBlock();
356 if (trim($c_item->getLink()) !=
"")
358 $tpl->setCurrentBlock(
"plink");
359 $tpl->setVariable(
"HREF_LINK", $c_item->getLink());
360 $tpl->setVariable(
"TXT_LINK", $lng->txt(
"feed_open_source_page"));
361 $tpl->parseCurrentBlock();
363 $tpl->setVariable(
"VAL_TITLE", $c_item->getTitle());
366 include_once(
"./Services/PersonalDesktop/classes/class.ilPDContentBlockGUI.php");
368 $content_block->setContent(
$tpl->get());
369 $content_block->setTitle($this->
getTitle());
371 $content_block->addHeaderCommand($ilCtrl->getParentReturn($this),
372 $lng->txt(
"selected_items_back"));
374 return $content_block->getHTML();
395 $lng->loadLanguageModule(
"block");
397 include(
"Services/Form/classes/class.ilPropertyFormGUI.php");
402 $text_input =
new ilTextInputGUI($lng->txt(
"block_feed_block_title"),
"block_title");
404 $text_input->setRequired(
true);
405 $text_input->setMaxLength(200);
406 $this->form_gui->addItem($text_input);
409 $text_input =
new ilFeedUrlInputGUI($lng->txt(
"block_feed_block_feed_url"),
"block_feed_url");
410 $text_input->
setInfo($lng->txt(
"block_feed_block_feed_url_info"));
411 $text_input->setRequired(
true);
412 $text_input->setMaxLength(250);
413 $this->form_gui->addItem($text_input);
419 $this->form_gui->addCommandButton(
"saveFeedBlock", $lng->txt(
"save"));
420 $this->form_gui->addCommandButton(
"cancelSaveFeedBlock", $lng->txt(
"cancel"));
424 $this->form_gui->addCommandButton(
"updateFeedBlock", $lng->txt(
"save"));
425 $this->form_gui->addCommandButton(
"cancelUpdateFeedBlock", $lng->txt(
"cancel"));
428 $this->form_gui->setTitle($lng->txt(
"block_feed_block_head"));
429 $this->form_gui->setFormAction($this->ctrl->getFormAction($this));
444 $a_feed_block->setContextObjId($ilCtrl->getContextObjId());
445 $a_feed_block->setContextObjType($ilCtrl->getContextObjType());
446 $a_feed_block->setType(
"pdfeed");
456 include_once(
"Services/Utilities/classes/class.ilConfirmationGUI.php");
460 $c_gui->setFormAction($ilCtrl->getFormAction($this,
"deleteFeedBlock"));
461 $c_gui->setHeaderText($lng->txt(
"info_delete_sure"));
462 $c_gui->setCancel($lng->txt(
"cancel"),
"exitDeleteFeedBlock");
463 $c_gui->setConfirm($lng->txt(
"confirm"),
"deleteFeedBlock");
466 $c_gui->addItem(
"external_feed_block_id",
467 $this->feed_block->getId(), $this->feed_block->getTitle(),
470 return $c_gui->getHTML();
480 $ilCtrl->returnToParent($this);
490 $this->feed_block->delete();
491 $ilCtrl->returnToParent($this);