Open Source Billing

This commit is contained in:
Deon George
2013-10-10 13:44:53 +11:00
commit b02d70adf0
2344 changed files with 392978 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class supports Domain TLD Registrars
*
* @package Domain
* @category Models
* @author Deon George
* @copyright (c) 2009-2013 Open Source Billing
* @license http://dev.osbill.net/license.html
*/
class Model_Domain_Registrar extends ORM_OSB {
/**
* The button that provides a login to the Registrar to manage the domain license
*/
public function manage_button(Model_Service_Plugin_Domain $spdo,$t) {
$c = sprintf('Service_Domain_%s',$this->file);
if (! class_exists($c))
return '';
$po = new $c($this->id);
return $po->manage_button($spdo,$t);
}
}
?>

View File

@@ -0,0 +1,19 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class supports Domain TLD
*
* @package Domain
* @category Models
* @author Deon George
* @copyright (c) 2009-2013 Open Source Billing
* @license http://dev.osbill.net/license.html
*/
class Model_Domain_Tld extends ORM_OSB {
protected $_display_filters = array(
'name'=>array(
array('strtoupper',array(':value')),
),
);
}
?>

View File

@@ -0,0 +1,41 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class supports DOMAIN products
*
* @package Domain
* @category Plugins
* @author Deon George
* @copyright (c) 2009-2013 Open Source Billing
* @license http://dev.osbill.net/license.html
*/
class Model_Product_Plugin_Domain extends Model_Product_Plugin {
// This model doesnt have a database table
public function __construct() {
}
// Our required abstract methods
public function admin_update() {}
public function feature_summary() {}
// @todo This is not used, but should be.
public function order_features() {
$output = '';
$t = ORM::factory('Domain_TLD');
// @todo Change this to a view.
$output = sprintf('<table class="box-full"><tr class="head"><td>%s</td></tr><tr><td>',_('Domains are available with the following suffixes'));
$output .= Table::display(
$t->list_active(),
25,
array(
'display("name")'=>array('label'=>'TLD Suffix'),
),
array(
));
$output .= '</td></tr></table>';
return $output;
}
}
?>

View File

@@ -0,0 +1,83 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class supports Services
*
* @package Domain
* @category Models
* @author Deon George
* @copyright (c) 2009-2013 Open Source Billing
* @license http://dev.osbill.net/license.html
*/
class Model_Service_Plugin_Domain extends Model_Service_Plugin {
protected $_table_name = 'service__domain';
protected $_updated_column = FALSE;
// Relationships
protected $_has_one = array(
'domain_TLD'=>array('foreign_key'=>'id','far_key'=>'domain_tld_id'),
'domain_registrar'=>array('foreign_key'=>'id','far_key'=>'domain_registrar_id'),
'service_plugin_host'=>array('through'=>'service','far_key'=>'service_id','foreign_key'=>'service_id'),
);
protected $_belongs_to = array(
'service'=>array(),
);
protected $_display_filters = array(
'domain_expire'=>array(
array('Config::date',array(':value')),
),
'domain_name'=>array(
array('strtoupper',array(':value')),
),
'registrar_lastsync'=>array(
array('Config::date',array(':value')),
),
);
// Required abstract functions
public function admin_update() {
return '';
}
public function expire() {
return $this->domain_expire;
}
public function name() {
return sprintf('%s.%s',$this->display('domain_name'),$this->domain_TLD->display('name'));
}
public function service_name() {
return sprintf('%s - %s',_('Domain Name License'),$this->name());
}
public function service_view() {
return View::factory('service/user/plugin/domain/view')
->set('so',$this);
}
public function username_value() {
return $this->registrar_username;
}
public function password_value() {
return $this->registrar_password;
}
/**
* This provides us with a manage button to jump to the registrar
* to manage the domain.
*/
public function manage_button($t='') {
if (! parent::manage_button($t))
return NULL;
return ($this->username_value() AND $this->password_value()) ? $this->domain_registrar->manage_button($this,$t) : _('Please contact us');
}
public function manage_dns_button() {
return $this->service_plugin_host->manage_button('service_plugin_host');
}
}
?>