ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilPDNewsGUI Class Reference

News on PD. More...

+ Collaboration diagram for ilPDNewsGUI:

Public Member Functions

 ilPDNewsGUI ()
 Constructor.
executeCommand ()
 execute command
 displayHeader ()
 display header and locator
 view ()
 applyFilter ()
 change related object
 resetFilter ()
 reset filter

Detailed Description

News on PD.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

ilPDNewsGUI:

Definition at line 15 of file class.ilPDNewsGUI.php.

Member Function Documentation

ilPDNewsGUI::applyFilter ( )

change related object

Definition at line 151 of file class.ilPDNewsGUI.php.

References $_POST, $_SESSION, and $ilUser.

{
global $ilUser;
$this->ctrl->setParameter($this, "news_ref_id", $_POST["news_ref_id"]);
$ilUser->writePref("news_sel_ref_id", $_POST["news_ref_id"]);
if ($_POST["news_per"] > 0)
{
$_SESSION["news_pd_news_per"] = $_POST["news_per"];
}
$this->ctrl->redirect($this, "view");
}
ilPDNewsGUI::displayHeader ( )

display header and locator

Definition at line 62 of file class.ilPDNewsGUI.php.

References ilUtil\infoPanel().

Referenced by executeCommand().

{
$this->tpl->setTitle($this->lng->txt("news"));
// display infopanel if something happened
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

& ilPDNewsGUI::executeCommand ( )

execute command

Definition at line 42 of file class.ilPDNewsGUI.php.

References $cmd, and displayHeader().

{
$next_class = $this->ctrl->getNextClass();
switch($next_class)
{
default:
$cmd = $this->ctrl->getCmd("view");
$this->displayHeader();
$this->$cmd();
break;
}
$this->tpl->show(true);
return true;
}

+ Here is the call graph for this function:

ilPDNewsGUI::ilPDNewsGUI ( )

Constructor.

public

Definition at line 23 of file class.ilPDNewsGUI.php.

References $ilCtrl, $lng, and $tpl.

{
global $tpl, $lng, $ilCtrl, $ilHelp;
$ilHelp->setScreenIdComponent("news");
// initiate variables
$this->tpl =& $tpl;
$this->lng =& $lng;
$this->ctrl =& $ilCtrl;
$lng->loadLanguageModule("news");
$this->ctrl->saveParameter($this, "news_ref_id");
}
ilPDNewsGUI::resetFilter ( )

reset filter

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

References $_SESSION, and $ilUser.

{
global $ilUser;
$this->ctrl->setParameter($this, "news_ref_id", 0);
$ilUser->writePref("news_sel_ref_id", 0);
$_SESSION["news_pd_news_per"] = "";
$this->ctrl->redirect($this, "view");
}
ilPDNewsGUI::view ( )

Definition at line 73 of file class.ilPDNewsGUI.php.

References $_GET, $_SESSION, $ilCtrl, $ilUser, $lng, $ref_id, $tpl, ilObject\_lookupObjId(), ilObject\_lookupTitle(), ilObject\_lookupType(), ilNewsItem\_lookupUserPDPeriod(), and ilNewsItem\filterObjIdsPerNews().

{
global $ilUser, $lng, $tpl, $ilCtrl;
$ref_ids = array();
$obj_ids = array();
$pd_items = $ilUser->getDesktopItems();
foreach($pd_items as $item)
{
$ref_ids[] = $item["ref_id"];
$obj_ids[] = $item["obj_id"];
}
$sel_ref_id = ($_GET["news_ref_id"] > 0)
? $_GET["news_ref_id"]
: $ilUser->getPref("news_sel_ref_id");
include_once("./Services/News/classes/class.ilNewsItem.php");
$per = ($_SESSION["news_pd_news_per"] != "")
? $_SESSION["news_pd_news_per"]
: ilNewsItem::_lookupUserPDPeriod($ilUser->getId());
$news_obj_ids = ilNewsItem::filterObjIdsPerNews($obj_ids, $per);
// related objects (contexts) of news
$contexts[0] = $lng->txt("news_all_items");
$conts = array();
$sel_has_news = false;
foreach ($ref_ids as $ref_id)
{
$obj_id = ilObject::_lookupObjId($ref_id);
$title = ilObject::_lookupTitle($obj_id);
$conts[$ref_id] = $title;
if ($sel_ref_id == $ref_id)
{
$sel_has_news = true;
}
}
$cnt = array();
$nitem = new ilNewsItem();
$news_items = $nitem->_getNewsItemsOfUser($ilUser->getId(), false,
true, $per, $cnt);
// reset selected news ref id, if no news are given for id
if (!$sel_has_news)
{
$sel_ref_id = "";
}
asort($conts);
foreach($conts as $ref_id => $title)
{
$contexts[$ref_id] = $title." (".(int) $cnt[$ref_id].")";
}
if ($sel_ref_id > 0)
{
$obj_id = ilObject::_lookupObjId($sel_ref_id);
$obj_type = ilObject::_lookupType($obj_id);
$nitem->setContextObjId($obj_id);
$nitem->setContextObjType($obj_type);
$news_items = $nitem->getNewsForRefId($sel_ref_id, false,
false, $per, true);
}
include_once("./Services/News/classes/class.ilPDNewsTableGUI.php");
$pd_news_table = new ilPDNewsTableGUI($this, "view", $contexts, $sel_ref_id);
$pd_news_table->setData($news_items);
$pd_news_table->setNoEntriesText($lng->txt("news_no_news_items"));
$tpl->setContent($pd_news_table->getHTML());
}

+ Here is the call graph for this function:


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