ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
All Data Structures Namespaces Files Functions Variables Modules Pages
ilNoteGUI Class Reference

Notes GUI class. More...

+ Collaboration diagram for ilNoteGUI:

Public Member Functions

 ilNoteGUI ($a_rep_obj_id="", $a_obj_id="", $a_obj_type="", $a_include_subobjects=false)
 constructor, specifies notes set 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...
 
 showTargets (&$tpl, $a_rep_obj_id, $a_note_id, $a_obj_type, $a_obj_id)
 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...
 
 initJavascript ($a_ajax_url)
 Init javascript. More...
 
 getListNotesJSCall ($a_hash, $a_update_code=null)
 Get list notes js call. More...
 
 getListCommentsJSCall ($a_hash, $a_update_code=null)
 Get list comments js call. More...
 
 renderLink ($a_tpl, $a_var, $a_txt, $a_cmd, $a_anchor="")
 Render a link. More...
 
 addObserver ($a_callback)
 Add observer. More...
 

Data Fields

 $public_deletion_enabled = false
 
 $repository_mode = 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 ()
 

Static Protected Member Functions

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

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.

Member Function Documentation

◆ activateComments()

ilNoteGUI::activateComments ( )

Activate Comments.

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

References $ilCtrl, and ilNote\activateComments().

357  {
358  global $ilCtrl;
359 
360  $notes_settings = new ilSetting("notes");
361 
362  if ($this->comments_settings)
363  {
364  $id = $this->rep_obj_id."_".$this->obj_id."_".$this->obj_type;
365  //$notes_settings->set("activate_".$id, 1);
366  ilNote::activateComments($this->rep_obj_id, $this->obj_id, $this->obj_type, true);
367  }
368 
369  $ilCtrl->redirectByClass("ilnotegui", "showNotes", "", $this->ajax);
370 // $ilCtrl->redirectByClass("ilnotegui", "getNotesHtml", "", $this->ajax);
371  }
ILIAS Setting Class.
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 1379 of file class.ilNoteGUI.php.

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

1380  {
1381  global $ilUser, $lng, $ilCtrl;
1382 
1383  $this->initNoteForm("create", $_GET["note_type"]);
1384 
1385  //if ($this->form->checkInput())
1386  if ($_POST["note"] != "")
1387  {
1388  $note = new ilNote();
1389  $note->setObject($this->obj_type, $this->rep_obj_id, $this->obj_id);
1390  $note->setInRepository($this->repository_mode);
1391  $note->setType($_GET["note_type"]);
1392  $note->setAuthor($ilUser->getId());
1393  $note->setText(ilUtil::stripslashes($_POST["note"]));
1394 // $note->setSubject($_POST["sub_note"]);
1395 // $note->setLabel($_POST["note_label"]);
1396  $note->create();
1397 
1398  $this->notifyObserver("new", $note);
1399 
1400  $ilCtrl->setParameter($this, "note_mess", "mod");
1401 // $ilCtrl->redirect($this, "showNotes", "notes_top", $this->ajax);
1402  }
1403  $ilCtrl->redirect($this, "showNotes", "notes_top", $this->ajax);
1404 // $this->note_mess = "frmfld";
1405 // $this->form->setValuesByPost();
1406 // return $this->addNoteForm(false);;
1407  }
initNoteForm($a_mode="edit", $a_type, $a_note=null)
Init note form.
$_POST['username']
Definition: cron.php:12
$_GET["client_id"]
Note class.
global $ilCtrl
Definition: ilias.php:18
notifyObserver($a_action, $a_note)
Notify observers on update/create.
global $ilUser
Definition: imgupload.php:15
global $lng
Definition: privfeed.php:40
+ 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 1347 of file class.ilNoteGUI.php.

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

1348  {
1349  global $ilUser;
1350 
1351  $suffix = ($_GET["note_type"] == IL_NOTE_PRIVATE)
1352  ? "private"
1353  : "public";
1354  $ilUser->setPref("notes_".$suffix, "y");
1355 
1356  $this->add_note_form = true;
1357  return $this->getNotesHTML($a_init_form);
1358  }
getNotesHTML($a_init_form=true)
const IL_NOTE_PRIVATE
Definition: class.ilNote.php:4
$_GET["client_id"]
global $ilUser
Definition: imgupload.php:15
+ Here is the call graph for this function:

◆ addObserver()

ilNoteGUI::addObserver (   $a_callback)

Add observer.

Parameters
string | array$a_callback

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

1707  {
1708  $this->observer[] = $a_callback;
1709  }

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

1668  {
1669  return $a_node_type.";".$a_node_id.";".$a_sub_id.";".$a_sub_type;
1670  }

◆ cancelAddNote()

ilNoteGUI::cancelAddNote ( )

cancel add note

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

References getNotesHTML().

1364  {
1365  return $this->getNotesHTML();
1366  }
getNotesHTML($a_init_form=true)
+ Here is the call graph for this function:

◆ cancelDelete()

ilNoteGUI::cancelDelete ( )

cancel deletion of note

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

References getNotesHTML().

1488  {
1489  return $this->getNotesHTML();
1490  }
getNotesHTML($a_init_form=true)
+ Here is the call graph for this function:

◆ cancelUpdateNote()

ilNoteGUI::cancelUpdateNote ( )

cancel edit note

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

References getNotesHTML().

1372  {
1373  return $this->getNotesHTML();
1374  }
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 924 of file class.ilNoteGUI.php.

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

Referenced by confirmDelete(), and getNoteListHTML().

925  {
926  global $ilUser, $ilSetting;
927 
928  if ($ilUser->getId() == ANONYMOUS_USER_ID)
929  {
930  return false;
931  }
932 
933  $is_author = ($a_note->getAuthor() == $ilUser->getId());
934 
935  if ($a_note->getType() == IL_NOTE_PRIVATE && $is_author)
936  {
937  return true;
938  }
939 
940  if ($a_note->getType() == IL_NOTE_PUBLIC && $this->public_deletion_enabled)
941  {
942  return true;
943  }
944 
945  if ($a_note->getType() == IL_NOTE_PUBLIC && $is_author && $ilSetting->get("comments_del_user", 0))
946  {
947  return true;
948  }
949 
950  return false;
951  }
const IL_NOTE_PRIVATE
Definition: class.ilNote.php:4
const IL_NOTE_PUBLIC
Definition: class.ilNote.php:5
global $ilUser
Definition: imgupload.php:15
global $ilSetting
Definition: privfeed.php:40
+ Here is the caller graph for this function:

◆ checkEdit()

ilNoteGUI::checkEdit (   $a_note)

Check edit.

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

References $ilUser.

Referenced by getNoteListHTML(), and updateNote().

957  {
958  global $ilUser;
959 
960  if ($a_note->getAuthor() == $ilUser->getId()
961  && ($ilUser->getId() != ANONYMOUS_USER_ID))
962  {
963  return true;
964  }
965  return false;
966  }
global $ilUser
Definition: imgupload.php:15
+ Here is the caller graph for this function:

◆ confirmDelete()

ilNoteGUI::confirmDelete ( )

cancel deletion of note

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

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

1496  {
1497  global $ilCtrl, $lng, $ilUser;
1498 
1499  $cnt = 0;
1500  foreach($_POST["note"] as $id)
1501  {
1502  $note = new ilNote($id);
1503  if ($this->checkDeletion($note))
1504  {
1505  $note->delete();
1506  $cnt++;
1507  }
1508  }
1509  if ($cnt > 1)
1510  {
1511  $ilCtrl->setParameter($this, "note_mess", "ntsdel");
1512  }
1513  else
1514  {
1515  $ilCtrl->setParameter($this, "note_mess", "ntdel");
1516  }
1517  $ilCtrl->redirect($this, "showNotes", "notes_top", $this->ajax);
1518  }
checkDeletion($a_note)
Check whether deletion is allowed.
$_POST['username']
Definition: cron.php:12
Note class.
global $ilCtrl
Definition: ilias.php:18
global $ilUser
Definition: imgupload.php:15
global $lng
Definition: privfeed.php:40
+ Here is the call graph for this function:

◆ deactivateComments()

ilNoteGUI::deactivateComments ( )

Deactivate Comments.

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

References $ilCtrl, and ilNote\activateComments().

377  {
378  global $ilCtrl;
379 
380  $notes_settings = new ilSetting("notes");
381 
382  if ($this->comments_settings)
383  {
384  $id = $this->rep_obj_id."_".$this->obj_id."_".$this->obj_type;
385  //$notes_settings->set("activate_".$id, 0);
386  ilNote::activateComments($this->rep_obj_id, $this->obj_id, $this->obj_type, false);
387  }
388 
389  $ilCtrl->redirectByClass("ilnotegui", "showNotes", "", $this->ajax);
390  //$ilCtrl->redirectByClass("ilnotegui", "getNotesHtml", "", $this->ajax);
391  }
ILIAS Setting Class.
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 1457 of file class.ilNoteGUI.php.

References getNotesHTML().

1458  {
1459  $this->delete_note = true;
1460  $this->note_mess = "qdel";
1461  return $this->getNotesHTML();
1462  }
getNotesHTML($a_init_form=true)
+ Here is the call graph for this function:

◆ deleteNotes()

ilNoteGUI::deleteNotes ( )

delete notes confirmation

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

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

1468  {
1469  global $lng;
1470 
1471  if (!$_POST["note"])
1472  {
1473  $this->note_mess = "noc";
1474  }
1475  else
1476  {
1477  $this->delete_note = true;
1478  $this->note_mess = "qdel";
1479  }
1480 
1481  return $this->getNotesHTML();
1482  }
getNotesHTML($a_init_form=true)
$_POST['username']
Definition: cron.php:12
global $lng
Definition: privfeed.php:40
+ 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 1447 of file class.ilNoteGUI.php.

References getNotesHTML().

Referenced by updateNote().

1448  {
1449  $this->edit_note_form = true;
1450 
1451  return $this->getNotesHTML($a_init_form);
1452  }
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 193 of file class.ilNoteGUI.php.

194  {
195  $this->anchor_jump = $a_enable;
196  }

◆ enableCommentsSettings()

ilNoteGUI::enableCommentsSettings (   $a_enable = true)

enable private notes

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

154  {
155  $this->comments_settings = $a_enable;
156  }

◆ enableHiding()

ilNoteGUI::enableHiding (   $a_enable = true)

enable hiding

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

170  {
171  $this->enable_hiding = $a_enable;
172  }

◆ enableMultiSelection()

ilNoteGUI::enableMultiSelection (   $a_enable = true)

enable multi selection (checkboxes and commands)

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

186  {
187  $this->multi_selection = $a_enable;
188  }

◆ enablePrivateNotes()

ilNoteGUI::enablePrivateNotes (   $a_enable = true)

enable private notes

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

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

138  {
139  $this->private_enabled = $a_enable;
140  }
+ Here is the caller graph for this function:

◆ enablePublicNotes()

ilNoteGUI::enablePublicNotes (   $a_enable = true)

enable public notes

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

Referenced by ilInfoScreenGUI\showNotesSection().

146  {
147  $this->public_enabled = $a_enable;
148  }
+ Here is the caller graph for this function:

◆ enablePublicNotesDeletion()

ilNoteGUI::enablePublicNotesDeletion (   $a_enable = true)

enable public notes

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

Referenced by ilLMPresentationGUI\ilLMNotes().

162  {
163  $this->public_deletion_enabled = $a_enable;
164  }
+ Here is the caller graph for this function:

◆ enableTargets()

ilNoteGUI::enableTargets (   $a_enable = true)

enable target objects

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

178  {
179  $this->targets_enabled = $a_enable;
180  }

◆ executeCommand()

& ilNoteGUI::executeCommand ( )

execute command

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

References $cmd.

122  {
123  $cmd = $this->ctrl->getCmd("getNotesHTML");
124  $next_class = $this->ctrl->getNextClass($this);
125 
126  switch($next_class)
127  {
128  default:
129  return $this->$cmd();
130  break;
131  }
132  }
$cmd
Definition: sahs_server.php:35

◆ exportNotesHTML()

ilNoteGUI::exportNotesHTML ( )

export selected notes to html

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

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

1524  {
1525  $tpl = new ilTemplate("tpl.main.html", true, true);
1526 
1527  $this->export_html = true;
1528  $this->multi_selection = false;
1529  $tpl->setVariable("CONTENT", $this->getNotesHTML());
1530  ilUtil::deliverData($tpl->get(), "notes.html");
1531  }
getNotesHTML($a_init_form=true)
static deliverData($a_data, $a_filename, $mime="application/octet-stream", $charset="")
deliver data for download via browser.
global $tpl
Definition: ilias.php:8
special template class to simplify handling of ITX/PEAR
+ Here is the call graph for this function:

◆ getListCommentsJSCall()

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

Get list comments js call.

Parameters
string$a_hash
string$a_update_code
Returns
string

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

Referenced by ilDataCollectionRecordListTableGUI\getCommentsAjaxLink(), ilObjectListGUI\getHeaderAction(), ilDataCollectionRecord\getStandardFieldHTML(), ilObjectListGUI\insertCommonSocialCommands(), and ilObjectListGUI\insertProperties().

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

◆ getListNotesJSCall()

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

Get list notes js call.

Parameters
string$a_hash
string$a_update_code
Returns
string

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

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

1624  {
1625  if ($a_update_code === null)
1626  {
1627  $a_update_code = "null";
1628  }
1629  else
1630  {
1631  $a_update_code = "'".$a_update_code."'";
1632  }
1633 
1634  return "ilNotes.listNotes(event, '".$a_hash."', ".$a_update_code.");";
1635  }
+ 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 396 of file class.ilNoteGUI.php.

References $_GET, $_POST, $_SESSION, $ilCtrl, $ilUser, $img, $lng, $tpl, $txt, ilObject\_exists(), ilObject\_getIcon(), ilNote\_getNotesOfObject(), ilObjUser\_getPersonalPicturePath(), ilObjUser\_lookupLogin(), ilContainerReference\_lookupTitle(), ilObject\_lookupTitle(), checkDeletion(), checkEdit(), ilGlyphGUI\CLOSE, ilDatePresentation\formatDate(), ilGlyphGUI\get(), ilUtil\getImagePath(), ilUserUtil\getNamePresentation(), getSubObjectTitle(), IL_CAL_DATETIME, IL_NOTE_CONTRA, IL_NOTE_IMPORTANT, IL_NOTE_PRIVATE, IL_NOTE_PRO, IL_NOTE_PUBLIC, IL_NOTE_QUESTION, IL_NOTE_UNLABELED, ilUtil\img(), initNoteForm(), renderLink(), ilDatePresentation\setUseRelativeDates(), showTargets(), and ilDatePresentation\useRelativeDates().

Referenced by getNotesHTML().

