ILIAS  trunk Revision v11.0_alpha-1843-g9e1fad99175
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilPDNotesGUI Class Reference

Private Notes on PD. More...

+ Collaboration diagram for ilPDNotesGUI:

Public Member Functions

 __construct ()
 
 executeCommand ()
 
 displayHeader ()
 
 view ()
 
 changeRelatedObject ()
 
 showPrivateNotes ()
 
 showPublicComments ()
 
 printSelection ()
 

Data Fields

ilGlobalTemplateInterface $tpl
 
ilLanguage $lng
 

Protected Member Functions

 readFilter ()
 
 getRelatedObjects ()
 
 getGui ()
 
 setSortation ()
 
 getFilter ()
 
 setToolbar ()
 

Protected Attributes

int $note_type
 
string $search_text = ""
 
FilterAdapterGUI $filter = null
 
ILIAS Notes InternalGUIService $gui
 
ILIAS DI UIServices $ui
 
NotesManager $notes_manager
 
int $current_rel_obj = null
 
StandardGUIRequest $request
 
ilCtrl $ctrl
 
ilObjUser $user
 
ilTabsGUI $tabs
 
ilHelpGUI $help
 
ilSetting $settings
 
ilAccessHandler $access
 
ilToolbarGUI $toolbar
 
array $related_objects = null
 

Detailed Description

Private Notes on PD.

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de ilPDNotesGUI: ilNoteGUI, ilCommentGUI

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

Constructor & Destructor Documentation

◆ __construct()

ilPDNotesGUI::__construct ( )

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

References $context, $DIC, $lng, $tpl, ILIAS\Repository\access(), ILIAS\Repository\ctrl(), ILIAS\Repository\help(), ILIAS\Repository\lng(), ilLanguage\loadLanguageModule(), readFilter(), ILIAS\Repository\settings(), ILIAS\Repository\tabs(), ILIAS\Repository\toolbar(), ILIAS\Repository\ui(), and ILIAS\Repository\user().

53  {
54  global $DIC;
55 
56  $this->user = $DIC->user();
57  $this->tabs = $DIC->tabs();
58  $this->help = $DIC["ilHelp"];
59  $this->settings = $DIC->settings();
60  $this->access = $DIC->access();
61  $this->toolbar = $DIC->toolbar();
62  $tpl = $DIC["tpl"];
63  $lng = $DIC->language();
64  $ilCtrl = $DIC->ctrl();
65  $ilUser = $DIC->user();
66  $ilHelp = $DIC["ilHelp"];
67  $this->ui = $DIC->ui();
68 
69  $this->request = $DIC->notes()
70  ->internal()
71  ->gui()
72  ->standardRequest();
73 
74  $ilHelp->setScreenIdComponent("note");
75 
76  $lng->loadLanguageModule("notes");
77 
78  // initiate variables
79  $this->tpl = $tpl;
80  $this->lng = $lng;
81  $this->ctrl = $ilCtrl;
82 
83  $this->notes_manager = $DIC->notes()->internal()->domain()->notes();
84  $this->gui = $DIC->notes()->internal()->gui();
85 
86  // link from ilPDNotesBlockGUI
87  $rel_obj = $this->request->getRelatedObjId();
88  $this->note_type = ($this->request->getNoteType() === Note::PRIVATE || $ilCtrl->getCmd() === "getNotesHTML")
89  ? Note::PRIVATE
90  : Note::PUBLIC;
91  if ($ilCtrl->getCmd() === "getCommentsHTML") {
92  $this->note_type = Note::PUBLIC;
93  }
94  $this->ctrl->setParameter($this, "note_type", $this->note_type);
95  if ($rel_obj > 0) {
96  $ilUser->writePref("pd_notes_rel_obj" . $this->note_type, (string) $rel_obj);
97  }
98  // edit link
99  elseif ($this->request->getNoteId() > 0) {
100  $note = $this->notes_manager->getById($this->request->getNoteId());
101  $context = $note->getContext();
102  $ilUser->writePref("pd_notes_rel_obj" . $this->note_type, $context->getObjId());
103  }
104  $this->readFilter();
105  $ajax_url = $this->ctrl->getLinkTargetByClass(
106  ["ildashboardgui", "ilpdnotesgui", "ilnotegui"],
107  "",
108  "",
109  true,
110  false
111  );
112  $this->gui->initJavascript($ajax_url);
113  }
$context
Definition: webdav.php:31
loadLanguageModule(string $a_module)
Load language module.
global $DIC
Definition: shib_login.php:22
ilGlobalTemplateInterface $tpl
+ Here is the call graph for this function:

Member Function Documentation

◆ changeRelatedObject()

