ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
ilNoteGUI Class Reference

Notes GUI class. More...

+ Collaboration diagram for ilNoteGUI:

Public Member Functions

 __construct ( $a_rep_obj_id="", $a_obj_id="", $a_obj_type="", $a_include_subobjects=false, $a_news_id=0)
 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, ilGlobalTemplateInterface $a_main_tpl=null)
 Init javascript. More...
 
static getListNotesJSCall ($a_hash, $a_update_code=null)
 Get list notes js call. More...
 
static getListCommentsJSCall ($a_hash, $a_update_code=null)
 Get list comments js call. More...
 

Data Fields

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

Protected Member Functions

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

Static Protected Member Functions

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

Protected Attributes

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

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(), ui(), 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
$_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)
ui()
Definition: ui.php:5
static _lookupType($a_id, $a_reference=false)
lookup object type
const IL_NOTE_UNLABELED
Definition: class.ilNote.php:8
const IL_NOTE_QUESTION
$DIC
Definition: xapitoken.php:46
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 1365 of file class.ilNoteGUI.php.

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

1366  {
1367  $ilUser = $this->user;
1368  $lng = $this->lng;
1369  $ilCtrl = $this->ctrl;
1370  //ilLoggerFactory::getLogger("root")->notice("addNote");
1371  $this->initNoteForm("create", $_GET["note_type"]);
1372 
1373  //if ($this->form->checkInput())
1374  if ($_POST["note"] != "") {
1375  $note = new ilNote();
1376  $note->setObject($this->obj_type, $this->rep_obj_id, $this->obj_id, $this->news_id);
1377  $note->setInRepository($this->repository_mode);
1378  $note->setType($_GET["note_type"]);
1379  $note->setAuthor($ilUser->getId());
1380  $note->setText(ilUtil::stripslashes($_POST["note"]));
1381  // $note->setSubject($_POST["sub_note"]);
1382  // $note->setLabel($_POST["note_label"]);
1383  $note->create();
1384 
1385  $this->notifyObserver("new", $note);
1386 
1387  $ilCtrl->setParameter($this, "note_mess", "mod");
1388  // $ilCtrl->redirect($this, "showNotes", "notes_top", $this->ajax);
1389  }
1390  $ilCtrl->redirect($this, "showNotes", "notes_top", $this->ajax);
1391  // $this->note_mess = "frmfld";
1392 // $this->form->setValuesByPost();
1393 // return $this->addNoteForm(false);;
1394  }
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 1333 of file class.ilNoteGUI.php.

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

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

1700  {
1701  $this->observer[] = $a_callback;
1702  }

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

1662  {
1663  return $a_node_type . ";" . $a_node_id . ";" . $a_sub_id . ";" . $a_sub_type;
1664  }

◆ cancelAddNote()

ilNoteGUI::cancelAddNote ( )

cancel add note

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

References getNotesHTML().

1350  {
1351  return $this->getNotesHTML();
1352  }
getNotesHTML($a_init_form=true)
+ Here is the call graph for this function:

◆ cancelDelete()

ilNoteGUI::cancelDelete ( )

cancel deletion of note

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

References getNotesHTML().

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

◆ cancelUpdateNote()

ilNoteGUI::cancelUpdateNote ( )

cancel edit note

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

References getNotesHTML().

1358  {
1359  return $this->getNotesHTML();
1360  }
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 952 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().

953  {
956 
957  if ($ilUser->getId() == ANONYMOUS_USER_ID) {
958  return false;
959  }
960 
961  $is_author = ($a_note->getAuthor() == $ilUser->getId());
962 
963  if ($a_note->getType() == IL_NOTE_PRIVATE && $is_author) {
964  return true;
965  }
966 
967  if ($a_note->getType() == IL_NOTE_PUBLIC && $this->public_deletion_enabled) {
968  return true;
969  }
970 
971  if ($a_note->getType() == IL_NOTE_PUBLIC && $is_author && $ilSetting->get("comments_del_user", 0)) {
972  return true;
973  }
974 
975  return false;
976  }
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 981 of file class.ilNoteGUI.php.

References $ilUser, and $user.

Referenced by getNoteListHTML(), and updateNote().

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

◆ confirmDelete()

ilNoteGUI::confirmDelete ( )

cancel deletion of note

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

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

1484  {
1485  $ilCtrl = $this->ctrl;
1486  $lng = $this->lng;
1487  $ilUser = $this->user;
1488 
1489  $cnt = 0;
1490  foreach ($_POST["note"] as $id) {
1491  $note = new ilNote($id);
1492  if ($this->checkDeletion($note)) {
1493  $note->delete();
1494  $cnt++;
1495  }
1496  }
1497  if ($cnt > 1) {
1498  $ilCtrl->setParameter($this, "note_mess", "ntsdel");
1499  } else {
1500  $ilCtrl->setParameter($this, "note_mess", "ntdel");
1501  }
1502  $ilCtrl->redirect($this, "showNotes", "notes_top", $this->ajax);
1503  }
checkDeletion($a_note)
Check whether deletion is allowed.
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 1448 of file class.ilNoteGUI.php.

References getNotesHTML().

1449  {
1450  $this->delete_note = true;
1451  $this->note_mess = "qdel";
1452  return $this->getNotesHTML();
1453  }
getNotesHTML($a_init_form=true)
+ Here is the call graph for this function:

◆ deleteNotes()

ilNoteGUI::deleteNotes ( )

delete notes confirmation

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

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

1459  {
1460  $lng = $this->lng;
1461 
1462  if (!$_POST["note"]) {
1463  $this->note_mess = "noc";
1464  } else {
1465  $this->delete_note = true;
1466  $this->note_mess = "qdel";
1467  }
1468 
1469  return $this->getNotesHTML();
1470  }
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 1438 of file class.ilNoteGUI.php.

References getNotesHTML().

Referenced by updateNote().

1439  {
1440  $this->edit_note_form = true;
1441 
1442  return $this->getNotesHTML($a_init_form);
1443  }
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 1508 of file class.ilNoteGUI.php.

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

1509  {
1510  $tpl = new ilGlobalTemplate("tpl.main.html", true, true);
1511 
1512  $this->export_html = true;
1513  $this->multi_selection = false;
1514  $tpl->setVariable("CONTENT", $this->getNotesHTML());
1515  ilUtil::deliverData($tpl->get(), "notes.html");
1516  }
getNotesHTML($a_init_form=true)
static deliverData($a_data, $a_filename, $mime="application/octet-stream", $charset="")
deliver data for download via browser.
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
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 1776 of file class.ilNoteGUI.php.

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

Referenced by getHTML(), and updateWidget().

1777  {
1778  $f = $this->ui->factory();
1779  $r = $this->ui->renderer();
1780 
1781  $lng = $this->lng;
1782  $ctrl = $this->ctrl;
1783  $ctrl->setParameter($this, "news_id", $this->news_id);
1786  null,
1787  ilObject::_lookupType($this->rep_obj_id),
1788  $this->rep_obj_id,
1789  $this->obj_type,
1790  $this->obj_id,
1791  $this->news_id
1792  );
1793 
1794  $cnt = ilNote::_countNotesAndComments($this->rep_obj_id, $this->obj_id, $this->obj_type, $this->news_id);
1795  $cnt = $cnt[$this->rep_obj_id][IL_NOTE_PUBLIC];
1796 
1797  $tpl = new ilTemplate("tpl.note_widget_header.html", true, true, "Services/Notes");
1798  $widget_el_id = "notew_" . str_replace(";", "_", $hash);
1799  $ctrl->setParameter($this, "hash", $hash);
1800  $update_url = $ctrl->getLinkTarget($this, "updateWidget", "", true, false);
1801  $comps = array();
1802  if ($cnt > 0) {
1803  $c = $f->counter()->status((int) $cnt);
1804  $comps[] = $f->symbol()->glyph()->comment()->withCounter($c)->withAdditionalOnLoadCode(function ($id) use ($hash, $update_url, $widget_el_id) {
1805  return "$(\"#$id\").click(function(event) { " . self::getListCommentsJSCall($hash, "ilNotes.updateWidget(\"" . $widget_el_id . "\",\"" . $update_url . "\");") . "});";
1806  });
1807  $comps[] = $f->divider()->vertical();
1808  $tpl->setVariable("GLYPH", $r->render($comps));
1809  $tpl->setVariable("TXT_LATEST", $lng->txt("notes_latest_comment"));
1810  }
1811 
1812 
1813  $b = $f->button()->shy($lng->txt("notes_add_edit_comment"), "#")->withAdditionalOnLoadCode(function ($id) use ($hash,$update_url,$widget_el_id) {
1814  return "$(\"#$id\").click(function(event) { " . self::getListCommentsJSCall($hash, "ilNotes.updateWidget(\"" . $widget_el_id . "\",\"" . $update_url . "\");") . "});";
1815  });
1816  if ($ctrl->isAsynch()) {
1817  $tpl->setVariable("SHY_BUTTON", $r->renderAsync($b));
1818  } else {
1819  $tpl->setVariable("SHY_BUTTON", $r->render($b));
1820  }
1821 
1822  $this->widget_header = $tpl->get();
1823 
1824  $this->hide_new_form = true;
1825  $this->only_latest = true;
1826  $this->no_actions = true;
1827  $html = "<div id='" . $widget_el_id . "'>" . $this->getNoteListHTML(IL_NOTE_PUBLIC) . "</div>";
1828  $ctrl->setParameter($this, "news_id", $_GET["news_id"]);
1829  return $html;
1830  }
getNoteListHTML($a_type=IL_NOTE_PRIVATE, $a_init_form=true)
get notes/comments list as html code
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
$_GET["client_id"]
static _countNotesAndComments( $a_rep_obj_id, $a_sub_obj_id=null, $a_obj_type="", $a_news_id=0)
Get all notes related to a specific object.
const IL_NOTE_PUBLIC
Definition: class.ilNote.php:6
ui()
Definition: ui.php:5
static buildAjaxHash( $a_node_type, $a_node_id, $a_obj_type, $a_obj_id, $a_sub_type=null, $a_sub_id=null, $a_news_id=0)
Build ajax hash.
static _lookupType($a_id, $a_reference=false)
lookup object type
+ 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 1764 of file class.ilNoteGUI.php.

