_("User ID"), "uidnumber" => _("UID number"), "gidnumber" => _("GID number"), "cn" => _("User name"), "host" => _("Allowed hosts"), "givenname" => _("First name"), "sn" => _("Last name"), "homedirectory" => _("Home directory"), "loginshell" => _("Login shell"), "mail" => _("E-Mail"), "gecos" => _("Description") ); } } /** * Generates the list view. * * @package lists * @author Roland Gruber * */ class lamUserList extends lamList { /** Controls if GID number is translated to group name */ var $trans_primary = false; /** translates GID to group name */ var $trans_primary_hash = array(); /** * Constructor * * @param string $type account type * @return lamList list object */ function lamUserList($type) { parent::lamList($type); $this->labels = array( 'nav' => _("%s user(s) found"), 'error_noneFound' => _("No users found!"), 'newEntry' => _("New user"), 'deleteEntry' => _("Delete user"), 'createPDF' => _("Create PDF for selected user(s)"), 'createPDFAll' => _("Create PDF for all users")); } /** * Manages all POST actions (e.g. button pressed) for the account lists. */ function listDoPost() { parent::listDoPost(); // check if primary group should be translated if (isset($_POST['apply_trans_primary'])) { $this->trans_primary = $_POST['trans_primary']; } // generate hash table for group translation if ($this->trans_primary == "on" && ($this->refresh || (sizeof($this->trans_primary_hash) == 0))) { $this->trans_primary_hash = array(); $grp_suffix = $_SESSION['config']->get_Suffix('group'); $filter = "objectClass=posixGroup"; $attrs = array("cn", "gidNumber"); $sr = @ldap_search($_SESSION["ldap"]->server(), $grp_suffix, $filter, $attrs); if ($sr) { $info = @ldap_get_entries($_SESSION["ldap"]->server(), $sr); unset($info['count']); // delete count entry for ($i = 0; $i < sizeof($info); $i++) { $this->trans_primary_hash[$info[$i]['gidnumber'][0]] = $info[$i]['cn'][0]; } } } } /** * Prints the entry list * * @param array $info entries */ function listPrintTableBody($info) { // calculate which rows to show $table_begin = ($this->page - 1) * $this->maxPageEntries; if (($this->page * $this->maxPageEntries) > sizeof($info)) $table_end = sizeof($info); else $table_end = ($this->page * $this->maxPageEntries); // translate GIDs and resort array if selected if ($this->trans_primary == "on") { // translate GIDs for ($i = 0; $i < sizeof($info); $i++) { if (isset($this->trans_primary_hash[$info[$i]['gidnumber'][0]])) { $info[$i]['gidnumber'][0] = $this->trans_primary_hash[$info[$i]['gidnumber'][0]]; } } // resort if needed if ($this->sortColumn == "gidnumber") { $info = $this->listSort($info); } } // print account list for ($i = $table_begin; $i < $table_end; $i++) { echo("type . "list\" onMouseOver=\"list_over(this, '" . $info[$i]['LAM_ID'] . "', '" . $this->type . "')\"\n" . " onMouseOut=\"list_out(this, '" . $info[$i]['LAM_ID'] . "', '" . $this->type . "')\"\n" . " onClick=\"list_click(this, '" . $info[$i]['LAM_ID'] . "', '" . $this->type . "')\"\n" . " onDblClick=\"parent.frames[1].location.href='../account/edit.php?type=" . $this->type . "&DN=" . $info[$i]['dn'] . "'\">\n"); if (isset($_GET['selectall'])) { echo " type . "')\"" . " type=\"checkbox\" checked name=\"" . $info[$i]['LAM_ID'] . "\">\n"; } else { echo " type . "')\"" . " type=\"checkbox\" name=\"" . $info[$i]['LAM_ID'] . "\">\n"; } echo (" type . "&DN='" . $info[$i]['dn'] . "'\">" . _("Edit") . "\n"); for ($k = 0; $k < sizeof($this->attrArray); $k++) { echo (""); // print all attribute entries seperated by "; " $attrName = strtolower($this->attrArray[$k]); if (isset($info[$i][$attrName]) && sizeof($info[$i][$attrName]) > 0) { // delete "count" entry unset($info[$i][$attrName]['count']); if (is_array($info[$i][$attrName])) { // sort array sort($info[$i][$attrName]); echo implode("; ", $info[$i][$attrName]); } else echo $info[$i][$attrName]; } echo ("\n"); } echo("\n"); } // display select all link $colspan = sizeof($this->attrArray) + 1; echo "type . "list\">\n"; echo "\"select\n"; echo " type . "&norefresh=y&page=" . $this->page . "&sort=" . $this->sortColumn . $this->filterText . "&selectall=yes\">" . "" . _("Select all") . "\n"; echo "\n"; echo (""); echo ("
"); } /** * Prints the create, delete and PDF buttons. * * @param boolean $createOnly true if only the create button should be displayed */ function listPrintButtons($createOnly) { // show translate GID to group name box if there is a column with gidnumber if (in_array("gidnumber", $this->attrArray)) { echo "

\n"; echo "" . _("Translate GID number to group name") . ": "; if ($this->trans_primary == "on") { echo ""; } else echo ""; echo ("  "); echo "

\n"; } echo ("

 

\n"); parent::listPrintButtons($createOnly); } } ?>