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();
94 $html = $this->
form->getHTML();
99 string $a_mode =
"edit" 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"));
124 if (count($templ) > 0) {
127 foreach ($templ as $k => $te) {
130 $vchar_prop =
new ilSelectInputGUI($this->
lng->txt(
"cont_characteristic"),
"vaccord_templ");
132 $op1->addSubItem($vchar_prop);
137 $this->
form->addItem($vchar_prop);
139 $radg->addOption($op1);
172 if (count($templ) > 0) {
174 $this->
lng->txt(
"cont_characteristic"),
177 foreach ($templ as $k => $te) {
178 $t = explode(
":", $k);
179 $html = $this->style->lookupTemplatePreview($t[1]) .
'<div style="clear:both" class="small">' . $te .
"</div>";
180 $cchar_prop->addOption($k, $te, $html);
181 if ($t[2] ==
"Carousel") {
182 $cchar_prop->setValue($k);
185 $op3->addSubItem($cchar_prop);
188 $this->
form->addItem($cchar_prop);
191 $radg->addOption($op3);
192 $this->
form->addItem($radg);
196 if ($a_mode ==
"create") {
198 $lng->
txt(
"cont_number_of_tabs"),
201 $nrs = array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6,
202 7 => 7, 8 => 8, 9 => 9, 10 => 10);
203 $nr_prop->setOptions($nrs);
204 $this->
form->addItem($nr_prop);
220 "AllClosed" =>
$lng->
txt(
"cont_all_closed"),
221 "FirstOpen" =>
$lng->
txt(
"cont_first_open"),
222 "ForceAllOpen" =>
$lng->
txt(
"cont_force_all_open"),
226 $op1->addSubItem($si);
251 $ti->setMaxLength(6);
253 $ti->setSuffix(
"ms");
254 $ti->setMinValue(100);
255 $op3->addSubItem($ti);
261 $op3->addSubItem($cb);
265 if ($a_mode ==
"create") {
266 $this->
form->addCommandButton(
"create_section",
$lng->
txt(
"save"));
267 $this->
form->addCommandButton(
"cancelCreate",
$lng->
txt(
"cancel"));
269 $this->
form->addCommandButton(
"update",
$lng->
txt(
"save"));
270 $this->
form->addCommandButton(
"cancelUpdate",
$lng->
txt(
"cancel"));
289 $values[
"type"] = $this->content_obj->getTabType();
290 $values[
"content_width"] = $this->content_obj->getContentWidth();
291 $values[
"content_height"] = $this->content_obj->getContentHeight();
292 $values[
"valign"] = $this->content_obj->getHorizontalAlign();
293 $values[
"calign"] = $this->content_obj->getHorizontalAlign();
294 $values[
"vbehavior"] = $this->content_obj->getBehavior();
295 $values[
"hbehavior"] = $this->content_obj->getBehavior();
297 $values[
"auto_time"] = $this->content_obj->getAutoTime();
298 $values[
"rand_start"] = $this->content_obj->getRandomStart();
300 $this->
form->setValuesByArray($values);
303 $va = $this->
form->getItemByPostVar(
"vaccord_templ");
306 $this->content_obj->getTemplate();
318 $ca = $this->
form->getItemByPostVar(
"carousel_templ");
321 $this->content_obj->getTemplate();
330 if ($form->
getInput(
"content_width") ==
"") {
332 ->setAlert($this->
lng->txt(
"cont_hacc_needs_width"));
335 if ($form->
getInput(
"content_height") ==
"") {
337 ->setAlert($this->
lng->txt(
"cont_hacc_needs_height"));
351 $this->content_obj->create($this->pg_obj, $this->hier_id, $this->pc_id);
355 for ($i = 0; $i < $this->request->getInt(
"nr"); $i++) {
356 $this->content_obj->addTab(
$lng->
txt(
"cont_new_tab"));
359 $this->updated = $this->pg_obj->update();
361 if ($this->updated ===
true) {
367 $this->
form->setValuesByPost();
376 $this->pg_obj->stripHierIDs();
377 $this->pg_obj->addHierIDs();
378 $ilCtrl->
setParameter($this,
"hier_id", $this->content_obj->readHierId());
379 $ilCtrl->setParameter($this,
"pc_id", $this->content_obj->readPCId());
380 $this->content_obj->setHierId($this->content_obj->readHierId());
381 $this->
setHierId($this->content_obj->readHierId());
382 $this->content_obj->setPcId($this->content_obj->readPCId());
391 $c->setTabType(
$f->getInput(
"type"));
393 $c->setContentWidth((
string)
$f->getInput(
"content_width"));
394 $c->setContentHeight((
string)
$f->getInput(
"content_height"));
396 switch ($this->request->getString(
"type")) {
398 $t = explode(
":",
$f->getInput(
"vaccord_templ"));
399 $c->setTemplate($t[2] ??
"");
400 $c->setBehavior(
$f->getInput(
"vbehavior"));
401 $c->setHorizontalAlign(
$f->getInput(
"valign"));
405 $t = explode(
":",
$f->getInput(
"haccord_templ"));
406 $c->setTemplate($t[2] ??
"");
407 $c->setBehavior(
$f->getInput(
"hbehavior"));
411 $t = explode(
":",
$f->getInput(
"carousel_templ"));
412 $c->setTemplate($t[2] ??
"");
413 $c->setHorizontalAlign(
$f->getInput(
"calign"));
414 $c->setAutoTime(
$f->getInput(
"auto_time"));
415 $c->setRandomStart(
$f->getInput(
"rand_start"));
423 $this->updated =
false;
426 $this->updated = $this->pg_obj->update();
428 $this->
form->setValuesByPost();
432 if ($this->updated ===
true) {
433 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"msg_obj_modified"),
true);
434 $this->
ctrl->redirect($this,
"editProperties");
436 $this->pg_obj->addHierIDs();
450 $this->
tabs->setBackTarget(
"",
"");
463 $captions = $this->request->getStringArray(
"caption");
464 $positions = $this->request->getStringArray(
"position");
465 if (count($captions) > 0) {
466 $this->content_obj->saveCaptions($captions);
468 if (count($positions)) {
469 $this->content_obj->savePositions($positions);
471 $this->updated = $this->pg_obj->update();
472 $this->tpl->setOnScreenMessage(
'success',
$lng->
txt(
"msg_obj_modified"),
true);
473 $ilCtrl->redirect($this,
"edit");
484 $this->content_obj->addTab(
$lng->
txt(
"cont_new_tab"));
485 $this->updated = $this->pg_obj->update();
487 $this->tpl->setOnScreenMessage(
'success',
$lng->
txt(
"cont_added_tab"),
true);
499 $tids = $this->request->getStringArray(
"tid");
500 if (count($tids) == 0) {
501 $this->tpl->setOnScreenMessage(
'info',
$lng->
txt(
"no_checkbox"),
true);
502 $ilCtrl->redirect($this,
"edit");
505 $cgui->setFormAction($ilCtrl->getFormAction($this));
506 $cgui->setHeaderText(
$lng->
txt(
"cont_tabs_confirm_deletion"));
507 $cgui->setCancel(
$lng->
txt(
"cancel"),
"cancelTabDeletion");
508 $cgui->setConfirm(
$lng->
txt(
"delete"),
"deleteTabs");
510 foreach ($tids as $k => $i) {
511 $id = explode(
":", $k);
515 $this->content_obj->getCaption(
$id[0],
$id[1])
533 $tids = $this->request->getStringArray(
"tid");
534 foreach ($tids as $tid) {
535 $ids = explode(
":", $tid);
536 $this->content_obj->deleteTab($ids[0], $ids[1]);
538 $this->updated = $this->pg_obj->update();
540 $ilCtrl->redirect($this,
"edit");
549 $ilTabs->setBackTarget(
551 $this->
ctrl->getParentReturn($this)
556 $ilCtrl->getLinkTarget($this,
"edit"),
563 $ilCtrl->getLinkTarget($this,
"editProperties"),
571 return $this->gui->form([self::class],
"saveCaption")
572 ->text(
"caption", $this->
lng->txt(
"title"),
"", $caption);
575 protected function getTabPanels():
string 580 $ui = $this->gui->ui();
583 $this->
lng->txt(
"cont_tab_add_above") =>
"addAbove",
584 $this->
lng->txt(
"cont_tab_add_below") =>
"addBelow",
585 $this->
lng->txt(
"cont_tab_move_up") =>
"moveUp",
586 $this->
lng->txt(
"cont_tab_move_down") =>
"moveDown",
587 $this->
lng->txt(
"cont_tab_move_top") =>
"moveTop",
588 $this->
lng->txt(
"cont_tab_move_bottom") =>
"moveBottom",
589 $this->
lng->txt(
"cont_tab_delete") =>
"deletePanel" 592 $captions = $tabs->getCaptions();
594 foreach ($captions as $cap) {
595 $this->
ctrl->setParameter($this,
"cap_pc_id", $cap[
"pc_id"]);
597 $components = $this->gui->modal($this->
lng->txt(
"cont_edit_title"))
598 ->
form($form)->getTriggerButtonComponents(
599 $this->
lng->txt(
"cont_edit_title"),
602 $items[] = $components[
"modal"];
603 $dd_items = [$components[
"button"]];
604 foreach ($actions as
$lng => $act) {
605 if ($cnt === 1 && in_array($act, [
"moveUp",
"moveTop"])) {
608 if ($cnt === count($captions) && in_array($act, [
"moveDown",
"moveBottom"])) {
611 $dd_items[] = $ui->factory()->link()->standard(
613 $this->
ctrl->getLinkTarget($this, $act)
616 $dd = $ui->factory()->dropdown()->standard($dd_items);
617 $content = $this->getTabContent($cap[
"pc_id"]);
618 $items[] = $ui->factory()->panel()->standard(
620 $ui->factory()->legacy($content)
626 return $ui->renderer()->render($items);
629 protected function getTabContent(
string $pc_id):
string 633 $xml = $tabs->getNodeXml($pc_id);
635 $xml =
"<dummy>" . $xml . $this->
getPage()->getMultimediaXML() .
"</dummy>";
638 $params = array(
'mode' =>
"presentation",
'enlarge_path' =>
"#",
639 'fullscreen_link' =>
"#",
640 'pg_frame' =>
"",
'webspace_path' => $wb_path);
641 $output = $this->xsl->process($xml,
$params);
643 $defs = $this->pc_def->getPCDefinitions();
644 foreach ($defs as $def) {
645 $pc_class = $def[
"pc_class"];
646 $pc_obj =
new $pc_class($this->
getPage());
649 $output = $pc_obj->modifyPageContentPostXsl($output,
"presentation",
false);
655 protected function saveCaption():
void 661 if ($form->isValid()) {
662 $pc_id = $this->request->getString(
"cap_pc_id");
663 $tabs->saveCaption($pc_id, $form->getData(
"caption"));
664 $this->updated = $this->pg_obj->update();
666 $this->
ctrl->redirect($this,
"edit");
669 protected function addAbove():
void 673 $pc_id = $this->request->getString(
"cap_pc_id");
674 $tabs->addAbove($pc_id, $this->
lng->txt(
"cont_new_tab"));
675 $this->updated = $this->pg_obj->update();
676 $this->
ctrl->redirect($this,
"edit");
679 protected function addBelow():
void 683 $pc_id = $this->request->getString(
"cap_pc_id");
684 $tabs->addBelow($pc_id, $this->
lng->txt(
"cont_new_tab"));
685 $this->updated = $this->pg_obj->update();
686 $this->
ctrl->redirect($this,
"edit");
689 protected function moveUp():
void 693 $pc_id = $this->request->getString(
"cap_pc_id");
694 $tabs->moveUp($pc_id);
695 $this->updated = $this->pg_obj->update();
696 $this->
ctrl->redirect($this,
"edit");
699 protected function moveDown():
void 703 $pc_id = $this->request->getString(
"cap_pc_id");
704 $tabs->moveDown($pc_id);
705 $this->updated = $this->pg_obj->update();
706 $this->
ctrl->redirect($this,
"edit");
709 protected function moveTop():
void 713 $pc_id = $this->request->getString(
"cap_pc_id");
714 $tabs->moveTop($pc_id);
715 $this->updated = $this->pg_obj->update();
716 $this->
ctrl->redirect($this,
"edit");
719 protected function moveBottom():
void 723 $pc_id = $this->request->getString(
"cap_pc_id");
724 $tabs->moveBottom($pc_id);
725 $this->updated = $this->pg_obj->update();
726 $this->
ctrl->redirect($this,
"edit");
729 protected function deletePanel():
void 733 $pc_id = $this->request->getString(
"cap_pc_id");
734 $tabs->deletePanel($pc_id);
735 $this->updated = $this->pg_obj->update();
736 $this->
ctrl->redirect($this,
"edit");
static getWebspaceDir(string $mode="filesystem")
get webspace directory
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilPageContent $content_obj
editProperties(bool $init_form=true)
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...
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...
redirect(object $a_gui_obj, string $a_cmd=null, string $a_anchor=null, bool $is_async=false)
saveTabs()
Save tabs properties in db and return to page edit screen.
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
insert(bool $a_omit_form_init=false)
Insert new tabs.
Class ChatMainBarProvider .
checkWidthHeight(ilPropertyFormGUI $form)
setHierId(string $a_hier_id)
set hierarchical id in dom object
getCaptionForm(string $caption="")
Content object of ilPageObject (see ILIAS DTD).
addTab()
Save tabs properties in db and return to page edit screen.
User Interface for Editing of Page Content Objects (Paragraphs, Tables, ...)
static addCss()
Add required css.
setContent(string $a_html)
Sets content for standard template.
initForm(string $a_mode="edit")
Class ilPageObject Handles PageObjects of ILIAS Learning Modules (see ILIAS DTD)
ilGlobalTemplateInterface $tpl
getEditorScriptTag(string $form_pc_id="", string $form_cname="")
form( $class_path, string $cmd, string $submit_caption="")
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
ILIAS COPage Xsl XslManager $xsl
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setParameter(object $a_gui_obj, string $a_parameter, $a_value)
__construct(ilPageObject $a_pg_obj, ?ilPageContent $a_content_obj, string $a_hier_id, string $a_pc_id="")
getTemplateOptions(string $a_type="")
Get table templates.
ILIAS COPage PC PCDefinition $pc_def