Public Member Functions | Static Public Member Functions | Static Public Attributes

ilExternalFeedBlockGUI Class Reference
[Services/Feeds]

BlockGUI class for external feed block. More...

Inheritance diagram for ilExternalFeedBlockGUI:
Collaboration diagram for ilExternalFeedBlockGUI:

Public Member Functions

 ilExternalFeedBlockGUI ()
 Constructor.
 setBlock ($a_block)
 Do most of the initialisation.
executeCommand ()
 execute command
 fillDataSection ()
 Fill data section.
 getHTML ()
 Get block HTML code.
 getDynamic ()
 getDynamicReload ()
 getJSEnabler ()
 disableJS ()
 enableJS ()
 fillRow ($item)
 Fill feed item row.
 getOverview ()
 Get overview.
 showFeedItem ()
 Show Feed Item.
 create ()
 Create Form for Block.
 initFormFeedBlock ($a_mode)
 FORM FeedBlock: Init form.
 prepareSaveFeedBlock (&$a_feed_block)
 FORM FeedBlock: Prepare Saving of FeedBlock.
 exitSaveFeedBlock ()
 FORM FeedBlock: Exit save.
 cancelUpdateFeedBlock ()
 FORM FeedBlock: Exit save.
 exitUpdateFeedBlock ()
 FORM FeedBlock: Exit save.

Static Public Member Functions

static getBlockType ()
 Get block type.
static isRepositoryObject ()
 Get block type.
static getScreenMode ()
 Get Screen Mode for current command.

Static Public Attributes

static $block_type = "feed"

Detailed Description

BlockGUI class for external feed block.

This is the one that is used within the repository. On the personal desktop ilPDExternalFeedBlockGUI is used.

Author:
Alex Killing <alex.killing@gmx.de>
Version:
$Id$

ilExternalFeedBlockGUI: ilColumnGUI

Definition at line 39 of file class.ilExternalFeedBlockGUI.php.


Member Function Documentation

ilExternalFeedBlockGUI::cancelUpdateFeedBlock (  ) 

FORM FeedBlock: Exit save.

(Can be overwritten in derived classes)

Reimplemented from ilExternalFeedBlockGUIGen.

Definition at line 476 of file class.ilExternalFeedBlockGUI.php.

References $ilCtrl, and ilExternalFeedBlockGUIGen::getGuiObject().

        {
                global $ilCtrl;

                $this->getGuiObject()->cancelUpdate();
        }

Here is the call graph for this function:

ilExternalFeedBlockGUI::create (  ) 

Create Form for Block.

Definition at line 391 of file class.ilExternalFeedBlockGUI.php.

References ilExternalFeedBlockGUIGen::createFeedBlock().

        {
                return $this->createFeedBlock();
        }

Here is the call graph for this function:

ilExternalFeedBlockGUI::disableJS (  ) 

Definition at line 274 of file class.ilExternalFeedBlockGUI.php.

References $_SESSION, and $ilCtrl.

        {
                global $ilCtrl, $ilUser;
                
                $_SESSION["il_feed_js"] = "n";
                $ilUser->writePref("il_feed_js", "n");
                $ilCtrl->returnToParent($this);
        }

ilExternalFeedBlockGUI::enableJS (  ) 

Definition at line 283 of file class.ilExternalFeedBlockGUI.php.

References $_SESSION, exit, and getHTML().

        {
                global $ilUser;
                
                $_SESSION["il_feed_js"] = "y";
                $ilUser->writePref("il_feed_js", "y");
                echo $this->getHTML();
                exit;
        }

Here is the call graph for this function:

& ilExternalFeedBlockGUI::executeCommand (  ) 

execute command

Reimplemented from ilExternalFeedBlockGUIGen.

Definition at line 131 of file class.ilExternalFeedBlockGUI.php.

References $cmd, and $ilCtrl.

        {
                global $ilCtrl;

                $next_class = $ilCtrl->getNextClass();
                $cmd = $ilCtrl->getCmd("getHTML");

                switch ($next_class)
                {
                        default:
                                return $this->$cmd();
                }
        }

ilExternalFeedBlockGUI::exitSaveFeedBlock (  ) 

FORM FeedBlock: Exit save.

(Can be overwritten in derived classes)

Reimplemented from ilExternalFeedBlockGUIGen.