References getCommentsWidget().

1765  {
1766  return $this->getCommentsWidget();
1767  }
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 1641 of file class.ilNoteGUI.php.

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

1642  {
1643  if ($a_update_code === null) {
1644  $a_update_code = "null";
1645  } else {
1646  $a_update_code = "'" . $a_update_code . "'";
1647  }
1648 
1649  return "ilNotes.listComments(event, '" . $a_hash . "', " . $a_update_code . ");";
1650  }
+ 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 1623 of file class.ilNoteGUI.php.

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

1624  {
1625  if ($a_update_code === null) {
1626  $a_update_code = "null";
1627  } else {
1628  $a_update_code = "'" . $a_update_code . "'";
1629  }
1630 
1631  return "ilNotes.listNotes(event, '" . $a_hash . "', " . $a_update_code . ");";
1632  }
+ 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, $tpl, $txt, $user, ilObject\_exists(), ilNote\_getNotesOfObject(), ilObjUser\_getPersonalPicturePath(), ilObjUser\_lookupLogin(), ilContainerReference\_lookupTitle(), ilObject\_lookupTitle(), checkDeletion(), checkEdit(), ilGlyphGUI\CLOSE, ilDatePresentation\formatDate(), ilGlyphGUI\get(), ilUtil\getImagePath(), ilUserUtil\getNamePresentation(), getSubObjectTitle(), ilUtil\getSystemMessageHTML(), IL_CAL_DATETIME, IL_NOTE_PRIVATE, IL_NOTE_PUBLIC, ilUtil\img(), initNoteForm(), renderLink(), renderTargets(), ilDatePresentation\setUseRelativeDates(), and ilDatePresentation\useRelativeDates().

