4require_once(
"./Services/COPage/classes/class.ilPCTabs.php");
5require_once(
"./Services/COPage/classes/class.ilPageContentGUI.php");
38 public function __construct(&$a_pg_obj, &$a_content_obj, $a_hier_id, $a_pc_id =
"")
42 $this->tpl =
$DIC[
"tpl"];
43 $this->ctrl =
$DIC->ctrl();
44 $this->lng =
$DIC->language();
45 $this->db =
$DIC->database();
46 $this->tabs =
$DIC->tabs();
47 $this->toolbar =
$DIC->toolbar();
57 $next_class = $this->ctrl->getNextClass($this);
60 $cmd = $this->ctrl->getCmd();
62 switch ($next_class) {
74 public function insert($a_omit_form_init =
false)
80 if (!$a_omit_form_init) {
83 $html = $this->form->getHTML();
84 $tpl->setContent($html);
99 if (!$omit_form_init) {
103 $html = $this->form->getHTML();
104 $tpl->setContent($html);
116 include_once(
"./Services/Accordion/classes/class.ilAccordionGUI.php");
120 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
122 $this->form->setFormAction($ilCtrl->getFormAction($this));
123 if ($a_mode !=
"edit") {
124 $this->form->setTitle(
$lng->txt(
"cont_ed_insert_tabs"));
126 $this->form->setTitle(
$lng->txt(
"cont_edit_tabs"));
138 require_once(
"./Services/Form/classes/class.ilAdvSelectInputGUI.php");
139 if (count($templ) > 0) {
141 $this->lng->txt(
"cont_characteristic"),
144 foreach ($templ as $k => $te) {
145 $t = explode(
":", $k);
146 $html = $this->style->lookupTemplatePreview($t[1]) .
'<div style="clear:both" class="small">' . $te .
"</div>";
147 $vchar_prop->addOption($k, $te, $html);
148 if ($t[2] ==
"VerticalAccordion") {
149 $vchar_prop->setValue($k);
152 $op1->addSubItem($vchar_prop);
155 $this->form->addItem($vchar_prop);
157 $radg->addOption($op1);
165 if (count($templ) > 0) {
167 $this->lng->txt(
"cont_characteristic"),
170 foreach ($templ as $k => $te) {
171 $t = explode(
":", $k);
172 $html = $this->style->lookupTemplatePreview($t[1]) .
'<div style="clear:both" class="small">' . $te .
"</div>";
173 $hchar_prop->addOption($k, $te, $html);
174 if ($t[2] ==
"HorizontalAccordion") {
175 $hchar_prop->setValue($k);
178 $op2->addSubItem($hchar_prop);
181 $this->form->addItem($hchar_prop);
184 $radg->addOption($op2);
189 require_once(
"./Services/Form/classes/class.ilAdvSelectInputGUI.php");
190 if (count($templ) > 0) {
192 $this->lng->txt(
"cont_characteristic"),
195 foreach ($templ as $k => $te) {
196 $t = explode(
":", $k);
197 $html = $this->style->lookupTemplatePreview($t[1]) .
'<div style="clear:both" class="small">' . $te .
"</div>";
198 $cchar_prop->addOption($k, $te, $html);
199 if ($t[2] ==
"Carousel") {
200 $cchar_prop->setValue($k);
203 $op3->addSubItem($cchar_prop);
206 $this->form->addItem($cchar_prop);
209 $radg->addOption($op3);
210 $this->form->addItem($radg);
214 if ($a_mode ==
"create") {
216 $lng->txt(
"cont_number_of_tabs"),
219 $nrs = array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6,
220 7 => 7, 8 => 8, 9 => 9, 10 => 10);
221 $nr_prop->setOptions($nrs);
222 $this->form->addItem($nr_prop);
225 $ni =
new ilNumberInputGUI($this->lng->txt(
"cont_tab_cont_width"),
"content_width");
226 $ni->setMaxLength(4);
228 $this->form->addItem($ni);
230 $ni =
new ilNumberInputGUI($this->lng->txt(
"cont_tab_cont_height"),
"content_height");
231 $ni->setMaxLength(4);
233 $this->form->addItem($ni);
237 "AllClosed" =>
$lng->txt(
"cont_all_closed"),
238 "FirstOpen" =>
$lng->txt(
"cont_first_open"),
239 "ForceAllOpen" =>
$lng->txt(
"cont_force_all_open"),
242 $si->setOptions($options);
243 $op1->addSubItem(
$si);
245 $si->setOptions($options);
246 $op2->addSubItem(
$si);
250 $align_opts = array(
"Left" =>
$lng->txt(
"cont_left"),
251 "Right" =>
$lng->txt(
"cont_right"),
"Center" =>
$lng->txt(
"cont_center"),
252 "LeftFloat" =>
$lng->txt(
"cont_left_float"),
253 "RightFloat" =>
$lng->txt(
"cont_right_float"));
255 $align->setOptions($align_opts);
256 $align->setValue(
"Center");
258 $op1->addSubItem($align);
260 $align->setOptions($align_opts);
261 $align->setValue(
"Center");
262 $op3->addSubItem($align);
266 $ti->setMaxLength(6);
268 $ti->setSuffix(
"ms");
269 $ti->setMinValue(100);
270 $op3->addSubItem($ti);
276 $op3->addSubItem($cb);
280 if ($a_mode ==
"create") {
281 $this->form->addCommandButton(
"create_section",
$lng->txt(
"save"));
282 $this->form->addCommandButton(
"cancelCreate",
$lng->txt(
"cancel"));
284 $this->form->addCommandButton(
"update",
$lng->txt(
"save"));
285 $this->form->addCommandButton(
"cancelUpdate",
$lng->txt(
"cancel"));
294 $values[
"type"] = $this->content_obj->getTabType();
295 $values[
"content_width"] = $this->content_obj->getContentWidth();
296 $values[
"content_height"] = $this->content_obj->getContentHeight();
297 $values[
"valign"] = $this->content_obj->getHorizontalAlign();
298 $values[
"calign"] = $this->content_obj->getHorizontalAlign();
299 $values[
"vbehavior"] = $this->content_obj->getBehavior();
300 $values[
"hbehavior"] = $this->content_obj->getBehavior();
302 $values[
"auto_time"] = $this->content_obj->getAutoTime();
303 $values[
"rand_start"] = $this->content_obj->getRandomStart();
305 $this->form->setValuesByArray($values);
308 $va = $this->form->getItemByPostVar(
"vaccord_templ");
311 $this->content_obj->getTemplate();
315 $ha = $this->form->getItemByPostVar(
"haccord_templ");
318 $this->content_obj->getTemplate();
322 $ca = $this->form->getItemByPostVar(
"carousel_templ");
325 $this->content_obj->getTemplate();
334 if ($form->
getInput(
"content_width") ===
"") {
336 ->setAlert($this->lng->txt(
"cont_hacc_needs_width"));
339 if ($form->
getInput(
"content_height") ===
"") {
341 ->setAlert($this->lng->txt(
"cont_hacc_needs_height"));
357 if ($this->form->checkInput() && $this->checkWidthHeight($this->form)) {
359 $this->content_obj->create($this->pg_obj, $this->hier_id, $this->pc_id);
364 $this->content_obj->addTab(
$lng->txt(
"cont_new_tab"));
367 $this->updated = $this->pg_obj->update();
369 if ($this->updated ===
true) {
376 $this->form->setValuesByPost();
389 $this->pg_obj->stripHierIDs();
390 $this->pg_obj->addHierIDs();
391 $ilCtrl->setParameter($this,
"hier_id", $this->content_obj->readHierId());
392 $ilCtrl->setParameter($this,
"pc_id", $this->content_obj->readPCId());
393 $this->content_obj->setHierId($this->content_obj->readHierId());
394 $this->
setHierId($this->content_obj->readHierId());
395 $this->content_obj->setPCId($this->content_obj->readPCId());
410 $c->setTabType(
$f->getInput(
"type"));
412 $c->setContentWidth(
$f->getInput(
"content_width"));
413 $c->setContentHeight(
$f->getInput(
"content_height"));
417 $t = explode(
":",
$f->getInput(
"vaccord_templ"));
418 $c->setTemplate($t[2]);
419 $c->setBehavior(
$f->getInput(
"vbehavior"));
420 $c->setHorizontalAlign(
$f->getInput(
"valign"));
424 $t = explode(
":",
$f->getInput(
"haccord_templ"));
425 $c->setTemplate($t[2]);
426 $c->setBehavior(
$f->getInput(
"hbehavior"));
430 $t = explode(
":",
$f->getInput(
"carousel_templ"));
431 $c->setTemplate($t[2]);
432 $c->setHorizontalAlign(
$f->getInput(
"calign"));
433 $c->setAutoTime(
$f->getInput(
"auto_time"));
434 $c->setRandomStart(
$f->getInput(
"rand_start"));
446 $this->updated =
false;
447 if ($this->form->checkInput() && $this->checkWidthHeight($this->form)) {
449 $this->updated = $this->pg_obj->update();
451 $this->form->setValuesByPost();
455 if ($this->updated ===
true) {
456 ilUtil::sendSuccess($this->lng->txt(
"msg_obj_modified"),
true);
457 $this->ctrl->redirect($this,
"editProperties");
460 $this->pg_obj->addHierIDs();
481 $ilToolbar->addButton(
482 $lng->txt(
"cont_add_tab"),
483 $ilCtrl->getLinkTarget($this,
"addTab")
487 $ilTabs->activateTab(
"cont_tabs");
488 include_once(
"./Services/COPage/classes/class.ilPCTabsTableGUI.php");
490 $tpl->setContent($table_gui->getHTML());
501 if (is_array(
$_POST[
"caption"])) {
503 $this->content_obj->saveCaptions($captions);
505 if (is_array(
$_POST[
"position"])) {
507 $this->content_obj->savePositions($positions);
509 $this->updated = $this->pg_obj->update();
510 ilUtil::sendSuccess(
$lng->txt(
"msg_obj_modified"),
true);
511 $ilCtrl->redirect($this,
"edit");
522 $this->content_obj->addTab(
$lng->txt(
"cont_new_tab"));
523 $this->updated = $this->pg_obj->update();
525 ilUtil::sendSuccess(
$lng->txt(
"cont_added_tab"),
true);
526 $ilCtrl->redirect($this,
"edit");
540 if (!is_array(
$_POST[
"tid"]) || count(
$_POST[
"tid"]) == 0) {
542 $ilCtrl->redirect($this,
"edit");
544 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
546 $cgui->setFormAction($ilCtrl->getFormAction($this));
547 $cgui->setHeaderText(
$lng->txt(
"cont_tabs_confirm_deletion"));
548 $cgui->setCancel(
$lng->txt(
"cancel"),
"cancelTabDeletion");
549 $cgui->setConfirm(
$lng->txt(
"delete"),
"deleteTabs");
551 foreach (
$_POST[
"tid"] as $k =>
$i) {
552 $id = explode(
":", $k);
556 $this->content_obj->getCaption($id[0], $id[1])
560 $tpl->setContent($cgui->getHTML());
570 $ilCtrl->redirect($this,
"edit");
580 if (is_array(
$_POST[
"tid"])) {
581 foreach (
$_POST[
"tid"] as $tid) {
582 $ids = explode(
":", $tid);
583 $this->content_obj->deleteTab($ids[0], $ids[1]);
586 $this->updated = $this->pg_obj->update();
588 $ilCtrl->redirect($this,
"edit");
601 $ilTabs->setBackTarget(
603 $this->ctrl->getParentReturn($this)
608 $ilCtrl->getLinkTarget($this,
"edit"),
615 $ilCtrl->getLinkTarget($this,
"editProperties"),
An exception for terminatinating execution or to throw for unit testing.
static addCss()
Add required css.
Confirmation screen class.
static _lookupTemplateIdByName($a_style_id, $a_name)
Lookup table template preview.
cancelTabDeletion()
Cancel tab deletion.
update()
Save tabs properties in db and return to page edit screen.
confirmTabsDeletion()
Confirm tabs deletion.
afterCreation()
After creation processing.
insert($a_omit_form_init=false)
Insert new tabs.
initForm($a_mode="edit")
Insert tabs form.
checkWidthHeight(ilPropertyFormGUI $form)
__construct(&$a_pg_obj, &$a_content_obj, $a_hier_id, $a_pc_id="")
Constructor @access public.
getFormValues()
Get form values.
executeCommand()
execute command
setPropertiesByForm()
Set properties by post.
create()
Create new tabs in dom and update page in db.
addTab()
Save tabs properties in db and return to page edit screen.
editProperties(bool $omit_form_init=false)
Edit tabs.
saveTabs()
Save tabs properties in db and return to page edit screen.
User Interface for Editing of Page Content Objects (Paragraphs, Tables, ...)
getTemplateOptions($a_type)
Get table templates.
displayValidationError()
display validation errors
setHierId($a_hier_id)
get hierarchical id in dom object
getStyleId()
Get Style Id.
This class represents an option in a radio group.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static stripSlashesArray($a_arr, $a_strip_html=true, $a_allow="")
Strip slashes from array.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc