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");
31 parent::__construct();
33 $lng->loadLanguageModule(
"feed");
35 $this->
setRowTemplate(
"tpl.block_external_feed_row.html",
"Services/Feeds");
45 return self::$block_type;
65 switch($ilCtrl->getCmd())
70 case "updateFeedBlock":
73 case "confirmDeleteFeedBlock":
91 $this->feed_block = $a_block;
92 $this->
setTitle($this->feed_block->getTitle());
96 include_once(
"./Services/Feeds/classes/class.ilExternalFeed.php");
98 $this->feed->setUrl($this->feed_block->getFeedUrl());
103 $ilCtrl->setParameter($this,
"block_id", $this->feed_block->getId());
113 $next_class = $ilCtrl->getNextClass();
114 $cmd = $ilCtrl->getCmd(
"getHTML");
119 return $this->
$cmd();
134 parent::fillDataSection();
164 $this->feed->fetch();
165 $this->
setData($this->feed->getItems());
169 $this->
setData($this->feed->getItems());
171 if ($ilAccess->checkAccess(
"write",
"", $this->getRefId()))
173 $ilCtrl->setParameterByClass(
"ilobjexternalfeedgui",
175 $ilCtrl->setParameter($this,
"external_feed_block_id", $this->
getBlockId());
177 $ilCtrl->getLinkTargetByClass(
array(
"ilrepositorygui",
"ilobjexternalfeedgui",
178 "ilexternalfeedblockgui"),
180 $lng->txt(
"settings"));
181 $ilCtrl->clearParametersByClass(
"ilobjexternalfeedgui");
187 ($ilUser->getPref(
"il_feed_js") ==
"n" &&
$_SESSION[
"il_feed_js"] !=
"y"))
192 return parent::getHTML().$add;
199 if ($ilCtrl->getCmdClass() !=
"ilcolumngui" && $ilCtrl->getCmd() !=
"enableJS")
202 ($ilUser->getPref(
"il_feed_js") !=
"n" ||
$_SESSION[
"il_feed_js"] ==
"y"))
205 if (!$this->feed->checkCacheHit())
219 $ilCtrl->setParameterByClass(
"ilcolumngui",
"block_id",
222 $rel_tpl =
new ilTemplate(
"tpl.dynamic_reload.html",
true,
true,
"Services/Feeds");
223 $rel_tpl->setVariable(
"TXT_LOADING", $lng->txt(
"feed_loading_feed"));
224 $rel_tpl->setVariable(
"BLOCK_ID",
"block_feed_".$this->
getBlockId());
225 $rel_tpl->setVariable(
"TARGET",
226 $ilCtrl->getLinkTargetByClass(
"ilcolumngui",
"updateBlock",
"",
true));
229 $rel_tpl->setVariable(
"TXT_FEED_CLICK_HERE", $lng->txt(
"feed_no_js_click_here"));
230 $rel_tpl->setVariable(
"TARGET_NO_JS",
231 $ilCtrl->getLinkTargetByClass(
"ilexternalfeedblockgui",
"disableJS"));
233 return $rel_tpl->get();
240 $ilCtrl->setParameterByClass(
"ilcolumngui",
"block_id",
243 $rel_tpl =
new ilTemplate(
"tpl.js_enabler.html",
true,
true,
"Services/Feeds");
244 $rel_tpl->setVariable(
"BLOCK_ID",
"block_feed_".$this->
getBlockId());
245 $rel_tpl->setVariable(
"TARGET",
246 $ilCtrl->getLinkTargetByClass(
"ilexternalfeedblockgui",
"enableJS",
true,
"",
false));
248 return $rel_tpl->get();
257 $ilUser->writePref(
"il_feed_js",
"n");
258 $ilCtrl->returnToParent($this);
266 $ilUser->writePref(
"il_feed_js",
"y");
278 if ($this->
isRepositoryObject() && !$ilAccess->checkAccess(
"read",
"", $this->getRefId()))
280 $this->tpl->setVariable(
"TXT_TITLE", $item->getTitle());
284 $ilCtrl->setParameter($this,
"feed_item_id", $item->getId());
285 $this->tpl->setCurrentBlock(
"feed_link");
286 $this->tpl->setVariable(
"VAL_TITLE", $item->getTitle());
287 $this->tpl->setVariable(
"HREF_SHOW",
288 $ilCtrl->getLinkTarget($this,
"showFeedItem"));
289 $ilCtrl->setParameter($this,
"feed_item_id",
"");
290 $this->tpl->parseCurrentBlock();
302 return '<div class="small">'.((int) count($this->
getData())).
" ".$lng->txt(
"feed_feed_items").
"</div>";
312 include_once(
"./Services/News/classes/class.ilNewsItem.php");
314 $this->feed->fetch();
315 foreach($this->feed->getItems() as $item)
317 if ($item->getId() ==
$_GET[
"feed_item_id"])
324 $tpl =
new ilTemplate(
"tpl.show_feed_item.html",
true,
true,
"Services/Feeds");
326 if (is_object($c_item))
328 if (trim($c_item->getSummary()) !=
"")
330 $tpl->setCurrentBlock(
"content");
331 $tpl->setVariable(
"VAL_CONTENT", $c_item->getSummary());
332 $tpl->parseCurrentBlock();
334 if (trim($c_item->getDate()) !=
"" || trim($c_item->getAuthor()) !=
"")
336 $tpl->setCurrentBlock(
"date_author");
337 if (trim($c_item->getAuthor()) !=
"")
339 $tpl->setVariable(
"VAL_AUTHOR", $c_item->getAuthor().
" - ");
341 $tpl->setVariable(
"VAL_DATE", $c_item->getDate());
342 $tpl->parseCurrentBlock();
345 if (trim($c_item->getLink()) !=
"")
347 $tpl->setCurrentBlock(
"plink");
348 $tpl->setVariable(
"HREF_LINK", $c_item->getLink());
349 $tpl->setVariable(
"TXT_LINK", $lng->txt(
"feed_open_source_page"));
350 $tpl->parseCurrentBlock();
352 $tpl->setVariable(
"VAL_TITLE", $c_item->getTitle());
355 include_once(
"./Services/PersonalDesktop/classes/class.ilPDContentBlockGUI.php");
357 $content_block->setContent(
$tpl->get());
358 $content_block->setTitle($this->
getTitle());
360 $content_block->addHeaderCommand($ilCtrl->getParentReturn($this),
361 $lng->txt(
"close"),
true);
363 return $content_block->getHTML();
377 $html2 =
"<br/>".$this->form->getHTML();
392 $lng->loadLanguageModule(
"feed");
394 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
396 $this->form->setTarget(
"_top");
399 include_once(
"./Services/Form/classes/class.ilFileInputGUI.php");
402 $fi->setRequired(
true);
403 $this->form->addItem($fi);
405 $this->form->addCommandButton(
"importFile", $lng->txt(
"import"));
406 $this->form->addCommandButton(
"cancelSaveFeedBlock", $lng->txt(
"cancel"));
407 $this->form->setTitle($lng->txt($a_new_type.
"_import"));
409 $ilCtrl->setParameter($this,
"new_type", $a_new_type);
410 $this->form->setFormAction($ilCtrl->getFormAction($this));
420 global $rbacsystem, $objDefinition,
$tpl,
$lng;
425 if (!$rbacsystem->checkAccess(
"create",
$_GET[
"ref_id"], $new_type))
427 $this->
ilias->raiseError($this->lng->txt(
"no_create_permission"), $this->
ilias->error_obj->MESSAGE);
429 $this->ctrl->setParameter($this,
"new_type", $new_type);
431 if ($this->form->checkInput())
434 include_once(
"./Services/Export/classes/class.ilImport.php");
436 $new_id = $imp->importObject($newObj, $_FILES[
"importfile"][
"tmp_name"],
437 $_FILES[
"importfile"][
"name"], $new_type);
443 $newObj->createReference();
444 $newObj->putInTree($_GET[
"ref_id"]);
445 $newObj->setPermissions($_GET[
"ref_id"]);
452 $this->form->setValuesByPost();
453 $tpl->setContent($this->form->getHtml());
467 $lng->loadLanguageModule(
"block");
469 require_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
474 $text_input =
new ilTextInputGUI($lng->txt(
"block_feed_block_title"),
"block_title");
476 $text_input->setRequired(
true);
477 $text_input->setMaxLength(200);
478 $this->form_gui->addItem($text_input);
481 $text_input =
new ilFeedUrlInputGUI($lng->txt(
"block_feed_block_feed_url"),
"block_feed_url");
482 $text_input->
setInfo($lng->txt(
"block_feed_block_feed_url_info"));
483 $text_input->setRequired(
true);
484 $text_input->setMaxLength(250);
485 $this->form_gui->addItem($text_input);
491 $this->form_gui->addCommandButton(
"saveFeedBlock", $lng->txt(
"save"));
492 $this->form_gui->addCommandButton(
"cancelSaveFeedBlock", $lng->txt(
"cancel"));
496 $this->form_gui->addCommandButton(
"updateFeedBlock", $lng->txt(
"save"));
497 $this->form_gui->addCommandButton(
"cancelUpdateFeedBlock", $lng->txt(
"cancel"));
500 $this->form_gui->setTitle($lng->txt(
"block_feed_block_head"));
501 $this->form_gui->setFormAction($this->ctrl->getFormAction($this));
552 $this->
getGuiObject()->update($this->external_feed_block);
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
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.
static isRepositoryObject()
Get block type.
addBlockCommand($a_href, $a_text, $a_target="", $a_img="", $a_right_aligned=false, $a_checked=false, $a_html="")
Add Block Command.
setEnableNumInfo($a_enablenuminfo)
Set Enable Item Number Info.
Handles external Feeds via Magpie libaray.
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
Create styles array
The data for the language used.
getBlockId()
Get Block Id.
showFeedItem()
Show Feed Item.
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.
static getBlockType()
Get block type.
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.