ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
ilNoteGUI Class Reference

Notes GUI class. More...

+ Collaboration diagram for ilNoteGUI:

Public Member Functions

 __construct ( $a_rep_obj_id="", $a_obj_id="", $a_obj_type="", $a_include_subobjects=false, $a_news_id=0, $ajax=true)
 constructor, specifies notes set More...
 
 setDefaultCommand ($a_val)
 Set default command. More...
 
 getDefaultCommand ()
 Get default command. More...
 
 executeCommand ()
 execute command More...
 
 enablePrivateNotes ($a_enable=true)
 enable private notes More...
 
 enablePublicNotes ($a_enable=true)
 enable public notes More...
 
 enableCommentsSettings ($a_enable=true)
 enable private notes More...
 
 enablePublicNotesDeletion ($a_enable=true)
 enable public notes More...
 
 enableHiding ($a_enable=true)
 enable hiding More...
 
 enableTargets ($a_enable=true)
 enable target objects More...
 
 enableMultiSelection ($a_enable=true)
 enable multi selection (checkboxes and commands) More...
 
 enableAnchorJump ($a_enable=true)
 enable anchor for form jump More...
 
 setRepositoryMode ($a_value)
 Set repository mode. More...
 
 getOnlyNotesHTML ()
 Get only notes html. More...
 
 getOnlyCommentsHTML ()
 Get only comments html. More...
 
 getNotesHTML ($a_init_form=true)
 
 activateComments ()
 Activate Comments. More...
 
 deactivateComments ()
 Deactivate Comments. More...
 
 getNoteListHTML ($a_type=IL_NOTE_PRIVATE, $a_init_form=true)
 get notes/comments list as html code More...
 
 checkDeletion ($a_note)
 Check whether deletion is allowed. More...
 
 checkEdit ($a_note)
 Check edit. More...
 
 initNoteForm ($a_mode="edit", $a_type, $a_note=null)
 Init note form. More...
 
 getPDNoteHTML ($note_id)
 Note display for personal desktop. More...
 
 renderTargets ($a_note)
 show related objects as links More...
 
 addNoteForm ($a_init_form=true)
 get notes list including add note area More...
 
 cancelAddNote ()
 cancel add note More...
 
 cancelUpdateNote ()
 cancel edit note More...
 
 addNote ()
 add note More...
 
 updateNote ()
 update note More...
 
 editNoteForm ($a_init_form=true)
 get notes list including add note area More...
 
 deleteNote ()
 delete note confirmation More...
 
 deleteNotes ()
 delete notes confirmation More...
 
 cancelDelete ()
 cancel deletion of note More...
 
 confirmDelete ()
 cancel deletion of note More...
 
 exportNotesHTML ()
 export selected notes to html More...
 
 printNotes ()
 notes print view screen More...
 
 showNotes ()
 show notes More...
 
 hideNotes ()
 hide notes More...
 
 showAllPublicNotes ()
 show all public notes to user More...
 
 showMyPublicNotes ()
 show only public notes of user More...
 
 renderLink ($a_tpl, $a_var, $a_txt, $a_cmd, $a_anchor="")
 Render a link. More...
 
 addObserver ($a_callback)
 Add observer. More...
 
 getHTML ()
 Get HTML. More...
 
 setExportMode ()
 Set export mode. More...
 

Static Public Member Functions

static initJavascript ($a_ajax_url, $a_type=IL_NOTE_PRIVATE, ilGlobalTemplateInterface $a_main_tpl=null)
 Init javascript. More...
 
static getListNotesJSCall ($a_hash, $a_update_code=null)
 Get list notes js call. More...
 
static getListCommentsJSCall ($a_hash, $a_update_code=null)
 Get list comments js call. More...
 

Data Fields

 $public_deletion_enabled = false
 
 $repository_mode = false
 
 $old = false
 

Protected Member Functions

 getSubObjectTitle ($parent_obj_id, $sub_obj_id)
 Get sub object title if available with callback. More...
 
 notifyObserver ($a_action, $a_note)
 Notify observers on update/create. More...
 
 listSortAsc ()
 
 listSortDesc ()
 
 getCommentsWidget ()
 Get widget. More...
 
 updateWidget ()
 Update widget. More...
 

Static Protected Member Functions

static buildAjaxHash ($a_node_type, $a_node_id, $a_sub_id, $a_sub_type)
 Combine properties to hash. More...
 

Protected Attributes

 $ctrl
 
 $lng
 
 $user
 
 $settings
 
 $obj_definition
 
 $tree
 
 $access
 
 $default_command = "getNotesHTML"
 
 $observer = []
 
 $ui
 
 $news_id = 0
 
 $hide_new_form = false
 
 $only_latest = false
 
 $widget_header = ""
 
 $no_actions = false
 
 $enable_sorting = true
 
 $user_img_export_html = false
 
 $log
 

Detailed Description

Notes GUI class.

An instance of this class handles all notes (and their lists) of an object.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 18 of file class.ilNoteGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilNoteGUI::__construct (   $a_rep_obj_id = "",
  $a_obj_id = "",
  $a_obj_type = "",
  $a_include_subobjects = false,
  $a_news_id = 0,
  $ajax = true 
)

constructor, specifies notes set

Parameters
$a_rep_obj_idint object id of repository object (0 for personal desktop)
$a_obj_idint subobject id (0 for repository items, user id for personal desktop)
$a_obj_typestring "pd" for personal desktop
$a_include_subobjectsstring include all subobjects of rep object (e.g. pages)

Definition at line 117 of file class.ilNoteGUI.php.

References $_GET, $DIC, $lng, ilObject\_lookupType(), ilNote\commentsActivated(), ilUtil\getImagePath(), ilLoggerFactory\getLogger(), IL_NOTE_CONTRA, IL_NOTE_IMPORTANT, IL_NOTE_PRO, IL_NOTE_QUESTION, IL_NOTE_UNLABELED, setRepositoryMode(), settings(), ui(), and user().

124  {
125  global $DIC;
126 
127  $this->user = $DIC->user();
128  $this->settings = $DIC->settings();
129  $this->obj_definition = $DIC["objDefinition"];
130  $this->tree = $DIC->repositoryTree();
131  $this->access = $DIC->access();
132  $this->ui = $DIC->ui();
133  $ilCtrl = $DIC->ctrl();
134  $lng = $DIC->language();
135  $this->log = ilLoggerFactory::getLogger('note');
136 
137  $lng->loadLanguageModule("notes");
138 
139  $ilCtrl->saveParameter($this, "notes_only");
140  $this->only = $_GET["notes_only"];
141 
142  $this->rep_obj_id = $a_rep_obj_id;
143  $this->obj_id = $a_obj_id;
144  $this->obj_type = $a_obj_type;
145  $this->inc_sub = $a_include_subobjects;
146  $this->news_id = $a_news_id;
147 
148  // auto-detect object type
149  if (!$this->obj_type && $a_rep_obj_id) {
150  $this->obj_type = ilObject::_lookupType($a_rep_obj_id);
151  }
152 
153  $this->ajax = $ajax;
154 
155  $this->ctrl = $ilCtrl;
156  $this->lng = $lng;
157 
158  $this->anchor_jump = true;
159  $this->add_note_form = false;
160  $this->edit_note_form = false;
161  $this->private_enabled = false;
162 
163  if (ilNote::commentsActivated($this->rep_obj_id, $this->obj_id, $this->obj_type, $this->news_id)) {
164  $this->public_enabled = true;
165  } else {
166  $this->public_enabled = false;
167  }
168  $this->enable_hiding = false;
169  $this->targets_enabled = false;
170  $this->multi_selection = false;
171  $this->export_html = false;
172  $this->print = false;
173  $this->comments_settings = false;
174 
175  $this->note_img = array(
176  IL_NOTE_UNLABELED => array(
177  "img" => ilUtil::getImagePath("note_unlabeled.svg"),
178  "alt" => $lng->txt("note")),
179  IL_NOTE_IMPORTANT => array(
180  "img" => ilUtil::getImagePath("note_unlabeled.svg"),
181  "alt" => $lng->txt("note") . ", " . $lng->txt("important")),
182  IL_NOTE_QUESTION => array(
183  "img" => ilUtil::getImagePath("note_unlabeled.svg"),
184  "alt" => $lng->txt("note") . ", " . $lng->txt("question")),
185  IL_NOTE_PRO => array(
186  "img" => ilUtil::getImagePath("note_unlabeled.svg"),
187  "alt" => $lng->txt("note") . ", " . $lng->txt("pro")),
188  IL_NOTE_CONTRA => array(
189  "img" => ilUtil::getImagePath("note_unlabeled.svg"),
190  "alt" => $lng->txt("note") . ", " . $lng->txt("contra"))
191  );
192 
193  $this->comment_img = array(
194  IL_NOTE_UNLABELED => array(
195  "img" => ilUtil::getImagePath("comment_unlabeled.svg"),
196  "alt" => $lng->txt("notes_comment")),
197  IL_NOTE_IMPORTANT => array(
198  "img" => ilUtil::getImagePath("comment_unlabeled.svg"),
199  "alt" => $lng->txt("notes_comment") . ", " . $lng->txt("important")),
200  IL_NOTE_QUESTION => array(
201  "img" => ilUtil::getImagePath("comment_unlabeled.svg"),
202  "alt" => $lng->txt("notes_comment") . ", " . $lng->txt("question")),
203  IL_NOTE_PRO => array(
204  "img" => ilUtil::getImagePath("comment_unlabeled.svg"),
205  "alt" => $lng->txt("notes_comment") . ", " . $lng->txt("pro")),
206  IL_NOTE_CONTRA => array(
207  "img" => ilUtil::getImagePath("comment_unlabeled.svg"),
208  "alt" => $lng->txt("notes_comment") . ", " . $lng->txt("contra"))
209  );
210 
211  // default: notes for repository objects
212  $this->setRepositoryMode(true);
213  }
const IL_NOTE_CONTRA
settings()
Definition: settings.php:2
setRepositoryMode($a_value)
Set repository mode.
static commentsActivated($a_rep_obj_id, $a_obj_id, $a_obj_type, $a_news_id=0)
Are comments activated for object?
const IL_NOTE_PRO
$_GET["client_id"]
user()
Definition: user.php:4
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
global $DIC
Definition: goto.php:24
ui()
Definition: ui.php:5
static _lookupType($a_id, $a_reference=false)
lookup object type
const IL_NOTE_UNLABELED
Definition: class.ilNote.php:8
const IL_NOTE_QUESTION
static getLogger($a_component_id)
Get component logger.
const IL_NOTE_IMPORTANT
Definition: class.ilNote.php:9
+ Here is the call graph for this function:

Member Function Documentation

◆ activateComments()

ilNoteGUI::activateComments ( )

Activate Comments.

Definition at line 480 of file class.ilNoteGUI.php.

References $ctrl, and ilNote\activateComments().

481  {
482  $ilCtrl = $this->ctrl;
483 
484  if ($this->comments_settings) {
485  ilNote::activateComments($this->rep_obj_id, $this->obj_id, $this->obj_type, true);
486  }
487 
488  $ilCtrl->redirectByClass("ilnotegui", "showNotes", "", $this->ajax);
489  }
static activateComments($a_rep_obj_id, $a_obj_id, $a_obj_type, $a_activate=true)
Activate notes feature.
+ Here is the call graph for this function:

◆ addNote()

ilNoteGUI::addNote ( )

add note

Definition at line 1390 of file class.ilNoteGUI.php.

References $_GET, $_POST, $ctrl, $ilUser, $lng, $user, initNoteForm(), and notifyObserver().

1391  {
1392  $ilUser = $this->user;
1393  $lng = $this->lng;
1394  $ilCtrl = $this->ctrl;
1395  //ilLoggerFactory::getLogger("root")->notice("addNote");
1396  $this->initNoteForm("create", $_GET["note_type"]);
1397 
1398  //if ($this->form->checkInput())
1399  if ($_POST["note"] != "") {
1400  $note = new ilNote();
1401  $note->setObject($this->obj_type, $this->rep_obj_id, $this->obj_id, $this->news_id);
1402  $note->setInRepository($this->repository_mode);
1403  $note->setType($_GET["note_type"]);
1404  $note->setAuthor($ilUser->getId());
1405  $note->setText(ilUtil::stripslashes($_POST["note"]));
1406  // $note->setSubject($_POST["sub_note"]);
1407  // $note->setLabel($_POST["note_label"]);
1408  $note->create();
1409 
1410  $this->notifyObserver("new", $note);
1411 
1412  $ilCtrl->setParameter($this, "note_mess", "mod");
1413  // $ilCtrl->redirect($this, "showNotes", "notes_top", $this->ajax);
1414  }
1415  $ilCtrl->redirect($this, "showNotes", "notes_top", $this->ajax);
1416  // $this->note_mess = "frmfld";
1417 // $this->form->setValuesByPost();
1418 // return $this->addNoteForm(false);;
1419  }
initNoteForm($a_mode="edit", $a_type, $a_note=null)
Init note form.
$_GET["client_id"]
Note class.
notifyObserver($a_action, $a_note)
Notify observers on update/create.
$ilUser
Definition: imgupload.php:18
$_POST["username"]
+ Here is the call graph for this function:

◆ addNoteForm()

ilNoteGUI::addNoteForm (   $a_init_form = true)

get notes list including add note area

Definition at line 1358 of file class.ilNoteGUI.php.

References $_GET, $ilUser, $user, getNotesHTML(), and IL_NOTE_PRIVATE.

1359  {
1360  $ilUser = $this->user;
1361 
1362  $suffix = ($_GET["note_type"] == IL_NOTE_PRIVATE)
1363  ? "private"
1364  : "public";
1365  $ilUser->setPref("notes_" . $suffix, "y");
1366 
1367  $this->add_note_form = true;
1368  return $this->getNotesHTML($a_init_form);
1369  }
getNotesHTML($a_init_form=true)
const IL_NOTE_PRIVATE
Definition: class.ilNote.php:5
$_GET["client_id"]
$ilUser
Definition: imgupload.php:18
+ Here is the call graph for this function:

◆ addObserver()

ilNoteGUI::addObserver (   $a_callback)

Add observer.

Parameters
string | array$a_callback

Definition at line 1724 of file class.ilNoteGUI.php.

1725  {
1726  $this->observer[] = $a_callback;
1727  }

◆ buildAjaxHash()

static ilNoteGUI::buildAjaxHash (   $a_node_type,
  $a_node_id,
  $a_sub_id,
  $a_sub_type 
)
staticprotected

Combine properties to hash.

Parameters
string$a_node_type
int$a_node_id
int$a_sub_id
string$a_sub_type
Returns
string

Definition at line 1686 of file class.ilNoteGUI.php.

1687  {
1688  return $a_node_type . ";" . $a_node_id . ";" . $a_sub_id . ";" . $a_sub_type;
1689  }

◆ cancelAddNote()

ilNoteGUI::cancelAddNote ( )

cancel add note

Definition at line 1374 of file class.ilNoteGUI.php.

References getNotesHTML().

1375  {
1376  return $this->getNotesHTML();
1377  }
getNotesHTML($a_init_form=true)
+ Here is the call graph for this function:

◆ cancelDelete()

ilNoteGUI::cancelDelete ( )

cancel deletion of note

Definition at line 1500 of file class.ilNoteGUI.php.

References getNotesHTML().

1501  {
1502  return $this->getNotesHTML();
1503  }
getNotesHTML($a_init_form=true)
+ Here is the call graph for this function:

◆ cancelUpdateNote()

ilNoteGUI::cancelUpdateNote ( )

cancel edit note

Definition at line 1382 of file class.ilNoteGUI.php.

References getNotesHTML().

1383  {
1384  return $this->getNotesHTML();
1385  }
getNotesHTML($a_init_form=true)
+ Here is the call graph for this function:

◆ checkDeletion()

ilNoteGUI::checkDeletion (   $a_note)

Check whether deletion is allowed.

Definition at line 977 of file class.ilNoteGUI.php.

References $ilSetting, $ilUser, $public_deletion_enabled, $settings, $user, ANONYMOUS_USER_ID, IL_NOTE_PRIVATE, and IL_NOTE_PUBLIC.

Referenced by confirmDelete(), and getNoteListHTML().

978  {
981 
982  if ($ilUser->getId() == ANONYMOUS_USER_ID) {
983  return false;
984  }
985 
986  $is_author = ($a_note->getAuthor() == $ilUser->getId());
987 
988  if ($a_note->getType() == IL_NOTE_PRIVATE && $is_author) {
989  return true;
990  }
991 
992  if ($a_note->getType() == IL_NOTE_PUBLIC && $this->public_deletion_enabled) {
993  return true;
994  }
995 
996  if ($a_note->getType() == IL_NOTE_PUBLIC && $is_author && $ilSetting->get("comments_del_user", 0)) {
997  return true;
998  }
999 
1000  return false;
1001  }
const IL_NOTE_PRIVATE
Definition: class.ilNote.php:5
const ANONYMOUS_USER_ID
Definition: constants.php:25
const IL_NOTE_PUBLIC
Definition: class.ilNote.php:6
global $ilSetting
Definition: privfeed.php:17
$ilUser
Definition: imgupload.php:18
+ Here is the caller graph for this function:

◆ checkEdit()

ilNoteGUI::checkEdit (   $a_note)

Check edit.

Definition at line 1006 of file class.ilNoteGUI.php.

References $ilUser, $user, and ANONYMOUS_USER_ID.

Referenced by getNoteListHTML(), and updateNote().

1007  {
1008  $ilUser = $this->user;
1009 
1010  if ($a_note->getAuthor() == $ilUser->getId()
1011  && ($ilUser->getId() != ANONYMOUS_USER_ID)) {
1012  return true;
1013  }
1014  return false;
1015  }
const ANONYMOUS_USER_ID
Definition: constants.php:25
$ilUser
Definition: imgupload.php:18
+ Here is the caller graph for this function:

◆ confirmDelete()

ilNoteGUI::confirmDelete ( )

cancel deletion of note

Definition at line 1508 of file class.ilNoteGUI.php.

References $_POST, $ctrl, $ilUser, $lng, $user, and checkDeletion().

1509  {
1510  $ilCtrl = $this->ctrl;
1511  $lng = $this->lng;
1512  $ilUser = $this->user;
1513 
1514  $cnt = 0;
1515  foreach ($_POST["note"] as $id) {
1516  $note = new ilNote($id);
1517  if ($this->checkDeletion($note)) {
1518  $note->delete();
1519  $cnt++;
1520  }
1521  }
1522  if ($cnt > 1) {
1523  $ilCtrl->setParameter($this, "note_mess", "ntsdel");
1524  } else {
1525  $ilCtrl->setParameter($this, "note_mess", "ntdel");
1526  }
1527  $ilCtrl->redirect($this, "showNotes", "notes_top", $this->ajax);
1528  }
checkDeletion($a_note)
Check whether deletion is allowed.
Note class.
$ilUser
Definition: imgupload.php:18
$_POST["username"]
+ Here is the call graph for this function:

◆ deactivateComments()

ilNoteGUI::deactivateComments ( )

Deactivate Comments.

Definition at line 494 of file class.ilNoteGUI.php.

References $ctrl, and ilNote\activateComments().

495  {
496  $ilCtrl = $this->ctrl;
497 
498  if ($this->comments_settings) {
499  ilNote::activateComments($this->rep_obj_id, $this->obj_id, $this->obj_type, false);
500  }
501 
502  $ilCtrl->redirectByClass("ilnotegui", "showNotes", "", $this->ajax);
503  }
static activateComments($a_rep_obj_id, $a_obj_id, $a_obj_type, $a_activate=true)
Activate notes feature.
+ Here is the call graph for this function:

◆ deleteNote()

ilNoteGUI::deleteNote ( )

delete note confirmation

Definition at line 1473 of file class.ilNoteGUI.php.

References getNotesHTML().

1474  {
1475  $this->delete_note = true;
1476  $this->note_mess = "qdel";
1477  return $this->getNotesHTML();
1478  }
getNotesHTML($a_init_form=true)
+ Here is the call graph for this function:

◆ deleteNotes()

ilNoteGUI::deleteNotes ( )

delete notes confirmation

Definition at line 1483 of file class.ilNoteGUI.php.

References $_POST, $lng, and getNotesHTML().

1484  {
1485  $lng = $this->lng;
1486 
1487  if (!$_POST["note"]) {
1488  $this->note_mess = "noc";
1489  } else {
1490  $this->delete_note = true;
1491  $this->note_mess = "qdel";
1492  }
1493 
1494  return $this->getNotesHTML();
1495  }
getNotesHTML($a_init_form=true)
$_POST["username"]
+ Here is the call graph for this function:

◆ editNoteForm()

ilNoteGUI::editNoteForm (   $a_init_form = true)

get notes list including add note area

Definition at line 1463 of file class.ilNoteGUI.php.

References getNotesHTML().

Referenced by updateNote().

1464  {
1465  $this->edit_note_form = true;
1466 
1467  return $this->getNotesHTML($a_init_form);
1468  }
getNotesHTML($a_init_form=true)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ enableAnchorJump()

ilNoteGUI::enableAnchorJump (   $a_enable = true)

enable anchor for form jump

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

310  {
311  $this->anchor_jump = $a_enable;
312  }

◆ enableCommentsSettings()

ilNoteGUI::enableCommentsSettings (   $a_enable = true)

enable private notes

Definition at line 269 of file class.ilNoteGUI.php.

270  {
271  $this->comments_settings = $a_enable;
272  }

◆ enableHiding()

ilNoteGUI::enableHiding (   $a_enable = true)

enable hiding

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

286  {
287  $this->enable_hiding = $a_enable;
288  }

◆ enableMultiSelection()

ilNoteGUI::enableMultiSelection (   $a_enable = true)

enable multi selection (checkboxes and commands)

Definition at line 301 of file class.ilNoteGUI.php.

302  {
303  $this->multi_selection = $a_enable;
304  }

◆ enablePrivateNotes()

ilNoteGUI::enablePrivateNotes (   $a_enable = true)

enable private notes

Definition at line 253 of file class.ilNoteGUI.php.

Referenced by ilPageObjectGUI\getNotesHTML(), and ilPDNotesGUI\view().

254  {
255  $this->private_enabled = $a_enable;
256  }
+ Here is the caller graph for this function:

◆ enablePublicNotes()

ilNoteGUI::enablePublicNotes (   $a_enable = true)

enable public notes

Definition at line 261 of file class.ilNoteGUI.php.

Referenced by ilAssQuestionPreviewGUI\executeCommand(), assQuestionGUI\getNotesHTML(), and ilInfoScreenGUI\showNotesSection().

262  {
263  $this->public_enabled = $a_enable;
264  }
+ Here is the caller graph for this function:

◆ enablePublicNotesDeletion()

ilNoteGUI::enablePublicNotesDeletion (   $a_enable = true)

enable public notes

