ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilPCTableGUI Class Reference

Class ilPCTableGUI. More...

+ Inheritance diagram for ilPCTableGUI:
+ Collaboration diagram for ilPCTableGUI:

Public Member Functions

 ilPCTableGUI (&$a_pg_obj, &$a_content_obj, $a_hier_id, $a_pc_id="")
 Constructor public.
 setBasicTableCellStyles ()
 Set basic table cell styles.
executeCommand ()
 execute command
 setTabs ()
 Set tabs.
 setCellPropertiesSubTabs ()
 Set tabs.
 getTemplateOptions ()
 Get table templates.
 edit ()
 edit properties form
 initPropertiesForm ($a_mode="edit")
 Init properties form.
 getPropertiesFormValues ()
 Get properties form.
 renderTable ($a_mode="table_edit", $a_submode="")
 Render the table.
 editCellStyle ()
 Edit cell styles.
 editCellWidth ()
 Edit cell widths.
 editCellSpan ()
 Edit cell spans.
 setStyles ()
 Set cell styles and.
 setWidths ()
 Set cell widths.
 setSpans ()
 Set cell spans.
 setProperties ()
 Set properties from input form.
 saveProperties ()
 save table properties in db and return to page edit screen
 rightAlign ()
 align table to right
 leftAlign ()
 align table to left
 centerAlign ()
 align table to left
 leftFloatAlign ()
 align table to left float
 rightFloatAlign ()
 align table to left
 insert ()
 insert new table form
 getNewTableObject ()
 Get new table object.
 create ()
 create new table in dom and update page in db
 afterCreation ()
 After creation processing.
 editCellAlignment ()
 Edit cell styles.
 setAlignment ()
 Set cell alignments.
- 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.

Static Public Member Functions

static _renderTable ($content, $a_mode="table_edit", $a_submode="", $a_table_obj=null)
 Static render table function.
static _addStyleCheckboxes ($a_output, $a_table)
 Add style checkboxes in edit mode.
static _addAlignmentCheckboxes ($a_output, $a_table)
 Add alignment checkboxes in edit mode.
static _addWidthInputs ($a_output, $a_table)
 Add width inputs.
static _addSpanInputs ($a_output, $a_table)
 Add span inputs.
- Static Public Member Functions inherited from ilPageContentGUI
static _getCommonBBButtons ()
 Get common bb buttons.

Additional Inherited Members

- 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 ilPCTableGUI.

User Interface for Table Editing

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.ilPCTableGUI.php.

Member Function Documentation

static ilPCTableGUI::_addAlignmentCheckboxes (   $a_output,
  $a_table 
)
static

Add alignment checkboxes in edit mode.

Definition at line 506 of file class.ilPCTableGUI.php.

References ilPageContentGUI\$lng.

Referenced by _renderTable().

{
global $lng;
$classes = $a_table->getAllCellAlignments();
foreach ($classes as $k => $v)
{
if ($v == "")
{
$v = $lng->txt("default");
}
$check = $lng->txt("cont_alignment").": ".
'<input type="checkbox" value="1"'.
' name="target['.$k.']">'.'</input> '.$v;
$a_output = str_replace("{{{{{TableEdit;".$k."}}}}}", $check, $a_output);
}
return $a_output;
}

+ Here is the caller graph for this function:

static ilPCTableGUI::_addSpanInputs (   $a_output,
  $a_table 
)
static

Add span inputs.

Definition at line 550 of file class.ilPCTableGUI.php.

References ilPageContentGUI\$lng.

Referenced by _renderTable().

{
global $lng;
$spans = $a_table->getAllCellSpans();
foreach ($spans as $k => $v)
{
// colspans
$selects = '<div style="white-space:nowrap;">'.$lng->txt("cont_colspan").": ".
'<select class="small" name="colspan['.$k.']">';
for ($i = 1; $i <= $v["max_x"] - $v["x"] + 1; $i++)
{
$sel_str = ($i == $v["colspan"])
? 'selected="selected"'
: '';
$selects.= '<option value="'.$i.'" '.$sel_str.'>'.$i.'</option>';
}
$selects.= "</select></div>";
// rowspans
$selects.= '<div style="margin-top:3px; white-space:nowrap;">'.$lng->txt("cont_rowspan").": ".
'<select class="small" name="rowspan['.$k.']">';
for ($i = 1; $i <= $v["max_y"] - $v["y"] + 1; $i++)
{
$sel_str = ($i == $v["rowspan"])
? 'selected="selected"'
: '';
$selects.= '<option value="'.$i.'" '.$sel_str.'>'.$i.'</option>';
}
$selects.= "</select></div>";
$a_output = str_replace("{{{{{TableEdit;".$k."}}}}}", $selects, $a_output);
}
return $a_output;
}

