Misc fixes from live site

This commit is contained in:
Deon George
2013-07-05 16:11:37 +10:00
parent 3499776ddc
commit f3d2c1fe8d
21 changed files with 80 additions and 65 deletions

View File

@@ -37,6 +37,7 @@ class Controller_Reseller_Export extends Controller_Export {
$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()
@@ -74,7 +75,7 @@ class Controller_Reseller_Export extends Controller_Export {
$output .= sprintf('<div class="tab-pane %s" id="tab%s">',$c++ ? '' : 'active',$emo->id);
$output .= Table::factory()
->data($emo->list_export())
->data($emo->list_export($this->request->post('days')))
->jssort($emo->id)
->columns(Arr::merge(array(
'id'=>'ID',

View File

@@ -26,16 +26,19 @@ class Model_Export_Module extends ORM_OSB {
'display',
);
public function list_export() {
public function list_export($days=NULL) {
if (! is_numeric($days))
$days = 90;
$o = $this->module->module();
return $o
return $o
->select(array($this->export_item->table_name().'.date_orig','exported'))
->join($this->export_item->table_name(),'LEFT OUTER')
->on($this->export_item->table_name().'.site_id','=',$o->table_name().'.site_id') // @todo This should be automatic
->on($this->export_item->table_name().'.item_id','=',$o->table_name().'.id')
->on('export_module_id','=',$this->id)
->where($o->table_name().'.date_orig','>=',time()-86400*90)
->where($o->table_name().'.date_orig','>=',time()-86400*$days)
->find_all();
}
}