4 require_once(
"./Services/COPage/classes/class.ilPCTabs.php");
5 require_once(
"./Services/COPage/classes/class.ilPageContentGUI.php");
23 function ilPCTabsGUI(&$a_pg_obj, &$a_content_obj, $a_hier_id, $a_pc_id =
"")
34 $next_class = $this->ctrl->getNextClass($this);
37 $cmd = $this->ctrl->getCmd();
59 $html = $this->form->getHTML();
60 $tpl->setContent($html);
75 $html = $this->form->getHTML();
76 $tpl->setContent($html);
86 include_once(
"./Services/Accordion/classes/class.ilAccordionGUI.php");
90 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
92 $this->form->setFormAction($ilCtrl->getFormAction($this));
93 if ($a_mode !=
"edit")
95 $this->form->setTitle($lng->txt(
"cont_ed_insert_tabs"));
99 $this->form->setTitle($lng->txt(
"cont_edit_tabs"));
112 require_once(
"./Services/Form/classes/class.ilAdvSelectInputGUI.php");
117 foreach($templ as $k => $te)
119 $t = explode(
":", $k);
120 $html = $this->style->lookupTemplatePreview(
$t[1]).
'<div style="clear:both" class="small">'.$te.
"</div>";
121 $vchar_prop->addOption($k, $te, $html);
122 if (
$t[2] ==
"VerticalAccordion")
124 $vchar_prop->setValue($k);
132 foreach($templ as $k => $te)
134 $t = explode(
":", $k);
135 $html = $this->style->lookupTemplatePreview(
$t[1]).
'<div style="clear:both" class="small">'.$te.
"</div>";
136 $hchar_prop->addOption($k, $te, $html);
137 if (
$t[2] ==
"HorizontalAccordion")
139 $hchar_prop->setValue($k);
147 $radg->addOption($op1);
150 $radg->addOption($op2);
151 $this->form->addItem($radg);
155 if ($a_mode ==
"create")
159 $nrs = array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6,
160 7 => 7, 8 => 8, 9 => 9, 10 => 10);
161 $nr_prop->setOptions($nrs);
162 $this->form->addItem($nr_prop);
165 $ni =
new ilNumberInputGUI($this->lng->txt(
"cont_tab_cont_width"),
"content_width");
168 $this->form->addItem($ni);
170 $ni =
new ilNumberInputGUI($this->lng->txt(
"cont_tab_cont_height"),
"content_height");
173 $this->form->addItem($ni);
177 "AllClosed" => $lng->txt(
"cont_all_closed"),
178 "FirstOpen" => $lng->txt(
"cont_first_open"),
179 "ForceAllOpen" => $lng->txt(
"cont_force_all_open"),
183 $this->form->addItem($si);
187 $align_opts = array(
"Left" => $lng->txt(
"cont_left"),
188 "Right" => $lng->txt(
"cont_right"),
"Center" => $lng->txt(
"cont_center"),
189 "LeftFloat" => $lng->txt(
"cont_left_float"),
190 "RightFloat" => $lng->txt(
"cont_right_float"));
193 $align->setValue(
"Center");
194 $align->setInfo($lng->txt(
"cont_tabs_hor_align_info"));
195 $this->form->addItem($align);
198 if ($a_mode ==
"create")
200 $this->form->addCommandButton(
"create_section", $lng->txt(
"save"));
201 $this->form->addCommandButton(
"cancelCreate", $lng->txt(
"cancel"));
205 $this->form->addCommandButton(
"update", $lng->txt(
"save"));
206 $this->form->addCommandButton(
"cancelUpdate", $lng->txt(
"cancel"));
215 $values[
"type"] = $this->content_obj->getTabType();
216 $values[
"content_width"] = $this->content_obj->getContentWidth();
217 $values[
"content_height"] = $this->content_obj->getContentHeight();
218 $values[
"align"] = $this->content_obj->getHorizontalAlign();
219 $values[
"behavior"] = $this->content_obj->getBehavior();
220 $this->form->setValuesByArray($values);
224 $va = $this->form->getItemByPostVar(
"vaccord_templ");
227 $this->content_obj->getTemplate();
232 $ha = $this->form->getItemByPostVar(
"haccord_templ");
235 $this->content_obj->getTemplate();
248 if ($this->form->checkInput())
250 $this->content_obj =
new ilPCTabs($this->dom);
251 $this->content_obj->create($this->pg_obj, $this->hier_id, $this->pc_id);
252 $this->content_obj->setTabType(
$_POST[
"type"]);
253 $this->content_obj->setContentWidth(
$_POST[
"content_width"]);
254 $this->content_obj->setContentHeight(
$_POST[
"content_height"]);
255 $this->content_obj->setHorizontalAlign(
$_POST[
"align"]);
256 $this->content_obj->setBehavior(
$_POST[
"behavior"]);
257 for ($i = 0; $i < (int)
$_POST[
"nr"]; $i++)
259 $this->content_obj->addTab($lng->txt(
"cont_new_tab"));
263 $t = explode(
":",
$_POST[
"vaccord_templ"]);
264 $this->content_obj->setTemplate(
$t[2]);
268 $t = explode(
":",
$_POST[
"haccord_templ"]);
269 $this->content_obj->setTemplate(
$t[2]);
272 $this->updated = $this->pg_obj->update();
274 if ($this->updated ===
true)
292 $this->pg_obj->stripHierIDs();
293 $this->pg_obj->addHierIDs();
294 $ilCtrl->setParameter($this,
"hier_id", $this->content_obj->readHierId());
295 $ilCtrl->setParameter($this,
"pc_id", $this->content_obj->readPCId());
296 $this->content_obj->setHierId($this->content_obj->readHierId());
297 $this->
setHierId($this->content_obj->readHierId());
298 $this->content_obj->setPCId($this->content_obj->readPCId());
309 if ($this->form->checkInput())
312 $this->content_obj->setContentWidth(
$_POST[
"content_width"]);
313 $this->content_obj->setContentHeight(
$_POST[
"content_height"]);
314 $this->content_obj->setHorizontalAlign(
$_POST[
"align"]);
315 $this->content_obj->setTemplate(
"");
316 $this->content_obj->setBehavior(
$_POST[
"behavior"]);
319 $t = explode(
":",
$_POST[
"vaccord_templ"]);
320 $this->content_obj->setTemplate(
$t[2]);
324 $t = explode(
":",
$_POST[
"haccord_templ"]);
325 $this->content_obj->setTemplate(
$t[2]);
328 $this->updated = $this->pg_obj->update();
329 if ($this->updated ===
true)
331 $this->ctrl->returnToParent($this,
"jump".$this->hier_id);
335 $this->pg_obj->addHierIDs();
350 global
$tpl, $ilTabs;
353 $ilTabs->activateTab(
"cont_tabs");
354 include_once(
"./Services/COPage/classes/class.ilPCTabsTableGUI.php");
356 $tpl->setContent($table_gui->getHTML());
366 if (is_array(
$_POST[
"caption"]))
368 $this->content_obj->saveCaptions(
$_POST[
"caption"]);
370 if (is_array(
$_POST[
"position"]))
372 $this->content_obj->savePositions(
$_POST[
"position"]);
374 $this->updated = $this->pg_obj->update();
375 $ilCtrl->redirect($this,
"editTabs");
385 $this->content_obj->addTab($lng->txt(
"cont_new_tab"));
386 $this->updated = $this->pg_obj->update();
387 $ilCtrl->redirect($this,
"editTabs");
399 if (!is_array(
$_POST[
"tid"]) || count(
$_POST[
"tid"]) == 0)
402 $ilCtrl->redirect($this,
"editTabs");
406 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
408 $cgui->setFormAction($ilCtrl->getFormAction($this));
409 $cgui->setHeaderText($lng->txt(
"cont_tabs_confirm_deletion"));
410 $cgui->setCancel($lng->txt(
"cancel"),
"cancelTabDeletion");
411 $cgui->setConfirm($lng->txt(
"delete"),
"deleteTabs");
413 foreach (
$_POST[
"tid"] as $k => $i)
415 $id = explode(
":", $k);
416 $cgui->addItem(
"tid[]", $k,
417 $this->content_obj->getCaption($id[0], $id[1]));
420 $tpl->setContent($cgui->getHTML());
430 $ilCtrl->redirect($this,
"editTabs");
440 if (is_array(
$_POST[
"tid"]))
442 foreach(
$_POST[
"tid"] as $tid)
444 $ids = explode(
":", $tid);
445 $this->content_obj->deleteTab($ids[0], $ids[1]);
448 $this->updated = $this->pg_obj->update();
450 $ilCtrl->redirect($this,
"editTabs");
461 $ilTabs->setBackTarget($lng->txt(
"pg"),
462 $this->ctrl->getParentReturn($this));
464 $ilTabs->addTarget(
"cont_edit_tabs",
465 $ilCtrl->getLinkTarget($this,
"edit"),
"edit",
468 $ilTabs->addTarget(
"cont_tabs",
469 $ilCtrl->getLinkTarget($this,
"editTabs"),
"editTabs",