ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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, $ilCtrl, $ilUser, $lng, $tpl, 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
global $DIC
Definition: saml.php:7
$_GET["client_id"]
user()
Definition: user.php:4
Note class.
global $ilCtrl
Definition: ilias.php:18
$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 283 of file class.ilPDNotesGUI.php.

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

284  {
286 
287  $ilUser->writePref("pd_notes_rel_obj" . $this->getMode(), $_POST["rel_obj"]);
288  $this->ctrl->redirect($this);
289  }
$ilUser
Definition: imgupload.php:18
getMode()
Get current mode.
$_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, $t, 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  $this->tpl->setTitle($t);
151 
152  // catch feedback message
153  // display infopanel if something happened
155  }
static infoPanel($a_keep=true)
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->show(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 356 of file class.ilPDNotesGUI.php.

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

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

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

◆ setTabs()

ilPDNotesGUI::setTabs ( )

Show subtabs.

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

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

Referenced by executeCommand().

296  {
297  $ilTabs = $this->tabs;
300 
301  if (!$ilSetting->get("disable_notes")) {
302  $ilTabs->addTarget(
303  "private_notes",
304  $ilCtrl->getLinkTarget($this, "showPrivateNotes"),
305  "",
306  "",
307  "",
309  );
310  }
311 
312  if (!$ilSetting->get("disable_comments")) {
313  $ilTabs->addTarget(
314  "notes_public_comments",
315  $ilCtrl->getLinkTarget($this, "showPublicComments"),
316  "",
317  "",
318  "",
320  );
321  }
322  }
global $ilCtrl
Definition: ilias.php:18
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:

◆ showPrivateNotes()

ilPDNotesGUI::showPrivateNotes ( )

Show private notes.

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

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

328  {
331 
332  $ilUser->writePref("pd_notes_mode", ilPDNotesGUI::PRIVATE_NOTES);
333  $ilCtrl->redirect($this, "");
334  }
global $ilCtrl
Definition: ilias.php:18
$ilUser
Definition: imgupload.php:18

◆ showPublicComments()

ilPDNotesGUI::showPublicComments ( )

Show public comments.

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

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

340  {
344 
345  if ($ilSetting->get("disable_comments")) {
346  $ilCtrl->redirect($this, "showPrivateNotes");
347  }
348 
349  $ilUser->writePref("pd_notes_mode", ilPDNotesGUI::PUBLIC_COMMENTS);
350  $ilCtrl->redirect($this, "");
351  }
global $ilCtrl
Definition: ilias.php:18
$ilUser
Definition: imgupload.php:18
global $ilSetting
Definition: privfeed.php:17

◆ view()

ilPDNotesGUI::view ( )

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

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

Referenced by executeCommand().

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


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