ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
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$

ilPDNewsGUI:

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

Member Function Documentation

◆ applyFilter()

ilPDNewsGUI::applyFilter ( )

change related object

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

References $_POST, $_SESSION, and $ilUser.

156  {
157  global $ilUser;
158 
159  $this->ctrl->setParameter($this, "news_ref_id", $_POST["news_ref_id"]);
160  $ilUser->writePref("news_sel_ref_id", $_POST["news_ref_id"]);
161  if ($_POST["news_per"] > 0)
162  {
163  $_SESSION["news_pd_news_per"] = $_POST["news_per"];
164  }
165  $this->ctrl->redirect($this, "view");
166  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
$_POST['username']
Definition: cron.php:12
global $ilUser
Definition: imgupload.php:15

◆ displayHeader()

ilPDNewsGUI::displayHeader ( )

display header and locator

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

References ilUtil\infoPanel().

Referenced by executeCommand().

63  {
64  //$this->tpl->setTitleIcon(ilUtil::getImagePath("icon_pd_b.png"),
65  // $this->lng->txt("personal_desktop"));
66 // $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_pd_b.png"),
67 // "");
68  $this->tpl->setTitle($this->lng->txt("news"));
69 
70  // display infopanel if something happened
72  }
static infoPanel($a_keep=true)
+ 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.

References $cmd, and displayHeader().

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
+ Here is the call graph for this function:

◆ ilPDNewsGUI()

ilPDNewsGUI::ilPDNewsGUI ( )

Constructor.

public

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

References $ilCtrl, $lng, and $tpl.

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 $ilCtrl
Definition: ilias.php:18
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
global $lng
Definition: privfeed.php:40

◆ resetFilter()

ilPDNewsGUI::resetFilter ( )

reset filter

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

References $_SESSION, and $ilUser.

172  {
173  global $ilUser;
174  $this->ctrl->setParameter($this, "news_ref_id", 0);
175  $ilUser->writePref("news_sel_ref_id", 0);
176  $_SESSION["news_pd_news_per"] = "";
177  $this->ctrl->redirect($this, "view");
178  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
global $ilUser
Definition: imgupload.php:15

◆ view()

ilPDNewsGUI::view ( )

Definition at line 77 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().

78  {
79  global $ilUser, $lng, $tpl, $ilCtrl;
80 
81  $ref_ids = array();
82  $obj_ids = array();
83  $pd_items = $ilUser->getDesktopItems();
84  foreach($pd_items as $item)
85  {
86  $ref_ids[] = $item["ref_id"];
87  $obj_ids[] = $item["obj_id"];
88  }
89 
90  $sel_ref_id = ($_GET["news_ref_id"] > 0)
91  ? $_GET["news_ref_id"]
92  : $ilUser->getPref("news_sel_ref_id");
93 
94  include_once("./Services/News/classes/class.ilNewsItem.php");
95  $per = ($_SESSION["news_pd_news_per"] != "")
96  ? $_SESSION["news_pd_news_per"]
97  : ilNewsItem::_lookupUserPDPeriod($ilUser->getId());
98  $news_obj_ids = ilNewsItem::filterObjIdsPerNews($obj_ids, $per);
99 
100  // related objects (contexts) of news
101  $contexts[0] = $lng->txt("news_all_items");
102 
103  $conts = array();
104  $sel_has_news = false;
105  foreach ($ref_ids as $ref_id)
106  {
107  $obj_id = ilObject::_lookupObjId($ref_id);
108  $title = ilObject::_lookupTitle($obj_id);
109 
110  $conts[$ref_id] = $title;
111  if ($sel_ref_id == $ref_id)
112  {
113  $sel_has_news = true;
114  }
115  }
116 
117  $cnt = array();
118  $nitem = new ilNewsItem();
119  $news_items = $nitem->_getNewsItemsOfUser($ilUser->getId(), false,
120  true, $per, $cnt);
121 
122  // reset selected news ref id, if no news are given for id
123  if (!$sel_has_news)
124  {
125  $sel_ref_id = "";
126  }
127  asort($conts);
128  foreach($conts as $ref_id => $title)
129  {
130  $contexts[$ref_id] = $title." (".(int) $cnt[$ref_id].")";
131  }
132 
133 
134  if ($sel_ref_id > 0)
135  {
136  $obj_id = ilObject::_lookupObjId($sel_ref_id);
137  $obj_type = ilObject::_lookupType($obj_id);
138  $nitem->setContextObjId($obj_id);
139  $nitem->setContextObjType($obj_type);
140  $news_items = $nitem->getNewsForRefId($sel_ref_id, false,
141  false, $per, true);
142  }
143 
144  include_once("./Services/News/classes/class.ilPDNewsTableGUI.php");
145  $pd_news_table = new ilPDNewsTableGUI($this, "view", $contexts, $sel_ref_id);
146  $pd_news_table->setData($news_items);
147  $pd_news_table->setNoEntriesText($lng->txt("news_no_news_items"));
148 
149  $tpl->setContent($pd_news_table->getHTML());
150  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
$_GET["client_id"]
static _lookupTitle($a_id)
lookup object title
Personal desktop news table.
global $ilCtrl
Definition: ilias.php:18
static _lookupObjId($a_id)
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
static _lookupType($a_id, $a_reference=false)
lookup object type
global $ilUser
Definition: imgupload.php:15
$ref_id
Definition: sahs_server.php:39
global $lng
Definition: privfeed.php:40
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)
+ Here is the call graph for this function:

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