~katiekitty/+junk/solidstate

« back to all changes in this revision

Viewing changes to solidstate/branches/v0.5 Alpha/widgets/AccountTableWidget.class.php

  • Committer: root
  • Date: 2010-01-13 07:44:31 UTC
  • Revision ID: root@ds3-vamp.cs-monitor.cz.cc-20100113074431-kt8ceoeznpjg22x7
Reviving the project

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
/**
 
3
 * AccountTableWidget.class.php
 
4
 *
 
5
 * This file contains the definition of the AccountTableWidget class.  
 
6
 *
 
7
 * @package SolidWorks
 
8
 * @author John Diamond <jdiamond@solid-state.org>
 
9
 * @copyright John Diamond <jdiamond@solid-state.org>
 
10
 * @license http://www.opensource.org/licenses/gpl-license.php GNU Public License
 
11
 */
 
12
 
 
13
/**
 
14
 * AccountTableWidget
 
15
 *
 
16
 * @package SolidWorks
 
17
 * @author John Diamond <jdiamond@solid-state.org>
 
18
 */
 
19
class AccountTableWidget extends TableWidget
 
20
{
 
21
  /**
 
22
   * @var string Account status filter
 
23
   */
 
24
  private $statusFilter = null;
 
25
 
 
26
  /**
 
27
   * Initialize the Table
 
28
   *
 
29
   * @param array $params Parameters from the {form_table} tag
 
30
   */
 
31
  public function init( $params ) 
 
32
  { 
 
33
    parent::init( $params );
 
34
 
 
35
    // Build an account filter
 
36
    $where = isset( $this->statusFilter ) ? 
 
37
      sprintf( "status='%s'", $this->statusFilter ) : null;
 
38
 
 
39
    // Load the Account Table
 
40
    try
 
41
      {
 
42
        $accounts = load_array_AccountDBO( $where );
 
43
        // Build the table
 
44
        foreach( $accounts as $dbo )
 
45
          {
 
46
            // Put the row into the table
 
47
            $this->data[] = 
 
48
              array( "id" => $dbo->getID(),
 
49
                     "accountname" => $dbo->getAccountName(),
 
50
                     "type" => $dbo->getType(),
 
51
                     "status" => $dbo->getStatus(),
 
52
                     "balance" => $dbo->getBalance(),
 
53
                     "billingstatus" => $dbo->getBillingStatus(),
 
54
                     "billingday" => $dbo->getBillingDay(),
 
55
                     "businessname" => $dbo->getBusinessName(),
 
56
                     "contactname" => $dbo->getContactName(),
 
57
                     "contactemail" => $dbo->getContactEmail() );
 
58
          }
 
59
      }
 
60
    catch( DBNoRowsFoundException $e ) {}
 
61
  }
 
62
 
 
63
  /**
 
64
   * Set Account Status Filter
 
65
   *
 
66
   * @param string $status Account status
 
67
   */
 
68
  public function setStatus( $status )
 
69
  {
 
70
    $this->statusFilter = $status;
 
71
  }
 
72
}
 
 
b'\\ No newline at end of file'