Zeige vmail-Quota im Webinterface an
bernd

bernd commited on 2011-04-22 10:18:16
Zeige 2 geänderte Dateien mit 6 Einfügungen und 2 Löschungen.


git-svn-id: https://svn.schokokeks.org/repos/tools/webinterface/trunk@1983 87cf0b9e-d624-0410-a070-f6ee81989793
... ...
@@ -26,7 +26,7 @@ function get_account_details($id, $checkuid = true)
26 26
 	$id = (int) $id;
27 27
 	$uid = (int) $_SESSION['userinfo']['uid'];
28 28
 	$uid_check = ($checkuid ? "useraccount='{$uid}' AND " : "");
29
-	$result = db_query("SELECT id, local, domain, password, spamfilter, forwards from mail.v_vmail_accounts WHERE {$uid_check}id={$id} LIMIT 1");
29
+	$result = db_query("SELECT id, local, domain, password, spamfilter, forwards, quota, quota_used from mail.v_vmail_accounts WHERE {$uid_check}id={$id} LIMIT 1");
30 30
 	if (mysql_num_rows($result) == 0)
31 31
 		system_failure('Ungültige ID oder kein eigener Account');
32 32
 	$acc = empty_account();
... ...
@@ -64,6 +64,10 @@ if (count($sorted_by_domains) > 0)
64 64
 	      DEBUG($acc);
65 65
 	      if ($acc['password'] != '')
66 66
 	      {
67
+                $percent = round(( $acc["quota_used"] / $acc["quota"] ) * 100 );
68
+                $color = ( $percent > 95 ? 'red' : ($percent > 75 ? "yellow" : "green" ));
69
+                $width = 2 * min($percent, 100);
70
+                $quotachart = "<div style=\"margin: 2px 0; padding: 0; width: 200px; border: 1px solid black;\"><div style=\"font-size: 1px; background-color: {$color}; height: 10px; width: {$width}px; margin: 0; padding: 0;\">&#160;</div></div> {$acc['quota_used']} MB von {$acc['quota']} MB belegt";
67 71
 	      	$spam = 'ohne Spamfilter';
68 72
 	        switch ($acc['spamfilter'])
69 73
 	  	{
... ...
@@ -74,7 +78,7 @@ if (count($sorted_by_domains) > 0)
74 78
 			case 'delete':	$spam = 'Spam nicht zustellen';
75 79
 					break;
76 80
 	        }
77
-	        array_push($actions, "Ablegen in Mailbox ({$spam})");
81
+	        array_push($actions, "Ablegen in Mailbox ({$spam})<br />".$quotachart);
78 82
 	      }
79 83
 	      foreach ($acc['forwards'] AS $fwd)
80 84
 	      {
81 85