Browse code

Zeige letzte Aktivität bei Jabber-Accounts. Und zeige Warnung wenn Account noch nicht aktiv ist

git-svn-id: https://svn.schokokeks.org/repos/tools/webinterface/trunk@2177 87cf0b9e-d624-0410-a070-f6ee81989793

bernd authored on08/02/2012 14:07:19
Showing2 changed files
... ...
@@ -18,6 +18,18 @@ output("<table>");
18 18
 
19 19
 foreach ($jabberaccounts as $acc)
20 20
 {
21
+  $not_ready = '';
22
+  if ($acc['create'] == 1) {
23
+    $not_ready = " ".icon_warning('Dieser Account wird in Kürze auf dem Server eingerichtet.');
24
+  }
25
+  $lastactivity = $acc['lastactivity'];
26
+  // Innerhalb der letzten Woche verwendet
27
+  if ($lastactivity > strftime('%Y-%m-%d', time()-7*24*60*60)) {
28
+    $lastactivity = 'Kürzlich';
29
+  }
30
+  if (! $lastactivity) {
31
+    $lastactivity = 'Bisher nie verwendet';
32
+  }
21 33
   $local = filter_input_general($acc['local']);
22 34
   $domain = new Domain( (int) $acc['domain']  );
23 35
   if ($domain->id == NULL)
... ...
@@ -25,7 +37,7 @@ foreach ($jabberaccounts as $acc)
25 37
     $domain = new Domain();
26 38
     $domain->fqdn = config('masterdomain');
27 39
   }
28
-  output("<tr><td>{$local}@{$domain->fqdn}</td><td>".internal_link('chpass', icon_pwchange('Passwort ändern'), 'account='.$acc['id'])."&#160;&#160;&#160;".internal_link('save', icon_delete("»{$local}@{$domain->fqdn}« löschen"), 'action=delete&account='.$acc['id']).'</td></tr>');
40
+  output("<tr><td>{$local}@{$domain->fqdn}{$not_ready}<br /><span style=\"font-size: 80%; font-style: italic;\">Letzte Nutzung: {$lastactivity}</span></td><td>".internal_link('chpass', icon_pwchange('Passwort ändern'), 'account='.$acc['id'])."&#160;&#160;&#160;".internal_link('save', icon_delete("»{$local}@{$domain->fqdn}« löschen"), 'action=delete&account='.$acc['id']).'</td></tr>');
29 41
 }
30 42
 
31 43
 output('</table>');
... ...
@@ -9,11 +9,11 @@ require_once('class/domain.php');
9 9
 function get_jabber_accounts() {
10 10
   require_role(ROLE_CUSTOMER);
11 11
   $customerno = (int) $_SESSION['customerinfo']['customerno'];
12
-  $result = db_query("SELECT id, created, local, domain FROM jabber.accounts WHERE customerno='$customerno' AND `delete`=0;");
12
+  $result = db_query("SELECT id, `create`, created, lastactivity, local, domain FROM jabber.accounts WHERE customerno='$customerno' AND `delete`=0;");
13 13
   $accounts = array();
14 14
   if (@mysql_num_rows($result) > 0)
15
-    while ($acc = @mysql_fetch_object($result))
16
-      array_push($accounts, array('id'=> $acc->id, 'created' => $acc->created, 'local' => $acc->local, 'domain' => $acc->domain));
15
+    while ($acc = @mysql_fetch_assoc($result))
16
+      array_push($accounts, $acc);
17 17
   return $accounts;
18 18
 }
19 19