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();
 
   52         function insert($a_omit_form_init = 
false)
 
   58                 if (!$a_omit_form_init)
 
   62                 $html = $this->form->getHTML();
 
   63                 $tpl->setContent($html);
 
   78                 $html = $this->form->getHTML();
 
   79                 $tpl->setContent($html);
 
   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"));
 
  115                 require_once(
"./Services/Form/classes/class.ilAdvSelectInputGUI.php");
 
  120                 foreach($templ as $k => $te)
 
  122                         $t = explode(
":", $k);
 
  123                         $html = $this->style->lookupTemplatePreview(
$t[1]).
'<div style="clear:both" class="small">'.$te.
"</div>";
 
  124                         $vchar_prop->addOption($k, $te, $html);
 
  125                         if (
$t[2] == 
"VerticalAccordion")
 
  127                                 $vchar_prop->setValue($k);
 
  135                 foreach($templ as $k => $te)
 
  137                         $t = explode(
":", $k);
 
  138                         $html = $this->style->lookupTemplatePreview(
$t[1]).
'<div style="clear:both" class="small">'.$te.
"</div>";
 
  139                         $hchar_prop->addOption($k, $te, $html);
 
  140                         if (
$t[2] == 
"HorizontalAccordion")
 
  142                                 $hchar_prop->setValue($k);
 
  150                 $radg->addOption($op1);
 
  153                 $radg->addOption($op2);
 
  154                 $this->form->addItem($radg);
 
  158                 if ($a_mode == 
"create")
 
  162                         $nrs = array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 
 
  163                                 7 => 7, 8 => 8, 9 => 9, 10 => 10);
 
  164                         $nr_prop->setOptions($nrs);
 
  165                         $this->form->addItem($nr_prop);
 
  168                 $ni = 
new ilNumberInputGUI($this->lng->txt(
"cont_tab_cont_width"), 
"content_width");
 
  171                 $this->form->addItem($ni);
 
  173                 $ni = 
new ilNumberInputGUI($this->lng->txt(
"cont_tab_cont_height"), 
"content_height");
 
  176                 $this->form->addItem($ni);
 
  180                         "AllClosed" => $lng->txt(
"cont_all_closed"),
 
  181                         "FirstOpen" => $lng->txt(
"cont_first_open"),
 
  182                         "ForceAllOpen" => $lng->txt(
"cont_force_all_open"),
 
  186                 $this->form->addItem($si);
 
  190                 $align_opts = array(
"Left" => $lng->txt(
"cont_left"),
 
  191                         "Right" => $lng->txt(
"cont_right"), 
"Center" => $lng->txt(
"cont_center"),
 
  192                         "LeftFloat" => $lng->txt(
"cont_left_float"),
 
  193                         "RightFloat" => $lng->txt(
"cont_right_float"));
 
  196                 $align->setValue(
"Center");
 
  197                 $align->setInfo($lng->txt(
"cont_tabs_hor_align_info"));
 
  198                 $this->form->addItem($align);
 
  201                 if ($a_mode == 
"create")
 
  203                         $this->form->addCommandButton(
"create_section", $lng->txt(
"save"));
 
  204                         $this->form->addCommandButton(
"cancelCreate", $lng->txt(
"cancel"));
 
  208                         $this->form->addCommandButton(
"update", $lng->txt(
"save"));
 
  209                         $this->form->addCommandButton(
"cancelUpdate", $lng->txt(
"cancel"));
 
  218                 $values[
"type"] = $this->content_obj->getTabType();
 
  219                 $values[
"content_width"] = $this->content_obj->getContentWidth();
 
  220                 $values[
"content_height"] = $this->content_obj->getContentHeight();
 
  221                 $values[
"align"] = $this->content_obj->getHorizontalAlign();
 
  222                 $values[
"behavior"] = $this->content_obj->getBehavior();
 
  223                 $this->form->setValuesByArray($values);
 
  227                         $va = $this->form->getItemByPostVar(
"vaccord_templ");
 
  230                                 $this->content_obj->getTemplate();
 
  235                         $ha = $this->form->getItemByPostVar(
"haccord_templ");
 
  238                                 $this->content_obj->getTemplate();
 
  251                 if ($this->form->checkInput())
 
  254                         $this->content_obj->create($this->pg_obj, $this->hier_id, $this->pc_id);
 
  255                         $this->content_obj->setTabType(
$_POST[
"type"]);
 
  256                         $this->content_obj->setContentWidth(
$_POST[
"content_width"]);
 
  257                         $this->content_obj->setContentHeight(
$_POST[
"content_height"]);
 
  258                         $this->content_obj->setHorizontalAlign(
$_POST[
"align"]);
 
  259                         $this->content_obj->setBehavior(
$_POST[
"behavior"]);
 
  260                         for ($i = 0; $i < (int) 
$_POST[
"nr"]; $i++)
 
  262                                 $this->content_obj->addTab($lng->txt(
"cont_new_tab"));
 
  266                                 $t = explode(
":", 
$_POST[
"vaccord_templ"]);
 
  267                                 $this->content_obj->setTemplate(
$t[2]);
 
  271                                 $t = explode(
":", 
$_POST[
"haccord_templ"]);
 
  272                                 $this->content_obj->setTemplate(
$t[2]);
 
  274                         $this->updated = $this->pg_obj->update();
 
  276                         if ($this->updated === 
true)
 
  288                         $this->form->setValuesByPost();
 
  301                 $this->pg_obj->stripHierIDs();
 
  302                 $this->pg_obj->addHierIDs();
 
  303                 $ilCtrl->setParameter($this, 
"hier_id", $this->content_obj->readHierId());
 
  304                 $ilCtrl->setParameter($this, 
"pc_id", $this->content_obj->readPCId());
 
  305                 $this->content_obj->setHierId($this->content_obj->readHierId());
 
  306                 $this->
setHierId($this->content_obj->readHierId());
 
  307                 $this->content_obj->setPCId($this->content_obj->readPCId());
 
  318                 if ($this->form->checkInput())
 
  321                         $this->content_obj->setContentWidth(
$_POST[
"content_width"]);
 
  322                         $this->content_obj->setContentHeight(
$_POST[
"content_height"]);
 
  323                         $this->content_obj->setHorizontalAlign(
$_POST[
"align"]);
 
  324                         $this->content_obj->setTemplate(
"");
 
  325                         $this->content_obj->setBehavior(
$_POST[
"behavior"]);
 
  328                                 $t = explode(
":", 
$_POST[
"vaccord_templ"]);
 
  329                                 $this->content_obj->setTemplate(
$t[2]);
 
  333                                 $t = explode(
":", 
$_POST[
"haccord_templ"]);
 
  334                                 $this->content_obj->setTemplate(
$t[2]);
 
  337                 $this->updated = $this->pg_obj->update();
 
  338                 if ($this->updated === 
true)
 
  340                         $this->ctrl->returnToParent($this, 
"jump".$this->hier_id);
 
  344                         $this->pg_obj->addHierIDs();
 
  361                 $ilToolbar->addButton($lng->txt(
"cont_add_tab"),
 
  362                         $ilCtrl->getLinkTarget($this, 
"addTab"));
 
  365                 $ilTabs->activateTab(
"cont_tabs");
 
  366                 include_once(
"./Services/COPage/classes/class.ilPCTabsTableGUI.php");
 
  368                 $tpl->setContent($table_gui->getHTML());
 
  378                 if (is_array(
$_POST[
"caption"]))
 
  381                         $this->content_obj->saveCaptions($captions);
 
  383                 if (is_array(
$_POST[
"position"]))
 
  386                         $this->content_obj->savePositions($positions);
 
  388                 $this->updated = $this->pg_obj->update();
 
  390                 $ilCtrl->redirect($this, 
"edit");
 
  400                 $this->content_obj->addTab($lng->txt(
"cont_new_tab"));
 
  401                 $this->updated = $this->pg_obj->update();
 
  404                 $ilCtrl->redirect($this, 
"edit");
 
  416                 if (!is_array(
$_POST[
"tid"]) || count(
$_POST[
"tid"]) == 0)
 
  419                         $ilCtrl->redirect($this, 
"edit");
 
  423                         include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
 
  425                         $cgui->setFormAction($ilCtrl->getFormAction($this));
 
  426                         $cgui->setHeaderText($lng->txt(
"cont_tabs_confirm_deletion"));
 
  427                         $cgui->setCancel($lng->txt(
"cancel"), 
"cancelTabDeletion");
 
  428                         $cgui->setConfirm($lng->txt(
"delete"), 
"deleteTabs");
 
  430                         foreach (
$_POST[
"tid"] as $k => $i)
 
  432                                 $id = explode(
":", $k);
 
  433                                 $cgui->addItem(
"tid[]", $k,
 
  434                                         $this->content_obj->getCaption($id[0], $id[1]));
 
  437                         $tpl->setContent($cgui->getHTML());
 
  447                 $ilCtrl->redirect($this, 
"edit");
 
  457                 if (is_array(
$_POST[
"tid"]))
 
  459                         foreach(
$_POST[
"tid"] as $tid)
 
  461                                 $ids = explode(
":", $tid);
 
  462                                 $this->content_obj->deleteTab($ids[0], $ids[1]);
 
  465                 $this->updated = $this->pg_obj->update();
 
  467                 $ilCtrl->redirect($this, 
"edit");
 
  478                 $ilTabs->setBackTarget($lng->txt(
"pg"),
 
  479                         $this->ctrl->getParentReturn($this));
 
  481                 $ilTabs->addTarget(
"cont_tabs",
 
  482                         $ilCtrl->getLinkTarget($this, 
"edit"), 
"edit",
 
  485                 $ilTabs->addTarget(
"cont_edit_tabs",
 
  486                         $ilCtrl->getLinkTarget($this, 
"editProperties"), 
"editProperties",