2000-08-18 05:24:22 +02:00
|
|
|
<?php
|
|
|
|
/**************************************************************************\
|
|
|
|
* phpGroupWare - administration *
|
|
|
|
* http://www.phpgroupware.org *
|
|
|
|
* -------------------------------------------- *
|
|
|
|
* This program is free software; you can redistribute it and/or modify it *
|
|
|
|
* under the terms of the GNU General Public License as published by the *
|
|
|
|
* Free Software Foundation; either version 2 of the License, or (at your *
|
|
|
|
* option) any later version. *
|
|
|
|
\**************************************************************************/
|
|
|
|
|
|
|
|
/* $Id$ */
|
|
|
|
|
2000-09-05 20:36:13 +02:00
|
|
|
$phpgw_info["flags"]["currentapp"] = "admin";
|
2000-09-28 01:17:36 +02:00
|
|
|
$phpgw_info["flags"]["disable_message_class"] = True;
|
|
|
|
$phpgw_info["flags"]["disable_send_class"] = True;
|
2000-08-18 05:24:22 +02:00
|
|
|
include("../header.inc.php");
|
|
|
|
|
2000-08-21 07:15:45 +02:00
|
|
|
$t = new Template($phpgw_info["server"]["template_dir"]);
|
|
|
|
$t->set_file(array( "header" => "accounts.tpl",
|
2000-09-04 01:22:14 +02:00
|
|
|
"row" => "accounts.tpl",
|
|
|
|
"footer" => "accounts.tpl" ));
|
2000-08-21 07:15:45 +02:00
|
|
|
|
|
|
|
$t->set_block("header","row","footer");
|
|
|
|
|
2000-08-19 08:17:20 +02:00
|
|
|
if (! $start)
|
|
|
|
$start = 0;
|
|
|
|
|
|
|
|
if ($order)
|
|
|
|
$ordermethod = "order by $order $sort";
|
|
|
|
else
|
2000-09-26 00:27:40 +02:00
|
|
|
$ordermethod = "order by account_lastname,account_firstname,account_lid asc";
|
2000-08-19 08:17:20 +02:00
|
|
|
|
2000-08-19 08:32:09 +02:00
|
|
|
if (! $sort)
|
|
|
|
$sort = "desc";
|
|
|
|
|
2000-08-19 08:17:20 +02:00
|
|
|
if ($query) {
|
2000-09-26 00:27:40 +02:00
|
|
|
$querymethod = " where account_firstname like '%$query%' OR account_lastname like '%$query%' OR account_lid "
|
2000-09-04 01:22:14 +02:00
|
|
|
. "like '%$query%' ";
|
2000-08-19 08:17:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
$phpgw->db->query("select count(*) from accounts $querymethod");
|
|
|
|
$phpgw->db->next_record();
|
|
|
|
|
|
|
|
$total = $phpgw->db->f(0);
|
|
|
|
$limit = $phpgw->nextmatchs->sql_limit($start);
|
|
|
|
|
2000-08-21 07:15:45 +02:00
|
|
|
$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));
|
2000-09-07 22:49:55 +02:00
|
|
|
$t->set_var("lang_user_accounts",lang("user accounts"));
|
2000-08-21 07:15:45 +02:00
|
|
|
$t->set_var("right_next_matchs",$phpgw->nextmatchs->right("accounts.php",$start,$total));
|
|
|
|
|
2000-09-26 00:27:40 +02:00
|
|
|
$t->set_var("lang_lastname",$phpgw->nextmatchs->show_sort_order($sort,"account_lastname",$order,"accounts.php",lang("last name")));
|
|
|
|
$t->set_var("lang_firstname",$phpgw->nextmatchs->show_sort_order($sort,"account_firstname",$order,"accounts.php",lang("first name")));
|
2000-08-21 07:15:45 +02:00
|
|
|
|
2000-09-07 22:49:55 +02:00
|
|
|
$t->set_var("lang_edit",lang("Edit"));
|
|
|
|
$t->set_var("lang_delete",lang("Delete"));
|
|
|
|
$t->set_var("lang_view",lang("View"));
|
2000-08-19 08:17:20 +02:00
|
|
|
|
2000-08-21 07:15:45 +02:00
|
|
|
$t->parse("out","header");
|
2000-08-19 08:17:20 +02:00
|
|
|
|
2000-09-26 00:27:40 +02:00
|
|
|
$phpgw->db->query("select account_id,account_firstname,account_lastname,account_lid from accounts $querymethod "
|
2000-09-04 01:22:14 +02:00
|
|
|
. "$ordermethod limit $limit");
|
2000-08-18 05:24:22 +02:00
|
|
|
|
2000-09-28 06:57:32 +02:00
|
|
|
$i = 0;
|
2000-08-18 05:24:22 +02:00
|
|
|
while ($phpgw->db->next_record()) {
|
|
|
|
$tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
|
2000-08-21 07:15:45 +02:00
|
|
|
$t->set_var("tr_color",$tr_color);
|
2000-08-18 05:24:22 +02:00
|
|
|
|
2000-09-26 00:27:40 +02:00
|
|
|
$lastname = $phpgw->db->f("account_lastname");
|
|
|
|
$firstname = $phpgw->db->f("account_firstname");
|
2000-08-18 05:24:22 +02:00
|
|
|
|
|
|
|
if (! $lastname) $lastname = ' ';
|
|
|
|
if (! $firstname) $firstname = ' ';
|
|
|
|
|
2000-08-21 07:15:45 +02:00
|
|
|
$t->set_var("row_firstname",$firstname);
|
|
|
|
$t->set_var("row_lastname",$lastname);
|
2000-09-26 00:27:40 +02:00
|
|
|
$t->set_var("row_edit",'<a href="'.$phpgw->link("editaccount.php","account_id="
|
|
|
|
. $phpgw->db->f("account_id")) . '"> ' . lang("Edit") . ' </a>');
|
2000-08-21 07:15:45 +02:00
|
|
|
|
2000-09-27 11:05:02 +02:00
|
|
|
if ($phpgw_info["user"]["userid"] != $phpgw->db->f("account_lid")) {
|
2000-09-26 00:27:40 +02:00
|
|
|
$t->set_var("row_delete",'<a href="' . $phpgw->link("deleteaccount.php",'account_id='
|
|
|
|
. $phpgw->db->f("account_id")) . '"> '.lang("Delete").' </a>');
|
2000-08-21 07:15:45 +02:00
|
|
|
} else {
|
|
|
|
$t->set_var("row_delete"," ");
|
|
|
|
}
|
|
|
|
|
2000-09-26 00:27:40 +02:00
|
|
|
$t->set_var("row_view",'<a href="' . $phpgw->link("viewaccount.php", "account_id="
|
|
|
|
. $phpgw->db->f("account_id")) . '"> ' . lang("View") . ' </a>');
|
2000-08-21 07:15:45 +02:00
|
|
|
|
2000-08-22 02:58:29 +02:00
|
|
|
if ($phpgw->db->num_rows() == 1) {
|
|
|
|
$t->set_var("output","");
|
|
|
|
}
|
2000-08-21 07:15:45 +02:00
|
|
|
if ($phpgw->db->num_rows() != ++$i) {
|
|
|
|
$t->parse("output","row",True);
|
|
|
|
}
|
2000-08-18 05:24:22 +02:00
|
|
|
}
|
2000-08-19 08:17:20 +02:00
|
|
|
|
2000-09-03 22:25:31 +02:00
|
|
|
$t->set_var("actionurl",$phpgw->link("newaccount.php"));
|
2000-09-07 22:49:55 +02:00
|
|
|
$t->set_var("lang_add",lang("add"));
|
|
|
|
$t->set_var("lang_search",lang("search"));
|
2000-08-21 07:15:45 +02:00
|
|
|
|
|
|
|
$t->pparse("out","footer");
|
2000-08-18 05:24:22 +02:00
|
|
|
|
|
|
|
include($phpgw_info["server"]["api_dir"] . "/footer.inc.php");
|
2000-09-28 04:25:19 +02:00
|
|
|
?>
|