ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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$

@ilCtrl_Calls ilPDNotesGUI: ilNoteGUI

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

Constructor & Destructor Documentation

◆ __construct()

ilPDNotesGUI::__construct ( )

Constructor.

@access public

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

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 }
user()
Definition: user.php:4
$_GET["client_id"]
const IL_NOTE_PRIVATE
Definition: class.ilNote.php:5
Note class.
help()
Definition: help.php:2
global $ilCtrl
Definition: ilias.php:18
settings()
Definition: settings.php:2
$ilUser
Definition: imgupload.php:18
$DIC
Definition: xapitoken.php:46

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

+ Here is the call graph for this function:

Member Function Documentation

◆ changeRelatedObject()

ilPDNotesGUI::changeRelatedObject ( )

change related object

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

292 {
294
295 $ilUser->writePref("pd_notes_rel_obj" . $this->getMode(), $_POST["rel_obj"]);
296 $this->ctrl->redirect($this);
297 }
$_POST["username"]
getMode()
Get current mode.

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

+ Here is the call graph for this function:

◆ displayHeader()

ilPDNotesGUI::displayHeader ( )

display header and locator

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

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)
global $ilSetting
Definition: privfeed.php:17

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

Referenced by executeCommand().

+ 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.

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 }
displayHeader()
display header and locator
setTabs()
Show subtabs.

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

+ Here is the call graph for this function:

◆ getMode()

ilPDNotesGUI::getMode ( )

Get current mode.

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

358 {
361
362 if ($ilUser->getPref("pd_notes_mode") == ilPDNotesGUI::PUBLIC_COMMENTS &&
363 !$ilSetting->get("disable_comments")) {
365 } else {
367 }
368 }

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

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

+ Here is the caller graph for this function:

◆ setTabs()

ilPDNotesGUI::setTabs ( )

Show subtabs.

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

304 {
305 $ilTabs = $this->tabs;
308
309 /*
310 if(!$ilSetting->get("disable_notes"))
311 {
312 $ilTabs->addTarget("private_notes",
313 $ilCtrl->getLinkTarget($this, "showPrivateNotes"), "", "", "",
314 ($this->getMode() == ilPDNotesGUI::PRIVATE_NOTES));
315 }
316
317 if(!$ilSetting->get("disable_comments"))
318 {
319 $ilTabs->addTarget("notes_public_comments",
320 $ilCtrl->getLinkTarget($this, "showPublicComments"), "", "", "",
321 ($this->getMode() == ilPDNotesGUI::PUBLIC_COMMENTS));
322 }*/
323 }

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

Referenced by executeCommand().

+ Here is the caller graph for this function:

◆ showPrivateNotes()

ilPDNotesGUI::showPrivateNotes ( )

Show private notes.

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

329 {
332
333 $ilUser->writePref("pd_notes_mode", ilPDNotesGUI::PRIVATE_NOTES);
334 $ilCtrl->redirect($this, "");
335 }

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

◆ showPublicComments()

ilPDNotesGUI::showPublicComments ( )

Show public comments.

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

341 {
345
346 if ($ilSetting->get("disable_comments")) {
347 $ilCtrl->redirect($this, "showPrivateNotes");
348 }
349
350 $ilUser->writePref("pd_notes_mode", ilPDNotesGUI::PUBLIC_COMMENTS);
351 $ilCtrl->redirect($this, "");
352 }

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

◆ view()

ilPDNotesGUI::view ( )

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

169 {
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 );
216 } else {
217 $notes_gui = new ilNoteGUI(0, $ilUser->getId(), "pd");
218 }
219
220 if ($this->getMode() == ilPDNotesGUI::PRIVATE_NOTES) {
221 $notes_gui->enablePrivateNotes(true);
222 $notes_gui->enablePublicNotes(false);
223 } else {
224 $notes_gui->enablePrivateNotes(false);
225 $notes_gui->enablePublicNotes(true);
226 // #13707
227 if ($this->current_rel_obj > 0 &&
228 count($current_ref_ids) > 0 &&
229 $ilSetting->get("comments_del_tutor", 1)) {
230 foreach ($current_ref_ids as $ref_id) {
231 if ($ilAccess->checkAccess("write", "", $ref_id)) {
232 $notes_gui->enablePublicNotesDeletion(true);
233 break;
234 }
235 }
236 }
237 }
238 $notes_gui->enableHiding(false);
239 $notes_gui->enableTargets(true);
240 $notes_gui->enableMultiSelection(true);
241 $notes_gui->enableAnchorJump(false);
242
243 $next_class = $this->ctrl->getNextClass($this);
244
245 if ($next_class == "ilnotegui") {
246 $html = $this->ctrl->forwardCommand($notes_gui);
247 } else {
248 if ($this->getMode() == ilPDNotesGUI::PRIVATE_NOTES) {
249 $html = $notes_gui->getOnlyNotesHTML();
250 } else {
251 $html = $notes_gui->getOnlyCommentsHTML();
252 }
253 }
254
255 if (count($rel_objs) > 1 ||
256 ($rel_objs[0]["rep_obj_id"] > 0)) {
257 $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
258
259 foreach ($rel_objs as $obj) {
260 if ($obj["rep_obj_id"] > 0) {
261 $type = ilObject::_lookupType($obj["rep_obj_id"]);
262 $type_str = (in_array($type, array("lm", "htlm", "sahs")))
263 ? $lng->txt("obj_lm")
264 : $lng->txt("obj_" . $type);
265 $caption = $type_str . ": " . ilObject::_lookupTitle($obj["rep_obj_id"]);
266 } else {
267 $caption = $lng->txt("note_without_object");
268 }
269
270 $options[$obj["rep_obj_id"]] = $caption;
271 }
272
273 include_once "Services/Form/classes/class.ilSelectInputGUI.php";
274 $rel = new ilSelectInputGUI($lng->txt("related_to"), "rel_obj");
275 $rel->setOptions($options);
276 $rel->setValue($this->current_rel_obj);
277 $ilToolbar->addStickyItem($rel);
278
280 $btn->setCaption('change');
281 $btn->setCommand('changeRelatedObject');
282 $ilToolbar->addStickyItem($btn);
283 }
284
285 $this->tpl->setContent($html);
286 }
Notes GUI class.
static _getRelatedObjectsOfUser($a_mode)
get all related objects for user
static _lookupTitle($a_id)
lookup object title
static _lookupType($a_id, $a_reference=false)
lookup object type
This class represents a selection list property in a property form.
static getInstance()
Factory.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$type

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

Referenced by executeCommand().

+ 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: