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);
144 if (count($templ) > 0) {
146 $this->
lng->txt(
"cont_characteristic"),
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"),
191 $op1->addSubItem($si);
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"));
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"));
316 $this->content_obj->create($this->pg_obj, $this->hier_id, $this->pc_id);
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) {
332 $this->
form->setValuesByPost();
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());
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;
391 $this->updated = $this->pg_obj->update();
393 $this->
form->setValuesByPost();
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();
415 $this->
tabs->setBackTarget(
"",
"");
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");
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);
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])
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");
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 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"]);
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 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 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 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 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 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 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 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 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 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");
static getWebspaceDir(string $mode="filesystem")
get webspace directory
This class represents an option in a radio group.
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...
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.
Interface Observer Contains several chained tasks and infos about them.
checkWidthHeight(ilPropertyFormGUI $form)
setHierId(string $a_hier_id)
set hierarchical id in dom object
setContent(string $a_html)
Sets content for standard template.
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.
redirect(object $a_gui_obj, ?string $a_cmd=null, ?string $a_anchor=null, bool $is_async=false)
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
__construct(Container $dic, ilPlugin $plugin)
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