ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
ilPDNotesGUI Class Reference

Private Notes on PD. More...

+ Collaboration diagram for ilPDNotesGUI:

Public Member Functions

 __construct ()
 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

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

Protected Attributes

 $ctrl
 
 $user
 
 $tabs
 
 $help
 
 $settings
 
 $access
 
 $toolbar
 

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.

Constructor & Destructor Documentation

◆ __construct()

ilPDNotesGUI::__construct ( )

Constructor.

public

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

References $_GET, $DIC, $ilUser, $lng, $tpl, help(), IL_NOTE_PRIVATE, settings(), and user().

66  {
67  global $DIC;
68 
69  $this->user = $DIC->user();
70  $this->tabs = $DIC->tabs();
71  $this->help = $DIC["ilHelp"];
72  $this->settings = $DIC->settings();
73  $this->access = $DIC->access();
74  $this->toolbar = $DIC->toolbar();
75  $tpl = $DIC["tpl"];
76  $lng = $DIC->language();
77  $ilCtrl = $DIC->ctrl();
78  $ilUser = $DIC->user();
79  $ilTabs = $DIC->tabs();
80  $ilHelp = $DIC["ilHelp"];
81 
82  $ilHelp->setScreenIdComponent("note");
83 
84  $lng->loadLanguageModule("notes");
85 
86  // initiate variables
87  $this->tpl = $tpl;
88  $this->lng = $lng;
89  $this->ctrl = $ilCtrl;
90 
91  // link from ilPDNotesBlockGUI
92  if ($_GET["rel_obj"]) {
93  $mode = ($_GET["note_type"] == IL_NOTE_PRIVATE) ? self::PRIVATE_NOTES : self::PUBLIC_COMMENTS;
94  $ilUser->writePref("pd_notes_mode", $mode);
95  $ilUser->writePref("pd_notes_rel_obj" . $mode, $_GET["rel_obj"]);
96  }
97  // edit link
98  elseif ($_REQUEST["note_id"]) {
99  $note = new ilNote($_REQUEST["note_id"]);
100  $mode = ($note->getType() == IL_NOTE_PRIVATE) ? self::PRIVATE_NOTES : self::PUBLIC_COMMENTS;
101  $obj = $note->getObject();
102  $ilUser->writePref("pd_notes_mode", $mode);
103  $ilUser->writePref("pd_notes_rel_obj" . $mode, $obj["rep_obj_id"]);
104  }
105  }
settings()
Definition: settings.php:2
const IL_NOTE_PRIVATE
Definition: class.ilNote.php:5
$_GET["client_id"]
user()
Definition: user.php:4
Note class.
help()
Definition: help.php:2
global $DIC
Definition: goto.php:24
$ilUser
Definition: imgupload.php:18
+ Here is the call graph for this function:

Member Function Documentation

◆ changeRelatedObject()

ilPDNotesGUI::changeRelatedObject ( )

change related object

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

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

294  {
296 
297  $ilUser->writePref("pd_notes_rel_obj" . $this->getMode(), $_POST["rel_obj"]);
298  $this->ctrl->redirect($this);
299  }
getMode()
Get current mode.
$ilUser
Definition: imgupload.php:18
$_POST["username"]
+ Here is the call graph for this function:

◆ displayHeader()

ilPDNotesGUI::displayHeader ( )

display header and locator

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

References $ilSetting, $settings, ilUtil\getImagePath(), getMode(), and ilUtil\infoPanel().

Referenced by executeCommand().

139  {
141 
142  $t = $this->lng->txt("notes");
143  if (!$ilSetting->get("disable_notes") && !$ilSetting->get("disable_comments")) {
144  $t = $this->lng->txt("notes_and_comments");
145  }
146  if ($ilSetting->get("disable_notes")) {
147  $t = $this->lng->txt("notes_comments");
148  }
149 
150  if ($this->getMode() == self::PRIVATE_NOTES) {
151  $t = $this->lng->txt("private_notes");
152  $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_nots.svg"));
153  } else {
154  $t = $this->lng->txt("notes_public_comments");
155  $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_coms.svg"));
156  }
157 
158  $this->tpl->setTitle($t);
159 
160  // catch feedback message
161  // display infopanel if something happened
163  }
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static infoPanel($a_keep=true)
getMode()
Get current mode.
global $ilSetting
Definition: privfeed.php:17
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilPDNotesGUI::executeCommand ( )

execute command

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

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

111  {
112  $next_class = $this->ctrl->getNextClass();
113  switch ($next_class) {
114  case "ilnotegui":
115  // scorm2004-start
116  $this->setTabs();
117  // scorm2004-end
118  $this->displayHeader();
119  $this->view(); // forwardCommand is invoked in view() method
120  break;
121 
122  default:
123  // scorm2004-start
124  $this->setTabs();
125  // scorm2004-end
126  $cmd = $this->ctrl->getCmd("view");
127  $this->displayHeader();
128  $this->$cmd();
129  break;
130  }
131  $this->tpl->printToStdout(true);
132  return true;
133  }
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 359 of file class.ilPDNotesGUI.php.

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

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

