ILIAS  Release_4_2_x_branch Revision 61807
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilPCTabsGUI Class Reference

Class ilPCTabsGUI. More...

+ Inheritance diagram for ilPCTabsGUI:
+ Collaboration diagram for ilPCTabsGUI:

Public Member Functions

 ilPCTabsGUI (&$a_pg_obj, &$a_content_obj, $a_hier_id, $a_pc_id="")
 Constructor public.
executeCommand ()
 execute command
 insert ($a_omit_form_init=false)
 Insert new tabs.
 editProperties ()
 Edit tabs.
 initForm ($a_mode="edit")
 Insert tabs form.
 getFormValues ()
 Get form values.
 create ()
 Create new tabs in dom and update page in db.
 afterCreation ()
 After creation processing.
 update ()
 Save tabs properties in db and return to page edit screen.
 edit ()
 List all tabs.
 saveTabs ()
 Save tabs properties in db and return to page edit screen.
 addTab ()
 Save tabs properties in db and return to page edit screen.
 confirmTabsDeletion ()
 Confirm tabs deletion.
 cancelTabDeletion ()
 Cancel tab deletion.
 deleteTabs ()
 Delete Tabs.
 setTabs ()
 Set tabs.
- Public Member Functions inherited from ilPageContentGUI
 ilPageContentGUI (&$a_pg_obj, &$a_content_obj, $a_hier_id=0, $a_pc_id="")
 Constructor public.
 setStyleId ($a_styleid)
 Set Style Id.
 getStyleId ()
 Get Style Id.
 setEnableInternalLinks ($a_val)
 Set enable internal links.
 getEnableInternalLinks ()
 Get enable internal links.
 setEnableKeywords ($a_val)
 Set enable keywords handling.
 getEnableKeywords ()
 Get enable keywords handling.
 setEnableAnchors ($a_val)
 Set enable anchors.
 getEnableAnchors ()
 Get enable anchors.
 getStyle ()
 Get style object.
 setCharacteristics ($a_chars)
 Set Characteristics.
 getCharacteristics ()
 Get characteristics.
 getHierId ()
 get hierarchical id in dom object
 setHierId ($a_hier_id)
 get hierarchical id in dom object
 getBBMenu ($a_ta_name="par_content")
 Get the bb menu incl.
 delete ()
 delete content element
 moveAfter ()
 move content element after another element
 moveBefore ()
 move content element before another element
 splitPage ()
 split page to new page at specified position
 splitPageNext ()
 split page to next page at specified position
 displayValidationError ()
 display validation errors
 cancelCreate ()
 cancel creating page content
 cancelUpdate ()
 cancel update
 cancel ()
 Cancel.
 deactivate ()
 gui function set enabled if is not enabled and vice versa
 cut ()
 Cut single element.
 copy ()
 Copy single element.
 getTemplateOptions ($a_type)
 Get table templates.

Additional Inherited Members

- Static Public Member Functions inherited from ilPageContentGUI
static _getCommonBBButtons ()
 Get common bb buttons.
- Data Fields inherited from ilPageContentGUI
 $content_obj
 $ilias
 $tpl
 $lng
 $ctrl
 $pg_obj
 $hier_id
 $dom
 $updated
 $target_script
 $return_location
- Protected Member Functions inherited from ilPageContentGUI
 getCharacteristicsOfCurrentStyle ($a_type)
 Get characteristics of current style.
- Static Protected Attributes inherited from ilPageContentGUI
static $common_bb_buttons

Detailed Description

Class ilPCTabsGUI.

User Interface for Tabbed Content

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 17 of file class.ilPCTabsGUI.php.

Member Function Documentation

ilPCTabsGUI::addTab ( )

Save tabs properties in db and return to page edit screen.

Definition at line 396 of file class.ilPCTabsGUI.php.

References $ilCtrl, ilPageContentGUI\$lng, and ilUtil\sendSuccess().

{
global $lng, $ilCtrl;
$this->content_obj->addTab($lng->txt("cont_new_tab"));
$this->updated = $this->pg_obj->update();
ilUtil::sendSuccess($lng->txt("cont_added_tab"), true);
$ilCtrl->redirect($this, "edit");
}

+ Here is the call graph for this function:

