TRUE, 'export'=>TRUE, ); /** * Export plugins must define an export action. */ public function action_export() { if (empty($_POST['plugin'])) $this->request->redirect('affiliate/export'); $sc = sprintf('Export_%s',$_POST['plugin']); if (! class_exists($sc)) throw new Kohana_Exception('Export Class doesnt exist for :plugin',array(':plugin'=>$_POST['plugin'])); else $export = new $sc; // @todo: Need to limit this to affiliate acounts $export->export(); } /** * This is the main call to export, providing a list of items to export and * setting up the page to call the export plugin when submitted. */ public function action_index($daysago) { // @todo this should come from a file list $TBRexportplugins = array('quicken'=>'Export to Quicken'); if (! $daysago) $daysago = 30; // @todo: Need to limit this to affiliate acounts $payments = ORM::factory('payment') ->export($daysago); if (count($payments)) { $output = Form::open(Request::current()->uri(array('action'=>'export'))); $output .= ''; $output .= View::factory('export/payment/header') ->set('plugins',$TBRexportplugins); $i = 0; foreach ($payments as $payment) { $output .= View::factory('export/payment/body') ->set('payment',$payment) ->set('i',$i++%2); } $output .= '
'; $output .= Form::submit('submit','export',array('class'=>'form_button')); $output .= Form::close(); Style::add(array( 'type'=>'file', 'data'=>'css/list.css', )); Block::add(array( 'title'=>_('Payments to Export'), 'body'=>$output, )); # Nothing to export } else { SystemMessage::add(array( 'title'=>_('No payments to export'), 'type'=>'info', 'body'=>sprintf(_('There are no payments within the last %s days (since %s) to show.'), $daysago,date(Kohana::config('osb')->get('date_format'),$daysago*86400+time())), )); } } } ?>