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");
34 $lng->loadLanguageModule(
"feed");
36 $this->
setRowTemplate(
"tpl.block_external_feed_row.html",
"Services/Feeds");
66 switch($ilCtrl->getCmd())
71 case "updateFeedBlock":
74 case "confirmDeleteFeedBlock":
92 $this->feed_block = $a_block;
93 $this->
setTitle($this->feed_block->getTitle());
97 include_once(
"./Services/Feeds/classes/class.ilExternalFeed.php");
99 $this->feed->setUrl($this->feed_block->getFeedUrl());
104 $ilCtrl->setParameter($this,
"block_id", $this->feed_block->getId());
114 $next_class = $ilCtrl->getNextClass();
115 $cmd = $ilCtrl->getCmd(
"getHTML");
120 return $this->
$cmd();
165 $this->feed->fetch();
166 $this->
setData($this->feed->getItems());
170 $this->
setData($this->feed->getItems());
172 if ($ilAccess->checkAccess(
"write",
"", $this->getRefId()))
174 $ilCtrl->setParameterByClass(
"ilobjexternalfeedgui",
176 $ilCtrl->setParameter($this,
"external_feed_block_id", $this->
getBlockId());
178 $ilCtrl->getLinkTargetByClass(array(
"ilrepositorygui",
"ilobjexternalfeedgui",
179 "ilexternalfeedblockgui"),
181 $lng->txt(
"settings"));
182 $ilCtrl->clearParametersByClass(
"ilobjexternalfeedgui");
188 ($ilUser->getPref(
"il_feed_js") ==
"n" &&
$_SESSION[
"il_feed_js"] !=
"y"))
200 if ($ilCtrl->getCmdClass() !=
"ilcolumngui" && $ilCtrl->getCmd() !=
"enableJS")
203 ($ilUser->getPref(
"il_feed_js") !=
"n" ||
$_SESSION[
"il_feed_js"] ==
"y"))
206 if (!$this->feed->checkCacheHit())
220 $ilCtrl->setParameterByClass(
"ilcolumngui",
"block_id",
223 $rel_tpl =
new ilTemplate(
"tpl.dynamic_reload.html",
true,
true,
"Services/Feeds");
224 $rel_tpl->setVariable(
"TXT_LOADING", $lng->txt(
"feed_loading_feed"));
225 $rel_tpl->setVariable(
"BLOCK_ID",
"block_feed_".$this->
getBlockId());
226 $rel_tpl->setVariable(
"TARGET",
227 $ilCtrl->getLinkTargetByClass(
"ilcolumngui",
"updateBlock",
"",
true));
230 $rel_tpl->setVariable(
"TXT_FEED_CLICK_HERE", $lng->txt(
"feed_no_js_click_here"));
231 $rel_tpl->setVariable(
"TARGET_NO_JS",
232 $ilCtrl->getLinkTargetByClass(
"ilexternalfeedblockgui",
"disableJS"));
234 return $rel_tpl->get();
241 $ilCtrl->setParameterByClass(
"ilcolumngui",
"block_id",
244 $rel_tpl =
new ilTemplate(
"tpl.js_enabler.html",
true,
true,
"Services/Feeds");
245 $rel_tpl->setVariable(
"BLOCK_ID",
"block_feed_".$this->
getBlockId());
246 $rel_tpl->setVariable(
"TARGET",
247 $ilCtrl->getLinkTargetByClass(
"ilexternalfeedblockgui",
"enableJS",
true,
"",
false));
249 return $rel_tpl->get();
258 $ilUser->writePref(
"il_feed_js",
"n");
259 $ilCtrl->returnToParent($this);
267 $ilUser->writePref(
"il_feed_js",
"y");
279 if ($this->
isRepositoryObject() && !$ilAccess->checkAccess(
"read",
"", $this->getRefId()))
281 $this->tpl->setVariable(
"TXT_TITLE", $item->getTitle());
285 $ilCtrl->setParameter($this,
"feed_item_id", $item->getId());
286 $this->tpl->setCurrentBlock(
"feed_link");
287 $this->tpl->setVariable(
"VAL_TITLE", $item->getTitle());
288 $this->tpl->setVariable(
"HREF_SHOW",
289 $ilCtrl->getLinkTarget($this,
"showFeedItem"));
290 $ilCtrl->setParameter($this,
"feed_item_id",
"");
291 $this->tpl->parseCurrentBlock();
303 return '<div class="small">'.((int) count($this->
getData())).
" ".$lng->txt(
"feed_feed_items").
"</div>";
313 include_once(
"./Services/News/classes/class.ilNewsItem.php");
315 $this->feed->fetch();
316 foreach($this->feed->getItems() as $item)
318 if ($item->getId() ==
$_GET[
"feed_item_id"])
325 $tpl =
new ilTemplate(
"tpl.show_feed_item.html",
true,
true,
"Services/Feeds");
327 if (is_object($c_item))
329 if (trim($c_item->getSummary()) !=
"")
331 $tpl->setCurrentBlock(
"content");
332 $tpl->setVariable(
"VAL_CONTENT", $c_item->getSummary());
333 $tpl->parseCurrentBlock();
335 if (trim($c_item->getDate()) !=
"" || trim($c_item->getAuthor()) !=
"")
337 $tpl->setCurrentBlock(
"date_author");
338 if (trim($c_item->getAuthor()) !=
"")
340 $tpl->setVariable(
"VAL_AUTHOR", $c_item->getAuthor().
" - ");
342 $tpl->setVariable(
"VAL_DATE", $c_item->getDate());
343 $tpl->parseCurrentBlock();
346 if (trim($c_item->getLink()) !=
"")
348 $tpl->setCurrentBlock(
"plink");
349 $tpl->setVariable(
"HREF_LINK", $c_item->getLink());
350 $tpl->setVariable(
"TXT_LINK", $lng->txt(
"feed_open_source_page"));
351 $tpl->parseCurrentBlock();
353 $tpl->setVariable(
"VAL_TITLE", $c_item->getTitle());
356 include_once(
"./Services/PersonalDesktop/classes/class.ilPDContentBlockGUI.php");
358 $content_block->setContent(
$tpl->get());
359 $content_block->setTitle($this->
getTitle());
361 $content_block->addHeaderCommand($ilCtrl->getParentReturn($this),
362 $lng->txt(
"close"),
true);
364 return $content_block->getHTML();
378 $html2 =
"<br/>".$this->form->getHTML();
381 return $html1.$html2;
393 $lng->loadLanguageModule(
"feed");
395 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
397 $this->form->setTarget(
"_top");
400 include_once(
"./Services/Form/classes/class.ilFileInputGUI.php");
403 $fi->setRequired(
true);
404 $this->form->addItem($fi);
406 $this->form->addCommandButton(
"importFile", $lng->txt(
"import"));
407 $this->form->addCommandButton(
"cancelSaveFeedBlock", $lng->txt(
"cancel"));
408 $this->form->setTitle($lng->txt($a_new_type.
"_import"));
410 $ilCtrl->setParameter($this,
"new_type", $a_new_type);
411 $this->form->setFormAction($ilCtrl->getFormAction($this));
421 global $rbacsystem, $objDefinition,
$tpl,
$lng;
426 if (!$rbacsystem->checkAccess(
"create",
$_GET[
"ref_id"], $new_type))
428 $this->ilias->raiseError($this->lng->txt(
"no_create_permission"), $this->ilias->error_obj->MESSAGE);
430 $this->ctrl->setParameter($this,
"new_type", $new_type);
432 if ($this->form->checkInput())
435 include_once(
"./Services/Export/classes/class.ilImport.php");
437 $new_id = $imp->importObject($newObj, $_FILES[
"importfile"][
"tmp_name"],
438 $_FILES[
"importfile"][
"name"], $new_type);
444 $newObj->createReference();
445 $newObj->putInTree($_GET[
"ref_id"]);
446 $newObj->setPermissions($_GET[
"ref_id"]);
453 $this->form->setValuesByPost();
454 $tpl->setContent($this->form->getHtml());
468 $lng->loadLanguageModule(
"block");
470 include(
"Services/Form/classes/class.ilPropertyFormGUI.php");
475 $text_input =
new ilTextInputGUI($lng->txt(
"block_feed_block_title"),
"block_title");
477 $text_input->setRequired(
true);
478 $text_input->setMaxLength(200);
479 $this->form_gui->addItem($text_input);
482 $text_input =
new ilFeedUrlInputGUI($lng->txt(
"block_feed_block_feed_url"),
"block_feed_url");
483 $text_input->
setInfo($lng->txt(
"block_feed_block_feed_url_info"));
484 $text_input->setRequired(
true);
485 $text_input->setMaxLength(250);
486 $this->form_gui->addItem($text_input);
492 $this->form_gui->addCommandButton(
"saveFeedBlock", $lng->txt(
"save"));
493 $this->form_gui->addCommandButton(
"cancelSaveFeedBlock", $lng->txt(
"cancel"));
497 $this->form_gui->addCommandButton(
"updateFeedBlock", $lng->txt(
"save"));
498 $this->form_gui->addCommandButton(
"cancelUpdateFeedBlock", $lng->txt(
"cancel"));
501 $this->form_gui->setTitle($lng->txt(
"block_feed_block_head"));
502 $this->form_gui->setFormAction($this->ctrl->getFormAction($this));
553 $this->
getGuiObject()->update($this->external_feed_block);