Definition at line 277 of file class.ilNoteGUI.php.

Referenced by ilLMPresentationGUI\ilLMNotes().

278  {
279  $this->public_deletion_enabled = $a_enable;
280  }
+ Here is the caller graph for this function:

◆ enableTargets()

ilNoteGUI::enableTargets (   $a_enable = true)

enable target objects

Definition at line 293 of file class.ilNoteGUI.php.

294  {
295  $this->targets_enabled = $a_enable;
296  }

◆ executeCommand()

ilNoteGUI::executeCommand ( )

execute command

Definition at line 238 of file class.ilNoteGUI.php.

References getDefaultCommand().

239  {
240  $cmd = $this->ctrl->getCmd($this->getDefaultCommand());
241  $next_class = $this->ctrl->getNextClass($this);
242 
243  switch ($next_class) {
244  default:
245  return $this->$cmd();
246  break;
247  }
248  }
getDefaultCommand()
Get default command.
+ Here is the call graph for this function:

◆ exportNotesHTML()

ilNoteGUI::exportNotesHTML ( )

export selected notes to html

Definition at line 1533 of file class.ilNoteGUI.php.

References $tpl, ilUtil\deliverData(), and getNotesHTML().

1534  {
1535  $tpl = new ilGlobalTemplate("tpl.main.html", true, true);
1536 
1537  $this->export_html = true;
1538  $this->multi_selection = false;
1539  $tpl->setVariable("CONTENT", $this->getNotesHTML());
1540  ilUtil::deliverData($tpl->get(), "notes.html");
1541  }
getNotesHTML($a_init_form=true)
static deliverData($a_data, $a_filename, $mime="application/octet-stream", $charset="")
deliver data for download via browser.
special template class to simplify handling of ITX/PEAR
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41
+ Here is the call graph for this function:

◆ getCommentsWidget()

ilNoteGUI::getCommentsWidget ( )
protected

Get widget.

Parameters

Definition at line 1802 of file class.ilNoteGUI.php.

References $_GET, Vendor\Package\$b, $c, $ctrl, Vendor\Package\$f, $lng, $tpl, ilNote\_countNotesAndComments(), ilObject\_lookupType(), ilCommonActionDispatcherGUI\buildAjaxHash(), getNoteListHTML(), IL_NOTE_PUBLIC, ilCommonActionDispatcherGUI\TYPE_REPOSITORY, ui(), and ILIAS\UI\Implementation\Component\withAdditionalOnLoadCode().

Referenced by getHTML(), and updateWidget().

1803  {
1804  $f = $this->ui->factory();
1805  $r = $this->ui->renderer();
1806 
1807  $lng = $this->lng;
1808  $ctrl = $this->ctrl;
1809  $ctrl->setParameter($this, "news_id", $this->news_id);
1812  null,
1813  ilObject::_lookupType($this->rep_obj_id),
1814  $this->rep_obj_id,
1815  $this->obj_type,
1816  $this->obj_id,
1817  $this->news_id
1818  );
1819 
1820  $cnt = ilNote::_countNotesAndComments($this->rep_obj_id, $this->obj_id, $this->obj_type, $this->news_id);
1821  $cnt = $cnt[$this->rep_obj_id][IL_NOTE_PUBLIC];
1822 
1823  $tpl = new ilTemplate("tpl.note_widget_header.html", true, true, "Services/Notes");
1824  $widget_el_id = "notew_" . str_replace(";", "_", $hash);
1825  $ctrl->setParameter($this, "hash", $hash);
1826  $update_url = $ctrl->getLinkTarget($this, "updateWidget", "", true, false);
1827  $comps = array();
1828  if ($cnt > 0) {
1829  $c = $f->counter()->status((int) $cnt);
1830  $comps[] = $f->symbol()->glyph()->comment()->withCounter($c)->withAdditionalOnLoadCode(function ($id) use ($hash, $update_url, $widget_el_id) {
1831  return "$(\"#$id\").click(function(event) { " . self::getListCommentsJSCall($hash, "ilNotes.updateWidget(\"" . $widget_el_id . "\",\"" . $update_url . "\");") . "});";
1832  });
1833  $comps[] = $f->divider()->vertical();
1834  $tpl->setVariable("GLYPH", $r->render($comps));
1835  $tpl->setVariable("TXT_LATEST", $lng->txt("notes_latest_comment"));
1836  }
1837 
1838 
1839  $b = $f->button()->shy($lng->txt("notes_add_edit_comment"), "#")->withAdditionalOnLoadCode(function ($id) use ($hash,$update_url,$widget_el_id) {
1840  return "$(\"#$id\").click(function(event) { " . self::getListCommentsJSCall($hash, "ilNotes.updateWidget(\"" . $widget_el_id . "\",\"" . $update_url . "\");") . "});";
1841  });
1842  if ($ctrl->isAsynch()) {
1843  $tpl->setVariable("SHY_BUTTON", $r->renderAsync($b));
1844  } else {
1845  $tpl->setVariable("SHY_BUTTON", $r->render($b));
1846  }
1847 
1848  $this->widget_header = $tpl->get();
1849 
1850  $this->hide_new_form = true;
1851  $this->only_latest = true;
1852  $this->no_actions = true;
1853  $html = "<div id='" . $widget_el_id . "'>" . $this->getNoteListHTML(IL_NOTE_PUBLIC) . "</div>";
1854  $ctrl->setParameter($this, "news_id", $_GET["news_id"]);
1855  return $html;
1856  }
getNoteListHTML($a_type=IL_NOTE_PRIVATE, $a_init_form=true)
get notes/comments list as html code
$c
Definition: cli.php:37
$_GET["client_id"]
static _countNotesAndComments( $a_rep_obj_id, $a_sub_obj_id=null, $a_obj_type="", $a_news_id=0)
Get all notes related to a specific object.
const IL_NOTE_PUBLIC
Definition: class.ilNote.php:6
ui()
Definition: ui.php:5
static buildAjaxHash( $a_node_type, $a_node_id, $a_obj_type, $a_obj_id, $a_sub_type=null, $a_sub_id=null, $a_news_id=0)
Build ajax hash.
static _lookupType($a_id, $a_reference=false)
lookup object type
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDefaultCommand()

ilNoteGUI::getDefaultCommand ( )

Get default command.

Returns
string default command

Definition at line 230 of file class.ilNoteGUI.php.

References $default_command.

Referenced by executeCommand().

231  {
232  return $this->default_command;
233  }
+ Here is the caller graph for this function:

◆ getHTML()

ilNoteGUI::getHTML ( )

Get HTML.

Parameters

Definition at line 1790 of file class.ilNoteGUI.php.

References getCommentsWidget().

1791  {
1792  return $this->getCommentsWidget();
1793  }
getCommentsWidget()
Get widget.
+ Here is the call graph for this function:

◆ getListCommentsJSCall()

static ilNoteGUI::getListCommentsJSCall (   $a_hash,
  $a_update_code = null 
)
static

Get list comments js call.

Parameters
string$a_hash
string$a_update_code
Returns
string

Definition at line 1666 of file class.ilNoteGUI.php.

Referenced by ilObjectListGUI\determineProperties(), ilDclRecordListTableGUI\getCommentsAjaxLink(), ilQuestionBrowserTableGUI\getCommentsAjaxLink(), ilObjectListGUI\getHeaderAction(), ilDclBaseRecordModel\getStandardFieldHTML(), and ilObjectListGUI\insertCommonSocialCommands().

1667  {
1668  if ($a_update_code === null) {
1669  $a_update_code = "null";
1670  } else {
1671  $a_update_code = "'" . $a_update_code . "'";
1672  }
1673 
1674  return "ilNotes.listComments(event, '" . $a_hash . "', " . $a_update_code . ");";
1675  }
+ Here is the caller graph for this function:

◆ getListNotesJSCall()

static ilNoteGUI::getListNotesJSCall (   $a_hash,
  $a_update_code = null 
)
static

Get list notes js call.

Parameters
string$a_hash
string$a_update_code
Returns
string

Definition at line 1648 of file class.ilNoteGUI.php.

Referenced by ilObjectListGUI\determineProperties(), ilObjectListGUI\getHeaderAction(), and ilObjectListGUI\insertCommonSocialCommands().

1649  {
1650  if ($a_update_code === null) {
1651  $a_update_code = "null";
1652  } else {
1653  $a_update_code = "'" . $a_update_code . "'";
1654  }
1655 
1656  return "ilNotes.listNotes(event, '" . $a_hash . "', " . $a_update_code . ");";
1657  }
+ Here is the caller graph for this function:

◆ getNoteListHTML()

ilNoteGUI::getNoteListHTML (   $a_type = IL_NOTE_PRIVATE,
  $a_init_form = true 
)

get notes/comments list as html code

Definition at line 508 of file class.ilNoteGUI.php.

References $_GET, $_POST, $_SESSION, $ctrl, $hide_new_form, $ilUser, $img, $lng, $only_latest, $tpl, $txt, $user, $user_img_export_html, ilObject\_exists(), ilObject\_getIcon(), ilNote\_getNotesOfObject(), ilObjUser\_getPersonalPicturePath(), ilObjUser\_lookupLogin(), ilContainerReference\_lookupTitle(), ilObject\_lookupTitle(), ANONYMOUS_USER_ID, checkDeletion(), checkEdit(), ilGlyphGUI\CLOSE, ilDatePresentation\formatDate(), ilGlyphGUI\get(), ilUtil\getImagePath(), ilUserUtil\getNamePresentation(), getSubObjectTitle(), ilUtil\getSystemMessageHTML(), IL_CAL_DATETIME, IL_NOTE_PRIVATE, IL_NOTE_PUBLIC, ilUtil\img(), initNoteForm(), renderLink(), renderTargets(), ilDatePresentation\setUseRelativeDates(), and ilDatePresentation\useRelativeDates().

Referenced by getCommentsWidget(), and getNotesHTML().

509  {
510  $lng = $this->lng;
511  $ilCtrl = $this->ctrl;
513 
514  include_once("./Services/User/classes/class.ilUserUtil.php");
515 
516  $suffix = ($a_type == IL_NOTE_PRIVATE)
517  ? "private"
518  : "public";
519 
520  $user_setting_notes_public_all = "y";
521  $user_setting_notes_by_type = "y";
522 
523  if ($this->delete_note || $this->export_html || $this->print) {
524  if ($_GET["note_id"] != "") {
525  $filter = $_GET["note_id"];
526  } else {
527  $filter = $_POST["note"];
528  }
529  }
530 
531  $order = (bool) $_SESSION["comments_sort_asc"];
532  if ($this->only_latest) {
533  $order = false;
534  }
535 
536 
537  $notes = ilNote::_getNotesOfObject(
538  $this->rep_obj_id,
539  $this->obj_id,
540  $this->obj_type,
541  $a_type,
542  $this->inc_sub,
543  $filter,
544  $user_setting_notes_public_all,
545  $this->repository_mode,
546  $order,
547  $this->news_id
548  );
549 
550  $tpl = new ilTemplate("tpl.notes_list.html", true, true, "Services/Notes");
551 
552  if ($this->ajax) {
553  include_once("./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php");
554  $tpl->setCurrentBlock("close_img");
555  $tpl->setVariable("CLOSE_IMG", ilGlyphGUI::get(ilGlyphGUI::CLOSE));
556  $tpl->parseCurrentBlock();
557  }
558 
559  // show counter if notes are hidden
560  $cnt_str = (count($notes) > 0)
561  ? " (" . count($notes) . ")"
562  : "";
563 
564  // title
565  if ($ilCtrl->isAsynch() && !$this->only_latest) {
566  switch ($this->obj_type) {
567  case "grpr":
568  case "catr":
569  case "crsr":
570  include_once "Services/ContainerReference/classes/class.ilContainerReference.php";
571  $title = ilContainerReference::_lookupTitle($this->rep_obj_id);
572  break;
573 
574  default:
575  $title = ilObject::_lookupTitle($this->rep_obj_id);
576  break;
577  }
578 
579  $img = ilUtil::img(ilObject::_getIcon($this->rep_obj_id, "tiny"));
580 
581  // add sub-object if given
582  if ($this->obj_id) {
583  $sub_title = $this->getSubObjectTitle($this->rep_obj_id, $this->obj_id);
584  if ($sub_title) {
585  $title .= " - " . $sub_title;
586  }
587  }
588 
589  $tpl->setCurrentBlock("title");
590  $tpl->setVariable("TITLE", $img . " " . $title);
591  $tpl->parseCurrentBlock();
592  }
593 
594  if ($this->delete_note) {
595  $cnt_str = "";
596  }
597  if ($a_type == IL_NOTE_PRIVATE) {
598  $tpl->setVariable("TXT_NOTES", $lng->txt("private_notes") . $cnt_str);
599  $ilCtrl->setParameterByClass("ilnotegui", "note_type", IL_NOTE_PRIVATE);
600  } else {
601  $tpl->setVariable("TXT_NOTES", $lng->txt("notes_public_comments") . $cnt_str);
602  $ilCtrl->setParameterByClass("ilnotegui", "note_type", IL_NOTE_PUBLIC);
603  }
604  $anch = $this->anchor_jump
605  ? "notes_top"
606  : "";
607  if (!$this->only_latest && !$this->hide_new_form) {
608  $tpl->setVariable("FORMACTION", $ilCtrl->getFormAction($this, "getNotesHTML", $anch));
609  if ($this->ajax) {
610  $os = "onsubmit = \"ilNotes.cmdAjaxForm(event, '" .
611  $ilCtrl->getFormActionByClass("ilnotegui", "", "", true) .
612  "'); return false;\"";
613  $tpl->setVariable("ON_SUBMIT_FORM", $os);
614  /*if ($a_type == IL_NOTE_PRIVATE) {
615  $tpl->setVariable("FORM_ID", "id='ilNoteFormAjax'");
616  } else {
617  $tpl->setVariable("FORM_ID", "id='ilCommentFormAjax'");
618  }*/
619  }
620  }
621 
622 
623  if ($this->export_html || $this->print) {
624  $tpl->touchBlock("print_style");
625  }
626 
627  // show add new note button
628  /*
629  if (!$this->add_note_form && !$this->edit_note_form && !$this->delete_note &&
630  !$this->export_html && !$this->print && $ilUser->getId() != ANONYMOUS_USER_ID && !$this->hide_new_form) {
631  if (!$this->inc_sub) { // we cannot offer add button if aggregated notes
632  // are displayed
633  if ($this->rep_obj_id > 0 || $a_type != IL_NOTE_PUBLIC) {
634  $tpl->setCurrentBlock("add_note_btn");
635  if ($a_type == IL_NOTE_PUBLIC) {
636  $tpl->setVariable("TXT_ADD_NOTE", $lng->txt("notes_add_comment"));
637  } else {
638  $tpl->setVariable("TXT_ADD_NOTE", $lng->txt("add_note"));
639  }
640  $tpl->setVariable("LINK_ADD_NOTE", $ilCtrl->getLinkTargetByClass("ilnotegui", "addNoteForm") .
641  "#note_edit");
642  $tpl->parseCurrentBlock();
643  }
644  }
645  }*/
646 
647  // show show/hide button for note list
648  if (count($notes) > 0 && $this->enable_hiding && !$this->delete_note
649  && !$this->export_html && !$this->print && !$this->edit_note_form
650  && !$this->add_note_form) {
651  if ($user_setting_notes_by_type == "n") {
652  if ($a_type == IL_NOTE_PUBLIC) {
653  $txt = $lng->txt("notes_show_comments");
654  } else {
655  $txt = $lng->txt("show_" . $suffix . "_notes");
656  }
657  $this->renderLink($tpl, "show_notes", $txt, "showNotes", "notes_top");
658  } else {
659  // never individually hide for anonymous users
660  if (($ilUser->getId() != ANONYMOUS_USER_ID)) {
661  if ($a_type == IL_NOTE_PUBLIC) {
662  $txt = $lng->txt("notes_hide_comments");
663  } else {
664  $txt = $lng->txt("hide_" . $suffix . "_notes");
665  }
666  $this->renderLink($tpl, "hide_notes", $txt, "hideNotes", "notes_top");
667 
668  // show all public notes / my notes only switch
669  if ($a_type == IL_NOTE_PUBLIC) {
670  if ($user_setting_notes_public_all == "n") {
671  $this->renderLink(
672  $tpl,
673  "all_pub_notes",
674  $lng->txt("notes_all_comments"),
675  "showAllPublicNotes",
676  "notes_top"
677  );
678  } else {
679  $this->renderLink(
680  $tpl,
681  "my_pub_notes",
682  $lng->txt("notes_my_comments"),
683  "showMyPublicNotes",
684  "notes_top"
685  );
686  }
687  }
688  }
689  }
690  }
691 
692  // show add new note text area
693  if (!$this->edit_note_form && $user_setting_notes_by_type != "n" &&
694  !$this->delete_note && $ilUser->getId() != ANONYMOUS_USER_ID && !$this->hide_new_form) {
695  if ($a_init_form) {
696  $this->initNoteForm("create", $a_type);
697  }
698 
699  $tpl->setCurrentBlock("edit_note_form");
700  // $tpl->setVariable("EDIT_FORM", $this->form->getHTML());
701  $tpl->setVariable("EDIT_FORM", $this->form_tpl->get());
702  $tpl->parseCurrentBlock();
703 
704  $tpl->parseCurrentBlock();
705  $tpl->setCurrentBlock("note_row");
706  $tpl->parseCurrentBlock();
707  }
708 
709  // list all notes
710  if ($user_setting_notes_by_type != "n" || !$this->enable_hiding) {
713 
714  if (sizeof($notes) && !$this->only_latest && $this->enable_sorting) {
715  if ((int) $_SESSION["comments_sort_asc"] == 1) {
716  $sort_txt = $lng->txt("notes_sort_desc");
717  $sort_cmd = "listSortDesc";
718  } else {
719  $sort_txt = $lng->txt("notes_sort_asc");
720  $sort_cmd = "listSortAsc";
721  }
722  $this->renderLink($tpl, "sort_list", $sort_txt, $sort_cmd, $anch);
723  }
724 
725  $notes_given = false;
726  foreach ($notes as $note) {
727  if ($this->only_latest && $notes_given) {
728  continue;
729  }
730 
731 
732  if ($this->edit_note_form && ($note->getId() == $_GET["note_id"])
733  && $a_type == $_GET["note_type"]) {
734  if ($a_init_form) {
735  $this->initNoteForm("edit", $a_type, $note);
736  }
737  $tpl->setCurrentBlock("edit_note_form");
738  // $tpl->setVariable("EDIT_FORM", $this->form->getHTML());
739  $tpl->setVariable("EDIT_FORM", $this->form_tpl->get());
740  $tpl->parseCurrentBlock();
741  } else {
742  $cnt_col = 2;
743 
744  // delete note stuff for all private notes
745  if ($this->checkDeletion($note)
746  && !$this->delete_note
747  && !$this->export_html && !$this->print
748  && !$this->edit_note_form && !$this->add_note_form && !$this->no_actions) {
749  $ilCtrl->setParameterByClass("ilnotegui", "note_id", $note->getId());
750  $this->renderLink(
751  $tpl,
752  "delete_note",
753  $lng->txt("delete"),
754  "deleteNote",
755  "note_" . $note->getId()
756  );
757  }
758 
759  // checkboxes in multiselection mode
760  if ($this->multi_selection && !$this->delete_note) {
761  $tpl->setVariable("CHECKBOX_CLASS", "ilNotesCheckboxes");
762  $tpl->setCurrentBlock("checkbox_col");
763  $tpl->setVariable("CHK_NOTE", "note[]");
764  $tpl->setVariable("CHK_NOTE_ID", $note->getId());
765  $tpl->parseCurrentBlock();
766  $cnt_col = 1;
767  }
768 
769  // edit note stuff for all private notes
770  if ($this->checkEdit($note)) {
771  if (!$this->delete_note && !$this->export_html && !$this->print
772  && !$this->edit_note_form && !$this->add_note_form && !$this->no_actions) {
773  $ilCtrl->setParameterByClass("ilnotegui", "note_id", $note->getId());
774  $this->renderLink(
775  $tpl,
776  "edit_note",
777  $lng->txt("edit"),
778  "editNoteForm",
779  "note_edit"
780  );
781  }
782  }
783 
784  $tpl->setVariable("CNT_COL", $cnt_col);
785 
786  // output author account
787  if ($a_type == IL_NOTE_PUBLIC && ilObject::_exists($note->getAuthor())) {
788  //$tpl->setCurrentBlock("author");
789  //$tpl->setVariable("VAL_AUTHOR", ilObjUser::_lookupLogin($note->getAuthor()));
790  //$tpl->parseCurrentBlock();
791  $tpl->setCurrentBlock("user_img");
792  $tpl->setVariable(
793  "USR_IMG",
794  ilObjUser::_getPersonalPicturePath($note->getAuthor(), "xsmall", false, false, $this->user_img_export_html)
795  );
796  $tpl->setVariable("USR_ALT", $lng->txt("user_image") . ": " .
797  ilObjUser::_lookupLogin($note->getAuthor()));
798  $tpl->parseCurrentBlock();
799  $tpl->setVariable(
800  "TXT_USR",
801  ilUserUtil::getNamePresentation($note->getAuthor(), false, false) . " - "
802  );
803  }
804 
805  // last edited
806  if ($note->getUpdateDate() != null) {
807  $tpl->setVariable("TXT_LAST_EDIT", $lng->txt("last_edited_on"));
808  $tpl->setVariable(
809  "DATE_LAST_EDIT",
810  ilDatePresentation::formatDate(new ilDate($note->getUpdateDate(), IL_CAL_DATETIME))
811  );
812  } else {
813  $tpl->setVariable(
814  "VAL_DATE",
815  ilDatePresentation::formatDate(new ilDate($note->getCreationDate(), IL_CAL_DATETIME))
816  );
817  }
818 
819  // hidden note ids for deletion
820  if ($this->delete_note) {
821  $tpl->setCurrentBlock("delete_ids");
822  $tpl->setVariable("HID_NOTE", "note[]");
823  $tpl->setVariable("HID_NOTE_ID", $note->getId());
824  $tpl->parseCurrentBlock();
825  }
826  $target = $note->getObject();
827 
828 
829  $tpl->setCurrentBlock("note");
830  $text = (trim($note->getText()) != "")
831  ? nl2br($note->getText())
832  : "<p class='subtitle'>" . $lng->txt("note_content_removed") . "</p>";
833  $tpl->setVariable("NOTE_TEXT", $text);
834  $tpl->setVariable("VAL_SUBJECT", $note->getSubject());
835  $tpl->setVariable("NOTE_ID", $note->getId());
836 
837  // target objects
838  $tpl->setVariable(
839  "TARGET_OBJECTS",
840  $this->renderTargets($note)
841  );
842 
843  $tpl->parseCurrentBlock();
844  }
845  $tpl->setCurrentBlock("note_row");
846  $tpl->parseCurrentBlock();
847  $notes_given = true;
848  }
849 
850  if (!$notes_given) {
851  $tpl->setCurrentBlock("no_notes");
852  if ($a_type == IL_NOTE_PUBLIC && !$this->only_latest) {
853  $tpl->setVariable("NO_NOTES", $lng->txt("notes_no_comments"));
854  }
855  $tpl->parseCurrentBlock();
856  }
857 
859 
860  // multiple items commands
861  if ($this->multi_selection && !$this->delete_note && !$this->edit_note_form
862  && count($notes) > 0) {
863  if ($a_type == IL_NOTE_PRIVATE) {
864  $tpl->setCurrentBlock("delete_cmd");
865  $tpl->setVariable("TXT_DELETE_NOTES", $this->lng->txt("delete"));
866  $tpl->parseCurrentBlock();
867  }
868 
869  $tpl->setCurrentBlock("multiple_commands");
870  $tpl->setVariable("TXT_SELECT_ALL", $this->lng->txt("select_all"));
871  $tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.svg"));
872  $tpl->setVariable("ALT_ARROW", $this->lng->txt("actions"));
873  $tpl->setVariable("TXT_PRINT_NOTES", $this->lng->txt("print"));
874  $tpl->setVariable("TXT_EXPORT_NOTES", $this->lng->txt("exp_html"));
875  $tpl->parseCurrentBlock();
876  }
877 
878  // delete / cancel row
879  if ($this->delete_note) {
880  $tpl->setCurrentBlock("delete_cancel");
881  $tpl->setVariable("TXT_DEL_NOTES", $this->lng->txt("delete"));
882  $tpl->setVariable("TXT_CANCEL_DEL_NOTES", $this->lng->txt("cancel"));
883  $tpl->parseCurrentBlock();
884  }
885 
886  // print
887  if ($this->print) {
888  $tpl->touchBlock("print_js");
889  $tpl->setCurrentBlock("print_back");
890  $tpl->setVariable("LINK_BACK", $this->ctrl->getLinkTarget($this, "showNotes"));
891  $tpl->setVariable("TXT_BACK", $this->lng->txt("back"));
892  $tpl->parseCurrentBlock();
893  }
894  }
895 
896  // message
897  switch ($_GET["note_mess"] != "" ? $_GET["note_mess"] : $this->note_mess) {
898  case "mod":
899  $mtype = "success";
900  $mtxt = $lng->txt("msg_obj_modified");
901  break;
902 
903  case "ntsdel":
904  $mtype = "success";
905  $mtxt = ($a_type == IL_NOTE_PRIVATE)
906  ? $lng->txt("notes_notes_deleted")
907  : $lng->txt("notes_comments_deleted");
908  break;
909 
910  case "ntdel":
911  $mtype = "success";
912  $mtxt = ($a_type == IL_NOTE_PRIVATE)
913  ? $lng->txt("notes_note_deleted")
914  : $lng->txt("notes_comment_deleted");
915  break;
916 
917  case "frmfld":
918  $mtype = "failure";
919  $mtxt = $lng->txt("form_input_not_valid");
920  break;
921 
922  case "qdel":
923  $mtype = "question";
924  $mtxt = $lng->txt("info_delete_sure");
925  break;
926 
927  case "noc":
928  $mtype = "failure";
929  $mtxt = $lng->txt("no_checkbox");
930  break;
931  }
932  if ($mtxt != "") {
933  $tpl->setVariable("MESS", ilUtil::getSystemMessageHTML($mtxt, $mtype));
934  } else {
935  $tpl->setVariable("MESS", "");
936  }
937 
938  if ($this->widget_header != "") {
939  $tpl->setVariable("WIDGET_HEADER", $this->widget_header);
940  }
941 
942 
943  if ($this->delete_note && count($notes) == 0) {
944  return "";
945  } else {
946  return $tpl->get();
947  }
948  }
static _lookupLogin($a_user_id)
lookup login
static _getIcon( $a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
Get icon for repository item.
checkDeletion($a_note)
Check whether deletion is allowed.
initNoteForm($a_mode="edit", $a_type, $a_note=null)
Init note form.
const IL_NOTE_PRIVATE
Definition: class.ilNote.php:5
const IL_CAL_DATETIME
const ANONYMOUS_USER_ID
Definition: constants.php:25
$_SESSION["AccountId"]
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data
$_GET["client_id"]
static getSystemMessageHTML($a_txt, $a_type="info")
Get HTML for a system message.
static get($a_glyph, $a_text="")
Get glyph html.
renderLink($a_tpl, $a_var, $a_txt, $a_cmd, $a_anchor="")
Render a link.
static setUseRelativeDates($a_status)
set use relative dates
static _lookupTitle($a_id)
lookup object title
static _getNotesOfObject( $a_rep_obj_id, $a_obj_id, $a_obj_type, $a_type=IL_NOTE_PRIVATE, $a_incl_sub=false, $a_filter="", $a_all_public="y", $a_repository_mode=true, $a_sort_ascending=false, $a_news_id=0)
get all notes related to a specific object
checkEdit($a_note)
Check edit.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
static useRelativeDates()
check if relative dates are used
getSubObjectTitle($parent_obj_id, $sub_obj_id)
Get sub object title if available with callback.
Class for single dates.
static _lookupTitle($a_obj_id)
Overwitten from base class.
const IL_NOTE_PUBLIC
Definition: class.ilNote.php:6
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static _getPersonalPicturePath( $a_usr_id, $a_size="small", $a_force_pic=false, $a_prevent_no_photo_image=false, $html_export=false)
Get path to personal picture.
static getNamePresentation( $a_user_id, $a_user_image=false, $a_profile_link=false, $a_profile_back_link="", $a_force_first_lastname=false, $a_omit_login=false, $a_sortable=true, $a_return_data_array=false, $a_ctrl_path="ilpublicuserprofilegui")
Default behaviour is:
$txt
Definition: error.php:13
static img($a_src, $a_alt=null, $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
$img
Definition: imgupload.php:57
renderTargets($a_note)
show related objects as links
$ilUser
Definition: imgupload.php:18
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41
$_POST["username"]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getNotesHTML()

ilNoteGUI::getNotesHTML (   $a_init_form = true)

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

References $_GET, $ctrl, $ilSetting, $ilUser, $lng, $settings, $user, ANONYMOUS_USER_ID, ilNote\commentsActivated(), exit, getNoteListHTML(), ilUtil\getSystemMessageHTML(), IL_NOTE_PRIVATE, IL_NOTE_PUBLIC, and renderLink().

Referenced by addNoteForm(), cancelAddNote(), cancelDelete(), cancelUpdateNote(), deleteNote(), deleteNotes(), editNoteForm(), exportNotesHTML(), getOnlyCommentsHTML(), getOnlyNotesHTML(), hideNotes(), printNotes(), showAllPublicNotes(), showMyPublicNotes(), and showNotes().

358  {
360  $lng = $this->lng;
361  $ilCtrl = $this->ctrl;
363 
364  $lng->loadLanguageModule("notes");
365 
366  $ntpl = new ilTemplate(
367  "tpl.notes_and_comments.html",
368  true,
369  true,
370  "Services/Notes"
371  );
372 
373  // check, whether column is hidden due to processing in other column
374  $hide_comments = ($this->only == "notes");
375  $hide_notes = ($this->only == "comments");
376  switch ($ilCtrl->getCmd()) {
377  case "addNoteForm":
378  case "editNoteForm":
379  case "addNote":
380  case "updateNote":
381  if ($_GET["note_type"] == IL_NOTE_PRIVATE) {
382  $hide_comments = true;
383  }
384  if ($_GET["note_type"] == IL_NOTE_PUBLIC) {
385  $hide_notes = true;
386  }
387  break;
388  }
389 
390 
391  // temp workaround: only show comments (if both have been activated)
392  if ($this->private_enabled && $this->public_enabled
393  && $this->only != "notes") {
394  $this->private_enabled = false;
395  }
396 
397  if (!$ilCtrl->isAsynch()) {
398  $ntpl->setVariable("OUTER_ID", " id='notes_embedded_outer' ");
399  }
400 
401  $nodes_col = false;
402  if ($this->private_enabled && ($ilUser->getId() != ANONYMOUS_USER_ID)
403  && !$hide_notes) {
404  $ntpl->setCurrentBlock("notes_col");
405  $ntpl->setVariable("NOTES", $this->getNoteListHTML(IL_NOTE_PRIVATE, $a_init_form));
406  $ntpl->parseCurrentBlock();
407  $nodes_col = true;
408  }
409 
410  // #15948 - public enabled vs. comments_settings
411  $comments_col = false;
412  if ($this->public_enabled && (!$this->delete_note || $this->public_deletion_enabled || $ilSetting->get("comments_del_user", 0))
413  && !$hide_comments /* && $ilUser->getId() != ANONYMOUS_USER_ID */) {
414  $ntpl->setVariable("COMMENTS", $this->getNoteListHTML(IL_NOTE_PUBLIC, $a_init_form));
415  $comments_col = true;
416  }
417 
418  // Comments Settings
419  if ($this->comments_settings && !$hide_comments && !$this->delete_note
420  && !$this->edit_note_form && !$this->add_note_form && $ilUser->getId() != ANONYMOUS_USER_ID) {
421  //$active = $notes_settings->get("activate_".$id);
422  $active = ilNote::commentsActivated($this->rep_obj_id, $this->obj_id, $this->obj_type);
423 
424  if ($active) {
425  if ($this->news_id == 0) {
426  $this->renderLink(
427  $ntpl,
428  "comments_settings",
429  $lng->txt("notes_deactivate_comments"),
430  "deactivateComments",
431  "notes_top"
432  );
433  }
434  $ntpl->setCurrentBlock("comments_settings2");
435  } else {
436  $this->renderLink(
437  $ntpl,
438  "comments_settings",
439  $lng->txt("notes_activate_comments"),
440  "activateComments",
441  "notes_top"
442  );
443  $ntpl->setCurrentBlock("comments_settings2");
444 
445  if ($this->ajax && !$comments_col) {
446  $ntpl->setVariable(
447  "COMMENTS_MESS",
448  ilUtil::getSystemMessageHTML($lng->txt("comments_feature_currently_not_activated_for_object"), "info")
449  );
450  }
451  }
452  $ntpl->parseCurrentBlock();
453 
454  if (!$comments_col) {
455  $ntpl->setVariable("COMMENTS", "");
456  }
457 
458  $comments_col = true;
459  }
460 
461  if ($comments_col) {
462  $ntpl->setCurrentBlock("comments_col");
463  if ($nodes_col) {
464  // $ntpl->touchBlock("comments_style");
465  }
466  $ntpl->parseCurrentBlock();
467  }
468 
469  if ($ilCtrl->isAsynch()) {
470  echo $ntpl->get();
471  exit;
472  }
473 
474  return $ntpl->get();
475  }
getNoteListHTML($a_type=IL_NOTE_PRIVATE, $a_init_form=true)
get notes/comments list as html code
exit
Definition: login.php:29
static commentsActivated($a_rep_obj_id, $a_obj_id, $a_obj_type, $a_news_id=0)
Are comments activated for object?
const IL_NOTE_PRIVATE
Definition: class.ilNote.php:5
const ANONYMOUS_USER_ID
Definition: constants.php:25
$_GET["client_id"]
static getSystemMessageHTML($a_txt, $a_type="info")
Get HTML for a system message.
renderLink($a_tpl, $a_var, $a_txt, $a_cmd, $a_anchor="")
Render a link.
const IL_NOTE_PUBLIC
Definition: class.ilNote.php:6
global $ilSetting
Definition: privfeed.php:17
$ilUser
Definition: imgupload.php:18
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getOnlyCommentsHTML()

ilNoteGUI::getOnlyCommentsHTML ( )

Get only comments html.

Parameters

Definition at line 345 of file class.ilNoteGUI.php.

References $ctrl, and getNotesHTML().

346  {
347  $ilCtrl = $this->ctrl;
348  $ilCtrl->setParameter($this, "notes_only", "comments");
349  $this->only = "comments";
350  return $this->getNotesHTML($a_init_form = true);
351  }
getNotesHTML($a_init_form=true)
+ Here is the call graph for this function:

◆ getOnlyNotesHTML()

ilNoteGUI::getOnlyNotesHTML ( )

Get only notes html.

Parameters

Definition at line 331 of file class.ilNoteGUI.php.

References $ctrl, and getNotesHTML().

332  {
333  $ilCtrl = $this->ctrl;
334  $ilCtrl->setParameter($this, "notes_only", "notes");
335  $this->only = "notes";
336  return $this->getNotesHTML($a_init_form = true);
337  }
getNotesHTML($a_init_form=true)
+ Here is the call graph for this function:

◆ getPDNoteHTML()

ilNoteGUI::getPDNoteHTML (   $note_id)

Note display for personal desktop.

Definition at line 1125 of file class.ilNoteGUI.php.

References $ctrl, $ilUser, $lng, $tpl, $user, ilDatePresentation\formatDate(), IL_CAL_DATETIME, and renderTargets().

1126  {
1127  $lng = $this->lng;
1128  $ilCtrl = $this->ctrl;
1129  $ilUser = $this->user;
1130 
1131  $tpl = new ilTemplate("tpl.pd_note.html", true, true, "Services/Notes");
1132  $note = new ilNote($note_id);
1133  $target = $note->getObject();
1134 
1135  if ($note->getAuthor() != $ilUser->getId()) {
1136  return;
1137  }
1138 
1139  $tpl->setCurrentBlock("edit_note");
1140  $ilCtrl->setParameterByClass("ilnotegui", "rel_obj", $target["rep_obj_id"]);
1141  $ilCtrl->setParameterByClass("ilnotegui", "note_id", $note_id);
1142  $ilCtrl->setParameterByClass("ilnotegui", "note_type", $note->getType());
1143  $tpl->setVariable(
1144  "LINK_EDIT_NOTE",
1145  $ilCtrl->getLinkTargetByClass(
1146  array("ildashboardgui", "ilpdnotesgui", "ilnotegui"),
1147  "editNoteForm"
1148  )
1149  );
1150  $tpl->setVariable("TXT_EDIT_NOTE", $lng->txt("edit"));
1151  $tpl->parseCurrentBlock();
1152  $ilCtrl->clearParametersByClass("ilnotegui");
1153 
1154  // last edited
1155  if ($note->getUpdateDate() != null) {
1156  $tpl->setVariable("TXT_LAST_EDIT", $lng->txt("last_edited_on"));
1157  $tpl->setVariable(
1158  "DATE_LAST_EDIT",
1159  ilDatePresentation::formatDate(new ilDate($note->getUpdateDate(), IL_CAL_DATETIME))
1160  );
1161  } else {
1162  //$tpl->setVariable("TXT_CREATED", $lng->txt("create_date"));
1163  $tpl->setVariable(
1164  "VAL_DATE",
1165  ilDatePresentation::formatDate(new ilDate($note->getCreationDate(), IL_CAL_DATETIME))
1166  );
1167  }
1168 
1169  $tpl->setVariable("VAL_SUBJECT", $note->getSubject());
1170  $text = (trim($note->getText()) != "")
1171  ? nl2br($note->getText())
1172  : "<p class='subtitle'>" . $lng->txt("note_content_removed") . "</p>";
1173  $tpl->setVariable("NOTE_TEXT", $text);
1174  $tpl->setVariable("TARGET_OBJECTS", $this->renderTargets($note));
1175  return $tpl->get();
1176  }
const IL_CAL_DATETIME
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
Note class.
Class for single dates.
renderTargets($a_note)
show related objects as links
$ilUser
Definition: imgupload.php:18
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41
+ Here is the call graph for this function:

◆ getSubObjectTitle()

ilNoteGUI::getSubObjectTitle (   $parent_obj_id,
  $sub_obj_id 
)
protected

Get sub object title if available with callback.

Parameters
int$parent_obj_id
int$sub_obj_id
Returns
string

Definition at line 957 of file class.ilNoteGUI.php.

References $ctrl, $obj_definition, and ilObject\_lookupType().

Referenced by getNoteListHTML(), and renderTargets().

958  {
960  $ilCtrl = $this->ctrl;
961 
962  $parent_type = ilObject::_lookupType($parent_obj_id);
963  if ($parent_type == "") {
964  return "";
965  }
966  $parent_class = "ilObj" . $objDefinition->getClassName($parent_type) . "GUI";
967  $parent_path = $ilCtrl->lookupClassPath($parent_class);
968  include_once $parent_path;
969  if (method_exists($parent_class, "lookupSubObjectTitle")) {
970  return call_user_func_array(array($parent_class, "lookupSubObjectTitle"), array($parent_obj_id, $sub_obj_id));
971  }
972  }
static _lookupType($a_id, $a_reference=false)
lookup object type
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hideNotes()

ilNoteGUI::hideNotes ( )

hide notes

Definition at line 1575 of file class.ilNoteGUI.php.

References $_GET, $ilUser, $user, getNotesHTML(), and IL_NOTE_PRIVATE.

1576  {
1577  $ilUser = $this->user;
1578 
1579  $suffix = ($_GET["note_type"] == IL_NOTE_PRIVATE)
1580  ? "private"
1581  : "public";
1582  $ilUser->writePref("notes_" . $suffix, "n");
1583 
1584  return $this->getNotesHTML();
1585  }
getNotesHTML($a_init_form=true)
const IL_NOTE_PRIVATE
Definition: class.ilNote.php:5
$_GET["client_id"]
$ilUser
Definition: imgupload.php:18
+ Here is the call graph for this function:

◆ initJavascript()

static ilNoteGUI::initJavascript (   $a_ajax_url,
  $a_type = IL_NOTE_PRIVATE,
ilGlobalTemplateInterface  $a_main_tpl = null 
)
static

Init javascript.

Definition at line 1614 of file class.ilNoteGUI.php.

References $DIC, $lng, $tpl, iljQueryUtil\initjQuery(), ilModalGUI\initJS(), and ilYuiUtil\initPanel().

Referenced by ilQuestionBrowserTableGUI\__construct(), ilObjPortfolioGUI\executeCommand(), and ilObjectListGUI\prepareJsLinks().

1615  {
1616  global $DIC;
1617 
1618  if ($a_main_tpl != null) {
1619  $tpl = $a_main_tpl;
1620  } else {
1621  $tpl = $DIC["tpl"];
1622  }
1623  $lng = $DIC->language();
1624 
1625  $lng->loadLanguageModule("notes");
1626 
1627  include_once("./Services/UIComponent/Modal/classes/class.ilModalGUI.php");
1629 
1630  $lng->toJs(array("private_notes", "notes_public_comments"), $tpl);
1631 
1632  include_once("./Services/YUI/classes/class.ilYuiUtil.php");
1633  ilYuiUtil::initPanel(false, $tpl);
1634  include_once("./Services/jQuery/classes/class.iljQueryUtil.php");
1636  $tpl->addJavascript("./Services/Notes/js/ilNotes.js");
1637 
1638  $tpl->addOnLoadCode("ilNotes.setAjaxUrl('" . $a_ajax_url . "');");
1639  }
static initJS(ilGlobalTemplateInterface $a_main_tpl=null)
Init javascript.
static initPanel($a_resize=false, ilGlobalTemplateInterface $a_main_tpl=null)
Init yui panel.
global $DIC
Definition: goto.php:24
static initjQuery(ilGlobalTemplateInterface $a_tpl=null)
inits and adds the jQuery JS-File to the global or a passed template
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initNoteForm()

ilNoteGUI::initNoteForm (   $a_mode = "edit",
  $a_type,
  $a_note = null 
)

Init note form.

Parameters
int$a_modeEdit Mode

Definition at line 1023 of file class.ilNoteGUI.php.

References $_GET, $ctrl, $lng, IL_NOTE_PUBLIC, and ilUtil\prepareFormOutput().

Referenced by addNote(), getNoteListHTML(), and updateNote().

1024  {
1025  $lng = $this->lng;
1026  $ilCtrl = $this->ctrl;
1027 
1028  $this->form_tpl = new ilTemplate("tpl.notes_edit.html", true, true, "Services/Notes");
1029  $this->form_tpl->setVariable("LABEL", ($a_type == IL_NOTE_PUBLIC)
1030  ? $lng->txt("comment")
1031  : $lng->txt("note"));
1032 
1033  if ($a_note) {
1034  $this->form_tpl->setVariable("VAL_NOTE", ilUtil::prepareFormOutput($a_note->getText()));
1035  $this->form_tpl->setVariable("NOTE_ID", $a_note->getId());
1036  }
1037 
1038  if ($a_mode == "create") {
1039  $this->form_tpl->setVariable("TXT_CMD", ($a_type == IL_NOTE_PUBLIC)
1040  ? $lng->txt("note_add_comment")
1041  : $lng->txt("note_add_note"));
1042  $this->form_tpl->setVariable("CMD", "addNote");
1043  } else {
1044  $this->form_tpl->setVariable("TXT_CMD", ($a_type == IL_NOTE_PUBLIC)
1045  ? $lng->txt("note_update_comment")
1046  : $lng->txt("note_update_note"));
1047  $this->form_tpl->setVariable("CMD", "updateNote");
1048  }
1049 
1050  return;
1051  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
1052  $this->form = new ilPropertyFormGUI();
1053  $this->form->setOpenTag(false);
1054  $this->form->setCloseTag(false);
1055  $this->form->setDisableStandardMessage(true);
1056 
1057  // subject
1058  /* $ti = new ilTextInputGUI($this->lng->txt("subject"), "sub_note");
1059  $ti->setRequired(true);
1060  $ti->setMaxLength(200);
1061  $ti->setSize(40);
1062  if ($a_note)
1063  {
1064  $ti->setValue($a_note->getSubject());
1065  }
1066  $this->form->addItem($ti);*/
1067 
1068  // text
1069  // $ta = new ilTextAreaInputGUI(($a_type == IL_NOTE_PUBLIC)
1070  // ? $lng->txt("notes_comment")
1071  // : $lng->txt("note"), "note");
1072  $ta = new ilTextAreaInputGUI("", "note");
1073  $ta->setCols(40);
1074  $ta->setRows(4);
1075  if ($a_note) {
1076  $ta->setValue($a_note->getText());
1077  }
1078  $this->form->addItem($ta);
1079 
1080  // label
1081  /* $options = array(
1082  IL_NOTE_UNLABELED => $lng->txt("unlabeled"),
1083  IL_NOTE_QUESTION => $lng->txt("question"),
1084  IL_NOTE_IMPORTANT => $lng->txt("important"),
1085  IL_NOTE_PRO => $lng->txt("pro"),
1086  IL_NOTE_CONTRA => $lng->txt("contra"),
1087  );
1088  $si = new ilSelectInputGUI($this->lng->txt("notes_label"), "note_label");
1089  $si->setOptions($options);
1090  if ($a_note)
1091  {
1092  $si->setValue($a_note->getLabel());
1093  }
1094  $this->form->addItem($si); */
1095 
1096  // hidden note id
1097  if ($a_note) {
1098  $hi = new ilHiddenInputGUI("note_id");
1099  $hi->setValue($_GET["note_id"]);
1100  $this->form->addItem($hi);
1101  }
1102 
1103  // save and cancel commands
1104  if ($a_mode == "create") {
1105  $this->form->addCommandButton("addNote", $lng->txt("save"));
1106  /* $this->form->addCommandButton("cancelAddNote", $lng->txt("cancel"));
1107  $this->form->setTitle($a_type == IL_NOTE_PUBLIC
1108  ? $lng->txt("notes_add_comment")
1109  : $lng->txt("notes_add_note"));*/
1110  } else {
1111  $this->form->addCommandButton("updateNote", $lng->txt("save"));
1112  /* $this->form->addCommandButton("cancelUpdateNote", $lng->txt("cancel"));
1113  $this->form->setTitle($a_type == IL_NOTE_PUBLIC
1114  ? $lng->txt("notes_edit_comment")
1115  : $lng->txt("notes_edit_note"));*/
1116  }
1117 
1118  $ilCtrl->setParameter($this, "note_type", $a_type);
1119  $this->form->setFormAction($this->ctrl->getFormAction($this));
1120  }
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
This class represents a property form user interface.
$_GET["client_id"]
This class represents a hidden form property in a property form.
const IL_NOTE_PUBLIC
Definition: class.ilNote.php:6
This class represents a text area property in a property form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ listSortAsc()

ilNoteGUI::listSortAsc ( )
protected

Definition at line 1772 of file class.ilNoteGUI.php.

References $_SESSION.

1773  {
1774  $_SESSION["comments_sort_asc"] = 1;
1775  return $this->getNotesHtml();
1776  }
$_SESSION["AccountId"]

◆ listSortDesc()

ilNoteGUI::listSortDesc ( )
protected

Definition at line 1778 of file class.ilNoteGUI.php.

References $_SESSION.

1779  {
1780  $_SESSION["comments_sort_asc"] = 0;
1781  return $this->getNotesHtml();
1782  }
$_SESSION["AccountId"]

◆ notifyObserver()

ilNoteGUI::notifyObserver (   $a_action,
  $a_note 
)
protected

Notify observers on update/create.

Parameters
string$a_action
ilNote$a_note

Definition at line 1735 of file class.ilNoteGUI.php.

References $param.

Referenced by addNote(), and updateNote().

1736  {
1737  $this->log->debug("Notifying Observers (" . count($this->observer) . ").");
1738  if (is_array($this->observer) && count($this->observer) > 0) {
1739  foreach ($this->observer as $item) {
1740  $param = $a_note->getObject();
1741  //TODO refactor this, check what is this news_id from getObject
1742  unset($param['news_id']);
1743  $param["action"] = $a_action;
1744  $param["note_id"] = $a_note->getId();
1745  call_user_func_array($item, $param);
1746  }
1747  }
1748 
1749  //ajax calls don't have callbacks in the observer. (modals)
1750  /* deactivated, at least learning modules get double notifications otherwise, see #29331
1751  if ($this->ajax) {
1752  $ref = (int) $_GET['ref_id'];
1753  if (in_array($ref, ilObject::_getAllReferences($this->rep_obj_id))) {
1754  if ($this->obj_type == "pg") {
1755  $gui = new ilLMPresentationGUI(
1756  "",
1757  false,
1758  "",
1759  false
1760  );
1761  $gui->observeNoteAction($this->rep_obj_id, $this->obj_id, $this->obj_type, $a_action, $a_note->getId());
1762  }
1763 
1764  if ($this->obj_type == "wpg") {
1765  $gui = new ilWikiPageGUI($this->obj_id, 0, $ref);
1766  $gui->observeNoteAction($this->obj_id, $this->obj_id, $this->obj_type, $a_action, $a_note->getId());
1767  }
1768  }
1769  }*/
1770  }
$param
Definition: xapitoken.php:29
+ Here is the caller graph for this function:

◆ printNotes()

ilNoteGUI::printNotes ( )

notes print view screen

Definition at line 1546 of file class.ilNoteGUI.php.

References $tpl, exit, and getNotesHTML().

1547  {
1548  $tpl = new ilTemplate("tpl.main.html", true, true);
1549 
1550  $this->print = true;
1551  $this->multi_selection = false;
1552  $tpl->setVariable("CONTENT", $this->getNotesHTML());
1553  echo $tpl->get();
1554  exit;
1555  }
getNotesHTML($a_init_form=true)
exit
Definition: login.php:29
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41
+ Here is the call graph for this function:

◆ renderLink()

ilNoteGUI::renderLink (   $a_tpl,
  $a_var,
  $a_txt,
  $a_cmd,
  $a_anchor = "" 
)

Render a link.

Definition at line 1694 of file class.ilNoteGUI.php.

References $ctrl.

Referenced by getNoteListHTML(), and getNotesHTML().

1695  {
1696  $ilCtrl = $this->ctrl;
1697 
1698  $low_var = strtolower($a_var);
1699  $up_var = strtoupper($a_var);
1700 
1701  if ($this->ajax) {
1702  $a_tpl->setVariable("LINK_" . $up_var, "#");
1703  $oc = "onclick = \"ilNotes.cmdAjaxLink(event, '" .
1704  $ilCtrl->getLinkTargetByClass("ilnotegui", $a_cmd, "", true) .
1705  "');\"";
1706  $a_tpl->setVariable("ON_CLICK_" . $up_var, $oc);
1707  } else {
1708  $a_tpl->setVariable(
1709  "LINK_" . $up_var,
1710  $ilCtrl->getLinkTargetByClass("ilnotegui", $a_cmd, $a_anchor)
1711  );
1712  }
1713 
1714  $a_tpl->setCurrentBlock($low_var);
1715  $a_tpl->setVariable("TXT_" . $up_var, $a_txt);
1716  $a_tpl->parseCurrentBlock();
1717  }
+ Here is the caller graph for this function:

◆ renderTargets()

ilNoteGUI::renderTargets (   $a_note)

show related objects as links

Definition at line 1181 of file class.ilNoteGUI.php.

References $access, $additional, $ilUser, $location, $obj_definition, $tree, $type, $user, ilObject\_getAllReferences(), ilLink\_getLink(), ilObject\_lookupObjId(), ilObject\_lookupOwner(), ilObject\_lookupOwnerName(), ilContainerReference\_lookupTargetId(), ilSCORM2004Node\_lookupTitle(), ilObject\_lookupTitle(), ilObject\_lookupType(), ilUtil\appendUrlParameterString(), ilWorkspaceAccessHandler\getGotoLink(), and getSubObjectTitle().

Referenced by getNoteListHTML(), and getPDNoteHTML().

1182  {
1183  $tree = $this->tree;
1184  $ilAccess = $this->access;
1186  $ilUser = $this->user;
1187 
1188  if (!$this->targets_enabled) {
1189  return "";
1190  }
1191 
1192  $a_note_id = $a_note->getId();
1193  $target = $a_note->getObject();
1194  $a_obj_type = $target["obj_type"];
1195  $a_obj_id = $target["obj_id"];
1196 
1197  $target_tpl = new ilTemplate("tpl.note_target_object.html", true, true, "Services/Notes");
1198 
1199  if ($target["rep_obj_id"] > 0) {
1200  // get all visible references of target object
1201 
1202  // repository
1203  $ref_ids = ilObject::_getAllReferences($target["rep_obj_id"]);
1204  if ($ref_ids) {
1205  $vis_ref_ids = array();
1206  foreach ($ref_ids as $ref_id) {
1207  if ($ilAccess->checkAccess("visible", "", $ref_id)) {
1208  $vis_ref_ids[] = $ref_id;
1209  }
1210  }
1211 
1212  // output links to targets
1213  if (count($vis_ref_ids) > 0) {
1214  foreach ($vis_ref_ids as $vis_ref_id) {
1215  $type = ilObject::_lookupType($vis_ref_id, true);
1216  $title = ilObject::_lookupTitle($target["rep_obj_id"]);
1217 
1218  $sub_link = $sub_title = "";
1219  if ($type == "sahs") { // bad hack, needs general procedure
1220  $link = "goto.php?target=sahs_" . $vis_ref_id;
1221  if ($a_obj_type == "sco" || $a_obj_type == "seqc" || $a_obj_type == "chap" || $a_obj_type == "pg") {
1222  $sub_link = "goto.php?target=sahs_" . $vis_ref_id . "_" . $a_obj_id;
1223  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
1224  $sub_title = ilSCORM2004Node::_lookupTitle($a_obj_id);
1225  }
1226  } elseif ($type == "poll") {
1227  include_once "Services/Link/classes/class.ilLink.php";
1228  $link = ilLink::_getLink($vis_ref_id, "poll");
1229  } elseif ($a_obj_type != "pg") {
1230  if (!is_object($this->item_list_gui[$type])) {
1231  $class = $objDefinition->getClassName($type);
1232  $location = $objDefinition->getLocation($type);
1233  $full_class = "ilObj" . $class . "ListGUI";
1234  include_once($location . "/class." . $full_class . ".php");
1235  $this->item_list_gui[$type] = new $full_class();
1236  }
1237 
1238  // for references, get original title
1239  // (link will lead to orignal, which basically is wrong though)
1240  if ($a_obj_type == "crsr" || $a_obj_type == "catr" || $a_obj_type == "grpr") {
1241  include_once "Services/ContainerReference/classes/class.ilContainerReference.php";
1242  $tgt_obj_id = ilContainerReference::_lookupTargetId($target["rep_obj_id"]);
1243  $title = ilObject::_lookupTitle($tgt_obj_id);
1244  }
1245  $this->item_list_gui[$type]->initItem($vis_ref_id, $target["rep_obj_id"], $title, $a_obj_type);
1246  $link = $this->item_list_gui[$type]->getCommandLink("infoScreen");
1247 
1248  // workaround, because # anchor can't be passed through frameset
1249  $link = ilUtil::appendUrlParameterString($link, "anchor=note_" . $a_note_id);
1250 
1251  $link = $this->item_list_gui[$type]->appendRepositoryFrameParameter($link) . "#note_" . $a_note_id;
1252  } else {
1253  $title = ilObject::_lookupTitle($target["rep_obj_id"]);
1254  $link = "goto.php?target=pg_" . $a_obj_id . "_" . $vis_ref_id;
1255  }
1256 
1257  $par_id = $tree->getParentId($vis_ref_id);
1258 
1259  // sub object link
1260  if ($sub_link != "") {
1261  if ($this->export_html || $this->print) {
1262  $target_tpl->setCurrentBlock("exp_target_sub_object");
1263  } else {
1264  $target_tpl->setCurrentBlock("target_sub_object");
1265  $target_tpl->setVariable("LINK_SUB_TARGET", $sub_link);
1266  }
1267  $target_tpl->setVariable("TXT_SUB_TARGET", $sub_title);
1268  $target_tpl->parseCurrentBlock();
1269  }
1270 
1271  // container and object link
1272  if ($this->export_html || $this->print) {
1273  $target_tpl->setCurrentBlock("exp_target_object");
1274  } else {
1275  $target_tpl->setCurrentBlock("target_object");
1276  $target_tpl->setVariable("LINK_TARGET", $link);
1277  }
1278  $target_tpl->setVariable(
1279  "TXT_CONTAINER",
1281  ilObject::_lookupObjId($par_id)
1282  )
1283  );
1284  $target_tpl->setVariable("TXT_TARGET", $title);
1285 
1286  $target_tpl->parseCurrentBlock();
1287  }
1288  $target_tpl->touchBlock("target_objects");
1289  }
1290  }
1291  // personal workspace
1292  else {
1293  // we only need 1 instance
1294  if (!$this->wsp_tree) {
1295  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
1296  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
1297  $this->wsp_tree = new ilWorkspaceTree($ilUser->getId());
1298  $this->wsp_access_handler = new ilWorkspaceAccessHandler($this->wsp_tree);
1299  }
1300  $node_id = $this->wsp_tree->lookupNodeId($target["rep_obj_id"]);
1301  if ($this->wsp_access_handler->checkAccess("visible", "", $node_id)) {
1302  $path = $this->wsp_tree->getPathFull($node_id);
1303  if ($path) {
1304  $item = array_pop($path);
1305  $parent = array_pop($path);
1306 
1307  if (!$parent["title"]) {
1308  $parent["title"] = $this->lng->txt("personal_resources");
1309  }
1310 
1311  // sub-objects
1312  $additional = null;
1313  if ($a_obj_id) {
1314  $sub_title = $this->getSubObjectTitle($target["rep_obj_id"], $a_obj_id);
1315  if ($sub_title) {
1316  $item["title"] .= " (" . $sub_title . ")";
1317  $additional = "_" . $a_obj_id;
1318  }
1319  }
1320 
1321  $link = ilWorkspaceAccessHandler::getGotoLink($node_id, $target["rep_obj_id"], $additional);
1322  }
1323  // shared resource
1324  else {
1325  $owner = ilObject::_lookupOwner($target["rep_obj_id"]);
1326  $parent["title"] = $this->lng->txt("wsp_tab_shared") .
1327  " (" . ilObject::_lookupOwnerName($owner) . ")";
1328  $item["title"] = ilObject::_lookupTitle($target["rep_obj_id"]);
1329  $link = "ilias.php?baseClass=ilDashboardGUI&cmd=jumpToWorkspace&dsh=" .
1330  $owner;
1331  }
1332 
1333  // container and object link
1334  if ($this->export_html || $this->print) {
1335  $target_tpl->setCurrentBlock("exp_target_object");
1336  } else {
1337  $target_tpl->setCurrentBlock("target_object");
1338  $target_tpl->setVariable("LINK_TARGET", $link);
1339  }
1340 
1341 
1342  // :TODO: no images in template ?
1343 
1344  $target_tpl->setVariable("TXT_CONTAINER", $parent["title"]);
1345 
1346  $target_tpl->setVariable("TXT_TARGET", $item["title"]);
1347 
1348  $target_tpl->parseCurrentBlock();
1349  }
1350  }
1351  }
1352  return $target_tpl->get();
1353  }
static _lookupTitle($a_obj_id)
Lookup Title.
$type
$location
Definition: buildRTE.php:44
Access handler for personal workspace.
static _lookupTitle($a_id)
lookup object title
static _getAllReferences($a_id)
get all reference ids of object
Tree handler for personal workspace.
getSubObjectTitle($parent_obj_id, $sub_obj_id)
Get sub object title if available with callback.
static appendUrlParameterString($a_url, $a_par, $xml_style=false)
append URL parameter string ("par1=value1&par2=value2...") to given URL string
static getGotoLink($a_node_id, $a_obj_id, $a_additional=null)
static _lookupObjId($a_id)
static _lookupOwner($a_id)
lookup object owner
$additional
Definition: goto.php:52
static _lookupType($a_id, $a_reference=false)
lookup object type
$ilUser
Definition: imgupload.php:18
static _lookupOwnerName($a_owner_id)
lookup owner name for owner id
static _lookupTargetId($a_obj_id)
lookup target id
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setDefaultCommand()

ilNoteGUI::setDefaultCommand (   $a_val)

Set default command.

Parameters
string$a_valdefault command

Definition at line 220 of file class.ilNoteGUI.php.

Referenced by ilNewsTimelineItemGUI\renderFooter().

221  {
222  $this->default_command = $a_val;
223  }
+ Here is the caller graph for this function:

◆ setExportMode()

ilNoteGUI::setExportMode ( )

Set export mode.

Definition at line 1861 of file class.ilNoteGUI.php.

1862  {
1863  $this->hide_new_form = true;
1864  $this->no_actions = true;
1865  $this->enable_sorting = false;
1866  $this->user_img_export_html = true;
1867  }

◆ setRepositoryMode()

ilNoteGUI::setRepositoryMode (   $a_value)

Set repository mode.

Parameters
bool$a_value

Definition at line 319 of file class.ilNoteGUI.php.

Referenced by __construct().

320  {
321  $this->repository_mode = (bool) $a_value;
322  }
+ Here is the caller graph for this function:

◆ showAllPublicNotes()

ilNoteGUI::showAllPublicNotes ( )

show all public notes to user

Definition at line 1590 of file class.ilNoteGUI.php.

References $ilUser, $user, and getNotesHTML().

1591  {
1592  $ilUser = $this->user;
1593 
1594  $ilUser->writePref("notes_pub_all", "y");
1595 
1596  return $this->getNotesHTML();
1597  }
getNotesHTML($a_init_form=true)
$ilUser
Definition: imgupload.php:18
+ Here is the call graph for this function:

◆ showMyPublicNotes()

ilNoteGUI::showMyPublicNotes ( )

show only public notes of user

Definition at line 1602 of file class.ilNoteGUI.php.

References $ilUser, $user, and getNotesHTML().

1603  {
1604  $ilUser = $this->user;
1605 
1606  $ilUser->writePref("notes_pub_all", "n");
1607 
1608  return $this->getNotesHTML();
1609  }
getNotesHTML($a_init_form=true)
$ilUser
Definition: imgupload.php:18
+ Here is the call graph for this function:

◆ showNotes()

ilNoteGUI::showNotes ( )

show notes

Definition at line 1560 of file class.ilNoteGUI.php.

References $_GET, $ilUser, $user, getNotesHTML(), and IL_NOTE_PRIVATE.

1561  {
1562  $ilUser = $this->user;
1563 
1564  $suffix = ($_GET["note_type"] == IL_NOTE_PRIVATE)
1565  ? "private"
1566  : "public";
1567  $ilUser->writePref("notes_" . $suffix, "y");
1568 
1569  return $this->getNotesHTML();
1570  }
getNotesHTML($a_init_form=true)
const IL_NOTE_PRIVATE
Definition: class.ilNote.php:5
$_GET["client_id"]
$ilUser
Definition: imgupload.php:18
+ Here is the call graph for this function:

◆ updateNote()

ilNoteGUI::updateNote ( )

update note

Definition at line 1424 of file class.ilNoteGUI.php.

References $_GET, $_POST, $ctrl, $ilUser, $lng, $user, checkEdit(), editNoteForm(), initNoteForm(), notifyObserver(), and ilUtil\stripSlashes().

1425  {
1426  $ilUser = $this->user;
1427  $lng = $this->lng;
1428  $ilCtrl = $this->ctrl;
1429 
1430  $note = new ilNote(ilUtil::stripSlashes($_POST["note_id"]));
1431  $this->initNoteForm(
1432  "edit",
1433  $note->getType(),
1434  $note
1435  );
1436 
1437  // if ($this->form->checkInput())
1438  // if ($_POST["note"] != "")
1439  // {
1440  $note->setText(ilUtil::stripSlashes($_POST["note"]));
1441  $note->setSubject(ilUtil::stripSlashes($_POST["sub_note"]));
1442  $note->setLabel(ilUtil::stripSlashes($_POST["note_label"]));
1443  if ($this->checkEdit($note)) {
1444  $note->update();
1445 
1446  $this->notifyObserver("update", $note);
1447 
1448  $ilCtrl->setParameter($this, "note_mess", "mod");
1449  }
1450  $ilCtrl->redirect($this, "showNotes", "notes_top", $this->ajax);
1451  // }
1452  $ilCtrl->redirect($this, "showNotes", "notes_top", $this->ajax);
1453  $this->note_mess = "frmfld";
1454  $this->form->setValuesByPost();
1455  $_GET["note_id"] = $note->getId();
1456  $_GET["note_type"] = $note->getType();
1457  return $this->editNoteForm(false);
1458  }
initNoteForm($a_mode="edit", $a_type, $a_note=null)
Init note form.
$_GET["client_id"]
checkEdit($a_note)
Check edit.
editNoteForm($a_init_form=true)
get notes list including add note area
Note class.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
notifyObserver($a_action, $a_note)
Notify observers on update/create.
$ilUser
Definition: imgupload.php:18
$_POST["username"]
+ Here is the call graph for this function:

◆ updateWidget()

ilNoteGUI::updateWidget ( )
protected

Update widget.

Parameters

Definition at line 1875 of file class.ilNoteGUI.php.

References exit, and getCommentsWidget().

1876  {
1877  echo $this->getCommentsWidget();
1878  exit;
1879  }
exit
Definition: login.php:29
getCommentsWidget()
Get widget.
+ Here is the call graph for this function:

Field Documentation

◆ $access

ilNoteGUI::$access
protected

Definition at line 53 of file class.ilNoteGUI.php.

Referenced by renderTargets().

◆ $ctrl

◆ $default_command

ilNoteGUI::$default_command = "getNotesHTML"
protected

Definition at line 59 of file class.ilNoteGUI.php.

Referenced by getDefaultCommand().

◆ $enable_sorting

ilNoteGUI::$enable_sorting = true
protected

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

◆ $hide_new_form

ilNoteGUI::$hide_new_form = false
protected

Definition at line 78 of file class.ilNoteGUI.php.

Referenced by getNoteListHTML().

◆ $lng

◆ $log

ilNoteGUI::$log
protected

Definition at line 107 of file class.ilNoteGUI.php.

◆ $news_id

ilNoteGUI::$news_id = 0
protected

Definition at line 72 of file class.ilNoteGUI.php.

◆ $no_actions

ilNoteGUI::$no_actions = false
protected

Definition at line 95 of file class.ilNoteGUI.php.

◆ $obj_definition

ilNoteGUI::$obj_definition
protected

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

Referenced by getSubObjectTitle(), and renderTargets().

◆ $observer

ilNoteGUI::$observer = []
protected

Definition at line 62 of file class.ilNoteGUI.php.

◆ $old

ilNoteGUI::$old = false

Definition at line 57 of file class.ilNoteGUI.php.

◆ $only_latest

ilNoteGUI::$only_latest = false
protected

Definition at line 84 of file class.ilNoteGUI.php.

Referenced by getNoteListHTML().

◆ $public_deletion_enabled

ilNoteGUI::$public_deletion_enabled = false

Definition at line 55 of file class.ilNoteGUI.php.

Referenced by checkDeletion().

◆ $repository_mode

ilNoteGUI::$repository_mode = false

Definition at line 56 of file class.ilNoteGUI.php.

◆ $settings

ilNoteGUI::$settings
protected

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

Referenced by checkDeletion(), and getNotesHTML().

◆ $tree

ilNoteGUI::$tree
protected

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

Referenced by renderTargets().

◆ $ui

ilNoteGUI::$ui
protected

Definition at line 67 of file class.ilNoteGUI.php.

◆ $user

◆ $user_img_export_html

ilNoteGUI::$user_img_export_html = false
protected

Definition at line 102 of file class.ilNoteGUI.php.

Referenced by getNoteListHTML().

◆ $widget_header

ilNoteGUI::$widget_header = ""
protected

Definition at line 89 of file class.ilNoteGUI.php.


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