ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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)
 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...
 

Static Public Member Functions

static initJavascript ($a_ajax_url, $a_type=IL_NOTE_PRIVATE, ilTemplate $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
 

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 
)

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 105 of file class.ilNoteGUI.php.

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

111  {
112  global $DIC;
113 
114  $this->user = $DIC->user();
115  $this->settings = $DIC->settings();
116  $this->obj_definition = $DIC["objDefinition"];
117  $this->tree = $DIC->repositoryTree();
118  $this->access = $DIC->access();
119  $this->ui = $DIC->ui();
120  $ilCtrl = $DIC->ctrl();
121  $lng = $DIC->language();
122 
123  $lng->loadLanguageModule("notes");
124 
125  $ilCtrl->saveParameter($this, "notes_only");
126  $this->only = $_GET["notes_only"];
127 
128  $this->rep_obj_id = $a_rep_obj_id;
129  $this->obj_id = $a_obj_id;
130  $this->obj_type = $a_obj_type;
131  $this->inc_sub = $a_include_subobjects;
132  $this->news_id = $a_news_id;
133 
134  // auto-detect object type
135  if (!$this->obj_type && $a_rep_obj_id) {
136  $this->obj_type = ilObject::_lookupType($a_rep_obj_id);
137  }
138 
139  $this->ajax = $ilCtrl->isAsynch();
140 
141  $this->ctrl = $ilCtrl;
142  $this->lng = $lng;
143 
144  $this->anchor_jump = true;
145  $this->add_note_form = false;
146  $this->edit_note_form = false;
147  $this->private_enabled = false;
148 
149  if (ilNote::commentsActivated($this->rep_obj_id, $this->obj_id, $this->obj_type, $this->news_id)) {
150  $this->public_enabled = true;
151  } else {
152  $this->public_enabled = false;
153  }
154  $this->enable_hiding = false;
155  $this->targets_enabled = false;
156  $this->multi_selection = false;
157  $this->export_html = false;
158  $this->print = false;
159  $this->comments_settings = false;
160 
161  $this->note_img = array(
162  IL_NOTE_UNLABELED => array(
163  "img" => ilUtil::getImagePath("note_unlabeled.svg"),
164  "alt" => $lng->txt("note")),
165  IL_NOTE_IMPORTANT => array(
166  "img" => ilUtil::getImagePath("note_unlabeled.svg"),
167  "alt" => $lng->txt("note") . ", " . $lng->txt("important")),
168  IL_NOTE_QUESTION => array(
169  "img" => ilUtil::getImagePath("note_unlabeled.svg"),
170  "alt" => $lng->txt("note") . ", " . $lng->txt("question")),
171  IL_NOTE_PRO => array(
172  "img" => ilUtil::getImagePath("note_unlabeled.svg"),
173  "alt" => $lng->txt("note") . ", " . $lng->txt("pro")),
174  IL_NOTE_CONTRA => array(
175  "img" => ilUtil::getImagePath("note_unlabeled.svg"),
176  "alt" => $lng->txt("note") . ", " . $lng->txt("contra"))
177  );
178 
179  $this->comment_img = array(
180  IL_NOTE_UNLABELED => array(
181  "img" => ilUtil::getImagePath("comment_unlabeled.svg"),
182  "alt" => $lng->txt("notes_comment")),
183  IL_NOTE_IMPORTANT => array(
184  "img" => ilUtil::getImagePath("comment_unlabeled.svg"),
185  "alt" => $lng->txt("notes_comment") . ", " . $lng->txt("important")),
186  IL_NOTE_QUESTION => array(
187  "img" => ilUtil::getImagePath("comment_unlabeled.svg"),
188  "alt" => $lng->txt("notes_comment") . ", " . $lng->txt("question")),
189  IL_NOTE_PRO => array(
190  "img" => ilUtil::getImagePath("comment_unlabeled.svg"),
191  "alt" => $lng->txt("notes_comment") . ", " . $lng->txt("pro")),
192  IL_NOTE_CONTRA => array(
193  "img" => ilUtil::getImagePath("comment_unlabeled.svg"),
194  "alt" => $lng->txt("notes_comment") . ", " . $lng->txt("contra"))
195  );
196 
197  // default: notes for repository objects
198  $this->setRepositoryMode(true);
199  }
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
global $DIC
Definition: saml.php:7
$_GET["client_id"]
user()
Definition: user.php:4
global $ilCtrl
Definition: ilias.php:18
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static _lookupType($a_id, $a_reference=false)
lookup object type
const IL_NOTE_UNLABELED
Definition: class.ilNote.php:8
const IL_NOTE_QUESTION
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 462 of file class.ilNoteGUI.php.

References $ctrl, $ilCtrl, and ilNote\activateComments().

463  {
465 
466  if ($this->comments_settings) {
467  ilNote::activateComments($this->rep_obj_id, $this->obj_id, $this->obj_type, true);
468  }
469 
470  $ilCtrl->redirectByClass("ilnotegui", "showNotes", "", $this->ajax);
471  }
global $ilCtrl
Definition: ilias.php:18
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 1360 of file class.ilNoteGUI.php.

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

1361  {
1362  $ilUser = $this->user;
1363  $lng = $this->lng;
1364  $ilCtrl = $this->ctrl;
1365  //ilLoggerFactory::getLogger("root")->notice("addNote");
1366  $this->initNoteForm("create", $_GET["note_type"]);
1367 
1368  //if ($this->form->checkInput())
1369  if ($_POST["note"] != "") {
1370  $note = new ilNote();
1371  $note->setObject($this->obj_type, $this->rep_obj_id, $this->obj_id, $this->news_id);
1372  $note->setInRepository($this->repository_mode);
1373  $note->setType($_GET["note_type"]);
1374  $note->setAuthor($ilUser->getId());
1375  $note->setText(ilUtil::stripslashes($_POST["note"]));
1376  // $note->setSubject($_POST["sub_note"]);
1377  // $note->setLabel($_POST["note_label"]);
1378  $note->create();
1379 
1380  $this->notifyObserver("new", $note);
1381 
1382  $ilCtrl->setParameter($this, "note_mess", "mod");
1383  // $ilCtrl->redirect($this, "showNotes", "notes_top", $this->ajax);
1384  }
1385  $ilCtrl->redirect($this, "showNotes", "notes_top", $this->ajax);
1386  // $this->note_mess = "frmfld";
1387 // $this->form->setValuesByPost();
1388 // return $this->addNoteForm(false);;
1389  }
initNoteForm($a_mode="edit", $a_type, $a_note=null)
Init note form.
$_GET["client_id"]
Note class.
global $ilCtrl
Definition: ilias.php:18
$ilUser
Definition: imgupload.php:18
notifyObserver($a_action, $a_note)
Notify observers on update/create.
$_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 1328 of file class.ilNoteGUI.php.

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

