2011-07-14 09:09:03 +00:00
|
|
|
<?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
|
|
|
|
*/
|
2011-09-28 06:46:22 +00:00
|
|
|
class Model_Product_Plugin_ADSL extends Model_Product_Plugin {
|
2011-07-14 09:09:03 +00:00
|
|
|
protected $_table_name = 'adsl_plan';
|
|
|
|
|
2011-09-28 06:46:22 +00:00
|
|
|
protected $_belongs_to = array(
|
|
|
|
'adsl_supplier_plan'=>array(),
|
2011-07-14 09:09:03 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
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')),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
|
2011-09-28 06:46:22 +00:00
|
|
|
// 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')
|
2011-07-14 09:09:03 +00:00
|
|
|
->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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|