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");
46 $this->ctrl = $DIC->ctrl();
47 $this->lng = $DIC->language();
48 $this->
user = $DIC->user();
49 $this->access = $DIC->access();
51 $this->rbacsystem = $DIC->rbac()->system();
52 $this->obj_definition = $DIC[
"objDefinition"];
53 $lng = $DIC->language();
55 parent::__construct();
57 $lng->loadLanguageModule(
"feed");
59 $this->
setRowTemplate(
"tpl.block_external_feed_row.html",
"Services/Feeds");
67 return self::$block_type;
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");
136 switch ($next_class) {
138 return $this->$cmd();
150 parent::fillDataSection();
173 if (
$feed_set->get(
"disable_rep_feeds")) {
179 $this->feed->fetch();
180 $this->
setData($this->feed->getItems());
184 $this->
setData($this->feed->getItems());
186 if ($ilAccess->checkAccess(
"write",
"", $this->getRefId())) {
188 "ilobjexternalfeedgui",
195 array(
"ilrepositorygui",
"ilobjexternalfeedgui",
196 "ilexternalfeedblockgui"),
199 $lng->txt(
"settings")
201 $ilCtrl->clearParametersByClass(
"ilobjexternalfeedgui");
207 (
$ilUser->getPref(
"il_feed_js") ==
"n" &&
$_SESSION[
"il_feed_js"] !=
"y")) {
211 return parent::getHTML() . $add;
219 if (
$ilCtrl->getCmdClass() !=
"ilcolumngui" &&
$ilCtrl->getCmd() !=
"enableJS") {
221 (
$ilUser->getPref(
"il_feed_js") !=
"n" ||
$_SESSION[
"il_feed_js"] ==
"y")) {
223 if (!$this->feed->checkCacheHit()) {
243 $rel_tpl =
new ilTemplate(
"tpl.dynamic_reload.html",
true,
true,
"Services/Feeds");
244 $rel_tpl->setVariable(
"TXT_LOADING",
$lng->txt(
"feed_loading_feed"));
245 $rel_tpl->setVariable(
"BLOCK_ID",
"block_feed_" . $this->
getBlockId());
246 $rel_tpl->setVariable(
248 $ilCtrl->getLinkTargetByClass(
"ilcolumngui",
"updateBlock",
"",
true)
252 $rel_tpl->setVariable(
"TXT_FEED_CLICK_HERE",
$lng->txt(
"feed_no_js_click_here"));
253 $rel_tpl->setVariable(
255 $ilCtrl->getLinkTargetByClass(
"ilexternalfeedblockgui",
"disableJS")
258 return $rel_tpl->get();
272 $rel_tpl =
new ilTemplate(
"tpl.js_enabler.html",
true,
true,
"Services/Feeds");
273 $rel_tpl->setVariable(
"BLOCK_ID",
"block_feed_" . $this->
getBlockId());
274 $rel_tpl->setVariable(
276 $ilCtrl->getLinkTargetByClass(
"ilexternalfeedblockgui",
"enableJS",
true,
"",
false)
279 return $rel_tpl->get();
289 $ilUser->writePref(
"il_feed_js",
"n");
290 $ilCtrl->returnToParent($this);
298 $ilUser->writePref(
"il_feed_js",
"y");
311 if ($this->
isRepositoryObject() && !$ilAccess->checkAccess(
"read",
"", $this->getRefId())) {
312 $this->tpl->setVariable(
"TXT_TITLE", $item->getTitle());
314 $ilCtrl->setParameter($this,
"feed_item_id", $item->getId());
315 $this->tpl->setCurrentBlock(
"feed_link");
316 $this->tpl->setVariable(
"VAL_TITLE", $item->getTitle());
317 $this->tpl->setVariable(
319 $ilCtrl->getLinkTarget($this,
"showFeedItem")
321 $ilCtrl->setParameter($this,
"feed_item_id",
"");
322 $this->tpl->parseCurrentBlock();
336 return '<div class="small">' . ((int) count($this->
getData())) .
" " .
$lng->txt(
"feed_feed_items") .
"</div>";
347 include_once(
"./Services/News/classes/class.ilNewsItem.php");
349 $this->feed->fetch();
350 foreach ($this->feed->getItems() as $item) {
351 if ($item->getId() ==
$_GET[
"feed_item_id"]) {
357 $tpl =
new ilTemplate(
"tpl.show_feed_item.html",
true,
true,
"Services/Feeds");
359 if (is_object($c_item)) {
360 if (trim($c_item->getSummary()) !=
"") {
361 $tpl->setCurrentBlock(
"content");
362 $tpl->setVariable(
"VAL_CONTENT", $c_item->getSummary());
363 $tpl->parseCurrentBlock();
365 if (trim($c_item->getDate()) !=
"" || trim($c_item->getAuthor()) !=
"") {
366 $tpl->setCurrentBlock(
"date_author");
367 if (trim($c_item->getAuthor()) !=
"") {
368 $tpl->setVariable(
"VAL_AUTHOR", $c_item->getAuthor() .
" - ");
370 $tpl->setVariable(
"VAL_DATE", $c_item->getDate());
371 $tpl->parseCurrentBlock();
374 if (trim($c_item->getLink()) !=
"") {
375 $tpl->setCurrentBlock(
"plink");
376 $tpl->setVariable(
"HREF_LINK", $c_item->getLink());
377 $tpl->setVariable(
"TXT_LINK",
$lng->txt(
"feed_open_source_page"));
378 $tpl->parseCurrentBlock();
380 $tpl->setVariable(
"VAL_TITLE", $c_item->getTitle());
383 include_once(
"./Services/PersonalDesktop/classes/class.ilPDContentBlockGUI.php");
385 $content_block->setContent(
$tpl->get());
386 $content_block->setTitle($this->
getTitle());
388 $content_block->addHeaderCommand(
389 $ilCtrl->getParentReturn($this),
394 return $content_block->getHTML();
407 $html2 =
"<br/>" . $this->form->getHTML();
423 $lng->loadLanguageModule(
"feed");
425 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
427 $this->form->setTarget(
"_top");
430 include_once(
"./Services/Form/classes/class.ilFileInputGUI.php");
433 $fi->setRequired(
true);
434 $this->form->addItem($fi);
436 $this->form->addCommandButton(
"importFile",
$lng->txt(
"import"));
437 $this->form->addCommandButton(
"cancelSaveFeedBlock",
$lng->txt(
"cancel"));
438 $this->form->setTitle(
$lng->txt($a_new_type .
"_import"));
440 $ilCtrl->setParameter($this,
"new_type", $a_new_type);
441 $this->form->setFormAction(
$ilCtrl->getFormAction($this));
459 $this->
ilias->raiseError($this->lng->txt(
"no_create_permission"), $this->
ilias->error_obj->MESSAGE);
461 $this->ctrl->setParameter($this,
"new_type", $new_type);
463 if ($this->form->checkInput()) {
465 include_once(
"./Services/Export/classes/class.ilImport.php");
467 $new_id = $imp->importObject(
469 $_FILES[
"importfile"][
"tmp_name"],
470 $_FILES[
"importfile"][
"name"],
477 $newObj->createReference();
478 $newObj->putInTree($_GET[
"ref_id"]);
479 $newObj->setPermissions($_GET[
"ref_id"]);
480 ilUtil::sendSuccess(
$lng->txt(
"msg_obj_modified"),
true);
486 $this->form->setValuesByPost();
487 $tpl->setContent($this->form->getHtml());
501 $lng->loadLanguageModule(
"block");
503 require_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
510 $text_input->setRequired(
true);
511 $text_input->setMaxLength(200);
512 $this->form_gui->addItem($text_input);
516 $text_input->
setInfo(
$lng->txt(
"block_feed_block_feed_url_info"));
517 $text_input->setRequired(
true);
518 $text_input->setMaxLength(250);
519 $this->form_gui->addItem($text_input);
524 $this->form_gui->addCommandButton(
"saveFeedBlock",
$lng->txt(
"save"));
525 $this->form_gui->addCommandButton(
"cancelSaveFeedBlock",
$lng->txt(
"cancel"));
527 $this->form_gui->addCommandButton(
"updateFeedBlock",
$lng->txt(
"save"));
528 $this->form_gui->addCommandButton(
"cancelUpdateFeedBlock",
$lng->txt(
"cancel"));
531 $this->form_gui->setTitle(
$lng->txt(
"block_feed_block_head"));
532 $this->form_gui->setFormAction($this->ctrl->getFormAction($this));
572 $this->
getGuiObject()->update($this->external_feed_block);
exitUpdateFeedBlock()
FORM FeedBlock: Exit save.
createFeedBlock()
FORM FeedBlock: Create ExternalFeedBlock.
getGuiObject()
Get GuiObject.
exitSaveFeedBlock()
FORM FeedBlock: Exit save.
prepareFormFeedBlock(&$a_form_gui)
FORM FeedBlock: Prepare form.
static getScreenMode()
Get Screen Mode for current command.
setDataSection($a_content)
Call this from overwritten fillDataSection(), if standard row based data is not used.
create()
Create Form for Block.
__construct()
Constructor.
fillDataSection()
Fill data section.
cancelUpdateFeedBlock()
FORM FeedBlock: Exit save.
setEnableNumInfo($a_enablenuminfo)
Set Enable Item Number Info.
Handles external Feeds via Magpie library.
executeCommand()
execute command
fillRow($item)
Fill feed item row.
GUI class for external news feed custom block.
getOverview()
Get overview.
prepareSaveFeedBlock(&$a_feed_block)
FORM FeedBlock: Prepare Saving of FeedBlock.
setTitle($a_title)
Set Title.
setBlockId($a_block_id=0)
Set Block Id.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
initImportForm($a_new_type="")
Init object import form.
setData($a_data)
Set Data.
special template class to simplify handling of ITX/PEAR
setAvailableDetailLevels($a_max, $a_min=0)
Set Available Detail Levels.
This class represents a text property in a property form.
setBlock($a_block)
Do most of the initialisation.
redirection script todo: (a better solution should control the processing via a xml file) ...
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
getBlockId()
Get Block Id.
showFeedItem()
Show Feed Item.
addBlockCommand( $a_href, $a_text, $a_target="", $a_img="", $a_right_aligned=false, $a_checked=false, $a_html="")
Add Block Command.
setLimit($a_limit)
Set Limit.
getRefId()
Get Ref Id (only used if isRepositoryObject() is true).
BlockGUI class for external feed block.
initFormFeedBlock($a_mode)
FORM FeedBlock: Init form.
BlockGUI class for (centered) Content on Personal Desktop.
getHTML()
Get block HTML code.
setRowTemplate($a_rowtemplatename, $a_rowtemplatedir="")
Set Row Template Name.
getCurrentDetailLevel()
Get Current Detail Level.