ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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

 $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$

@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 37 of file class.ilPDNotesGUI.php.

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

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

Member Function Documentation

◆ changeRelatedObject()

ilPDNotesGUI::changeRelatedObject ( )

change related object

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

265 {
266 global $ilUser;
267
268 $ilUser->writePref("pd_notes_rel_obj".$this->getMode(), $_POST["rel_obj"]);
269 $this->ctrl->redirect($this);
270 }
$_POST["username"]
getMode()
Get current mode.

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

+ Here is the call graph for this function:

◆ displayHeader()

ilPDNotesGUI::displayHeader ( )

display header and locator

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

102 {
103 global $ilSetting;
104
105 $t = $this->lng->txt("notes");
106 if (!$this->ilias->getSetting("disable_notes") && !$ilSetting->get("disable_comments"))
107 {
108 $t = $this->lng->txt("notes_and_comments");
109 }
110 if ($this->ilias->getSetting("disable_notes"))
111 {
112 $t = $this->lng->txt("notes_comments");
113 }
114
115 $this->tpl->setTitle($t);
116
117 // catch feedback message
118 // display infopanel if something happened
120
121 }
static infoPanel($a_keep=true)
global $ilSetting
Definition: privfeed.php:17

References $ilSetting, $t, 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 72 of file class.ilPDNotesGUI.php.

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

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

+ Here is the call graph for this function:

◆ getMode()

ilPDNotesGUI::getMode ( )

Get current mode.

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

326 {
327 global $ilUser, $ilSetting;
328
329 if ($ilUser->getPref("pd_notes_mode") == ilPDNotesGUI::PUBLIC_COMMENTS &&
330 !$ilSetting->get("disable_comments"))
331 {
333 }
334 else
335 {
337 }
338 }

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

Referenced by changeRelatedObject(), and view().

+ Here is the caller graph for this function:

◆ setTabs()

ilPDNotesGUI::setTabs ( )

Show subtabs.

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

277 {
278 global $ilTabs, $ilSetting, $ilCtrl;
279
280 if(!$ilSetting->get("disable_notes"))
281 {
282 $ilTabs->addTarget("private_notes",
283 $ilCtrl->getLinkTarget($this, "showPrivateNotes"), "", "", "",
284 ($this->getMode() == ilPDNotesGUI::PRIVATE_NOTES));
285 }
286
287 if(!$ilSetting->get("disable_comments"))
288 {
289 $ilTabs->addTarget("notes_public_comments",
290 $ilCtrl->getLinkTarget($this, "showPublicComments"), "", "", "",
291 ($this->getMode() == ilPDNotesGUI::PUBLIC_COMMENTS));
292 }
293 }

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

Referenced by executeCommand().

+ Here is the caller graph for this function:

◆ showPrivateNotes()

ilPDNotesGUI::showPrivateNotes ( )

Show private notes.

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

299 {
300 global $ilUser, $ilCtrl;
301
302 $ilUser->writePref("pd_notes_mode", ilPDNotesGUI::PRIVATE_NOTES);
303 $ilCtrl->redirect($this, "");
304 }

References $ilCtrl, $ilUser, and PRIVATE_NOTES.

◆ showPublicComments()

ilPDNotesGUI::showPublicComments ( )

Show public comments.

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

310 {
311 global $ilUser, $ilCtrl, $ilSetting;
312
313 if($ilSetting->get("disable_comments"))
314 {
315 $ilCtrl->redirect($this, "showPrivateNotes");
316 }
317
318 $ilUser->writePref("pd_notes_mode", ilPDNotesGUI::PUBLIC_COMMENTS);
319 $ilCtrl->redirect($this, "");
320 }

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

◆ view()

ilPDNotesGUI::view ( )

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

127 {
128 global $ilUser, $lng, $ilSetting, $ilAccess, $ilToolbar;
129
130 //$this->tpl->addBlockFile("ADM_CONTENT", "objects", "tpl.table.html")
131 include_once("Services/Notes/classes/class.ilNoteGUI.php");
132
133 // output related item selection (if more than one)
134 include_once("Services/Notes/classes/class.ilNote.php");
135 $rel_objs = ilNote::_getRelatedObjectsOfUser($this->getMode());
136//var_dump($rel_objs);
137 // prepend personal dektop, if first object
138// if ($rel_objs[0]["rep_obj_id"] > 0 && $this->getMode() == ilPDNotesGUI::PRIVATE_NOTES)
139 if ($this->getMode() == ilPDNotesGUI::PRIVATE_NOTES)
140 {
141
142 $rel_objs = array_merge(array(0), $rel_objs);
143 }
144
145 // #9410
146 if(!$rel_objs && $this->getMode() == ilPDNotesGUI::PUBLIC_COMMENTS)
147 {
148 $lng->loadLanguageModule("notes");
149 ilUtil::sendInfo($lng->txt("msg_no_search_result"));
150 return;
151 }
152
153 $first = true;
154 foreach ($rel_objs as $r)
155 {
156 if ($first) // take first one as default
157 {
158 $this->current_rel_obj = $r["rep_obj_id"];
159 $current_ref_ids = $r["ref_ids"];
160 }
161 if ($r["rep_obj_id"] == $ilUser->getPref("pd_notes_rel_obj".$this->getMode()))
162 {
163 $this->current_rel_obj = $r["rep_obj_id"];
164 $current_ref_ids = $r["ref_ids"];
165 }
166 $first = false;
167 }
168 if ($this->current_rel_obj > 0)
169 {
170 $notes_gui = new ilNoteGUI($this->current_rel_obj, 0,
171 ilObject::_lookupType($this->current_rel_obj),true);
172 }
173 else
174 {
175 $notes_gui = new ilNoteGUI(0, $ilUser->getId(), "pd");
176 }
177
178 if ($this->getMode() == ilPDNotesGUI::PRIVATE_NOTES)
179 {
180 $notes_gui->enablePrivateNotes(true);
181 $notes_gui->enablePublicNotes(false);
182 }
183 else
184 {
185 $notes_gui->enablePrivateNotes(false);
186 $notes_gui->enablePublicNotes(true);
187
188 // #13707
189 if ($this->current_rel_obj > 0 &&
190 sizeof($current_ref_ids) &&
191 $ilSetting->get("comments_del_tutor", 1))
192 {
193 foreach($current_ref_ids as $ref_id)
194 {
195 if($ilAccess->checkAccess("write", "", $ref_id))
196 {
197 $notes_gui->enablePublicNotesDeletion(true);
198 break;
199 }
200 }
201 }
202 }
203 $notes_gui->enableHiding(false);
204 $notes_gui->enableTargets(true);
205 $notes_gui->enableMultiSelection(true);
206 $notes_gui->enableAnchorJump(false);
207
208 $next_class = $this->ctrl->getNextClass($this);
209
210 if ($next_class == "ilnotegui")
211 {
212 $html = $this->ctrl->forwardCommand($notes_gui);
213 }
214 else
215 {
216 if ($this->getMode() == ilPDNotesGUI::PRIVATE_NOTES)
217 {
218 $html = $notes_gui->getOnlyNotesHTML();
219 }
220 else
221 {
222 $html = $notes_gui->getOnlyCommentsHTML();
223 }
224 }
225
226 if (count($rel_objs) > 1 ||
227 ($rel_objs[0]["rep_obj_id"] > 0))
228 {
229 $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
230
231 foreach($rel_objs as $obj)
232 {
233 if ($obj["rep_obj_id"] > 0)
234 {
235 $type = ilObject::_lookupType($obj["rep_obj_id"]);
236 $type_str = (in_array($type, array("lm", "htlm", "sahs")))
237 ? $lng->txt("learning_resource")
238 : $lng->txt("obj_".$type);
239 $caption = $type_str.": ".ilObject::_lookupTitle($obj["rep_obj_id"]);
240 }
241 else
242 {
243 $caption = $lng->txt("personal_desktop");
244 }
245
246 $options[$obj["rep_obj_id"]] = $caption;
247 }
248
249 include_once "Services/Form/classes/class.ilSelectInputGUI.php";
250 $rel = new ilSelectInputGUI($lng->txt("related_to"), "rel_obj");
251 $rel->setOptions($options);
252 $rel->setValue($this->current_rel_obj);
253 $ilToolbar->addInputItem($rel);
254
255 $ilToolbar->addFormButton($lng->txt("change"), "changeRelatedObject");
256 }
257
258 $this->tpl->setContent($html);
259 }
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 sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$html
Definition: example_001.php:87
$r
Definition: example_031.php:79
$ref_id
Definition: sahs_server.php:39
if(!is_array($argv)) $options

References $html, $ilSetting, $ilUser, $lng, $options, $r, $ref_id, ilNote\_getRelatedObjectsOfUser(), ilObject\_lookupTitle(), ilObject\_lookupType(), 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

◆ $ilias

ilPDNotesGUI::$ilias

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

Referenced by __construct().

◆ $lng

ilPDNotesGUI::$lng

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

Referenced by __construct(), and view().

◆ $tpl

ilPDNotesGUI::$tpl

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

Referenced by __construct().

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