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

ilPDExternalFeedBlockGUI Class Reference
[Services/Feeds]

BlockGUI class for external feed block on the personal desktop. More...

Inheritance diagram for ilPDExternalFeedBlockGUI:
Collaboration diagram for ilPDExternalFeedBlockGUI:

Public Member Functions

 ilPDExternalFeedBlockGUI ()
 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.
 confirmDeleteFeedBlock ()
 Confirmation of feed block deletion.
 exitDeleteFeedBlock ()
 Cancel deletion of feed block.
 deleteFeedBlock ()
 Delete feed block.

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 = "pdfeed"

Detailed Description

BlockGUI class for external feed block on the personal desktop.

Within the repository ilExternalFeedBlockGUI is used. is used.

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

ilPDExternalFeedBlockGUI: ilColumnGUI

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


Member Function Documentation

ilPDExternalFeedBlockGUI::confirmDeleteFeedBlock (  ) 

Confirmation of feed block deletion.

Definition at line 452 of file class.ilPDExternalFeedBlockGUI.php.

References $ilCtrl, $lng, and ilUtil::getImagePath().

        {
                global $ilCtrl, $lng;
                
                include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
                $c_gui = new ilConfirmationGUI();
                
                // set confirm/cancel commands
                $c_gui->setFormAction($ilCtrl->getFormAction($this, "deleteFeedBlock"));
                $c_gui->setHeaderText($lng->txt("info_delete_sure"));
                $c_gui->setCancel($lng->txt("cancel"), "exitDeleteFeedBlock");
                $c_gui->setConfirm($lng->txt("confirm"), "deleteFeedBlock");

                // add items to delete
                $c_gui->addItem("external_feed_block_id",
                        $this->feed_block->getId(), $this->feed_block->getTitle(),
                        ilUtil::getImagePath("icon_feed.gif"));
                
                return $c_gui->getHTML();
        }

Here is the call graph for this function:

ilPDExternalFeedBlockGUI::create (  ) 

Create Form for Block.

Definition at line 380 of file class.ilPDExternalFeedBlockGUI.php.

References ilExternalFeedBlockGUIGen::createFeedBlock().

        {
                return $this->createFeedBlock();
        }

Here is the call graph for this function:

ilPDExternalFeedBlockGUI::deleteFeedBlock (  ) 

Delete feed block.

Definition at line 486 of file class.ilPDExternalFeedBlockGUI.php.

References $ilCtrl.

        {
                global $ilCtrl;

                $this->feed_block->delete();
                $ilCtrl->returnToParent($this);
        }

ilPDExternalFeedBlockGUI::disableJS (  ) 

Definition at line 272 of file class.ilPDExternalFeedBlockGUI.php.

References $_SESSION, and $ilCtrl.

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

ilPDExternalFeedBlockGUI::enableJS (  ) 

Definition at line 281 of file class.ilPDExternalFeedBlockGUI.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:

& ilPDExternalFeedBlockGUI::executeCommand (  ) 

execute command

Reimplemented from ilExternalFeedBlockGUIGen.

Definition at line 132 of file class.ilPDExternalFeedBlockGUI.php.

References $cmd, and $ilCtrl.

        {
                global $ilCtrl;

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

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

ilPDExternalFeedBlockGUI::exitDeleteFeedBlock (  ) 

Cancel deletion of feed block.

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

References $ilCtrl.

        {
                global $ilCtrl;

                $ilCtrl->returnToParent($this);
        }

ilPDExternalFeedBlockGUI::fillDataSection (  ) 

Fill data section.

Reimplemented from ilBlockGUI.

Definition at line 149 of file class.ilPDExternalFeedBlockGUI.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:

ilPDExternalFeedBlockGUI::fillRow ( item  ) 

Fill feed item row.

Reimplemented from ilBlockGUI.

Definition at line 294 of file class.ilPDExternalFeedBlockGUI.php.

References $ilCtrl, and $lng.

        {
                global $ilUser, $ilCtrl, $lng;

                $ilCtrl->setParameter($this, "feed_item_id", $item->getId());
                $this->tpl->setVariable("VAL_TITLE", $item->getTitle());
                $this->tpl->setVariable("HREF_SHOW",
                        $ilCtrl->getLinkTarget($this, "showFeedItem"));
                $ilCtrl->setParameter($this, "feed_item_id", "");
        }

static ilPDExternalFeedBlockGUI::getBlockType (  )  [static]

Get block type.

Returns:
string Block type.

Reimplemented from ilBlockGUI.

Definition at line 66 of file class.ilPDExternalFeedBlockGUI.php.

        {
                return self::$block_type;
        }

ilPDExternalFeedBlockGUI::getDynamic (  ) 

Definition at line 215 of file class.ilPDExternalFeedBlockGUI.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:

ilPDExternalFeedBlockGUI::getDynamicReload (  ) 

Definition at line 235 of file class.ilPDExternalFeedBlockGUI.php.

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

Referenced by fillDataSection().

        {
                global $ilCtrl, $lng;
                
                $ilCtrl->setParameterByClass("ilcolumngui", "block_id",
                        "block_pdfeed_".$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_pdfeed_".$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("ilpdexternalfeedblockgui", "disableJS"));

                return $rel_tpl->get();
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilPDExternalFeedBlockGUI::getHTML (  ) 

Get block HTML code.

Reimplemented from ilBlockGUI.

Definition at line 168 of file class.ilPDExternalFeedBlockGUI.php.

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

Referenced by enableJS().

        {
                global $ilCtrl, $lng, $ilUser, $ilAccess, $ilSetting;
                
                $feed_set = new ilSetting("feed");
                
                if ($ilSetting->get("block_limit_pdfeed") == 0)
                {
                        return "";
                }

                if ($this->getCurrentDetailLevel() == 0)
                {
                        return "";
                }

                
                // if no dynamic reload
                if (!$this->getDynamic())
                {
                        $this->feed->fetch();
                        $this->setData($this->feed->getItems());
                }

                $ilCtrl->setParameter($this, "external_feed_block_id",
                        $this->getBlockId());
                $this->addBlockCommand(
                        $ilCtrl->getLinkTarget($this,
                                "editFeedBlock"),
                        $lng->txt("edit"));
                $this->addBlockCommand(
                        $ilCtrl->getLinkTarget($this,
                                "confirmDeleteFeedBlock"),
                        $lng->txt("delete"));
                $ilCtrl->setParameter($this, "external_feed_block_id", "");

                // 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:

ilPDExternalFeedBlockGUI::getJSEnabler (  ) 

Definition at line 256 of file class.ilPDExternalFeedBlockGUI.php.

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

Referenced by getHTML().

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

ilPDExternalFeedBlockGUI::getOverview (  ) 

Get overview.

Definition at line 308 of file class.ilPDExternalFeedBlockGUI.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 ilPDExternalFeedBlockGUI::getScreenMode (  )  [static]

Get Screen Mode for current command.

Reimplemented from ilBlockGUI.

Definition at line 84 of file class.ilPDExternalFeedBlockGUI.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;
                }
        }

ilPDExternalFeedBlockGUI::ilPDExternalFeedBlockGUI (  ) 

Constructor.

Definition at line 46 of file class.ilPDExternalFeedBlockGUI.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:

ilPDExternalFeedBlockGUI::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 391 of file class.ilPDExternalFeedBlockGUI.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 ilPDExternalFeedBlockGUI::isRepositoryObject (  )  [static]

Get block type.

Returns:
string Block type.

Reimplemented from ilBlockGUI.

Definition at line 76 of file class.ilPDExternalFeedBlockGUI.php.

        {
                return false;
        }

ilPDExternalFeedBlockGUI::prepareSaveFeedBlock ( &$  a_feed_block  ) 

FORM FeedBlock: Prepare Saving of FeedBlock.

Parameters:
object $a_feed_block FeedBlock object.

Reimplemented from ilExternalFeedBlockGUIGen.

Definition at line 440 of file class.ilPDExternalFeedBlockGUI.php.

References $ilCtrl.

        {
                global $ilCtrl;
                
                $a_feed_block->setContextObjId($ilCtrl->getContextObjId());
                $a_feed_block->setContextObjType($ilCtrl->getContextObjType());
                $a_feed_block->setType("pdfeed");
        }

ilPDExternalFeedBlockGUI::setBlock ( a_block  ) 

Do most of the initialisation.

Definition at line 109 of file class.ilPDExternalFeedBlockGUI.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:

ilPDExternalFeedBlockGUI::showFeedItem (  ) 

Show Feed Item.

Definition at line 319 of file class.ilPDExternalFeedBlockGUI.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("selected_items_back"));

                return $content_block->getHTML();
        }

Here is the call graph for this function:


Field Documentation

ilPDExternalFeedBlockGUI::$block_type = "pdfeed" [static]

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


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