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");
57 $this->
setRowTemplate(
"tpl.block_external_feed_row.html",
"Services/Feeds");
87 switch($ilCtrl->getCmd())
92 case "updateFeedBlock":
95 case "confirmDeleteFeedBlock":
113 $this->feed_block = $a_block;
114 $this->
setTitle($this->feed_block->getTitle());
115 $this->
setBlockId($this->feed_block->getId());
118 include_once(
"./Services/Feeds/classes/class.ilExternalFeed.php");
120 $this->feed->setUrl($this->feed_block->getFeedUrl());
125 $ilCtrl->setParameter($this,
"block_id", $this->feed_block->getId());
135 $next_class = $ilCtrl->getNextClass();
136 $cmd = $ilCtrl->getCmd(
"getHTML");
141 return $this->
$cmd();
186 $this->feed->fetch();
187 $this->
setData($this->feed->getItems());
191 $this->
setData($this->feed->getItems());
193 if ($ilAccess->checkAccess(
"write",
"", $this->getRefId()))
195 $ilCtrl->setParameterByClass(
"ilobjexternalfeedgui",
197 $ilCtrl->setParameter($this,
"external_feed_block_id", $this->
getBlockId());
199 $ilCtrl->getLinkTargetByClass(array(
"ilrepositorygui",
"ilobjexternalfeedgui",
200 "ilexternalfeedblockgui"),
203 $ilCtrl->clearParametersByClass(
"ilobjexternalfeedgui");
209 ($ilUser->getPref(
"il_feed_js") ==
"n" &&
$_SESSION[
"il_feed_js"] !=
"y"))
221 if ($ilCtrl->getCmdClass() !=
"ilcolumngui" && $ilCtrl->getCmd() !=
"enableJS")
224 ($ilUser->getPref(
"il_feed_js") !=
"n" ||
$_SESSION[
"il_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_feed_".$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(
"ilexternalfeedblockgui",
"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_feed_".$this->
getBlockId());
267 $rel_tpl->setVariable(
"TARGET",
268 $ilCtrl->getLinkTargetByClass(
"ilexternalfeedblockgui",
"enableJS",
true));
270 return $rel_tpl->get();
279 $ilUser->writePref(
"il_feed_js",
"n");
280 $ilCtrl->returnToParent($this);
288 $ilUser->writePref(
"il_feed_js",
"y");
300 if ($this->
isRepositoryObject() && !$ilAccess->checkAccess(
"read",
"", $this->getRefId()))
302 $this->tpl->setVariable(
"TXT_TITLE", $item->getTitle());
306 $ilCtrl->setParameter($this,
"feed_item_id", $item->getId());
307 $this->tpl->setCurrentBlock(
"feed_link");
308 $this->tpl->setVariable(
"VAL_TITLE", $item->getTitle());
309 $this->tpl->setVariable(
"HREF_SHOW",
310 $ilCtrl->getLinkTarget($this,
"showFeedItem"));
311 $ilCtrl->setParameter($this,
"feed_item_id",
"");
312 $this->tpl->parseCurrentBlock();
324 return '<div class="small">'.((int) count($this->
getData())).
" ".$lng->txt(
"feed_feed_items").
"</div>";
334 include_once(
"./Services/News/classes/class.ilNewsItem.php");
336 $this->feed->fetch();
337 foreach($this->feed->getItems() as $item)
339 if ($item->getId() ==
$_GET[
"feed_item_id"])
346 $tpl =
new ilTemplate(
"tpl.show_feed_item.html",
true,
true,
"Services/Feeds");
348 if (is_object($c_item))
350 if (trim($c_item->getSummary()) !=
"")
352 $tpl->setCurrentBlock(
"content");
353 $tpl->setVariable(
"VAL_CONTENT", $c_item->getSummary());
354 $tpl->parseCurrentBlock();
356 if (trim($c_item->getDate()) !=
"" || trim($c_item->getAuthor()) !=
"")
358 $tpl->setCurrentBlock(
"date_author");
359 if (trim($c_item->getAuthor()) !=
"")
361 $tpl->setVariable(
"VAL_AUTHOR", $c_item->getAuthor().
" - ");
363 $tpl->setVariable(
"VAL_DATE", $c_item->getDate());
364 $tpl->parseCurrentBlock();
367 if (trim($c_item->getLink()) !=
"")
369 $tpl->setCurrentBlock(
"plink");
370 $tpl->setVariable(
"HREF_LINK", $c_item->getLink());
371 $tpl->setVariable(
"TXT_LINK", $lng->txt(
"feed_open_source_page"));
372 $tpl->parseCurrentBlock();
374 $tpl->setVariable(
"VAL_TITLE", $c_item->getTitle());
377 include_once(
"./Services/PersonalDesktop/classes/class.ilPDContentBlockGUI.php");
379 $content_block->setContent(
$tpl->get());
380 $content_block->setTitle($this->
getTitle());
382 $content_block->addHeaderCommand($ilCtrl->getParentReturn($this),
383 $lng->txt(
"close"),
true);
385 return $content_block->getHTML();
406 $lng->loadLanguageModule(
"block");
408 include(
"Services/Form/classes/class.ilPropertyFormGUI.php");
413 $text_input =
new ilTextInputGUI($lng->txt(
"block_feed_block_title"),
"block_title");
415 $text_input->setRequired(
true);
416 $text_input->setMaxLength(200);
417 $this->form_gui->addItem($text_input);
420 $text_input =
new ilFeedUrlInputGUI($lng->txt(
"block_feed_block_feed_url"),
"block_feed_url");
421 $text_input->
setInfo($lng->txt(
"block_feed_block_feed_url_info"));
422 $text_input->setRequired(
true);
423 $text_input->setMaxLength(250);
424 $this->form_gui->addItem($text_input);
430 $this->form_gui->addCommandButton(
"saveFeedBlock", $lng->txt(
"save"));
431 $this->form_gui->addCommandButton(
"cancelSaveFeedBlock", $lng->txt(
"cancel"));
435 $this->form_gui->addCommandButton(
"updateFeedBlock", $lng->txt(
"save"));
436 $this->form_gui->addCommandButton(
"cancelUpdateFeedBlock", $lng->txt(
"cancel"));
439 $this->form_gui->setTitle($lng->txt(
"block_feed_block_head"));
440 $this->form_gui->setFormAction($this->ctrl->getFormAction($this));
491 $this->
getGuiObject()->update($this->external_feed_block);