30 protected \ILIAS\COPage\PC\DomainService
$pc_def;
31 protected \ILIAS\DI\UIServices
$ui;
32 protected \ilLanguage
$lng;
40 $this->pc_def = $DIC->copage()->internal()->domain()->pc();
43 $this->
lng->loadLanguageModule(
"copg");
51 string $component =
"",
52 bool $primary =
false,
53 string $aria_label =
"" 58 $b =
$f->button()->primary($content,
"");
60 $b =
$f->button()->standard($content,
"");
65 $b =
$b->withOnLoadCode(
66 function (
$id) use ($type,
$data, $action, $component, $aria_label) {
67 $code =
"document.querySelector('#$id').setAttribute('data-copg-ed-type', '$type'); 68 document.querySelector('#$id').setAttribute('data-copg-ed-component', '$component'); 69 document.querySelector('#$id').setAttribute('data-copg-ed-action', '$action'); ";
70 if ($aria_label !==
"") {
71 $code .=
"document.querySelector('#$id').setAttribute('aria-label', '$aria_label'); ";
74 $code .=
"\n document.querySelector('#$id').setAttribute('data-copg-ed-par-$key', '$val');";
86 $m =
$f->messageBox()->info($text);
87 if (count($buttons)) {
88 $m = $m->withButtons($buttons);
90 return $ui->renderer()->renderAsync($m);
97 $m =
$f->messageBox()->success($text);
98 return $ui->renderer()->renderAsync($m);
105 $m =
$f->messageBox()->failure($this->
lng->txt(
"copg_an_error_occured"))
106 ->withLinks([
$f->link()->standard($this->
lng->txt(
"copg_details"),
"#")]);
108 return $ui->renderer()->renderAsync($m);
116 string $component =
"",
117 bool $primary =
false,
118 string $aria_label =
"" 121 $b = $this->
getButton($content, $type, $action,
$data, $component, $primary, $aria_label);
122 return $ui->renderer()->renderAsync(
$b);
129 $m =
$f->messageBox()->failure($this->
lng->txt(
"copg_error_occured_modal"))
130 ->withButtons([
$f->button()->standard($this->
lng->txt(
"copg_reload_page"),
"#")->
withOnLoadCode(
function (
$id) {
132 "$(\"#$id\").click(function() { location.reload(); return false;});";
135 return $ui->renderer()->renderAsync($m) .
"<p>" . $this->
lng->txt(
"copg_details") .
":</p>";
141 $r = $ui->renderer();
143 $tpl = new \ilTemplate(
"tpl.editor_button_group.html",
true,
true,
"Services/COPage");
145 foreach ($groups as $buttons) {
146 foreach ($buttons as $action => $lng_key) {
147 $tpl->setCurrentBlock(
"button");
148 $b = $this->
getButton($this->
lng->txt($lng_key),
"multi", $action);
149 $tpl->setVariable(
"BUTTON",
$r->renderAsync(
$b));
150 $tpl->parseCurrentBlock();
152 $tpl->setCurrentBlock(
"section");
153 $tpl->parseCurrentBlock();
162 $r = $ui->renderer();
164 $tpl = new \ilTemplate(
"tpl.form_footer.html",
true,
true,
"Services/COPage");
167 foreach ($buttons as
$b) {
168 $html .= $ui->renderer()->renderAsync($b);
171 $tpl->setVariable(
"BUTTONS", $html);
182 foreach ($buttons as $button) {
188 foreach ($buttons as $button) {
191 "id='cmd-" . $cnt .
"'",
192 " data-copg-ed-type='form-button' data-copg-ed-action='" . $button[1] .
"' data-copg-ed-component='" . $button[0] .
"'",
205 foreach ($buttons as $button) {
216 $html = preg_replace(
"#\\<" . $tag .
"(.*)/" . $tag .
">#iUs",
"", $html, 1);
217 $footer_pos = stripos($html,
"il-standard-form-footer");
220 substr($html, 0, $footer_pos) .
221 preg_replace(
"#\\<" . $tag .
"(.*)/" . $tag .
">#iUs", $button_html, substr($html, $footer_pos), 1);
224 $html = str_replace(
"<form ",
"<form id='$id' ", $html);
248 $error .= implode(
"<br />", $u);
267 $data = new \stdClass();
268 $data->renderedContent = $page_data . $this->getOnloadCode($page_gui);
269 $data->pcModel = $pc_model;
282 $defs = $this->pc_def->definition()->getPCDefinitions();
283 $all_onload_code = [];
284 foreach ($defs as $def) {
285 $pc_class = $def[
"pc_class"];
287 $pc_obj =
new $pc_class($page);
290 $onload_code = $pc_obj->getOnloadCode(
"edit");
291 foreach ($onload_code as $code) {
292 $all_onload_code[] = $code;
296 if (count($all_onload_code) > 0) {
297 $code_str =
"<script>" . implode(
"\n", $all_onload_code) .
"</script>";
305 $data = new \stdClass();
306 $data->formError =
true;
317 foreach ($actions as $act) {
319 $view_modes[$act[2]] =
"cmd-" . $cnt;
321 $vc = $ui->factory()->viewControl()->mode($view_modes,
"");
322 $html = $ui->renderer()->render($vc);
324 foreach ($actions as $act) {
327 'data-action="cmd-' . $cnt .
'"',
328 " data-copg-ed-type='view-control' data-copg-ed-action='" . $act[1] .
"' data-copg-ed-component='" . $act[0] .
"'",
332 $html = str_replace(
"id=",
"data-id=", $html);
346 $l =
$f->button()->shy($content,
"");
347 if (
$data === null) {
350 $l = $l->withOnLoadCode(
351 function (
$id) use ($component, $type,
$data, $action) {
352 $code =
"document.querySelector('#$id').setAttribute('data-copg-ed-component', '$component'); 353 document.querySelector('#$id').setAttribute('data-copg-ed-type', '$type'); 354 document.querySelector('#$id').setAttribute('data-copg-ed-action', '$action')";
356 $code .=
"\n document.querySelector('#$id').setAttribute('data-copg-ed-par-$key', '$val');";
372 $l = $this->
getLink($content, $component, $type, $action,
$data);
373 return $ui->renderer()->renderAsync($l);
380 $r = $ui->renderer();
381 $i =
$f->symbol()->icon()->standard($type, $type,
'medium');
382 return $r->render($i);
387 bool $leading_image =
false 391 $r = $ui->renderer();
392 $dd =
$f->dropdown()->standard([
393 $f->link()->standard(
"#link-label#",
"#")
396 $item =
$f->item()->standard(
"#item-title#")->withActions($dd);
397 if ($leading_image) {
398 $item = $item->withLeadImage(
399 $f->image()->responsive(
"#img-src#",
"#img-alt#")
402 $p =
$f->panel()->listing()->standard(
410 return $r->render($p);
getRenderedLink(string $content, string $component, string $type, string $action, array $data=null)
getRenderedButtonGroups(array $groups)
getRenderedListingPanelTemplate(string $title="", bool $leading_image=false)
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 .
getRenderedSuccessBox(string $text)
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)
ILIAS COPage PC DomainService $pc_def
__construct(\ILIAS\DI\UIServices $ui, \ilLanguage $lng)
setTemplateOutput(bool $a_output=true)
withOnLoadCode(Closure $binder)
getRenderedButton(string $content, string $type, string $action, array $data=null, string $component="", bool $primary=false, string $aria_label="")
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getRenderedAdapterForm(FormAdapterGUI $form, array $buttons, string $id="")
getRenderedForm(\ilPropertyFormGUI $form, array $buttons)
getRenderedInfoBox(string $text, array $buttons=[])
getButton(string $content, string $type, string $action, array $data=null, string $component="", bool $primary=false, string $aria_label="")
showPage()
display content of page
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
getRenderedModalFailureBox()
static setUseRelativeDates(bool $a_status)
set use relative dates
sendPage(\ilPageObjectGUI $page_gui, $updated)
Send whole page as response.
sendFormError(string $form)