4require_once(
"./Services/COPage/classes/class.ilPCTabs.php");
5require_once(
"./Services/COPage/classes/class.ilPageContentGUI.php");
23 function ilPCTabsGUI(&$a_pg_obj, &$a_content_obj, $a_hier_id, $a_pc_id =
"")
25 parent::ilPageContentGUI($a_pg_obj, $a_content_obj, $a_hier_id, $a_pc_id);
34 $next_class = $this->ctrl->getNextClass($this);
37 $cmd = $this->ctrl->getCmd();
52 function insert($a_omit_form_init =
false)
58 if (!$a_omit_form_init)
62 $html = $this->form->getHTML();
78 $html = $this->form->getHTML();
89 include_once(
"./Services/Accordion/classes/class.ilAccordionGUI.php");
93 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
95 $this->form->setFormAction(
$ilCtrl->getFormAction($this));
96 if ($a_mode !=
"edit")
98 $this->form->setTitle(
$lng->txt(
"cont_ed_insert_tabs"));
102 $this->form->setTitle(
$lng->txt(
"cont_edit_tabs"));
114 require_once(
"./Services/Form/classes/class.ilAdvSelectInputGUI.php");
115 if (count($templ) > 0)
119 foreach($templ as $k => $te)
121 $t = explode(
":", $k);
122 $html = $this->style->lookupTemplatePreview(
$t[1]).
'<div style="clear:both" class="small">'.$te.
"</div>";
123 $vchar_prop->addOption($k, $te,
$html);
124 if (
$t[2] ==
"VerticalAccordion")
126 $vchar_prop->setValue($k);
129 $op1->addSubItem($vchar_prop);
134 $this->form->addItem($vchar_prop);
136 $radg->addOption($op1);
144 if (count($templ) > 0)
148 foreach($templ as $k => $te)
150 $t = explode(
":", $k);
151 $html = $this->style->lookupTemplatePreview(
$t[1]).
'<div style="clear:both" class="small">'.$te.
"</div>";
152 $hchar_prop->addOption($k, $te,
$html);
153 if (
$t[2] ==
"HorizontalAccordion")
155 $hchar_prop->setValue($k);
158 $op2->addSubItem($hchar_prop);
163 $this->form->addItem($hchar_prop);
166 $radg->addOption($op2);
171 require_once(
"./Services/Form/classes/class.ilAdvSelectInputGUI.php");
172 if (count($templ) > 0)
176 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")
183 $cchar_prop->setValue($k);
186 $op3->addSubItem($cchar_prop);
191 $this->form->addItem($cchar_prop);
194 $radg->addOption($op3);
195 $this->form->addItem($radg);
199 if ($a_mode ==
"create")
203 $nrs = array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6,
204 7 => 7, 8 => 8, 9 => 9, 10 => 10);
205 $nr_prop->setOptions($nrs);
206 $this->form->addItem($nr_prop);
209 $ni =
new ilNumberInputGUI($this->lng->txt(
"cont_tab_cont_width"),
"content_width");
210 $ni->setMaxLength(4);
212 $this->form->addItem($ni);
214 $ni =
new ilNumberInputGUI($this->lng->txt(
"cont_tab_cont_height"),
"content_height");
215 $ni->setMaxLength(4);
217 $this->form->addItem($ni);
221 "AllClosed" =>
$lng->txt(
"cont_all_closed"),
222 "FirstOpen" =>
$lng->txt(
"cont_first_open"),
223 "ForceAllOpen" =>
$lng->txt(
"cont_force_all_open"),
227 $op1->addSubItem(
$si);
230 $op2->addSubItem(
$si);
234 $align_opts = array(
"Left" =>
$lng->txt(
"cont_left"),
235 "Right" =>
$lng->txt(
"cont_right"),
"Center" =>
$lng->txt(
"cont_center"),
236 "LeftFloat" =>
$lng->txt(
"cont_left_float"),
237 "RightFloat" =>
$lng->txt(
"cont_right_float"));
239 $align->setOptions($align_opts);
240 $align->setValue(
"Center");
242 $op1->addSubItem($align);
244 $align->setOptions($align_opts);
245 $align->setValue(
"Center");
246 $op3->addSubItem($align);
250 $ti->setMaxLength(6);
252 $ti->setSuffix(
"ms");
253 $ti->setMinValue(100);
254 $op3->addSubItem($ti);
260 $op3->addSubItem($cb);
264 if ($a_mode ==
"create")
266 $this->form->addCommandButton(
"create_section",
$lng->txt(
"save"));
267 $this->form->addCommandButton(
"cancelCreate",
$lng->txt(
"cancel"));
271 $this->form->addCommandButton(
"update",
$lng->txt(
"save"));
272 $this->form->addCommandButton(
"cancelUpdate",
$lng->txt(
"cancel"));
281 $values[
"type"] = $this->content_obj->getTabType();
282 $values[
"content_width"] = $this->content_obj->getContentWidth();
283 $values[
"content_height"] = $this->content_obj->getContentHeight();
284 $values[
"valign"] = $this->content_obj->getHorizontalAlign();
285 $values[
"calign"] = $this->content_obj->getHorizontalAlign();
286 $values[
"vbehavior"] = $this->content_obj->getBehavior();
287 $values[
"hbehavior"] = $this->content_obj->getBehavior();
289 $values[
"auto_time"] = $this->content_obj->getAutoTime();
290 $values[
"rand_start"] = $this->content_obj->getRandomStart();
292 $this->form->setValuesByArray($values);
296 $va = $this->form->getItemByPostVar(
"vaccord_templ");
299 $this->content_obj->getTemplate();
304 $ha = $this->form->getItemByPostVar(
"haccord_templ");
307 $this->content_obj->getTemplate();
312 $ca = $this->form->getItemByPostVar(
"carousel_templ");
315 $this->content_obj->getTemplate();
328 if ($this->form->checkInput())
331 $this->content_obj->create($this->pg_obj, $this->hier_id, $this->pc_id);
335 for ($i = 0; $i < (int)
$_POST[
"nr"]; $i++)
337 $this->content_obj->addTab(
$lng->txt(
"cont_new_tab"));
340 $this->updated = $this->pg_obj->update();
342 if ($this->updated ===
true)
354 $this->form->setValuesByPost();
367 $this->pg_obj->stripHierIDs();
368 $this->pg_obj->addHierIDs();
369 $ilCtrl->setParameter($this,
"hier_id", $this->content_obj->readHierId());
370 $ilCtrl->setParameter($this,
"pc_id", $this->content_obj->readPCId());
371 $this->content_obj->setHierId($this->content_obj->readHierId());
372 $this->
setHierId($this->content_obj->readHierId());
373 $this->content_obj->setPCId($this->content_obj->readPCId());
388 $c->setTabType($f->getInput(
"type"));
390 $c->setContentWidth($f->getInput(
"content_width"));
391 $c->setContentHeight($f->getInput(
"content_height"));
396 $t = explode(
":", $f->getInput(
"vaccord_templ"));
397 $c->setTemplate(
$t[2]);
398 $c->setBehavior($f->getInput(
"vbehavior"));
399 $c->setHorizontalAlign($f->getInput(
"valign"));
403 $t = explode(
":", $f->getInput(
"haccord_templ"));
404 $c->setTemplate(
$t[2]);
405 $c->setBehavior($f->getInput(
"hbehavior"));
409 $t = explode(
":", $f->getInput(
"carousel_templ"));
410 $c->setTemplate(
$t[2]);
411 $c->setHorizontalAlign($f->getInput(
"calign"));
412 $c->setAutoTime($f->getInput(
"auto_time"));
413 $c->setRandomStart($f->getInput(
"rand_start"));
425 $this->updated =
false;
426 if ($this->form->checkInput())
429 $this->updated = $this->pg_obj->update();
431 if ($this->updated ===
true)
434 $this->ctrl->redirect($this,
"editProperties");
439 $this->pg_obj->addHierIDs();
456 $ilToolbar->addButton(
$lng->txt(
"cont_add_tab"),
457 $ilCtrl->getLinkTarget($this,
"addTab"));
460 $ilTabs->activateTab(
"cont_tabs");
461 include_once(
"./Services/COPage/classes/class.ilPCTabsTableGUI.php");
463 $tpl->setContent($table_gui->getHTML());
473 if (is_array(
$_POST[
"caption"]))
476 $this->content_obj->saveCaptions($captions);
478 if (is_array(
$_POST[
"position"]))
481 $this->content_obj->savePositions($positions);
483 $this->updated = $this->pg_obj->update();
485 $ilCtrl->redirect($this,
"edit");
495 $this->content_obj->addTab(
$lng->txt(
"cont_new_tab"));
496 $this->updated = $this->pg_obj->update();
499 $ilCtrl->redirect($this,
"edit");
511 if (!is_array(
$_POST[
"tid"]) || count(
$_POST[
"tid"]) == 0)
514 $ilCtrl->redirect($this,
"edit");
518 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
520 $cgui->setFormAction(
$ilCtrl->getFormAction($this));
521 $cgui->setHeaderText(
$lng->txt(
"cont_tabs_confirm_deletion"));
522 $cgui->setCancel(
$lng->txt(
"cancel"),
"cancelTabDeletion");
523 $cgui->setConfirm(
$lng->txt(
"delete"),
"deleteTabs");
525 foreach (
$_POST[
"tid"] as $k => $i)
527 $id = explode(
":", $k);
528 $cgui->addItem(
"tid[]", $k,
529 $this->content_obj->getCaption($id[0], $id[1]));
532 $tpl->setContent($cgui->getHTML());
542 $ilCtrl->redirect($this,
"edit");
552 if (is_array(
$_POST[
"tid"]))
554 foreach(
$_POST[
"tid"] as $tid)
556 $ids = explode(
":", $tid);
557 $this->content_obj->deleteTab($ids[0], $ids[1]);
560 $this->updated = $this->pg_obj->update();
562 $ilCtrl->redirect($this,
"edit");
573 $ilTabs->setBackTarget(
$lng->txt(
"pg"),
574 $this->ctrl->getParentReturn($this));
576 $ilTabs->addTarget(
"cont_tabs",
577 $ilCtrl->getLinkTarget($this,
"edit"),
"edit",
580 $ilTabs->addTarget(
"cont_edit_tabs",
581 $ilCtrl->getLinkTarget($this,
"editProperties"),
"editProperties",
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.
ilPCTabsGUI(&$a_pg_obj, &$a_content_obj, $a_hier_id, $a_pc_id="")
Constructor @access public.
confirmTabsDeletion()
Confirm tabs deletion.
afterCreation()
After creation processing.
insert($a_omit_form_init=false)
Insert new tabs.
& executeCommand()
execute command
initForm($a_mode="edit")
Insert tabs form.
editProperties()
Edit tabs.
getFormValues()
Get form values.
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.
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 sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
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.
if(!is_array($argv)) $options