ILIAS  trunk Revision v13.0_alpha-52-g21c366bbdd4
class.InternalGUIService.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21namespace ILIAS\Notes;
22
26
31{
32 use GlobalDICGUIServices;
33
36
37 public function __construct(
39 InternalDataService $data_service,
41 ) {
42 $this->data_service = $data_service;
43 $this->domain_service = $domain_service;
44 $this->initGUIServices($DIC);
45 }
46
48 {
49 return new StandardGUIRequest(
50 $this->http(),
51 $this->domain_service->refinery()
52 );
53 }
54
55 public function initJavascript(
56 string $ajax_url = "",
57 ?\ilGlobalTemplateInterface $main_tpl = null
58 ): void {
59 $tpl = $main_tpl ?? $this->mainTemplate();
60 $lng = $this->domain_service->lng();
61 $ctrl = $this->ctrl();
62 // temporary patch to make this work...
63 global $DIC;
64 $ref_id = $DIC->repository()->internal()->gui()->standardRequest()->getRefId();
65 $type = \ilObject::_lookupType($ref_id, true);
66 if ($ajax_url === "") {
67 $path = ["ilcommonactiondispatchergui", "ilnotegui"];
68 $ajax_url = $this->ctrl()->getLinkTargetByClass(
69 $path,
70 "",
71 "",
72 true,
73 false
74 );
75 }
76 $lng->loadLanguageModule("notes");
77
78 $lng->toJS(array("private_notes", "notes_public_comments", "cancel", "notes_messages"), $tpl);
79 $tpl->addJavaScript("assets/js/ilNotes.js");
80 //$tpl->addJavaScript("../components/ILIAS/Notes/resources/ilNotes.js");
81
82 $modal_template = $this->getModalTemplate();
83
84 $tpl->addOnLoadCode("ilNotes.setAjaxUrl('" . $ajax_url . "');");
85 $tpl->addOnLoadCode('ilNotes.setModalTemplate("' . addslashes(json_encode($modal_template["template"])) . '");');
86 $tpl->addOnLoadCode("ilNotes.setShowSignal('" . $modal_template["show"] . "');");
87 $tpl->addOnLoadCode("ilNotes.setHideSignal('" . $modal_template["close"] . "');");
88 }
89
90 public function getModalTemplate(): array
91 {
92 $ui = $this->ui();
93 $modal = $ui->factory()->modal()->roundtrip('#notes_title#', $ui->factory()->legacy()->content(''));
94 $modalt["show"] = $modal->getShowSignal()->getId();
95 $modalt["close"] = $modal->getCloseSignal()->getId();
96 $modalt["template"] = $ui->renderer()->renderAsync($modal);
97
98 return $modalt;
99 }
100
101 public function print(): PrintProcessGUI
102 {
103 $provider = new PrintViewProvider();
104 return new PrintProcessGUI(
105 $provider,
106 $this->http(),
107 $this->ui(),
108 $this->domain_service->lng()
109 );
110 }
111
112 public function getCommentsGUI(
113 $rep_obj_id,
114 int $obj_id,
115 string $obj_type,
116 int $news_id = 0,
117 bool $include_subs = false,
118 bool $ajax = true,
119 string $search_text = ""
120 ): \ilCommentGUI {
121 return new \ilCommentGUI(
122 $rep_obj_id,
123 $obj_id,
124 $obj_type,
125 $include_subs,
126 $news_id,
127 $ajax,
128 $search_text
129 );
130 }
131
132 public function getMessagesGUI(
133 int $recipient,
134 int $rep_obj_id,
135 int $obj_id,
136 string $obj_type
137 ): \ilMessageGUI {
138 return new \ilMessageGUI(
139 $recipient,
140 $rep_obj_id,
141 $obj_id,
142 $obj_type
143 );
144 }
145}
mainTemplate()
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:38
getMessagesGUI(int $recipient, int $rep_obj_id, int $obj_id, string $obj_type)
initJavascript(string $ajax_url="", ?\ilGlobalTemplateInterface $main_tpl=null)
getCommentsGUI( $rep_obj_id, int $obj_id, string $obj_type, int $news_id=0, bool $include_subs=false, bool $ajax=true, string $search_text="")
__construct(Container $DIC, InternalDataService $data_service, InternalDomainService $domain_service)
static _lookupType(int $id, bool $reference=false)
return['3gp', '7z', 'ai', 'aif', 'aifc', 'aiff', 'au', 'arw', 'avi', 'backup', 'bak', 'bas', 'bpmn', 'bpmn2', 'bmp', 'bib', 'bibtex', 'bz', 'bz2', 'c', 'c++', 'cc', 'cct', 'cdf', 'cer', 'class', 'cls', 'conf', 'cpp', 'crt', 'crs', 'crw', 'cr2', 'css', 'cst', 'csv', 'cur', 'db', 'dcr', 'des', 'dng', 'doc', 'docx', 'dot', 'dotx', 'dtd', 'dvi', 'el', 'eps', 'epub', 'f', 'f77', 'f90', 'flv', 'for', 'g3', 'gif', 'gl', 'gan', 'ggb', 'gsd', 'gsm', 'gtar', 'gz', 'gzip', 'h', 'hpp', 'htm', 'html', 'htmls', 'ibooks', 'ico', 'ics', 'ini', 'ipynb', 'java', 'jbf', 'jpeg', 'jpg', 'js', 'jsf', 'jso', 'json', 'latex', 'lang', 'less', 'log', 'lsp', 'ltx', 'm1v', 'm2a', 'm2v', 'm3u', 'm4a', 'm4v', 'markdown', 'm', 'mat', 'md', 'mdl', 'mdown', 'mid', 'min', 'midi', 'mobi', 'mod', 'mov', 'movie', 'mp2', 'mp3', 'mp4', 'mpa', 'mpeg', 'mpg', 'mph', 'mpga', 'mpp', 'mpt', 'mpv', 'mpx', 'mv', 'mw', 'mv4', 'nb', 'nbp', 'nef', 'nif', 'niff', 'obj', 'obm', 'odt', 'ods', 'odp', 'odg', 'odf', 'oga', 'ogg', 'ogv', 'old', 'p', 'pas', 'pbm', 'pcl', 'pct', 'pcx', 'pdf', 'pgm', 'pic', 'pict', 'png', 'por', 'pov', 'project', 'properties', 'ppa', 'ppm', 'pps', 'ppsx', 'ppt', 'pptx', 'ppz', 'ps', 'psd', 'pwz', 'qt', 'qtc', 'qti', 'qtif', 'r', 'ra', 'ram', 'rar', 'rast', 'rda', 'rev', 'rexx', 'ris', 'rf', 'rgb', 'rm', 'rmd', 'rmi', 'rmm', 'rmp', 'rt', 'rtf', 'rtx', 'rv', 's', 's3m', 'sav', 'sbs', 'sec', 'sdml', 'sgm', 'sgml', 'smi', 'smil', 'srt', 'sps', 'spv', 'stl', 'svg', 'swa', 'swf', 'swz', 'tar', 'tex', 'texi', 'texinfo', 'text', 'tgz', 'tif', 'tiff', 'ttf', 'txt', 'tmp', 'uvproj', 'vdf', 'vimeo', 'viv', 'vivo', 'vrml', 'vsdx', 'vtt', 'wav', 'webm', 'wmv', 'wmx', 'wmz', 'woff', 'wwd', 'xhtml', 'xif', 'xls', 'xlsx', 'xmind', 'xml', 'xsl', 'xsd', 'zip']
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
addJavaScript(string $a_js_file, bool $a_add_version_parameter=true, int $a_batch=2)
Add a javascript file that should be included in the header.
addOnLoadCode(string $a_code, int $a_batch=2)
Add on load code.
static http()
Fetches the global http state from ILIAS.
readonly ilGlobalTemplateInterface $tpl
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
initGUIServices(\ILIAS\DI\Container $DIC)
global $lng
Definition: privfeed.php:26
global $DIC
Definition: shib_login.php:26