ILIAS  release_4-4 Revision
ilPDNotesGUI Class Reference

Private Notes on PD. More...

+ Collaboration diagram for ilPDNotesGUI:

Public Member Functions

 ilPDNotesGUI ()
 Constructor. More...
 
executeCommand ()
 execute command More...
 
 displayHeader ()
 display header and locator More...
 
 view ()
 
 changeRelatedObject ()
 change related object More...
 
 setTabs ()
 Show subtabs. More...
 
 showPrivateNotes ()
 Show private notes. More...
 
 showPublicComments ()
 Show public comments. More...
 
 getMode ()
 Get current mode. More...
 

Data Fields

 $ilias
 
 $tpl
 
 $lng
 
const PUBLIC_COMMENTS = "publiccomments"
 
const PRIVATE_NOTES = "privatenotes"
 

Detailed Description

Private Notes on PD.

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

ilPDNotesGUI: ilNoteGUI

Definition at line 17 of file class.ilPDNotesGUI.php.

Member Function Documentation

◆ changeRelatedObject()

ilPDNotesGUI::changeRelatedObject ( )

change related object

Definition at line 243 of file class.ilPDNotesGUI.php.

References $_POST, $ilUser, and getMode().

244  {
245  global $ilUser;
246 
247  $ilUser->writePref("pd_notes_rel_obj".$this->getMode(), $_POST["rel_obj"]);
248  $this->ctrl->redirect($this);
249  }
$_POST['username']
Definition: cron.php:12
global $ilUser
Definition: imgupload.php:15
getMode()
Get current mode.
+ Here is the call graph for this function:

◆ displayHeader()

ilPDNotesGUI::displayHeader ( )

display header and locator

Definition at line 100 of file class.ilPDNotesGUI.php.

References ilUtil\infoPanel().

Referenced by executeCommand().

101  {
102  //$this->tpl->setTitleIcon(ilUtil::getImagePath("icon_pd_b.png"),
103  // $this->lng->txt("personal_desktop"));
104 // $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_pd_b.png"),
105 // "");
106  $this->tpl->setTitle($this->lng->txt("notes"));
107 
108  // catch feedback message
109  // display infopanel if something happened
111 
112  }
static infoPanel($a_keep=true)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

& ilPDNotesGUI::executeCommand ( )

execute command

Definition at line 70 of file class.ilPDNotesGUI.php.

References $cmd, displayHeader(), setTabs(), and view().

71  {
72  $next_class = $this->ctrl->getNextClass();
73 
74  switch($next_class)
75  {
76  case "ilnotegui":
77  // scorm2004-start
78  $this->setTabs();
79  // scorm2004-end
80  $this->displayHeader();
81  $this->view(); // forwardCommand is invoked in view() method
82  break;
83 
84  default:
85  // scorm2004-start
86  $this->setTabs();
87  // scorm2004-end
88  $cmd = $this->ctrl->getCmd("view");
89  $this->displayHeader();
90  $this->$cmd();
91  break;
92  }
93  $this->tpl->show(true);
94  return true;
95  }
$cmd
Definition: sahs_server.php:35
setTabs()
Show subtabs.
displayHeader()
display header and locator
+ Here is the call graph for this function:

◆ getMode()

ilPDNotesGUI::getMode ( )

Get current mode.

Definition at line 300 of file class.ilPDNotesGUI.php.

References $ilSetting, $ilUser, PRIVATE_NOTES, and PUBLIC_COMMENTS.

Referenced by changeRelatedObject(), setTabs(), and view().

301  {
302  global $ilUser, $ilSetting;
303 
304  if ($ilUser->getPref("pd_notes_mode") == ilPDNotesGUI::PUBLIC_COMMENTS &&
305  !$ilSetting->get("disable_comments"))
306  {
308  }
309  else
310  {
312  }
313  }
global $ilUser
Definition: imgupload.php:15
global $ilSetting
Definition: privfeed.php:40
+ Here is the caller graph for this function:

◆ ilPDNotesGUI()

ilPDNotesGUI::ilPDNotesGUI ( )

Constructor.

public

Definition at line 37 of file class.ilPDNotesGUI.php.

References $_GET, $_REQUEST, $ilCtrl, $ilias, $ilUser, $lng, $tpl, and IL_NOTE_PRIVATE.