+ Here is the caller graph for this function:

static ilPCTableGUI::_addStyleCheckboxes (   $a_output,
  $a_table 
)
static

Add style checkboxes in edit mode.

Definition at line 478 of file class.ilPCTableGUI.php.

References ilPageContentGUI\$lng.

Referenced by _renderTable().

{
global $lng;
$classes = $a_table->getAllCellClasses();
foreach ($classes as $k => $v)
{
if ($v == "")
{
$v = $lng->txt("none");
}
if (substr($v, 0, 4) == "ilc_")
{
$v = substr($v, 4);
}
$check = $lng->txt("cont_style").": ".
'<input type="checkbox" value="1"'.
' name="target['.$k.']">'.'</input> '.$v;
$a_output = str_replace("{{{{{TableEdit;".$k."}}}}}", $check, $a_output);
}
return $a_output;
}

+ Here is the caller graph for this function:

static ilPCTableGUI::_addWidthInputs (   $a_output,
  $a_table 
)
static

Add width inputs.

Definition at line 530 of file class.ilPCTableGUI.php.

References ilPageContentGUI\$lng.

Referenced by _renderTable().

{
global $lng;
$widths = $a_table->getAllCellWidths();
foreach ($widths as $k => $v)
{
$check = $lng->txt("cont_width").": ".
'<input class="small" type="text" size="5" maxlength="10"'.
' name="width['.$k.']" value="'.$v.'">'.'</input>';
$a_output = str_replace("{{{{{TableEdit;".$k."}}}}}", $check, $a_output);
}
return $a_output;
}

+ Here is the caller graph for this function:

static ilPCTableGUI::_renderTable (   $content,
  $a_mode = "table_edit",
  $a_submode = "",
  $a_table_obj = null 
)
static

Static render table function.

Definition at line 421 of file class.ilPCTableGUI.php.

References $ilUser, _addAlignmentCheckboxes(), _addSpanInputs(), _addStyleCheckboxes(), _addWidthInputs(), ilUtil\getImagePath(), ilUtil\getWebspaceDir(), xslt_create(), xslt_error(), xslt_free(), and xslt_process().

Referenced by ilObjStyleSheetGUI\_getTemplatePreview(), and renderTable().