ilPCTabsGUI::afterCreation ( )

After creation processing.

Definition at line 297 of file class.ilPCTabsGUI.php.

References $ilCtrl, edit(), and ilPageContentGUI\setHierId().

Referenced by create().

{
global $ilCtrl;
$this->pg_obj->stripHierIDs();
$this->pg_obj->addHierIDs();
$ilCtrl->setParameter($this, "hier_id", $this->content_obj->readHierId());
$ilCtrl->setParameter($this, "pc_id", $this->content_obj->readPCId());
$this->content_obj->setHierId($this->content_obj->readHierId());
$this->setHierId($this->content_obj->readHierId());
$this->content_obj->setPCId($this->content_obj->readPCId());
$this->edit();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPCTabsGUI::cancelTabDeletion ( )

Cancel tab deletion.

Definition at line 444 of file class.ilPCTabsGUI.php.

References $ilCtrl.

{
global $ilCtrl;
$ilCtrl->redirect($this, "edit");
}
ilPCTabsGUI::confirmTabsDeletion ( )

Confirm tabs deletion.

Definition at line 410 of file class.ilPCTabsGUI.php.

References $_POST, $ilCtrl, ilPageContentGUI\$lng, ilPageContentGUI\$tpl, ilUtil\sendInfo(), and setTabs().

{
global $ilCtrl, $tpl, $lng;
$this->setTabs();
if (!is_array($_POST["tid"]) || count($_POST["tid"]) == 0)
{
ilUtil::sendInfo($lng->txt("no_checkbox"), true);
$ilCtrl->redirect($this, "edit");
}
else
{
include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
$cgui = new ilConfirmationGUI();
$cgui->setFormAction($ilCtrl->getFormAction($this));
$cgui->setHeaderText($lng->txt("cont_tabs_confirm_deletion"));
$cgui->setCancel($lng->txt("cancel"), "cancelTabDeletion");
$cgui->setConfirm($lng->txt("delete"), "deleteTabs");
foreach ($_POST["tid"] as $k => $i)
{
$id = explode(":", $k);
$cgui->addItem("tid[]", $k,
$this->content_obj->getCaption($id[0], $id[1]));
}
$tpl->setContent($cgui->getHTML());
}
}

+ Here is the call graph for this function:

ilPCTabsGUI::create ( )

Create new tabs in dom and update page in db.

Definition at line 246 of file class.ilPCTabsGUI.php.

References $_POST, $ilDB, ilPageContentGUI\$lng, $t, ilPCTabs\ACCORDION_HOR, ilPCTabs\ACCORDION_VER, afterCreation(), initForm(), and insert().

{
global $ilDB, $lng;
$this->initForm("create");
if ($this->form->checkInput())
{
$this->content_obj = new ilPCTabs($this->dom);
$this->content_obj->create($this->pg_obj, $this->hier_id, $this->pc_id);
$this->content_obj->setTabType($_POST["type"]);
$this->content_obj->setContentWidth($_POST["content_width"]);
$this->content_obj->setContentHeight($_POST["content_height"]);
$this->content_obj->setHorizontalAlign($_POST["align"]);
$this->content_obj->setBehavior($_POST["behavior"]);
for ($i = 0; $i < (int) $_POST["nr"]; $i++)
{
$this->content_obj->addTab($lng->txt("cont_new_tab"));
}
{
$t = explode(":", $_POST["vaccord_templ"]);
$this->content_obj->setTemplate($t[2]);
}
{
$t = explode(":", $_POST["haccord_templ"]);
$this->content_obj->setTemplate($t[2]);
}
$this->updated = $this->pg_obj->update();
if ($this->updated === true)
{
$this->afterCreation();
//$this->ctrl->returnToParent($this, "jump".$this->hier_id);
}
else
{
$this->insert();
}
}
else
{
$this->form->setValuesByPost();
$this->insert(true);
// return $this->form->getHtml();
}
}

+ Here is the call graph for this function:

ilPCTabsGUI::deleteTabs ( )

Delete Tabs.

Definition at line 453 of file class.ilPCTabsGUI.php.

References $_POST, and $ilCtrl.

{
global $ilCtrl;
if (is_array($_POST["tid"]))
{
foreach($_POST["tid"] as $tid)
{
$ids = explode(":", $tid);
$this->content_obj->deleteTab($ids[0], $ids[1]);
}
}
$this->updated = $this->pg_obj->update();
$ilCtrl->redirect($this, "edit");
}
ilPCTabsGUI::edit ( )

List all tabs.

Definition at line 357 of file class.ilPCTabsGUI.php.

References $ilCtrl, ilPageContentGUI\$lng, ilPageContentGUI\$tpl, and setTabs().

Referenced by afterCreation().

{
global $tpl, $ilTabs, $ilCtrl, $ilToolbar, $lng;
$ilToolbar->addButton($lng->txt("cont_add_tab"),
$ilCtrl->getLinkTarget($this, "addTab"));
$this->setTabs();
$ilTabs->activateTab("cont_tabs");
include_once("./Services/COPage/classes/class.ilPCTabsTableGUI.php");
$table_gui = new ilPCTabsTableGUI($this, "edit", $this->content_obj);
$tpl->setContent($table_gui->getHTML());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPCTabsGUI::editProperties ( )

Edit tabs.

Definition at line 69 of file class.ilPCTabsGUI.php.

References $ilCtrl, ilPageContentGUI\$lng, ilPageContentGUI\$tpl, ilPageContentGUI\displayValidationError(), getFormValues(), initForm(), and setTabs().

Referenced by update().

{
global $ilCtrl, $lng, $tpl;
$this->setTabs();
$this->initForm();
$this->getFormValues();
$html = $this->form->getHTML();
$tpl->setContent($html);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

& ilPCTabsGUI::executeCommand ( )

execute command

Definition at line 31 of file class.ilPCTabsGUI.php.

References $cmd, and $ret.

{
// get next class that processes or forwards current command
$next_class = $this->ctrl->getNextClass($this);
// get current command
$cmd = $this->ctrl->getCmd();
switch($next_class)
{
default:
$ret =& $this->$cmd();
break;
}
return $ret;
}
ilPCTabsGUI::getFormValues ( )

Get form values.

Definition at line 216 of file class.ilPCTabsGUI.php.

References ilObjStyleSheet\_lookupTemplateIdByName(), ilPCTabs\ACCORDION_HOR, ilPCTabs\ACCORDION_VER, and ilPageContentGUI\getStyleId().

Referenced by editProperties().

{
$values["type"] = $this->content_obj->getTabType();
$values["content_width"] = $this->content_obj->getContentWidth();
$values["content_height"] = $this->content_obj->getContentHeight();
$values["align"] = $this->content_obj->getHorizontalAlign();
$values["behavior"] = $this->content_obj->getBehavior();
$this->form->setValuesByArray($values);
if ($values["type"] == ilPCTabs::ACCORDION_VER)
{
$va = $this->form->getItemByPostVar("vaccord_templ");
$v = "t:".
ilObjStyleSheet::_lookupTemplateIdByName($this->getStyleId(), $this->content_obj->getTemplate()).":".
$this->content_obj->getTemplate();
$va->setValue($v);
}
if ($values["type"] == ilPCTabs::ACCORDION_HOR)
{
$ha = $this->form->getItemByPostVar("haccord_templ");
$v = "t:".
ilObjStyleSheet::_lookupTemplateIdByName($this->getStyleId(), $this->content_obj->getTemplate()).":".
$this->content_obj->getTemplate();
$ha->setValue($v);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPCTabsGUI::ilPCTabsGUI ( $a_pg_obj,
$a_content_obj,
  $a_hier_id,
  $a_pc_id = "" 
)

Constructor public.

Definition at line 23 of file class.ilPCTabsGUI.php.

References ilPageContentGUI\ilPageContentGUI().

{
parent::ilPageContentGUI($a_pg_obj, $a_content_obj, $a_hier_id, $a_pc_id);
}

+ Here is the call graph for this function:

ilPCTabsGUI::initForm (   $a_mode = "edit")

Insert tabs form.

Definition at line 85 of file class.ilPCTabsGUI.php.

References $ilCtrl, ilPageContentGUI\$lng, $t, ilPageContentGUI\$tpl, ilPCTabs\ACCORDION_HOR, ilPCTabs\ACCORDION_VER, ilAccordionGUI\addCss(), ilRadioOption\addSubItem(), ilPageContentGUI\getTemplateOptions(), ilNumberInputGUI\setMaxLength(), ilSelectInputGUI\setOptions(), and ilRadioGroupInputGUI\setValue().

Referenced by create(), editProperties(), insert(), and update().

{
global $ilCtrl, $tpl, $lng;
include_once("./Services/Accordion/classes/class.ilAccordionGUI.php");
// edit form
include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
$this->form = new ilPropertyFormGUI();
$this->form->setFormAction($ilCtrl->getFormAction($this));
if ($a_mode != "edit")
{
$this->form->setTitle($lng->txt("cont_ed_insert_tabs"));
}
else
{
$this->form->setTitle($lng->txt("cont_edit_tabs"));
}
// tabs type
/*$type_prop = new ilSelectInputGUI($lng->txt("cont_type"),
"type");
$types = array(ilPCTabs::ACCORDION_VER => $lng->txt("cont_tabs_acc_ver"),
ilPCTabs::ACCORDION_HOR => $lng->txt("cont_tabs_acc_hor"));
$type_prop->setOptions($types);
$this->form->addItem($type_prop);*/
$templ = $this->getTemplateOptions("vaccordion");
require_once("./Services/Form/classes/class.ilAdvSelectInputGUI.php");
$vchar_prop = new ilAdvSelectInputGUI($this->lng->txt("cont_characteristic"),
"vaccord_templ");
$vchars = array();
foreach($templ as $k => $te)
{
$t = explode(":", $k);
$html = $this->style->lookupTemplatePreview($t[1]).'<div style="clear:both" class="small">'.$te."</div>";
$vchar_prop->addOption($k, $te, $html);
if ($t[2] == "VerticalAccordion")
{
$vchar_prop->setValue($k);
}
}
$templ = $this->getTemplateOptions("haccordion");
$hchar_prop = new ilAdvSelectInputGUI($this->lng->txt("cont_characteristic"),
"haccord_templ");
$hchars = array();
foreach($templ as $k => $te)
{
$t = explode(":", $k);
$html = $this->style->lookupTemplatePreview($t[1]).'<div style="clear:both" class="small">'.$te."</div>";
$hchar_prop->addOption($k, $te, $html);
if ($t[2] == "HorizontalAccordion")
{
$hchar_prop->setValue($k);
}
}
$radg = new ilRadioGroupInputGUI($lng->txt("cont_type"), "type");
$op1 = new ilRadioOption($lng->txt("cont_tabs_acc_ver"), ilPCTabs::ACCORDION_VER);
$op1->addSubItem($vchar_prop);
$radg->addOption($op1);
$op2 = new ilRadioOption($lng->txt("cont_tabs_acc_hor"), ilPCTabs::ACCORDION_HOR);
$op2->addSubItem($hchar_prop);
$radg->addOption($op2);
$this->form->addItem($radg);
// number of initial tabs
if ($a_mode == "create")
{
$nr_prop = new ilSelectInputGUI($lng->txt("cont_number_of_tabs"),
"nr");
$nrs = array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6,
7 => 7, 8 => 8, 9 => 9, 10 => 10);
$nr_prop->setOptions($nrs);
$this->form->addItem($nr_prop);
}
$ni = new ilNumberInputGUI($this->lng->txt("cont_tab_cont_width"), "content_width");
$ni->setMaxLength(4);
$ni->setSize(4);
$this->form->addItem($ni);
$ni = new ilNumberInputGUI($this->lng->txt("cont_tab_cont_height"), "content_height");
$ni->setMaxLength(4);
$ni->setSize(4);
$this->form->addItem($ni);
// behaviour
$options = array(
"AllClosed" => $lng->txt("cont_all_closed"),
"FirstOpen" => $lng->txt("cont_first_open"),
"ForceAllOpen" => $lng->txt("cont_force_all_open"),
);
$si = new ilSelectInputGUI($this->lng->txt("cont_behavior"), "behavior");
$si->setOptions($options);
$this->form->addItem($si);
// alignment
$align_opts = array("Left" => $lng->txt("cont_left"),
"Right" => $lng->txt("cont_right"), "Center" => $lng->txt("cont_center"),
"LeftFloat" => $lng->txt("cont_left_float"),
"RightFloat" => $lng->txt("cont_right_float"));
$align = new ilSelectInputGUI($this->lng->txt("cont_align"), "align");
$align->setOptions($align_opts);
$align->setValue("Center");
$align->setInfo($lng->txt("cont_tabs_hor_align_info"));
$this->form->addItem($align);
// save/cancel buttons
if ($a_mode == "create")
{
$this->form->addCommandButton("create_section", $lng->txt("save"));
$this->form->addCommandButton("cancelCreate", $lng->txt("cancel"));
}
else
{
$this->form->addCommandButton("update", $lng->txt("save"));
$this->form->addCommandButton("cancelUpdate", $lng->txt("cancel"));
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPCTabsGUI::insert (   $a_omit_form_init = false)

Insert new tabs.

Definition at line 52 of file class.ilPCTabsGUI.php.

References ilPageContentGUI\$tpl, ilPageContentGUI\displayValidationError(), and initForm().

Referenced by create().

{
global $tpl;
if (!$a_omit_form_init)
{
$this->initForm("create");
}
$html = $this->form->getHTML();
$tpl->setContent($html);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPCTabsGUI::saveTabs ( )

Save tabs properties in db and return to page edit screen.

Definition at line 374 of file class.ilPCTabsGUI.php.

References $_POST, $ilCtrl, ilPageContentGUI\$lng, ilUtil\sendSuccess(), and ilUtil\stripSlashesArray().

{
global $ilCtrl, $lng;
if (is_array($_POST["caption"]))
{
$captions = ilUtil::stripSlashesArray($_POST["caption"]);
$this->content_obj->saveCaptions($captions);
}
if (is_array($_POST["position"]))
{
$positions = ilUtil::stripSlashesArray($_POST["position"]);
$this->content_obj->savePositions($positions);
}
$this->updated = $this->pg_obj->update();
ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
$ilCtrl->redirect($this, "edit");
}

+ Here is the call graph for this function:

ilPCTabsGUI::setTabs ( )

Set tabs.

Definition at line 474 of file class.ilPCTabsGUI.php.

References $ilCtrl, and ilPageContentGUI\$lng.

Referenced by confirmTabsDeletion(), edit(), and editProperties().

{
global $ilTabs, $ilCtrl, $lng;
$ilTabs->setBackTarget($lng->txt("pg"),
$this->ctrl->getParentReturn($this));
$ilTabs->addTarget("cont_tabs",
$ilCtrl->getLinkTarget($this, "edit"), "edit",
get_class($this));
$ilTabs->addTarget("cont_edit_tabs",
$ilCtrl->getLinkTarget($this, "editProperties"), "editProperties",
get_class($this));
}

+ Here is the caller graph for this function:

ilPCTabsGUI::update ( )

Save tabs properties in db and return to page edit screen.

Definition at line 315 of file class.ilPCTabsGUI.php.

References $_POST, $t, ilPCTabs\ACCORDION_HOR, ilPCTabs\ACCORDION_VER, editProperties(), initForm(), and ilUtil\stripSlashes().

{
$this->initForm();
if ($this->form->checkInput())
{
$this->content_obj->setTabType(ilUtil::stripSlashes($_POST["type"]));
$this->content_obj->setContentWidth($_POST["content_width"]);
$this->content_obj->setContentHeight($_POST["content_height"]);
$this->content_obj->setHorizontalAlign($_POST["align"]);
$this->content_obj->setTemplate("");
$this->content_obj->setBehavior($_POST["behavior"]);
{
$t = explode(":", $_POST["vaccord_templ"]);
$this->content_obj->setTemplate($t[2]);
}
{
$t = explode(":", $_POST["haccord_templ"]);
$this->content_obj->setTemplate($t[2]);
}
}
$this->updated = $this->pg_obj->update();
if ($this->updated === true)
{
$this->ctrl->returnToParent($this, "jump".$this->hier_id);
}
else
{
$this->pg_obj->addHierIDs();
$this->editProperties();
}
}

+ Here is the call graph for this function:


The documentation for this class was generated from the following file: