Location: PHPKode > projects > Neobill > NeoBill0.5.6/widgets/ProductPurchaseTableWidget.class.php
<?php
/**
 * ProductPurchaseTableWidget.class.php
 *
 * This file contains the definition of the ProductPurchaseTableWidget class.
 *
 * @package SolidWorks
 * @author John Diamond <hide@address.com>
 * @copyright John Diamond <hide@address.com>
 * @license http://www.opensource.org/licenses/gpl-license.php GNU Public License
 */

/**
 * ProductPurchaseTableWidget
 *
 * @package SolidWorks
 * @author John Diamond <hide@address.com>
 */
class ProductPurchaseTableWidget extends TableWidget {
	/**
	 * @var integer Account ID
	 */
	private $accountID = null;

	/**
	 * Initialize the Table
	 *
	 * @param array $params Parameters from the {form_table} tag
	 */
	public function init( $params ) {
		parent::init( $params );

		// Build an ProductPurchase filter
		$where = isset( $this->accountID ) ?
				sprintf( "accountid='%d'", $this->accountID ) : null;

		// Load the ProductPurchase Table
		try {
			// Build the table
			$purchases = load_array_ProductPurchaseDBO( $where );
			foreach ( $purchases as $dbo ) {
				// Put the row into the table
				$this->data[] =
						array( "id" => $dbo->getID(),
						"productname" => $dbo->getProductName(),
						"note" => $dbo->getNote(),
						"date" => $dbo->getDate(),
						"term" => $dbo->getTerm(),
						"nextbillingdate" => $dbo->getNextBillingDate() );
			}
		}
		catch ( DBNoRowsFoundException $e ) {

		}
	}

	/**
	 * Set Account ID
	 *
	 * @param integer $id Account ID
	 */
	public function setAccountID( $id ) {
		$this->accountID = $id;
	}
}
Return current item: Neobill