1329  {
1330  $ilUser = $this->user;
1331 
1332  $suffix = ($_GET["note_type"] == IL_NOTE_PRIVATE)
1333  ? "private"
1334  : "public";
1335  $ilUser->setPref("notes_" . $suffix, "y");
1336 
1337  $this->add_note_form = true;
1338  return $this->getNotesHTML($a_init_form);
1339  }
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 1694 of file class.ilNoteGUI.php.

1695  {
1696  $this->observer[] = $a_callback;
1697  }

◆ 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 1656 of file class.ilNoteGUI.php.

1657  {
1658  return $a_node_type . ";" . $a_node_id . ";" . $a_sub_id . ";" . $a_sub_type;
1659  }

◆ cancelAddNote()

ilNoteGUI::cancelAddNote ( )

cancel add note

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

References getNotesHTML().

1345  {
1346  return $this->getNotesHTML();
1347  }
getNotesHTML($a_init_form=true)
+ Here is the call graph for this function:

◆ cancelDelete()

ilNoteGUI::cancelDelete ( )

cancel deletion of note

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

References getNotesHTML().

1471  {
1472  return $this->getNotesHTML();
1473  }
getNotesHTML($a_init_form=true)
+ Here is the call graph for this function:

◆ cancelUpdateNote()

ilNoteGUI::cancelUpdateNote ( )

cancel edit note

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

References getNotesHTML().

1353  {
1354  return $this->getNotesHTML();
1355  }
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 951 of file class.ilNoteGUI.php.

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

Referenced by confirmDelete(), and getNoteListHTML().

952  {
955 
956  if ($ilUser->getId() == ANONYMOUS_USER_ID) {
957  return false;
958  }
959 
960  $is_author = ($a_note->getAuthor() == $ilUser->getId());
961 
962  if ($a_note->getType() == IL_NOTE_PRIVATE && $is_author) {
963  return true;
964  }
965 
966  if ($a_note->getType() == IL_NOTE_PUBLIC && $this->public_deletion_enabled) {
967  return true;
968  }
969 
970  if ($a_note->getType() == IL_NOTE_PUBLIC && $is_author && $ilSetting->get("comments_del_user", 0)) {
971  return true;
972  }
973 
974  return false;
975  }
const IL_NOTE_PRIVATE
Definition: class.ilNote.php:5
const IL_NOTE_PUBLIC
Definition: class.ilNote.php:6
$ilUser
Definition: imgupload.php:18
global $ilSetting
Definition: privfeed.php:17
+ Here is the caller graph for this function:

◆ checkEdit()

ilNoteGUI::checkEdit (   $a_note)

Check edit.

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

References $ilUser, and $user.

Referenced by getNoteListHTML(), and updateNote().

981  {
983 
984  if ($a_note->getAuthor() == $ilUser->getId()
985  && ($ilUser->getId() != ANONYMOUS_USER_ID)) {
986  return true;
987  }
988  return false;
989  }
$ilUser
Definition: imgupload.php:18
+ Here is the caller graph for this function:

◆ confirmDelete()

ilNoteGUI::confirmDelete ( )

cancel deletion of note

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

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

1479  {
1480  $ilCtrl = $this->ctrl;
1481  $lng = $this->lng;
1482  $ilUser = $this->user;
1483 
1484  $cnt = 0;
1485  foreach ($_POST["note"] as $id) {
1486  $note = new ilNote($id);
1487  if ($this->checkDeletion($note)) {
1488  $note->delete();
1489  $cnt++;
1490  }
1491  }
1492  if ($cnt > 1) {
1493  $ilCtrl->setParameter($this, "note_mess", "ntsdel");
1494  } else {
1495  $ilCtrl->setParameter($this, "note_mess", "ntdel");
1496  }
1497  $ilCtrl->redirect($this, "showNotes", "notes_top", $this->ajax);
1498  }
checkDeletion($a_note)
Check whether deletion is allowed.
if(!array_key_exists('StateId', $_REQUEST)) $id
Note class.
global $ilCtrl
Definition: ilias.php:18
$ilUser
Definition: imgupload.php:18
$_POST["username"]
+ Here is the call graph for this function:

◆ deactivateComments()

ilNoteGUI::deactivateComments ( )

Deactivate Comments.

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

References $ctrl, $ilCtrl, and ilNote\activateComments().

477  {
479 
480  if ($this->comments_settings) {
481  ilNote::activateComments($this->rep_obj_id, $this->obj_id, $this->obj_type, false);
482  }
483 
484  $ilCtrl->redirectByClass("ilnotegui", "showNotes", "", $this->ajax);
485  }
global $ilCtrl
Definition: ilias.php:18
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 1443 of file class.ilNoteGUI.php.

References getNotesHTML().

1444  {
1445  $this->delete_note = true;
1446  $this->note_mess = "qdel";
1447  return $this->getNotesHTML();
1448  }
getNotesHTML($a_init_form=true)
+ Here is the call graph for this function:

◆ deleteNotes()

ilNoteGUI::deleteNotes ( )

delete notes confirmation

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

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

1454  {
1455  $lng = $this->lng;
1456 
1457  if (!$_POST["note"]) {
1458  $this->note_mess = "noc";
1459  } else {
1460  $this->delete_note = true;
1461  $this->note_mess = "qdel";
1462  }
1463 
1464  return $this->getNotesHTML();
1465  }
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 1433 of file class.ilNoteGUI.php.

References getNotesHTML().

Referenced by updateNote().

1434  {
1435  $this->edit_note_form = true;
1436 
1437  return $this->getNotesHTML($a_init_form);
1438  }
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 295 of file class.ilNoteGUI.php.

296  {
297  $this->anchor_jump = $a_enable;
298  }

◆ enableCommentsSettings()

ilNoteGUI::enableCommentsSettings (   $a_enable = true)

enable private notes

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

256  {
257  $this->comments_settings = $a_enable;
258  }

◆ enableHiding()

ilNoteGUI::enableHiding (   $a_enable = true)

enable hiding

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

272  {
273  $this->enable_hiding = $a_enable;
274  }

◆ enableMultiSelection()

ilNoteGUI::enableMultiSelection (   $a_enable = true)

enable multi selection (checkboxes and commands)

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

288  {
289  $this->multi_selection = $a_enable;
290  }

◆ enablePrivateNotes()

ilNoteGUI::enablePrivateNotes (   $a_enable = true)

enable private notes

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

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

240  {
241  $this->private_enabled = $a_enable;
242  }
+ Here is the caller graph for this function:

◆ enablePublicNotes()

ilNoteGUI::enablePublicNotes (   $a_enable = true)

enable public notes

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

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

248  {
249  $this->public_enabled = $a_enable;
250  }
+ Here is the caller graph for this function:

◆ enablePublicNotesDeletion()

ilNoteGUI::enablePublicNotesDeletion (   $a_enable = true)

enable public notes

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

Referenced by ilLMPresentationGUI\ilLMNotes().

264  {
265  $this->public_deletion_enabled = $a_enable;
266  }
+ Here is the caller graph for this function:

◆ enableTargets()

ilNoteGUI::enableTargets (   $a_enable = true)

enable target objects

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

280  {
281  $this->targets_enabled = $a_enable;
282  }

◆ executeCommand()

ilNoteGUI::executeCommand ( )

execute command

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

References getDefaultCommand().

225  {
226  $cmd = $this->ctrl->getCmd($this->getDefaultCommand());
227  $next_class = $this->ctrl->getNextClass($this);
228 
229  switch ($next_class) {
230  default:
231  return $this->$cmd();
232  break;
233  }
234  }
getDefaultCommand()
Get default command.
+ Here is the call graph for this function:

◆ exportNotesHTML()

ilNoteGUI::exportNotesHTML ( )

export selected notes to html

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

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

1504  {
1505  $tpl = new ilTemplate("tpl.main.html", true, true);
1506 
1507  $this->export_html = true;
1508  $this->multi_selection = false;
1509  $tpl->setVariable("CONTENT", $this->getNotesHTML());
1510  ilUtil::deliverData($tpl->get(), "notes.html");
1511  }
getNotesHTML($a_init_form=true)
static deliverData($a_data, $a_filename, $mime="application/octet-stream", $charset="")
deliver data for download via browser.
$tpl
Definition: ilias.php:10
special template class to simplify handling of ITX/PEAR
+ Here is the call graph for this function:

◆ getCommentsWidget()

ilNoteGUI::getCommentsWidget ( )
protected

Get widget.

Parameters

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

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

Referenced by getHTML(), and updateWidget().

1749  {
1750  $f = $this->ui->factory();
1751  $r = $this->ui->renderer();
1752 
1753  $lng = $this->lng;
1754  $ctrl = $this->ctrl;
1755  $ctrl->setParameter($this, "news_id", $this->news_id);
1758  null,
1759  ilObject::_lookupType($this->rep_obj_id),
1760  $this->rep_obj_id,
1761  $this->obj_type,
1762  $this->obj_id,
1763  $this->news_id
1764  );
1765 
1766  $cnt = ilNote::_countNotesAndComments($this->rep_obj_id, $this->obj_id, $this->obj_type, $this->news_id);
1767  $cnt = $cnt[$this->rep_obj_id][IL_NOTE_PUBLIC];
1768 
1769  $tpl = new ilTemplate("tpl.note_widget_header.html", true, true, "Services/Notes");
1770  $widget_el_id = "notew_" . str_replace(";", "_", $hash);
1771  $ctrl->setParameter($this, "hash", $hash);
1772  $update_url = $ctrl->getLinkTarget($this, "updateWidget", "", true, false);
1773  $comps = array();
1774  if ($cnt > 0) {
1775  $c = $f->counter()->status((int) $cnt);
1776  $comps[] = $f->glyph()->comment()->withCounter($c)->withAdditionalOnLoadCode(function ($id) use ($hash, $update_url, $widget_el_id) {
1777  return "$(\"#$id\").click(function(event) { " . self::getListCommentsJSCall($hash, "ilNotes.updateWidget(\"" . $widget_el_id . "\",\"" . $update_url . "\");") . "});";
1778  });
1779  $comps[] = $f->divider()->vertical();
1780  $tpl->setVariable("GLYPH", $r->render($comps));
1781  $tpl->setVariable("TXT_LATEST", $lng->txt("notes_latest_comment"));
1782  }
1783 
1784 
1785  $b = $f->button()->shy($lng->txt("notes_add_edit_comment"), "#")->withAdditionalOnLoadCode(function ($id) use ($hash,$update_url,$widget_el_id) {
1786  return "$(\"#$id\").click(function(event) { " . self::getListCommentsJSCall($hash, "ilNotes.updateWidget(\"" . $widget_el_id . "\",\"" . $update_url . "\");") . "});";
1787  });
1788  if ($ctrl->isAsynch()) {
1789  $tpl->setVariable("SHY_BUTTON", $r->renderAsync($b));
1790  } else {
1791  $tpl->setVariable("SHY_BUTTON", $r->render($b));
1792  }
1793 
1794  $this->widget_header = $tpl->get();
1795 
1796  $this->hide_new_form = true;
1797  $this->only_latest = true;
1798  $this->no_actions = true;
1799  $html = "<div id='" . $widget_el_id . "'>" . $this->getNoteListHTML(IL_NOTE_PUBLIC) . "</div>";
1800  $ctrl->setParameter($this, "news_id", $_GET["news_id"]);
1801  return $html;
1802  }
getNoteListHTML($a_type=IL_NOTE_PRIVATE, $a_init_form=true)
get notes/comments list as html code
$_GET["client_id"]
$tpl
Definition: ilias.php:10
if(!array_key_exists('StateId', $_REQUEST)) $id
$r
Definition: example_031.php:79
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
special template class to simplify handling of ITX/PEAR
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
$html
Definition: example_001.php:87
+ 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 216 of file class.ilNoteGUI.php.

References $default_command.

Referenced by executeCommand().

217  {
218  return $this->default_command;
219  }
+ Here is the caller graph for this function:

◆ getHTML()

ilNoteGUI::getHTML ( )

Get HTML.

Parameters

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

References getCommentsWidget().

1737  {
1738  return $this->getCommentsWidget();
1739  }
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 1636 of file class.ilNoteGUI.php.

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

