TRUE, 'index'=>TRUE, 'list'=>TRUE, ); /** * Export plugins must define an export action. */ public function action_export() { $this->auto_render = FALSE; if (empty($_POST['export_module_id']) OR ! ($emo = ORM::factory('Export_Module',$_POST['export_module_id'])) OR ! $emo->loaded()) HTTP::redirect(URL::link('reseller','export/index')); $emo->export->plugin($emo)->export($this->response); } /** * Select our primary export target */ public function action_index() { $output = ''; $output .= Form::open(URL::link('reseller','export/list')); $output .= Form::select('eid',ORM::factory('Export')->list_select()); $output .= Form::button('submit','Submit',array('class'=>'btn btn-primary')); $output .= Form::hidden('days',$this->request->param('id')); $output .= Form::close(); Block::factory() ->title('Select Export Target') ->title_icon('icon-share') ->body($output); } /** * 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_list() { if (empty($_POST['eid'])) HTTP::redirect(URL::link('reseller','export/index')); $eo = ORM::factory('Export',$_POST['eid']); if (! $eo->loaded()) HTTP::redirect(URL::link('reseller','export/index')); $c = 0; $output = '
'; $output .= ''; $c = 0; $output .= '
'; foreach ($eo->export_module->find_all() as $emo) { $output .= sprintf('
',$c++ ? '' : 'active',$emo->id); $output .= Table::factory() ->data($emo->list_export($this->request->post('days'))) ->jssort($emo->id) ->columns(Arr::merge(array( 'id'=>'ID', 'account->name(TRUE)'=>'Account', 'date_orig'=>'Date', 'status'=>'Active', 'total(TRUE)'=>'Total', 'exported'=>'Exported', ),$emo->display ? $emo->display : array())) ->select(URL::link('reseller','export/export'),$emo->id,array('export_module_id'=>$emo->id)) ->prepend(array( 'id'=>array('checkbox'=>'id[]'), ))->filters(array( 'exported'=>array(array('Config::date',array(':value'))), )); $output .= '
'; } $output .= '
'; Block::factory() ->title('Export Transactions') ->title_icon('icon-share') ->body($output); } } ?>