Definition at line 465 of file class.ilExternalFeedBlockGUI.php.

References $ilCtrl, and ilExternalFeedBlockGUIGen::getGuiObject().

        {
                global $ilCtrl;

                $this->getGuiObject()->exitSave();
        }

Here is the call graph for this function:

ilExternalFeedBlockGUI::exitUpdateFeedBlock (  ) 

FORM FeedBlock: Exit save.

(Can be overwritten in derived classes)

Reimplemented from ilExternalFeedBlockGUIGen.

Definition at line 487 of file class.ilExternalFeedBlockGUI.php.

References $ilCtrl, and ilExternalFeedBlockGUIGen::getGuiObject().

        {
                global $ilCtrl;
                
                $this->getGuiObject()->update($this->external_feed_block);
        }

Here is the call graph for this function:

ilExternalFeedBlockGUI::fillDataSection (  ) 

Fill data section.

Reimplemented from ilBlockGUI.

Definition at line 148 of file class.ilExternalFeedBlockGUI.php.

References ilBlockGUI::getCurrentDetailLevel(), ilBlockGUI::getData(), getDynamic(), getDynamicReload(), getOverview(), and ilBlockGUI::setDataSection().

        {
                if ($this->getDynamic())
                {
                        $this->setDataSection($this->getDynamicReload());
                }
                else if ($this->getCurrentDetailLevel() > 1 && count($this->getData()) > 0)
                {
                        parent::fillDataSection();
                }
                else
                {
                        $this->setDataSection($this->getOverview());
                }
        }

Here is the call graph for this function:

ilExternalFeedBlockGUI::fillRow ( item  ) 

Fill feed item row.

Reimplemented from ilBlockGUI.

Definition at line 296 of file class.ilExternalFeedBlockGUI.php.

References $ilCtrl, $lng, and isRepositoryObject().

        {
                global $ilUser, $ilCtrl, $lng, $ilAccess;

                if ($this->isRepositoryObject() && !$ilAccess->checkAccess("read", "", $this->getRefId()))
                {
                        $this->tpl->setVariable("TXT_TITLE", $item->getTitle());
                }
                else
                {
                        $ilCtrl->setParameter($this, "feed_item_id", $item->getId());
                        $this->tpl->setCurrentBlock("feed_link");
                        $this->tpl->setVariable("VAL_TITLE", $item->getTitle());
                        $this->tpl->setVariable("HREF_SHOW",
                                $ilCtrl->getLinkTarget($this, "showFeedItem"));
                        $ilCtrl->setParameter($this, "feed_item_id", "");
                        $this->tpl->parseCurrentBlock();
                }
        }

Here is the call graph for this function:

static ilExternalFeedBlockGUI::getBlockType (  )  [static]

Get block type.

Returns:
string Block type.

Reimplemented from ilBlockGUI.

Definition at line 65 of file class.ilExternalFeedBlockGUI.php.

Referenced by prepareSaveFeedBlock().

        {
                return self::$block_type;
        }

Here is the caller graph for this function:

ilExternalFeedBlockGUI::getDynamic (  ) 

Definition at line 217 of file class.ilExternalFeedBlockGUI.php.

References $_SESSION, and $ilCtrl.

Referenced by fillDataSection(), and getHTML().

        {
                global $ilCtrl, $ilUser;
                
                if ($ilCtrl->getCmdClass() != "ilcolumngui" && $ilCtrl->getCmd() != "enableJS")
                {
                        if ($_SESSION["il_feed_js"] != "n" &&
                                ($ilUser->getPref("il_feed_js") != "n" || $_SESSION["il_feed_js"] == "y"))
                        {
                                // do not get feed dynamically, if cache hit is given.
                                if (!$this->feed->checkCacheHit())
                                {
                                        return true;
                                }
                        }
                }
                
                return false;
        }

Here is the caller graph for this function:

ilExternalFeedBlockGUI::getDynamicReload (  ) 

Definition at line 237 of file class.ilExternalFeedBlockGUI.php.

References $ilCtrl, $lng, and ilBlockGUI::getBlockId().

