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");
69 return self::$block_type;
95 case "updateFeedBlock":
98 case "confirmDeleteFeedBlock":
116 $this->feed_block = $a_block;
117 $this->
setTitle($this->feed_block->getTitle());
118 $this->
setBlockId($this->feed_block->getId());
121 include_once(
"./Services/Feeds/classes/class.ilExternalFeed.php");
123 $this->feed->setUrl($this->feed_block->getFeedUrl());
128 $ilCtrl->setParameter($this,
"block_id", $this->feed_block->getId());
138 $next_class =
$ilCtrl->getNextClass();
139 $cmd =
$ilCtrl->getCmd(
"getHTML");
140 switch ($next_class) {
142 return $this->$cmd();
154 parent::fillDataSection();
177 if (
$feed_set->get(
"disable_rep_feeds")) {
183 $this->feed->fetch();
184 $this->
setData($this->feed->getItems());
188 $this->
setData($this->feed->getItems());
190 if ($ilAccess->checkAccess(
"write",
"", $this->getRefId())) {
192 "ilobjexternalfeedgui",
199 array(
"ilrepositorygui",
"ilobjexternalfeedgui",
200 "ilexternalfeedblockgui"),
203 $lng->txt(
"settings")
205 $ilCtrl->clearParametersByClass(
"ilobjexternalfeedgui");
211 (
$ilUser->getPref(
"il_feed_js") ==
"n" &&
$_SESSION[
"il_feed_js"] !=
"y")) {
215 return parent::getHTML() . $add;
223 if (
$ilCtrl->getCmdClass() !=
"ilcolumngui" &&
$ilCtrl->getCmd() !=
"enableJS") {
225 (
$ilUser->getPref(
"il_feed_js") !=
"n" ||
$_SESSION[
"il_feed_js"] ==
"y")) {
227 if (!$this->feed->checkCacheHit()) {
247 $rel_tpl =
new ilTemplate(
"tpl.dynamic_reload.html",
true,
true,
"Services/Feeds");
248 $rel_tpl->setVariable(
"TXT_LOADING",
$lng->txt(
"feed_loading_feed"));
249 $rel_tpl->setVariable(
"BLOCK_ID",
"block_feed_" . $this->
getBlockId());
250 $rel_tpl->setVariable(
252 $ilCtrl->getLinkTargetByClass(
"ilcolumngui",
"updateBlock",
"",
true)
256 $rel_tpl->setVariable(
"TXT_FEED_CLICK_HERE",
$lng->txt(
"feed_no_js_click_here"));
257 $rel_tpl->setVariable(
259 $ilCtrl->getLinkTargetByClass(
"ilexternalfeedblockgui",
"disableJS")
262 return $rel_tpl->get();
276 $rel_tpl =
new ilTemplate(
"tpl.js_enabler.html",
true,
true,
"Services/Feeds");
277 $rel_tpl->setVariable(
"BLOCK_ID",
"block_feed_" . $this->
getBlockId());
278 $rel_tpl->setVariable(
280 $ilCtrl->getLinkTargetByClass(
"ilexternalfeedblockgui",
"enableJS",
true,
"",
false)
283 return $rel_tpl->get();
293 $ilUser->writePref(
"il_feed_js",
"n");
294 $ilCtrl->returnToParent($this);
302 $ilUser->writePref(
"il_feed_js",
"y");
315 if ($this->
isRepositoryObject() && !$ilAccess->checkAccess(
"read",
"", $this->getRefId())) {
316 $this->tpl->setVariable(
"TXT_TITLE", $item->getTitle());
318 $ilCtrl->setParameter($this,
"feed_item_id", $item->getId());
319 $this->tpl->setCurrentBlock(
"feed_link");
320 $this->tpl->setVariable(
"VAL_TITLE", $item->getTitle());
321 $this->tpl->setVariable(
323 $ilCtrl->getLinkTarget($this,
"showFeedItem")
325 $ilCtrl->setParameter($this,
"feed_item_id",
"");
326 $this->tpl->parseCurrentBlock();
340 return '<div class="small">' . ((int) count($this->
getData())) .
" " .
$lng->txt(
"feed_feed_items") .
"</div>";
351 include_once(
"./Services/News/classes/class.ilNewsItem.php");
353 $this->feed->fetch();
354 foreach ($this->feed->getItems() as $item) {
355 if ($item->getId() ==
$_GET[
"feed_item_id"]) {
361 $tpl =
new ilTemplate(
"tpl.show_feed_item.html",
true,
true,
"Services/Feeds");
363 if (is_object($c_item)) {
364 if (trim($c_item->getSummary()) !=
"") {
365 $tpl->setCurrentBlock(
"content");
366 $tpl->setVariable(
"VAL_CONTENT", $c_item->getSummary());
367 $tpl->parseCurrentBlock();
369 if (trim($c_item->getDate()) !=
"" || trim($c_item->getAuthor()) !=
"") {
370 $tpl->setCurrentBlock(
"date_author");
371 if (trim($c_item->getAuthor()) !=
"") {
372 $tpl->setVariable(
"VAL_AUTHOR", $c_item->getAuthor() .
" - ");
374 $tpl->setVariable(
"VAL_DATE", $c_item->getDate());
375 $tpl->parseCurrentBlock();
378 if (trim($c_item->getLink()) !=
"") {
379 $tpl->setCurrentBlock(
"plink");
380 $tpl->setVariable(
"HREF_LINK", $c_item->getLink());
381 $tpl->setVariable(
"TXT_LINK",
$lng->txt(
"feed_open_source_page"));
382 $tpl->parseCurrentBlock();
384 $tpl->setVariable(
"VAL_TITLE", $c_item->getTitle());
387 include_once(
"./Services/PersonalDesktop/classes/class.ilPDContentBlockGUI.php");
389 $content_block->setContent(
$tpl->get());
390 $content_block->setTitle($this->
getTitle());
392 $content_block->addHeaderCommand(
393 $ilCtrl->getParentReturn($this),
398 return $content_block->getHTML();
411 $html2 =
"<br/>" . $this->form->getHTML();
427 $lng->loadLanguageModule(
"feed");
429 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
431 $this->form->setTarget(
"_top");
434 include_once(
"./Services/Form/classes/class.ilFileInputGUI.php");
437 $fi->setRequired(
true);
438 $this->form->addItem($fi);
440 $this->form->addCommandButton(
"importFile",
$lng->txt(
"import"));
441 $this->form->addCommandButton(
"cancelSaveFeedBlock",
$lng->txt(
"cancel"));
442 $this->form->setTitle(
$lng->txt($a_new_type .
"_import"));
444 $ilCtrl->setParameter($this,
"new_type", $a_new_type);
445 $this->form->setFormAction(
$ilCtrl->getFormAction($this));
463 $this->
ilias->raiseError($this->lng->txt(
"no_create_permission"), $this->
ilias->error_obj->MESSAGE);
465 $this->ctrl->setParameter($this,
"new_type", $new_type);
467 if ($this->form->checkInput()) {
469 include_once(
"./Services/Export/classes/class.ilImport.php");
471 $new_id = $imp->importObject(
473 $_FILES[
"importfile"][
"tmp_name"],
474 $_FILES[
"importfile"][
"name"],
481 $newObj->createReference();
482 $newObj->putInTree($_GET[
"ref_id"]);
483 $newObj->setPermissions($_GET[
"ref_id"]);
490 $this->form->setValuesByPost();
491 $tpl->setContent($this->form->getHtml());
505 $lng->loadLanguageModule(
"block");
507 require_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
514 $text_input->setRequired(
true);
515 $text_input->setMaxLength(200);
516 $this->form_gui->addItem($text_input);
520 $text_input->
setInfo(
$lng->txt(
"block_feed_block_feed_url_info"));
521 $text_input->setRequired(
true);
522 $text_input->setMaxLength(250);
523 $this->form_gui->addItem($text_input);
528 $this->form_gui->addCommandButton(
"saveFeedBlock",
$lng->txt(
"save"));
529 $this->form_gui->addCommandButton(
"cancelSaveFeedBlock",
$lng->txt(
"cancel"));
531 $this->form_gui->addCommandButton(
"updateFeedBlock",
$lng->txt(
"save"));
532 $this->form_gui->addCommandButton(
"cancelUpdateFeedBlock",
$lng->txt(
"cancel"));
535 $this->form_gui->setTitle(
$lng->txt(
"block_feed_block_head"));
536 $this->form_gui->setFormAction($this->ctrl->getFormAction($this));
576 $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.
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
Create styles array
The data for the language used.
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.
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.