27 protected \ILIAS\DI\UIServices
$ui;
28 protected \ilLanguage
$lng;
36 $this->
lng->loadLanguageModule(
"copg");
44 string $component =
"",
45 string $aria_label =
"" 49 $b =
$f->button()->standard($content,
"");
53 $b =
$b->withOnLoadCode(
54 function (
$id) use ($type,
$data, $action, $component, $aria_label) {
55 $code =
"document.querySelector('#$id').setAttribute('data-copg-ed-type', '$type'); 56 document.querySelector('#$id').setAttribute('data-copg-ed-component', '$component'); 57 document.querySelector('#$id').setAttribute('data-copg-ed-action', '$action'); ";
58 if ($aria_label !==
"") {
59 $code .=
"document.querySelector('#$id').setAttribute('aria-label', '$aria_label'); ";
62 $code .=
"\n document.querySelector('#$id').setAttribute('data-copg-ed-par-$key', '$val');";
74 $m =
$f->messageBox()->info($text);
75 return $ui->renderer()->renderAsync($m);
82 $m =
$f->messageBox()->failure($this->
lng->txt(
"copg_an_error_occured"))
83 ->withLinks([
$f->link()->standard($this->
lng->txt(
"copg_details"),
"#")]);
85 return $ui->renderer()->renderAsync($m);
93 string $component =
"",
94 string $aria_label =
"" 97 $b = $this->
getButton($content, $type, $action,
$data, $component, $aria_label);
98 return $ui->renderer()->renderAsync(
$b);
105 $m =
$f->messageBox()->failure($this->
lng->txt(
"copg_error_occured_modal"))
106 ->withButtons([
$f->button()->standard($this->
lng->txt(
"copg_reload_page"),
"#")->
withOnLoadCode(
function (
$id) {
108 "$(\"#$id\").click(function() { location.reload(); return false;});";
111 return $ui->renderer()->renderAsync($m) .
"<p>" . $this->
lng->txt(
"copg_details") .
":</p>";
117 $r = $ui->renderer();
119 $tpl = new \ilTemplate(
"tpl.editor_button_group.html",
true,
true,
"Services/COPage");
121 foreach ($groups as $buttons) {
122 foreach ($buttons as $action => $lng_key) {
123 $tpl->setCurrentBlock(
"button");
124 $b = $this->
getButton($this->
lng->txt($lng_key),
"multi", $action);
125 $tpl->setVariable(
"BUTTON", $r->renderAsync(
$b));
126 $tpl->parseCurrentBlock();
128 $tpl->setCurrentBlock(
"section");
129 $tpl->parseCurrentBlock();
138 $r = $ui->renderer();
140 $tpl = new \ilTemplate(
"tpl.form_footer.html",
true,
true,
"Services/COPage");
143 foreach ($buttons as
$b) {
144 $html .= $ui->renderer()->renderAsync($b);
147 $tpl->setVariable(
"BUTTONS", $html);
158 foreach ($buttons as $button) {
164 foreach ($buttons as $button) {
167 "id='cmd-" . $cnt .
"'",
168 " data-copg-ed-type='form-button' data-copg-ed-action='" . $button[1] .
"' data-copg-ed-component='" . $button[0] .
"'",
194 $error .= implode(
"<br />", $u);
212 $data = new \stdClass();
213 $data->renderedContent = $page_data . $this->getOnloadCode($page_gui);
214 $data->pcModel = $pc_model;
228 $all_onload_code = [];
229 foreach ($defs as $def) {
230 $pc_class = $def[
"pc_class"];
232 $pc_obj =
new $pc_class($page);
235 $onload_code = $pc_obj->getOnloadCode(
"edit");
236 foreach ($onload_code as $code) {
237 $all_onload_code[] = $code;
241 if (count($all_onload_code) > 0) {
242 $code_str =
"<script>" . implode(
"\n", $all_onload_code) .
"</script>";
250 $data = new \stdClass();
251 $data->formError =
true;
262 foreach ($actions as $act) {
264 $view_modes[$act[2]] =
"cmd-" . $cnt;
266 $vc = $ui->factory()->viewControl()->mode($view_modes,
"");
267 $html = $ui->renderer()->render($vc);
269 foreach ($actions as $act) {
272 'data-action="cmd-' . $cnt .
'"',
273 " data-copg-ed-type='view-control' data-copg-ed-action='" . $act[1] .
"' data-copg-ed-component='" . $act[0] .
"'",
277 $html = str_replace(
"id=",
"data-id=", $html);
291 $l =
$f->button()->shy($content,
"");
292 if (
$data === null) {
295 $l = $l->withOnLoadCode(
296 function (
$id) use ($component, $type,
$data, $action) {
297 $code =
"document.querySelector('#$id').setAttribute('data-copg-ed-component', '$component'); 298 document.querySelector('#$id').setAttribute('data-copg-ed-type', '$type'); 299 document.querySelector('#$id').setAttribute('data-copg-ed-action', '$action')";
301 $code .=
"\n document.querySelector('#$id').setAttribute('data-copg-ed-par-$key', '$val');";
317 $l = $this->
getLink($content, $component, $type, $action,
$data);
318 return $ui->renderer()->renderAsync($l);
325 $r = $ui->renderer();
326 $i =
$f->symbol()->icon()->standard($type, $type,
'medium');
327 return $r->render(
$i);
getRenderedInfoBox(string $text)
getRenderedLink(string $content, string $component, string $type, string $action, array $data=null)
getRenderedButtonGroups(array $groups)
setOutputMode(string $a_mode=self::PRESENTATION)
getRenderedIcon(string $type)
getRenderedViewControl(array $actions)
getLink(string $content, string $component, string $type, string $action, array $data=null)
Class ChatMainBarProvider .
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getRenderedFormFooter(array $buttons)
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
static getPCDefinitions()
__construct(\ILIAS\DI\UIServices $ui, \ilLanguage $lng)
withOnLoadCode(Closure $binder)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getButton(string $content, string $type, string $action, array $data=null, string $component="", string $aria_label="")
getRenderedForm(\ilPropertyFormGUI $form, array $buttons)
showPage()
display content of page
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
getRenderedModalFailureBox()
getRenderedButton(string $content, string $type, string $action, array $data=null, string $component="", string $aria_label="")
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
static setUseRelativeDates(bool $a_status)
set use relative dates
sendPage(\ilPageObjectGUI $page_gui, $updated)
Send whole page as response.
sendFormError(string $form)