<?php defined('SYSPATH') or die('No direct access allowed.');

/**
 * This class provides Affiliate Account functions
 *
 * @package    OSB
 * @subpackage Account
 * @category   Controllers/Affiliate
 * @author     Deon George
 * @copyright  (c) 2010 Open Source Billing
 * @license    http://dev.osbill.net/license.html
 */
class Controller_Affiliate_Account extends Controller_TemplateDefault_Affiliate {
	protected $secure_actions = array(
		'list'=>TRUE,
	);

	/**
	 * Show a list of accounts
	 */
	public function action_list() {
		Block::add(array(
			'title'=>_('Customer List'),
			'body'=>Table::display(
				$this->filter(ORM::factory('account')->list_active(),$this->ao->affiliate->id,'sortkey(TRUE)'),
				25,
				array(
					'id'=>array('label'=>'ID','url'=>'user/account/view/'),
					'accnum()'=>array('label'=>'Num'),
					'name(TRUE)'=>array('label'=>'Account'),
					'email'=>array('label'=>'Email'),
					'invoices_due_total(NULL,TRUE)'=>array('label'=>'Invoices','class'=>'right'),
					'count_services(TRUE,'.$this->ao->affiliate->id.')'=>array('label'=>'Services','class'=>'right'),
				),
				array(
					'page'=>TRUE,
					'type'=>'select',
					'form'=>'user/account/view',
				)),
			));
	}
}
?>
