ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilPDNewsGUI Class Reference

News on PD. More...

+ Collaboration diagram for ilPDNewsGUI:

Public Member Functions

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

Protected Attributes

 $tpl
 
 $lng
 
 $ctrl
 
 $help
 
 $user
 

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.

Constructor & Destructor Documentation

◆ __construct()

ilPDNewsGUI::__construct ( )

Constructor.

@access public

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

49 {
50 global $DIC;
51
52 $this->help = $DIC["ilHelp"];
53 $this->user = $DIC->user();
54 $tpl = $DIC["tpl"];
55 $lng = $DIC->language();
56 $ilCtrl = $DIC->ctrl();
57 $ilHelp = $DIC["ilHelp"];
58
59 $ilHelp->setScreenIdComponent("news");
60
61 // initiate variables
62 $this->tpl = $tpl;
63 $this->lng = $lng;
64 $this->ctrl = $ilCtrl;
65
66 $lng->loadLanguageModule("news");
67
68 $this->ctrl->saveParameter($this, "news_ref_id");
69 }
user()
Definition: user.php:4
global $ilCtrl
Definition: ilias.php:18
global $DIC
Definition: saml.php:7

References $DIC, $ilCtrl, $lng, $tpl, and user().

+ Here is the call graph for this function:

Member Function Documentation

◆ applyFilter()

ilPDNewsGUI::applyFilter ( )

change related object

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

190 {
192
193 $this->ctrl->setParameter($this, "news_ref_id", $_POST["news_ref_id"]);
194 $ilUser->writePref("news_sel_ref_id", $_POST["news_ref_id"]);
195 if ($_POST["news_per"] > 0) {
196 $_SESSION["news_pd_news_per"] = $_POST["news_per"];
197 }
198 $this->ctrl->redirect($this, "view");
199 }
$_POST["username"]
$_SESSION["AccountId"]
$ilUser
Definition: imgupload.php:18

References $_POST, $_SESSION, $ilUser, and $user.

◆ displayHeader()

ilPDNewsGUI::displayHeader ( )

display header and locator

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

94 {
95 $this->tpl->setTitle($this->lng->txt("news"));
96
97 // display infopanel if something happened
99 }
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 74 of file class.ilPDNewsGUI.php.

75 {
76 $next_class = $this->ctrl->getNextClass();
77
78 switch ($next_class) {
79
80 default:
81 $cmd = $this->ctrl->getCmd("view");
82 $this->displayHeader();
83 $this->$cmd();
84 break;
85 }
86 $this->tpl->show(true);
87 return true;
88 }
displayHeader()
display header and locator

References displayHeader().

+ Here is the call graph for this function:

◆ resetFilter()

ilPDNewsGUI::resetFilter ( )

reset filter

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

205 {
207 $this->ctrl->setParameter($this, "news_ref_id", 0);
208 $ilUser->writePref("news_sel_ref_id", 0);
209 $_SESSION["news_pd_news_per"] = "";
210 $this->ctrl->redirect($this, "view");
211 }

References $_SESSION, $ilUser, and $user.

◆ view()

ilPDNewsGUI::view ( )

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

105 {
110
111 $ref_ids = array();
112 $obj_ids = array();
113 $pd_items = $ilUser->getDesktopItems();
114 foreach ($pd_items as $item) {
115 $ref_ids[] = $item["ref_id"];
116 $obj_ids[] = $item["obj_id"];
117 }
118
119 $sel_ref_id = ($_GET["news_ref_id"] > 0)
120 ? $_GET["news_ref_id"]
121 : $ilUser->getPref("news_sel_ref_id");
122
123 include_once("./Services/News/classes/class.ilNewsItem.php");
124 $per = ($_SESSION["news_pd_news_per"] != "")
125 ? $_SESSION["news_pd_news_per"]
127 $news_obj_ids = ilNewsItem::filterObjIdsPerNews($obj_ids, $per);
128
129 // related objects (contexts) of news
130 $contexts[0] = $lng->txt("news_all_items");
131
132 $conts = array();
133 $sel_has_news = false;
134 foreach ($ref_ids as $ref_id) {
135 $obj_id = ilObject::_lookupObjId($ref_id);
137
138 $conts[$ref_id] = $title;
139 if ($sel_ref_id == $ref_id) {
140 $sel_has_news = true;
141 }
142 }
143
144 $cnt = array();
145 $nitem = new ilNewsItem();
146 $news_items = $nitem->_getNewsItemsOfUser(
147 $ilUser->getId(),
148 false,
149 true,
150 $per,
151 $cnt
152 );
153
154 // reset selected news ref id, if no news are given for id
155 if (!$sel_has_news) {
156 $sel_ref_id = "";
157 }
158 asort($conts);
159 foreach ($conts as $ref_id => $title) {
160 $contexts[$ref_id] = $title . " (" . (int) $cnt[$ref_id] . ")";
161 }
162
163
164 if ($sel_ref_id > 0) {
165 $obj_id = ilObject::_lookupObjId($sel_ref_id);
166 $obj_type = ilObject::_lookupType($obj_id);
167 $nitem->setContextObjId($obj_id);
168 $nitem->setContextObjType($obj_type);
169 $news_items = $nitem->getNewsForRefId(
170 $sel_ref_id,
171 false,
172 false,
173 $per,
174 true
175 );
176 }
177
178 include_once("./Services/News/classes/class.ilPDNewsTableGUI.php");
179 $pd_news_table = new ilPDNewsTableGUI($this, "view", $contexts, $sel_ref_id);
180 $pd_news_table->setData($news_items);
181 $pd_news_table->setNoEntriesText($lng->txt("news_no_news_items"));
182
183 $tpl->setContent($pd_news_table->getHTML());
184 }
$_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.
static _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.

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

+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

ilPDNewsGUI::$ctrl
protected

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

Referenced by view().

◆ $help

ilPDNewsGUI::$help
protected

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

◆ $lng

ilPDNewsGUI::$lng
protected

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

Referenced by __construct(), and view().

◆ $tpl

ilPDNewsGUI::$tpl
protected

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

Referenced by __construct(), and view().

◆ $user

ilPDNewsGUI::$user
protected

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

Referenced by applyFilter(), resetFilter(), and view().


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