Referenced by getCommentsWidget(), and getNotesHTML().

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", "id='ilNoteFormAjax'");
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  /*
607  if (!$this->add_note_form && !$this->edit_note_form && !$this->delete_note &&
608  !$this->export_html && !$this->print && $ilUser->getId() != ANONYMOUS_USER_ID && !$this->hide_new_form) {
609  if (!$this->inc_sub) { // we cannot offer add button if aggregated notes
610  // are displayed
611  if ($this->rep_obj_id > 0 || $a_type != IL_NOTE_PUBLIC) {
612  $tpl->setCurrentBlock("add_note_btn");
613  if ($a_type == IL_NOTE_PUBLIC) {
614  $tpl->setVariable("TXT_ADD_NOTE", $lng->txt("notes_add_comment"));
615  } else {
616  $tpl->setVariable("TXT_ADD_NOTE", $lng->txt("add_note"));
617  }
618  $tpl->setVariable("LINK_ADD_NOTE", $ilCtrl->getLinkTargetByClass("ilnotegui", "addNoteForm") .
619  "#note_edit");
620  $tpl->parseCurrentBlock();
621  }
622  }
623  }*/
624 
625  // show show/hide button for note list
626  if (count($notes) > 0 && $this->enable_hiding && !$this->delete_note
627  && !$this->export_html && !$this->print && !$this->edit_note_form
628  && !$this->add_note_form) {
629  if ($user_setting_notes_by_type == "n") {
630  if ($a_type == IL_NOTE_PUBLIC) {
631  $txt = $lng->txt("notes_show_comments");
632  } else {
633  $txt = $lng->txt("show_" . $suffix . "_notes");
634  }
635  $this->renderLink($tpl, "show_notes", $txt, "showNotes", "notes_top");
636  } else {
637  // never individually hide for anonymous users
638  if (($ilUser->getId() != ANONYMOUS_USER_ID)) {
639  if ($a_type == IL_NOTE_PUBLIC) {
640  $txt = $lng->txt("notes_hide_comments");
641  } else {
642  $txt = $lng->txt("hide_" . $suffix . "_notes");
643  }
644  $this->renderLink($tpl, "hide_notes", $txt, "hideNotes", "notes_top");
645 
646  // show all public notes / my notes only switch
647  if ($a_type == IL_NOTE_PUBLIC) {
648  if ($user_setting_notes_public_all == "n") {
649  $this->renderLink(
650  $tpl,
651  "all_pub_notes",
652  $lng->txt("notes_all_comments"),
653  "showAllPublicNotes",
654  "notes_top"
655  );
656  } else {
657  $this->renderLink(
658  $tpl,
659  "my_pub_notes",
660  $lng->txt("notes_my_comments"),
661  "showMyPublicNotes",
662  "notes_top"
663  );
664  }
665  }
666  }
667  }
668  }
669 
670  // show add new note text area
671  if (!$this->edit_note_form && $user_setting_notes_by_type != "n" &&
672  !$this->delete_note && $ilUser->getId() != ANONYMOUS_USER_ID && !$this->hide_new_form) {
673  if ($a_init_form) {
674  $this->initNoteForm("create", $a_type);
675  }
676 
677  $tpl->setCurrentBlock("edit_note_form");
678  // $tpl->setVariable("EDIT_FORM", $this->form->getHTML());
679  $tpl->setVariable("EDIT_FORM", $this->form_tpl->get());
680  $tpl->parseCurrentBlock();
681 
682  $tpl->parseCurrentBlock();
683  $tpl->setCurrentBlock("note_row");
684  $tpl->parseCurrentBlock();
685  }
686 
687  // list all notes
688  if ($user_setting_notes_by_type != "n" || !$this->enable_hiding) {
691 
692  if (sizeof($notes) && !$this->only_latest) {
693  if ((int) $_SESSION["comments_sort_asc"] == 1) {
694  $sort_txt = $lng->txt("notes_sort_desc");
695  $sort_cmd = "listSortDesc";
696  } else {
697  $sort_txt = $lng->txt("notes_sort_asc");
698  $sort_cmd = "listSortAsc";
699  }
700  $this->renderLink($tpl, "sort_list", $sort_txt, $sort_cmd, $anch);
701  }
702 
703  $notes_given = false;
704  foreach ($notes as $note) {
705  if ($this->only_latest && $notes_given) {
706  continue;
707  }
708 
709 
710  if ($this->edit_note_form && ($note->getId() == $_GET["note_id"])
711  && $a_type == $_GET["note_type"]) {
712  if ($a_init_form) {
713  $this->initNoteForm("edit", $a_type, $note);
714  }
715  $tpl->setCurrentBlock("edit_note_form");
716  // $tpl->setVariable("EDIT_FORM", $this->form->getHTML());
717  $tpl->setVariable("EDIT_FORM", $this->form_tpl->get());
718  $tpl->parseCurrentBlock();
719  } else {
720  $cnt_col = 2;
721 
722  // delete note stuff for all private notes
723  if ($this->checkDeletion($note)
724  && !$this->delete_note
725  && !$this->export_html && !$this->print
726  && !$this->edit_note_form && !$this->add_note_form && !$this->no_actions) {
727  $ilCtrl->setParameterByClass("ilnotegui", "note_id", $note->getId());
728  $this->renderLink(
729  $tpl,
730  "delete_note",
731  $lng->txt("delete"),
732  "deleteNote",
733  "note_" . $note->getId()
734  );
735  }
736 
737  // checkboxes in multiselection mode
738  if ($this->multi_selection && !$this->delete_note) {
739  $tpl->setVariable("CHECKBOX_CLASS", "ilNotesCheckboxes");
740  $tpl->setCurrentBlock("checkbox_col");
741  $tpl->setVariable("CHK_NOTE", "note[]");
742  $tpl->setVariable("CHK_NOTE_ID", $note->getId());
743  $tpl->parseCurrentBlock();
744  $cnt_col = 1;
745  }
746 
747  // edit note stuff for all private notes
748  if ($this->checkEdit($note)) {
749  if (!$this->delete_note && !$this->export_html && !$this->print
750  && !$this->edit_note_form && !$this->add_note_form && !$this->no_actions) {
751  $ilCtrl->setParameterByClass("ilnotegui", "note_id", $note->getId());
752  $this->renderLink(
753  $tpl,
754  "edit_note",
755  $lng->txt("edit"),
756  "editNoteForm",
757  "note_edit"
758  );
759  }
760  }
761 
762  $tpl->setVariable("CNT_COL", $cnt_col);
763 
764  // output author account
765  if ($a_type == IL_NOTE_PUBLIC && ilObject::_exists($note->getAuthor())) {
766  //$tpl->setCurrentBlock("author");
767  //$tpl->setVariable("VAL_AUTHOR", ilObjUser::_lookupLogin($note->getAuthor()));
768  //$tpl->parseCurrentBlock();
769  $tpl->setCurrentBlock("user_img");
770  $tpl->setVariable(
771  "USR_IMG",
772  ilObjUser::_getPersonalPicturePath($note->getAuthor(), "xsmall")
773  );
774  $tpl->setVariable("USR_ALT", $lng->txt("user_image") . ": " .
775  ilObjUser::_lookupLogin($note->getAuthor()));
776  $tpl->parseCurrentBlock();
777  $tpl->setVariable(
778  "TXT_USR",
779  ilUserUtil::getNamePresentation($note->getAuthor(), false, false) . " - "
780  );
781  }
782 
783  // last edited
784  if ($note->getUpdateDate() != null) {
785  $tpl->setVariable("TXT_LAST_EDIT", $lng->txt("last_edited_on"));
786  $tpl->setVariable(
787  "DATE_LAST_EDIT",
788  ilDatePresentation::formatDate(new ilDate($note->getUpdateDate(), IL_CAL_DATETIME))
789  );
790  } else {
791  $tpl->setVariable(
792  "VAL_DATE",
793  ilDatePresentation::formatDate(new ilDate($note->getCreationDate(), IL_CAL_DATETIME))
794  );
795  }
796 
797  // hidden note ids for deletion
798  if ($this->delete_note) {
799  $tpl->setCurrentBlock("delete_ids");
800  $tpl->setVariable("HID_NOTE", "note[]");
801  $tpl->setVariable("HID_NOTE_ID", $note->getId());
802  $tpl->parseCurrentBlock();
803  }
804  $target = $note->getObject();
805 
806 
807  $tpl->setCurrentBlock("note");
808  $text = (trim($note->getText()) != "")
809  ? nl2br($note->getText())
810  : "<p class='subtitle'>" . $lng->txt("note_content_removed") . "</p>";
811  $tpl->setVariable("NOTE_TEXT", $text);
812  $tpl->setVariable("VAL_SUBJECT", $note->getSubject());
813  $tpl->setVariable("NOTE_ID", $note->getId());
814 
815  // target objects
816  $tpl->setVariable(
817  "TARGET_OBJECTS",
818  $this->renderTargets($note)
819  );
820 
821  $tpl->parseCurrentBlock();
822  }
823  $tpl->setCurrentBlock("note_row");
824  $tpl->parseCurrentBlock();
825  $notes_given = true;
826  }
827 
828  if (!$notes_given) {
829  $tpl->setCurrentBlock("no_notes");
830  if ($a_type == IL_NOTE_PUBLIC && !$this->only_latest) {
831  $tpl->setVariable("NO_NOTES", $lng->txt("notes_no_comments"));
832  }
833  $tpl->parseCurrentBlock();
834  }
835 
837 
838  // multiple items commands
839  if ($this->multi_selection && !$this->delete_note && !$this->edit_note_form
840  && count($notes) > 0) {
841  if ($a_type == IL_NOTE_PRIVATE) {
842  $tpl->setCurrentBlock("delete_cmd");
843  $tpl->setVariable("TXT_DELETE_NOTES", $this->lng->txt("delete"));
844  $tpl->parseCurrentBlock();
845  }
846 
847  $tpl->setCurrentBlock("multiple_commands");
848  $tpl->setVariable("TXT_SELECT_ALL", $this->lng->txt("select_all"));
849  $tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.svg"));
850  $tpl->setVariable("ALT_ARROW", $this->lng->txt("actions"));
851  $tpl->setVariable("TXT_PRINT_NOTES", $this->lng->txt("print"));
852  $tpl->setVariable("TXT_EXPORT_NOTES", $this->lng->txt("exp_html"));
853  $tpl->parseCurrentBlock();
854  }
855 
856  // delete / cancel row
857  if ($this->delete_note) {
858  $tpl->setCurrentBlock("delete_cancel");
859  $tpl->setVariable("TXT_DEL_NOTES", $this->lng->txt("delete"));
860  $tpl->setVariable("TXT_CANCEL_DEL_NOTES", $this->lng->txt("cancel"));
861  $tpl->parseCurrentBlock();
862  }
863 
864  // print
865  if ($this->print) {
866  $tpl->touchBlock("print_js");
867  $tpl->setCurrentBlock("print_back");
868  $tpl->setVariable("LINK_BACK", $this->ctrl->getLinkTarget($this, "showNotes"));
869  $tpl->setVariable("TXT_BACK", $this->lng->txt("back"));
870  $tpl->parseCurrentBlock();
871  }
872  }
873 
874  // message
875  switch ($_GET["note_mess"] != "" ? $_GET["note_mess"] : $this->note_mess) {
876  case "mod":
877  $mtype = "success";
878  $mtxt = $lng->txt("msg_obj_modified");
879  break;
880 
881  case "ntsdel":
882  $mtype = "success";
883  $mtxt = ($a_type == IL_NOTE_PRIVATE)
884  ? $lng->txt("notes_notes_deleted")
885  : $lng->txt("notes_comments_deleted");
886  break;
887 
888  case "ntdel":
889  $mtype = "success";
890  $mtxt = ($a_type == IL_NOTE_PRIVATE)
891  ? $lng->txt("notes_note_deleted")
892  : $lng->txt("notes_comment_deleted");
893  break;
894 
895  case "frmfld":
896  $mtype = "failure";
897  $mtxt = $lng->txt("form_input_not_valid");
898  break;
899 
900  case "qdel":
901  $mtype = "question";
902  $mtxt = $lng->txt("info_delete_sure");
903  break;
904 
905  case "noc":
906  $mtype = "failure";
907  $mtxt = $lng->txt("no_checkbox");
908  break;
909  }
910  if ($mtxt != "") {
911  $tpl->setVariable("MESS", ilUtil::getSystemMessageHTML($mtxt, $mtype));
912  } else {
913  $tpl->setVariable("MESS", "");
914  }
915 
916  if ($this->widget_header != "") {
917  $tpl->setVariable("WIDGET_HEADER", $this->widget_header);
918  }
919 
920 
921  if ($this->delete_note && count($notes) == 0) {
922  return "";
923  } else {
924  return $tpl->get();
925  }
926  }
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
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
$_SESSION["AccountId"]
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data
$_GET["client_id"]
static getSystemMessageHTML($a_txt, $a_type="info")
Get HTML for a system message.
static get($a_glyph, $a_text="")
Get glyph html.
renderLink($a_tpl, $a_var, $a_txt, $a_cmd, $a_anchor="")
Render a link.
static setUseRelativeDates($a_status)
set use relative dates
static _lookupTitle($a_id)
lookup object title
static _getNotesOfObject( $a_rep_obj_id, $a_obj_id, $a_obj_type, $a_type=IL_NOTE_PRIVATE, $a_incl_sub=false, $a_filter="", $a_all_public="y", $a_repository_mode=true, $a_sort_ascending=false, $a_news_id=0)
get all notes related to a specific object
checkEdit($a_note)
Check edit.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
static useRelativeDates()
check if relative dates are used
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)
$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:13
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
static _getPersonalPicturePath( $a_usr_id, $a_size="small", $a_force_pic=false, $a_prevent_no_photo_image=false)
Get path to personal picture.
$_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(), ilUtil\getSystemMessageHTML(), IL_NOTE_PRIVATE, IL_NOTE_PUBLIC, and renderLink().

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

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  ilUtil::getSystemMessageHTML($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
exit
Definition: login.php:29
static commentsActivated($a_rep_obj_id, $a_obj_id, $a_obj_type, $a_news_id=0)
Are comments activated for object?
const IL_NOTE_PRIVATE
Definition: class.ilNote.php:5
$_GET["client_id"]
static getSystemMessageHTML($a_txt, $a_type="info")
Get HTML for a system message.
renderLink($a_tpl, $a_var, $a_txt, $a_cmd, $a_anchor="")
Render a link.
global $ilCtrl
Definition: ilias.php:18
const IL_NOTE_PUBLIC
Definition: class.ilNote.php:6
$ilUser
Definition: imgupload.php:18
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 1100 of file class.ilNoteGUI.php.

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

1101  {
1102  $lng = $this->lng;
1103  $ilCtrl = $this->ctrl;
1104  $ilUser = $this->user;
1105 
1106  $tpl = new ilTemplate("tpl.pd_note.html", true, true, "Services/Notes");
1107  $note = new ilNote($note_id);
1108  $target = $note->getObject();
1109 
1110  if ($note->getAuthor() != $ilUser->getId()) {
1111  return;
1112  }
1113 
1114  $tpl->setCurrentBlock("edit_note");
1115  $ilCtrl->setParameterByClass("ilnotegui", "rel_obj", $target["rep_obj_id"]);
1116  $ilCtrl->setParameterByClass("ilnotegui", "note_id", $note_id);
1117  $ilCtrl->setParameterByClass("ilnotegui", "note_type", $note->getType());
1118  $tpl->setVariable(
1119  "LINK_EDIT_NOTE",
1120  $ilCtrl->getLinkTargetByClass(
1121  array("ildashboardgui", "ilpdnotesgui", "ilnotegui"),
1122  "editNoteForm"
1123  )
1124  );
1125  $tpl->setVariable("TXT_EDIT_NOTE", $lng->txt("edit"));
1126  $tpl->parseCurrentBlock();
1127  $ilCtrl->clearParametersByClass("ilnotegui");
1128 
1129  // last edited
1130  if ($note->getUpdateDate() != null) {
1131  $tpl->setVariable("TXT_LAST_EDIT", $lng->txt("last_edited_on"));
1132  $tpl->setVariable(
1133  "DATE_LAST_EDIT",
1134  ilDatePresentation::formatDate(new ilDate($note->getUpdateDate(), IL_CAL_DATETIME))
1135  );
1136  } else {
1137  //$tpl->setVariable("TXT_CREATED", $lng->txt("create_date"));
1138  $tpl->setVariable(
1139  "VAL_DATE",
1140  ilDatePresentation::formatDate(new ilDate($note->getCreationDate(), IL_CAL_DATETIME))
1141  );
1142  }
1143 
1144  $tpl->setVariable("VAL_SUBJECT", $note->getSubject());
1145  $text = (trim($note->getText()) != "")
1146  ? nl2br($note->getText())
1147  : "<p class='subtitle'>" . $lng->txt("note_content_removed") . "</p>";
1148  $tpl->setVariable("NOTE_TEXT", $text);
1149  $tpl->setVariable("TARGET_OBJECTS", $this->renderTargets($note));
1150  return $tpl->get();
1151  }
const IL_CAL_DATETIME
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
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.
$ilUser
Definition: imgupload.php:18
renderTargets($a_note)
show related objects as links
+ 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 935 of file class.ilNoteGUI.php.

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

Referenced by getNoteListHTML(), and renderTargets().

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

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

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

◆ initJavascript()

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

Init javascript.

Definition at line 1589 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().

1590  {
1591  global $DIC;
1592 
1593  if ($a_main_tpl != null) {
1594  $tpl = $a_main_tpl;
1595  } else {
1596  $tpl = $DIC["tpl"];
1597  }
1598  $lng = $DIC->language();
1599 
1600  $lng->loadLanguageModule("notes");
1601 
1602  include_once("./Services/UIComponent/Modal/classes/class.ilModalGUI.php");
1604 
1605  $lng->toJs(array("private_notes", "notes_public_comments"), $tpl);
1606 
1607  include_once("./Services/YUI/classes/class.ilYuiUtil.php");
1608  ilYuiUtil::initPanel(false, $tpl);
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  }
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
static initJS(ilGlobalTemplateInterface $a_main_tpl=null)
Init javascript.
static initPanel($a_resize=false, ilGlobalTemplateInterface $a_main_tpl=null)
Init yui panel.
static initjQuery(ilGlobalTemplateInterface $a_tpl=null)
inits and adds the jQuery JS-File to the global or a passed template
$DIC
Definition: xapitoken.php:46
+ 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 998 of file class.ilNoteGUI.php.

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

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

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

References $_SESSION.

1747  {
1748  $_SESSION["comments_sort_asc"] = 1;
1749  return $this->getNotesHtml();
1750  }
$_SESSION["AccountId"]

◆ listSortDesc()

ilNoteGUI::listSortDesc ( )
protected

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

References $_SESSION.

1753  {
1754  $_SESSION["comments_sort_asc"] = 0;
1755  return $this->getNotesHtml();
1756  }
$_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 1710 of file class.ilNoteGUI.php.

References $_GET, $param, and ilObject\_getAllReferences().

Referenced by addNote(), and updateNote().

1711  {
1712  if (is_array($this->observer) && count($this->observer) > 0) {
1713  foreach ($this->observer as $item) {
1714  $param = $a_note->getObject();
1715  //TODO refactor this, check what is this news_id from getObject
1716  unset($param['news_id']);
1717  $param["action"] = $a_action;
1718  $param["note_id"] = $a_note->getId();
1719 
1720  call_user_func_array($item, $param);
1721  }
1722  }
1723 
1724  //ajax calls don't have callbacks in the observer. (modals)
1725  if ($this->ajax) {
1726  $ref = (int) $_GET['ref_id'];
1727  if (in_array($ref, ilObject::_getAllReferences($this->rep_obj_id))) {
1728  if ($this->obj_type == "pg") {
1729  $gui = new ilLMPresentationGUI(
1730  "",
1731  false,
1732  "",
1733  false
1734  );
1735  $gui->observeNoteAction($this->rep_obj_id, $this->obj_id, $this->obj_type, $a_action, $a_note->getId());
1736  }
1737 
1738  if ($this->obj_type == "wpg") {
1739  $gui = new ilWikiPageGUI($this->obj_id, 0, $ref);
1740  $gui->observeNoteAction($this->obj_id, $this->obj_id, $this->obj_type, $a_action, $a_note->getId());
1741  }
1742  }
1743  }
1744  }
$_GET["client_id"]
static _getAllReferences($a_id)
get all reference ids of object
Class ilLMPresentationGUI.
$param
Definition: xapitoken.php:31
Class ilWikiPage GUI class.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ printNotes()

ilNoteGUI::printNotes ( )

notes print view screen

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

References $tpl, exit, and getNotesHTML().

1522  {
1523  $tpl = new ilTemplate("tpl.main.html", true, true);
1524 
1525  $this->print = true;
1526  $this->multi_selection = false;
1527  $tpl->setVariable("CONTENT", $this->getNotesHTML());
1528  echo $tpl->get();
1529  exit;
1530  }
getNotesHTML($a_init_form=true)
exit
Definition: login.php:29
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
+ 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 1669 of file class.ilNoteGUI.php.

References $ctrl, and $ilCtrl.

Referenced by getNoteListHTML(), and getNotesHTML().

1670  {
1671  $ilCtrl = $this->ctrl;
1672 
1673  $low_var = strtolower($a_var);
1674  $up_var = strtoupper($a_var);
1675 
1676  if ($this->ajax) {
1677  $a_tpl->setVariable("LINK_" . $up_var, "#");
1678  $oc = "onclick = \"ilNotes.cmdAjaxLink(event, '" .
1679  $ilCtrl->getLinkTargetByClass("ilnotegui", $a_cmd, "", true) .
1680  "');\"";
1681  $a_tpl->setVariable("ON_CLICK_" . $up_var, $oc);
1682  } else {
1683  $a_tpl->setVariable(
1684  "LINK_" . $up_var,
1685  $ilCtrl->getLinkTargetByClass("ilnotegui", $a_cmd, $a_anchor)
1686  );
1687  }
1688 
1689  $a_tpl->setCurrentBlock($low_var);
1690  $a_tpl->setVariable("TXT_" . $up_var, $a_txt);
1691  $a_tpl->parseCurrentBlock();
1692  }
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 1156 of file class.ilNoteGUI.php.

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

Referenced by getNoteListHTML(), and getPDNoteHTML().

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

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

1566  {
1567  $ilUser = $this->user;
1568 
1569  $ilUser->writePref("notes_pub_all", "y");
1570 
1571  return $this->getNotesHTML();
1572  }
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 1577 of file class.ilNoteGUI.php.

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

1578  {
1579  $ilUser = $this->user;
1580 
1581  $ilUser->writePref("notes_pub_all", "n");
1582 
1583  return $this->getNotesHTML();
1584  }
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 1535 of file class.ilNoteGUI.php.

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

1536  {
1537  $ilUser = $this->user;
1538 
1539  $suffix = ($_GET["note_type"] == IL_NOTE_PRIVATE)
1540  ? "private"
1541  : "public";
1542  $ilUser->writePref("notes_" . $suffix, "y");
1543 
1544  return $this->getNotesHTML();
1545  }
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 1399 of file class.ilNoteGUI.php.

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

1400  {
1401  $ilUser = $this->user;
1402  $lng = $this->lng;
1403  $ilCtrl = $this->ctrl;
1404 
1405  $note = new ilNote(ilUtil::stripSlashes($_POST["note_id"]));
1406  $this->initNoteForm(
1407  "edit",
1408  $note->getType(),
1409  $note
1410  );
1411 
1412  // if ($this->form->checkInput())
1413  // if ($_POST["note"] != "")
1414  // {
1415  $note->setText(ilUtil::stripSlashes($_POST["note"]));
1416  $note->setSubject(ilUtil::stripSlashes($_POST["sub_note"]));
1417  $note->setLabel(ilUtil::stripSlashes($_POST["note_label"]));
1418  if ($this->checkEdit($note)) {
1419  $note->update();
1420 
1421  $this->notifyObserver("update", $note);
1422 
1423  $ilCtrl->setParameter($this, "note_mess", "mod");
1424  }
1425  $ilCtrl->redirect($this, "showNotes", "notes_top", $this->ajax);
1426  // }
1427  $ilCtrl->redirect($this, "showNotes", "notes_top", $this->ajax);
1428  $this->note_mess = "frmfld";
1429  $this->form->setValuesByPost();
1430  $_GET["note_id"] = $note->getId();
1431  $_GET["note_type"] = $note->getType();
1432  return $this->editNoteForm(false);
1433  }
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 1838 of file class.ilNoteGUI.php.

References exit, and getCommentsWidget().

1839  {
1840  echo $this->getCommentsWidget();
1841  exit;
1842  }
exit
Definition: login.php:29
getCommentsWidget()
Get widget.
+ Here is the call graph for this function:

Field Documentation

◆ $access

ilNoteGUI::$access
protected

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

Referenced by renderTargets().

◆ $ctrl

◆ $default_command

ilNoteGUI::$default_command = "getNotesHTML"
protected

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

Referenced by getDefaultCommand().

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