1637  {
1638  if ($a_update_code === null) {
1639  $a_update_code = "null";
1640  } else {
1641  $a_update_code = "'" . $a_update_code . "'";
1642  }
1643 
1644  return "ilNotes.listComments(event, '" . $a_hash . "', " . $a_update_code . ");";
1645  }
+ 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 1618 of file class.ilNoteGUI.php.

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

1619  {
1620  if ($a_update_code === null) {
1621  $a_update_code = "null";
1622  } else {
1623  $a_update_code = "'" . $a_update_code . "'";
1624  }
1625 
1626  return "ilNotes.listNotes(event, '" . $a_hash . "', " . $a_update_code . ");";
1627  }
+ 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 490 of file class.ilNoteGUI.php.

References $_GET, $_POST, $_SESSION, $a_type, $ctrl, $hide_new_form, $ilCtrl, $ilUser, $img, $lng, $mtype, $target, $text, $title, $tpl, $txt, $user, ilObject\_exists(), ilNote\_getNotesOfObject(), ilObjUser\_lookupLogin(), ilContainerReference\_lookupTitle(), ilObject\_lookupTitle(), checkDeletion(), checkEdit(), ilGlyphGUI\CLOSE, ilDatePresentation\formatDate(), ilGlyphGUI\get(), ilUtil\getImagePath(), ilUserUtil\getNamePresentation(), getSubObjectTitle(), IL_CAL_DATETIME, IL_NOTE_PRIVATE, IL_NOTE_PUBLIC, ilUtil\img(), initNoteForm(), renderLink(), renderTargets(), ilDatePresentation\setUseRelativeDates(), and ilDatePresentation\useRelativeDates().

Referenced by getCommentsWidget(), and getNotesHTML().

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

References $_GET, $ctrl, $ilCtrl, $ilSetting, $ilUser, $lng, $settings, $user, ilNote\commentsActivated(), exit, getNoteListHTML(), 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().

344  {
346  $lng = $this->lng;
349 
350  $lng->loadLanguageModule("notes");
351 
352  $ntpl = new ilTemplate(
353  "tpl.notes_and_comments.html",
354  true,
355  true,
356  "Services/Notes"
357  );
358 
359  // check, whether column is hidden due to processing in other column
360  $hide_comments = ($this->only == "notes");
361  $hide_notes = ($this->only == "comments");
362  switch ($ilCtrl->getCmd()) {
363  case "addNoteForm":
364  case "editNoteForm":
365  case "addNote":
366  case "updateNote":
367  if ($_GET["note_type"] == IL_NOTE_PRIVATE) {
368  $hide_comments = true;
369  }
370  if ($_GET["note_type"] == IL_NOTE_PUBLIC) {
371  $hide_notes = true;
372  }
373  break;
374  }
375 
376 
377  // temp workaround: only show comments (if both have been activated)
378  if ($this->private_enabled && $this->public_enabled
379  && $this->only != "notes") {
380  $this->private_enabled = false;
381  }
382 
383  $nodes_col = false;
384  if ($this->private_enabled && ($ilUser->getId() != ANONYMOUS_USER_ID)
385  && !$hide_notes) {
386  $ntpl->setCurrentBlock("notes_col");
387  $ntpl->setVariable("NOTES", $this->getNoteListHTML(IL_NOTE_PRIVATE, $a_init_form));
388  $ntpl->parseCurrentBlock();
389  $nodes_col = true;
390  }
391 
392  // #15948 - public enabled vs. comments_settings
393  $comments_col = false;
394  if ($this->public_enabled && (!$this->delete_note || $this->public_deletion_enabled || $ilSetting->get("comments_del_user", 0))
395  && !$hide_comments /* && $ilUser->getId() != ANONYMOUS_USER_ID */) {
396  $ntpl->setVariable("COMMENTS", $this->getNoteListHTML(IL_NOTE_PUBLIC, $a_init_form));
397  $comments_col = true;
398  }
399 
400  // Comments Settings
401  if ($this->comments_settings && !$hide_comments && !$this->delete_note
402  && !$this->edit_note_form && !$this->add_note_form && $ilUser->getId() != ANONYMOUS_USER_ID) {
403  //$active = $notes_settings->get("activate_".$id);
404  $active = ilNote::commentsActivated($this->rep_obj_id, $this->obj_id, $this->obj_type);
405 
406  if ($active) {
407  if ($this->news_id == 0) {
408  $this->renderLink(
409  $ntpl,
410  "comments_settings",
411  $lng->txt("notes_deactivate_comments"),
412  "deactivateComments",
413  "notes_top"
414  );
415  }
416  $ntpl->setCurrentBlock("comments_settings2");
417  } else {
418  $this->renderLink(
419  $ntpl,
420  "comments_settings",
421  $lng->txt("notes_activate_comments"),
422  "activateComments",
423  "notes_top"
424  );
425  $ntpl->setCurrentBlock("comments_settings2");
426 
427  if ($this->ajax && !$comments_col) {
428  $ntpl->setVariable(
429  "COMMENTS_MESS",
430  $ntpl->getMessageHTML($lng->txt("comments_feature_currently_not_activated_for_object"), "info")
431  );
432  }
433  }
434  $ntpl->parseCurrentBlock();
435 
436  if (!$comments_col) {
437  $ntpl->setVariable("COMMENTS", "");
438  }
439 
440  $comments_col = true;
441  }
442 
443  if ($comments_col) {
444  $ntpl->setCurrentBlock("comments_col");
445  if ($nodes_col) {
446  // $ntpl->touchBlock("comments_style");
447  }
448  $ntpl->parseCurrentBlock();
449  }
450 
451  if ($this->ajax) {
452  echo $ntpl->get();
453  exit;
454  }
455 
456  return $ntpl->get();
457  }
getNoteListHTML($a_type=IL_NOTE_PRIVATE, $a_init_form=true)
get notes/comments list as html code
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
$_GET["client_id"]
renderLink($a_tpl, $a_var, $a_txt, $a_cmd, $a_anchor="")
Render a link.
global $ilCtrl
Definition: ilias.php:18
const IL_NOTE_PUBLIC
Definition: class.ilNote.php:6
special template class to simplify handling of ITX/PEAR
$ilUser
Definition: imgupload.php:18
exit
Definition: backend.php:16
global $ilSetting
Definition: privfeed.php:17
+ 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 331 of file class.ilNoteGUI.php.

