ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilTable2GUI Class Reference

Class ilTable2GUI. More...

+ Inheritance diagram for ilTable2GUI:
+ Collaboration diagram for ilTable2GUI:

Public Member Functions

 __construct ($a_parent_obj, $a_parent_cmd="")
 Constructor.
 getParentObject ()
 Get parent object.
 getParentCmd ()
 Get parent command.
 setNoEntriesText ($a_text)
 Set text for an empty table.
 getNoEntriesText ()
 Get text for an empty table.
 setEnableTitle ($a_enabletitle)
 Set Enable Title.
 getEnableTitle ()
 Get Enable Title.
 setEnableHeader ($a_enableheader)
 Set Enable Header.
 getEnableHeader ()
 Get Enable Header.
 setTitle ($a_title, $a_icon=0, $a_icon_alt=0)
 set table title public
 setOrderField ($a_order_field)
 set order column
 getOrderField ()
 setData ($a_data)
 set table data public
 getData ()
 dataExists ()
 setPrefix ($a_prefix)
 set prefix for sort and offset fields (if you have two or more tables on a page that you want to sort separately) public
 setFormAction ($a_form_action)
 Set Form action parameter.
 getFormAction ()
 Get Form action parameter.
 setFormName ($a_formname)
 Set Form name.
 getFormName ()
 Get Form name.
 setId ($a_val)
 Set id.
 getId ()
 Get element id.
 getSelectAllCheckbox ()
 Get the name of the checkbox that should be toggled with a select all button.
 setSelectAllCheckbox ($a_select_all_checkbox)
 Set the name of the checkbox that should be toggled with a select all button.
 setRowTemplate ($a_template, $a_template_dir="")
 Set row template.
 setDefaultOrderField ($a_defaultorderfield)
 Set Default order field.
 getDefaultOrderField ()
 Get Default order field.
 setDefaultOrderDirection ($a_defaultorderdirection)
 Set Default order direction.
 getDefaultOrderDirection ()
 Get Default order direction.
 addCommandButton ($a_cmd, $a_text)
 Add Command button.
 setCloseCommand ($a_link)
 Add command for closing table.
 addMultiCommand ($a_cmd, $a_text)
 Add Command button.
 addHeaderCommand ($a_href, $a_text, $a_target="", $a_img="")
 Add Header Command (Link) (Image needed for now)
 addColumn ($a_text, $a_sort_field="", $a_width="")
 Add a column to the header.
 getNavParameter ()
 setOrderLink ($sort_field, $order_dir)
 fillHeader ()
 getHTML ()
 numericOrdering ($a_field)
 Should this field be sorted numeric?
 render ()
 render table public
 fillFooter ()
 Fill footer row.
 getLinkbar ($a_num)
 Get previous/next linkbar.
 fillActionRow ()
 Fill Action Row.
 setHeaderHTML ($html)
 set header html
- Public Member Functions inherited from ilTableGUI
 ilTableGUI ($a_data=0, $a_global_tpl=true)
 Constructor.
 setTemplate (&$a_tpl)
 set template public
getTemplateObject ()
 setHelp ($a_help_page, $a_help_icon, $a_help_icon_alt=0)
 set table help page public
 setHeaderNames ($a_header_names)
 set table header names public
 getColumnCount ()
 Returns the column count based on the number of the header row columns public.
 setHeaderVars ($a_header_vars, $a_header_params=0)
 set table header vars public
 setColumnWidth ($a_column_width)
 set table column widths public
 setOneColumnWidth ($a_column_width, $a_column_number)
 set one table column width public
 setMaxCount ($a_max_count)
 set max.
 setLimit ($a_limit=0, $a_default_limit=0)
 set max.
 getLimit ()
 Get limit.
 setOffset ($a_offset)
 set dataset offset public
 getOffset ()
 Get offset.
 setOrderColumn ($a_order_column=0, $a_default_column=0)
 set order column public
 getOrderColumn ()
 Get order column.
 setOrderDirection ($a_order_direction)
 set order direction public
 getOrderDirection ()
 Get order direction.
 setFooter ($a_style, $a_previous=0, $a_next=0)
 set order direction public
 enable ($a_module_name)
 enables particular modules of table public
 disable ($a_module_name)
 diesables particular modules of table public
 sortData ()
 renderHeader ()
 setStyle ($a_element, $a_style)
 getStyle ($a_element)
 setBase ($a_base)
 Set Base script name (deprecated, only use this for workarounds).
 getBase ()
 Get Base script name (deprecated, only use this for workarounds).
 clearActionButtons ()
 addActionButton ($btn_name, $btn_value)

Protected Member Functions

 fillRow ($a_set)
 Standard Version of Fill Row.

Protected Attributes

 $close_command = ""

Private Attributes

 $unique_id
 $headerHTML

Additional Inherited Members

- Data Fields inherited from ilTableGUI
 $title
 $icon
 $icon_alt
 $help_page
 $help_icon
 $help_icon_alt
 $header_names
 $header_vars
 $linkbar_vars
 $data
 $column_count
 $column_width
 $max_count
 $limit
 $max_limit = false
 $offset
 $order_column
 $order_direction
 $footer_style
 $footer_previous
 $footer_next
 $lang_support = true
 $global_tpl
 $form_name
 $select_all_checkbox
 $action_buttons
 $prefix
 $base = ""
 $enabled
 $styles

Detailed Description

Class ilTable2GUI.

Author
Sascha Hofmann shofm.nosp@m.ann@.nosp@m.datab.nosp@m.ay.d.nosp@m.e
Version
Id:
class.ilTableGUI.php 12818 2006-12-10 13:14:43Z akill

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

Constructor & Destructor Documentation

ilTable2GUI::__construct (   $a_parent_obj,
  $a_parent_cmd = "" 
)

Constructor.