38  {
39  global $ilias, $tpl, $lng, $ilCtrl, $ilUser, $ilTabs, $ilHelp;
40 
41  $ilHelp->setScreenIdComponent("note");
42 
43  // initiate variables
44  $this->ilias =& $ilias;
45  $this->tpl =& $tpl;
46  $this->lng =& $lng;
47  $this->ctrl =& $ilCtrl;
48 
49  // link from ilPDNotesBlockGUI
50  if($_GET["rel_obj"])
51  {
52  $mode = ($_GET["note_type"] == IL_NOTE_PRIVATE) ? self::PRIVATE_NOTES : self::PUBLIC_COMMENTS;
53  $ilUser->writePref("pd_notes_mode", $mode);
54  $ilUser->writePref("pd_notes_rel_obj".$mode, $_GET["rel_obj"]);
55  }
56  // edit link
57  else if($_REQUEST["note_id"])
58  {
59  $note = new ilNote($_REQUEST["note_id"]);
60  $mode = ($note->getType() == IL_NOTE_PRIVATE) ? self::PRIVATE_NOTES : self::PUBLIC_COMMENTS;
61  $obj = $note->getObject();
62  $ilUser->writePref("pd_notes_mode", $mode);
63  $ilUser->writePref("pd_notes_rel_obj".$mode, $obj["rep_obj_id"]);
64  }
65  }
const IL_NOTE_PRIVATE
Definition: class.ilNote.php:4
$_GET["client_id"]
Note class.
global $ilCtrl
Definition: ilias.php:18
redirection script todo: (a better solution should control the processing via a xml file) ...
global $ilUser
Definition: imgupload.php:15
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7

◆ setTabs()

ilPDNotesGUI::setTabs ( )

Show subtabs.

Definition at line 255 of file class.ilPDNotesGUI.php.

References $ilCtrl, $ilSetting, getMode(), PRIVATE_NOTES, and PUBLIC_COMMENTS.

Referenced by executeCommand().

256  {
257  global $ilTabs, $ilSetting, $ilCtrl;
258 
259  $ilTabs->addTarget("private_notes",
260  $ilCtrl->getLinkTarget($this, "showPrivateNotes"), "", "", "",
261  ($this->getMode() == ilPDNotesGUI::PRIVATE_NOTES));
262  if(!$ilSetting->get("disable_comments"))
263  {
264  $ilTabs->addTarget("notes_public_comments",
265  $ilCtrl->getLinkTarget($this, "showPublicComments"), "", "", "",
266  ($this->getMode() == ilPDNotesGUI::PUBLIC_COMMENTS));
267  }
268  }
global $ilCtrl
Definition: ilias.php:18
getMode()
Get current mode.
global $ilSetting
Definition: privfeed.php:40
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showPrivateNotes()

ilPDNotesGUI::showPrivateNotes ( )

Show private notes.

Definition at line 273 of file class.ilPDNotesGUI.php.

References $ilCtrl, $ilUser, and PRIVATE_NOTES.

274  {
275  global $ilUser, $ilCtrl;
276 
277  $ilUser->writePref("pd_notes_mode", ilPDNotesGUI::PRIVATE_NOTES);
278  $ilCtrl->redirect($this, "");
279  }
global $ilCtrl
Definition: ilias.php:18
global $ilUser
Definition: imgupload.php:15

◆ showPublicComments()

ilPDNotesGUI::showPublicComments ( )

Show public comments.

Definition at line 284 of file class.ilPDNotesGUI.php.

References $ilCtrl, $ilSetting, $ilUser, and PUBLIC_COMMENTS.

285  {
286  global $ilUser, $ilCtrl, $ilSetting;
287 
288  if($ilSetting->get("disable_comments"))
289  {
290  $ilCtrl->redirect($this, "showPrivateNotes");
291  }
292 
293  $ilUser->writePref("pd_notes_mode", ilPDNotesGUI::PUBLIC_COMMENTS);
294  $ilCtrl->redirect($this, "");
295  }
global $ilCtrl
Definition: ilias.php:18
global $ilUser
Definition: imgupload.php:15
global $ilSetting
Definition: privfeed.php:40

◆ view()

ilPDNotesGUI::view ( )

Definition at line 117 of file class.ilPDNotesGUI.php.

References $ilUser, $lng, $r, ilNote\_getRelatedObjectsOfUser(), ilObject\_lookupTitle(), ilObject\_lookupType(), ilNoteGUI\enablePrivateNotes(), getMode(), PRIVATE_NOTES, PUBLIC_COMMENTS, and ilUtil\sendInfo().

Referenced by executeCommand().

