ILIAS  release_8 Revision v8.24
ilNoteGUI Class Reference

Notes GUI class. More...

+ Collaboration diagram for ilNoteGUI:

Public Member Functions

 __construct ( $a_rep_obj_id=0, int $a_obj_id=0, string $a_obj_type="", bool $a_include_subobjects=false, int $a_news_id=0, bool $ajax=true, string $search_text="")
 
 setShowEmptyListMessage (bool $a_val)
 
 getShowEmptyListMessage ()
 
 setShowHeader (bool $a_val)
 
 getShowHeader ()
 
 setUseObjectTitleHeader (bool $a_val)
 
 getUseObjectTitleHeader ()
 
 setDefaultCommand (string $a_val)
 
 setHideNewForm (bool $a_val)
 
 getDefaultCommand ()
 
 executeCommand ()
 
 enablePrivateNotes (bool $a_enable=true)
 
 enablePublicNotes (bool $a_enable=true)
 
 enableCommentsSettings (bool $a_enable=true)
 
 enablePublicNotesDeletion (bool $a_enable=true)
 
 enableTargets (bool $a_enable=true)
 
 setRepositoryMode (bool $a_value)
 
 getNotesHTML ()
 
 getCommentsHTML ()
 
 getListHTML (bool $a_init_form=true)
 
 activateComments ()
 
 deactivateComments ()
 
 getNoteListHTML (int $a_type=Note::PRIVATE, bool $a_init_form=true)
 
 getTarget (Note $note)
 show related objects as links More...
 
 addNoteForm (bool $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 ()
 
 editNoteForm (bool $a_init_form=true)
 get notes list including add note area More...
 
 renderContent (string $content)
 Render content into notes wrapper. More...
 
 cancelDelete ()
 
 confirmDelete ()
 
 exportNotesHTML ()
 export selected notes to html More...
 
 getShyButton (string $a_var, string $a_txt, string $a_cmd, string $a_anchor="", int $note_id=0)
 
 getButton (string $a_var, string $a_txt, string $a_cmd, string $a_anchor="")
 
 addObserver (callable $a_callback)
 Add observer. More...
 
 getHTML ()
 Get HTML. More...
 
 setExportMode ()
 

Static Public Member Functions

static getListNotesJSCall (string $a_hash, string $a_update_code=null)
 Get list notes js call. More...
 
static getListCommentsJSCall (string $a_hash, string $a_update_code=null)
 Get list comments js call. More...
 

Data Fields

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

Protected Member Functions

 renderComponents (array $components)
 
 getNotes (int $a_type)
 
 getSortationControl ()
 
 getItemGroupTitle (int $obj_id=0)
 
 getItemForNote (Note $note, bool $actions=true)
 
 getNoteTextPlaceholder (Note $note)
 
 getNoteText (Note $note)
 
 getSubObjectTitle (int $parent_obj_id, int $sub_obj_id)
 Get sub object title if available with callback. More...
 
 getNoteForm (string $mode, int $type, Note $note=null)
 
 deleteNote ()
 
 listSortAsc ()
 
 listSortDesc ()
 
 getCommentsWidget ()
 
 updateWidget ()
 
 getOriginHeader ()
 

Protected Attributes

array $notes = null
 
ILIAS Notes InternalGUIService $gui
 
string $search_text
 
ILIAS Notes AccessManager $notes_access
 
ILIAS Notes InternalDataService $data
 
ilWorkspaceAccessHandler $wsp_access_handler
 
ilWorkspaceTree $wsp_tree
 
bool $public_enabled
 
StandardGUIRequest $request
 
NotesManager $manager
 
bool $targets_enabled = false
 
bool $export_html = false
 
bool $print = false
 
bool $comments_settings = false
 
string $obj_type
 
bool $private_enabled
 
bool $edit_note_form
 
bool $add_note_form
 
bool $ajax
 
bool $inc_sub
 
int $obj_id
 
 $rep_obj_id
 
ilCtrl $ctrl
 
ilLanguage $lng
 
ilObjUser $user
 
ilSetting $settings
 
ilObjectDefinition $obj_definition
 
ilTree $tree
 
ilAccessHandler $access
 
string $default_command = "getListHTML"
 
array $observer = []
 
ILIAS DI UIServices $ui
 
int $news_id = 0
 
bool $hide_new_form = false
 
bool $only_latest = false
 
string $widget_header = ""
 
bool $no_actions = false
 
bool $enable_sorting = true
 
bool $user_img_export_html = false
 
ilLogger $log
 
ilTemplate $form_tpl
 
int $requested_note_type = 0
 
int $requested_note_id = 0
 
string $requested_note_mess = ""
 
int $requested_news_id = 0
 
bool $delete_note = false
 
string $note_mess = ""
 
array $item_list_gui = []
 
bool $use_obj_title_header = true
 
bool $show_empty_list_message = true
 
bool $show_header = true
 

Detailed Description

Notes GUI class.

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

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

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

Constructor & Destructor Documentation

◆ __construct()

ilNoteGUI::__construct (   $a_rep_obj_id = 0,
int  $a_obj_id = 0,
string  $a_obj_type = "",
bool  $a_include_subobjects = false,
int  $a_news_id = 0,
bool  $ajax = true,
string  $search_text = "" 
)
Parameters
int | int[]$a_rep_obj_idobject id of repository object (0 for personal desktop)
int$a_obj_idsub-object id (0 for repository items, user id for personal desktop)
string$a_obj_type"pd" for personal desktop
bool$a_include_subobjectsinclude all subobjects of rep object (e.g. pages)
int$a_news_id
bool$ajax
Exceptions
ilCtrlException

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

108 {
109 global $DIC;
110
111 $this->user = $DIC->user();
112 $this->settings = $DIC->settings();
113 $this->obj_definition = $DIC["objDefinition"];
114 $this->tree = $DIC->repositoryTree();
115 $this->access = $DIC->access();
116 $this->ui = $DIC->ui();
117 $ilCtrl = $DIC->ctrl();
118 $this->lng = $DIC->language();
119 $this->log = ilLoggerFactory::getLogger('note');
120 $this->search_text = $search_text;
121
122 $ns = $DIC->notes()->internal();
123 $this->manager = $ns
124 ->domain()
125 ->notes();
126 $this->request = $ns
127 ->gui()
128 ->standardRequest();
129 $this->data = $ns->data();
130 $this->gui = $ns->gui();
131 $this->notes_access = $ns->domain()->noteAccess();
132
133 $this->lng->loadLanguageModule("notes");
134
135 $ilCtrl->saveParameter($this, "notes_only");
136
137 $this->rep_obj_id = $a_rep_obj_id;
138 $this->obj_id = $a_obj_id;
139 $this->obj_type = $a_obj_type;
140 $this->inc_sub = $a_include_subobjects;
141 $this->news_id = $a_news_id;
142
143 // auto-detect object type
144 if (!is_array($a_rep_obj_id) && !$this->obj_type && $a_rep_obj_id) {
145 $this->obj_type = ilObject::_lookupType($a_rep_obj_id);
146 }
147
148 $this->ajax = $ajax;
149
150 $this->ctrl = $ilCtrl;
151
152 $this->add_note_form = false;
153 $this->edit_note_form = false;
154 $this->private_enabled = false;
155
156 if (!is_array($this->rep_obj_id)) {
157 if ($this->manager->commentsActive($this->rep_obj_id)) {
158 $this->public_enabled = true;
159 } else {
160 $this->public_enabled = false;
161 }
162 }
163 $this->targets_enabled = false;
164 $this->export_html = false;
165 $this->print = false;
166 $this->comments_settings = false;
167
168 // default: notes for repository objects
169 $this->setRepositoryMode(true);
170
171 $this->ctrl->saveParameter($this, "note_type");
172 $this->requested_note_type = $this->request->getNoteType();
173 $this->requested_note_id = $this->request->getNoteId();
174 $this->requested_note_mess = $this->request->getNoteMess();
175 $this->requested_news_id = $this->request->getNewsId();
176 }
static getLogger(string $a_component_id)
Get component logger.
string $search_text
setRepositoryMode(bool $a_value)
static _lookupType(int $id, bool $reference=false)
global $DIC
Definition: feed.php:28

References $ajax, $DIC, $search_text, ilObject\_lookupType(), ILIAS\Repository\access(), ILIAS\Repository\ctrl(), ilLoggerFactory\getLogger(), ILIAS\Repository\lng(), setRepositoryMode(), ILIAS\Repository\settings(), ILIAS\Repository\ui(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

Member Function Documentation

◆ activateComments()

ilNoteGUI::activateComments ( )

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

354 : void
355 {
356 $ilCtrl = $this->ctrl;
357
358 if ($this->comments_settings) {
359 $this->manager->activateComments($this->rep_obj_id, true);
360 }
361
362 $ilCtrl->redirectByClass("ilnotegui", "getCommentsHTML", "", $this->ajax);
363 }
redirectByClass( $a_class, string $a_cmd=null, string $a_anchor=null, bool $is_async=false)
@inheritDoc

References $ctrl, and ilCtrl\redirectByClass().

+ Here is the call graph for this function:

◆ addNote()

ilNoteGUI::addNote ( )

add note

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

1001 : void
1002 {
1004 $ilCtrl = $this->ctrl;
1005
1006 $text = $this->getNoteForm(
1007 "create",
1008 $this->requested_note_type
1009 )->getData("note") ?? "";
1010
1011 //if ($this->form->checkInput())
1012 if ($text !== "" && !is_array($this->rep_obj_id)) {
1013 $context = $this->data->context(
1014 $this->rep_obj_id,
1015 $this->obj_id,
1016 $this->obj_type,
1017 $this->news_id,
1018 $this->repository_mode
1019 );
1020 $note = $this->data->note(
1021 0,
1022 $context,
1023 $text,
1024 $ilUser->getId(),
1025 $this->requested_note_type
1026 );
1027 $this->manager->createNote(
1028 $note,
1029 $this->observer
1030 );
1031
1032 $ilCtrl->setParameter($this, "note_mess", "mod");
1033 }
1034 $ilCtrl->redirect($this, "getListHTML", "", $this->ctrl->isAsynch());
1035 }
ilObjUser $user
getNoteForm(string $mode, int $type, Note $note=null)
$ilUser
Definition: imgupload.php:34
$context
Definition: webdav.php:29

References $context, $ilUser, and ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ addNoteForm()

ilNoteGUI::addNoteForm ( bool  $a_init_form = true)

get notes list including add note area

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

977 : string {
978 $this->add_note_form = true;
979 return $this->getListHTML($a_init_form);
980 }
getListHTML(bool $a_init_form=true)

◆ addObserver()

ilNoteGUI::addObserver ( callable  $a_callback)

Add observer.

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

1285 : void {
1286 $this->observer[] = $a_callback;
1287 }

◆ cancelAddNote()

ilNoteGUI::cancelAddNote ( )

cancel add note

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

985 : string
986 {
987 return $this->getListHTML();
988 }

◆ cancelDelete()

ilNoteGUI::cancelDelete ( )

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

1136 : string
1137 {
1138 return $this->getListHTML();
1139 }

◆ cancelUpdateNote()

ilNoteGUI::cancelUpdateNote ( )

cancel edit note

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

993 : string
994 {
995 return $this->getListHTML();
996 }

◆ confirmDelete()

ilNoteGUI::confirmDelete ( )

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

1141 : void
1142 {
1143 $ilCtrl = $this->ctrl;
1144
1145 $cnt = 0;
1146 $ids = [$this->request->getNoteId()];
1147 foreach ($ids as $id) {
1148 $note = $this->manager->getById($id);
1149 if ($this->notes_access->canDelete($note, $this->user->getId(), $this->public_deletion_enabled)) {
1150 $this->manager->deleteNote($note, $this->user->getId(), $this->public_deletion_enabled);
1151 $cnt++;
1152 }
1153 }
1154 if ($cnt > 1) {
1155 $ilCtrl->setParameter($this, "note_mess", "ntsdel");
1156 } else {
1157 $ilCtrl->setParameter($this, "note_mess", "ntdel");
1158 }
1159 $ilCtrl->redirect($this, "getListHTML", "", $this->ajax);
1160 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
setParameter(object $a_gui_obj, string $a_parameter, $a_value)
@inheritDoc

References $id, ILIAS\Notes\Note\getId(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

◆ deactivateComments()

ilNoteGUI::deactivateComments ( )

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

365 : void
366 {
367 $ilCtrl = $this->ctrl;
368
369 if ($this->comments_settings) {
370 $this->manager->activateComments($this->rep_obj_id, false);
371 }
372
373 $ilCtrl->redirectByClass("ilnotegui", "getCommentsHTML", "", $this->ajax);
374 }

References $ctrl, and ilCtrl\redirectByClass().

+ Here is the call graph for this function:

◆ deleteNote()

ilNoteGUI::deleteNote ( )
protected

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

1098 : string
1099 {
1102
1103 $f = $this->ui->factory();
1105 $ctrl->setParameter($this, "note_id", $this->requested_note_id);
1106 $note = $this->manager->getById($this->requested_note_id);
1107
1108 $text = ($this->requested_note_type === Note::PRIVATE)
1109 ? $this->lng->txt("notes_delete_note")
1110 : $this->lng->txt("notes_delete_comment");
1111
1112 $mess = $f->messageBox()->confirmation($text);
1113 $item = $this->getItemForNote($note, false);
1114
1115 $b1 = $this->getButton(
1116 "",
1117 $this->lng->txt("cancel"),
1118 "cancelDelete"
1119 );
1120 $b2 = $this->getButton(
1121 "",
1122 $this->lng->txt("delete"),
1123 "confirmDelete"
1124 );
1125
1126 $it_group_title = $this->getItemGroupTitle($note->getContext()->getObjId());
1127 $item_groups = [$f->item()->group($it_group_title, [$item])];
1128 $panel = $f->panel()->listing()->standard("", $item_groups);
1129
1130 $html = $this->renderComponents([$mess, $panel, $b2, $b1]);
1131 $html = str_replace($this->getNoteTextPlaceholder($note), $this->getNoteText($note), $html);
1132
1133 return $this->renderContent($html);
1134 }
static setUseRelativeDates(bool $a_status)
set use relative dates
getNoteText(Note $note)
renderComponents(array $components)
renderContent(string $content)
Render content into notes wrapper.
getItemForNote(Note $note, bool $actions=true)
getButton(string $a_var, string $a_txt, string $a_cmd, string $a_anchor="")
getNoteTextPlaceholder(Note $note)
getItemGroupTitle(int $obj_id=0)
if(isset($_FILES['img_file']) &&is_array($_FILES['img_file'])) $panel
Definition: imgupload.php:198

References Vendor\Package\$f, $panel, ILIAS\Notes\Note\getContext(), ILIAS\Repository\lng(), ilCtrl\setParameter(), ilDatePresentation\setUseRelativeDates(), ILIAS\Repository\ui(), and ilDatePresentation\useRelativeDates().

+ Here is the call graph for this function:

◆ editNoteForm()

ilNoteGUI::editNoteForm ( bool  $a_init_form = true)

get notes list including add note area

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

1063 : string {
1064 $this->edit_note_form = true;
1065
1066 return $this->getListHTML($a_init_form);
1067 }

◆ enableCommentsSettings()

ilNoteGUI::enableCommentsSettings ( bool  $a_enable = true)

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

244 : void
245 {
246 $this->comments_settings = $a_enable;
247 }

◆ enablePrivateNotes()

ilNoteGUI::enablePrivateNotes ( bool  $a_enable = true)

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

234 : void
235 {
236 $this->private_enabled = $a_enable;
237 }

◆ enablePublicNotes()

ilNoteGUI::enablePublicNotes ( bool  $a_enable = true)

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

239 : void
240 {
241 $this->public_enabled = $a_enable;
242 }

◆ enablePublicNotesDeletion()

ilNoteGUI::enablePublicNotesDeletion ( bool  $a_enable = true)

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

249 : void
250 {
251 $this->public_deletion_enabled = $a_enable;
252 }

◆ enableTargets()

ilNoteGUI::enableTargets ( bool  $a_enable = true)

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

255 : void
256 {
257 $this->targets_enabled = $a_enable;
258 }

◆ executeCommand()

ilNoteGUI::executeCommand ( )

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

225 {
226 $cmd = $this->ctrl->getCmd($this->getDefaultCommand());
227 $next_class = $this->ctrl->getNextClass($this);
228 switch ($next_class) {
229 default:
230 return $this->$cmd();
231 }
232 }

References ILIAS\Repository\ctrl(), and getDefaultCommand().

+ Here is the call graph for this function:

◆ exportNotesHTML()

ilNoteGUI::exportNotesHTML ( )

export selected notes to html

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

1165 : void
1166 {
1167 $tpl = new ilGlobalTemplate("tpl.main.html", true, true);
1168
1169 $this->export_html = true;
1170 //$tpl->setVariable("CONTENT", $this->getListHTML());
1171 //ilUtil::deliverData($tpl->get(), "notes.html");
1172
1173 $authors = array_unique(array_map(function (Note $note) {
1174 return $note->getAuthor();
1175 }, $this->getNotes($this->requested_note_type)));
1176 $export = new \ILIAS\Notes\Export\NotesHtmlExport(
1177 $this->requested_note_type,
1178 $this->user->getId(),
1179 $authors
1180 );
1181 $export->exportHTML($this->getListHTML());
1182 }
special template class to simplify handling of ITX/PEAR
getNotes(int $a_type)
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41

References $tpl, ILIAS\Notes\Note\getAuthor(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

◆ getButton()

ilNoteGUI::getButton ( string  $a_var,
string  $a_txt,
string  $a_cmd,
string  $a_anchor = "" 
)
Exceptions
ilCtrlException

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

1259 $f = $this->ui->factory();
1260
1261 if ($this->ajax) {
1262 $button = $f->button()->standard(
1263 $a_txt,
1264 "#"
1265 )->withOnLoadCode(function ($id) use ($ctrl, $a_cmd) {
1266 return
1267 "$('#$id').on('click', () => { ilNotes.cmdAjaxLink(event, '" .
1268 $ctrl->getLinkTargetByClass("ilnotegui", $a_cmd, "", true) .
1269 "');});";
1270 });
1271 } else {
1272 $button = $f->button()->standard(
1273 $a_txt,
1274 $ctrl->getLinkTargetByClass("ilnotegui", $a_cmd, $a_anchor)
1275 );
1276 }
1277 return $button;
1278 }
getLinkTargetByClass( $a_class, string $a_cmd=null, string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
@inheritDoc
This describes a standard button.
Definition: Standard.php:27

References Vendor\Package\$f, $id, and ilCtrl\getLinkTargetByClass().

+ Here is the call graph for this function:

◆ getCommentsHTML()

ilNoteGUI::getCommentsHTML ( )

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

273 : string
274 {
275 if ($this->ajax) {
276 $this->gui->initJavascript();
277 }
278 $ilCtrl = $this->ctrl;
279 $ilCtrl->setParameter($this, "notes_type", Note::PUBLIC);
280 $this->requested_note_type = Note::PUBLIC;
281 return $this->getListHTML($a_init_form = true);
282 }

References $ctrl, getListHTML(), and ilCtrl\setParameter().

+ Here is the call graph for this function:

◆ getCommentsWidget()

ilNoteGUI::getCommentsWidget ( )
protected

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

1310 : string
1311 {
1312 $f = $this->ui->factory();
1313 $r = $this->ui->renderer();
1314 $lng = $this->lng;
1316 $ctrl->setParameter($this, "news_id", $this->news_id);
1319 null,
1320 ilObject::_lookupType($this->rep_obj_id),
1321 $this->rep_obj_id,
1322 $this->obj_type,
1323 $this->obj_id,
1324 $this->news_id
1325 );
1326
1327 $context = $this->data->context(
1328 $this->rep_obj_id,
1329 $this->obj_id,
1330 $this->obj_type,
1331 $this->news_id
1332 );
1333
1334 $cnt[$this->rep_obj_id][Note::PUBLIC] = $this->manager->getNrOfNotesForContext($context, Note::PUBLIC);
1335 $cnt[$this->rep_obj_id][Note::PRIVATE] = $this->manager->getNrOfNotesForContext($context, Note::PRIVATE);
1336 $cnt = $cnt[$this->rep_obj_id][Note::PUBLIC] ?? 0;
1337
1338 $tpl = new ilTemplate("tpl.note_widget_header.html", true, true, "Services/Notes");
1339 $widget_el_id = "notew_" . str_replace(";", "_", $hash);
1340 $ctrl->setParameter($this, "hash", $hash);
1341 $update_url = $ctrl->getLinkTarget($this, "updateWidget", "", true, false);
1342 $comps = array();
1343 if ($cnt > 0) {
1344 $c = $f->counter()->status((int) $cnt);
1345 $comps[] = $f->symbol()->glyph()->comment()->withCounter($c)->withAdditionalOnLoadCode(function ($id) use ($hash, $update_url, $widget_el_id) {
1346 return "$(\"#$id\").click(function(event) { " . self::getListCommentsJSCall($hash, "ilNotes.updateWidget(\"" . $widget_el_id . "\",\"" . $update_url . "\");") . "});";
1347 });
1348 $comps[] = $f->divider()->vertical();
1349 $tpl->setVariable("GLYPH", $r->render($comps));
1350 $tpl->setVariable("TXT_LATEST", $lng->txt("notes_latest_comment"));
1351 }
1352
1353 $b = $f->button()->shy($lng->txt("notes_add_edit_comment"), "#")->withAdditionalOnLoadCode(function ($id) use ($hash, $update_url, $widget_el_id) {
1354 return "$(\"#$id\").click(function(event) { " . self::getListCommentsJSCall($hash, "ilNotes.updateWidget(\"" . $widget_el_id . "\",\"" . $update_url . "\");") . "});";
1355 });
1356 if ($ctrl->isAsynch()) {
1357 $tpl->setVariable("SHY_BUTTON", $r->renderAsync($b));
1358 } else {
1359 $tpl->setVariable("SHY_BUTTON", $r->render($b));
1360 }
1361
1362 $this->widget_header = $tpl->get();
1363
1364 $this->hide_new_form = true;
1365 $this->only_latest = true;
1366 $this->no_actions = true;
1367 $html = "<div id='" . $widget_el_id . "'>" . $this->getNoteListHTML(Note::PUBLIC) . "</div>";
1368 $ctrl->setParameter($this, "news_id", $this->requested_news_id);
1369 return $html;
1370 }
static buildAjaxHash(int $node_type, ?int $node_id, string $obj_type, int $obj_id, string $sub_type=null, int $sub_id=null, int $news_id=0)
Build ajax hash.
isAsynch()
@inheritDoc
getLinkTarget(object $a_gui_obj, string $a_cmd=null, string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
@inheritDoc
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static getListCommentsJSCall(string $a_hash, string $a_update_code=null)
Get list comments js call.
ilLanguage $lng
getNoteListHTML(int $a_type=Note::PRIVATE, bool $a_init_form=true)
special template class to simplify handling of ITX/PEAR
$c
Definition: cli.php:38

References Vendor\Package\$b, $c, $context, Vendor\Package\$f, $id, $lng, $tpl, ilObject\_lookupType(), ilCommonActionDispatcherGUI\buildAjaxHash(), ilCtrl\getLinkTarget(), ilCtrl\isAsynch(), ilCtrl\setParameter(), ilCommonActionDispatcherGUI\TYPE_REPOSITORY, ILIAS\Repository\ui(), and ILIAS\UI\Implementation\Component\withAdditionalOnLoadCode().

+ Here is the call graph for this function:

◆ getDefaultCommand()

ilNoteGUI::getDefaultCommand ( )

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

219 : string
220 {
222 }
string $default_command

References $default_command.

Referenced by executeCommand().

+ Here is the caller graph for this function:

◆ getHTML()

ilNoteGUI::getHTML ( )

Get HTML.

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

1304 : string
1305 {
1306 $this->gui->initJavascript();
1307 return $this->getCommentsWidget();
1308 }

◆ getItemForNote()

ilNoteGUI::getItemForNote ( Note  $note,
bool  $actions = true 
)
protected
Exceptions
ilCtrlException
ilDateTimeException
ilWACException

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

726 $f = $this->ui->factory();
728
729
730 $dd_buttons = [];
731
732 // edit note stuff for all private notes
733 if ($actions && $this->notes_access->canEdit($note)) {
734 if (!$this->export_html && !$this->print
735 && !$this->edit_note_form && !$this->add_note_form && !$this->no_actions) {
736 $ctrl->setParameterByClass("ilnotegui", "note_id", $note->getId());
737 $dd_buttons[] = $this->getShyButton(
738 "edit_note",
739 $this->lng->txt("edit"),
740 "editNoteForm",
741 "note_" . $note->getId(),
742 $note->getId()
743 );
744 }
745 }
746
747 // delete note stuff for all private notes
748 if ($actions && !$this->export_html && !$this->print
749 && !$this->no_actions
750 && $this->notes_access->canDelete($note)) {
751 $ctrl->setParameterByClass("ilnotegui", "note_id", $note->getId());
752 $dd_buttons[] = $this->getShyButton(
753 "delete_note",
754 $this->lng->txt("delete"),
755 "deleteNote",
756 "note_" . $note->getId(),
757 $note->getId()
758 );
759 }
760
761
763
764 $properties = [];
765
766 // origin
767 if ($this->targets_enabled) {
768 $target = $this->getTarget($note);
769 if ($target["title"] !== "") {
770 if ($target["link"] === "") {
771 $properties[$this->lng->txt("notes_origin")] = $target["title"];
772 } else {
773 $properties[$this->lng->txt("notes_origin")] = $f
774 ->button()
775 ->shy(
776 $target["title"],
777 $target["link"]
778 );
779 }
780 }
781 }
782
783 // output author account and creation date
784 $img_path = "";
785 $img_alt = "";
786 $avatar = null;
787 if ($note->getType() === Note::PUBLIC) {
788 $avatar = ilObjUser::_getAvatar($note->getAuthor());
789 $title = ilUserUtil::getNamePresentation($note->getAuthor(), false, false);
790 $properties[$this->lng->txt("create_date")] = $creation_date;
791 } else {
792 $title = $creation_date;
793 }
794
795 // last edited
796 if ($note->getUpdateDate() !== null) {
797 $properties[$this->lng->txt("last_edited_on")] = ilDatePresentation::formatDate(
798 new ilDate(
799 $note->getUpdateDate(),
801 )
802 );
803 }
804
805 $item = $f->item()->standard($title)
806 ->withDescription($this->getNoteTextPlaceholder($note))
807 ->withProperties($properties);
808 if (!is_null($avatar)) {
809 $item = $item->withLeadAvatar($avatar);
810 }
811 if (count($dd_buttons) > 0) {
812 $item = $item->withActions(
813 $f->dropdown()->standard($dd_buttons)
814 );
815 }
816 return $item;
817 }
const IL_CAL_DATETIME
setParameterByClass(string $a_class, string $a_parameter, $a_value)
@inheritDoc
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
Class for single dates.
getTarget(Note $note)
show related objects as links
getShyButton(string $a_var, string $a_txt, string $a_cmd, string $a_anchor="", int $note_id=0)
static _getAvatar(int $a_usr_id)
static getNamePresentation( $a_user_id, bool $a_user_image=false, bool $a_profile_link=false, string $a_profile_back_link="", bool $a_force_first_lastname=false, bool $a_omit_login=false, bool $a_sortable=true, bool $a_return_data_array=false, $a_ctrl_path="ilpublicuserprofilegui")
Default behaviour is:
Common interface to all items.
Definition: Item.php:32

References ILIAS\Notes\Note\getId(), ILIAS\Repository\lng(), and ilCtrl\setParameterByClass().

+ Here is the call graph for this function:

◆ getItemGroupTitle()

ilNoteGUI::getItemGroupTitle ( int  $obj_id = 0)
protected

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

700 : string
701 {
702 if (!$this->show_header) {
703 return "";
704 }
705 if (!is_array($this->rep_obj_id) && !$this->getUseObjectTitleHeader()) {
706 $it_group_title = ($this->requested_note_type === Note::PRIVATE)
707 ? $this->lng->txt("notes")
708 : $this->lng->txt("notes_comments");
709 } else {
710 $it_group_title = ($obj_id)
712 : $this->lng->txt("note_without_object");
713 }
714 return $it_group_title;
715 }
static _lookupTitle(int $obj_id)

References ilObject\_lookupTitle(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ getListCommentsJSCall()

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

Get list comments js call.

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

1206 : string {
1207 if ($a_update_code === null) {
1208 $a_update_code = "null";
1209 } else {
1210 $a_update_code = "'" . $a_update_code . "'";
1211 }
1212
1213 return "ilNotes.listComments(event, '" . $a_hash . "', " . $a_update_code . ");";
1214 }

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

+ Here is the caller graph for this function:

◆ getListHTML()

ilNoteGUI::getListHTML ( bool  $a_init_form = true)

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

284 : string
285 {
288 $ilCtrl = $this->ctrl;
290
291 $content = "";
292 if ($this->requested_note_type === Note::PRIVATE && $ilUser->getId() !== ANONYMOUS_USER_ID) {
293 $content = $this->getNoteListHTML(Note::PRIVATE, $a_init_form);
294 }
295 // #15948 - public enabled vs. comments_settings
296 if ($this->requested_note_type === Note::PUBLIC) {
297 $active = true;
298 // news items (in timeline) do not check, if the object has news activated!
299 if (!is_array($this->rep_obj_id) && $this->news_id === 0) {
300
301 // if common object settings are used, we check for activation
302 // 37713, 37701
303 // removed setting check due to 41511
304 //if ($this->comments_settings) {
305 $active = $this->manager->commentsActive($this->rep_obj_id);
306 //}
307 }
308 if ($active) {
309 $content = $this->getNoteListHTML(Note::PUBLIC, $a_init_form);
310 }
311
312 // Comments Settings
313 if (!is_array($this->rep_obj_id) && $this->comments_settings && $ilUser->getId() !== ANONYMOUS_USER_ID) {
314 $active = $this->manager->commentsActive($this->rep_obj_id);
315 if ($active) {
316 if ($this->news_id === 0) {
317 $content .= $this->renderComponents([$this->getShyButton(
318 "comments_settings",
319 $lng->txt("notes_deactivate_comments"),
320 "deactivateComments",
321 ""
322 )
323 ]);
324 }
325 } else {
326 $content .= $this->renderComponents([$this->getShyButton(
327 "comments_settings",
328 $lng->txt("notes_activate_comments"),
329 "activateComments",
330 ""
331 )
332 ]);
333 /*
334 if ($this->ajax && !$comments_col) {
335 $ntpl->setVariable(
336 "COMMENTS_MESS",
337 ilUtil::getSystemMessageHTML($lng->txt("comments_feature_currently_not_activated_for_object"), "info")
338 );
339 }*/
340 }
341 }
342 }
343 return $this->renderContent($content);
344 }
ilSetting $settings
const ANONYMOUS_USER_ID
Definition: constants.php:27
global $ilSetting
Definition: privfeed.php:17

References $ctrl, $ilSetting, $ilUser, $lng, $settings, $user, ANONYMOUS_USER_ID, getNoteListHTML(), getShyButton(), renderComponents(), renderContent(), and ilLanguage\txt().

Referenced by getCommentsHTML(), and getNotesHTML().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getListNotesJSCall()

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

Get list notes js call.

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

1190 : string {
1191 if ($a_update_code === null) {
1192 $a_update_code = "null";
1193 } else {
1194 $a_update_code = "'" . $a_update_code . "'";
1195 }
1196
1197 return "ilNotes.listNotes(event, '" . $a_hash . "', " . $a_update_code . ");";
1198 }

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

+ Here is the caller graph for this function:

◆ getNoteForm()

ilNoteGUI::getNoteForm ( string  $mode,
int  $type,
Note  $note = null 
)
protected

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

855 global $DIC;
856
857 $label_key = "note";
858 $label_key .= ($mode === "create")
859 ? "_add"
860 : "_update";
861 $label_key .= ($type === Note::PUBLIC)
862 ? "_comment"
863 : "_note";
864 $cmd = ($mode === "create")
865 ? "addNote"
866 : "updateNote";
867
868 $value = ($note)
869 ? $note->getText()
870 : "";
871 if ($cmd === "updateNote") {
872 $this->ctrl->setParameter($this, "note_id", $this->requested_note_id);
873 }
874 $action = $this->ctrl->getFormAction($this, $cmd, "");
875 $form = $this->gui->form(self::class, $action)
876 ->section("props", $this->lng->txt($label_key))
877 ->textarea("note", $this->lng->txt("note_text"), "", $value);
878 return $form;
879 }
$type

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ getNoteListHTML()

ilNoteGUI::getNoteListHTML ( int  $a_type = Note::PRIVATE,
bool  $a_init_form = true 
)

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

435 : string {
437 $ilCtrl = $this->ctrl;
438 $f = $this->ui->factory();
440
441 $mtype = "";
442
443 $suffix = ($a_type === Note::PRIVATE)
444 ? "private"
445 : "public";
446
447 $notes = $this->getNotes($a_type);
448
449 $tpl = new ilTemplate("tpl.notes_list.html", true, true, "Services/Notes");
450
451 // show counter if notes are hidden
452 $cnt_str = (count($notes) > 0)
453 ? " (" . count($notes) . ")"
454 : "";
455
456 // origin header
457 $origin_header = $this->getOriginHeader();
458 if ($origin_header != "") {
459 $tpl->setCurrentBlock("title");
460 $tpl->setVariable("TITLE", $origin_header);
461 $tpl->parseCurrentBlock();
462 }
463
464 if ($a_type === Note::PRIVATE) {
465 $tpl->setVariable("TXT_NOTES", $lng->txt("private_notes") . $cnt_str);
466 $ilCtrl->setParameterByClass("ilnotegui", "note_type", Note::PRIVATE);
467 } else {
468 $tpl->setVariable("TXT_NOTES", $lng->txt("notes_public_comments") . $cnt_str);
469 $ilCtrl->setParameterByClass("ilnotegui", "note_type", Note::PUBLIC);
470 }
471 $anch = "";
472
473 // show add new note text area
474 if (!$this->edit_note_form && !is_array($this->rep_obj_id) &&
475 !$this->hide_new_form && $ilUser->getId() !== ANONYMOUS_USER_ID) {
476 $tpl->setCurrentBlock("edit_note_form");
477 $b_caption = ($this->requested_note_type === Note::PRIVATE)
478 ? $this->lng->txt("note_add_note")
479 : $this->lng->txt("note_add_comment");
480 $b = $this->ui->factory()->button()->standard(
481 $b_caption,
482 "#"
483 );
484 $tpl->setVariable("EDIT_STYLE", "display:none;");
485 $tpl->setVariable(
486 "EDIT_FORM_ACTION",
487 $ilCtrl->getFormActionByClass("ilnotegui", "addNote", "", true)
488 );
489 $tpl->setVariable(
490 "TXT_CANCEL",
491 $this->lng->txt("cancel")
492 );
493 $tpl->setVariable(
494 "EDIT_FORM_BUTTON",
495 $this->renderComponents([$b])
496 );
497 $tpl->setVariable(
498 "EDIT_FORM",
499 $this->getNoteForm("create", $a_type)->render()
500 );
501 $tpl->parseCurrentBlock();
502 }
503
504 // list all notes
507
508 $notes_given = false;
509
510 // edit form
511 if ($this->edit_note_form && $a_type === $this->requested_note_type) {
512 $note = $this->manager->getById($this->requested_note_id);
513 $ilCtrl->setParameterByClass("ilnotegui", "note_id", $this->requested_note_id);
514 $tpl->setVariable(
515 "EDIT_FORM_ACTION",
516 $ilCtrl->getFormActionByClass("ilnotegui", "updateNote", "", true)
517 );
518 $tpl->setVariable(
519 "CANCEL_FORM_ACTION",
520 $ilCtrl->getFormActionByClass("ilnotegui", "cancelUpdateNote", "", true)
521 );
522 $tpl->setVariable("NOTE_FOCUS", "1");
523 $tpl->setVariable(
524 "TXT_CANCEL",
525 $this->lng->txt("cancel")
526 );
527 $tpl->setVariable(
528 "EDIT_FORM",
529 $this->getNoteForm("edit", $a_type, $note)->render()
530 );
531 $tpl->parseCurrentBlock();
532 }
533
534 $items = [];
535 $item_groups = [];
536 $text_placeholders = [];
537 $texts = [];
538 $last_obj_id = null;
539 foreach ($notes as $note) {
540 if ($this->only_latest && $notes_given) {
541 continue;
542 }
543
544 $current_obj_id = $note->getContext()->getObjId();
545 if ($last_obj_id !== null && $current_obj_id !== $last_obj_id) {
546 $it_group_title = $this->getItemGroupTitle($last_obj_id);
547 $item_groups[] = $f->item()->group($it_group_title, $items);
548 $items = [];
549 }
550 $last_obj_id = $current_obj_id;
551
552 $items[] = $this->getItemForNote($note);
553 $notes_given = true;
554
555 $text_placeholders[] = $this->getNoteTextPlaceholder($note);
556 $texts[] = $this->getNoteText($note);
557 }
558
559 $it_group_title = $this->getItemGroupTitle((int) $last_obj_id);
560 $item_groups[] = $f->item()->group($it_group_title, $items);
561
562 if ($notes_given) {
563 if (!is_array($this->rep_obj_id)) {
564 $title = $item_groups[0]->getTitle();
565 $item_groups[0] = $f->item()->group("", $item_groups[0]->getItems());
566 } else {
567 $title = "";
568 }
569 $panel = $f->panel()->listing()->standard($title, $item_groups);
570 if (!is_array($this->rep_obj_id)) {
571 $panel = $panel->withActions($this->getSortationControl());
572 }
573 $html = $this->renderComponents([$panel]);
574 $html = str_replace($text_placeholders, $texts, $html);
575 $tpl->setVariable("NOTES_LIST", $html);
576 } elseif (!is_array($this->rep_obj_id)) {
577 $it_group_title = $this->getItemGroupTitle($this->rep_obj_id);
578 $item_groups = [$f->item()->group($it_group_title, [])];
579 $panel = $f->panel()->listing()->standard("", $item_groups);
580 $mess_txt = "";
581 if ($this->show_empty_list_message) {
582 if ($this->search_text === "") {
583 $mess_txt = ($this->requested_note_type === Note::PRIVATE)
584 ? $lng->txt("notes_no_notes")
585 : $lng->txt("notes_no_comments");
586 } else {
587 $mess_txt = ($this->requested_note_type === Note::PRIVATE)
588 ? $lng->txt("notes_no_notes_found")
589 : $lng->txt("notes_no_comments_found");
590 }
591 $mess = $f->messageBox()->info($mess_txt);
592 //$html = $this->renderComponents([$panel, $mess]);
593 $html = $this->renderComponents([$mess]);
594 $tpl->setVariable("NOTES_LIST", $html);
595 }
596 } elseif ($this->search_text !== "") {
597 $mess_txt = ($this->requested_note_type === Note::PRIVATE)
598 ? $lng->txt("notes_no_notes_found")
599 : $lng->txt("notes_no_comments_found");
600 $mess = $f->messageBox()->info($mess_txt);
601 $tpl->setVariable("NOTES_LIST", $this->renderComponents([$mess]));
602 }
603
605
606 // message
607 $mtxt = "";
608 switch ($this->requested_note_mess !== "" ? $this->requested_note_mess : $this->note_mess) {
609 case "mod":
610 $mtype = "success";
611 $mtxt = $lng->txt("msg_obj_modified");
612 break;
613
614 case "ntsdel":
615 $mtype = "success";
616 $mtxt = ($a_type === Note::PRIVATE)
617 ? $lng->txt("notes_notes_deleted")
618 : $lng->txt("notes_comments_deleted");
619 break;
620
621 case "ntdel":
622 $mtype = "success";
623 $mtxt = ($a_type === Note::PRIVATE)
624 ? $lng->txt("notes_note_deleted")
625 : $lng->txt("notes_comment_deleted");
626 break;
627
628 case "frmfld":
629 $mtype = "failure";
630 $mtxt = $lng->txt("form_input_not_valid");
631 break;
632
633 case "qdel":
634 $mtype = "question";
635 $mtxt = $lng->txt("info_delete_sure");
636 break;
637
638 case "noc":
639 $mtype = "failure";
640 $mtxt = $lng->txt("no_checkbox");
641 break;
642 }
643 if ($mtxt !== "") {
644 $tpl->setVariable("MESS", ilUtil::getSystemMessageHTML($mtxt, $mtype));
645 } else {
646 $tpl->setVariable("MESS", "");
647 }
648
649 if ($this->widget_header !== "") {
650 $tpl->setVariable("WIDGET_HEADER", $this->widget_header);
651 }
652
653 return $tpl->get();
654 }
static getSystemMessageHTML(string $a_txt, string $a_type="info")
Get HTML for a system message.

Referenced by getListHTML().

+ Here is the caller graph for this function:

◆ getNotes()

ilNoteGUI::getNotes ( int  $a_type)
protected
Returns
Note[]

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

379 : array
380 {
381 if ($this->notes === null) {
383 $filter = null;
384 if ($this->export_html || $this->print) {
385 if ($this->requested_note_id > 0) {
386 $filter = $this->requested_note_id;
387 } else {
388 $filter = $this->request->getNoteText();
389 }
390 }
391
392 $ascending = $this->manager->getSortAscending();
393 if ($this->only_latest) {
394 $order = false;
395 }
396 $author_id = ($a_type === Note::PRIVATE)
397 ? $ilUser->getId()
398 : 0;
399
400 if (!is_array($this->rep_obj_id)) {
401 $notes = $this->manager->getNotesForContext(
402 $this->data->context(
403 $this->rep_obj_id,
404 $this->obj_id,
405 $this->obj_type,
406 $this->news_id,
407 $this->repository_mode
408 ),
409 $a_type,
411 $author_id,
412 $ascending,
413 "",
415 );
416 } else {
417 $notes = $this->manager->getNotesForRepositoryObjIds(
418 $this->rep_obj_id,
419 $a_type,
420 $this->inc_sub,
421 $author_id,
422 $ascending,
423 "",
424 $this->search_text
425 );
426 }
427 $this->notes = $notes;
428 }
429 return $this->notes;
430 }
int $requested_note_id

References $ilUser, $inc_sub, $notes, $requested_note_id, $search_text, and $user.

◆ getNotesHTML()

ilNoteGUI::getNotesHTML ( )

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

265 : string
266 {
267 $ilCtrl = $this->ctrl;
268 $ilCtrl->setParameter($this, "notes_type", Note::PRIVATE);
269 $this->requested_note_type = Note::PRIVATE;
270 return $this->getListHTML($a_init_form = true);
271 }

References $ctrl, getListHTML(), and ilCtrl\setParameter().

+ Here is the call graph for this function:

◆ getNoteText()

ilNoteGUI::getNoteText ( Note  $note)
protected

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

824 : string
825 {
826 return (trim($note->getText()) !== "")
827 ? nl2br(htmlentities($note->getText()))
828 : $this->lng->txt("note_content_removed");
829 }

References ILIAS\Notes\Note\getText(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ getNoteTextPlaceholder()

ilNoteGUI::getNoteTextPlaceholder ( Note  $note)
protected

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

819 : string
820 {
821 return "##note-text-" . $note->getId() . "##";
822 }

References ILIAS\Notes\Note\getId().

+ Here is the call graph for this function:

◆ getOriginHeader()

ilNoteGUI::getOriginHeader ( )
protected

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

1386 : string
1387 {
1388 if (!is_array($this->rep_obj_id) && !$this->only_latest && $this->ctrl->isAsynch()) {
1389 switch ($this->obj_type) {
1390 case "grpr":
1391 case "catr":
1392 case "crsr":
1393 $title = ilContainerReference::_lookupTitle($this->rep_obj_id);
1394 break;
1395
1396 default:
1397 $title = ilObject::_lookupTitle($this->rep_obj_id);
1398 break;
1399 }
1400
1401 $img = ilUtil::img(ilObject::_getIcon($this->rep_obj_id, "tiny"));
1402
1403 // add sub-object if given
1404 if ($this->obj_id) {
1405 $sub_title = $this->getSubObjectTitle($this->rep_obj_id, $this->obj_id);
1406 if ($sub_title) {
1407 $title .= " - " . $sub_title;
1408 }
1409 }
1410
1411 return $img . " " . $title;
1412 }
1413 return "";
1414 }
static _lookupTitle(int $obj_id)
getSubObjectTitle(int $parent_obj_id, int $sub_obj_id)
Get sub object title if available with callback.
static _getIcon(int $obj_id=0, string $size="big", string $type="", bool $offline=false)
Get icon for repository item.
static img(string $a_src, ?string $a_alt=null, $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
$img
Definition: imgupload.php:83

References $img, ilObject\_getIcon(), ilContainerReference\_lookupTitle(), ilObject\_lookupTitle(), ILIAS\Repository\ctrl(), and ilUtil\img().

+ Here is the call graph for this function:

◆ getShowEmptyListMessage()

ilNoteGUI::getShowEmptyListMessage ( )

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

183 : bool
184 {
186 }
bool $show_empty_list_message

References $show_empty_list_message.

◆ getShowHeader()

ilNoteGUI::getShowHeader ( )

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

193 : bool
194 {
195 return $this->show_header;
196 }

References $show_header.

◆ getShyButton()

ilNoteGUI::getShyButton ( string  $a_var,
string  $a_txt,
string  $a_cmd,
string  $a_anchor = "",
int  $note_id = 0 
)
Exceptions
ilCtrlException

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

1227 $f = $this->ui->factory();
1228
1229 if ($this->ajax) {
1230 $button = $f->button()->shy(
1231 $a_txt,
1232 "#"
1233 )->withOnLoadCode(function ($id) use ($ctrl, $a_cmd, $note_id) {
1234 $ctrl->setParameterByClass("ilnotegui", "note_id", $note_id);
1235 return
1236 "$('#$id').on('click', () => { ilNotes.cmdAjaxLink(event, '" .
1237 $ctrl->getLinkTargetByClass("ilnotegui", $a_cmd, "", true) .
1238 "');});";
1239 });
1240 } else {
1241 $button = $f->button()->shy(
1242 $a_txt,
1243 $ctrl->getLinkTargetByClass("ilnotegui", $a_cmd, $a_anchor)
1244 );
1245 }
1246 return $button;
1247 }

References Vendor\Package\$f, $id, ilCtrl\getLinkTargetByClass(), and ilCtrl\setParameterByClass().

Referenced by getListHTML().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSortationControl()

ilNoteGUI::getSortationControl ( )
protected
Exceptions
ilCtrlException

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

661 {
662 /*
663 $c = $this->lng->txt("create_date") . ", ";
664 $options = [
665 'desc' => $c . $this->lng->txt("sorting_desc"),
666 'asc' => $c . $this->lng->txt("sorting_asc")
667 ];
668 $select_option = (true)
669 ? 'asc'
670 : 'desc';
671 $s = $this->ui->factory()->viewControl()->sortation($options)
672 ->withTargetURL($this->ctrl->getLinkTarget($this, "setSortation"), 'sortation')
673 ->withLabel($options[$select_option]);*/
674 $dd_buttons = [];
675 if ($this->manager->getSortAscending()) {
676 $dd_buttons[] = $this->getShyButton(
677 "sort",
678 $this->lng->txt("notes_sort_desc"),
679 "listSortDesc",
680 "",
681 0
682 );
683 } else {
684 $dd_buttons[] = $this->getShyButton(
685 "sort",
686 $this->lng->txt("notes_sort_asc"),
687 "listSortAsc",
688 "",
689 0
690 );
691 }
692
693 $s = $this->ui->factory()->dropdown()->standard(
694 $dd_buttons
695 );
696
697 return $s;
698 }
This describes a Standard Dropdown.
Definition: Standard.php:27

References ILIAS\Repository\lng(), and ILIAS\Repository\ui().

+ Here is the call graph for this function:

◆ getSubObjectTitle()

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

Get sub object title if available with callback.

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

837 : string {
838 $objDefinition = $this->obj_definition;
839 $parent_type = ilObject::_lookupType($parent_obj_id);
840 if ($parent_type === "") {
841 return "";
842 }
843 $parent_class = "ilObj" . $objDefinition->getClassName($parent_type) . "GUI";
844 if (method_exists($parent_class, "lookupSubObjectTitle")) {
845 return call_user_func_array(array($parent_class, "lookupSubObjectTitle"), array($parent_obj_id, $sub_obj_id));
846 }
847 return "";
848 }
ilObjectDefinition $obj_definition

◆ getTarget()

ilNoteGUI::getTarget ( Note  $note)

show related objects as links

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

886 : array {
888 $ilAccess = $this->access;
889 $objDefinition = $this->obj_definition;
891
892 $title = "";
893 $link = "";
894
895 $a_note_id = $note->getId();
896 $context = $note->getContext();
897 $a_obj_type = $context->getType();
898 $a_obj_id = $context->getSubObjId();
899
900 if ($context->getObjId() > 0) {
901
902 // get first visible reference
903 $vis_ref_id = 0;
904 $ref_ids = ilObject::_getAllReferences($context->getObjId());
905 foreach ($ref_ids as $ref_id) {
906 if ($vis_ref_id > 0) {
907 break;
908 }
909 if ($ilAccess->checkAccess("visible", "", $ref_id)) {
910 $vis_ref_id = $ref_id;
911 }
912 }
913
914 // if we got the reference id
915 if ($vis_ref_id > 0) {
916 $type = ilObject::_lookupType($vis_ref_id, true);
917 $title = ilObject::_lookupTitle($context->getObjId());
918
919 if ($type === "poll") {
920 $link = ilLink::_getLink($vis_ref_id, "poll");
921 } elseif ($a_obj_type !== "pg") {
922 if (!isset($this->item_list_gui[$type])) {
923 $class = $objDefinition->getClassName($type);
924 $full_class = "ilObj" . $class . "ListGUI";
925 $this->item_list_gui[$type] = new $full_class();
926 }
927
928 // for references, get original title
929 // (link will lead to orignal, which basically is wrong though)
930 if ($a_obj_type === "crsr" || $a_obj_type === "catr" || $a_obj_type === "grpr") {
931 $tgt_obj_id = ilContainerReference::_lookupTargetId($context->getObjId());
932 $title = ilObject::_lookupTitle($tgt_obj_id);
933 }
934 $this->item_list_gui[$type]->initItem($vis_ref_id, $context->getObjId(), $title, $a_obj_type);
935 $link = $this->item_list_gui[$type]->getCommandLink("infoScreen");
936 $link = $this->item_list_gui[$type]->appendRepositoryFrameParameter($link) . "#note_" . $a_note_id;
937 } else {
938 $title = ilObject::_lookupTitle($context->getObjId());
939 $link = "goto.php?target=pg_" . $a_obj_id . "_" . $vis_ref_id;
940 }
941 } else { // personal workspace
942 // we only need 1 instance
943 if (!isset($this->wsp_tree)) {
944 $this->wsp_tree = new ilWorkspaceTree($ilUser->getId());
945 $this->wsp_access_handler = new ilWorkspaceAccessHandler($this->wsp_tree);
946 }
947 $node_id = $this->wsp_tree->lookupNodeId($context->getObjId());
948 if ($this->wsp_access_handler->checkAccess("visible", "", $node_id)) {
949 $path = $this->wsp_tree->getPathFull($node_id);
950 if ($path) {
951 $item = array_pop($path);
952 $title = $item["title"];
953 $link = ilWorkspaceAccessHandler::getGotoLink($node_id, $context->getObjId());
954 }
955 // shared resource
956 else {
957 $owner = ilObject::_lookupOwner($context->getObjId());
958 $title = ilObject::_lookupTitle($context->getObjId()) .
959 " (" . ilObject::_lookupOwnerName($owner) . ")";
960 $link = "ilias.php?baseClass=ilDashboardGUI&cmd=jumpToWorkspace&dsh=" .
961 $owner;
962 }
963 }
964 }
965 }
966 return [
967 "title" => $title,
968 "link" => $link,
969 ];
970 }
static _lookupTargetId(int $a_obj_id)
ilAccessHandler $access
static _lookupOwnerName(int $owner_id)
Lookup owner name for owner id.
static _lookupOwner(int $obj_id)
Lookup owner user ID for object ID.
static _getAllReferences(int $id)
get all reference ids for object ID
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getGotoLink(int $a_node_id, int $a_obj_id, string $a_additional="")
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$ref_id
Definition: ltiauth.php:67
$path
Definition: ltiservices.php:32

References $context, $ilUser, $path, $ref_id, $type, ilObject\_getAllReferences(), ilLink\_getLink(), ilObject\_lookupOwner(), ilObject\_lookupOwnerName(), ilContainerReference\_lookupTargetId(), ilObject\_lookupTitle(), ilObject\_lookupType(), and ilWorkspaceAccessHandler\getGotoLink().

+ Here is the call graph for this function:

◆ getUseObjectTitleHeader()

ilNoteGUI::getUseObjectTitleHeader ( )

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

204 : bool
205 {
207 }
bool $use_obj_title_header

References $use_obj_title_header.

◆ listSortAsc()

ilNoteGUI::listSortAsc ( )
protected

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

1289 : string
1290 {
1291 $this->manager->setSortAscending(true);
1292 return $this->getListHTML();
1293 }

◆ listSortDesc()

ilNoteGUI::listSortDesc ( )
protected

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

1295 : string
1296 {
1297 $this->manager->setSortAscending(false);
1298 return $this->getListHTML();
1299 }

◆ renderComponents()

ilNoteGUI::renderComponents ( array  $components)
protected

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

346 : string
347 {
348 if ($this->ctrl->isAsynch()) {
349 return $this->ui->renderer()->renderAsync($components);
350 }
351 return $this->ui->renderer()->render($components);
352 }

References ILIAS\Repository\ctrl(), and ILIAS\Repository\ui().

Referenced by getListHTML().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ renderContent()

ilNoteGUI::renderContent ( string  $content)

Render content into notes wrapper.

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

1072 : string
1073 {
1074 $lng = $this->lng;
1076
1077 $ntpl = new ilTemplate(
1078 "tpl.notes_and_comments.html",
1079 true,
1080 true,
1081 "Services/Notes"
1082 );
1083
1084 if (!$ctrl->isAsynch()) {
1085 $ntpl->setVariable("OUTER_ID", " id='notes_embedded_outer' ");
1086 }
1087
1088 $ntpl->setVariable("CONTENT", $content);
1089
1090 if ($ctrl->isAsynch() && !$this->request->isFilterCommand()) {
1091 echo $ntpl->get();
1092 exit;
1093 }
1094
1095 return $ntpl->get();
1096 }
exit
Definition: login.php:28

References $lng, exit, and ilCtrl\isAsynch().

Referenced by getListHTML().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setDefaultCommand()

ilNoteGUI::setDefaultCommand ( string  $a_val)

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

209 : void
210 {
211 $this->default_command = $a_val;
212 }

◆ setExportMode()

ilNoteGUI::setExportMode ( )

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

1372 : void
1373 {
1374 $this->hide_new_form = true;
1375 $this->no_actions = true;
1376 $this->enable_sorting = false;
1377 $this->user_img_export_html = true;
1378 }

◆ setHideNewForm()

ilNoteGUI::setHideNewForm ( bool  $a_val)

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

214 : void
215 {
216 $this->hide_new_form = $a_val;
217 }

◆ setRepositoryMode()

ilNoteGUI::setRepositoryMode ( bool  $a_value)

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

260 : void
261 {
262 $this->repository_mode = $a_value;
263 }

Referenced by __construct().

+ Here is the caller graph for this function:

◆ setShowEmptyListMessage()

ilNoteGUI::setShowEmptyListMessage ( bool  $a_val)

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

178 : void
179 {
180 $this->show_empty_list_message = $a_val;
181 }

◆ setShowHeader()

ilNoteGUI::setShowHeader ( bool  $a_val)

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

188 : void
189 {
190 $this->show_header = $a_val;
191 }

◆ setUseObjectTitleHeader()

ilNoteGUI::setUseObjectTitleHeader ( bool  $a_val)

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

199 : void
200 {
201 $this->use_obj_title_header = $a_val;
202 }

◆ updateNote()

ilNoteGUI::updateNote ( )

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

1037 : void
1038 {
1039 $ilCtrl = $this->ctrl;
1040
1041 $note = $this->manager->getById($this->requested_note_id);
1042 $text = $this->getNoteForm(
1043 "edit",
1044 $this->requested_note_type
1045 )->getData("note") ?? "";
1046
1047 if ($this->notes_access->canEdit($note)) {
1048 $this->manager->updateNoteText(
1049 $this->requested_note_id,
1050 $text,
1051 $this->observer
1052 );
1053 $ilCtrl->setParameter($this, "note_mess", "mod");
1054 }
1055 $ilCtrl->redirect($this, "getListHTML", "", $this->ctrl->isAsynch());
1056 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ updateWidget()

ilNoteGUI::updateWidget ( )
protected

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

1380 : void
1381 {
1382 echo $this->getCommentsWidget();
1383 exit;
1384 }

References exit.

Field Documentation

◆ $access

ilAccessHandler ilNoteGUI::$access
protected

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

◆ $add_note_form

bool ilNoteGUI::$add_note_form
protected

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

◆ $ajax

bool ilNoteGUI::$ajax
protected

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

Referenced by __construct().

◆ $comments_settings

bool ilNoteGUI::$comments_settings = false
protected

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

◆ $ctrl

ilCtrl ilNoteGUI::$ctrl
protected

◆ $data

ILIAS Notes InternalDataService ilNoteGUI::$data
protected

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

◆ $default_command

string ilNoteGUI::$default_command = "getListHTML"
protected

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

Referenced by getDefaultCommand().

◆ $delete_note

bool ilNoteGUI::$delete_note = false
protected

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

◆ $edit_note_form

bool ilNoteGUI::$edit_note_form
protected

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

◆ $enable_sorting

bool ilNoteGUI::$enable_sorting = true
protected

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

◆ $export_html

bool ilNoteGUI::$export_html = false
protected

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

◆ $form_tpl

ilTemplate ilNoteGUI::$form_tpl
protected

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

◆ $gui

ILIAS Notes InternalGUIService ilNoteGUI::$gui
protected

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

◆ $hide_new_form

bool ilNoteGUI::$hide_new_form = false
protected

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

◆ $inc_sub

bool ilNoteGUI::$inc_sub
protected

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

Referenced by getNotes().

◆ $item_list_gui

array ilNoteGUI::$item_list_gui = []
protected

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

◆ $lng

ilLanguage ilNoteGUI::$lng
protected

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

Referenced by getListHTML().

◆ $log

ilLogger ilNoteGUI::$log
protected

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

◆ $manager

NotesManager ilNoteGUI::$manager
protected

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

◆ $news_id

int ilNoteGUI::$news_id = 0
protected

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

◆ $no_actions

bool ilNoteGUI::$no_actions = false
protected

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

◆ $note_mess

string ilNoteGUI::$note_mess = ""
protected

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

◆ $notes

array ilNoteGUI::$notes = null
protected

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

Referenced by getNotes().

◆ $notes_access

ILIAS Notes AccessManager ilNoteGUI::$notes_access
protected

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

◆ $obj_definition

ilObjectDefinition ilNoteGUI::$obj_definition
protected

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

◆ $obj_id

int ilNoteGUI::$obj_id
protected

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

◆ $obj_type

string ilNoteGUI::$obj_type
protected

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

◆ $observer

array ilNoteGUI::$observer = []
protected

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

◆ $old

bool ilNoteGUI::$old = false

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

◆ $only_latest

bool ilNoteGUI::$only_latest = false
protected

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

◆ $print

bool ilNoteGUI::$print = false
protected

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

◆ $private_enabled

bool ilNoteGUI::$private_enabled
protected

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

◆ $public_deletion_enabled

bool ilNoteGUI::$public_deletion_enabled = false

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

◆ $public_enabled

bool ilNoteGUI::$public_enabled
protected

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

◆ $rep_obj_id

ilNoteGUI::$rep_obj_id
protected

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

◆ $repository_mode

bool ilNoteGUI::$repository_mode = false

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

◆ $request

StandardGUIRequest ilNoteGUI::$request
protected

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

◆ $requested_news_id

int ilNoteGUI::$requested_news_id = 0
protected

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

◆ $requested_note_id

int ilNoteGUI::$requested_note_id = 0
protected

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

Referenced by getNotes().

◆ $requested_note_mess

string ilNoteGUI::$requested_note_mess = ""
protected

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

◆ $requested_note_type

int ilNoteGUI::$requested_note_type = 0
protected

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

◆ $search_text

string ilNoteGUI::$search_text
protected

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

Referenced by __construct(), and getNotes().

◆ $settings

ilSetting ilNoteGUI::$settings
protected

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

Referenced by getListHTML().

◆ $show_empty_list_message

bool ilNoteGUI::$show_empty_list_message = true
protected

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

Referenced by getShowEmptyListMessage().

◆ $show_header

bool ilNoteGUI::$show_header = true
protected

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

Referenced by getShowHeader().

◆ $targets_enabled

bool ilNoteGUI::$targets_enabled = false
protected

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

◆ $tree

ilTree ilNoteGUI::$tree
protected

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

◆ $ui

ILIAS DI UIServices ilNoteGUI::$ui
protected

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

◆ $use_obj_title_header

bool ilNoteGUI::$use_obj_title_header = true
protected

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

Referenced by getUseObjectTitleHeader().

◆ $user

ilObjUser ilNoteGUI::$user
protected

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

Referenced by getListHTML(), and getNotes().

◆ $user_img_export_html

bool ilNoteGUI::$user_img_export_html = false
protected

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

◆ $widget_header

string ilNoteGUI::$widget_header = ""
protected

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

◆ $wsp_access_handler

ilWorkspaceAccessHandler ilNoteGUI::$wsp_access_handler
protected

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

◆ $wsp_tree

ilWorkspaceTree ilNoteGUI::$wsp_tree
protected

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


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