25 protected \ILIAS\COPage\PC\PCDefinition
$pc_def;
26 protected \ILIAS\COPage\Xsl\XslManager
$xsl;
40 $this->tpl =
$DIC[
"tpl"];
41 $this->
ctrl = $DIC->ctrl();
42 $this->
lng = $DIC->language();
43 $this->db =
$DIC->database();
44 $this->
tabs = $DIC->tabs();
45 $this->
toolbar = $DIC->toolbar();
47 $this->xsl =
$DIC->copage()->internal()->domain()->xsl();
48 $this->pc_def =
$DIC->copage()->internal()->domain()->pc()->definition();
54 $next_class = $this->
ctrl->getNextClass($this);
57 $cmd = $this->
ctrl->getCmd();
59 switch ($next_class) {
70 bool $a_omit_form_init =
false
76 if (!$a_omit_form_init) {
79 $html = $this->
form->getHTML();
87 $this->displayValidationError();
92 $this->getFormValues();
94 $html = $this->
form->getHTML();
95 $tpl->setContent($html);
99 string $a_mode =
"edit"
101 $ilCtrl = $this->
ctrl;
108 $this->
form->setShowTopButtons(
false);
109 $this->
form->setFormAction($ilCtrl->getFormAction($this));
110 if ($a_mode !=
"edit") {
111 $this->
form->setTitle(
$lng->txt(
"cont_ed_insert_tabs"));
113 $this->
form->setTitle(
$lng->txt(
"cont_edit_tabs"));
123 $templ = $this->getTemplateOptions(
"vaccordion");
124 if (count($templ) > 0) {
127 foreach ($templ as $k => $te) {
130 $vchar_prop =
new ilSelectInputGUI($this->
lng->txt(
"cont_characteristic"),
"vaccord_templ");
131 $vchar_prop->setOptions($options);
132 $op1->addSubItem($vchar_prop);
137 $this->
form->addItem($vchar_prop);
139 $radg->addOption($op1);
143 $templ = $this->getTemplateOptions(
"carousel");
144 if (count($templ) > 0) {
146 $this->
lng->txt(
"cont_characteristic"),
149 $cchar_prop->setOptions($templ);
150 $op3->addSubItem($cchar_prop);
153 $this->
form->addItem($cchar_prop);
156 $radg->addOption($op3);
157 $this->
form->addItem($radg);
161 if ($a_mode ==
"create") {
163 $lng->txt(
"cont_number_of_tabs"),
166 $nrs = array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6,
167 7 => 7, 8 => 8, 9 => 9, 10 => 10);
168 $nr_prop->setOptions($nrs);
169 $this->
form->addItem($nr_prop);
185 "AllClosed" =>
$lng->txt(
"cont_all_closed"),
186 "FirstOpen" =>
$lng->txt(
"cont_first_open"),
187 "ForceAllOpen" =>
$lng->txt(
"cont_force_all_open"),
190 $si->setOptions($options);
191 $op1->addSubItem($si);
216 $ti->setMaxLength(6);
218 $ti->setSuffix(
"ms");
219 $ti->setMinValue(100);
220 $op3->addSubItem($ti);
226 $op3->addSubItem($cb);
230 if ($a_mode ==
"create") {
231 $this->
form->addCommandButton(
"create",
$lng->txt(
"save"));
232 $this->
form->addCommandButton(
"cancelCreate",
$lng->txt(
"cancel"));
234 $this->
form->addCommandButton(
"update",
$lng->txt(
"save"));
235 $this->
form->addCommandButton(
"cancelUpdate",
$lng->txt(
"cancel"));
241 $this->initForm(
"create");
247 $this->initForm(
"edit");
248 $this->getFormValues();
254 $values[
"type"] = $this->content_obj->getTabType();
255 $values[
"content_width"] = $this->content_obj->getContentWidth();
256 $values[
"content_height"] = $this->content_obj->getContentHeight();
257 $values[
"valign"] = $this->content_obj->getHorizontalAlign();
258 $values[
"calign"] = $this->content_obj->getHorizontalAlign();
259 $values[
"vbehavior"] = $this->content_obj->getBehavior();
260 $values[
"hbehavior"] = $this->content_obj->getBehavior();
262 $values[
"auto_time"] = $this->content_obj->getAutoTime();
263 $values[
"rand_start"] = $this->content_obj->getRandomStart();
265 $this->
form->setValuesByArray($values);
268 $va = $this->
form->getItemByPostVar(
"vaccord_templ");
271 $this->content_obj->getTemplate();
283 $ca = $this->
form->getItemByPostVar(
"carousel_templ");
286 $this->content_obj->getTemplate();
295 if ($form->
getInput(
"content_width") ==
"") {
297 ->setAlert($this->
lng->txt(
"cont_hacc_needs_width"));
300 if ($form->
getInput(
"content_height") ==
"") {
302 ->setAlert($this->
lng->txt(
"cont_hacc_needs_height"));
313 $this->initForm(
"create");
314 if ($this->
form->checkInput() && $this->checkWidthHeight($this->form)) {
315 $this->content_obj =
new ilPCTabs($this->getPage());
316 $this->content_obj->create($this->pg_obj, $this->hier_id, $this->pc_id);
318 $this->setPropertiesByForm();
320 for ($i = 0; $i < $this->request->getInt(
"nr"); $i++) {
321 $this->content_obj->addTab(
$lng->txt(
"cont_new_tab"));
324 $this->updated = $this->pg_obj->update();
326 if ($this->updated ===
true) {
327 $this->afterCreation();
332 $this->
form->setValuesByPost();
339 $ilCtrl = $this->ctrl;
341 $this->pg_obj->stripHierIDs();
342 $this->pg_obj->addHierIDs();
343 $ilCtrl->setParameter($this,
"hier_id", $this->content_obj->readHierId());
344 $ilCtrl->setParameter($this,
"pc_id", $this->content_obj->readPCId());
345 $this->content_obj->setHierId($this->content_obj->readHierId());
346 $this->setHierId($this->content_obj->readHierId());
347 $this->content_obj->setPcId($this->content_obj->readPCId());
353 $c = $this->content_obj;
356 $c->setTabType(
$f->getInput(
"type"));
358 $c->setContentWidth((
string)
$f->getInput(
"content_width"));
359 $c->setContentHeight((
string)
$f->getInput(
"content_height"));
361 switch ($this->request->getString(
"type")) {
363 $t = explode(
":",
$f->getInput(
"vaccord_templ"));
364 $c->setTemplate($t[2] ??
"");
365 $c->setBehavior(
$f->getInput(
"vbehavior"));
366 $c->setHorizontalAlign(
$f->getInput(
"valign"));
370 $t = explode(
":",
$f->getInput(
"haccord_templ"));
371 $c->setTemplate($t[2] ??
"");
372 $c->setBehavior(
$f->getInput(
"hbehavior"));
376 $t = explode(
":",
$f->getInput(
"carousel_templ"));
377 $c->setTemplate($t[2] ??
"");
378 $c->setHorizontalAlign(
$f->getInput(
"calign"));
379 $c->setAutoTime(
$f->getInput(
"auto_time"));
380 $c->setRandomStart(
$f->getInput(
"rand_start"));
388 $this->updated =
false;
389 if ($this->
form->checkInput() && $this->checkWidthHeight($this->form)) {
390 $this->setPropertiesByForm();
391 $this->updated = $this->pg_obj->update();
393 $this->
form->setValuesByPost();
394 $this->editProperties(
false);
397 if ($this->updated ===
true) {
398 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"msg_obj_modified"),
true);
399 $this->
ctrl->redirect($this,
"editProperties");
401 $this->pg_obj->addHierIDs();
402 $this->editProperties(
false);
409 $ilTabs = $this->tabs;
410 $ilCtrl = $this->ctrl;
411 $ilToolbar = $this->toolbar;
415 $this->
tabs->setBackTarget(
"",
"");
417 $tpl->setContent($this->getTabPanels() . $this->getEditorScriptTag($this->pc_id,
"Tabs"));
425 $ilCtrl = $this->ctrl;
428 $captions = $this->request->getStringArray(
"caption");
429 $positions = $this->request->getStringArray(
"position");
430 if (count($captions) > 0) {
431 $this->content_obj->saveCaptions($captions);
433 if (count($positions)) {
434 $this->content_obj->savePositions($positions);
436 $this->updated = $this->pg_obj->update();
437 $this->tpl->setOnScreenMessage(
'success',
$lng->txt(
"msg_obj_modified"),
true);
438 $ilCtrl->redirect($this,
"edit");
447 $ilCtrl = $this->ctrl;
449 $this->content_obj->addTab(
$lng->txt(
"cont_new_tab"));
450 $this->updated = $this->pg_obj->update();
452 $this->tpl->setOnScreenMessage(
'success',
$lng->txt(
"cont_added_tab"),
true);
453 $ilCtrl->redirect($this,
"edit");
458 $ilCtrl = $this->ctrl;
464 $tids = $this->request->getStringArray(
"tid");
465 if (count($tids) == 0) {
466 $this->tpl->setOnScreenMessage(
'info',
$lng->txt(
"no_checkbox"),
true);
467 $ilCtrl->redirect($this,
"edit");
470 $cgui->setFormAction($ilCtrl->getFormAction($this));
471 $cgui->setHeaderText(
$lng->txt(
"cont_tabs_confirm_deletion"));
472 $cgui->setCancel(
$lng->txt(
"cancel"),
"cancelTabDeletion");
473 $cgui->setConfirm(
$lng->txt(
"delete"),
"deleteTabs");
475 foreach ($tids as $k => $i) {
476 $id = explode(
":", $k);
480 $this->content_obj->getCaption(
$id[0],
$id[1])
484 $tpl->setContent($cgui->getHTML());
490 $ilCtrl = $this->ctrl;
491 $ilCtrl->redirect($this,
"edit");
496 $ilCtrl = $this->ctrl;
498 $tids = $this->request->getStringArray(
"tid");
499 foreach ($tids as $tid) {
500 $ids = explode(
":", $tid);
501 $this->content_obj->deleteTab($ids[0], $ids[1]);
503 $this->updated = $this->pg_obj->update();
505 $ilCtrl->redirect($this,
"edit");
510 $ilTabs = $this->tabs;
511 $ilCtrl = $this->ctrl;
514 $ilTabs->setBackTarget(
516 $this->ctrl->getParentReturn($this)
521 $ilCtrl->getLinkTarget($this,
"edit"),
528 $ilCtrl->getLinkTarget($this,
"editProperties"),
536 return $this->gui->form([self::class],
"saveCaption")
537 ->text(
"caption", $this->
lng->txt(
"title"),
"", $caption);
540 protected function getTabPanels(): string
543 $tabs = $this->content_obj;
545 $ui = $this->gui->ui();
548 $this->
lng->txt(
"cont_tab_add_above") =>
"addAbove",
549 $this->
lng->txt(
"cont_tab_add_below") =>
"addBelow",
550 $this->
lng->txt(
"cont_tab_move_up") =>
"moveUp",
551 $this->
lng->txt(
"cont_tab_move_down") =>
"moveDown",
552 $this->
lng->txt(
"cont_tab_move_top") =>
"moveTop",
553 $this->
lng->txt(
"cont_tab_move_bottom") =>
"moveBottom",
554 $this->
lng->txt(
"cont_tab_delete") =>
"deletePanel"
557 $captions = $tabs->getCaptions();
559 foreach ($captions as $cap) {
560 $this->
ctrl->setParameter($this,
"cap_pc_id", $cap[
"pc_id"]);
561 $form = $this->getCaptionForm($cap[
"caption"]);
562 $components = $this->gui->modal($this->
lng->txt(
"cont_edit_title"))
563 ->form($form)->getTriggerButtonComponents(
564 $this->
lng->txt(
"cont_edit_title"),
569 foreach ($actions as
$lng => $act) {
570 if ($cnt === 1 && in_array($act, [
"moveUp",
"moveTop"])) {
573 if ($cnt === count($captions) && in_array($act, [
"moveDown",
"moveBottom"])) {
576 $dd_items[] = $ui->factory()->link()->standard(
578 $this->
ctrl->getLinkTarget($this, $act)
581 $dd = $ui->factory()->dropdown()->standard($dd_items);
582 $content = $this->getTabContent($cap[
"pc_id"]);
583 $items[] = $ui->factory()->panel()->standard(
585 $ui->factory()->legacy()->content($content)
591 return $ui->renderer()->render($items);
594 protected function getTabContent(
string $pc_id): string
597 $tabs = $this->content_obj;
598 $xml = $tabs->getNodeXml($pc_id);
600 $xml =
"<dummy>" . $xml . $this->getPage()->getMultimediaXML() .
"</dummy>";
603 $params = array(
'mode' =>
"presentation",
'enlarge_path' =>
"#",
604 'fullscreen_link' =>
"#",
605 'pg_frame' =>
"",
'webspace_path' => $wb_path);
606 $output = $this->xsl->process($xml,
$params);
608 $defs = $this->pc_def->getPCDefinitions();
609 foreach ($defs as $def) {
610 $pc_class = $def[
"pc_class"];
611 $pc_obj =
new $pc_class($this->getPage());
614 $output = $pc_obj->modifyPageContentPostXsl($output,
"presentation",
false);
620 protected function saveCaption(): void
623 $tabs = $this->content_obj;
625 $form = $this->getCaptionForm();
626 if ($form->isValid()) {
627 $pc_id = $this->request->getString(
"cap_pc_id");
628 $tabs->saveCaption($pc_id, $form->getData(
"caption"));
629 $this->updated = $this->pg_obj->update();
631 $this->
ctrl->redirect($this,
"edit");
634 protected function addAbove(): void
637 $tabs = $this->content_obj;
638 $pc_id = $this->request->getString(
"cap_pc_id");
639 $tabs->addAbove($pc_id, $this->
lng->txt(
"cont_new_tab"));
640 $this->updated = $this->pg_obj->update();
641 $this->
ctrl->redirect($this,
"edit");
644 protected function addBelow(): void
647 $tabs = $this->content_obj;
648 $pc_id = $this->request->getString(
"cap_pc_id");
649 $tabs->addBelow($pc_id, $this->
lng->txt(
"cont_new_tab"));
650 $this->updated = $this->pg_obj->update();
651 $this->
ctrl->redirect($this,
"edit");
654 protected function moveUp(): void
657 $tabs = $this->content_obj;
658 $pc_id = $this->request->getString(
"cap_pc_id");
659 $tabs->moveUp($pc_id);
660 $this->updated = $this->pg_obj->update();
661 $this->
ctrl->redirect($this,
"edit");
664 protected function moveDown(): void
667 $tabs = $this->content_obj;
668 $pc_id = $this->request->getString(
"cap_pc_id");
669 $tabs->moveDown($pc_id);
670 $this->updated = $this->pg_obj->update();
671 $this->
ctrl->redirect($this,
"edit");
674 protected function moveTop(): void
677 $tabs = $this->content_obj;
678 $pc_id = $this->request->getString(
"cap_pc_id");
679 $tabs->moveTop($pc_id);
680 $this->updated = $this->pg_obj->update();
681 $this->
ctrl->redirect($this,
"edit");
684 protected function moveBottom(): void
687 $tabs = $this->content_obj;
688 $pc_id = $this->request->getString(
"cap_pc_id");
689 $tabs->moveBottom($pc_id);
690 $this->updated = $this->pg_obj->update();
691 $this->
ctrl->redirect($this,
"edit");
694 protected function deletePanel(): void
697 $tabs = $this->content_obj;
698 $pc_id = $this->request->getString(
"cap_pc_id");
699 $tabs->deletePanel($pc_id);
700 $this->updated = $this->pg_obj->update();
701 $this->
ctrl->redirect($this,
"edit");
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
static addCss()
Add required css.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getWebspaceDir(string $mode="filesystem")
get webspace directory
static _lookupTemplateIdByName(int $a_style_id, string $a_name)
Lookup table template preview.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(ilPageObject $a_pg_obj, ?ilPageContent $a_content_obj, string $a_hier_id, string $a_pc_id="")
editProperties(bool $init_form=true)
insert(bool $a_omit_form_init=false)
Insert new tabs.
ILIAS COPage PC PCDefinition $pc_def
ILIAS COPage Xsl XslManager $xsl
getCaptionForm(string $caption="")
checkWidthHeight(ilPropertyFormGUI $form)
addTab()
Save tabs properties in db and return to page edit screen.
initForm(string $a_mode="edit")
saveTabs()
Save tabs properties in db and return to page edit screen.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
User Interface for Editing of Page Content Objects (Paragraphs, Tables, ...)
ilGlobalTemplateInterface $tpl
Content object of ilPageObject (see ILIAS DTD).
Class ilPageObject Handles PageObjects of ILIAS Learning Modules (see ILIAS DTD)
This class represents an option in a radio group.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setContent(string $a_html)
Sets content for standard template.
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
form( $class_path, string $cmd, string $submit_caption="")
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.