360  {
363 
364  if ($ilUser->getPref("pd_notes_mode") == ilPDNotesGUI::PUBLIC_COMMENTS &&
365  !$ilSetting->get("disable_comments")) {
367  } else {
369  }
370  }
global $ilSetting
Definition: privfeed.php:17
$ilUser
Definition: imgupload.php:18
+ Here is the caller graph for this function:

◆ setTabs()

ilPDNotesGUI::setTabs ( )

Show subtabs.

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

References $ctrl, $ilSetting, $settings, and $tabs.

Referenced by executeCommand().

306  {
307  $ilTabs = $this->tabs;
309  $ilCtrl = $this->ctrl;
310 
311  /*
312  if(!$ilSetting->get("disable_notes"))
313  {
314  $ilTabs->addTarget("private_notes",
315  $ilCtrl->getLinkTarget($this, "showPrivateNotes"), "", "", "",
316  ($this->getMode() == ilPDNotesGUI::PRIVATE_NOTES));
317  }
318 
319  if(!$ilSetting->get("disable_comments"))
320  {
321  $ilTabs->addTarget("notes_public_comments",
322  $ilCtrl->getLinkTarget($this, "showPublicComments"), "", "", "",
323  ($this->getMode() == ilPDNotesGUI::PUBLIC_COMMENTS));
324  }*/
325  }
global $ilSetting
Definition: privfeed.php:17
+ Here is the caller graph for this function:

◆ showPrivateNotes()

ilPDNotesGUI::showPrivateNotes ( )

Show private notes.

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

References $ctrl, $ilUser, $user, and PRIVATE_NOTES.

331  {
333  $ilCtrl = $this->ctrl;
334 
335  $ilUser->writePref("pd_notes_mode", ilPDNotesGUI::PRIVATE_NOTES);
336  $ilCtrl->redirect($this, "");
337  }
$ilUser
Definition: imgupload.php:18

◆ showPublicComments()

ilPDNotesGUI::showPublicComments ( )

Show public comments.

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

References $ctrl, $ilSetting, $ilUser, $settings, $user, and PUBLIC_COMMENTS.

343  {
345  $ilCtrl = $this->ctrl;
347 
348  if ($ilSetting->get("disable_comments")) {
349  $ilCtrl->redirect($this, "showPrivateNotes");
350  }
351 
352  $ilUser->writePref("pd_notes_mode", ilPDNotesGUI::PUBLIC_COMMENTS);
353  $ilCtrl->redirect($this, "");
354  }
global $ilSetting
Definition: privfeed.php:17
$ilUser
Definition: imgupload.php:18

◆ view()

ilPDNotesGUI::view ( )

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

References $access, $ilSetting, $ilUser, $lng, $settings, $toolbar, $type, $user, ilNote\_getRelatedObjectsOfUser(), ilObject\_lookupTitle(), ilObject\_lookupType(), ilNoteGUI\enablePrivateNotes(), ilSubmitButton\getInstance(), getMode(), PRIVATE_NOTES, PUBLIC_COMMENTS, and ilUtil\sendInfo().

Referenced by executeCommand().

