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

/**
 * This class provides Reseller Email management
 *
 * @package    Email
 * @category   Controllers/Reseller
 * @author     Deon George
 * @copyright  (c) 2009-2013 Open Source Billing
 * @license    http://dev.osbill.net/license.html
 */
class Controller_Reseller_Email extends Controller_Email {
	protected $secure_actions = array(
		'list'=>TRUE,
	);

	/**
	 * Show a list of emails
	 */
	public function action_list() {
		Block::factory()
			->title(_('System Emails Sent'))
			->title_icon('icon-th')
			->body(Table::factory()
				->page_items(25)
				->data(ORM::factory('Email_Log')->where_authorised($this->ao)->find_all())
				->columns(array(
					'id'=>'ID',
					'date_orig'=>'Date',
					'email'=>'To',
					'resolve("subject")'=>'Subject',
					'account->accnum()'=>'Cust ID',
					'account->name()'=>'Customer',
				))
				->prepend(array(
					'id'=>array('url'=>URL::link('user','email/view/')),
				))
				->postproc(array(
					'resolve("subject")'=>array('trim'=>60),
				))
			);
	}
}
?>