References $ctrl, $ilCtrl, and getNotesHTML().

332  {
334  $ilCtrl->setParameter($this, "notes_only", "comments");
335  $this->only = "comments";
336  return $this->getNotesHTML($a_init_form = true);
337  }
getNotesHTML($a_init_form=true)
global $ilCtrl
Definition: ilias.php:18
+ Here is the call graph for this function:

◆ getOnlyNotesHTML()

ilNoteGUI::getOnlyNotesHTML ( )

Get only notes html.

Parameters

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

References $ctrl, $ilCtrl, and getNotesHTML().

318  {
320  $ilCtrl->setParameter($this, "notes_only", "notes");
321  $this->only = "notes";
322  return $this->getNotesHTML($a_init_form = true);
323  }
getNotesHTML($a_init_form=true)
global $ilCtrl
Definition: ilias.php:18
+ Here is the call graph for this function:

◆ getPDNoteHTML()

ilNoteGUI::getPDNoteHTML (   $note_id)

Note display for personal desktop.

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

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

1096  {
1097  $lng = $this->lng;
1098  $ilCtrl = $this->ctrl;
1099  $ilUser = $this->user;
1100 
1101  $tpl = new ilTemplate("tpl.pd_note.html", true, true, "Services/Notes");
1102  $note = new ilNote($note_id);
1103  $target = $note->getObject();
1104 
1105  if ($note->getAuthor() != $ilUser->getId()) {
1106  return;
1107  }
1108 
1109  $tpl->setCurrentBlock("edit_note");
1110  $ilCtrl->setParameterByClass("ilnotegui", "rel_obj", $target["rep_obj_id"]);
1111  $ilCtrl->setParameterByClass("ilnotegui", "note_id", $note_id);
1112  $ilCtrl->setParameterByClass("ilnotegui", "note_type", $note->getType());
1113  $tpl->setVariable(
1114  "LINK_EDIT_NOTE",
1115  $ilCtrl->getLinkTargetByClass(
1116  array("ilpersonaldesktopgui", "ilpdnotesgui", "ilnotegui"),
1117  "editNoteForm"
1118  )
1119  );
1120  $tpl->setVariable("TXT_EDIT_NOTE", $lng->txt("edit"));
1121  $tpl->parseCurrentBlock();
1122  $ilCtrl->clearParametersByClass("ilnotegui");
1123 
1124  // last edited
1125  if ($note->getUpdateDate() != null) {
1126  $tpl->setVariable("TXT_LAST_EDIT", $lng->txt("last_edited_on"));
1127  $tpl->setVariable(
1128  "DATE_LAST_EDIT",
1129  ilDatePresentation::formatDate(new ilDate($note->getUpdateDate(), IL_CAL_DATETIME))
1130  );
1131  } else {
1132  //$tpl->setVariable("TXT_CREATED", $lng->txt("create_date"));
1133  $tpl->setVariable(
1134  "VAL_DATE",
1135  ilDatePresentation::formatDate(new ilDate($note->getCreationDate(), IL_CAL_DATETIME))
1136  );
1137  }
1138 
1139  $tpl->setVariable("VAL_SUBJECT", $note->getSubject());
1140  $text = (trim($note->getText()) != "")
1141  ? nl2br($note->getText())
1142  : "<p class='subtitle'>" . $lng->txt("note_content_removed") . "</p>";
1143  $tpl->setVariable("NOTE_TEXT", $text);
1144  $tpl->setVariable("TARGET_OBJECTS", $this->renderTargets($note));
1145  return $tpl->get();
1146  }
const IL_CAL_DATETIME
$tpl
Definition: ilias.php:10
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
Note class.
global $ilCtrl
Definition: ilias.php:18
Class for single dates.
special template class to simplify handling of ITX/PEAR
$text
Definition: errorreport.php:18
$ilUser
Definition: imgupload.php:18
renderTargets($a_note)
show related objects as links
$target
Definition: test.php:19
+ 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 934 of file class.ilNoteGUI.php.

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

Referenced by getNoteListHTML(), and renderTargets().

935  {
936  $objDefinition = $this->obj_definition;
938 
939  $parent_type = ilObject::_lookupType($parent_obj_id);
940  $parent_class = "ilObj" . $objDefinition->getClassName($parent_type) . "GUI";
941  $parent_path = $ilCtrl->lookupClassPath($parent_class);
942  include_once $parent_path;
943  if (method_exists($parent_class, "lookupSubObjectTitle")) {
944  return call_user_func_array(array($parent_class, "lookupSubObjectTitle"), array($parent_obj_id, $sub_obj_id));
945  }
946  }
global $ilCtrl
Definition: ilias.php:18
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 1545 of file class.ilNoteGUI.php.

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

1546  {
1547  $ilUser = $this->user;
1548 
1549  $suffix = ($_GET["note_type"] == IL_NOTE_PRIVATE)
1550  ? "private"
1551  : "public";
1552  $ilUser->writePref("notes_" . $suffix, "n");
1553 
1554  return $this->getNotesHTML();
1555  }
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,
ilTemplate  $a_main_tpl = null 
)
static

Init javascript.

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

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

Referenced by ilQuestionBrowserTableGUI\__construct(), assQuestionGUI\addHeaderAction(), and ilObjectListGUI\prepareJsLinks().

1585  {
1586  global $DIC;
1587 
1588  if ($a_main_tpl != null) {
1589  $tpl = $a_main_tpl;
1590  } else {
1591  $tpl = $DIC["tpl"];
1592  }
1593  $lng = $DIC->language();
1594 
1595  $lng->loadLanguageModule("notes");
1596 
1597  include_once("./Services/UIComponent/Modal/classes/class.ilModalGUI.php");
1599 
1600  $lng->toJs(array("private_notes", "notes_public_comments"), $tpl);
1601 
1602  include_once("./Services/YUI/classes/class.ilYuiUtil.php");
1603  ilYuiUtil::initPanel(false, $tpl);
1604  include_once("./Services/jQuery/classes/class.iljQueryUtil.php");
1606  $tpl->addJavascript("./Services/Notes/js/ilNotes.js");
1607 
1608  $tpl->addOnLoadCode("ilNotes.setAjaxUrl('" . $a_ajax_url . "');");
1609  }
global $DIC
Definition: saml.php:7
$tpl
Definition: ilias.php:10
static initJS(ilTemplate $a_main_tpl=null)
Init javascript.
static initjQuery($a_tpl=null)
inits and adds the jQuery JS-File to the global or a passed template
static initPanel($a_resize=false, ilTemplate $a_main_tpl=null)
Init yui panel.
+ 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 997 of file class.ilNoteGUI.php.

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

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