{
global $ilUser;
$content = "<dummy>".$content."</dummy>";
$xsl = file_get_contents("./Services/COPage/xsl/page.xsl");
$args = array( '/_xml' => $content, '/_xsl' => $xsl );
$xh = xslt_create();
//echo "<b>XML</b>:".htmlentities($content).":<br>";
//echo "<b>XSLT</b>:".htmlentities($xsl).":<br>";
$med_disabled_path = ilUtil::getImagePath("media_disabled.png");
$wb_path = ilUtil::getWebspaceDir("output");
$enlarge_path = ilUtil::getImagePath("enlarge.png");
$params = array ('mode' => $a_mode,
'med_disabled_path' => $med_disabled_path,
'media_mode' => $ilUser->getPref("ilPageEditor_MediaMode"),
'media_mode' => 'disable',
'webspace_path' => $wb_path, 'enlarge_path' => $enlarge_path);
$output = xslt_process($xh,"arg:/_xml","arg:/_xsl",NULL,$args, $params);
echo xslt_error($xh);
xslt_free($xh);
// unmask user html
$output = str_replace("&lt;","<",$output);
$output = str_replace("&gt;",">",$output);
$output = str_replace("&amp;","&",$output);
if ($a_mode == "table_edit" && !is_null($a_table_obj))
{
switch ($a_submode)
{
case "style":
$output = ilPCTableGUI::_addStyleCheckboxes($output, $a_table_obj);
break;
case "alignment":
$output = ilPCTableGUI::_addAlignmentCheckboxes($output, $a_table_obj);
break;
case "width":
$output = ilPCTableGUI::_addWidthInputs($output, $a_table_obj);
break;
case "span":
$output = ilPCTableGUI::_addSpanInputs($output, $a_table_obj);
break;
}
}
return '<div style="float:left;">'.$output.'</div>';
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPCTableGUI::afterCreation ( )

After creation processing.

Reimplemented in ilPCDataTableGUI.

Definition at line 934 of file class.ilPCTableGUI.php.

Referenced by create().

{
$this->ctrl->returnToParent($this, "jump".$this->hier_id);
}

+ Here is the caller graph for this function:

ilPCTableGUI::centerAlign ( )

align table to left

Definition at line 825 of file class.ilPCTableGUI.php.

References $_SESSION.

{
$this->content_obj->setHorizontalAlign("Center");
$_SESSION["il_pg_error"] = $this->pg_obj->update();
$this->ctrl->returnToParent($this, "jump".$this->hier_id);
}
ilPCTableGUI::create ( )

create new table in dom and update page in db

Definition at line 877 of file class.ilPCTableGUI.php.

References $_POST, ilPageContentGUI\$lng, afterCreation(), getNewTableObject(), insert(), setProperties(), and ilUtil\stripSlashes().

{
global $lng;
$this->content_obj = $this->getNewTableObject();
$this->content_obj->create($this->pg_obj, $this->hier_id, $this->pc_id);
$import_table = trim($_POST["import_table"]);
// import xhtml or spreadsheet table
if (!empty ($import_table))
{
switch($_POST["import_type"])
{
// xhtml import
case "html":
if (!$this->content_obj->importHtml ($_POST["language"], $import_table))
{
$this->insert();
return;
}
break;
// spreadsheet
case "spreadsheet":
$this->content_obj->importSpreadsheet($_POST["language"], $import_table);
break;
}
}
else
{
$this->content_obj->addRows(ilUtil::stripSlashes($_POST["nr_rows"]),
}
$this->setProperties();
$frtype = ilUtil::stripSlashes($_POST["first_row_style"]);
if ($frtype != "")
{
$this->content_obj->setFirstRowStyle($frtype);
}
$this->updated = $this->pg_obj->update();
if ($this->updated === true)
{
$this->afterCreation();
}
else
{
$this->insert();
}
}

+ Here is the call graph for this function:

ilPCTableGUI::edit ( )

edit properties form

Definition at line 120 of file class.ilPCTableGUI.php.

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

Referenced by saveProperties().

{
global $ilCtrl, $lng, $tpl;
$this->setTabs();
$html = $this->form->getHTML();
$html.= "<br />".$this->renderTable("");
$tpl->setContent($html);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPCTableGUI::editCellAlignment ( )

Edit cell styles.

Definition at line 947 of file class.ilPCTableGUI.php.

References $ilCtrl, ilPageContentGUI\$lng, $si, ilPageContentGUI\$tpl, ilPageContentGUI\displayValidationError(), setCellPropertiesSubTabs(), ilSelectInputGUI\setOptions(), and setTabs().

{
global $ilCtrl, $tpl, $lng, $ilTabs;
$this->setTabs();
$ilTabs->setSubTabActive("cont_alignment");
$ilTabs->setTabActive("cont_table_cell_properties");
// edit form
include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
$form = new ilPropertyFormGUI();
$form->setFormAction($ilCtrl->getFormAction($this));
$form->setTitle($this->lng->txt("cont_table_cell_properties"));
// alignment
$options = array(
"" => $lng->txt("default"),
"Left" => $lng->txt("cont_left"),
"Center" => $lng->txt("cont_center"),
"Right" => $lng->txt("cont_right")
);
$si = new ilSelectInputGUI($lng->txt("cont_alignment"), "alignment");
$si->setOptions($options);
$si->setInfo($lng->txt(""));
$form->addItem($si);
$form->setKeepOpen(true);
$form->addCommandButton("setAlignment", $lng->txt("cont_set_alignment"));
$html = $form->getHTML();
$html.= "<br />".$this->renderTable("table_edit", "alignment")."</form>";
$tpl->setContent($html);
}

+ Here is the call graph for this function:

ilPCTableGUI::editCellSpan ( )

Edit cell spans.

Definition at line 660 of file class.ilPCTableGUI.php.

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

{
global $ilCtrl, $tpl, $lng, $ilTabs;
$this->setTabs();
$ilTabs->setSubTabActive("cont_span");
$ilTabs->setTabActive("cont_table_cell_properties");
$ctpl = new ilTemplate("tpl.table_cell_properties.html", true, true, "Services/COPage");
$ctpl->setVariable("BTN_NAME", "setSpans");
$ctpl->setVariable("BTN_TEXT", $lng->txt("cont_save_spans"));
$ctpl->setVariable("FORMACTION", $ilCtrl->getFormAction($this));
$html = $ctpl->get();
$html.= "<br />".$this->renderTable("table_edit", "span")."</form>";
$tpl->setContent($html);
}

+ Here is the call graph for this function:

ilPCTableGUI::editCellStyle ( )

Edit cell styles.

Definition at line 590 of file class.ilPCTableGUI.php.

References $ilCtrl, ilPageContentGUI\$lng, ilPageContentGUI\$tpl, ilPageContentGUI\displayValidationError(), ilPageContentGUI\getCharacteristics(), ilPageContentGUI\getCharacteristicsOfCurrentStyle(), setBasicTableCellStyles(), setCellPropertiesSubTabs(), and setTabs().

{
global $ilCtrl, $tpl, $lng, $ilTabs;
$this->setTabs();
$ilTabs->setSubTabActive("cont_style");
// edit form
include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
$form = new ilPropertyFormGUI();
$form->setFormAction($ilCtrl->getFormAction($this));
$form->setTitle($this->lng->txt("cont_table_cell_properties"));
// first row style
require_once("./Services/Form/classes/class.ilAdvSelectInputGUI.php");
$style = new ilAdvSelectInputGUI($this->lng->txt("cont_style"),
"style");
$this->getCharacteristicsOfCurrentStyle("table_cell"); // scorm-2004
$chars = $this->getCharacteristics(); // scorm-2004
$options = array_merge(array("" => $this->lng->txt("none")), $chars); // scorm-2004
foreach($options as $k => $option)
{
$html = '<table border="0" cellspacing="0" cellpadding="0"><tr><td class="ilc_table_cell_'.$k.'">'.
$option.'</td></tr></table>';
$style->addOption($k, $option, $html);
}
$style->setValue("");
$style->setInfo($lng->txt("cont_set_tab_style_info"));
$form->addItem($style);
$form->setKeepOpen(true);
$form->addCommandButton("setStyles", $lng->txt("cont_set_styles"));
$html = $form->getHTML();
$html.= "<br />".$this->renderTable("table_edit", "style")."</form>";
$tpl->setContent($html);
}

+ Here is the call graph for this function:

ilPCTableGUI::editCellWidth ( )

Edit cell widths.

Definition at line 636 of file class.ilPCTableGUI.php.

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

{
global $ilCtrl, $tpl, $lng, $ilTabs;
$this->setTabs();
$ilTabs->setSubTabActive("cont_width");
$ilTabs->setTabActive("cont_table_cell_properties");
$ctpl = new ilTemplate("tpl.table_cell_properties.html", true, true, "Services/COPage");
$ctpl->setVariable("BTN_NAME", "setWidths");
$ctpl->setVariable("BTN_TEXT", $lng->txt("cont_save_widths"));
$ctpl->setVariable("FORMACTION", $ilCtrl->getFormAction($this));
$html = $ctpl->get();
$html.= "<br />".$this->renderTable("table_edit", "width")."</form>";
$tpl->setContent($html);
}

+ Here is the call graph for this function:

& ilPCTableGUI::executeCommand ( )

execute command

Reimplemented in ilPCDataTableGUI.

Definition at line 43 of file class.ilPCTableGUI.php.

References $cmd, $ret, and ilPageContentGUI\getCharacteristicsOfCurrentStyle().

{
$this->getCharacteristicsOfCurrentStyle("table"); // scorm-2004
// 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;
}

+ Here is the call graph for this function:

ilPCTableGUI::getNewTableObject ( )

Get new table object.

Reimplemented in ilPCDataTableGUI.

Definition at line 869 of file class.ilPCTableGUI.php.

Referenced by create().

{
return new ilPCTable($this->dom);
}

+ Here is the caller graph for this function:

ilPCTableGUI::getPropertiesFormValues ( )

Get properties form.

Definition at line 360 of file class.ilPCTableGUI.php.

References ilObjStyleSheet\_lookupTemplateIdByName(), and ilPageContentGUI\getStyleId().

Referenced by edit().

{
$values = array();
$values["width"] = $this->content_obj->getWidth();
$values["border"] = $this->content_obj->getBorder();
$values["padding"] = $this->content_obj->getCellPadding();
$values["spacing"] = $this->content_obj->getCellSpacing();
$values["row_header"] = $this->content_obj->getHeaderRows();
$values["row_footer"] = $this->content_obj->getFooterRows();
$values["col_header"] = $this->content_obj->getHeaderCols();
$values["col_footer"] = $this->content_obj->getFooterCols();
if ($this->content_obj->getTemplate() != "")
{
$values["characteristic"] = "t:".
ilObjStyleSheet::_lookupTemplateIdByName($this->getStyleId(), $this->content_obj->getTemplate()).":".
$this->content_obj->getTemplate();
}
else
{
$values["characteristic"] = $this->content_obj->getClass();
}
$values["align"] = $this->content_obj->getHorizontalAlign();
$values["caption"] = $this->content_obj->getCaption();
$values["cap_align"] = $this->content_obj->getCaptionAlign();
$values["language"] = $this->content_obj->getLanguage();
$this->form->setValuesByArray($values);
$ca = $this->form->getItemByPostVar("cap_align");
$ca->setValue($this->content_obj->getCaptionAlign());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPCTableGUI::getTemplateOptions ( )

Get table templates.

Definition at line 112 of file class.ilPCTableGUI.php.

Referenced by initPropertiesForm().

{
return parent::getTemplateOptions("table");
}

+ Here is the caller graph for this function:

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

Constructor public.

Definition at line 24 of file class.ilPCTableGUI.php.

References ilPageContentGUI\ilPageContentGUI(), and ilPageContentGUI\setCharacteristics().

{
parent::ilPageContentGUI($a_pg_obj, $a_content_obj, $a_hier_id, $a_pc_id);
$this->setCharacteristics(array("StandardTable" => $this->lng->txt("cont_StandardTable")));
}

+ Here is the call graph for this function:

ilPCTableGUI::initPropertiesForm (   $a_mode = "edit")

Init properties form.

Definition at line 137 of file class.ilPCTableGUI.php.

References $_GET, $_SESSION, $ilCtrl, $ilUser, $lang, ilPageContentGUI\$lng, $t, ilPageContentGUI\$tpl, ilMDLanguageItem\_getLanguages(), ilRadioOption\addSubItem(), ilPageContentGUI\getCharacteristics(), ilPageContentGUI\getCharacteristicsOfCurrentStyle(), getTemplateOptions(), setBasicTableCellStyles(), ilSelectInputGUI\setOptions(), ilTextInputGUI\setSize(), and ilTextInputGUI\setValue().

Referenced by edit(), and insert().

{
global $ilCtrl, $lng, $tpl, $ilUser;
include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
$this->form = new ilPropertyFormGUI();
$this->form->setFormAction($ilCtrl->getFormAction($this));
if ($a_mode == "create")
{
$this->form->setTitle($this->lng->txt("cont_insert_table"));
}
else
{
$this->form->setTitle($this->lng->txt("cont_table_properties"));
}
if ($a_mode == "create")
{
$nr = array();
for($i=1; $i<=20; $i++)
{
$nr[$i] = $i;
}
// cols
$cols = new ilSelectInputGUI($this->lng->txt("cont_nr_cols"), "nr_cols");
$cols->setOptions($nr);
$cols->setValue(2);
$this->form->addItem($cols);
// rows
$rows = new ilSelectInputGUI($this->lng->txt("cont_nr_rows"), "nr_rows");
$rows->setOptions($nr);
$rows->setValue(2);
$this->form->addItem($rows);
}
// width
$width = new ilTextInputGUI($this->lng->txt("cont_table_width"), "width");
$width->setSize(6);
$width->setMaxLength(6);
$this->form->addItem($width);
// border
$border = new ilTextInputGUI($this->lng->txt("cont_table_border"), "border");
$border->setValue("1px");
$border->setSize(6);
$border->setMaxLength(6);
$this->form->addItem($border);
// padding
$padding = new ilTextInputGUI($this->lng->txt("cont_table_cellpadding"), "padding");
$padding->setValue("2px");
$padding->setSize(6);
$padding->setMaxLength(6);
$this->form->addItem($padding);
// spacing (deprecated, only hidden)
$spacing = new ilHiddenInputGUI("spacing");
$spacing->setValue("0px");
$this->form->addItem($spacing);
/*$spacing = new ilTextInputGUI($this->lng->txt("cont_table_cellspacing"), "spacing");
$spacing->setValue("0px");
$spacing->setSize(6);
$spacing->setMaxLength(6);
$this->form->addItem($spacing);*/
// table templates and table classes
require_once("./Services/Form/classes/class.ilAdvSelectInputGUI.php");
$char_prop = new ilAdvSelectInputGUI($this->lng->txt("cont_characteristic"),
"characteristic");
$chars = $this->getCharacteristics();
$templates = $this->getTemplateOptions();
$chars = array_merge($templates, $chars);
if (is_object($this->content_obj))
{
if ($chars[$a_seleted_value] == "" && ($this->content_obj->getClass() != ""))
{
$chars = array_merge(
array($this->content_obj->getClass() => $this->content_obj->getClass()),
$chars);
}
}
foreach($chars as $k => $char)
{
if (strpos($k, ":") > 0)
{
$t = explode(":", $k);
$html = $this->style->lookupTemplatePreview($t[1]).'<div style="clear:both;" class="small">'.$char."</div>";
}
else
{
$html = '<table class="ilc_table_'.$k.'"><tr><td class="small">'.
$char.'</td></tr></table>';
}
$char_prop->addOption($k, $char, $html);
}
$char_prop->setValue("StandardTable");
$this->form->addItem($char_prop);
$nr = array();
for($i=0; $i<=3; $i++)
{
$nr[$i] = $i;
}
// row header
$rh = new ilSelectInputGUI($this->lng->txt("cont_nr_row_header"), "row_header");
$rh->setOptions($nr);
$rh->setValue(1);
$this->form->addItem($rh);
// row footer
$rf = new ilSelectInputGUI($this->lng->txt("cont_nr_row_footer"), "row_footer");
$rf->setOptions($nr);
$rf->setValue(0);
$this->form->addItem($rf);
// col header
$ch = new ilSelectInputGUI($this->lng->txt("cont_nr_col_header"), "col_header");
$ch->setOptions($nr);
$ch->setValue(0);
$this->form->addItem($ch);
// col footer
$cf = new ilSelectInputGUI($this->lng->txt("cont_nr_col_footer"), "col_footer");
$cf->setOptions($nr);
$cf->setValue(0);
$this->form->addItem($cf);
if ($a_mode == "create")
{
// first row style
require_once("./Services/Form/classes/class.ilAdvSelectInputGUI.php");
$fr_style = new ilAdvSelectInputGUI($this->lng->txt("cont_first_row_style"),
"first_row_style");
$this->getCharacteristicsOfCurrentStyle("table_cell");
$chars = $this->getCharacteristics();
$options = array_merge(array("" => $this->lng->txt("none")), $chars);
foreach($options as $k => $option)
{
$html = '<table border="0" cellspacing="0" cellpadding="0"><tr><td class="ilc_table_cell_'.$k.'">'.
$option.'</td></tr></table>';
$fr_style->addOption($k, $option, $html);
}
$fr_style->setValue("");
$this->form->addItem($fr_style);
}
// 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");
$this->form->addItem($align);
// caption
$caption = new ilTextInputGUI($this->lng->txt("cont_caption"), "caption");
$caption->setSize(60);
$this->form->addItem($caption);
// caption align
$ca_opts = array("top" => $lng->txt("cont_top"),
"bottom" => $lng->txt("cont_bottom"));
$ca = new ilSelectInputGUI($this->lng->txt("cont_align"),
"cap_align");
$ca->setOptions($ca_opts);
$caption->addSubItem($ca);
// import
if ($a_mode == "create")
{
// import table
$import = new ilRadioGroupInputGUI($this->lng->txt("cont_paste_table"), "import_type");
$op = new ilRadioOption($this->lng->txt("cont_html_table"), "html");
$import->addOption($op);
$op2 = new ilRadioOption($this->lng->txt("cont_spreadsheet_table"), "spreadsheet");
$import_data = new ilTextAreaInputGUI("", "import_table");
$import_data->setRows(8);
$import_data->setCols(50);
$op2->addSubItem($import_data);
$import->addOption($op2);
$import->setValue("html");
$this->form->addItem($import);
}
// language
if ($_SESSION["il_text_lang_".$_GET["ref_id"]] != "")
{
$s_lang = $_SESSION["il_text_lang_".$_GET["ref_id"]];
}
else
{
$s_lang = $ilUser->getLanguage();
}
require_once("Services/MetaData/classes/class.ilMDLanguageItem.php");
$language = new ilSelectInputGUI($this->lng->txt("language"), "language");
$language->setOptions($lang);
$language->setValue($s_lang);
$this->form->addItem($language);
if ($a_mode == "create")
{
$this->form->addCommandButton("create_tab", $lng->txt("save"));
$this->form->addCommandButton("cancelCreate", $lng->txt("cancel"));
}
else
{
$this->form->addCommandButton("saveProperties", $lng->txt("save"));
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPCTableGUI::insert ( )

insert new table form

Definition at line 855 of file class.ilPCTableGUI.php.

References $ilCtrl, $ilUser, ilPageContentGUI\$lng, ilPageContentGUI\$tpl, ilPageContentGUI\displayValidationError(), and initPropertiesForm().

Referenced by create().

{
global $ilUser, $ilCtrl, $tpl, $lng;
$this->initPropertiesForm("create");
$html = $this->form->getHTML();
$tpl->setContent($html);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPCTableGUI::leftAlign ( )

align table to left

Definition at line 815 of file class.ilPCTableGUI.php.

References $_SESSION.

{
$this->content_obj->setHorizontalAlign("Left");
$_SESSION["il_pg_error"] = $this->pg_obj->update();
$this->ctrl->returnToParent($this, "jump".$this->hier_id);
}
ilPCTableGUI::leftFloatAlign ( )

align table to left float

Definition at line 835 of file class.ilPCTableGUI.php.

References $_SESSION.

{
$this->content_obj->setHorizontalAlign("LeftFloat");
$_SESSION["il_pg_error"] = $this->pg_obj->update();
$this->ctrl->returnToParent($this, "jump".$this->hier_id);
}
ilPCTableGUI::renderTable (   $a_mode = "table_edit",
  $a_submode = "" 
)

Render the table.

Definition at line 395 of file class.ilPCTableGUI.php.

References $mobs, ilObject\_lookupType(), _renderTable(), and ilPageContentGUI\getStyleId().

{
$tab_node = $this->content_obj->getNode();
$tab_node->set_attribute("Enabled", "True");
$content = $this->dom->dump_node($tab_node);
$trans = $this->pg_obj->getLanguageVariablesXML();
$mobs = $this->pg_obj->getMultimediaXML();
if ($this->getStyleId() > 0)
{
if (ilObject::_lookupType($this->getStyleId()) == "sty")
{
include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
$style = new ilObjStyleSheet($this->getStyleId());
$template_xml = $style->getTemplateXML();
}
}
$content = $content.$mobs.$trans.$template_xml;
return ilPCTableGUI::_renderTable($content, $a_mode, $a_submode, $this->content_obj);
}

+ Here is the call graph for this function:

ilPCTableGUI::rightAlign ( )

align table to right

Definition at line 805 of file class.ilPCTableGUI.php.

References $_SESSION.

{
$this->content_obj->setHorizontalAlign("Right");
$_SESSION["il_pg_error"] = $this->pg_obj->update();
$this->ctrl->returnToParent($this, "jump".$this->hier_id);
}
ilPCTableGUI::rightFloatAlign ( )

align table to left

Definition at line 845 of file class.ilPCTableGUI.php.

References $_SESSION.

{
$this->content_obj->setHorizontalAlign("RightFloat");
$_SESSION["il_pg_error"] = $this->pg_obj->update();
$this->ctrl->returnToParent($this, "jump".$this->hier_id);
}
ilPCTableGUI::saveProperties ( )

save table properties in db and return to page edit screen

Definition at line 786 of file class.ilPCTableGUI.php.

References edit(), and setProperties().

{
$this->setProperties();
$this->updated = $this->pg_obj->update();
if ($this->updated === true)
{
$this->ctrl->redirect($this, "edit");
//$this->ctrl->returnToParent($this, "jump".$this->hier_id);
}
else
{
$this->pg_obj->addHierIDs();
$this->edit();
}
}

+ Here is the call graph for this function:

ilPCTableGUI::setAlignment ( )

Set cell alignments.

Definition at line 988 of file class.ilPCTableGUI.php.

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

{
global $lng;
if (is_array($_POST["target"]))
{
foreach ($_POST["target"] as $k => $value)
{
if ($value > 0)
{
$cid = explode(":", $k);
$this->content_obj->setTDAlignment(ilUtil::stripSlashes($cid[0]),
}
}
}
$this->updated = $this->pg_obj->update();
ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
$this->ctrl->redirect($this, "editCellAlignment");
}

+ Here is the call graph for this function:

ilPCTableGUI::setBasicTableCellStyles ( )

Set basic table cell styles.

Definition at line 34 of file class.ilPCTableGUI.php.

References ilPageContentGUI\setCharacteristics().

Referenced by editCellStyle(), and initPropertiesForm().

{
$this->setCharacteristics(array("Cell1" => "Cell1", "Cell2" => "Cell2",
"Cell3" => "Cell3", "Cell4" => "Cell4"));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPCTableGUI::setCellPropertiesSubTabs ( )

Set tabs.

Definition at line 87 of file class.ilPCTableGUI.php.

References $ilCtrl, and ilPageContentGUI\$lng.

Referenced by editCellAlignment(), editCellSpan(), editCellStyle(), and editCellWidth().

{
global $ilTabs, $ilCtrl, $lng;
$ilTabs->addSubTabTarget("cont_style",
$ilCtrl->getLinkTarget($this, "editCellStyle"), "editCellStyle",
get_class($this));
$ilTabs->addSubTabTarget("cont_width",
$ilCtrl->getLinkTarget($this, "editCellWidth"), "editCellWidth",
get_class($this));
$ilTabs->addSubTabTarget("cont_alignment",
$ilCtrl->getLinkTarget($this, "editCellAlignment"), "editCellAlignment",
get_class($this));
$ilTabs->addSubTabTarget("cont_span",
$ilCtrl->getLinkTarget($this, "editCellSpan"), "editCellSpan",
get_class($this));
}

+ Here is the caller graph for this function:

ilPCTableGUI::setProperties ( )

Set properties from input form.

Definition at line 750 of file class.ilPCTableGUI.php.

References $_POST, $t, and ilUtil\stripSlashes().

Referenced by create(), and saveProperties().

{
// mask html
$caption = ilUtil::stripSlashes($_POST["caption"]);
$caption = str_replace("&","&amp;", $caption);
$caption = str_replace("<","&lt;", $caption);
$caption = str_replace(">","&gt;", $caption);
$this->content_obj->setLanguage(ilUtil::stripSlashes($_POST["language"]));
$this->content_obj->setWidth(ilUtil::stripSlashes($_POST["width"]));
$this->content_obj->setBorder(ilUtil::stripSlashes($_POST["border"]));
$this->content_obj->setCellSpacing(ilUtil::stripSlashes($_POST["spacing"]));
$this->content_obj->setCellPadding(ilUtil::stripSlashes($_POST["padding"]));
$this->content_obj->setHorizontalAlign(ilUtil::stripSlashes($_POST["align"]));
$this->content_obj->setHeaderRows(ilUtil::stripSlashes($_POST["row_header"]));
$this->content_obj->setHeaderCols(ilUtil::stripSlashes($_POST["col_header"]));
$this->content_obj->setFooterRows(ilUtil::stripSlashes($_POST["row_footer"]));
$this->content_obj->setFooterCols(ilUtil::stripSlashes($_POST["col_footer"]));
if (strpos($_POST["characteristic"], ":") > 0)
{
$t = explode(":", $_POST["characteristic"]);
$this->content_obj->setTemplate(ilUtil::stripSlashes($t[2]));
$this->content_obj->setClass("");
}
else
{
$this->content_obj->setClass(ilUtil::stripSlashes($_POST["characteristic"]));
$this->content_obj->setTemplate("");
}
$this->content_obj->setCaption($caption,
ilUtil::stripSlashes($_POST["cap_align"]));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPCTableGUI::setSpans ( )

Set cell spans.

Definition at line 729 of file class.ilPCTableGUI.php.

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

{
global $lng;
if (is_array($_POST["colspan"]))
{
foreach ($_POST["colspan"] as $k => $span)
{
$_POST["colspan"][$k] = ilUtil::stripSlashes($span);
$_POST["rowspan"][$k] = ilUtil::stripSlashes($_POST["rowspan"][$k]);
}
$this->content_obj->setTDSpans($_POST["colspan"], $_POST["rowspan"]);
}
$this->updated = $this->pg_obj->update();
ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
$this->ctrl->redirect($this, "editCellSpan");
}

+ Here is the call graph for this function:

ilPCTableGUI::setStyles ( )

Set cell styles and.

Definition at line 684 of file class.ilPCTableGUI.php.

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

{
global $lng;
if (is_array($_POST["target"]))
{
foreach ($_POST["target"] as $k => $value)
{
if ($value > 0)
{
$cid = explode(":", $k);
$this->content_obj->setTDClass(ilUtil::stripSlashes($cid[0]),
}
}
}
$this->updated = $this->pg_obj->update();
ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
$this->ctrl->redirect($this, "editCellStyle");
}

+ Here is the call graph for this function:

ilPCTableGUI::setTabs ( )

Set tabs.

Reimplemented in ilPCDataTableGUI.

Definition at line 67 of file class.ilPCTableGUI.php.

References $ilCtrl, and ilPageContentGUI\$lng.

Referenced by edit(), editCellAlignment(), editCellSpan(), editCellStyle(), and editCellWidth().

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

+ Here is the caller graph for this function:

ilPCTableGUI::setWidths ( )

Set cell widths.

Definition at line 708 of file class.ilPCTableGUI.php.

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

{
global $lng;
if (is_array($_POST["width"]))
{
foreach ($_POST["width"] as $k => $width)
{
$cid = explode(":", $k);
$this->content_obj->setTDWidth(ilUtil::stripSlashes($cid[0]),
}
}
$this->updated = $this->pg_obj->update();
ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
$this->ctrl->redirect($this, "editCellWidth");
}

+ Here is the call graph for this function:


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