";
// account table head
$this->listPrintTableHeader();
// account table body
$this->listPrintTableBody($this->entries);
echo "
";
}
else {
// buttons
$this->listPrintButtons(true);
echo ("type->getScope() . "-bright\">";
echo "
\n";
$refresh = '&norefresh=true';
if (isset($_GET['refresh']) && ($_GET['refresh'] == 'true')) {
$refresh = '&refresh=true';
}
echo "
description)
*
* @return array attribute list
*/
protected function listGetAttributeDescriptionList() {
$attrs = $this->type->getAttributes();
$ret = array();
foreach ($attrs as $attr) {
$ret[$attr->getAttributeName()] = $attr->getAlias();
}
return $ret;
}
/**
* Sets some internal parameters.
*/
protected function listGetParams() {
if (isset($_GET['accountEditBack'])) {
$this->refresh = true;
return;
}
// check if only PDF should be shown
if (isset($_GET['printPDF'])) {
$this->showPDFPage(null);
exit();
}
// get current page
if (!empty($_GET["page"])) $this->page = $_GET["page"];
else $this->page = 1;
// generate attribute-description table
$temp_array = $this->listGetAttributeDescriptionList();
$this->attrArray = array_keys($temp_array); // list of LDAP attributes to show
$this->descArray = array_values($temp_array); // list of descriptions for the attributes
// get sorting column
if (isset($_GET["sort"])) {
if ($_GET["sort"] == $this->sortColumn) {
$this->sortDirection = -$this->sortDirection;
}
else {
$this->sortColumn = $_GET["sort"];
$this->sortDirection = 1;
}
}
else {
$this->sortColumn = strtolower($this->attrArray[0]);
$this->sortDirection = 1;
}
// get sort order
if (isset($_GET['sortdirection'])) {
$this->sortDirection = $_GET['sortdirection'];
}
// check search suffix
if (isset($_POST['suffix'])) {
// new suffix selected via combobox
$this->suffix = $_POST['suffix'];
}
elseif (isset($_GET['suffix'])) {
// new suffix selected via combobox
$this->suffix = $_GET['suffix'];
}
elseif (!$this->suffix) {
// default suffix
$this->suffix = $this->type->getSuffix();
}
// check if LDAP data should be refreshed
$this->refresh = true;
if (isset($_GET['norefresh'])) $this->refresh = false;
if (isset($_POST['refresh']) || isset($_POST['apply_filter']) || isset($_POST['clear_filter'])) {
$this->refresh = true;
}
}
/**
* Rereads the entries from LDAP.
*/
protected function listRefreshData() {
// check suffix
if (!$this->suffix) {
$this->suffix = $this->type->getSuffix(); // default suffix
}
// configure search filter
$module_filter = get_ldap_filter($this->type->getId()); // basic filter is provided by modules
$filter = "(&" . $module_filter . $this->buildLDAPAttributeFilter() . ")";
$attrs = $this->attrArray;
// remove virtual attributes from list
for ($i = 0; $i < sizeof($attrs); $i++) {
if (strpos($attrs[$i], self::VIRTUAL_ATTRIBUTE_PREFIX) === 0) {
unset($attrs[$i]);
}
}
$attrs = array_values($attrs);
// include additional attributes
$additionalAttrs = $this->getAdditionalLDAPAttributesToRead();
for ($i = 0; $i < sizeof($additionalAttrs); $i++) {
if (!in_array_ignore_case($additionalAttrs[$i], $attrs)) {
$attrs[] = $additionalAttrs[$i];
}
}
$this->entries = searchLDAP($this->suffix, $filter, $attrs);
$lastError = getLastLDAPError();
if ($lastError != null) {
call_user_func_array('StatusMessage', $lastError);
}
// generate list of possible suffixes
$this->possibleSuffixes = $this->type->getBaseType()->getSuffixList();
}
/**
* Builds the LDAP filter based on the filter entries in the GUI.
*
* @return String LDAP filter
*/
protected function buildLDAPAttributeFilter() {
$text = '';
foreach ($this->filters as $attr => $filter) {
$text .= '(' . $attr . '=' . $filter . ')';
}
return $text;
}
/**
* Forces a refresh of the LDAP data.
* Function must be called before $this->refresh option is checked to load new LDAP data (e.g. in listGetParams).
*/
protected function forceRefresh() {
$this->refresh = true;
if (isset($_GET['norefresh'])) {
unset($_GET['norefresh']);
}
}
/**
* Returns a list of additional LDAP attributes that should be read.
* This can be used to show additional data even if the user selected other attributes to show in the list.
*
* @return array additional attribute names
*/
protected function getAdditionalLDAPAttributesToRead() {
return array();
}
/**
* Returns a list of lamListTool objects to display next to the edit/delete buttons.
*
* @return lamListTool[] tools
*/
protected function getAdditionalTools() {
return array();
}
/**
* Returns a list of possible configuration options.
*
* @return array list of lamListOption objects
*/
protected function listGetAllConfigOptions() {
$listSizeOption = new lamSelectListOption(_("Maximum list entries"), array(10, 20, 30, 50, 75, 100, 500, 1000), self::LIST_SIZE_OPTION_NAME);
$listSizeOption->setHelpID('208');
$listSizeOption->setValue($this->maxPageEntries);
return array($listSizeOption);
}
/**
* Prints the list configuration page.
*/
protected function listPrintConfigurationPage() {
echo "