397  {
398  global $lng, $ilCtrl, $ilUser;
399 
400  include_once("./Services/User/classes/class.ilUserUtil.php");
401 
402  $suffix = ($a_type == IL_NOTE_PRIVATE)
403  ? "private"
404  : "public";
405 
406  /* user settings are deprecated
407  $user_setting_notes_public_all = $ilUser->getPref("notes_pub_all");
408  $user_setting_notes_by_type = $ilUser->getPref("notes_".$suffix);
409  */
410  $user_setting_notes_public_all = "y";
411  $user_setting_notes_by_type = "y";
412 
413  if ($this->delete_note || $this->export_html || $this->print)
414  {
415  if ($_GET["note_id"] != "")
416  {
417  $filter = $_GET["note_id"];
418  }
419  else
420  {
421  $filter = $_POST["note"];
422  }
423  }
424 
425  $notes = ilNote::_getNotesOfObject($this->rep_obj_id, $this->obj_id,
426  $this->obj_type, $a_type, $this->inc_sub, $filter,
427  $user_setting_notes_public_all, $this->repository_mode, (bool)$_SESSION["comments_sort_asc"]);
428 
429  $all_notes = ilNote::_getNotesOfObject($this->rep_obj_id, $this->obj_id,
430  $this->obj_type, $a_type, $this->inc_sub, $filter,
431  "", $this->repository_mode);
432 
433  $tpl = new ilTemplate("tpl.notes_list.html", true, true, "Services/Notes");
434 
435  if ($this->ajax)
436  {
437  include_once("./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php");
438  $tpl->setCurrentBlock("close_img");
439  $tpl->setVariable("CLOSE_IMG", ilGlyphGUI::get(ilGlyphGUI::CLOSE));
440  $tpl->parseCurrentBlock();
441  }
442 
443  // show counter if notes are hidden
444  $cnt_str = (count($all_notes) > 0)
445  ? " (".count($all_notes).")"
446  : "";
447 
448  // title
449  if ($this->ajax)
450  {
451  switch($this->obj_type)
452  {
453  case "catr":
454  case "crsr":
455  include_once "Services/ContainerReference/classes/class.ilContainerReference.php";
456  $title = ilContainerReference::_lookupTitle($this->rep_obj_id);
457  break;
458 
459  default:
460  $title = ilObject::_lookupTitle($this->rep_obj_id);
461  break;
462  }
463 
464  $img = ilUtil::img(ilObject::_getIcon($this->rep_obj_id, "tiny"));
465 
466  // add sub-object if given
467  if($this->obj_id)
468  {
469  $sub_title = $this->getSubObjectTitle($this->rep_obj_id, $this->obj_id);
470  if($sub_title)
471  {
472  $title .= " - ".$sub_title;
473  }
474  }
475 
476  $tpl->setCurrentBlock("title");
477  $tpl->setVariable("TITLE", $img." ".$title);
478  $tpl->parseCurrentBlock();
479  }
480 
481  if ($this->delete_note)
482  {
483  $cnt_str = "";
484  }
485  if ($a_type == IL_NOTE_PRIVATE)
486  {
487  $tpl->setVariable("TXT_NOTES", $lng->txt("private_notes").$cnt_str);
488  $ilCtrl->setParameterByClass("ilnotegui", "note_type", IL_NOTE_PRIVATE);
489  }
490  else
491  {
492  $tpl->setVariable("TXT_NOTES", $lng->txt("notes_public_comments").$cnt_str);
493  $ilCtrl->setParameterByClass("ilnotegui", "note_type", IL_NOTE_PUBLIC);
494  }
495  $anch = $this->anchor_jump
496  ? "notes_top"
497  : "";
498  $tpl->setVariable("FORMACTION", $ilCtrl->getFormAction($this, "getNotesHTML", $anch));
499  if ($this->ajax)
500  {
501  $os = "onsubmit = \"ilNotes.cmdAjaxForm(event, '".
502  $ilCtrl->getFormActionByClass("ilnotegui", "", "", true).
503  "'); return false;\"";
504  $tpl->setVariable("ON_SUBMIT_FORM", $os);
505  $tpl->setVariable("FORM_ID", "Ajax");
506  }
507 
508  if ($this->export_html || $this->print)
509  {
510  $tpl->touchBlock("print_style");
511  }
512 
513  // show add new note button
514  if (!$this->add_note_form && !$this->edit_note_form && !$this->delete_note &&
515  !$this->export_html && !$this->print && $ilUser->getId() != ANONYMOUS_USER_ID)
516  {
517  if (!$this->inc_sub) // we cannot offer add button if aggregated notes
518  { // are displayed
519  if ($this->rep_obj_id > 0 || $a_type != IL_NOTE_PUBLIC)
520  {
521  $tpl->setCurrentBlock("add_note_btn");
522  if ($a_type == IL_NOTE_PUBLIC)
523  {
524  $tpl->setVariable("TXT_ADD_NOTE", $lng->txt("notes_add_comment"));
525  }
526  else
527  {
528  $tpl->setVariable("TXT_ADD_NOTE", $lng->txt("add_note"));
529  }
530  $tpl->setVariable("LINK_ADD_NOTE", $ilCtrl->getLinkTargetByClass("ilnotegui", "addNoteForm").
531  "#note_edit");
532  $tpl->parseCurrentBlock();
533  }
534  }
535  }
536 
537  // show show/hide button for note list
538  if (count($all_notes) > 0 && $this->enable_hiding && !$this->delete_note
539  && !$this->export_html && !$this->print && !$this->edit_note_form
540  && !$this->add_note_form)
541  {
542  if ($user_setting_notes_by_type == "n")
543  {
544  if ($a_type == IL_NOTE_PUBLIC)
545  {
546  $txt = $lng->txt("notes_show_comments");
547  }
548  else
549  {
550  $txt = $lng->txt("show_".$suffix."_notes");
551  }
552  $this->renderLink($tpl, "show_notes", $txt, "showNotes", "notes_top");
553  }
554  else
555  {
556  // never individually hide for anonymous users
557  if (($ilUser->getId() != ANONYMOUS_USER_ID))
558  {
559  if ($a_type == IL_NOTE_PUBLIC)
560  {
561  $txt = $lng->txt("notes_hide_comments");
562  }
563  else
564  {
565  $txt = $lng->txt("hide_".$suffix."_notes");
566  }
567  $this->renderLink($tpl, "hide_notes", $txt, "hideNotes", "notes_top");
568 
569  // show all public notes / my notes only switch
570  if ($a_type == IL_NOTE_PUBLIC)
571  {
572  if ($user_setting_notes_public_all == "n")
573  {
574  $this->renderLink($tpl, "all_pub_notes", $lng->txt("notes_all_comments"),
575  "showAllPublicNotes", "notes_top");
576  }
577  else
578  {
579  $this->renderLink($tpl, "my_pub_notes", $lng->txt("notes_my_comments"),
580  "showMyPublicNotes", "notes_top");
581  }
582  }
583  }
584  }
585  }
586 
587  // show add new note text area
588  if (!$this->edit_note_form && $user_setting_notes_by_type != "n" &&
589  !$this->delete_note && $ilUser->getId() != ANONYMOUS_USER_ID)
590  {
591  if ($a_init_form)
592  {
593  $this->initNoteForm("create", $a_type);
594  }
595 
596  $tpl->setCurrentBlock("edit_note_form");
597 // $tpl->setVariable("EDIT_FORM", $this->form->getHTML());
598  $tpl->setVariable("EDIT_FORM", $this->form_tpl->get());
599  $tpl->parseCurrentBlock();
600 
601  $tpl->parseCurrentBlock();
602  $tpl->setCurrentBlock("note_row");
603  $tpl->parseCurrentBlock();
604  }
605 
606  // list all notes
607  if ($user_setting_notes_by_type != "n" || !$this->enable_hiding)
608  {
611 
612  if(sizeof($notes))
613  {
614  if((int)$_SESSION["comments_sort_asc"] == 1)
615  {
616  $sort_txt = $lng->txt("notes_sort_desc");
617  $sort_cmd = "listSortDesc";
618  }
619  else
620  {
621  $sort_txt = $lng->txt("notes_sort_asc");
622  $sort_cmd = "listSortAsc";
623  }
624  $this->renderLink($tpl, "sort_list", $sort_txt, $sort_cmd, $anch);
625  }
626 
627  $notes_given = false;
628  foreach($notes as $note)
629  {
630  if ($this->edit_note_form && ($note->getId() == $_GET["note_id"])
631  && $a_type == $_GET["note_type"])
632  {
633  if ($a_init_form)
634  {
635  $this->initNoteForm("edit", $a_type, $note);
636  }
637  $tpl->setCurrentBlock("edit_note_form");
638 // $tpl->setVariable("EDIT_FORM", $this->form->getHTML());
639  $tpl->setVariable("EDIT_FORM", $this->form_tpl->get());
640  $tpl->parseCurrentBlock();
641  }
642  else
643  {
644  $cnt_col = 2;
645 
646  // delete note stuff for all private notes
647  if ($this->checkDeletion($note)
648  && !$this->delete_note
649  && !$this->export_html && !$this->print
650  && !$this->edit_note_form && !$this->add_note_form)
651  {
652  $ilCtrl->setParameterByClass("ilnotegui", "note_id", $note->getId());
653  $this->renderLink($tpl, "delete_note", $lng->txt("delete"),
654  "deleteNote", "note_".$note->getId());
655  }
656 
657  // checkboxes in multiselection mode
658  if ($this->multi_selection && !$this->delete_note)
659  {
660  $tpl->setCurrentBlock("checkbox_col");
661  $tpl->setVariable("CHK_NOTE", "note[]");
662  $tpl->setVariable("CHK_NOTE_ID", $note->getId());
663  $tpl->parseCurrentBlock();
664  $cnt_col = 1;
665  }
666 
667  // edit note stuff for all private notes
668  if ($this->checkEdit($note))
669  {
670 
671  if (!$this->delete_note && !$this->export_html && !$this->print
672  && !$this->edit_note_form && !$this->add_note_form)
673  {
674  $ilCtrl->setParameterByClass("ilnotegui", "note_id", $note->getId());
675  $this->renderLink($tpl, "edit_note", $lng->txt("edit"),
676  "editNoteForm", "note_edit");
677  }
678  }
679 
680  $tpl->setVariable("CNT_COL", $cnt_col);
681 
682  // output author account
683  if ($a_type == IL_NOTE_PUBLIC && ilObject::_exists($note->getAuthor()))
684  {
685  //$tpl->setCurrentBlock("author");
686  //$tpl->setVariable("VAL_AUTHOR", ilObjUser::_lookupLogin($note->getAuthor()));
687  //$tpl->parseCurrentBlock();
688  $tpl->setCurrentBlock("user_img");
689  $tpl->setVariable("USR_IMG",
690  ilObjUser::_getPersonalPicturePath($note->getAuthor(), "xxsmall"));
691  $tpl->setVariable("USR_ALT", $lng->txt("user_image").": ".
692  ilObjUser::_lookupLogin($note->getAuthor()));
693  $tpl->parseCurrentBlock();
694  $tpl->setVariable("TXT_USR",
695  ilUserUtil::getNamePresentation($note->getAuthor(), false, false)." - ");
696  }
697 
698  // last edited
699  if ($note->getUpdateDate() != null)
700  {
701  $tpl->setVariable("TXT_LAST_EDIT", $lng->txt("last_edited_on"));
702  $tpl->setVariable("DATE_LAST_EDIT",
703  ilDatePresentation::formatDate(new ilDate($note->getUpdateDate(), IL_CAL_DATETIME)));
704  }
705  else
706  {
707  $tpl->setVariable("VAL_DATE",
708  ilDatePresentation::formatDate(new ilDate($note->getCreationDate(), IL_CAL_DATETIME)));
709  }
710 
711  // hidden note ids for deletion
712  if ($this->delete_note)
713  {
714  $tpl->setCurrentBlock("delete_ids");
715  $tpl->setVariable("HID_NOTE", "note[]");
716  $tpl->setVariable("HID_NOTE_ID", $note->getId());
717  $tpl->parseCurrentBlock();
718  }
719  $target = $note->getObject();
720 
721  // target objects
722  $this->showTargets($tpl, $this->rep_obj_id, $note->getId(),
723  $target["obj_type"], $target["obj_id"]);
724 
725  $rowclass = ($rowclass != "tblrow1")
726  ? "tblrow1"
727  : "tblrow2";
728  if (!$this->export_html && !$this->print)
729  {
730  $tpl->setCurrentBlock("note_img");
731  if ($a_type == IL_NOTE_PUBLIC)
732  {
733  $tpl->setVariable("IMG_NOTE", $this->comment_img[$note->getLabel()]["img"]);
734  $tpl->setVariable("ALT_NOTE", $this->comment_img[$note->getLabel()]["alt"]);
735  }
736  else
737  {
738  $tpl->setVariable("IMG_NOTE", $this->note_img[$note->getLabel()]["img"]);
739  $tpl->setVariable("ALT_NOTE", $this->note_img[$note->getLabel()]["alt"]);
740  }
741  $tpl->parseCurrentBlock();
742  }
743  else
744  {
745  switch ($note->getLabel())
746  {
747  case IL_NOTE_UNLABELED:
748  $tpl->setVariable("EXP_ICON", "[ ]");
749  break;
750 
751  case IL_NOTE_IMPORTANT:
752  $tpl->setVariable("EXP_ICON", "[!]");
753  break;
754 
755  case IL_NOTE_QUESTION:
756  $tpl->setVariable("EXP_ICON", "[?]");
757  break;
758 
759  case IL_NOTE_PRO:
760  $tpl->setVariable("EXP_ICON", "[+]");
761  break;
762 
763  case IL_NOTE_CONTRA:
764  $tpl->setVariable("EXP_ICON", "[-]");
765  break;
766  }
767  }
768  $tpl->setCurrentBlock("note");
769  $tpl->setVariable("ROWCLASS", $rowclass);
770  $text = (trim($note->getText()) != "")
771  ? nl2br($note->getText())
772  : "<p class='subtitle'>".$lng->txt("note_content_removed")."</p>";
773  $tpl->setVariable("NOTE_TEXT", $text);
774  $tpl->setVariable("VAL_SUBJECT", $note->getSubject());
775  $tpl->setVariable("NOTE_ID", $note->getId());
776  $tpl->setVariable("CLASS", $a_type == IL_NOTE_PUBLIC
777  ? "ilComment"
778  : "ilNote");
779  $tpl->parseCurrentBlock();
780  }
781  $tpl->setCurrentBlock("note_row");
782  $tpl->parseCurrentBlock();
783  $notes_given = true;
784  }
785 
786  if (!$notes_given)
787  {
788  $tpl->setCurrentBlock("no_notes");
789  if ($a_type == IL_NOTE_PUBLIC)
790  {
791  $tpl->setVariable("NO_NOTES", $lng->txt("notes_no_comments"));
792  }
793 /* else
794  {
795  $tpl->setVariable("NO_NOTES", $lng->txt("notes_no_notes"));
796  }*/
797  $tpl->parseCurrentBlock();
798  }
799 
801 
802  // multiple items commands
803  if ($this->multi_selection && !$this->delete_note && !$this->edit_note_form
804  && count($notes) > 0)
805  {
806  if ($a_type == IL_NOTE_PRIVATE)
807  {
808  $tpl->setCurrentBlock("delete_cmd");
809  $tpl->setVariable("TXT_DELETE_NOTES", $this->lng->txt("delete"));
810  $tpl->parseCurrentBlock();
811  }
812 
813  $tpl->setCurrentBlock("multiple_commands");
814  $tpl->setVariable("TXT_SELECT_ALL", $this->lng->txt("select_all"));
815  $tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.svg"));
816  $tpl->setVariable("ALT_ARROW", $this->lng->txt("actions"));
817  $tpl->setVariable("TXT_PRINT_NOTES", $this->lng->txt("print"));
818  $tpl->setVariable("TXT_EXPORT_NOTES", $this->lng->txt("exp_html"));
819  $tpl->parseCurrentBlock();
820  }
821 
822  // delete / cancel row
823  if ($this->delete_note)
824  {
825  $tpl->setCurrentBlock("delete_cancel");
826  $tpl->setVariable("TXT_DEL_NOTES", $this->lng->txt("delete"));
827  $tpl->setVariable("TXT_CANCEL_DEL_NOTES", $this->lng->txt("cancel"));
828  $tpl->parseCurrentBlock();
829  }
830 
831  // print
832  if ($this->print)
833  {
834  $tpl->touchBlock("print_js");
835  $tpl->setCurrentBlock("print_back");
836  $tpl->setVariable("LINK_BACK", $this->ctrl->getLinkTarget($this, "showNotes"));
837  $tpl->setVariable("TXT_BACK", $this->lng->txt("back"));
838  $tpl->parseCurrentBlock();
839  }
840  }
841 
842  // message
843  switch($_GET["note_mess"] != "" ? $_GET["note_mess"] : $this->note_mess)
844  {
845  case "mod":
846  $mtype = "success";
847  $mtxt = $lng->txt("msg_obj_modified");
848  break;
849 
850  case "ntsdel":
851  $mtype = "success";
852  $mtxt = ($a_type == IL_NOTE_PRIVATE)
853  ? $lng->txt("notes_notes_deleted")
854  : $lng->txt("notes_comments_deleted");
855  break;
856 
857  case "ntdel":
858  $mtype = "success";
859  $mtxt = ($a_type == IL_NOTE_PRIVATE)
860  ? $lng->txt("notes_note_deleted")
861  : $lng->txt("notes_comment_deleted");
862  break;
863 
864  case "frmfld":
865  $mtype = "failure";
866  $mtxt = $lng->txt("form_input_not_valid");
867  break;
868 
869  case "qdel":
870  $mtype = "question";
871  $mtxt = $lng->txt("info_delete_sure");
872  break;
873 
874  case "noc":
875  $mtype = "failure";
876  $mtxt = $lng->txt("no_checkbox");
877  break;
878  }
879  if ($mtxt != "")
880  {
881  $tpl->setVariable("MESS", $tpl->getMessageHTML($mtxt, $mtype));
882  }
883  else
884  {
885  $tpl->setVariable("MESS", "");
886  }
887 
888 
889 
890  if ($this->delete_note && count($notes) == 0)
891  {
892  return "";
893  }
894  else
895  {
896  return $tpl->get();
897  }
898  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
checkDeletion($a_note)
Check whether deletion is allowed.
const IL_NOTE_CONTRA
static _getIcon($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
Get icon for repository item.
initNoteForm($a_mode="edit", $a_type, $a_note=null)
Init note form.
$_POST['username']
Definition: cron.php:12
const IL_NOTE_PRO
const IL_NOTE_PRIVATE
Definition: class.ilNote.php:4
const IL_CAL_DATETIME
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data
$_GET["client_id"]
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
checkEdit($a_note)
Check edit.
_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)
get all notes related to a specific object
static useRelativeDates()
check if relative dates are used
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)
Default behaviour is:
global $tpl
Definition: ilias.php:8
global $ilCtrl
Definition: ilias.php:18
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:5
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
special template class to simplify handling of ITX/PEAR
static formatDate(ilDateTime $date)
Format a date public.
_lookupLogin($a_user_id)
lookup login
$txt
Definition: error.php:10
showTargets(&$tpl, $a_rep_obj_id, $a_note_id, $a_obj_type, $a_obj_id)
show related objects as links
const IL_NOTE_UNLABELED
Definition: class.ilNote.php:7
static img($a_src, $a_alt="", $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
global $ilUser
Definition: imgupload.php:15
global $lng
Definition: privfeed.php:40
static _getPersonalPicturePath($a_usr_id, $a_size="small", $a_force_pic=false, $a_prevent_no_photo_image=false)
Get path to personal picture.
const IL_NOTE_QUESTION
Definition: class.ilNote.php:9
const IL_NOTE_IMPORTANT
Definition: class.ilNote.php:8
+ 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 241 of file class.ilNoteGUI.php.

References $_GET, $ilCtrl, $ilSetting, $ilUser, $lng, 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().

242  {
243  global $ilUser, $lng, $ilCtrl, $ilSetting;
244 
245  $lng->loadLanguageModule("notes");
246 
247  $ntpl = new ilTemplate("tpl.notes_and_comments.html", true, true,
248  "Services/Notes");
249 
250  // check, whether column is hidden due to processing in other column
251  $hide_comments = ($this->only == "notes");
252  $hide_notes = ($this->only == "comments");
253  switch($ilCtrl->getCmd())
254  {
255  case "addNoteForm":
256  case "editNoteForm":
257  case "addNote":
258  case "updateNote":
259  if ($_GET["note_type"] == IL_NOTE_PRIVATE)
260  {
261  $hide_comments = true;
262  }
263  if ($_GET["note_type"] == IL_NOTE_PUBLIC)
264  {
265  $hide_notes = true;
266  }
267  break;
268  }
269 
270 
271 // temp workaround: only show comments (if both have been activated)
272 if ($this->private_enabled && $this->public_enabled
273  && $this->only != "notes")
274 {
275  $this->private_enabled = false;
276 }
277 
278  $nodes_col = false;
279  if ($this->private_enabled && ($ilUser->getId() != ANONYMOUS_USER_ID)
280  && !$hide_notes)
281  {
282  $ntpl->setCurrentBlock("notes_col");
283  $ntpl->setVariable("NOTES", $this->getNoteListHTML(IL_NOTE_PRIVATE, $a_init_form));
284  $ntpl->parseCurrentBlock();
285  $nodes_col = true;
286  }
287 
288  // #15948 - public enabled vs. comments_settings
289  $comments_col = false;
290  if ($this->public_enabled && (!$this->delete_note || $this->public_deletion_enabled || $ilSetting->get("comments_del_user", 0))
291  && !$hide_comments /* && $ilUser->getId() != ANONYMOUS_USER_ID */)
292  {
293  $ntpl->setVariable("COMMENTS", $this->getNoteListHTML(IL_NOTE_PUBLIC, $a_init_form));
294  $comments_col = true;
295  }
296 
297  // Comments Settings
298  if ($this->comments_settings && !$hide_comments && !$this->delete_note
299  && !$this->edit_note_form && !$this->add_note_form && $ilUser->getId() != ANONYMOUS_USER_ID)
300  {
301  $notes_settings = new ilSetting("notes");
302  $id = $this->rep_obj_id."_".$this->obj_id."_".$this->obj_type;
303  //$active = $notes_settings->get("activate_".$id);
304  $active = ilNote::commentsActivated($this->rep_obj_id, $this->obj_id, $this->obj_type);
305 
306  if ($active)
307  {
308  $this->renderLink($ntpl, "comments_settings", $lng->txt("notes_deactivate_comments"),
309  "deactivateComments", "notes_top");
310  $ntpl->setCurrentBlock("comments_settings2");
311  }
312  else
313  {
314  $this->renderLink($ntpl, "comments_settings", $lng->txt("notes_activate_comments"),
315  "activateComments", "notes_top");
316  $ntpl->setCurrentBlock("comments_settings2");
317 
318  if ($this->ajax && !$comments_col)
319  {
320  $ntpl->setVariable("COMMENTS_MESS",
321  $ntpl->getMessageHTML($lng->txt("comments_feature_currently_not_activated_for_object"), "info"));
322  }
323  }
324  $ntpl->parseCurrentBlock();
325 
326  if (!$comments_col)
327  {
328  $ntpl->setVariable("COMMENTS", "");
329  }
330 
331  $comments_col = true;
332  }
333 
334  if ($comments_col)
335  {
336  $ntpl->setCurrentBlock("comments_col");
337  if ($nodes_col)
338  {
339 // $ntpl->touchBlock("comments_style");
340  }
341  $ntpl->parseCurrentBlock();
342  }
343 
344  if ($this->ajax)
345  {
346  echo $ntpl->get();
347  exit;
348  }
349 
350  return $ntpl->get();
351  }
ILIAS Setting Class.
getNoteListHTML($a_type=IL_NOTE_PRIVATE, $a_init_form=true)
get notes/comments list as html code
exit
Definition: login.php:54
const IL_NOTE_PRIVATE
Definition: class.ilNote.php:4
$_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:5
special template class to simplify handling of ITX/PEAR
static commentsActivated($a_rep_obj_id, $a_obj_id, $a_obj_type)
Are comments activated for object?
global $ilUser
Definition: imgupload.php:15
global $ilSetting
Definition: privfeed.php:40
global $lng
Definition: privfeed.php:40
+ 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 229 of file class.ilNoteGUI.php.

References $ilCtrl, and getNotesHTML().

230  {
231  global $ilCtrl;
232  $ilCtrl->setParameter($this, "notes_only", "comments");
233  $this->only = "comments";
234  return $this->getNotesHTML($a_init_form = true);
235  }
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 215 of file class.ilNoteGUI.php.

References $ilCtrl, and getNotesHTML().

216  {
217  global $ilCtrl;
218  $ilCtrl->setParameter($this, "notes_only", "notes");
219  $this->only = "notes";
220  return $this->getNotesHTML($a_init_form = true);
221  }
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 1081 of file class.ilNoteGUI.php.

References $ilCtrl, $ilUser, $lng, $tpl, ilDatePresentation\formatDate(), IL_CAL_DATETIME, and showTargets().

1082  {
1083  global $lng, $ilCtrl, $ilUser;
1084 
1085  $tpl = new ilTemplate("tpl.pd_note.html", true, true, "Services/Notes");
1086  $note = new ilNote($note_id);
1087  $target = $note->getObject();
1088 
1089  if ($note->getAuthor() != $ilUser->getId())
1090  {
1091  return;
1092  }
1093 
1094  $tpl->setCurrentBlock("edit_note");
1095  $ilCtrl->setParameterByClass("ilnotegui", "rel_obj", $target["rep_obj_id"]);
1096  $ilCtrl->setParameterByClass("ilnotegui", "note_id", $note_id);
1097  $ilCtrl->setParameterByClass("ilnotegui", "note_type", $note->getType());
1098  $tpl->setVariable("LINK_EDIT_NOTE",
1099  $ilCtrl->getLinkTargetByClass(array("ilpersonaldesktopgui", "ilpdnotesgui", "ilnotegui"),
1100  "editNoteForm"));
1101  $tpl->setVariable("TXT_EDIT_NOTE", $lng->txt("edit"));
1102  $tpl->parseCurrentBlock();
1103  $ilCtrl->clearParametersByClass("ilnotegui");
1104 
1105  $tpl->setCurrentBlock("note_img");
1106  $tpl->setVariable("IMG_NOTE", $this->note_img[$note->getLabel()]["img"]);
1107  $tpl->setVariable("ALT_NOTE", $this->note_img[$note->getLabel()]["alt"]);
1108  $tpl->parseCurrentBlock();
1109 
1110  // last edited
1111  if ($note->getUpdateDate() != null)
1112  {
1113  $tpl->setVariable("TXT_LAST_EDIT", $lng->txt("last_edited_on"));
1114  $tpl->setVariable("DATE_LAST_EDIT",
1115  ilDatePresentation::formatDate(new ilDate($note->getUpdateDate(), IL_CAL_DATETIME)));
1116  }
1117  else
1118  {
1119  //$tpl->setVariable("TXT_CREATED", $lng->txt("create_date"));
1120  $tpl->setVariable("VAL_DATE",
1121  ilDatePresentation::formatDate(new ilDate($note->getCreationDate(), IL_CAL_DATETIME)));
1122  }
1123 
1124  $tpl->setVariable("VAL_SUBJECT", $note->getSubject());
1125  $text = (trim($note->getText()) != "")
1126  ? nl2br($note->getText())
1127  : "<p class='subtitle'>".$lng->txt("note_content_removed")."</p>";
1128  $tpl->setVariable("NOTE_TEXT", $text);
1129  $this->showTargets($tpl, $target["rep_obj_id"], $note_id, $target["obj_type"], $target["obj_id"]);
1130  return $tpl->get();
1131  }
const IL_CAL_DATETIME
Note class.
global $tpl
Definition: ilias.php:8
global $ilCtrl
Definition: ilias.php:18
Class for single dates.
special template class to simplify handling of ITX/PEAR
static formatDate(ilDateTime $date)
Format a date public.
showTargets(&$tpl, $a_rep_obj_id, $a_note_id, $a_obj_type, $a_obj_id)
show related objects as links
global $ilUser
Definition: imgupload.php:15
global $lng
Definition: privfeed.php:40
+ 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 907 of file class.ilNoteGUI.php.

References $ilCtrl, and ilObject\_lookupType().

Referenced by getNoteListHTML(), and showTargets().

908  {
909  global $objDefinition, $ilCtrl;
910 
911  $parent_type = ilObject::_lookupType($parent_obj_id);
912  $parent_class = "ilObj".$objDefinition->getClassName($parent_type)."GUI";
913  $parent_path = $ilCtrl->lookupClassPath($parent_class);
914  include_once $parent_path;
915  if(method_exists($parent_class, "lookupSubObjectTitle"))
916  {
917  return call_user_func_array(array($parent_class, "lookupSubObjectTitle"), array($parent_obj_id, $sub_obj_id));
918  }
919  }
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 1564 of file class.ilNoteGUI.php.

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

1565  {
1566  global $ilUser;
1567 
1568  $suffix = ($_GET["note_type"] == IL_NOTE_PRIVATE)
1569  ? "private"
1570  : "public";
1571  $ilUser->writePref("notes_".$suffix, "n");
1572 
1573  return $this->getNotesHTML();
1574  }
getNotesHTML($a_init_form=true)
const IL_NOTE_PRIVATE
Definition: class.ilNote.php:4
$_GET["client_id"]
global $ilUser
Definition: imgupload.php:15
+ Here is the call graph for this function:

◆ ilNoteGUI()

ilNoteGUI::ilNoteGUI (   $a_rep_obj_id = "",
  $a_obj_id = "",
  $a_obj_type = "",
  $a_include_subobjects = false 
)

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

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

32  {
33  global $ilCtrl, $lng;
34 
35  $lng->loadLanguageModule("notes");
36 
37  $ilCtrl->saveParameter($this, "notes_only");
38  $this->only = $_GET["notes_only"];
39 
40  $this->rep_obj_id = $a_rep_obj_id;
41  $this->obj_id = $a_obj_id;
42  $this->obj_type = $a_obj_type;
43  $this->inc_sub = $a_include_subobjects;
44 
45  // auto-detect object type
46  if(!$this->obj_type && $a_rep_obj_id)
47  {
48  $this->obj_type = ilObject::_lookupType($a_rep_obj_id);
49  }
50 
51  $this->ajax = $ilCtrl->isAsynch();
52 
53  $this->ctrl =& $ilCtrl;
54  $this->lng =& $lng;
55 
56  $this->anchor_jump = true;
57  $this->add_note_form = false;
58  $this->edit_note_form = false;
59  $this->private_enabled = false;
60  $notes_settings = new ilSetting("notes");
61  $id = $this->rep_obj_id."_".$this->obj_id."_".$this->obj_type;
62  //if ($notes_settings->get("activate_".$id))
63  if (ilNote::commentsActivated($this->rep_obj_id, $this->obj_id, $this->obj_type))
64  {
65  $this->public_enabled = true;
66  }
67  else
68  {
69  $this->public_enabled = false;
70  }
71  $this->enable_hiding = false;
72  $this->targets_enabled = false;
73  $this->multi_selection = false;
74  $this->export_html = false;
75  $this->print = false;
76  $this->comments_settings = false;
77 
78  $this->note_img = array(
79  IL_NOTE_UNLABELED => array(
80  "img" => ilUtil::getImagePath("note_unlabeled.svg"),
81  "alt" => $lng->txt("note")),
82  IL_NOTE_IMPORTANT => array(
83  "img" => ilUtil::getImagePath("note_unlabeled.svg"),
84  "alt" => $lng->txt("note").", ".$lng->txt("important")),
85  IL_NOTE_QUESTION => array(
86  "img" => ilUtil::getImagePath("note_unlabeled.svg"),
87  "alt" => $lng->txt("note").", ".$lng->txt("question")),
88  IL_NOTE_PRO => array(
89  "img" => ilUtil::getImagePath("note_unlabeled.svg"),
90  "alt" => $lng->txt("note").", ".$lng->txt("pro")),
91  IL_NOTE_CONTRA => array(
92  "img" => ilUtil::getImagePath("note_unlabeled.svg"),
93  "alt" => $lng->txt("note").", ".$lng->txt("contra"))
94  );
95 
96  $this->comment_img = array(
97  IL_NOTE_UNLABELED => array(
98  "img" => ilUtil::getImagePath("comment_unlabeled.svg"),
99  "alt" => $lng->txt("notes_comment")),
100  IL_NOTE_IMPORTANT => array(
101  "img" => ilUtil::getImagePath("comment_unlabeled.svg"),
102  "alt" => $lng->txt("notes_comment").", ".$lng->txt("important")),
103  IL_NOTE_QUESTION => array(
104  "img" => ilUtil::getImagePath("comment_unlabeled.svg"),
105  "alt" => $lng->txt("notes_comment").", ".$lng->txt("question")),
106  IL_NOTE_PRO => array(
107  "img" => ilUtil::getImagePath("comment_unlabeled.svg"),
108  "alt" => $lng->txt("notes_comment").", ".$lng->txt("pro")),
109  IL_NOTE_CONTRA => array(
110  "img" => ilUtil::getImagePath("comment_unlabeled.svg"),
111  "alt" => $lng->txt("notes_comment").", ".$lng->txt("contra"))
112  );
113 
114  // default: notes for repository objects
115  $this->setRepositoryMode(true);
116  }
const IL_NOTE_CONTRA
ILIAS Setting Class.
setRepositoryMode($a_value)
Set repository mode.
const IL_NOTE_PRO
$_GET["client_id"]
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:7
static commentsActivated($a_rep_obj_id, $a_obj_id, $a_obj_type)
Are comments activated for object?
global $lng
Definition: privfeed.php:40
const IL_NOTE_QUESTION
Definition: class.ilNote.php:9
const IL_NOTE_IMPORTANT
Definition: class.ilNote.php:8
+ Here is the call graph for this function:

◆ initJavascript()

ilNoteGUI::initJavascript (   $a_ajax_url)

Init javascript.

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

References $tpl, iljQueryUtil\initjQuery(), and ilYuiUtil\initPanel().

Referenced by ilObjectListGUI\prepareJsLinks().

1604  {
1605  global $tpl;
1606 
1607  include_once("./Services/YUI/classes/class.ilYuiUtil.php");
1609  include_once("./Services/jQuery/classes/class.iljQueryUtil.php");
1611  $tpl->addJavascript("./Services/Notes/js/ilNotes.js");
1612 
1613  $tpl->addOnLoadCode("ilNotes.setAjaxUrl('".$a_ajax_url."');");
1614  }
global $tpl
Definition: ilias.php:8
static initPanel($a_resize=false)
Init yui panel.
static initjQuery($a_tpl=null)
Init jQuery.
+ 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 974 of file class.ilNoteGUI.php.

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

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

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

References $_SESSION.

1733  {
1734  $_SESSION["comments_sort_asc"] = 1;
1735  return $this->getNotesHtml();
1736  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']

◆ listSortDesc()

ilNoteGUI::listSortDesc ( )
protected

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

References $_SESSION.

1739  {
1740  $_SESSION["comments_sort_asc"] = 0;
1741  return $this->getNotesHtml();
1742  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']

◆ notifyObserver()

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

Notify observers on update/create.

Parameters
string$a_action
ilNote$a_note

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

Referenced by addNote(), and updateNote().

1718  {
1719  if(sizeof($this->observer))
1720  {
1721  foreach($this->observer as $item)
1722  {
1723  $param = $a_note->getObject();
1724  $param["action"] = $a_action;
1725  $param["note_id"] = $a_note->getId();
1726 
1727  call_user_func_array($item, $param);
1728  }
1729  }
1730  }
+ Here is the caller graph for this function:

◆ printNotes()

ilNoteGUI::printNotes ( )

notes print view screen

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

References $tpl, exit, and getNotesHTML().

1537  {
1538  $tpl = new ilTemplate("tpl.main.html", true, true);
1539 
1540  $this->print = true;
1541  $this->multi_selection = false;
1542  $tpl->setVariable("CONTENT", $this->getNotesHTML());
1543  echo $tpl->get(); exit;
1544  }
getNotesHTML($a_init_form=true)
exit
Definition: login.php:54
global $tpl
Definition: ilias.php:8
special template class to simplify handling of ITX/PEAR
+ 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 1675 of file class.ilNoteGUI.php.

References $ilCtrl.

Referenced by getNoteListHTML(), and getNotesHTML().

1676  {
1677  global $ilCtrl;
1678 
1679  $low_var = strtolower($a_var);
1680  $up_var = strtoupper($a_var);
1681 
1682  if ($this->ajax)
1683  {
1684  $a_tpl->setVariable("LINK_".$up_var, "#");
1685  $oc = "onclick = \"ilNotes.cmdAjaxLink(event, '".
1686  $ilCtrl->getLinkTargetByClass("ilnotegui", $a_cmd, "", true).
1687  "');\"";
1688  $a_tpl->setVariable("ON_CLICK_".$up_var, $oc);
1689  }
1690  else
1691  {
1692  $a_tpl->setVariable("LINK_".$up_var,
1693  $ilCtrl->getLinkTargetByClass("ilnotegui", $a_cmd, $a_anchor));
1694  }
1695 
1696  $a_tpl->setCurrentBlock($low_var);
1697  $a_tpl->setVariable("TXT_".$up_var, $a_txt);
1698  $a_tpl->parseCurrentBlock();
1699  }
global $ilCtrl
Definition: ilias.php:18
+ Here is the caller graph for this function:

◆ setRepositoryMode()

ilNoteGUI::setRepositoryMode (   $a_value)

Set repository mode.

Parameters
bool$a_value

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

Referenced by ilNoteGUI().

204  {
205  $this->repository_mode = (bool)$a_value;
206  }
+ Here is the caller graph for this function:

◆ showAllPublicNotes()

ilNoteGUI::showAllPublicNotes ( )

show all public notes to user

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

References $ilUser, and getNotesHTML().

1580  {
1581  global $ilUser;
1582 
1583  $ilUser->writePref("notes_pub_all", "y");
1584 
1585  return $this->getNotesHTML();
1586  }
getNotesHTML($a_init_form=true)
global $ilUser
Definition: imgupload.php:15
+ Here is the call graph for this function:

◆ showMyPublicNotes()

ilNoteGUI::showMyPublicNotes ( )

show only public notes of user

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

References $ilUser, and getNotesHTML().

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

◆ showNotes()

ilNoteGUI::showNotes ( )

show notes

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

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

1550  {
1551  global $ilUser;
1552 
1553  $suffix = ($_GET["note_type"] == IL_NOTE_PRIVATE)
1554  ? "private"
1555  : "public";
1556  $ilUser->writePref("notes_".$suffix, "y");
1557 
1558  return $this->getNotesHTML();
1559  }
getNotesHTML($a_init_form=true)
const IL_NOTE_PRIVATE
Definition: class.ilNote.php:4
$_GET["client_id"]
global $ilUser
Definition: imgupload.php:15
+ Here is the call graph for this function:

◆ showTargets()

ilNoteGUI::showTargets ( $tpl,
  $a_rep_obj_id,
  $a_note_id,
  $a_obj_type,
  $a_obj_id 
)

show related objects as links

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

References $additional, $ilUser, $location, $path, $ref_id, $tpl, ilObject\_getAllReferences(), ilObject\_getIcon(), ilLink\_getLink(), ilObject\_lookupObjId(), ilObject\_lookupOwner(), ilContainerReference\_lookupTargetId(), ilSCORM2004Node\_lookupTitle(), ilObject\_lookupTitle(), ilObject\_lookupType(), ilUtil\appendUrlParameterString(), ilWorkspaceAccessHandler\getGotoLink(), ilUtil\getImagePath(), and getSubObjectTitle().

Referenced by getNoteListHTML(), and getPDNoteHTML().

1137  {
1138  global $tree, $ilAccess, $objDefinition, $ilUser;
1139 
1140  if ($this->targets_enabled)
1141  {
1142  if ($a_rep_obj_id > 0)
1143  {
1144  // get all visible references of target object
1145 
1146  // repository
1147  $ref_ids = ilObject::_getAllReferences($a_rep_obj_id);
1148  if($ref_ids)
1149  {
1150  $vis_ref_ids = array();
1151  foreach($ref_ids as $ref_id)
1152  {
1153  if ($ilAccess->checkAccess("visible", "", $ref_id))
1154  {
1155  $vis_ref_ids[] = $ref_id;
1156  }
1157  }
1158 
1159  // output links to targets
1160  if (count($vis_ref_ids) > 0)
1161  {
1162  foreach($vis_ref_ids as $vis_ref_id)
1163  {
1164  $type = ilObject::_lookupType($vis_ref_id, true);
1165  $sub_link = $sub_title = "";
1166  if ($type == "sahs") // bad hack, needs general procedure
1167  {
1168  $link = "goto.php?target=sahs_".$vis_ref_id;
1169  $title = ilObject::_lookupTitle($a_rep_obj_id);
1170  if ($a_obj_type == "sco" || $a_obj_type == "seqc" || $a_obj_type == "chap" || $a_obj_type == "pg")
1171  {
1172  $sub_link = "goto.php?target=sahs_".$vis_ref_id."_".$a_obj_id;
1173  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
1174  $sub_title = ilSCORM2004Node::_lookupTitle($a_obj_id);
1175  $sub_icon = ilUtil::getImagePath("icon_".$a_obj_type.".svg");
1176  }
1177  }
1178  else if ($type == "poll")
1179  {
1180  include_once "Services/Link/classes/class.ilLink.php";
1181  $title = ilObject::_lookupTitle($a_rep_obj_id);
1182  $link = ilLink::_getLink($vis_ref_id, "poll");
1183  }
1184  else if ($a_obj_type != "pg")
1185  {
1186  if (!is_object($this->item_list_gui[$type]))
1187  {
1188  $class = $objDefinition->getClassName($type);
1189  $location = $objDefinition->getLocation($type);
1190  $full_class = "ilObj".$class."ListGUI";
1191  include_once($location."/class.".$full_class.".php");
1192  $this->item_list_gui[$type] = new $full_class();
1193  }
1194 
1195  // for references, get original title
1196  // (link will lead to orignal, which basically is wrong though)
1197  if($a_obj_type == "crsr" || $a_obj_type == "catr")
1198  {
1199  include_once "Services/ContainerReference/classes/class.ilContainerReference.php";
1200  $tgt_obj_id = ilContainerReference::_lookupTargetId($a_rep_obj_id);
1201  $title = ilObject::_lookupTitle($tgt_obj_id);
1202  }
1203  else
1204  {
1205  $title = ilObject::_lookupTitle($a_rep_obj_id);
1206  }
1207  $this->item_list_gui[$type]->initItem($vis_ref_id, $a_rep_obj_id, $title);
1208  $link = $this->item_list_gui[$type]->getCommandLink("infoScreen");
1209 
1210  // workaround, because # anchor can't be passed through frameset
1211  $link = ilUtil::appendUrlParameterString($link, "anchor=note_".$a_note_id);
1212 
1213  $link = $this->item_list_gui[$type]->appendRepositoryFrameParameter($link)."#note_".$a_note_id;
1214  }
1215  else
1216  {
1217  $title = ilObject::_lookupTitle($a_rep_obj_id);
1218  $link = "goto.php?target=pg_".$a_obj_id."_".$vis_ref_id;
1219  }
1220 
1221  $par_id = $tree->getParentId($vis_ref_id);
1222 
1223  // sub object link
1224  if ($sub_link != "")
1225  {
1226  if ($this->export_html || $this->print)
1227  {
1228  $tpl->setCurrentBlock("exp_target_sub_object");
1229  }
1230  else
1231  {
1232  $tpl->setCurrentBlock("target_sub_object");
1233  $tpl->setVariable("LINK_SUB_TARGET", $sub_link);
1234  }
1235  $tpl->setVariable("TXT_SUB_TARGET", $sub_title);
1236  $tpl->setVariable("IMG_SUB_TARGET", $sub_icon);
1237  $tpl->parseCurrentBlock();
1238  }
1239 
1240  // container and object link
1241  if ($this->export_html || $this->print)
1242  {
1243  $tpl->setCurrentBlock("exp_target_object");
1244  }
1245  else
1246  {
1247  $tpl->setCurrentBlock("target_object");
1248  $tpl->setVariable("LINK_TARGET", $link);
1249  }
1250  $tpl->setVariable("TXT_CONTAINER",
1252  ilObject::_lookupObjId($par_id)));
1253  $tpl->setVariable("IMG_CONTAINER",
1255  ilObject::_lookupObjId($par_id), "tiny"));
1256  $tpl->setVariable("TXT_TARGET", $title);
1257  $tpl->setVariable("IMG_TARGET",
1258  ilObject::_getIcon($a_rep_obj_id, "tiny"));
1259 
1260  $tpl->parseCurrentBlock();
1261  }
1262  $tpl->touchBlock("target_objects");
1263  }
1264  }
1265  // personal workspace
1266  else
1267  {
1268  // we only need 1 instance
1269  if(!$this->wsp_tree)
1270  {
1271  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
1272  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
1273  $this->wsp_tree = new ilWorkspaceTree($ilUser->getId());
1274  $this->wsp_access_handler = new ilWorkspaceAccessHandler($this->wsp_tree);
1275  }
1276  $node_id = $this->wsp_tree->lookupNodeId($a_rep_obj_id);
1277  if($this->wsp_access_handler->checkAccess("visible", "", $node_id))
1278  {
1279  $path = $this->wsp_tree->getPathFull($node_id);
1280  if($path)
1281  {
1282  $item = array_pop($path);
1283  $parent = array_pop($path);
1284 
1285  if(!$parent["title"])
1286  {
1287  $parent["title"] = $this->lng->txt("wsp_personal_workspace");
1288  }
1289 
1290  // sub-objects
1291  $additional = null;
1292  if($a_obj_id)
1293  {
1294  $sub_title = $this->getSubObjectTitle($a_rep_obj_id, $a_obj_id);
1295  if($sub_title)
1296  {
1297  $item["title"] .= " (".$sub_title.")";
1298  $additional = "_".$a_obj_id;
1299  }
1300  }
1301 
1302  $link = ilWorkspaceAccessHandler::getGotoLink($node_id, $a_rep_obj_id, $additional);
1303  }
1304  // shared resource
1305  else
1306  {
1307  $owner = ilObject::_lookupOwner($a_rep_obj_id);
1308  $parent["title"] = $this->lng->txt("wsp_tab_shared").
1309  " (".ilObject::_lookupOwnerName($owner).")";
1310  $item["title"] = ilObject::_lookupTitle($a_rep_obj_id);
1311  $link = "ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToWorkspace&dsh=".
1312  $owner;
1313  }
1314 
1315  // container and object link
1316  if ($this->export_html || $this->print)
1317  {
1318  $tpl->setCurrentBlock("exp_target_object");
1319  }
1320  else
1321  {
1322  $tpl->setCurrentBlock("target_object");
1323  $tpl->setVariable("LINK_TARGET", $link);
1324  }
1325 
1326 
1327  // :TODO: no images in template ?
1328 
1329  $tpl->setVariable("TXT_CONTAINER", $parent["title"]);
1330  $tpl->setVariable("IMG_CONTAINER",
1331  ilObject::_getIcon($parent["obj_id"], "tiny"));
1332 
1333  $tpl->setVariable("TXT_TARGET", $item["title"]);
1334  $tpl->setVariable("IMG_TARGET",
1335  ilObject::_getIcon($a_rep_obj_id, "tiny"));
1336 
1337  $tpl->parseCurrentBlock();
1338  }
1339  }
1340  }
1341  }
1342  }
static _lookupTitle($a_obj_id)
Lookup Title.
static _getIcon($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
Get icon for repository item.
_lookupOwner($a_id)
lookup object owner
$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.
global $tpl
Definition: ilias.php:8
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 getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static _lookupObjId($a_id)
$additional
Definition: goto.php:89
static _lookupType($a_id, $a_reference=false)
lookup object type
global $ilUser
Definition: imgupload.php:15
$ref_id
Definition: sahs_server.php:39
$path
Definition: index.php:22
static _lookupTargetId($a_obj_id)
lookup target id
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateNote()

ilNoteGUI::updateNote ( )

update note

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

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

1413  {
1414  global $ilUser, $lng, $ilCtrl;
1415 
1416  $note = new ilNote(ilUtil::stripSlashes($_POST["note_id"]));
1417  $this->initNoteForm("edit", $note->getType(),
1418  $note);
1419 
1420 // if ($this->form->checkInput())
1421 // if ($_POST["note"] != "")
1422 // {
1423  $note->setText(ilUtil::stripSlashes($_POST["note"]));
1424  $note->setSubject(ilUtil::stripSlashes($_POST["sub_note"]));
1425  $note->setLabel(ilUtil::stripSlashes($_POST["note_label"]));
1426  if ($this->checkEdit($note))
1427  {
1428  $note->update();
1429 
1430  $this->notifyObserver("update", $note);
1431 
1432  $ilCtrl->setParameter($this, "note_mess", "mod");
1433  }
1434  $ilCtrl->redirect($this, "showNotes", "notes_top", $this->ajax);
1435 // }
1436 $ilCtrl->redirect($this, "showNotes", "notes_top", $this->ajax);
1437  $this->note_mess = "frmfld";
1438  $this->form->setValuesByPost();
1439  $_GET["note_id"] = $note->getId();
1440  $_GET["note_type"] = $note->getType();
1441  return $this->editNoteForm(false);
1442  }
initNoteForm($a_mode="edit", $a_type, $a_note=null)
Init note form.
$_POST['username']
Definition: cron.php:12
$_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
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.
global $ilUser
Definition: imgupload.php:15
global $lng
Definition: privfeed.php:40
+ Here is the call graph for this function:

Field Documentation

◆ $public_deletion_enabled

ilNoteGUI::$public_deletion_enabled = false

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

Referenced by checkDeletion().

◆ $repository_mode

ilNoteGUI::$repository_mode = false

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


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