ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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$

@ilCtrl_Calls ilPDNotesGUI: ilNoteGUI

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

Member Function Documentation

◆ changeRelatedObject()

ilPDNotesGUI::changeRelatedObject ( )

change related object

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

252 {
253 global $ilUser;
254
255 $ilUser->writePref("pd_notes_rel_obj".$this->getMode(), $_POST["rel_obj"]);
256 $this->ctrl->redirect($this);
257 }
getMode()
Get current mode.
$_POST['username']
Definition: cron.php:12
global $ilUser
Definition: imgupload.php:15

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

+ Here is the call graph for this function:

◆ displayHeader()

ilPDNotesGUI::displayHeader ( )

display header and locator

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

101 {
102 $this->tpl->setTitle($this->lng->txt("notes"));
103
104 // catch feedback message
105 // display infopanel if something happened
107
108 }
static infoPanel($a_keep=true)

References 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 70 of file class.ilPDNotesGUI.php.

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 }
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 308 of file class.ilPDNotesGUI.php.

309 {
310 global $ilUser, $ilSetting;
311
312 if ($ilUser->getPref("pd_notes_mode") == ilPDNotesGUI::PUBLIC_COMMENTS &&
313 !$ilSetting->get("disable_comments"))
314 {
316 }
317 else
318 {
320 }
321 }
global $ilSetting
Definition: privfeed.php:40

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

Referenced by changeRelatedObject(), and view().

+ Here is the caller graph for this function:

◆ ilPDNotesGUI()

ilPDNotesGUI::ilPDNotesGUI ( )

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 // 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 }
$_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)
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7

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

◆ setTabs()

ilPDNotesGUI::setTabs ( )

Show subtabs.

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

264 {
265 global $ilTabs, $ilSetting, $ilCtrl;
266
267 $ilTabs->addTarget("private_notes",
268 $ilCtrl->getLinkTarget($this, "showPrivateNotes"), "", "", "",
269 ($this->getMode() == ilPDNotesGUI::PRIVATE_NOTES));
270 if(!$ilSetting->get("disable_comments"))
271 {
272 $ilTabs->addTarget("notes_public_comments",
273 $ilCtrl->getLinkTarget($this, "showPublicComments"), "", "", "",
274 ($this->getMode() == ilPDNotesGUI::PUBLIC_COMMENTS));
275 }
276 }

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

282 {
283 global $ilUser, $ilCtrl;
284
285 $ilUser->writePref("pd_notes_mode", ilPDNotesGUI::PRIVATE_NOTES);
286 $ilCtrl->redirect($this, "");
287 }

References $ilCtrl, $ilUser, and PRIVATE_NOTES.

◆ showPublicComments()

ilPDNotesGUI::showPublicComments ( )

Show public comments.

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

293 {
294 global $ilUser, $ilCtrl, $ilSetting;
295
296 if($ilSetting->get("disable_comments"))
297 {
298 $ilCtrl->redirect($this, "showPrivateNotes");
299 }
300
301 $ilUser->writePref("pd_notes_mode", ilPDNotesGUI::PUBLIC_COMMENTS);
302 $ilCtrl->redirect($this, "");
303 }

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

◆ view()

ilPDNotesGUI::view ( )

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

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