998  {
999  $lng = $this->lng;
1000  $ilCtrl = $this->ctrl;
1001 
1002  $this->form_tpl = new ilTemplate("tpl.notes_edit.html", true, true, "Services/Notes");
1003  if ($a_note) {
1004  $this->form_tpl->setVariable("VAL_NOTE", ilUtil::prepareFormOutput($a_note->getText()));
1005  $this->form_tpl->setVariable("NOTE_ID", $a_note->getId());
1006  }
1007 
1008  if ($a_mode == "create") {
1009  $this->form_tpl->setVariable("TXT_CMD", ($a_type == IL_NOTE_PUBLIC)
1010  ? $lng->txt("note_add_comment")
1011  : $lng->txt("note_add_note"));
1012  $this->form_tpl->setVariable("CMD", "addNote");
1013  } else {
1014  $this->form_tpl->setVariable("TXT_CMD", ($a_type == IL_NOTE_PUBLIC)
1015  ? $lng->txt("note_update_comment")
1016  : $lng->txt("note_update_note"));
1017  $this->form_tpl->setVariable("CMD", "updateNote");
1018  }
1019 
1020  return;
1021  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
1022  $this->form = new ilPropertyFormGUI();
1023  $this->form->setOpenTag(false);
1024  $this->form->setCloseTag(false);
1025  $this->form->setDisableStandardMessage(true);
1026 
1027  // subject
1028  /* $ti = new ilTextInputGUI($this->lng->txt("subject"), "sub_note");
1029  $ti->setRequired(true);
1030  $ti->setMaxLength(200);
1031  $ti->setSize(40);
1032  if ($a_note)
1033  {
1034  $ti->setValue($a_note->getSubject());
1035  }
1036  $this->form->addItem($ti);*/
1037 
1038  // text
1039  // $ta = new ilTextAreaInputGUI(($a_type == IL_NOTE_PUBLIC)
1040  // ? $lng->txt("notes_comment")
1041  // : $lng->txt("note"), "note");
1042  $ta = new ilTextAreaInputGUI("", "note");
1043  $ta->setCols(40);
1044  $ta->setRows(4);
1045  if ($a_note) {
1046  $ta->setValue($a_note->getText());
1047  }
1048  $this->form->addItem($ta);
1049 
1050  // label
1051  /* $options = array(
1052  IL_NOTE_UNLABELED => $lng->txt("unlabeled"),
1053  IL_NOTE_QUESTION => $lng->txt("question"),
1054  IL_NOTE_IMPORTANT => $lng->txt("important"),
1055  IL_NOTE_PRO => $lng->txt("pro"),
1056  IL_NOTE_CONTRA => $lng->txt("contra"),
1057  );
1058  $si = new ilSelectInputGUI($this->lng->txt("notes_label"), "note_label");
1059  $si->setOptions($options);
1060  if ($a_note)
1061  {
1062  $si->setValue($a_note->getLabel());
1063  }
1064  $this->form->addItem($si); */
1065 
1066  // hidden note id
1067  if ($a_note) {
1068  $hi = new ilHiddenInputGUI("note_id");
1069  $hi->setValue($_GET["note_id"]);
1070  $this->form->addItem($hi);
1071  }
1072 
1073  // save and cancel commands
1074  if ($a_mode == "create") {
1075  $this->form->addCommandButton("addNote", $lng->txt("save"));
1076  /* $this->form->addCommandButton("cancelAddNote", $lng->txt("cancel"));
1077  $this->form->setTitle($a_type == IL_NOTE_PUBLIC
1078  ? $lng->txt("notes_add_comment")
1079  : $lng->txt("notes_add_note"));*/
1080  } else {
1081  $this->form->addCommandButton("updateNote", $lng->txt("save"));
1082  /* $this->form->addCommandButton("cancelUpdateNote", $lng->txt("cancel"));
1083  $this->form->setTitle($a_type == IL_NOTE_PUBLIC
1084  ? $lng->txt("notes_edit_comment")
1085  : $lng->txt("notes_edit_note"));*/
1086  }
1087 
1088  $ilCtrl->setParameter($this, "note_type", $a_type);
1089  $this->form->setFormAction($this->ctrl->getFormAction($this));
1090  }
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"]
global $ilCtrl
Definition: ilias.php:18
$a_type
Definition: workflow.php:92
This class represents a hidden form property in a property form.
const IL_NOTE_PUBLIC
Definition: class.ilNote.php:6
special template class to simplify handling of ITX/PEAR
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 1718 of file class.ilNoteGUI.php.

References $_SESSION.

1719  {
1720  $_SESSION["comments_sort_asc"] = 1;
1721  return $this->getNotesHtml();
1722  }
$_SESSION["AccountId"]

◆ listSortDesc()

ilNoteGUI::listSortDesc ( )
protected

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

References $_SESSION.

1725  {
1726  $_SESSION["comments_sort_asc"] = 0;
1727  return $this->getNotesHtml();
1728  }
$_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 1705 of file class.ilNoteGUI.php.

Referenced by addNote(), and updateNote().

1706  {
1707  if (is_array($this->observer) && count($this->observer) > 0) {
1708  foreach ($this->observer as $item) {
1709  $param = $a_note->getObject();
1710  $param["action"] = $a_action;
1711  $param["note_id"] = $a_note->getId();
1712 
1713  call_user_func_array($item, $param);
1714  }
1715  }
1716  }
+ Here is the caller graph for this function:

◆ printNotes()

ilNoteGUI::printNotes ( )

notes print view screen

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

References $tpl, exit, and getNotesHTML().

1517  {
1518  $tpl = new ilTemplate("tpl.main.html", true, true);
1519 
1520  $this->print = true;
1521  $this->multi_selection = false;
1522  $tpl->setVariable("CONTENT", $this->getNotesHTML());
1523  echo $tpl->get();
1524  exit;
1525  }
getNotesHTML($a_init_form=true)
$tpl
Definition: ilias.php:10
special template class to simplify handling of ITX/PEAR
exit
Definition: backend.php:16
+ 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 1664 of file class.ilNoteGUI.php.

References $ctrl, and $ilCtrl.

