This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
khosb/modules/export/classes/Model/Export/Module.php

50 lines
1.3 KiB
PHP
Raw Normal View History

<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class supports OSB exporting.
*
* @package Export
2013-05-28 11:35:54 +00:00
* @category Models
* @author Deon George
* @copyright (c) 2009-2013 Open Source Billing
* @license http://dev.osbill.net/license.html
*/
class Model_Export_Module extends ORM {
protected $_created_column = FALSE;
protected $_updated_column = FALSE;
// Relationships
protected $_belongs_to = array(
'export' => array(),
'module' => array(),
);
protected $_has_many = array(
'export_item' => array('far_key'=>'id'),
);
2014-08-25 04:41:07 +00:00
protected $_compress_column = array(
'display',
);
protected $_nullifempty = array(
'display',
);
2013-07-05 06:11:37 +00:00
public function list_export($days=NULL) {
if (! is_numeric($days))
$days = 90;
$o = $this->module->instance();
2013-07-05 06:11:37 +00:00
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)
2013-07-05 06:11:37 +00:00
->where($o->table_name().'.date_orig','>=',time()-86400*$days)
->find_all();
}
}
?>