Added alphabetical ordering to customer.list
[PHPCredLocker.git] / views / Customer / list.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<?php
/** Customer Details View
*
* Copyright (C) 2012 B Tasker
* Released under GNU GPL V2
* See LICENSE
*
*/
defined('_CREDLOCK') or die;
$custom = new CustDB;
 
 
$customers = $custom->getAllCustomers();
$auth = new AuthDB;
$auth->connreuse = 1;
 
$crypt = new Crypto;
$crypt->safety = 0;
 
 
global $notifications;
 
$notifications->setPageTitle("List ".Lang::_('Customers'));
 
$path = array(array('name'=>'Customers','url'=>'index.php?option=viewCustomers'));
 
$notifications->setBreadcrumb($path);
 
 
 
?>
 
<h1>Customers</h1>
<button onclick="window.location.href='index.php?option=addCustomer';" class='btn btn-primary'>Add Customer</button>
<br /><Br />
<table class='credTbl table table-hover' id='CustomerTbl'>
<tr><th>Customer</th><th>Group</th><th></th><th></th></tr>
 
<?php
 
 
 
foreach ($customers as $customer){
 
ob_start();
$cname = $crypt->decrypt($customer->Name,'Customer');
?>
 
<tr id='CustDisp<?php echo $customer->id;?>'>
  <td>
    <a href='index.php?option=viewCust&id=<?php echo $customer->id;?>' title="View Credentials"><?php echo $cname;?></a>
  </td>
  
<td>
      <?php
 
      switch ($customer->Group){
 
              case '0':
              echo "All Users";
              break;
 
              case '-1':
              echo "Super Users";
              break;
 
              default:
              $grp = $auth->retrieveGrpById($cutomer->Group);
              echo $crypt->decrypt($grp->Name,'Group');
        }
?>
</td>
 
 
<td onclick="window.location.href = 'index.php?option=EditCustomer&id=<?php echo $customer->id; ?>';" class='editicon'><i class="icon-pencil"></i></td>
 
  <td class='delicon' onclick="DelCust('<?php echo $customer->id;?>');">
  <i class="icon-remove"></i>
  </td>
</tr>
 
<?php
 
$custs[$cname] = ob_get_clean();
 
}
 
ksort($custs);
echo implode("\n",$custs);
?>
 
</table>
<br />
<button onclick="window.location.href='index.php?option=addCustomer';" class='btn btn-primary'>Add Customer</button>