Referenced by fillDataSection().

        {
                global $ilCtrl, $lng;
                
                $ilCtrl->setParameterByClass("ilcolumngui", "block_id",
                        "block_feed_".$this->getBlockId());

                $rel_tpl = new ilTemplate("tpl.dynamic_reload.html", true, true, "Services/Feeds");
                $rel_tpl->setVariable("TXT_LOADING", $lng->txt("feed_loading_feed"));
                $rel_tpl->setVariable("BLOCK_ID", "block_feed_".$this->getBlockId());
                $rel_tpl->setVariable("TARGET", 
                        $ilCtrl->getLinkTargetByClass("ilcolumngui", "updateBlock", "", true));
                        
                // no JS
                $rel_tpl->setVariable("TXT_FEED_CLICK_HERE", $lng->txt("feed_no_js_click_here"));
                $rel_tpl->setVariable("TARGET_NO_JS", 
                        $ilCtrl->getLinkTargetByClass("ilexternalfeedblockgui", "disableJS"));

                return $rel_tpl->get();
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilExternalFeedBlockGUI::getHTML (  ) 

Get block HTML code.

Reimplemented from ilBlockGUI.

Definition at line 167 of file class.ilExternalFeedBlockGUI.php.

References $_SESSION, $ilCtrl, $ilSetting, $lng, ilBlockGUI::addBlockCommand(), ilBlockGUI::getBlockId(), ilBlockGUI::getCurrentDetailLevel(), getDynamic(), getJSEnabler(), ilBlockGUI::getRefId(), and ilBlockGUI::setData().

Referenced by enableJS().

        {
                global $ilCtrl, $lng, $ilUser, $ilAccess, $ilSetting;
                
                if ($this->getCurrentDetailLevel() == 0)
                {
                        return "";
                }

                $feed_set = new ilSetting("feed");
                
                if ($feed_set->get("disable_rep_feeds"))
                {
                        return "";
                }
                
                // if no dynamic reload
                if (!$this->getDynamic())
                {
                        $this->feed->fetch();
                        $this->setData($this->feed->getItems());
                }

                //$this->setTitle($this->feed->getChannelTitle());
                $this->setData($this->feed->getItems());

                if ($ilAccess->checkAccess("write", "", $this->getRefId()))
                {
                        $ilCtrl->setParameterByClass("ilobjexternalfeedgui",
                                "ref_id", $this->getRefId());
                        $ilCtrl->setParameter($this, "external_feed_block_id", $this->getBlockId());
                        $this->addBlockCommand(
                                $ilCtrl->getLinkTargetByClass(array("ilrepositorygui", "ilobjexternalfeedgui",
                                        "ilexternalfeedblockgui"),
                                        "editFeedBlock"),
                                $lng->txt("edit"));
                        $ilCtrl->clearParametersByClass("ilobjexternalfeedgui");
                }

                // JS enabler
                $add = "";
                if ($_SESSION["il_feed_js"] == "n" ||
                        ($ilUser->getPref("il_feed_js") == "n" && $_SESSION["il_feed_js"] != "y"))
                {
                        $add = $this->getJSEnabler();
                }

                return parent::getHTML().$add;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilExternalFeedBlockGUI::getJSEnabler (  ) 

Definition at line 258 of file class.ilExternalFeedBlockGUI.php.

References $ilCtrl, $lng, and ilBlockGUI::getBlockId().

Referenced by getHTML().

        {
                global $ilCtrl, $lng;
                
                $ilCtrl->setParameterByClass("ilcolumngui", "block_id",
                        "block_feed_".$this->getBlockId());

                $rel_tpl = new ilTemplate("tpl.js_enabler.html", true, true, "Services/Feeds");
                $rel_tpl->setVariable("BLOCK_ID", "block_feed_".$this->getBlockId());
                $rel_tpl->setVariable("TARGET", 
                        $ilCtrl->getLinkTargetByClass("ilexternalfeedblockgui", "enableJS", true));
                        
                return $rel_tpl->get();
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilExternalFeedBlockGUI::getOverview (  ) 

Get overview.

Definition at line 319 of file class.ilExternalFeedBlockGUI.php.

References $ilCtrl, $lng, ilBlockGUI::getData(), and ilBlockGUI::setEnableNumInfo().

Referenced by fillDataSection().

        {
                global $ilUser, $lng, $ilCtrl;
                
                $this->setEnableNumInfo(false);
                return '<div class="small">'.((int) count($this->getData()))." ".$lng->txt("feed_feed_items")."</div>";
        }

Here is the call graph for this function:

Here is the caller graph for this function:

static ilExternalFeedBlockGUI::getScreenMode (  )  [static]

Get Screen Mode for current command.

Reimplemented from ilBlockGUI.

Definition at line 83 of file class.ilExternalFeedBlockGUI.php.

References $ilCtrl.

        {
                global $ilCtrl;
                
                switch($ilCtrl->getCmd())
                {
                        case "create":
                        case "edit":
                        case "saveFeedBlock":
                        case "updateFeedBlock":
                        case "editFeedBlock":
                        case "showFeedItem":
                        case "confirmDeleteFeedBlock":
                                return IL_SCREEN_CENTER;
                                break;
                                
                        default:
                                return IL_SCREEN_SIDE;
                                break;
                }
        }

ilExternalFeedBlockGUI::ilExternalFeedBlockGUI (  ) 

Constructor.

Definition at line 46 of file class.ilExternalFeedBlockGUI.php.

References $ilCtrl, $lng, ilExternalFeedBlockGUIGen::__construct(), ilUtil::getImagePath(), ilBlockGUI::ilBlockGUI(), ilBlockGUI::setImage(), ilBlockGUI::setLimit(), and ilBlockGUI::setRowTemplate().

        {
                global $ilCtrl, $lng;
                
                parent::__construct();
                parent::ilBlockGUI();
                
                $this->setImage(ilUtil::getImagePath("icon_feed_s.gif"));

                $lng->loadLanguageModule("feed");
                $this->setLimit(5);
                $this->setRowTemplate("tpl.block_external_feed_row.html", "Services/Feeds");
        }

Here is the call graph for this function:

ilExternalFeedBlockGUI::initFormFeedBlock ( a_mode  ) 

FORM FeedBlock: Init form.

(We need to overwrite, because Generator does not know FeedUrl Inputs yet.

Parameters:
int $a_mode Form Edit Mode (IL_FORM_EDIT | IL_FORM_CREATE)

Reimplemented from ilExternalFeedBlockGUIGen.

Definition at line 402 of file class.ilExternalFeedBlockGUI.php.

References $lng, and ilExternalFeedBlockGUIGen::prepareFormFeedBlock().

        {
                global $lng;
                
                $lng->loadLanguageModule("block");
                
                include("Services/Form/classes/class.ilPropertyFormGUI.php");
                
                $this->form_gui = new ilPropertyFormGUI();
                
                // Property Title
                $text_input = new ilTextInputGUI($lng->txt("block_feed_block_title"), "block_title");
                $text_input->setInfo("");
                $text_input->setRequired(true);
                $text_input->setMaxLength(200);
                $this->form_gui->addItem($text_input);
                
                // Property FeedUrl
                $text_input = new ilFeedUrlInputGUI($lng->txt("block_feed_block_feed_url"), "block_feed_url");
                $text_input->setInfo($lng->txt("block_feed_block_feed_url_info"));
                $text_input->setRequired(true);
                $text_input->setMaxLength(250);
                $this->form_gui->addItem($text_input);
                
                
                // save and cancel commands
                if (in_array($a_mode, array(IL_FORM_CREATE,IL_FORM_RE_CREATE)))
                {
                        $this->form_gui->addCommandButton("saveFeedBlock", $lng->txt("save"));
                        $this->form_gui->addCommandButton("cancelSaveFeedBlock", $lng->txt("cancel"));
                }
                else
                {
                        $this->form_gui->addCommandButton("updateFeedBlock", $lng->txt("save"));
                        $this->form_gui->addCommandButton("cancelUpdateFeedBlock", $lng->txt("cancel"));
                }
                
                $this->form_gui->setTitle($lng->txt("block_feed_block_head"));
                $this->form_gui->setFormAction($this->ctrl->getFormAction($this));
                
                $this->prepareFormFeedBlock($this->form_gui);

        }

Here is the call graph for this function:

static ilExternalFeedBlockGUI::isRepositoryObject (  )  [static]

Get block type.

Returns:
string Block type.

Reimplemented from ilBlockGUI.

Definition at line 75 of file class.ilExternalFeedBlockGUI.php.

Referenced by fillRow().

        {
                return true;
        }

Here is the caller graph for this function:

ilExternalFeedBlockGUI::prepareSaveFeedBlock ( &$  a_feed_block  ) 

FORM FeedBlock: Prepare Saving of FeedBlock.

Parameters:
object $a_feed_block FeedBlock object.

Reimplemented from ilExternalFeedBlockGUIGen.

Definition at line 451 of file class.ilExternalFeedBlockGUI.php.

References $ilCtrl, $ref_id, getBlockType(), and ilExternalFeedBlockGUIGen::getGuiObject().

        {
                global $ilCtrl;
                
                $ref_id = $this->getGuiObject()->save($a_feed_block);
                $a_feed_block->setType($this->getBlockType());
                //$a_feed_block->setContextObjId($ilCtrl->getContextObjId());
                //$a_feed_block->setContextObjType($ilCtrl->getContextObjType());
        }

Here is the call graph for this function:

ilExternalFeedBlockGUI::setBlock ( a_block  ) 

Do most of the initialisation.

Definition at line 108 of file class.ilExternalFeedBlockGUI.php.

References $ilCtrl, ilBlockGUI::setAvailableDetailLevels(), ilBlockGUI::setBlockId(), and ilBlockGUI::setTitle().

        {
                global $ilCtrl;

                // init block
                $this->feed_block = $a_block;
                $this->setTitle($this->feed_block->getTitle());
                $this->setBlockId($this->feed_block->getId());
                
                // get feed object
                include_once("./Services/Feeds/classes/class.ilExternalFeed.php");
                $this->feed = new ilExternalFeed();
                $this->feed->setUrl($this->feed_block->getFeedUrl());
                
                // init details
                $this->setAvailableDetailLevels(2);
                
                $ilCtrl->setParameter($this, "block_id", $this->feed_block->getId());
        }

Here is the call graph for this function:

ilExternalFeedBlockGUI::showFeedItem (  ) 

Show Feed Item.

Definition at line 330 of file class.ilExternalFeedBlockGUI.php.

References $_GET, $ilCtrl, $lng, $tpl, ilUtil::getImagePath(), and ilBlockGUI::getTitle().

        {
                global $lng, $ilCtrl;
                
                include_once("./Services/News/classes/class.ilNewsItem.php");

                $this->feed->fetch();
                foreach($this->feed->getItems() as $item)
                {
                        if ($item->getId() == $_GET["feed_item_id"])
                        {
                                $c_item = $item;
                                break;
                        }
                }
                
                $tpl = new ilTemplate("tpl.show_feed_item.html", true, true, "Services/Feeds");
                
                if (is_object($c_item))
                {
                        if (trim($c_item->getSummary()) != "")          // summary
                        {
                                $tpl->setCurrentBlock("content");
                                $tpl->setVariable("VAL_CONTENT", $c_item->getSummary());
                                $tpl->parseCurrentBlock();
                        }
                        if (trim($c_item->getDate()) != "" || trim($c_item->getAuthor()) != "")         // date
                        {
                                $tpl->setCurrentBlock("date_author");
                                if (trim($c_item->getAuthor()) != "")
                                {
                                        $tpl->setVariable("VAL_AUTHOR", $c_item->getAuthor()." - ");
                                }
                                $tpl->setVariable("VAL_DATE", $c_item->getDate());
                                $tpl->parseCurrentBlock();
                        }

                        if (trim($c_item->getLink()) != "")             // link
                        {
                                $tpl->setCurrentBlock("plink");
                                $tpl->setVariable("HREF_LINK", $c_item->getLink());
                                $tpl->setVariable("TXT_LINK", $lng->txt("feed_open_source_page"));
                                $tpl->parseCurrentBlock();
                        }
                        $tpl->setVariable("VAL_TITLE", $c_item->getTitle());                    // title
                }
                
                include_once("./Services/PersonalDesktop/classes/class.ilPDContentBlockGUI.php");
                $content_block = new ilPDContentBlockGUI();
                $content_block->setContent($tpl->get());
                $content_block->setTitle($this->getTitle());
                $content_block->setImage(ilUtil::getImagePath("icon_feed.gif"));
                $content_block->addHeaderCommand($ilCtrl->getParentReturn($this),
                        $lng->txt("close"), true);

                return $content_block->getHTML();
        }

Here is the call graph for this function:


Field Documentation

ilExternalFeedBlockGUI::$block_type = "feed" [static]

Definition at line 41 of file class.ilExternalFeedBlockGUI.php.


The documentation for this class was generated from the following file: