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);
 
  101        $html = $this->form->getHTML();
 
  102        $tpl->setContent($html);
 
  114        include_once(
"./Services/Accordion/classes/class.ilAccordionGUI.php");
 
  118        include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
 
  120        $this->form->setFormAction(
$ilCtrl->getFormAction($this));
 
  121        if ($a_mode != 
"edit") {
 
  122            $this->form->setTitle(
$lng->txt(
"cont_ed_insert_tabs"));
 
  124            $this->form->setTitle(
$lng->txt(
"cont_edit_tabs"));
 
  136        require_once(
"./Services/Form/classes/class.ilAdvSelectInputGUI.php");
 
  137        if (count($templ) > 0) {
 
  139                $this->lng->txt(
"cont_characteristic"),
 
  142            foreach ($templ as $k => $te) {
 
  143                $t = explode(
":", $k);
 
  144                $html = $this->style->lookupTemplatePreview($t[1]) . 
'<div style="clear:both" class="small">' . $te . 
"</div>";
 
  145                $vchar_prop->addOption($k, $te, $html);
 
  146                if ($t[2] == 
"VerticalAccordion") {
 
  147                    $vchar_prop->setValue($k);
 
  150            $op1->addSubItem($vchar_prop);
 
  153            $this->form->addItem($vchar_prop);
 
  155        $radg->addOption($op1);
 
  163        if (count($templ) > 0) {
 
  165                $this->lng->txt(
"cont_characteristic"),
 
  168            foreach ($templ as $k => $te) {
 
  169                $t = explode(
":", $k);
 
  170                $html = $this->style->lookupTemplatePreview($t[1]) . 
'<div style="clear:both" class="small">' . $te . 
"</div>";
 
  171                $hchar_prop->addOption($k, $te, $html);
 
  172                if ($t[2] == 
"HorizontalAccordion") {
 
  173                    $hchar_prop->setValue($k);
 
  176            $op2->addSubItem($hchar_prop);
 
  179            $this->form->addItem($hchar_prop);
 
  182        $radg->addOption($op2);
 
  187        require_once(
"./Services/Form/classes/class.ilAdvSelectInputGUI.php");
 
  188        if (count($templ) > 0) {
 
  190                $this->lng->txt(
"cont_characteristic"),
 
  193            foreach ($templ as $k => $te) {
 
  194                $t = explode(
":", $k);
 
  195                $html = $this->style->lookupTemplatePreview($t[1]) . 
'<div style="clear:both" class="small">' . $te . 
"</div>";
 
  196                $cchar_prop->addOption($k, $te, $html);
 
  197                if ($t[2] == 
"Carousel") {
 
  198                    $cchar_prop->setValue($k);
 
  201            $op3->addSubItem($cchar_prop);
 
  204            $this->form->addItem($cchar_prop);
 
  207        $radg->addOption($op3);
 
  208        $this->form->addItem($radg);
 
  212        if ($a_mode == 
"create") {
 
  214                $lng->txt(
"cont_number_of_tabs"),
 
  217            $nrs = array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6,
 
  218                7 => 7, 8 => 8, 9 => 9, 10 => 10);
 
  219            $nr_prop->setOptions($nrs);
 
  220            $this->form->addItem($nr_prop);
 
  223        $ni = 
new ilNumberInputGUI($this->lng->txt(
"cont_tab_cont_width"), 
"content_width");
 
  224        $ni->setMaxLength(4);
 
  226        $this->form->addItem($ni);
 
  228        $ni = 
new ilNumberInputGUI($this->lng->txt(
"cont_tab_cont_height"), 
"content_height");
 
  229        $ni->setMaxLength(4);
 
  231        $this->form->addItem($ni);
 
  235            "AllClosed" => 
$lng->txt(
"cont_all_closed"),
 
  236            "FirstOpen" => 
$lng->txt(
"cont_first_open"),
 
  237            "ForceAllOpen" => 
$lng->txt(
"cont_force_all_open"),
 
  240        $si->setOptions($options);
 
  241        $op1->addSubItem(
$si);
 
  243        $si->setOptions($options);
 
  244        $op2->addSubItem(
$si);
 
  248        $align_opts = array(
"Left" => 
$lng->txt(
"cont_left"),
 
  249            "Right" => 
$lng->txt(
"cont_right"), 
"Center" => 
$lng->txt(
"cont_center"),
 
  250            "LeftFloat" => 
$lng->txt(
"cont_left_float"),
 
  251            "RightFloat" => 
$lng->txt(
"cont_right_float"));
 
  253        $align->setOptions($align_opts);
 
  254        $align->setValue(
"Center");
 
  256        $op1->addSubItem($align);
 
  258        $align->setOptions($align_opts);
 
  259        $align->setValue(
"Center");
 
  260        $op3->addSubItem($align);
 
  264        $ti->setMaxLength(6);
 
  266        $ti->setSuffix(
"ms");
 
  267        $ti->setMinValue(100);
 
  268        $op3->addSubItem($ti);
 
  274        $op3->addSubItem($cb);
 
  278        if ($a_mode == 
"create") {
 
  279            $this->form->addCommandButton(
"create_section", 
$lng->txt(
"save"));
 
  280            $this->form->addCommandButton(
"cancelCreate", 
$lng->txt(
"cancel"));
 
  282            $this->form->addCommandButton(
"update", 
$lng->txt(
"save"));
 
  283            $this->form->addCommandButton(
"cancelUpdate", 
$lng->txt(
"cancel"));
 
  292        $values[
"type"] = $this->content_obj->getTabType();
 
  293        $values[
"content_width"] = $this->content_obj->getContentWidth();
 
  294        $values[
"content_height"] = $this->content_obj->getContentHeight();
 
  295        $values[
"valign"] = $this->content_obj->getHorizontalAlign();
 
  296        $values[
"calign"] = $this->content_obj->getHorizontalAlign();
 
  297        $values[
"vbehavior"] = $this->content_obj->getBehavior();
 
  298        $values[
"hbehavior"] = $this->content_obj->getBehavior();
 
  300        $values[
"auto_time"] = $this->content_obj->getAutoTime();
 
  301        $values[
"rand_start"] = $this->content_obj->getRandomStart();
 
  303        $this->form->setValuesByArray($values);
 
  306            $va = $this->form->getItemByPostVar(
"vaccord_templ");
 
  309                $this->content_obj->getTemplate();
 
  313            $ha = $this->form->getItemByPostVar(
"haccord_templ");
 
  316                $this->content_obj->getTemplate();
 
  320            $ca = $this->form->getItemByPostVar(
"carousel_templ");
 
  323                $this->content_obj->getTemplate();
 
  337        if ($this->form->checkInput()) {
 
  339            $this->content_obj->create($this->pg_obj, $this->hier_id, $this->pc_id);
 
  344                $this->content_obj->addTab(
$lng->txt(
"cont_new_tab"));
 
  347            $this->updated = $this->pg_obj->update();
 
  349            if ($this->updated === 
true) {
 
  356            $this->form->setValuesByPost();
 
  369        $this->pg_obj->stripHierIDs();
 
  370        $this->pg_obj->addHierIDs();
 
  371        $ilCtrl->setParameter($this, 
"hier_id", $this->content_obj->readHierId());
 
  372        $ilCtrl->setParameter($this, 
"pc_id", $this->content_obj->readPCId());
 
  373        $this->content_obj->setHierId($this->content_obj->readHierId());
 
  374        $this->
setHierId($this->content_obj->readHierId());
 
  375        $this->content_obj->setPCId($this->content_obj->readPCId());
 
  390        $c->setTabType(
$f->getInput(
"type"));
 
  392        $c->setContentWidth(
$f->getInput(
"content_width"));
 
  393        $c->setContentHeight(
$f->getInput(
"content_height"));
 
  397                $t = explode(
":", 
$f->getInput(
"vaccord_templ"));
 
  398                $c->setTemplate($t[2]);
 
  399                $c->setBehavior(
$f->getInput(
"vbehavior"));
 
  400                $c->setHorizontalAlign(
$f->getInput(
"valign"));
 
  404                $t = explode(
":", 
$f->getInput(
"haccord_templ"));
 
  405                $c->setTemplate($t[2]);
 
  406                $c->setBehavior(
$f->getInput(
"hbehavior"));
 
  410                $t = explode(
":", 
$f->getInput(
"carousel_templ"));
 
  411                $c->setTemplate($t[2]);
 
  412                $c->setHorizontalAlign(
$f->getInput(
"calign"));
 
  413                $c->setAutoTime(
$f->getInput(
"auto_time"));
 
  414                $c->setRandomStart(
$f->getInput(
"rand_start"));
 
  426        $this->updated = 
false;
 
  427        if ($this->form->checkInput()) {
 
  429            $this->updated = $this->pg_obj->update();
 
  431        if ($this->updated === 
true) {
 
  432            ilUtil::sendSuccess($this->lng->txt(
"msg_obj_modified"), 
true);
 
  433            $this->ctrl->redirect($this, 
"editProperties");
 
  436            $this->pg_obj->addHierIDs();
 
  457        $ilToolbar->addButton(
 
  458            $lng->txt(
"cont_add_tab"),
 
  459            $ilCtrl->getLinkTarget($this, 
"addTab")
 
  463        $ilTabs->activateTab(
"cont_tabs");
 
  464        include_once(
"./Services/COPage/classes/class.ilPCTabsTableGUI.php");
 
  466        $tpl->setContent($table_gui->getHTML());
 
  477        if (is_array(
$_POST[
"caption"])) {
 
  479            $this->content_obj->saveCaptions($captions);
 
  481        if (is_array(
$_POST[
"position"])) {
 
  483            $this->content_obj->savePositions($positions);
 
  485        $this->updated = $this->pg_obj->update();
 
  486        ilUtil::sendSuccess(
$lng->txt(
"msg_obj_modified"), 
true);
 
  487        $ilCtrl->redirect($this, 
"edit");
 
  498        $this->content_obj->addTab(
$lng->txt(
"cont_new_tab"));
 
  499        $this->updated = $this->pg_obj->update();
 
  501        ilUtil::sendSuccess(
$lng->txt(
"cont_added_tab"), 
true);
 
  502        $ilCtrl->redirect($this, 
"edit");
 
  516        if (!is_array(
$_POST[
"tid"]) || count(
$_POST[
"tid"]) == 0) {
 
  518            $ilCtrl->redirect($this, 
"edit");
 
  520            include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
 
  522            $cgui->setFormAction(
$ilCtrl->getFormAction($this));
 
  523            $cgui->setHeaderText(
$lng->txt(
"cont_tabs_confirm_deletion"));
 
  524            $cgui->setCancel(
$lng->txt(
"cancel"), 
"cancelTabDeletion");
 
  525            $cgui->setConfirm(
$lng->txt(
"delete"), 
"deleteTabs");
 
  527            foreach (
$_POST[
"tid"] as $k => 
$i) {
 
  528                $id = explode(
":", $k);
 
  532                    $this->content_obj->getCaption($id[0], $id[1])
 
  536            $tpl->setContent($cgui->getHTML());
 
  546        $ilCtrl->redirect($this, 
"edit");
 
  556        if (is_array(
$_POST[
"tid"])) {
 
  557            foreach (
$_POST[
"tid"] as $tid) {
 
  558                $ids = explode(
":", $tid);
 
  559                $this->content_obj->deleteTab($ids[0], $ids[1]);
 
  562        $this->updated = $this->pg_obj->update();
 
  564        $ilCtrl->redirect($this, 
"edit");
 
  577        $ilTabs->setBackTarget(
 
  579            $this->ctrl->getParentReturn($this)
 
  584            $ilCtrl->getLinkTarget($this, 
"edit"),
 
  591            $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.
editProperties()
Edit tabs.
__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.
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