Referenced by getNoteListHTML(), and getNotesHTML().

1665  {
1666  $ilCtrl = $this->ctrl;
1667 
1668  $low_var = strtolower($a_var);
1669  $up_var = strtoupper($a_var);
1670 
1671  if ($this->ajax) {
1672  $a_tpl->setVariable("LINK_" . $up_var, "#");
1673  $oc = "onclick = \"ilNotes.cmdAjaxLink(event, '" .
1674  $ilCtrl->getLinkTargetByClass("ilnotegui", $a_cmd, "", true) .
1675  "');\"";
1676  $a_tpl->setVariable("ON_CLICK_" . $up_var, $oc);
1677  } else {
1678  $a_tpl->setVariable(
1679  "LINK_" . $up_var,
1680  $ilCtrl->getLinkTargetByClass("ilnotegui", $a_cmd, $a_anchor)
1681  );
1682  }
1683 
1684  $a_tpl->setCurrentBlock($low_var);
1685  $a_tpl->setVariable("TXT_" . $up_var, $a_txt);
1686  $a_tpl->parseCurrentBlock();
1687  }
global $ilCtrl
Definition: ilias.php:18
+ Here is the caller graph for this function:

◆ renderTargets()

ilNoteGUI::renderTargets (   $a_note)

show related objects as links

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

References $access, $additional, $ilUser, $location, $obj_definition, $path, $target, $title, $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().

1152  {
1153  $tree = $this->tree;
1154  $ilAccess = $this->access;
1155  $objDefinition = $this->obj_definition;
1156  $ilUser = $this->user;
1157 
1158  if (!$this->targets_enabled) {
1159  return "";
1160  }
1161 
1162  $a_note_id = $a_note->getId();
1163  $target = $a_note->getObject();
1164  $a_obj_type = $target["obj_type"];
1165  $a_obj_id = $target["obj_id"];
1166 
1167  $target_tpl = new ilTemplate("tpl.note_target_object.html", true, true, "Services/Notes");
1168 
1169  if ($target["rep_obj_id"] > 0) {
1170  // get all visible references of target object
1171 
1172  // repository
1173  $ref_ids = ilObject::_getAllReferences($target["rep_obj_id"]);
1174  if ($ref_ids) {
1175  $vis_ref_ids = array();
1176  foreach ($ref_ids as $ref_id) {
1177  if ($ilAccess->checkAccess("visible", "", $ref_id)) {
1178  $vis_ref_ids[] = $ref_id;
1179  }
1180  }
1181 
1182  // output links to targets
1183  if (count($vis_ref_ids) > 0) {
1184  foreach ($vis_ref_ids as $vis_ref_id) {
1185  $type = ilObject::_lookupType($vis_ref_id, true);
1186  $title = ilObject::_lookupTitle($target["rep_obj_id"]);
1187 
1188  $sub_link = $sub_title = "";
1189  if ($type == "sahs") { // bad hack, needs general procedure
1190  $link = "goto.php?target=sahs_" . $vis_ref_id;
1191  if ($a_obj_type == "sco" || $a_obj_type == "seqc" || $a_obj_type == "chap" || $a_obj_type == "pg") {
1192  $sub_link = "goto.php?target=sahs_" . $vis_ref_id . "_" . $a_obj_id;
1193  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
1194  $sub_title = ilSCORM2004Node::_lookupTitle($a_obj_id);
1195  }
1196  } elseif ($type == "poll") {
1197  include_once "Services/Link/classes/class.ilLink.php";
1198  $link = ilLink::_getLink($vis_ref_id, "poll");
1199  } elseif ($a_obj_type != "pg") {
1200  if (!is_object($this->item_list_gui[$type])) {
1201  $class = $objDefinition->getClassName($type);
1202  $location = $objDefinition->getLocation($type);
1203  $full_class = "ilObj" . $class . "ListGUI";
1204  include_once($location . "/class." . $full_class . ".php");
1205  $this->item_list_gui[$type] = new $full_class();
1206  }
1207 
1208  // for references, get original title
1209  // (link will lead to orignal, which basically is wrong though)
1210  if ($a_obj_type == "crsr" || $a_obj_type == "catr" || $a_obj_type == "grpr") {
1211  include_once "Services/ContainerReference/classes/class.ilContainerReference.php";
1212  $tgt_obj_id = ilContainerReference::_lookupTargetId($target["rep_obj_id"]);
1213  $title = ilObject::_lookupTitle($tgt_obj_id);
1214  }
1215  $this->item_list_gui[$type]->initItem($vis_ref_id, $target["rep_obj_id"], $title);
1216  $link = $this->item_list_gui[$type]->getCommandLink("infoScreen");
1217 
1218  // workaround, because # anchor can't be passed through frameset
1219  $link = ilUtil::appendUrlParameterString($link, "anchor=note_" . $a_note_id);
1220 
1221  $link = $this->item_list_gui[$type]->appendRepositoryFrameParameter($link) . "#note_" . $a_note_id;
1222  } else {
1223  $title = ilObject::_lookupTitle($target["rep_obj_id"]);
1224  $link = "goto.php?target=pg_" . $a_obj_id . "_" . $vis_ref_id;
1225  }
1226 
1227  $par_id = $tree->getParentId($vis_ref_id);
1228 
1229  // sub object link
1230  if ($sub_link != "") {
1231  if ($this->export_html || $this->print) {
1232  $target_tpl->setCurrentBlock("exp_target_sub_object");
1233  } else {
1234  $target_tpl->setCurrentBlock("target_sub_object");
1235  $target_tpl->setVariable("LINK_SUB_TARGET", $sub_link);
1236  }
1237  $target_tpl->setVariable("TXT_SUB_TARGET", $sub_title);
1238  $target_tpl->parseCurrentBlock();
1239  }
1240 
1241  // container and object link
1242  if ($this->export_html || $this->print) {
1243  $target_tpl->setCurrentBlock("exp_target_object");
1244  } else {
1245  $target_tpl->setCurrentBlock("target_object");
1246  $target_tpl->setVariable("LINK_TARGET", $link);
1247  }
1248  $target_tpl->setVariable(
1249  "TXT_CONTAINER",
1251  ilObject::_lookupObjId($par_id)
1252  )
1253  );
1254  $target_tpl->setVariable("TXT_TARGET", $title);
1255 
1256  $target_tpl->parseCurrentBlock();
1257  }
1258  $target_tpl->touchBlock("target_objects");
1259  }
1260  }
1261  // personal workspace
1262  else {
1263  // we only need 1 instance
1264  if (!$this->wsp_tree) {
1265  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
1266  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
1267  $this->wsp_tree = new ilWorkspaceTree($ilUser->getId());
1268  $this->wsp_access_handler = new ilWorkspaceAccessHandler($this->wsp_tree);
1269  }
1270  $node_id = $this->wsp_tree->lookupNodeId($target["rep_obj_id"]);
1271  if ($this->wsp_access_handler->checkAccess("visible", "", $node_id)) {
1272  $path = $this->wsp_tree->getPathFull($node_id);
1273  if ($path) {
1274  $item = array_pop($path);
1275  $parent = array_pop($path);
1276 
1277  if (!$parent["title"]) {
1278  $parent["title"] = $this->lng->txt("wsp_personal_workspace");
1279  }
1280 
1281  // sub-objects
1282  $additional = null;
1283  if ($a_obj_id) {
1284  $sub_title = $this->getSubObjectTitle($target["rep_obj_id"], $a_obj_id);
1285  if ($sub_title) {
1286  $item["title"] .= " (" . $sub_title . ")";
1287  $additional = "_" . $a_obj_id;
1288  }
1289  }
1290 
1291  $link = ilWorkspaceAccessHandler::getGotoLink($node_id, $target["rep_obj_id"], $additional);
1292  }
1293  // shared resource
1294  else {
1295  $owner = ilObject::_lookupOwner($target["rep_obj_id"]);
1296  $parent["title"] = $this->lng->txt("wsp_tab_shared") .
1297  " (" . ilObject::_lookupOwnerName($owner) . ")";
1298  $item["title"] = ilObject::_lookupTitle($target["rep_obj_id"]);
1299  $link = "ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToWorkspace&dsh=" .
1300  $owner;
1301  }
1302 
1303  // container and object link
1304  if ($this->export_html || $this->print) {
1305  $target_tpl->setCurrentBlock("exp_target_object");
1306  } else {
1307  $target_tpl->setCurrentBlock("target_object");
1308  $target_tpl->setVariable("LINK_TARGET", $link);
1309  }
1310 
1311 
1312  // :TODO: no images in template ?
1313 
1314  $target_tpl->setVariable("TXT_CONTAINER", $parent["title"]);
1315 
1316  $target_tpl->setVariable("TXT_TARGET", $item["title"]);
1317 
1318  $target_tpl->parseCurrentBlock();
1319  }
1320  }
1321  }
1322  return $target_tpl->get();
1323  }
static _lookupTitle($a_obj_id)
Lookup Title.
$path
Definition: aliased.php:25
$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)
special template class to simplify handling of ITX/PEAR
$ilUser
Definition: imgupload.php:18
static _lookupOwner($a_id)
lookup object owner
$additional
Definition: goto.php:50
static _lookupType($a_id, $a_reference=false)
lookup object type
$target
Definition: test.php:19
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 206 of file class.ilNoteGUI.php.