169  {
171  $lng = $this->lng;
173  $ilAccess = $this->access;
174  $ilToolbar = $this->toolbar;
175 
176  //$this->tpl->addBlockFile("ADM_CONTENT", "objects", "tpl.table.html")
177  include_once("Services/Notes/classes/class.ilNoteGUI.php");
178 
179  // output related item selection (if more than one)
180  include_once("Services/Notes/classes/class.ilNote.php");
181  $rel_objs = ilNote::_getRelatedObjectsOfUser($this->getMode());
182  //var_dump($rel_objs);
183  // prepend personal dektop, if first object
184  // if ($rel_objs[0]["rep_obj_id"] > 0 && $this->getMode() == ilPDNotesGUI::PRIVATE_NOTES)
185  if ($this->getMode() == ilPDNotesGUI::PRIVATE_NOTES) {
186  $rel_objs = array_merge(array(0), $rel_objs);
187  }
188 
189  // #9410
190  if (!$rel_objs && $this->getMode() == ilPDNotesGUI::PUBLIC_COMMENTS) {
191  $lng->loadLanguageModule("notes");
192  ilUtil::sendInfo($lng->txt("msg_no_search_result"));
193  return;
194  }
195 
196  $first = true;
197  $current_ref_ids = [];
198  foreach ($rel_objs as $r) {
199  if ($first) { // take first one as default
200  $this->current_rel_obj = $r["rep_obj_id"];
201  $current_ref_ids = $r["ref_ids"];
202  }
203  if ($r["rep_obj_id"] == $ilUser->getPref("pd_notes_rel_obj" . $this->getMode())) {
204  $this->current_rel_obj = $r["rep_obj_id"];
205  $current_ref_ids = $r["ref_ids"];
206  }
207  $first = false;
208  }
209  if ($this->current_rel_obj > 0) {
210  $notes_gui = new ilNoteGUI(
211  $this->current_rel_obj,
212  0,
213  ilObject::_lookupType($this->current_rel_obj),
214  true,
215  0,
216  false
217  );
218  } else {
219  $notes_gui = new ilNoteGUI(0, $ilUser->getId(), "pd", false, 0, false);
220  }
221 
222  if ($this->getMode() == ilPDNotesGUI::PRIVATE_NOTES) {
223  $notes_gui->enablePrivateNotes(true);
224  $notes_gui->enablePublicNotes(false);
225  } else {
226  $notes_gui->enablePrivateNotes(false);
227  $notes_gui->enablePublicNotes(true);
228  // #13707
229  if ($this->current_rel_obj > 0 &&
230  count($current_ref_ids) > 0 &&
231  $ilSetting->get("comments_del_tutor", 1)) {
232  foreach ($current_ref_ids as $ref_id) {
233  if ($ilAccess->checkAccess("write", "", $ref_id)) {
234  $notes_gui->enablePublicNotesDeletion(true);
235  break;
236  }
237  }
238  }
239  }
240  $notes_gui->enableHiding(false);
241  $notes_gui->enableTargets(true);
242  $notes_gui->enableMultiSelection(true);
243  $notes_gui->enableAnchorJump(false);
244 
245  $next_class = $this->ctrl->getNextClass($this);
246 
247  if ($next_class == "ilnotegui") {
248  $html = $this->ctrl->forwardCommand($notes_gui);
249  } else {
250  if ($this->getMode() == ilPDNotesGUI::PRIVATE_NOTES) {
251  $html = $notes_gui->getOnlyNotesHTML();
252  } else {
253  $html = $notes_gui->getOnlyCommentsHTML();
254  }
255  }
256 
257  if (count($rel_objs) > 1 ||
258  ($rel_objs[0]["rep_obj_id"] > 0)) {
259  $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
260 
261  foreach ($rel_objs as $obj) {
262  if ($obj["rep_obj_id"] > 0) {
263  $type = ilObject::_lookupType($obj["rep_obj_id"]);
264  $type_str = (in_array($type, array("lm", "htlm", "sahs")))
265  ? $lng->txt("obj_lm")
266  : $lng->txt("obj_" . $type);
267  $caption = $type_str . ": " . ilObject::_lookupTitle($obj["rep_obj_id"]);
268  } else {
269  $caption = $lng->txt("note_without_object");
270  }
271 
272  $options[$obj["rep_obj_id"]] = $caption;
273  }
274 
275  include_once "Services/Form/classes/class.ilSelectInputGUI.php";
276  $rel = new ilSelectInputGUI($lng->txt("related_to"), "rel_obj");
277  $rel->setOptions($options);
278  $rel->setValue($this->current_rel_obj);
279  $ilToolbar->addStickyItem($rel);
280 
282  $btn->setCaption('change');
283  $btn->setCommand('changeRelatedObject');
284  $ilToolbar->addStickyItem($btn);
285  }
286 
287  $this->tpl->setContent($html);
288  }
$type
static _lookupTitle($a_id)
lookup object title
Notes GUI class.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static _getRelatedObjectsOfUser($a_mode)
get all related objects for user
static _lookupType($a_id, $a_reference=false)
lookup object type
getMode()
Get current mode.
global $ilSetting
Definition: privfeed.php:17
enablePrivateNotes($a_enable=true)
enable private notes
$ilUser
Definition: imgupload.php:18
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $access

ilPDNotesGUI::$access
protected

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

Referenced by view().

◆ $ctrl

ilPDNotesGUI::$ctrl
protected

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

Referenced by setTabs(), showPrivateNotes(), and showPublicComments().

◆ $help

ilPDNotesGUI::$help
protected

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

◆ $lng

ilPDNotesGUI::$lng

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

Referenced by __construct(), and view().

◆ $settings

ilPDNotesGUI::$settings
protected

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

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

◆ $tabs

ilPDNotesGUI::$tabs
protected

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

Referenced by setTabs().

◆ $toolbar

ilPDNotesGUI::$toolbar
protected

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

Referenced by view().

◆ $tpl

ilPDNotesGUI::$tpl

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

Referenced by __construct().

◆ $user

ilPDNotesGUI::$user
protected

◆ PRIVATE_NOTES

const ilPDNotesGUI::PRIVATE_NOTES = "privatenotes"

◆ PUBLIC_COMMENTS

const ilPDNotesGUI::PUBLIC_COMMENTS = "publiccomments"

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

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


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