38 $this->tpl = $DIC[
"tpl"];
39 $this->
ctrl = $DIC->ctrl();
40 $this->
lng = $DIC->language();
41 $this->db = $DIC->database();
42 $this->
tabs = $DIC->tabs();
43 $this->
toolbar = $DIC->toolbar();
50 $next_class = $this->
ctrl->getNextClass($this);
53 $cmd = $this->
ctrl->getCmd();
55 switch ($next_class) {
66 bool $a_omit_form_init =
false 72 if (!$a_omit_form_init) {
75 $html = $this->
form->getHTML();
90 $html = $this->
form->getHTML();
95 string $a_mode =
"edit" 104 $this->
form->setFormAction($ilCtrl->getFormAction($this));
105 if ($a_mode !=
"edit") {
106 $this->
form->setTitle(
$lng->
txt(
"cont_ed_insert_tabs"));
108 $this->
form->setTitle(
$lng->
txt(
"cont_edit_tabs"));
120 if (count($templ) > 0) {
122 $this->
lng->txt(
"cont_characteristic"),
125 foreach ($templ as $k => $te) {
126 $t = explode(
":", $k);
127 $html = $this->style->lookupTemplatePreview($t[1]) .
'<div style="clear:both" class="small">' . $te .
"</div>";
128 $vchar_prop->addOption($k, $te, $html);
129 if ($t[2] ==
"VerticalAccordion") {
130 $vchar_prop->setValue($k);
133 $op1->addSubItem($vchar_prop);
136 $this->
form->addItem($vchar_prop);
138 $radg->addOption($op1);
146 if (count($templ) > 0) {
148 $this->
lng->txt(
"cont_characteristic"),
151 foreach ($templ as $k => $te) {
152 $t = explode(
":", $k);
153 $html = $this->style->lookupTemplatePreview($t[1]) .
'<div style="clear:both" class="small">' . $te .
"</div>";
154 $hchar_prop->addOption($k, $te, $html);
155 if ($t[2] ==
"HorizontalAccordion") {
156 $hchar_prop->setValue($k);
159 $op2->addSubItem($hchar_prop);
162 $this->
form->addItem($hchar_prop);
165 $radg->addOption($op2);
170 if (count($templ) > 0) {
172 $this->
lng->txt(
"cont_characteristic"),
175 foreach ($templ as $k => $te) {
176 $t = explode(
":", $k);
177 $html = $this->style->lookupTemplatePreview($t[1]) .
'<div style="clear:both" class="small">' . $te .
"</div>";
178 $cchar_prop->addOption($k, $te, $html);
179 if ($t[2] ==
"Carousel") {
180 $cchar_prop->setValue($k);
183 $op3->addSubItem($cchar_prop);
186 $this->
form->addItem($cchar_prop);
189 $radg->addOption($op3);
190 $this->
form->addItem($radg);
194 if ($a_mode ==
"create") {
196 $lng->
txt(
"cont_number_of_tabs"),
199 $nrs = array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6,
200 7 => 7, 8 => 8, 9 => 9, 10 => 10);
201 $nr_prop->setOptions($nrs);
202 $this->
form->addItem($nr_prop);
208 $this->
form->addItem($ni);
213 $this->
form->addItem($ni);
217 "AllClosed" =>
$lng->
txt(
"cont_all_closed"),
218 "FirstOpen" =>
$lng->
txt(
"cont_first_open"),
219 "ForceAllOpen" =>
$lng->
txt(
"cont_force_all_open"),
222 $si->setOptions($options);
223 $op1->addSubItem($si);
225 $si->setOptions($options);
226 $op2->addSubItem($si);
230 $align_opts = array(
"Left" =>
$lng->
txt(
"cont_left"),
231 "Right" =>
$lng->
txt(
"cont_right"),
"Center" =>
$lng->
txt(
"cont_center"),
232 "LeftFloat" =>
$lng->
txt(
"cont_left_float"),
233 "RightFloat" =>
$lng->
txt(
"cont_right_float"));
235 $align->setOptions($align_opts);
236 $align->setValue(
"Center");
238 $op1->addSubItem($align);
240 $align->setOptions($align_opts);
241 $align->setValue(
"Center");
242 $op3->addSubItem($align);
248 $ti->setSuffix(
"ms");
249 $ti->setMinValue(100);
250 $op3->addSubItem($ti);
260 if ($a_mode ==
"create") {
261 $this->
form->addCommandButton(
"create_section",
$lng->
txt(
"save"));
262 $this->
form->addCommandButton(
"cancelCreate",
$lng->
txt(
"cancel"));
264 $this->
form->addCommandButton(
"update",
$lng->
txt(
"save"));
265 $this->
form->addCommandButton(
"cancelUpdate",
$lng->
txt(
"cancel"));
271 $values[
"type"] = $this->content_obj->getTabType();
272 $values[
"content_width"] = $this->content_obj->getContentWidth();
273 $values[
"content_height"] = $this->content_obj->getContentHeight();
274 $values[
"valign"] = $this->content_obj->getHorizontalAlign();
275 $values[
"calign"] = $this->content_obj->getHorizontalAlign();
276 $values[
"vbehavior"] = $this->content_obj->getBehavior();
277 $values[
"hbehavior"] = $this->content_obj->getBehavior();
279 $values[
"auto_time"] = $this->content_obj->getAutoTime();
280 $values[
"rand_start"] = $this->content_obj->getRandomStart();
282 $this->
form->setValuesByArray($values);
285 $va = $this->
form->getItemByPostVar(
"vaccord_templ");
288 $this->content_obj->getTemplate();
292 $ha = $this->
form->getItemByPostVar(
"haccord_templ");
295 $this->content_obj->getTemplate();
299 $ca = $this->
form->getItemByPostVar(
"carousel_templ");
302 $this->content_obj->getTemplate();
311 if ($form->
getInput(
"content_width") ==
"") {
313 ->setAlert($this->
lng->txt(
"cont_hacc_needs_width"));
316 if ($form->
getInput(
"content_height") ==
"") {
318 ->setAlert($this->
lng->txt(
"cont_hacc_needs_height"));
332 $this->content_obj->create($this->pg_obj, $this->hier_id, $this->pc_id);
336 for (
$i = 0;
$i < $this->request->getInt(
"nr");
$i++) {
337 $this->content_obj->addTab(
$lng->
txt(
"cont_new_tab"));
340 $this->updated = $this->pg_obj->update();
342 if ($this->updated ===
true) {
348 $this->
form->setValuesByPost();
357 $this->pg_obj->stripHierIDs();
358 $this->pg_obj->addHierIDs();
359 $ilCtrl->
setParameter($this,
"hier_id", $this->content_obj->readHierId());
360 $ilCtrl->setParameter($this,
"pc_id", $this->content_obj->readPCId());
361 $this->content_obj->setHierId($this->content_obj->readHierId());
362 $this->
setHierId($this->content_obj->readHierId());
363 $this->content_obj->setPcId($this->content_obj->readPCId());
372 $c->setTabType(
$f->getInput(
"type"));
374 $c->setContentWidth((
string)
$f->getInput(
"content_width"));
375 $c->setContentHeight((
string)
$f->getInput(
"content_height"));
377 switch ($this->request->getString(
"type")) {
379 $t = explode(
":",
$f->getInput(
"vaccord_templ"));
380 $c->setTemplate($t[2] ??
"");
381 $c->setBehavior(
$f->getInput(
"vbehavior"));
382 $c->setHorizontalAlign(
$f->getInput(
"valign"));
386 $t = explode(
":",
$f->getInput(
"haccord_templ"));
387 $c->setTemplate($t[2] ??
"");
388 $c->setBehavior(
$f->getInput(
"hbehavior"));
392 $t = explode(
":",
$f->getInput(
"carousel_templ"));
393 $c->setTemplate($t[2] ??
"");
394 $c->setHorizontalAlign(
$f->getInput(
"calign"));
395 $c->setAutoTime(
$f->getInput(
"auto_time"));
396 $c->setRandomStart(
$f->getInput(
"rand_start"));
404 $this->updated =
false;
407 $this->updated = $this->pg_obj->update();
409 $this->
form->setValuesByPost();
413 if ($this->updated ===
true) {
414 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"msg_obj_modified"),
true);
415 $this->
ctrl->redirect($this,
"editProperties");
417 $this->pg_obj->addHierIDs();
422 public function edit():
void 430 $ilToolbar->addButton(
432 $ilCtrl->getLinkTarget($this,
"addTab")
436 $ilTabs->activateTab(
"cont_tabs");
451 $captions = $this->request->getStringArray(
"caption");
452 $positions = $this->request->getStringArray(
"position");
453 if (count($captions) > 0) {
454 $this->content_obj->saveCaptions($captions);
456 if (count($positions)) {
457 $this->content_obj->savePositions($positions);
459 $this->updated = $this->pg_obj->update();
460 $this->tpl->setOnScreenMessage(
'success',
$lng->
txt(
"msg_obj_modified"),
true);
461 $ilCtrl->redirect($this,
"edit");
472 $this->content_obj->addTab(
$lng->
txt(
"cont_new_tab"));
473 $this->updated = $this->pg_obj->update();
475 $this->tpl->setOnScreenMessage(
'success',
$lng->
txt(
"cont_added_tab"),
true);
487 $tids = $this->request->getStringArray(
"tid");
488 if (count($tids) == 0) {
489 $this->tpl->setOnScreenMessage(
'info',
$lng->
txt(
"no_checkbox"),
true);
490 $ilCtrl->redirect($this,
"edit");
493 $cgui->setFormAction($ilCtrl->getFormAction($this));
494 $cgui->setHeaderText(
$lng->
txt(
"cont_tabs_confirm_deletion"));
495 $cgui->setCancel(
$lng->
txt(
"cancel"),
"cancelTabDeletion");
496 $cgui->setConfirm(
$lng->
txt(
"delete"),
"deleteTabs");
498 foreach ($tids as $k =>
$i) {
499 $id = explode(
":", $k);
503 $this->content_obj->getCaption(
$id[0],
$id[1])
521 $tids = $this->request->getStringArray(
"tid");
522 foreach ($tids as $tid) {
523 $ids = explode(
":", $tid);
524 $this->content_obj->deleteTab($ids[0], $ids[1]);
526 $this->updated = $this->pg_obj->update();
528 $ilCtrl->redirect($this,
"edit");
537 $ilTabs->setBackTarget(
539 $this->
ctrl->getParentReturn($this)
544 $ilCtrl->getLinkTarget($this,
"edit"),
551 $ilCtrl->getLinkTarget($this,
"editProperties"),
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.
insert(bool $a_omit_form_init=false)
Insert new tabs.
checkWidthHeight(ilPropertyFormGUI $form)
setHierId(string $a_hier_id)
set hierarchical id in dom object
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
addTab()
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, ...)
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
form( $class_path, string $cmd)
__construct(Container $dic, ilPlugin $plugin)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
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.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...