ilPDNotesGUI::changeRelatedObject ( )

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

References $user, ILIAS\Repository\ctrl(), and ilObjUser\writePref().

285  : void
286  {
287  $ilUser = $this->user;
288 
289  $ilUser->writePref(
290  "pd_notes_rel_obj" . $this->note_type,
291  (string) $this->request->getRelatedObjId()
292  );
293  $this->ctrl->redirect($this);
294  }
writePref(string $a_keyword, string $a_value)
+ Here is the call graph for this function:

◆ displayHeader()

ilPDNotesGUI::displayHeader ( )

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

References $ilSetting, $settings, ilUtil\getImagePath(), and ILIAS\Repository\lng().

Referenced by executeCommand().

149  : void
150  {
152 
153  $t = $this->lng->txt("notes");
154  if (!$ilSetting->get("disable_notes") && !$ilSetting->get("disable_comments")) {
155  $t = $this->lng->txt("notes_and_comments");
156  }
157  if ($ilSetting->get("disable_notes")) {
158  $t = $this->lng->txt("notes_comments");
159  }
160 
161  if ($this->note_type === Note::PRIVATE) {
162  $t = $this->lng->txt("private_notes");
163  $this->tpl->setTitleIcon(ilUtil::getImagePath("standard/icon_nots.svg"));
164  } else {
165  $t = $this->lng->txt("notes_public_comments");
166  $this->tpl->setTitleIcon(ilUtil::getImagePath("standard/icon_coms.svg"));
167  }
168 
169  $this->tpl->setTitle($t);
170  }
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
global $ilSetting
Definition: privfeed.php:31
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilPDNotesGUI::executeCommand ( )

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

References ILIAS\Repository\ctrl(), displayHeader(), and view().

126  : void
127  {
128  $next_class = $this->ctrl->getNextClass();
129  switch ($next_class) {
130  case "ilnotegui":
131  $this->displayHeader();
132  $this->view(); // forwardCommand is invoked in view() method
133  break;
134 
135  case "ilcommentgui":
136  $this->displayHeader();
137  $this->view(); // forwardCommand is invoked in view() method
138  break;
139 
140  default:
141  $cmd = $this->ctrl->getCmd("view");
142  $this->displayHeader();
143  $this->$cmd();
144  break;
145  }
146  $this->tpl->printToStdout(true);
147  }
+ Here is the call graph for this function:

◆ getFilter()

ilPDNotesGUI::getFilter ( )
protected

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

References $filter, $gui, $lng, ilObject\_lookupTitle(), ILIAS\Repository\filter(), getRelatedObjects(), ILIAS\Repository\lng(), and ilLanguage\txt().

Referenced by readFilter(), and view().

324  {
325  $gui = $this->gui;
326  $lng = $this->lng;
327  if (is_null($this->filter)) {
328  $options = [];
329 
330  if ($this->note_type === Note::PRIVATE) {
331  $options[-1] = $this->lng->txt("note_without_object");
332  }
333 
334  foreach ($this->getRelatedObjects() as $k) {
335  $options[$k] = ilObject::_lookupTitle($k);
336  }
337  $this->filter = $gui->filter(
338  "notes_filter_" . $this->note_type,
339  self::class,
340  "view",
341  false,
342  false
343  )
344  ->text("text", $lng->txt("notes_text"))
345  ->select("object", $lng->txt("notes_origin"), $options);
346  }
347  return $this->filter;
348  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
FilterAdapterGUI $filter
static _lookupTitle(int $obj_id)
ILIAS Notes InternalGUIService $gui
filter(string $filter_id, $class_path, string $cmd, bool $activated=true, bool $expanded=true)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getGui()

ilPDNotesGUI::getGui ( )
protected

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

References $current_rel_obj, $gui, ilObject\_lookupType(), getRelatedObjects(), null, and ILIAS\Repository\user().

Referenced by view().

242  : ilNoteGUI
243  {
244  $rel_objs = $this->getRelatedObjects();
245  if ($this->current_rel_obj === null) {
246  $rep_objs = $rel_objs;
247  $type = "";
248  $include_subs = true;
249  $obj_id = 0;
250  } elseif ($this->current_rel_obj > 0) {
251  $rep_objs = $this->current_rel_obj;
252  $type = \ilObject::_lookupType($this->current_rel_obj);
253  $include_subs = true;
254  $obj_id = 0;
255  } else {
256  $rep_objs = 0;
257  $type = "pd";
258  $include_subs = false;
259  $obj_id = $this->user->getId();
260  }
261  if ($this->note_type === Note::PRIVATE) {
262  $gui = new ilNoteGUI(
263  $rep_objs,
264  $obj_id,
265  $type,
266  $include_subs,
267  0,
268  false,
269  $this->search_text
270  );
271  } else {
272  $gui = $this->gui->getCommentsGUI(
273  $rep_objs,
274  $obj_id,
275  $type,
276  0,
277  $include_subs,
278  false,
279  $this->search_text
280  );
281  }
282  return $gui;
283  }
ilNoteGUI: ilCommentGUI
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
ILIAS Notes InternalGUIService $gui
static _lookupType(int $id, bool $reference=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRelatedObjects()

ilPDNotesGUI::getRelatedObjects ( )
protected

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

References $related_objects.

Referenced by getFilter(), getGui(), and view().

172  : array
173  {
174  if (is_null($this->related_objects)) {
175  $this->related_objects = $this->notes_manager->getRelatedObjectsOfUser(
176  $this->note_type
177  );
178  }
179  return $this->related_objects;
180  }
+ Here is the caller graph for this function:

◆ printSelection()

ilPDNotesGUI::printSelection ( )
Exceptions

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

386  : void
387  {
388  $pv = $this->gui->print();
389  $pv->sendForm();
390  }

◆ readFilter()

ilPDNotesGUI::readFilter ( )
protected

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

References $data, getFilter(), ILIAS\Repository\int(), and null.

Referenced by __construct().

115  : void
116  {
117  $data = $this->getFilter()->getData();
118  if (!isset($data["object"]) || $data["object"] === "") {
119  $this->current_rel_obj = null;
120  } else {
121  $this->current_rel_obj = (int) $data["object"];
122  }
123  $this->search_text = $data["text"] ?? "";
124  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setSortation()

ilPDNotesGUI::setSortation ( )
protected

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

References view().

317  : void
318  {
319  $this->notes_manager->setSortAscending($this->gui->standardRequest()->getSortation() === "asc");
320  $this->view();
321  }
+ Here is the call graph for this function:

◆ setToolbar()

ilPDNotesGUI::setToolbar ( )
protected

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

References Vendor\Package\$b, $c, $ctrl, ilCtrl\getLinkTarget(), ilCtrl\getLinkTargetByClass(), ILIAS\Repository\lng(), ILIAS\Repository\toolbar(), and ILIAS\Repository\ui().

Referenced by view().

350  : void
351  {
352  $ctrl = $this->ctrl;
353 
354  // sortation
355  $c = $this->lng->txt("create_date") . ", ";
356  $options = [
357  'desc' => $c . $this->lng->txt("sorting_desc"),
358  'asc' => $c . $this->lng->txt("sorting_asc")
359  ];
360  $select_option = ($this->notes_manager->getSortAscending())
361  ? 'asc'
362  : 'desc';
363  $s = $this->ui->factory()->viewControl()->sortation($options, $select_option)
364  ->withTargetURL($ctrl->getLinkTarget($this, "setSortation"), 'sortation');
365  $this->toolbar->addComponent($s);
366 
367  // print selection
368  $pv = $this->gui->print();
369  $modal_elements = $pv->getModalElements(
370  $ctrl->getLinkTarget($this, "printSelection")
371  );
372  $this->toolbar->addComponent($modal_elements->button);
373  $this->toolbar->addComponent($modal_elements->modal);
374 
375  // export html
376  $b = $this->ui->factory()->button()->standard(
377  $this->lng->txt("notes_html_export"),
378  $ctrl->getLinkTargetByClass("ilNoteGUI", "exportNotesHTML")
379  );
380  $this->toolbar->addComponent($b);
381  }
getLinkTarget(object $a_gui_obj, ?string $a_cmd=null, ?string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
$c
Definition: deliver.php:25
getLinkTargetByClass( $a_class, ?string $a_cmd=null, ?string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showPrivateNotes()

ilPDNotesGUI::showPrivateNotes ( )

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

References $ctrl, $user, and ilCtrl\redirectByClass().

296  : void
297  {
298  $ilUser = $this->user;
299  $ilCtrl = $this->ctrl;
300 
301  $ilCtrl->redirectByClass(ilNoteGUI::class, "getNotesHTML");
302  }
redirectByClass( $a_class, ?string $a_cmd=null, ?string $a_anchor=null, bool $is_async=false)
+ Here is the call graph for this function:

◆ showPublicComments()

ilPDNotesGUI::showPublicComments ( )

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

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

304  : void
305  {
306  $ilUser = $this->user;
307  $ilCtrl = $this->ctrl;
309 
310  if ($ilSetting->get("disable_comments")) {
311  $ilCtrl->redirect($this, "showPrivateNotes");
312  }
313 
314  $ilCtrl->redirectByClass(ilCommentGUI::class, "getListHTML");
315  }
global $ilSetting
Definition: privfeed.php:31

◆ view()

ilPDNotesGUI::view ( )

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

References $access, $ilSetting, $lng, $ref_id, $settings, $toolbar, $user, ilObject\_getAllReferences(), ILIAS\Repository\ctrl(), getFilter(), getGui(), getRelatedObjects(), ilLanguage\loadLanguageModule(), setToolbar(), and ilLanguage\txt().

Referenced by executeCommand(), and setSortation().

182  : void
183  {
184  $ilUser = $this->user;
185  $lng = $this->lng;
187  $ilAccess = $this->access;
188  $ilToolbar = $this->toolbar;
189 
190  $rel_objs = $this->getRelatedObjects();
191  $this->setToolbar();
192 
193  if ($this->note_type === Note::PRIVATE) {
194  $rel_objs = array_merge(
195  [0],
196  $rel_objs
197  );
198  }
199 
200  // #9410
201  if (count($rel_objs) === 0 && $this->note_type === Note::PUBLIC) {
202  $lng->loadLanguageModule("notes");
203  $this->tpl->setOnScreenMessage('info', $lng->txt("msg_no_search_result"));
204  return;
205  }
206  $notes_gui = $this->getGui();
207 
208  if ($this->note_type === Note::PRIVATE) {
209  $notes_gui->enablePrivateNotes(true);
210  $notes_gui->enablePublicNotes(false);
211  } else {
212  $notes_gui->enablePrivateNotes(false);
213  $notes_gui->enablePublicNotes(true);
214  // #13707
215  if ($this->current_rel_obj > 0 &&
216  $ilSetting->get("comments_del_tutor", '1')) {
217  foreach (\ilObject::_getAllReferences($this->current_rel_obj) as $ref_id) {
218  if ($ilAccess->checkAccess("write", "", $ref_id)) {
219  $notes_gui->enablePublicNotesDeletion(true);
220  break;
221  }
222  }
223  }
224  }
225  $notes_gui->enableTargets(true);
226 
227  $next_class = $this->ctrl->getNextClass($this);
228 
229  if (in_array($next_class, ["ilnotegui", "ilcommentgui"])) {
230  $html = $this->ctrl->forwardCommand($notes_gui);
231  } elseif ($this->note_type === Note::PRIVATE) {
232  $html = $notes_gui->getNotesHTML();
233  } else {
234  $html = $notes_gui->getListHTML();
235  }
236 
237  $filter_html = $this->getFilter()->render();
238 
239  $this->tpl->setContent($filter_html . $html);
240  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static _getAllReferences(int $id)
get all reference ids for object ID
loadLanguageModule(string $a_module)
Load language module.
$ref_id
Definition: ltiauth.php:65
ilToolbarGUI $toolbar
global $ilSetting
Definition: privfeed.php:31
ilAccessHandler $access
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $access

ilAccessHandler ilPDNotesGUI::$access
protected

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

Referenced by view().

◆ $ctrl

ilCtrl ilPDNotesGUI::$ctrl
protected

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

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

◆ $current_rel_obj

int ilPDNotesGUI::$current_rel_obj = null
protected

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

Referenced by getGui().

◆ $filter

FilterAdapterGUI ilPDNotesGUI::$filter = null
protected

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

Referenced by getFilter().

◆ $gui

ILIAS Notes InternalGUIService ilPDNotesGUI::$gui
protected

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

Referenced by getFilter(), and getGui().

◆ $help

ilHelpGUI ilPDNotesGUI::$help
protected

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

◆ $lng

ilLanguage ilPDNotesGUI::$lng

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

Referenced by __construct(), getFilter(), and view().

◆ $note_type

int ilPDNotesGUI::$note_type
protected

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

◆ $notes_manager

NotesManager ilPDNotesGUI::$notes_manager
protected

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

◆ $related_objects

array ilPDNotesGUI::$related_objects = null
protected

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

Referenced by getRelatedObjects().

◆ $request

StandardGUIRequest ilPDNotesGUI::$request
protected

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

◆ $search_text

string ilPDNotesGUI::$search_text = ""
protected

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

◆ $settings

ilSetting ilPDNotesGUI::$settings
protected

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

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

◆ $tabs

ilTabsGUI ilPDNotesGUI::$tabs
protected

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

◆ $toolbar

ilToolbarGUI ilPDNotesGUI::$toolbar
protected

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

Referenced by view().

◆ $tpl

ilGlobalTemplateInterface ilPDNotesGUI::$tpl

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

Referenced by __construct().

◆ $ui

ILIAS DI UIServices ilPDNotesGUI::$ui
protected

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

◆ $user

ilObjUser ilPDNotesGUI::$user
protected

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