2011-09-28 06:46:22 +00:00
|
|
|
<?php defined('SYSPATH') or die('No direct access allowed.');
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This class supports Services
|
|
|
|
*
|
|
|
|
* @package OSB
|
|
|
|
* @subpackage DOMAIN
|
|
|
|
* @category Models
|
|
|
|
* @author Deon George
|
|
|
|
* @copyright (c) 2010 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_ns'=>array(
|
|
|
|
array('Domain::NS',array(':model')),
|
|
|
|
),
|
|
|
|
'registrar_lastsync'=>array(
|
|
|
|
array('Config::date',array(':value')),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
|
|
|
|
// Required abstract functions
|
2011-12-29 02:52:24 +00:00
|
|
|
public function admin_update() {
|
|
|
|
return '';
|
2011-09-28 06:46:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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());
|
|
|
|
}
|
|
|
|
|
2011-12-29 02:52:24 +00:00
|
|
|
public function service_view() {
|
|
|
|
return View::factory('service/user/plugin/domain/view')
|
|
|
|
->set('so',$this);
|
2011-09-28 06:46:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This provides us with a manage button to jump to the registrar
|
|
|
|
* to manage the domain.
|
|
|
|
*/
|
|
|
|
public function manage_button() {
|
|
|
|
return ($this->registrar_username AND $this->registrar_password) ? $this->domain_registrar->manage_button($this->registrar_username,$this->registrar_password,$this->name()) : _('Please contact us');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function manage_dns_button() {
|
|
|
|
return $this->service_plugin_host->manage_button();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|