Referenced by ilNewsTimelineItemGUI\renderFooter().

207  {
208  $this->default_command = $a_val;
209  }
+ Here is the caller graph for this function:

◆ setRepositoryMode()

ilNoteGUI::setRepositoryMode (   $a_value)

Set repository mode.

Parameters
bool$a_value

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

Referenced by __construct().

306  {
307  $this->repository_mode = (bool) $a_value;
308  }
+ Here is the caller graph for this function:

◆ showAllPublicNotes()

ilNoteGUI::showAllPublicNotes ( )

show all public notes to user

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

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

1561  {
1562  $ilUser = $this->user;
1563 
1564  $ilUser->writePref("notes_pub_all", "y");
1565 
1566  return $this->getNotesHTML();
1567  }
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 1572 of file class.ilNoteGUI.php.

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

1573  {
1574  $ilUser = $this->user;
1575 
1576  $ilUser->writePref("notes_pub_all", "n");
1577 
1578  return $this->getNotesHTML();
1579  }
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 1530 of file class.ilNoteGUI.php.

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

1531  {
1532  $ilUser = $this->user;
1533 
1534  $suffix = ($_GET["note_type"] == IL_NOTE_PRIVATE)
1535  ? "private"
1536  : "public";
1537  $ilUser->writePref("notes_" . $suffix, "y");
1538 
1539  return $this->getNotesHTML();
1540  }
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 1394 of file class.ilNoteGUI.php.

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

1395  {
1396  $ilUser = $this->user;
1397  $lng = $this->lng;
1398  $ilCtrl = $this->ctrl;
1399 
1400  $note = new ilNote(ilUtil::stripSlashes($_POST["note_id"]));
1401  $this->initNoteForm(
1402  "edit",
1403  $note->getType(),
1404  $note
1405  );
1406 
1407  // if ($this->form->checkInput())
1408  // if ($_POST["note"] != "")
1409  // {
1410  $note->setText(ilUtil::stripSlashes($_POST["note"]));
1411  $note->setSubject(ilUtil::stripSlashes($_POST["sub_note"]));
1412  $note->setLabel(ilUtil::stripSlashes($_POST["note_label"]));
1413  if ($this->checkEdit($note)) {
1414  $note->update();
1415 
1416  $this->notifyObserver("update", $note);
1417 
1418  $ilCtrl->setParameter($this, "note_mess", "mod");
1419  }
1420  $ilCtrl->redirect($this, "showNotes", "notes_top", $this->ajax);
1421  // }
1422  $ilCtrl->redirect($this, "showNotes", "notes_top", $this->ajax);
1423  $this->note_mess = "frmfld";
1424  $this->form->setValuesByPost();
1425  $_GET["note_id"] = $note->getId();
1426  $_GET["note_type"] = $note->getType();
1427  return $this->editNoteForm(false);
1428  }
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.
global $ilCtrl
Definition: ilias.php:18
$ilUser
Definition: imgupload.php:18
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.
$_POST["username"]
+ Here is the call graph for this function:

◆ updateWidget()

ilNoteGUI::updateWidget ( )
protected

Update widget.

Parameters

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

References exit, and getCommentsWidget().

1811  {
1812  echo $this->getCommentsWidget();
1813  exit;
1814  }
exit
Definition: backend.php:16
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().

◆ $hide_new_form

ilNoteGUI::$hide_new_form = false
protected

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

Referenced by getNoteListHTML().

◆ $lng

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

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

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