Reimplemented in ilShopPersonalSettingsTopicsTableGUI, ilShopTopicsTableGUI, ilCalendarInboxSharedTableGUI, ilMDCopyrightTableGUI, ilCourseInfoFileTableGUI, ilCourseObjectivesTableGUI, ilSessionFileTableGUI, ilAdvancedMDRecordTableGUI, ilCalendarSharedRoleListTableGUI, ilCalendarSharedUserListTableGUI, ilLDAPRoleAssignmentTableGUI, ilAddressbookTableGUI, ilECSImportedContentTableGUI, ilECSReleasedContentTableGUI, ilAdvancedMDFieldTableGUI, ilAdvancedMDRecordExportFilesTableGUI, ilCalendarAppointmentsTableGUI, ilCalendarChangedAppointmentsTableGUI, ilCalendarSharedListTableGUI, ilCourseObjectiveQuestionsTableGUI, ilClipboardTableGUI, and ilPageHistoryTableGUI.

Definition at line 44 of file class.ilTable2GUI.php.

References $unique_id, and ilTableGUI\setLimit().

Referenced by ilComponentsTableGUI\ilComponentsTableGUI(), ilFoundUsersTableGUI\ilFoundUsersTableGUI(), ilLinksTableGUI\ilLinksTableGUI(), ilMediaCastTableGUI\ilMediaCastTableGUI(), ilNewsForContextTableGUI\ilNewsForContextTableGUI(), ilPDNewsTableGUI\ilPDNewsTableGUI(), ilPluginsTableGUI\ilPluginsTableGUI(), ilSCORM2004TrackingTableGUI\ilSCORM2004TrackingTableGUI(), ilSpecialUsersTableGUI\ilSpecialUsersTableGUI(), ilWikiContributorsTableGUI\ilWikiContributorsTableGUI(), ilWikiPagesTableGUI\ilWikiPagesTableGUI(), ilWikiRecentChangesTableGUI\ilWikiRecentChangesTableGUI(), and ilWikiSearchResultsTableGUI\ilWikiSearchResultsTableGUI().

