TRUE, 'templateadd'=>TRUE, 'templateedit'=>TRUE, 'templatelist'=>TRUE, ); /** * Show a list of emails */ public function action_list() { $elo = ORM::factory('email_log'); Block::add(array( 'title'=>_('System Emails Sent'), 'body'=>Table::display( $elo->find_all(), 25, array( 'id'=>array('label'=>'ID','url'=>'user/email/view/'), 'date_orig'=>array('label'=>'Date'), 'email'=>array('label'=>'To'), 'translate_resolve("subject")'=>array('label'=>'Subject'), 'account->accnum()'=>array('label'=>'Cust ID'), 'account->name()'=>array('label'=>'Customer'), ), array( 'page'=>TRUE, 'type'=>'select', 'form'=>'user/email/view', )), )); } /** * List our defined email templates */ public function action_templatelist() { $eto = ORM::factory('email_template'); $output = ''; $output .= View::factory('email/admin/template/list_head'); foreach ($eto->find_all() as $et) { $output .= View::factory('email/admin/template/list_body') ->set('template',$et); } $output .= View::factory('email/admin/template/list_foot'); Block::add(array( 'title'=>_('Available Email Templates'), 'body'=>$output, )); } /** * Add a template */ public function action_templateadd() { $eto = ORM::factory('email_template'); $output = ''; if ($_POST AND $eto->values($_POST)->check()) { // @todo To update the setup ID $eto->email_setup_id=1; // Entry updated if ($eto->save()) { $x = $eto->email_template_translate->values($_POST['translate']['new']); $x->email_template_id = $eto->id; if ($x->check()) $x->save(); } } $output .= Form::open(); $output .= View::factory('email/admin/template/add'); $output .= View::factory('email/admin/template/translate/add'); $output .= '