ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilPDNewsGUI Class Reference

News on PD. More...

+ Collaboration diagram for ilPDNewsGUI:

Public Member Functions

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

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$

@ilCtrl_Calls ilPDNewsGUI:

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

Member Function Documentation

◆ applyFilter()

ilPDNewsGUI::applyFilter ( )

change related object

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

152 {
153 global $ilUser;
154
155 $this->ctrl->setParameter($this, "news_ref_id", $_POST["news_ref_id"]);
156 $ilUser->writePref("news_sel_ref_id", $_POST["news_ref_id"]);
157 if ($_POST["news_per"] > 0)
158 {
159 $_SESSION["news_pd_news_per"] = $_POST["news_per"];
160 }
161 $this->ctrl->redirect($this, "view");
162 }
$_SESSION["AccountId"]
$_POST['username']
Definition: cron.php:12
global $ilUser
Definition: imgupload.php:15

References $_POST, $_SESSION, and $ilUser.

◆ displayHeader()

ilPDNewsGUI::displayHeader ( )

display header and locator

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

63 {
64 $this->tpl->setTitle($this->lng->txt("news"));
65
66 // display infopanel if something happened
68 }
static infoPanel($a_keep=true)

References ilUtil\infoPanel().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

& ilPDNewsGUI::executeCommand ( )

execute command

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

43 {
44 $next_class = $this->ctrl->getNextClass();
45
46 switch($next_class)
47 {
48
49 default:
50 $cmd = $this->ctrl->getCmd("view");
51 $this->displayHeader();
52 $this->$cmd();
53 break;
54 }
55 $this->tpl->show(true);
56 return true;
57 }
displayHeader()
display header and locator
$cmd
Definition: sahs_server.php:35

References $cmd, and displayHeader().

+ Here is the call graph for this function:

◆ ilPDNewsGUI()

ilPDNewsGUI::ilPDNewsGUI ( )

Constructor.

@access public

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

24 {
25 global $tpl, $lng, $ilCtrl, $ilHelp;
26
27 $ilHelp->setScreenIdComponent("news");
28
29 // initiate variables
30 $this->tpl =& $tpl;
31 $this->lng =& $lng;
32 $this->ctrl =& $ilCtrl;
33
34 $lng->loadLanguageModule("news");
35
36 $this->ctrl->saveParameter($this, "news_ref_id");
37 }
global $tpl
Definition: ilias.php:8
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:40

References $ilCtrl, $lng, and $tpl.

◆ resetFilter()

ilPDNewsGUI::resetFilter ( )

reset filter

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

168 {
169 global $ilUser;
170 $this->ctrl->setParameter($this, "news_ref_id", 0);
171 $ilUser->writePref("news_sel_ref_id", 0);
172 $_SESSION["news_pd_news_per"] = "";
173 $this->ctrl->redirect($this, "view");
174 }

References $_SESSION, and $ilUser.

◆ view()

ilPDNewsGUI::view ( )

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

74 {
75 global $ilUser, $lng, $tpl, $ilCtrl;
76
77 $ref_ids = array();
78 $obj_ids = array();
79 $pd_items = $ilUser->getDesktopItems();
80 foreach($pd_items as $item)
81 {
82 $ref_ids[] = $item["ref_id"];
83 $obj_ids[] = $item["obj_id"];
84 }
85
86 $sel_ref_id = ($_GET["news_ref_id"] > 0)
87 ? $_GET["news_ref_id"]
88 : $ilUser->getPref("news_sel_ref_id");
89
90 include_once("./Services/News/classes/class.ilNewsItem.php");
91 $per = ($_SESSION["news_pd_news_per"] != "")
92 ? $_SESSION["news_pd_news_per"]
94 $news_obj_ids = ilNewsItem::filterObjIdsPerNews($obj_ids, $per);
95
96 // related objects (contexts) of news
97 $contexts[0] = $lng->txt("news_all_items");
98
99 $conts = array();
100 $sel_has_news = false;
101 foreach ($ref_ids as $ref_id)
102 {
104 $title = ilObject::_lookupTitle($obj_id);
105
106 $conts[$ref_id] = $title;
107 if ($sel_ref_id == $ref_id)
108 {
109 $sel_has_news = true;
110 }
111 }
112
113 $cnt = array();
114 $nitem = new ilNewsItem();
115 $news_items = $nitem->_getNewsItemsOfUser($ilUser->getId(), false,
116 true, $per, $cnt);
117
118 // reset selected news ref id, if no news are given for id
119 if (!$sel_has_news)
120 {
121 $sel_ref_id = "";
122 }
123 asort($conts);
124 foreach($conts as $ref_id => $title)
125 {
126 $contexts[$ref_id] = $title." (".(int) $cnt[$ref_id].")";
127 }
128
129
130 if ($sel_ref_id > 0)
131 {
132 $obj_id = ilObject::_lookupObjId($sel_ref_id);
133 $obj_type = ilObject::_lookupType($obj_id);
134 $nitem->setContextObjId($obj_id);
135 $nitem->setContextObjType($obj_type);
136 $news_items = $nitem->getNewsForRefId($sel_ref_id, false,
137 false, $per, true);
138 }
139
140 include_once("./Services/News/classes/class.ilPDNewsTableGUI.php");
141 $pd_news_table = new ilPDNewsTableGUI($this, "view", $contexts, $sel_ref_id);
142 $pd_news_table->setData($news_items);
143 $pd_news_table->setNoEntriesText($lng->txt("news_no_news_items"));
144
145 $tpl->setContent($pd_news_table->getHTML());
146 }
$_GET["client_id"]
static filterObjIdsPerNews($a_obj_ids, $a_time_period=0, $a_starting_date="", $a_ending_date='', $ignore_period=false)
Checks whether news are available for.
_lookupUserPDPeriod($a_user_id)
static _lookupObjId($a_id)
static _lookupTitle($a_id)
lookup object title
static _lookupType($a_id, $a_reference=false)
lookup object type
Personal desktop news table.
$ref_id
Definition: sahs_server.php:39

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

+ Here is the call graph for this function:

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