{
global $ilUser;
$this->unique_id = md5(uniqid());
$this->parent_obj = $a_parent_obj;
$this->parent_cmd = $a_parent_cmd;
$this->buttons = array();
$this->header_commands = array();
$this->multi = array();
$this->formname = "table_" . $this->unique_id;
$this->tpl = new ilTemplate("tpl.table2.html", true, true, "Services/Table");
$this->setLimit($ilUser->getPref("hits_per_page"));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Function Documentation

ilTable2GUI::addColumn (   $a_text,
  $a_sort_field = "",
  $a_width = "" 
)
final

Add a column to the header.

Parameters
stringText
stringSort field name (corresponds to data array field)
stringWidth string

Definition at line 372 of file class.ilTable2GUI.php.

Referenced by ilPageHistoryTableGUI\__construct(), ilClipboardTableGUI\__construct(), ilImageMapTableGUI\__construct(), ilMediaObjectUsagesTableGUI\__construct(), ilCourseObjectiveQuestionsTableGUI\__construct(), ilMediaPoolTableGUI\__construct(), ilCalendarCategoryTableGUI\__construct(), ilGroupEditParticipantsTableGUI\__construct(), ilAdvancedMDFieldTableGUI\__construct(), ilAdvancedMDRecordExportFilesTableGUI\__construct(), ilCalendarAppointmentsTableGUI\__construct(), ilCalendarChangedAppointmentsTableGUI\__construct(), ilCalendarSharedListTableGUI\__construct(), ilGroupParticipantsTableGUI\__construct(), ilCalendarSharedUserListTableGUI\__construct(), ilCalendarSharedRoleListTableGUI\__construct(), ilCourseInfoFileTableGUI\__construct(), ilECSReleasedContentTableGUI\__construct(), ilSubscriberTableGUI\__construct(), ilWaitingListTableGUI\__construct(), ilLDAPRoleAssignmentTableGUI\__construct(), ilCourseObjectivesTableGUI\__construct(), ilECSImportedContentTableGUI\__construct(), ilAdvancedMDRecordTableGUI\__construct(), ilSessionFileTableGUI\__construct(), ilMDCopyrightTableGUI\__construct(), ilCourseParticipantsTableGUI\__construct(), ilCalendarInboxSharedTableGUI\__construct(), ilShopTopicsTableGUI\__construct(), ilECSCommunityTableGUI\__construct(), ilCourseObjectiveMaterialAssignmentTableGUI\__construct(), ilShopPersonalSettingsTopicsTableGUI\__construct(), ilCourseObjectiveQuestionAssignmentTableGUI\__construct(), ilCourseEditParticipantsTableGUI\__construct(), ilCalendarChangedAppointmentsTableGUI\fillRow(), ilCalendarAppointmentsTableGUI\fillRow(), ilComponentsTableGUI\ilComponentsTableGUI(), ilFoundUsersTableGUI\ilFoundUsersTableGUI(), ilLinksTableGUI\ilLinksTableGUI(), ilMediaCastTableGUI\ilMediaCastTableGUI(), ilNewsForContextTableGUI\ilNewsForContextTableGUI(), ilPDNewsTableGUI\ilPDNewsTableGUI(), ilPluginsTableGUI\ilPluginsTableGUI(), ilSCORM2004TrackingTableGUI\ilSCORM2004TrackingTableGUI(), ilSpecialUsersTableGUI\ilSpecialUsersTableGUI(), ilWikiContributorsTableGUI\ilWikiContributorsTableGUI(), ilWikiPagesTableGUI\ilWikiPagesTableGUI(), ilWikiRecentChangesTableGUI\ilWikiRecentChangesTableGUI(), ilWikiSearchResultsTableGUI\ilWikiSearchResultsTableGUI(), and ilSessionParticipantsTableGUI\init().

{
$this->column[] = array(
"text" => $a_text,
"sort_field" => $a_sort_field,
"width" => $a_width);
$this->column_count = count($this->column);
}

+ Here is the caller graph for this function:

ilTable2GUI::addHeaderCommand (   $a_href,
  $a_text,
  $a_target = "",
  $a_img = "" 
)

Add Header Command (Link) (Image needed for now)

Parameters
stringhref
stringtext

Definition at line 359 of file class.ilTable2GUI.php.

Referenced by ilMediaPoolTableGUI\__construct().

{
$this->header_commands[] = array("href" => $a_href, "text" => $a_text,
"target" => $a_target, "img" => $a_img);
}

+ Here is the caller graph for this function:

ilTable2GUI::dataExists ( )
final

Definition at line 171 of file class.ilTable2GUI.php.

Referenced by fillActionRow(), and fillFooter().

{
if (is_array($this->row_data))
{
if (count($this->row_data) > 0)
{
return true;
}
}
return false;
}

+ Here is the caller graph for this function:

ilTable2GUI::fillActionRow ( )

Fill Action Row.

Definition at line 863 of file class.ilTable2GUI.php.

References $cmd, $lng, dataExists(), ilUtil\formSelect(), ilTableGUI\getColumnCount(), and ilUtil\getImagePath().

Referenced by getHTML().

{
global $lng;
// action row
$action_row = false;
$arrow = false;
// add buttons
if (count($this->buttons) > 0)
{
foreach ($this->buttons as $button)
{
$this->tpl->setCurrentBlock("plain_button");
$this->tpl->setVariable("PBTN_NAME", $button["cmd"]);
$this->tpl->setVariable("PBTN_VALUE", $button["text"]);
$this->tpl->parseCurrentBlock();
}
$this->tpl->setCurrentBlock("plain_buttons");
$this->tpl->parseCurrentBlock();
$action_row = true;
}
// multi selection
if (count($this->multi) > 1 && $this->dataExists())
{
$this->tpl->setCurrentBlock("tbl_cmd_select");
$sel = array();
foreach ($this->multi as $mc)
{
$sel[$mc["cmd"]] = $mc["text"];
}
$this->tpl->setVariable("SELECT_CMDS",
ilUtil::formSelect("", "selected_cmd", $sel, false, true));
$this->tpl->setVariable("TXT_EXECUTE", $lng->txt("execute"));
$this->tpl->setVariable('SELECT_CMD','select_cmd');
$this->tpl->parseCurrentBlock();
$arrow = true;
$action_row = true;
}
elseif(count($this->multi) == 1 && $this->dataExists())
{
$this->tpl->setCurrentBlock("tbl_single_cmd");
$sel = array();
foreach ($this->multi as $mc)
{
$cmd = $mc['cmd'];
$txt = $mc['text'];
}
$this->tpl->setVariable("TXT_SINGLE_CMD",$txt);
$this->tpl->setVariable("SINGLE_CMD",$cmd);
$this->tpl->parseCurrentBlock();
$arrow = true;
$action_row = true;
}
if ($arrow)
{
$this->tpl->setCurrentBlock("tbl_action_img_arrow");
$this->tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.gif"));
$this->tpl->setVariable("ALT_ARROW", $lng->txt("action"));
$this->tpl->parseCurrentBlock();
}
if ($action_row)
{
$this->tpl->setCurrentBlock("tbl_action_row");
$this->tpl->setVariable("COLUMN_COUNTS", $this->getColumnCount());
$this->tpl->parseCurrentBlock();
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilTable2GUI::fillFooter ( )

Fill footer row.

Definition at line 668 of file class.ilTable2GUI.php.

References $ilCtrl, ilTableGUI\$limit, $lng, ilTableGUI\$max_count, dataExists(), ilTableGUI\getColumnCount(), getFormName(), getLinkbar(), and getSelectAllCheckbox().

Referenced by getHTML().

{
global $lng, $ilCtrl;
$footer = false;
// select all checkbox
if ((strlen($this->getFormName())) && (strlen($this->getSelectAllCheckbox())) && $this->dataExists())
{
$this->tpl->setCurrentBlock("select_all_checkbox");
$this->tpl->setVariable("SELECT_ALL_TXT_SELECT_ALL", $lng->txt("select_all"));
$this->tpl->setVariable("SELECT_ALL_CHECKBOX_NAME", $this->getSelectAllCheckbox());
$this->tpl->setVariable("SELECT_ALL_FORM_NAME", $this->getFormName());
$this->tpl->setVariable("CHECKBOXNAME", "chb_select_all_" . $this->unique_id);
$this->tpl->parseCurrentBlock();
$footer = true;
}
// table footer numinfo
if ($this->enabled["numinfo"] && $this->enabled["footer"])
{
$start = $this->offset + 1; // compute num info
if (!$this->dataExists())
{
$start = 0;
}
$end = $this->offset + $this->limit;
if ($end > $this->max_count or $this->limit == 0)
{
}
if ($this->lang_support)
{
$numinfo = "(".$start." - ".$end." ".strtolower($this->lng->txt("of"))." ".$this->max_count.")";
}
else
{
$numinfo = "(".$start." - ".$end." of ".$this->max_count.")";
}
if ($this->max_count > 0)
{
$this->tpl->setCurrentBlock("tbl_footer_numinfo");
$this->tpl->setVariable("NUMINFO", $numinfo);
$this->tpl->parseCurrentBlock();
}
$footer = true;
}
// table footer linkbar
if ($this->enabled["linkbar"] && $this->enabled["footer"] && $this->limit != 0
&& $this->max_count > 0)
{
$layout = array(
"link" => $this->footer_style,
"prev" => $this->footer_previous,
"next" => $this->footer_next,
);
$linkbar = $this->getLinkbar("1");
$this->tpl->setCurrentBlock("tbl_footer_linkbar");
$this->tpl->setVariable("LINKBAR", $linkbar);
$this->tpl->parseCurrentBlock();
$footer = true;
}
if ($footer)
{
$this->tpl->setCurrentBlock("tbl_footer");
$this->tpl->setVariable("COLUMN_COUNT", $this->getColumnCount());
$this->tpl->parseCurrentBlock();
// top navigation, if number info or linkbar given
if ($numinfo != "" || $linkbar != "")
{
if ($numinfo != "")
{
$this->tpl->setCurrentBlock("top_numinfo");
$this->tpl->setVariable("NUMINFO", $numinfo);
$this->tpl->parseCurrentBlock();
}
if ($linkbar != "")
{
$linkbar = $this->getLinkbar("2");
$this->tpl->setCurrentBlock("top_linkbar");
$this->tpl->setVariable("LINKBAR", $linkbar);
$this->tpl->parseCurrentBlock();
}
$this->tpl->setCurrentBlock("top_navigation");
$this->tpl->setVariable("COLUMN_COUNT", $this->getColumnCount());
$this->tpl->parseCurrentBlock();
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilTable2GUI::fillHeader ( )

Definition at line 404 of file class.ilTable2GUI.php.

References ilUtil\getImagePath(), and setOrderLink().

Referenced by render().

{
foreach ($this->column as $column)
{
if (!$this->enabled["sort"] || $column["sort_field"] == "")
{
$this->tpl->setCurrentBlock("tbl_header_no_link");
if ($column["width"] != "")
{
$this->tpl->setVariable("TBL_COLUMN_WIDTH_NO_LINK"," width=\"".$column["width"]."\"");
}
$this->tpl->setVariable("TBL_HEADER_CELL_NO_LINK",
$column["text"]);
$this->tpl->parseCurrentBlock();
$this->tpl->touchBlock("tbl_header_th");
continue;
}
if (($column["sort_field"] == $this->order_field) && ($this->order_direction != ""))
{
$this->tpl->setCurrentBlock("tbl_order_image");
$this->tpl->setVariable("IMG_ORDER_DIR",ilUtil::getImagePath($this->order_direction."_order.gif"));
$this->tpl->parseCurrentBlock();
}
$this->tpl->setCurrentBlock("tbl_header_cell");
$this->tpl->setVariable("TBL_HEADER_CELL", $column["text"]);
// only set width if a value is given for that column
if ($column["width"] != "")
{
$this->tpl->setVariable("TBL_COLUMN_WIDTH"," width=\"".$column["width"]."\"");
}
$lng_sort_column = $this->lng->txt("sort_by_this_column");
$this->tpl->setVariable("TBL_ORDER_ALT",$lng_sort_column);
$order_dir = "asc";
if ($column["sort_field"] == $this->order_field)
{
$order_dir = $this->sort_order;
$lng_change_sort = $this->lng->txt("change_sort_direction");
$this->tpl->setVariable("TBL_ORDER_ALT",$lng_change_sort);
}
$this->setOrderLink($column["sort_field"], $order_dir);
$this->tpl->parseCurrentBlock();
$this->tpl->touchBlock("tbl_header_th");
}
$this->tpl->setCurrentBlock("tbl_header");
$this->tpl->parseCurrentBlock();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilTable2GUI::fillRow (   $a_set)
protected

Standard Version of Fill Row.

Most likely to be overwritten by derived class.

Parameters
array$a_setdata array

Reimplemented in ilMediaPoolTableGUI, ilWikiPagesTableGUI, ilSessionParticipantsTableGUI, ilCourseParticipantsTableGUI, ilGroupParticipantsTableGUI, ilSubscriberTableGUI, ilWaitingListTableGUI, ilCourseEditParticipantsTableGUI, ilComponentsTableGUI, ilCourseObjectiveQuestionAssignmentTableGUI, ilMediaObjectUsagesTableGUI, ilImageMapTableGUI, ilCalendarAppointmentsTableGUI, ilCourseObjectiveMaterialAssignmentTableGUI, ilGroupEditParticipantsTableGUI, ilClipboardTableGUI, ilCourseObjectivesTableGUI, ilCalendarChangedAppointmentsTableGUI, ilCalendarSharedListTableGUI, ilPluginsTableGUI, ilCalendarSharedRoleListTableGUI, ilCalendarSharedUserListTableGUI, ilCalendarInboxSharedTableGUI, ilCourseObjectiveQuestionsTableGUI, ilWikiContributorsTableGUI, ilCalendarCategoryTableGUI, ilShopTopicsTableGUI, ilECSCommunityTableGUI, ilMDCopyrightTableGUI, ilAdvancedMDRecordTableGUI, ilPageHistoryTableGUI, ilECSImportedContentTableGUI, ilCourseInfoFileTableGUI, ilSessionFileTableGUI, ilWikiRecentChangesTableGUI, ilLDAPRoleAssignmentTableGUI, ilShopPersonalSettingsTopicsTableGUI, ilECSReleasedContentTableGUI, ilAdvancedMDFieldTableGUI, ilAdvancedMDRecordExportFilesTableGUI, ilLinksTableGUI, ilAddressbookTableGUI, ilPCImageMapTableGUI, ilMediaCastTableGUI, ilWikiSearchResultsTableGUI, ilPDNewsTableGUI, ilFoundUsersTableGUI, ilSpecialUsersTableGUI, ilSCORM2004TrackingTableGUI, and ilNewsForContextTableGUI.

Definition at line 656 of file class.ilTable2GUI.php.

Referenced by getHTML().

{
foreach ($a_set as $key => $value)
{
$this->tpl->setVariable("VAL_".strtoupper($key), $value);
}
}

+ Here is the caller graph for this function:

ilTable2GUI::getData ( )
final

Reimplemented from ilTableGUI.

Definition at line 166 of file class.ilTable2GUI.php.

Referenced by ilImageMapTableGUI\__construct(), and getHTML().

{
return $this->row_data;
}

+ Here is the caller graph for this function:

ilTable2GUI::getDefaultOrderDirection ( )

Get Default order direction.

Returns
string Default order direction

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

Referenced by getHTML().

{
return $this->defaultorderdirection;
}

+ Here is the caller graph for this function:

ilTable2GUI::getDefaultOrderField ( )

Get Default order field.

Returns
string Default order field

Definition at line 295 of file class.ilTable2GUI.php.

Referenced by getHTML().

{
return $this->defaultorderfield;
}

+ Here is the caller graph for this function:

ilTable2GUI::getEnableHeader ( )

Get Enable Header.

Returns
boolean Enable Header

Definition at line 136 of file class.ilTable2GUI.php.

{
return $this->enabled["header"];
}
ilTable2GUI::getEnableTitle ( )

Get Enable Title.

Returns
boolean Enable Title

Definition at line 116 of file class.ilTable2GUI.php.

{
return $this->enabled["title"];
}
ilTable2GUI::getFormAction ( )
final

Get Form action parameter.

Returns
string Form action

Definition at line 203 of file class.ilTable2GUI.php.

Referenced by getHTML().

{
return $this->form_action;
}

+ Here is the caller graph for this function:

ilTable2GUI::getFormName ( )

Get Form name.

Returns
string Form name

Reimplemented from ilTableGUI.

Definition at line 223 of file class.ilTable2GUI.php.

Referenced by fillFooter(), and getHTML().

{
return $this->formname;
}

+ Here is the caller graph for this function:

ilTable2GUI::getHTML ( )
final

Definition at line 460 of file class.ilTable2GUI.php.

References $_GET, ilTableGUI\$data, $ilCtrl, $lng, fillActionRow(), fillFooter(), fillRow(), getData(), getDefaultOrderDirection(), getDefaultOrderField(), getFormAction(), getFormName(), ilTableGUI\getLimit(), getNavParameter(), getNoEntriesText(), ilTableGUI\getOffset(), ilTableGUI\getOrderDirection(), getOrderField(), getParentObject(), numericOrdering(), render(), ilTableGUI\setFooter(), ilTableGUI\setMaxCount(), ilTableGUI\setOffset(), ilTableGUI\setOrderDirection(), setOrderField(), and ilUtil\sortArray().

{
global $lng, $ilCtrl;
$ilCtrl->saveParameter($this->getParentObject(), $this->getNavParameter());
if(!$this->enabled['content'])
{
return $this->render();
}
if ($_POST[$this->getNavParameter()."1"] != "")
{
if ($_POST[$this->getNavParameter()."1"] != $_POST[$this->getNavParameter()])
{
$this->nav_value = $_POST[$this->getNavParameter()."1"];
}
else if ($_POST[$this->getNavParameter()."2"] != $_POST[$this->getNavParameter()])
{
$this->nav_value = $_POST[$this->getNavParameter()."2"];
}
}
else
{
$this->nav_value = $_GET[$this->getNavParameter()];
}
$nav = explode(":", $this->nav_value);
// $nav[0] is order by
$this->setOrderField(($nav[0] != "") ? $nav[0] : $this->getDefaultOrderField());
$this->setOrderDirection(($nav[1] != "") ? $nav[1] : $this->getDefaultOrderDirection());
$this->setOffset($nav[2]);
$this->setMaxCount(count($this->row_data));
$this->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));
// sort
$data = $this->getData();
$data = ilUtil::sortArray($data, $this->getOrderField(),
$this->getOrderDirection(), $this->numericOrdering($this->getOrderField()));
// slice
$data = array_slice($data, $this->getOffset(), $this->getLimit());
// fill rows
if(count($data) > 0)
{
$this->tpl->addBlockFile("TBL_CONTENT", "tbl_content", $this->row_template,
$this->row_template_dir);
foreach($data as $set)
{
$this->tpl->setCurrentBlock("tbl_content");
$this->css_row = ($this->css_row != "tblrow1")
? "tblrow1"
: "tblrow2";
$this->tpl->setVariable("CSS_ROW", $this->css_row);
$this->fillRow($set);
$this->tpl->setCurrentBlock("tbl_content");
$this->tpl->parseCurrentBlock();
}
}
else
{
// add standard no items text (please tell me, if it messes something up, alex, 29.8.2008)
$no_items_text = (trim($this->getNoEntriesText()) != '')
? $this->getNoEntriesText()
: $lng->txt("no_items");
$this->css_row = ($this->css_row != "tblrow1")
? "tblrow1"
: "tblrow2";
$this->tpl->setCurrentBlock("tbl_no_entries");
$this->tpl->setVariable('TBL_NO_ENTRY_CSS_ROW', $this->css_row);
$this->tpl->setVariable('TBL_NO_ENTRY_COLUMN_COUNT', $this->column_count);
$this->tpl->setVariable('TBL_NO_ENTRY_TEXT', trim($no_items_text));
$this->tpl->parseCurrentBlock();
}
// set form action
if ($this->form_action != "")
{
$this->tpl->setCurrentBlock("tbl_form_header");
$this->tpl->setVariable("FORMACTION", $this->getFormAction());
$this->tpl->setVariable("FORMNAME", $this->getFormName());
$this->tpl->parseCurrentBlock();
$this->tpl->touchBlock("tbl_form_footer");
}
$this->fillFooter();
$this->fillActionRow();
return $this->render();
}

+ Here is the call graph for this function:

ilTable2GUI::getId ( )

Get element id.

Returns
string id

Definition at line 243 of file class.ilTable2GUI.php.

Referenced by render().

{
return $this->id;
}

+ Here is the caller graph for this function:

ilTable2GUI::getLinkbar (   $a_num)

Get previous/next linkbar.

Author
Sascha Hofmann shofm.nosp@m.ann@.nosp@m.datab.nosp@m.ay.d.nosp@m.e
Returns
array linkbar or false on error

Definition at line 770 of file class.ilTable2GUI.php.

References $ilCtrl, $lng, ilTableGUI\getLimit(), getNavParameter(), ilTableGUI\getOffset(), ilTableGUI\getOrderDirection(), and getOrderField().

Referenced by fillFooter().

{
global $ilCtrl, $lng;
$link = $ilCtrl->getLinkTargetByClass(get_class($this->parent_obj), $this->parent_cmd).
"&".$this->getNavParameter()."=".
$this->getOrderField().":".$this->getOrderDirection().":";
$LinkBar = "";
$layout_prev = $lng->txt("previous");
$layout_next = $lng->txt("next");
// if more entries then entries per page -> show link bar
if ($this->max_count > $this->getLimit())
{
// previous link
if ($this->getOffset() >= 1)
{
$prevoffset = $this->getOffset() - $this->getLimit();
$LinkBar .= "<a class=\"small\" href=\"".$link.$prevoffset."\">".$layout_prev."&nbsp;</a>";
}
else
{
$LinkBar .= '<span class="il_BlockInfo">'.$layout_prev."&nbsp;</span>";
}
// current value
if ($a_num == "1")
{
$LinkBar .= '<input type="hidden" name="'.$this->getNavParameter().
'" value="'.$this->getOrderField().":".$this->getOrderDirection().":".$this->getOffset().'" />';
}
// calculate number of pages
$pages = intval($this->max_count / $this->getLimit());
// add a page if a rest remains
if (($this->max_count % $this->getLimit()))
$pages++;
// links to other pages
$offset_arr = array();
for ($i = 1 ;$i <= $pages ; $i++)
{
$newoffset = $this->getLimit() * ($i-1);
$nav_value = $this->getOrderField().":".$this->getOrderDirection().":".$newoffset;
$offset_arr[$nav_value] = $i;
if ($newoffset == $this->getOffset())
{
// $LinkBar .= "[".$i."] ";
}
else
{
// $LinkBar .= '<a '.$layout_link.' href="'.
// $link.$newoffset.'">['.$i.']</a> ';
}
}
// show next link (if not last page)
if (! ( ($this->getOffset() / $this->getLimit())==($pages-1) ) && ($pages!=1) )
{
if ($LinkBar != "")
$LinkBar .= "<span class=\"small\" > | </span>";
$newoffset = $this->getOffset() + $this->getLimit();
$LinkBar .= "<a class=\"small\" href=\"".$link.$newoffset."\">&nbsp;".$layout_next."</a>";
}
else
{
if ($LinkBar != "")
$LinkBar .= "<span class=\"small\" > | </span>";
$LinkBar .= '<span class="il_BlockInfo">&nbsp;'.$layout_next."</span>";
}
if (count($offset_arr))
{
$LinkBar .= "&nbsp;&nbsp;&nbsp;&nbsp;".ilUtil::formSelect($this->nav_value,
$this->getNavParameter().$a_num, $offset_arr, false, true, 0, "ilEditSelect").
' <input class="ilEditSubmit" type="submit" name="cmd['.$this->parent_cmd.']" value="'.
$lng->txt("select_page").'"> ';
}
return $LinkBar;
}
else
{
return false;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilTable2GUI::getNavParameter ( )
final

Definition at line 381 of file class.ilTable2GUI.php.

Referenced by getHTML(), getLinkbar(), and setOrderLink().

{
return $this->prefix."_table_nav";
}

+ Here is the caller graph for this function:

ilTable2GUI::getNoEntriesText ( )

Get text for an empty table.

Returns
string Text

Definition at line 96 of file class.ilTable2GUI.php.

Referenced by getHTML().

{
return $this->noentriestext;
}

+ Here is the caller graph for this function:

ilTable2GUI::getOrderField ( )

Definition at line 156 of file class.ilTable2GUI.php.

Referenced by getHTML(), and getLinkbar().

{
return $this->order_field;
}

+ Here is the caller graph for this function:

ilTable2GUI::getParentCmd ( )

Get parent command.

Returns
string get parent gui object default command

Definition at line 76 of file class.ilTable2GUI.php.

Referenced by ilWikiRecentChangesTableGUI\fillRow(), ilPageHistoryTableGUI\fillRow(), and ilWikiPagesTableGUI\fillRow().

{
return $this->parent_cmd;
}

+ Here is the caller graph for this function:

ilTable2GUI::getSelectAllCheckbox ( )

Get the name of the checkbox that should be toggled with a select all button.

Returns
string name of the checkbox

Reimplemented from ilTableGUI.

Definition at line 253 of file class.ilTable2GUI.php.

References ilTableGUI\$select_all_checkbox.

Referenced by fillFooter().

+ Here is the caller graph for this function:

ilTable2GUI::numericOrdering (   $a_field)

Should this field be sorted numeric?

Returns
boolean numeric ordering; default is false

Reimplemented in ilPageHistoryTableGUI.

Definition at line 562 of file class.ilTable2GUI.php.

Referenced by getHTML().

{
return false;
}

+ Here is the caller graph for this function:

ilTable2GUI::render ( )

render table public

Reimplemented from ilTableGUI.

Definition at line 571 of file class.ilTable2GUI.php.

References $command, $lng, fillHeader(), getId(), ilUtil\getImagePath(), and ilTableGUI\getStyle().

Referenced by getHTML().

{
global $lng;
$this->tpl->setVariable("CSS_TABLE",$this->getStyle("table"));
if ($this->getId() != "")
{
$this->tpl->setVariable("ID", 'id="'.$this->getId().'"');
}
// table title and icon
if ($this->enabled["title"])
{
if ($this->enabled["icon"])
{
$this->tpl->setCurrentBlock("tbl_header_title_icon");
$this->tpl->setVariable("TBL_TITLE_IMG",ilUtil::getImagePath($this->icon));
$this->tpl->setVariable("TBL_TITLE_IMG_ALT",$this->icon_alt);
$this->tpl->parseCurrentBlock();
}
foreach($this->header_commands as $command)
{
if ($command["img"] != "")
{
$this->tpl->setCurrentBlock("tbl_header_img_link");
if ($command["target"] != "")
{
$this->tpl->setVariable("TARGET_IMG_LINK",
'target="'.$command["target"].'"');
}
$this->tpl->setVariable("ALT_IMG_LINK", $command["text"]);
$this->tpl->setVariable("HREF_IMG_LINK", $command["href"]);
$this->tpl->setVariable("SRC_IMG_LINK",
$command["img"]);
$this->tpl->parseCurrentBlock();
}
else
{
$this->tpl->setCurrentBlock("head_cmd");
$this->tpl->setVariable("TXT_HEAD_CMD", $command["text"]);
$this->tpl->setVariable("HREF_HEAD_CMD", $command["href"]);
$this->tpl->parseCurrentBlock();
}
}
if (isset ($this->headerHTML)) {
$this->tpl->setCurrentBlock("tbl_header_html");
$this->tpl->setVariable ("HEADER_HTML", $this->headerHTML);
$this->tpl->parseCurrentBlock();
}
// close command
if ($this->close_command != "")
{
$this->tpl->setCurrentBlock("tbl_header_img_link");
$this->tpl->setVariable("ALT_IMG_LINK",$lng->txt("close"));
$this->tpl->setVariable("HREF_IMG_LINK",$this->close_command);
$this->tpl->setVariable("SRC_IMG_LINK",ilUtil::getImagePath("icon_close2.gif"));
$this->tpl->parseCurrentBlock();
}
$this->tpl->setCurrentBlock("tbl_header_title");
$this->tpl->setVariable("COLUMN_COUNT",$this->column_count);
$this->tpl->setVariable("TBL_TITLE",$this->title);
$this->tpl->parseCurrentBlock();
}
// table header
if ($this->enabled["header"])
{
$this->fillHeader();
}
$this->tpl->touchBlock("tbl_table_end");
return $this->tpl->get();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilTable2GUI::setCloseCommand (   $a_link)

Add command for closing table.

Parameters
string$a_linkclosing link

Definition at line 337 of file class.ilTable2GUI.php.

Referenced by ilNewsForContextTableGUI\ilNewsForContextTableGUI().

{
$this->close_command = $a_link;
}

+ Here is the caller graph for this function:

ilTable2GUI::setData (   $a_data)
final

set table data public

Parameters
arraytable data

Reimplemented from ilTableGUI.

Definition at line 161 of file class.ilTable2GUI.php.

Referenced by ilComponentsTableGUI\getComponents(), ilWikiContributorsTableGUI\getContributors(), ilPCImageMapTableGUI\getItems(), ilMediaObjectUsagesTableGUI\getItems(), ilClipboardTableGUI\getItems(), ilImageMapTableGUI\getItems(), ilMediaPoolTableGUI\getItems(), ilLinksTableGUI\getLinks(), ilWikiPagesTableGUI\getPages(), ilPluginsTableGUI\getPlugins(), ilWikiRecentChangesTableGUI\getRecentChanges(), ilWikiSearchResultsTableGUI\ilWikiSearchResultsTableGUI(), ilLDAPRoleAssignmentTableGUI\parse(), ilCalendarSharedUserListTableGUI\parse(), ilCalendarSharedRoleListTableGUI\parse(), ilCalendarSharedListTableGUI\parse(), ilECSCommunityTableGUI\parse(), ilSessionParticipantsTableGUI\parse(), ilCalendarInboxSharedTableGUI\parse(), ilCalendarCategoryTableGUI\parse(), ilCourseObjectiveMaterialAssignmentTableGUI\parse(), ilECSReleasedContentTableGUI\parse(), ilCourseObjectiveQuestionAssignmentTableGUI\parse(), ilCourseObjectiveQuestionsTableGUI\parse(), ilCourseObjectivesTableGUI\parse(), ilECSImportedContentTableGUI\parse(), ilAdvancedMDFieldTableGUI\parseDefinitions(), ilAdvancedMDRecordExportFilesTableGUI\parseFiles(), ilShopPersonalSettingsTopicsTableGUI\parseRecords(), ilShopTopicsTableGUI\parseRecords(), ilAdvancedMDRecordTableGUI\parseRecords(), ilMDCopyrightTableGUI\parseSelections(), ilSubscriberTableGUI\readSubscriberData(), ilWaitingListTableGUI\readUserData(), ilCalendarChangedAppointmentsTableGUI\setAppointments(), and ilCalendarAppointmentsTableGUI\setAppointments().

{
$this->row_data = $a_data;
}

+ Here is the caller graph for this function:

ilTable2GUI::setEnableTitle (   $a_enabletitle)

Set Enable Title.

Parameters
boolean$a_enabletitleEnable Title

Definition at line 106 of file class.ilTable2GUI.php.

Referenced by ilImageMapTableGUI\__construct(), and ilPDNewsTableGUI\ilPDNewsTableGUI().

{
$this->enabled["title"] = $a_enabletitle;
}

+ Here is the caller graph for this function:

ilTable2GUI::setFormAction (   $a_form_action)
final

Set Form action parameter.

Parameters
string$a_form_actionForm action

Definition at line 193 of file class.ilTable2GUI.php.

Referenced by ilPageHistoryTableGUI\__construct(), ilImageMapTableGUI\__construct(), ilMediaObjectUsagesTableGUI\__construct(), ilClipboardTableGUI\__construct(), ilMediaPoolTableGUI\__construct(), ilCourseObjectiveQuestionsTableGUI\__construct(), ilCalendarCategoryTableGUI\__construct(), ilAdvancedMDFieldTableGUI\__construct(), ilAdvancedMDRecordExportFilesTableGUI\__construct(), ilCalendarAppointmentsTableGUI\__construct(), ilGroupEditParticipantsTableGUI\__construct(), ilCalendarChangedAppointmentsTableGUI\__construct(), ilCalendarSharedListTableGUI\__construct(), ilECSImportedContentTableGUI\__construct(), ilLDAPRoleAssignmentTableGUI\__construct(), ilAddressbookTableGUI\__construct(), ilSubscriberTableGUI\__construct(), ilWaitingListTableGUI\__construct(), ilCourseInfoFileTableGUI\__construct(), ilECSReleasedContentTableGUI\__construct(), ilAdvancedMDRecordTableGUI\__construct(), ilSessionFileTableGUI\__construct(), ilCourseObjectivesTableGUI\__construct(), ilMDCopyrightTableGUI\__construct(), ilCalendarInboxSharedTableGUI\__construct(), ilShopPersonalSettingsTopicsTableGUI\__construct(), ilCourseObjectiveMaterialAssignmentTableGUI\__construct(), ilShopTopicsTableGUI\__construct(), ilCourseObjectiveQuestionAssignmentTableGUI\__construct(), ilCourseEditParticipantsTableGUI\__construct(), ilComponentsTableGUI\ilComponentsTableGUI(), ilFoundUsersTableGUI\ilFoundUsersTableGUI(), ilLinksTableGUI\ilLinksTableGUI(), ilMediaCastTableGUI\ilMediaCastTableGUI(), ilNewsForContextTableGUI\ilNewsForContextTableGUI(), ilPDNewsTableGUI\ilPDNewsTableGUI(), ilPluginsTableGUI\ilPluginsTableGUI(), ilSCORM2004TrackingTableGUI\ilSCORM2004TrackingTableGUI(), ilSpecialUsersTableGUI\ilSpecialUsersTableGUI(), ilWikiContributorsTableGUI\ilWikiContributorsTableGUI(), ilWikiPagesTableGUI\ilWikiPagesTableGUI(), ilWikiRecentChangesTableGUI\ilWikiRecentChangesTableGUI(), ilWikiSearchResultsTableGUI\ilWikiSearchResultsTableGUI(), and ilSessionParticipantsTableGUI\init().

{
$this->form_action = $a_form_action;
}

+ Here is the caller graph for this function:

ilTable2GUI::setHeaderHTML (   $html)

set header html

Parameters
string$html

Definition at line 942 of file class.ilTable2GUI.php.

{
$this->headerHTML = $html;
}
ilTable2GUI::setId (   $a_val)

Set id.

Parameters
stringelement id

Definition at line 233 of file class.ilTable2GUI.php.

{
$this->id = $a_val;
}
ilTable2GUI::setNoEntriesText (   $a_text)

Set text for an empty table.

Parameters
string$a_textText

Definition at line 86 of file class.ilTable2GUI.php.

Referenced by ilCourseObjectiveMaterialAssignmentTableGUI\__construct(), ilShopPersonalSettingsTopicsTableGUI\parseRecords(), and ilShopTopicsTableGUI\parseRecords().

{
$this->noentriestext = $a_text;
}

+ Here is the caller graph for this function:

ilTable2GUI::setOrderField (   $a_order_field)

set order column

Parameters
string(array) field name for ordering

Definition at line 151 of file class.ilTable2GUI.php.

Referenced by getHTML().

{
$this->order_field = $a_order_field;
}

+ Here is the caller graph for this function:

ilTable2GUI::setOrderLink (   $sort_field,
  $order_dir 
)

Reimplemented from ilTableGUI.

Definition at line 386 of file class.ilTable2GUI.php.

References $_GET, $ilCtrl, and getNavParameter().

Referenced by fillHeader().

{
global $ilCtrl;
$old = $_GET[$this->getNavParameter()];
// set order link
$ilCtrl->setParameter($this->parent_obj,
$this->getNavParameter(),
$sort_field.":".$order_dir.":".$this->offset);
$this->tpl->setVariable("TBL_ORDER_LINK",
$ilCtrl->getLinkTarget($this->parent_obj, $this->parent_cmd));
// set old value of nav variable
$ilCtrl->setParameter($this->parent_obj,
$this->getNavParameter(), $old);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilTable2GUI::setPrefix (   $a_prefix)
final
ilTable2GUI::setRowTemplate (   $a_template,
  $a_template_dir = "" 
)
final

Set row template.

Parameters
string$a_templateTemplate file name.
string$a_template_dirService/Module directory.

Definition at line 274 of file class.ilTable2GUI.php.

Referenced by ilPageHistoryTableGUI\__construct(), ilClipboardTableGUI\__construct(), ilImageMapTableGUI\__construct(), ilMediaObjectUsagesTableGUI\__construct(), ilCourseObjectiveQuestionsTableGUI\__construct(), ilMediaPoolTableGUI\__construct(), ilCalendarCategoryTableGUI\__construct(), ilGroupEditParticipantsTableGUI\__construct(), ilAdvancedMDFieldTableGUI\__construct(), ilAdvancedMDRecordExportFilesTableGUI\__construct(), ilCalendarAppointmentsTableGUI\__construct(), ilCalendarChangedAppointmentsTableGUI\__construct(), ilCalendarSharedListTableGUI\__construct(), ilGroupParticipantsTableGUI\__construct(), ilCourseInfoFileTableGUI\__construct(), ilLDAPRoleAssignmentTableGUI\__construct(), ilSubscriberTableGUI\__construct(), ilWaitingListTableGUI\__construct(), ilCalendarSharedUserListTableGUI\__construct(), ilECSImportedContentTableGUI\__construct(), ilCourseObjectivesTableGUI\__construct(), ilECSReleasedContentTableGUI\__construct(), ilAdvancedMDRecordTableGUI\__construct(), ilSessionFileTableGUI\__construct(), ilCalendarSharedRoleListTableGUI\__construct(), ilMDCopyrightTableGUI\__construct(), ilCourseParticipantsTableGUI\__construct(), ilCalendarInboxSharedTableGUI\__construct(), ilShopTopicsTableGUI\__construct(), ilECSCommunityTableGUI\__construct(), ilShopPersonalSettingsTopicsTableGUI\__construct(), ilCourseObjectiveMaterialAssignmentTableGUI\__construct(), ilCourseObjectiveQuestionAssignmentTableGUI\__construct(), ilCourseEditParticipantsTableGUI\__construct(), ilComponentsTableGUI\ilComponentsTableGUI(), ilFoundUsersTableGUI\ilFoundUsersTableGUI(), ilLinksTableGUI\ilLinksTableGUI(), ilMediaCastTableGUI\ilMediaCastTableGUI(), ilNewsForContextTableGUI\ilNewsForContextTableGUI(), ilPDNewsTableGUI\ilPDNewsTableGUI(), ilPluginsTableGUI\ilPluginsTableGUI(), ilSCORM2004TrackingTableGUI\ilSCORM2004TrackingTableGUI(), ilSpecialUsersTableGUI\ilSpecialUsersTableGUI(), ilWikiContributorsTableGUI\ilWikiContributorsTableGUI(), ilWikiPagesTableGUI\ilWikiPagesTableGUI(), ilWikiRecentChangesTableGUI\ilWikiRecentChangesTableGUI(), ilWikiSearchResultsTableGUI\ilWikiSearchResultsTableGUI(), and ilSessionParticipantsTableGUI\init().

{
$this->row_template = $a_template;
$this->row_template_dir = $a_template_dir;
}

+ Here is the caller graph for this function:

Field Documentation

ilTable2GUI::$close_command = ""
protected

Definition at line 36 of file class.ilTable2GUI.php.

ilTable2GUI::$headerHTML
private

Definition at line 38 of file class.ilTable2GUI.php.

ilTable2GUI::$unique_id
private

Definition at line 37 of file class.ilTable2GUI.php.

Referenced by __construct().


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