2011-09-28 06:46:22 +00:00
|
|
|
<?php defined('SYSPATH') or die('No direct access allowed.');
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This class supports Services
|
|
|
|
*
|
|
|
|
* @package OSB
|
|
|
|
* @subpackage Hosting
|
|
|
|
* @category Models
|
|
|
|
* @author Deon George
|
|
|
|
* @copyright (c) 2010 Open Source Billing
|
|
|
|
* @license http://dev.osbill.net/license.html
|
|
|
|
*/
|
|
|
|
class Model_Service_Plugin_Host extends Model_Service_Plugin {
|
|
|
|
protected $_table_name = 'service__hosting';
|
|
|
|
protected $_created_column = FALSE;
|
|
|
|
protected $_updated_column = FALSE;
|
2012-04-17 10:50:06 +00:00
|
|
|
protected $_serialize_column = array(
|
|
|
|
'server_data_date',
|
|
|
|
);
|
2011-09-28 06:46:22 +00:00
|
|
|
|
|
|
|
// Relationships
|
|
|
|
protected $_has_one = array(
|
|
|
|
'domain_tld'=>array('foreign_key'=>'id','far_key'=>'domain_tld_id'),
|
|
|
|
'host_server'=>array('far_key'=>'host_server_id','foreign_key'=>'id'),
|
|
|
|
);
|
|
|
|
protected $_belongs_to = array(
|
|
|
|
'service'=>array(),
|
|
|
|
);
|
|
|
|
|
|
|
|
protected $_display_filters = array(
|
|
|
|
'domain_name'=>array(
|
|
|
|
array('strtoupper',array(':value')),
|
|
|
|
),
|
|
|
|
'host_expire'=>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
|
|
|
}
|
|
|
|
|
2012-10-08 12:52:21 +00:00
|
|
|
public function expire() {
|
|
|
|
return $this->host_expire;
|
|
|
|
}
|
|
|
|
|
2011-09-28 06:46:22 +00:00
|
|
|
public function name() {
|
|
|
|
return sprintf('%s.%s',$this->display('domain_name'),$this->domain_tld->display('name'));
|
|
|
|
}
|
|
|
|
|
2011-12-29 02:52:24 +00:00
|
|
|
public function service_view() {
|
|
|
|
return View::factory('service/user/plugin/host/view')
|
|
|
|
->set('so',$this);
|
2011-09-28 06:46:22 +00:00
|
|
|
}
|
|
|
|
|
2012-06-22 05:12:59 +00:00
|
|
|
public function username_value() {
|
|
|
|
return $this->host_username;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function password_value() {
|
|
|
|
return $this->host_password;
|
|
|
|
}
|
|
|
|
|
2011-09-28 06:46:22 +00:00
|
|
|
/**
|
|
|
|
* This provides us with a manage button to jump to the hosting server
|
|
|
|
* to manage the domain.
|
|
|
|
*/
|
2012-06-22 05:12:59 +00:00
|
|
|
public function manage_button($t='') {
|
2012-10-22 12:24:28 +00:00
|
|
|
if (! parent::manage_button($t))
|
|
|
|
return NULL;
|
2012-04-17 10:50:06 +00:00
|
|
|
|
2011-12-16 23:31:35 +00:00
|
|
|
// @todo Convert this to a Static_List display
|
|
|
|
if ($this->service->queue == 'PROVISION')
|
|
|
|
return _('To Be Provisioned');
|
|
|
|
|
2012-07-01 00:18:21 +00:00
|
|
|
return ($this->username_value() AND $this->password_value() AND $a=$this->host_server->plugin()) ? $a->manage_button($this,$t) : '';
|
2011-09-28 06:46:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|