From 29ca6287d175fa8d42f5a9e27e35a83466a5fed3 Mon Sep 17 00:00:00 2001 From: jengo Date: Wed, 22 Nov 2000 05:31:20 +0000 Subject: [PATCH] Converted viewaccount over to templates --- admin/accounts.php | 4 +- admin/templates/default/account_view.tpl | 14 +++ admin/templates/default/account_view_row.tpl | 8 ++ admin/viewaccount.php | 121 ++++++++----------- 4 files changed, 77 insertions(+), 70 deletions(-) create mode 100644 admin/templates/default/account_view.tpl create mode 100644 admin/templates/default/account_view_row.tpl diff --git a/admin/accounts.php b/admin/accounts.php index fa4003786b..89be080393 100755 --- a/admin/accounts.php +++ b/admin/accounts.php @@ -56,8 +56,8 @@ $account_id = $account["account_id"]; $loginid = $account["account_lid"]; - $phpgw->templater_color = $phpgw->nextmatchs->alternate_row_color($phpgw->templater_color); - $phpgw->template->set_var("tr_color",$phpgw->templater_color); + $tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color); + $phpgw->template->set_var("tr_color",$tr_color); // $lastname = $account["account_lastname"]; // $firstname = $account["account_firstname"]; diff --git a/admin/templates/default/account_view.tpl b/admin/templates/default/account_view.tpl new file mode 100644 index 0000000000..7d52cb6a01 --- /dev/null +++ b/admin/templates/default/account_view.tpl @@ -0,0 +1,14 @@ + + +
+

+ + + + + + {rows} +
 
+

+ + diff --git a/admin/templates/default/account_view_row.tpl b/admin/templates/default/account_view_row.tpl new file mode 100644 index 0000000000..8ef51a3dac --- /dev/null +++ b/admin/templates/default/account_view_row.tpl @@ -0,0 +1,8 @@ + + + + {lable}  + {value}  + + + diff --git a/admin/viewaccount.php b/admin/viewaccount.php index 39eac23237..572429e512 100755 --- a/admin/viewaccount.php +++ b/admin/viewaccount.php @@ -16,7 +16,9 @@ if (! $account_id) { $phpgw_info["flags"] = array("nonavbar" => True, "noheader" => True); } - $phpgw_info["flags"]["currentapp"] = "admin"; + + $phpgw_info["flags"]["enable_nextmatchs_class"] = True; + $phpgw_info["flags"]["currentapp"] = "admin"; $phpgw_info["flags"]["parent_page"] = "accounts.php"; include("../header.inc.php"); @@ -27,12 +29,28 @@ Header("Location: " . $phpgw->link("accounts.php")); } + function display_row($lable,$value) + { + global $phpgw, $tr_color; + + $tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color); + + $phpgw->template->set_var("tr_color",$tr_color); + $phpgw->template->set_var("lable",$lable); + $phpgw->template->set_var("value",$value); + + $phpgw->template->parse("rows","row",True); + } + + $phpgw->template->set_file(array("display" => "account_view.tpl", + "row" => "account_view_row.tpl")); + $userData = $phpgw->accounts->read_userData($account_id); $loginid = $userData["account_lid"]; $account_lastlogin = $userData["account_lastlogin"]; $account_lastloginfrom = $userData["account_lastloginfrom"]; - $account_status = $userData["account_status"]; + $account_status = $userData["account_status"]; $db_perms = $phpgw->accounts->read_apps($loginid); @@ -46,79 +64,46 @@ #$phpgw->db->query("select account_lastlogin,account_lastloginfrom,account_status from accounts " # . "where account_id='$account_id'"); #$phpgw->db->next_record(); - - ?> -
-

+ $phpgw->template->set_var("th_bg",$phpgw_info["theme"]["th_bg"]); - "> - - + display_row(lang("LoginID"),$loginid); + display_row(lang("First Name"),$userData["firstname"]); + display_row(lang("Last Name"),$userData["lastname"]); - "> - - - + $i = 0; + while ($permission = each($db_perms)) { + if ($phpgw_info["apps"][$permission[0]]["enabled"]) { + $perm_display[$i] = lang($phpgw_info["apps"][$permission[0]]["title"]); + $i++; + } + } + display_row(lang("account permissions"),implode(", ", $perm_display)); - "> - - - + if ($userData["status"] == "A") { + $account_status = lang("yes"); + } else { + $account_status = "" . lang("no") . ""; + } + display_row(lang("account active"),$account_status); - "> - - - - - "> - - accounts->read_group_names($userData["account_lid"]); + for ($i=0;$i" . implode(", ", $perm_display) . ""; + if (! $userData["lastlogin"]) { + $lastlogin = lang("Never"); + } else { + $lastlogin = $phpgw->common->show_date($userData["lastlogin"]); + } + display_row(lang("Last login"),$lastlogin); + display_row(lang("Last login from"),$userData["lastloginfrom"]); - echo " - "> - - - - "> - - "> - - - -
 
 
 
 
" - . lang("account active") . " "; - if ($userData["status"] == "A") - echo lang("yes"); - else - echo "" . lang("no") . ""; - - ?>
Groups: accounts->read_group_names($userData["account_lid"]); - for ($i=0;$i 
Last login common->show_date($userData["lastlogin"]); - - ?>
Last login from 
-

-template->pparse("out","display"); $phpgw->common->phpgw_footer(); ?>