Skip to content

Commit 0fa20fe

Browse files
committed
Draft an info tab for the client page #5372
1 parent 06a08d8 commit 0fa20fe

File tree

5 files changed

+54
-6
lines changed

5 files changed

+54
-6
lines changed

interface/web/client/client_edit.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,30 @@ function onShowNew() {
7373
parent::onShowNew();
7474
}
7575

76+
function onShowEdit() {
77+
global $app, $conf;
78+
chdir('../dashboard');
79+
80+
$dashlet_list = array();
81+
$dashlets = array('databasequota.php', 'limits.php', 'mailquota.php', 'quota.php');
82+
$current_client_id = $this->id;
83+
84+
foreach ($dashlets as $file) {
85+
if ($file != '.' && $file != '..' && !is_dir(ISPC_WEB_PATH.'/dashboard/dashlets/'.$file)) {
86+
$dashlet_name = substr($file, 0, -4);
87+
$dashlet_class = 'dashlet_'.$dashlet_name;
88+
include_once ISPC_WEB_PATH.'/dashboard/dashlets/'.$file;
89+
$dashlet_list[$dashlet_name] = new $dashlet_class;
90+
$dashlets_html .= $dashlet_list[$dashlet_name]->show($current_client_id);
91+
}
92+
}
93+
$app->tpl->setVar('dashlets', $dashlets_html);
94+
95+
chdir('../client');
96+
97+
parent::onShowEdit();
98+
}
99+
76100

77101
function onSubmit() {
78102
global $app, $conf;

interface/web/client/form/client.tform.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
$form["db_table_idx"] = "client_id";
4747
$form["db_history"] = "yes";
4848
$form["tab_default"] = "address";
49+
$form["tab_default"] = "info";
4950
$form["list_default"] = "client_list.php";
5051
$form["auth"] = 'yes';
5152

@@ -80,6 +81,12 @@
8081
}
8182
}
8283

84+
$form["tabs"]['info'] = array (
85+
'title' => "Info",
86+
'width' => 100,
87+
'template' => "templates/client_edit_info.htm",
88+
'fields' => array ()
89+
);
8390
$form["tabs"]['address'] = array (
8491
'title' => "Address",
8592
'width' => 100,

interface/web/dashboard/dashlets/databasequota.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
class dashlet_databasequota {
44

5-
function show() {
5+
function show($limit_to_client_id = 0) {
66
global $app;
77

88
//* Loading Template
@@ -15,8 +15,13 @@ function show() {
1515
$lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_dashlet_databasequota.lng';
1616
if(is_file($lng_file)) include $lng_file;
1717
$tpl->setVar($wb);
18+
if ($limit_to_client_id == 0 || $_SESSION["s"]["user"]["typ"] != 'admin') {
19+
$client_id = $_SESSION['s']['user']['client_id'];
20+
} else {
21+
$client_id = $limit_to_client_id;
22+
}
1823

19-
$databases = $app->quota_lib->get_databasequota_data( ($_SESSION["s"]["user"]["typ"] != 'admin') ? $_SESSION['s']['user']['client_id'] : null);
24+
$databases = $app->quota_lib->get_databasequota_data($client_id);
2025
//print_r($databases);
2126

2227
$has_databasequota = false;

interface/web/dashboard/dashlets/mailquota.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
class dashlet_mailquota {
44

5-
function show() {
5+
function show($limit_to_client_id = 0) {
66
global $app;
77

88
//* Loading Template
@@ -16,7 +16,13 @@ function show() {
1616
if(is_file($lng_file)) include $lng_file;
1717
$tpl->setVar($wb);
1818

19-
$emails = $app->quota_lib->get_mailquota_data( ($_SESSION["s"]["user"]["typ"] != 'admin') ? $_SESSION['s']['user']['client_id'] : null);
19+
if ($limit_to_client_id == 0 || $_SESSION["s"]["user"]["typ"] != 'admin') {
20+
$client_id = $_SESSION['s']['user']['client_id'];
21+
} else {
22+
$client_id = $limit_to_client_id;
23+
}
24+
25+
$emails = $app->quota_lib->get_mailquota_data($client_id);
2026
//print_r($emails);
2127

2228
$has_mailquota = false;

interface/web/dashboard/dashlets/quota.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
class dashlet_quota {
44

5-
function show() {
5+
function show($limit_to_client_id = 0) {
66
global $app;
77

88
//* Loading Template
@@ -16,7 +16,13 @@ function show() {
1616
if(is_file($lng_file)) include $lng_file;
1717
$tpl->setVar($wb);
1818

19-
$sites = $app->quota_lib->get_quota_data( ($_SESSION["s"]["user"]["typ"] != 'admin') ? $_SESSION['s']['user']['client_id'] : null);
19+
if ($limit_to_client_id == 0 || $_SESSION["s"]["user"]["typ"] != 'admin') {
20+
$client_id = $_SESSION['s']['user']['client_id'];
21+
} else {
22+
$client_id = $limit_to_client_id;
23+
}
24+
25+
$sites = $app->quota_lib->get_quota_data($client_id);
2026
//print_r($sites);
2127

2228
$has_quota = false;

0 commit comments

Comments
 (0)