Minor work on ADSL/Domain/Hosting and other minor fixes

This commit is contained in:
Deon George
2011-10-11 10:38:21 +11:00
parent 0f45467ec8
commit 50a096e22a
12 changed files with 110 additions and 28 deletions

View File

@@ -23,6 +23,9 @@ class Model_Product extends ORMOSB {
);
protected $_display_filters = array(
'active'=>array(
array('StaticList_YesNo::display',array(':value')),
),
'price_type'=>array(
array('StaticList_PriceType::display',array(':value')),
),
@@ -43,6 +46,7 @@ class Model_Product extends ORMOSB {
/**
* Get the product name, after translating
* @todo This needs to be improved to find the right language item.
*/
public function name() {
return $this->product_translate->find()->display('name');

View File

@@ -1,56 +0,0 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class supports ADSL products
*
* @package OSB
* @subpackage Product/ADSL
* @category Models
* @author Deon George
* @copyright (c) 2010 Open Source Billing
* @license http://dev.osbill.net/license.html
*/
class Model_Product_Plugin_ADSL extends Model_Product_Plugin {
protected $_table_name = 'adsl_plan';
protected $_belongs_to = array(
'adsl_supplier_plan'=>array(),
);
protected $_display_filters = array(
'extra_down_peak'=>array(
array('Tax::add',array(':value')),
array('Currency::display',array(':value')),
),
'extra_down_offpeak'=>array(
array('Tax::add',array(':value')),
array('Currency::display',array(':value')),
),
);
// Our required abstract methods
public function feature_summary() {
// @todo This view should render based on the the results of this::allowance();
return View::factory('product/plugin/adsl/feature_summary')
->set('po',$this);
}
/**
* Show the ADSL allowance as a peak/offpeak metric
*/
public function allowance($string=TRUE) {
$output = ADSL::allowance(array(
'base_down_peak'=>$this->base_down_peak,
'base_down_offpeak'=>$this->base_down_offpeak,
'base_up_peak'=>$this->base_up_peak,
'base_up_offpeak'=>$this->base_up_offpeak,
'extra_down_peak'=>$this->extra_down_peak,
'extra_down_offpeak'=>$this->extra_down_offpeak,
'extra_up_peak'=>$this->extra_up_peak,
'extra_up_offpeak'=>$this->extra_up_offpeak,
));
return $string ? implode('/',$output) : $output;
}
}
?>

View File

@@ -1,41 +0,0 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class supports DOMAIN products
*
* @package OSB
* @subpackage Product/Domain
* @category Models
* @author Deon George
* @copyright (c) 2010 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 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->where('status','=','1')->find_all(),
25,
array(
'display("name")'=>array('label'=>'TLD Suffix'),
),
array(
));
$output .= '</td></tr></table>';
return $output;
}
}
?>

View File

@@ -1,25 +0,0 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class supports Host products
*
* @package OSB
* @subpackage Product/Host
* @category Models
* @author Deon George
* @copyright (c) 2010 Open Source Billing
* @license http://dev.osbill.net/license.html
*/
class Model_Product_Plugin_Host extends Model_Product_Plugin {
// @todo This model doesnt have a database table
public function __construct() {
}
// Our required abstract methods
public function feature_summary() {}
// @todo This is not used, but should be.
public function order_features() {
}
}
?>

View File

@@ -1,28 +0,0 @@
<!-- //@todo To translate -->
<table class="box-full">
<tr>
<td style="width: 40%;">Speed</td>
<td class="data" style="width: 60%;" colspan="2"><?php echo $po->display('speed'); ?></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>Peak</td>
<?php if ($po->base_down_offpeak OR $po->extra_down_offpeak) { ?>
<td>Off Peak</td>
<?php } ?>
</tr>
<tr>
<td>Included Download Traffic</td>
<!-- // @todo Since price is stored in the DB in GB, so should the traffic. -->
<td class="data"><?php echo $po->base_down_peak/1000; ?> GB</td>
<td class="data"><?php echo $po->base_down_offpeak ? ($po->base_down_offpeak/1000).'GB' : HTML::nbsp(''); ?></td>
</tr>
<tr>
<td>Extra Download Traffic</td>
<td class="data"><?php echo $po->display('extra_down_peak'); ?>/GB</td>
<td class="data"><?php echo $po->extra_down_offpeak ? $po->display('extra_down_offpeak').'/GB' : HTML::nbsp(''); ?></td>
</tr>
</table>