2011-08-27 06:33:46 +00:00
|
|
|
<?php defined('SYSPATH') or die('No direct access allowed.');
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This class provides User Email View functions
|
|
|
|
*
|
2013-03-19 22:35:19 +00:00
|
|
|
* @package Email
|
2011-08-27 06:33:46 +00:00
|
|
|
* @category Controllers/User
|
|
|
|
* @author Deon George
|
2013-03-19 22:35:19 +00:00
|
|
|
* @copyright (c) 2009-2013 Open Source Billing
|
|
|
|
* @license http://dev.osbill.net/license.html
|
2011-08-27 06:33:46 +00:00
|
|
|
*/
|
|
|
|
class Controller_User_Email extends Controller_TemplateDefault_User {
|
|
|
|
protected $secure_actions = array(
|
|
|
|
'list'=>TRUE,
|
|
|
|
'view'=>TRUE,
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Show a list of emails
|
|
|
|
*/
|
|
|
|
public function action_list() {
|
|
|
|
Block::add(array(
|
|
|
|
'title'=>sprintf('%s: %s - %s',_('Email For'),$this->ao->accnum(),$this->ao->name(TRUE)),
|
|
|
|
'body'=>Table::display(
|
|
|
|
$this->ao->email_log->find_all(),
|
|
|
|
25,
|
|
|
|
array(
|
2013-02-12 11:14:59 +00:00
|
|
|
'id'=>array('label'=>'ID','url'=>URL::link('user','email/view/')),
|
2011-08-27 06:33:46 +00:00
|
|
|
'date_orig'=>array('label'=>'Date'),
|
|
|
|
'translate_resolve("subject")'=>array('label'=>'Subject'),
|
|
|
|
),
|
|
|
|
array(
|
|
|
|
'page'=>TRUE,
|
|
|
|
'type'=>'select',
|
2013-02-12 11:14:59 +00:00
|
|
|
'form'=>URL::link('user','email/view'),
|
2011-08-27 06:33:46 +00:00
|
|
|
)),
|
|
|
|
));
|
|
|
|
}
|
|
|
|
|
|
|
|
public function action_view() {
|
2011-12-21 01:39:21 +00:00
|
|
|
list($id,$output) = Table::page(__METHOD__);
|
2011-08-27 06:33:46 +00:00
|
|
|
|
2012-11-09 23:13:57 +00:00
|
|
|
$elo = ORM::factory('Email_Log',$id);
|
2011-08-27 06:33:46 +00:00
|
|
|
|
2013-04-04 22:42:29 +00:00
|
|
|
if (! $elo->loaded() OR ! Auth::instance()->authorised($elo->account)) {
|
2011-08-27 06:33:46 +00:00
|
|
|
$this->template->content = 'Unauthorised or doesnt exist?';
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2011-12-21 01:39:21 +00:00
|
|
|
$output .= View::factory($this->viewpath())
|
2011-08-27 06:33:46 +00:00
|
|
|
->set('elo',$elo);
|
|
|
|
|
|
|
|
Block::add(array(
|
|
|
|
'title'=>sprintf('%s: %s',_('Email'),$elo->translate_resolve('subject')),
|
|
|
|
'body'=>$output,
|
|
|
|
));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|