5 include_once(
"./Services/Block/classes/class.ilBlockGUI.php");
6 include_once(
"./Services/Block/classes/class.ilExternalFeedBlockGUIGen.php");
7 include_once(
"./Services/Feeds/classes/class.ilExternalFeed.php");
36 $lng->loadLanguageModule(
"feed");
38 $this->
setRowTemplate(
"tpl.block_external_feed_row.html",
"Services/Feeds");
68 switch($ilCtrl->getCmd())
73 case "updateFeedBlock":
76 case "confirmDeleteFeedBlock":
94 $this->feed_block = $a_block;
95 $this->
setTitle($this->feed_block->getTitle());
99 include_once(
"./Services/Feeds/classes/class.ilExternalFeed.php");
101 $this->feed->setUrl($this->feed_block->getFeedUrl());
106 $ilCtrl->setParameter($this,
"block_id", $this->feed_block->getId());
116 $next_class = $ilCtrl->getNextClass();
117 $cmd = $ilCtrl->getCmd(
"getHTML");
122 return $this->
$cmd();
167 $this->feed->fetch();
168 $this->
setData($this->feed->getItems());
172 $this->
setData($this->feed->getItems());
174 if ($ilAccess->checkAccess(
"write",
"", $this->getRefId()))
176 $ilCtrl->setParameterByClass(
"ilobjexternalfeedgui",
178 $ilCtrl->setParameter($this,
"external_feed_block_id", $this->
getBlockId());
180 $ilCtrl->getLinkTargetByClass(array(
"ilrepositorygui",
"ilobjexternalfeedgui",
181 "ilexternalfeedblockgui"),
184 $ilCtrl->clearParametersByClass(
"ilobjexternalfeedgui");
190 ($ilUser->getPref(
"il_feed_js") ==
"n" &&
$_SESSION[
"il_feed_js"] !=
"y"))
202 if ($ilCtrl->getCmdClass() !=
"ilcolumngui" && $ilCtrl->getCmd() !=
"enableJS")
205 ($ilUser->getPref(
"il_feed_js") !=
"n" ||
$_SESSION[
"il_feed_js"] ==
"y"))
208 if (!$this->feed->checkCacheHit())
222 $ilCtrl->setParameterByClass(
"ilcolumngui",
"block_id",
225 $rel_tpl =
new ilTemplate(
"tpl.dynamic_reload.html",
true,
true,
"Services/Feeds");
226 $rel_tpl->setVariable(
"TXT_LOADING", $lng->txt(
"feed_loading_feed"));
227 $rel_tpl->setVariable(
"BLOCK_ID",
"block_feed_".$this->
getBlockId());
228 $rel_tpl->setVariable(
"TARGET",
229 $ilCtrl->getLinkTargetByClass(
"ilcolumngui",
"updateBlock",
"",
true));
232 $rel_tpl->setVariable(
"TXT_FEED_CLICK_HERE", $lng->txt(
"feed_no_js_click_here"));
233 $rel_tpl->setVariable(
"TARGET_NO_JS",
234 $ilCtrl->getLinkTargetByClass(
"ilexternalfeedblockgui",
"disableJS"));
236 return $rel_tpl->get();
243 $ilCtrl->setParameterByClass(
"ilcolumngui",
"block_id",
246 $rel_tpl =
new ilTemplate(
"tpl.js_enabler.html",
true,
true,
"Services/Feeds");
247 $rel_tpl->setVariable(
"BLOCK_ID",
"block_feed_".$this->
getBlockId());
248 $rel_tpl->setVariable(
"TARGET",
249 $ilCtrl->getLinkTargetByClass(
"ilexternalfeedblockgui",
"enableJS",
true,
"",
false));
251 return $rel_tpl->get();
260 $ilUser->writePref(
"il_feed_js",
"n");
261 $ilCtrl->returnToParent($this);
269 $ilUser->writePref(
"il_feed_js",
"y");
281 if ($this->
isRepositoryObject() && !$ilAccess->checkAccess(
"read",
"", $this->getRefId()))
283 $this->tpl->setVariable(
"TXT_TITLE", $item->getTitle());
287 $ilCtrl->setParameter($this,
"feed_item_id", $item->getId());
288 $this->tpl->setCurrentBlock(
"feed_link");
289 $this->tpl->setVariable(
"VAL_TITLE", $item->getTitle());
290 $this->tpl->setVariable(
"HREF_SHOW",
291 $ilCtrl->getLinkTarget($this,
"showFeedItem"));
292 $ilCtrl->setParameter($this,
"feed_item_id",
"");
293 $this->tpl->parseCurrentBlock();
305 return '<div class="small">'.((int) count($this->
getData())).
" ".$lng->txt(
"feed_feed_items").
"</div>";
315 include_once(
"./Services/News/classes/class.ilNewsItem.php");
317 $this->feed->fetch();
318 foreach($this->feed->getItems() as $item)
320 if ($item->getId() ==
$_GET[
"feed_item_id"])
327 $tpl =
new ilTemplate(
"tpl.show_feed_item.html",
true,
true,
"Services/Feeds");
329 if (is_object($c_item))
331 if (trim($c_item->getSummary()) !=
"")
333 $tpl->setCurrentBlock(
"content");
334 $tpl->setVariable(
"VAL_CONTENT", $c_item->getSummary());
335 $tpl->parseCurrentBlock();
337 if (trim($c_item->getDate()) !=
"" || trim($c_item->getAuthor()) !=
"")
339 $tpl->setCurrentBlock(
"date_author");
340 if (trim($c_item->getAuthor()) !=
"")
342 $tpl->setVariable(
"VAL_AUTHOR", $c_item->getAuthor().
" - ");
344 $tpl->setVariable(
"VAL_DATE", $c_item->getDate());
345 $tpl->parseCurrentBlock();
348 if (trim($c_item->getLink()) !=
"")
350 $tpl->setCurrentBlock(
"plink");
351 $tpl->setVariable(
"HREF_LINK", $c_item->getLink());
352 $tpl->setVariable(
"TXT_LINK", $lng->txt(
"feed_open_source_page"));
353 $tpl->parseCurrentBlock();
355 $tpl->setVariable(
"VAL_TITLE", $c_item->getTitle());
358 include_once(
"./Services/PersonalDesktop/classes/class.ilPDContentBlockGUI.php");
360 $content_block->setContent(
$tpl->get());
361 $content_block->setTitle($this->
getTitle());
363 $content_block->addHeaderCommand($ilCtrl->getParentReturn($this),
364 $lng->txt(
"close"),
true);
366 return $content_block->getHTML();
380 $html2 =
"<br/>".$this->form->getHTML();
383 return $html1.$html2;
395 $lng->loadLanguageModule(
"feed");
397 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
399 $this->form->setTarget(
"_top");
402 include_once(
"./Services/Form/classes/class.ilFileInputGUI.php");
405 $fi->setRequired(
true);
406 $this->form->addItem($fi);
408 $this->form->addCommandButton(
"importFile", $lng->txt(
"import"));
409 $this->form->addCommandButton(
"cancelSaveFeedBlock", $lng->txt(
"cancel"));
410 $this->form->setTitle($lng->txt($a_new_type.
"_import"));
412 $ilCtrl->setParameter($this,
"new_type", $a_new_type);
413 $this->form->setFormAction($ilCtrl->getFormAction($this));
423 global $rbacsystem, $objDefinition,
$tpl,
$lng;
428 if (!$rbacsystem->checkAccess(
"create",
$_GET[
"ref_id"], $new_type))
430 $this->ilias->raiseError($this->lng->txt(
"no_create_permission"), $this->ilias->error_obj->MESSAGE);
432 $this->ctrl->setParameter($this,
"new_type", $new_type);
434 if ($this->form->checkInput())
437 include_once(
"./Services/Export/classes/class.ilImport.php");
439 $new_id = $imp->importObject($newObj, $_FILES[
"importfile"][
"tmp_name"],
440 $_FILES[
"importfile"][
"name"], $new_type);
446 $newObj->createReference();
447 $newObj->putInTree($_GET[
"ref_id"]);
448 $newObj->setPermissions($_GET[
"ref_id"]);
455 $this->form->setValuesByPost();
456 $tpl->setContent($this->form->getHtml());
470 $lng->loadLanguageModule(
"block");
472 include(
"Services/Form/classes/class.ilPropertyFormGUI.php");
477 $text_input =
new ilTextInputGUI($lng->txt(
"block_feed_block_title"),
"block_title");
479 $text_input->setRequired(
true);
480 $text_input->setMaxLength(200);
481 $this->form_gui->addItem($text_input);
484 $text_input =
new ilFeedUrlInputGUI($lng->txt(
"block_feed_block_feed_url"),
"block_feed_url");
485 $text_input->
setInfo($lng->txt(
"block_feed_block_feed_url_info"));
486 $text_input->setRequired(
true);
487 $text_input->setMaxLength(250);
488 $this->form_gui->addItem($text_input);
494 $this->form_gui->addCommandButton(
"saveFeedBlock", $lng->txt(
"save"));
495 $this->form_gui->addCommandButton(
"cancelSaveFeedBlock", $lng->txt(
"cancel"));
499 $this->form_gui->addCommandButton(
"updateFeedBlock", $lng->txt(
"save"));
500 $this->form_gui->addCommandButton(
"cancelUpdateFeedBlock", $lng->txt(
"cancel"));
503 $this->form_gui->setTitle($lng->txt(
"block_feed_block_head"));
504 $this->form_gui->setFormAction($this->ctrl->getFormAction($this));
555 $this->
getGuiObject()->update($this->external_feed_block);