set_file(array( "header" => "accounts.tpl",
"row" => "accounts.tpl",
"footer" => "accounts.tpl" ));
$t->set_block("header","row","footer");
if (! $start)
$start = 0;
if ($order)
$ordermethod = "order by $order $sort";
else
$ordermethod = "order by lastname,firstname,loginid asc";
if (! $sort)
$sort = "desc";
if ($query) {
$querymethod = " where firstname like '%$query%' OR lastname like '%$query%' OR loginid "
. "like '%$query%' ";
}
$phpgw->db->query("select count(*) from accounts $querymethod");
$phpgw->db->next_record();
$total = $phpgw->db->f(0);
$limit = $phpgw->nextmatchs->sql_limit($start);
$t->set_var("bg_color",$phpgw_info["theme"]["bg_color"]);
$t->set_var("th_bg",$phpgw_info["theme"]["th_bg"]);
$t->set_var("left_next_matchs",$phpgw->nextmatchs->left("accounts.php",$start,$total));
$t->set_var("lang_user_accounts",lang("user accounts"));
$t->set_var("right_next_matchs",$phpgw->nextmatchs->right("accounts.php",$start,$total));
$t->set_var("lang_lastname",$phpgw->nextmatchs->show_sort_order($sort,"lastname",$order,"accounts.php",lang("last name")));
$t->set_var("lang_firstname",$phpgw->nextmatchs->show_sort_order($sort,"firstname",$order,"accounts.php",lang("first name")));
$t->set_var("lang_edit",lang("Edit"));
$t->set_var("lang_delete",lang("Delete"));
$t->set_var("lang_view",lang("View"));
$t->parse("out","header");
$phpgw->db->query("select con,firstname,lastname,loginid from accounts $querymethod "
. "$ordermethod limit $limit");
while ($phpgw->db->next_record()) {
$tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
$t->set_var("tr_color",$tr_color);
$lastname = $phpgw->db->f("lastname");
$firstname = $phpgw->db->f("firstname");
if (! $lastname) $lastname = ' ';
if (! $firstname) $firstname = ' ';
$t->set_var("row_firstname",$firstname);
$t->set_var("row_lastname",$lastname);
$t->set_var("row_edit",'db->f("con")) . '"> ' . lang("Edit") . ' ');
if ($phpgw_info["user"]["userid"] != $phpgw->db->f("loginid")) {
$t->set_var("row_delete",'db->f("con")) . '"> '.lang("Delete").' ');
} else {
$t->set_var("row_delete"," ");
}
$t->set_var("row_view",'db->f("con")) . '"> ' . lang("View") . ' ');
if ($phpgw->db->num_rows() == 1) {
$t->set_var("output","");
}
if ($phpgw->db->num_rows() != ++$i) {
$t->parse("output","row",True);
}
}
$t->set_var("actionurl",$phpgw->link("newaccount.php"));
$t->set_var("lang_add",lang("add"));
$t->set_var("lang_search",lang("search"));
$t->pparse("out","footer");
include($phpgw_info["server"]["api_dir"] . "/footer.inc.php");