118  {
119  global $ilUser, $lng;
120 
121  //$this->tpl->addBlockFile("ADM_CONTENT", "objects", "tpl.table.html")
122  include_once("Services/Notes/classes/class.ilNoteGUI.php");
123 
124  // output related item selection (if more than one)
125  include_once("Services/Notes/classes/class.ilNote.php");
126  $rel_objs = ilNote::_getRelatedObjectsOfUser($this->getMode());
127 //var_dump($rel_objs);
128  // prepend personal dektop, if first object
129 // if ($rel_objs[0]["rep_obj_id"] > 0 && $this->getMode() == ilPDNotesGUI::PRIVATE_NOTES)
130  if ($this->getMode() == ilPDNotesGUI::PRIVATE_NOTES)
131  {
132 
133  $rel_objs = array_merge(array(0), $rel_objs);
134  }
135 
136  // #9410
137  if(!$rel_objs && $this->getMode() == ilPDNotesGUI::PUBLIC_COMMENTS)
138  {
139  $lng->loadLanguageModule("notes");
140  ilUtil::sendInfo($lng->txt("msg_no_search_result"));
141  return;
142  }
143 
144  $first = true;
145  foreach ($rel_objs as $r)
146  {
147  if ($first) // take first one as default
148  {
149  $this->current_rel_obj = $r["rep_obj_id"];
150  }
151  if ($r["rep_obj_id"] == $ilUser->getPref("pd_notes_rel_obj".$this->getMode()))
152  {
153  $this->current_rel_obj = $r["rep_obj_id"];
154  }
155  $first = false;
156  }
157  if ($this->current_rel_obj > 0)
158  {
159  $notes_gui = new ilNoteGUI($this->current_rel_obj, 0,
160  ilObject::_lookupType($this->current_rel_obj),true);
161  }
162  else
163  {
164  $notes_gui = new ilNoteGUI(0, $ilUser->getId(), "pd");
165  }
166 
167  if ($this->getMode() == ilPDNotesGUI::PRIVATE_NOTES)
168  {
169  $notes_gui->enablePrivateNotes(true);
170  $notes_gui->enablePublicNotes(false);
171  }
172  else
173  {
174  $notes_gui->enablePrivateNotes(false);
175  $notes_gui->enablePublicNotes(true);
176  }
177  $notes_gui->enableHiding(false);
178  $notes_gui->enableTargets(true);
179  $notes_gui->enableMultiSelection(true);
180  $notes_gui->enableAnchorJump(false);
181 
182  $next_class = $this->ctrl->getNextClass($this);
183 
184  if ($next_class == "ilnotegui")
185  {
186  $html = $this->ctrl->forwardCommand($notes_gui);
187  }
188  else
189  {
190  $html = $notes_gui->getNotesHTML();
191  }
192 
193  $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.pd_notes.html", "Services/Notes");
194 
195  if (count($rel_objs) > 1 ||
196  ($rel_objs[0]["rep_obj_id"] > 0))
197  {
198  foreach($rel_objs as $obj)
199  {
200  $this->tpl->setCurrentBlock("related_option");
201  $this->tpl->setVariable("VAL_RELATED",
202  $obj["rep_obj_id"]);
203 //echo "-".$obj["rep_obj_id"]."-".$obj["obj_type"]."-";
204  if ($obj["rep_obj_id"] > 0)
205  {
206  $type = ilObject::_lookupType($obj["rep_obj_id"]);
207  $type_str = (in_array($type, array("lm", "htlm", "sahs", "dbk")))
208  ? $lng->txt("learning_resource")
209  : $lng->txt("obj_".$type);
210  $this->tpl->setVariable("TXT_RELATED", $type_str.": ".
211  ilObject::_lookupTitle($obj["rep_obj_id"]));
212  }
213  else
214  {
215  $this->tpl->setVariable("TXT_RELATED",
216  $lng->txt("personal_desktop"));
217  }
218  if ($obj["rep_obj_id"] == $this->current_rel_obj)
219  {
220  $this->tpl->setVariable("SEL", 'selected="selected"');
221  }
222  $this->tpl->parseCurrentBlock();
223  }
224 
225  $this->tpl->setCurrentBlock("related_selection");
226  $this->tpl->setVariable("TXT_CHANGE", $lng->txt("change"));
227  $this->tpl->setVariable("TXT_RELATED_TO", $lng->txt("related_to"));
228  $this->tpl->setVariable("TXT_FILTER", $lng->txt("filter"));
229  $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
230  $this->tpl->parseCurrentBlock();
231  }
232 
233  $this->tpl->setCurrentBlock("adm_content");
234  // output notes
235  $this->tpl->setVariable("NOTES", $html);
236  $this->tpl->parseCurrentBlock();
237 
238  }
_getRelatedObjectsOfUser($a_mode)
get all related objects for user
static _lookupTitle($a_id)
lookup object title
Notes GUI class.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static _lookupType($a_id, $a_reference=false)
lookup object type
global $ilUser
Definition: imgupload.php:15
getMode()
Get current mode.
enablePrivateNotes($a_enable=true)
enable private notes
$r
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $ilias

ilPDNotesGUI::$ilias

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

Referenced by ilPDNotesGUI().

◆ $lng

ilPDNotesGUI::$lng

Definition at line 27 of file class.ilPDNotesGUI.php.

Referenced by ilPDNotesGUI(), and view().

◆ $tpl

ilPDNotesGUI::$tpl

Definition at line 26 of file class.ilPDNotesGUI.php.

Referenced by ilPDNotesGUI().

◆ PRIVATE_NOTES

const ilPDNotesGUI::PRIVATE_NOTES = "privatenotes"

◆ PUBLIC_COMMENTS

const ilPDNotesGUI::PUBLIC_COMMENTS = "publiccomments"

Definition at line 29 of file class.ilPDNotesGUI.php.

Referenced by getMode(), setTabs(), showPublicComments(), and view().


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