2013-10-10 02:44:53 +00:00
|
|
|
<?php defined('SYSPATH') or die('No direct access allowed.');
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This class supports Product Plugins.
|
|
|
|
*
|
2013-11-27 00:22:20 +00:00
|
|
|
* @package Product/Plugin
|
2013-10-10 02:44:53 +00:00
|
|
|
* @category Models
|
|
|
|
* @author Deon George
|
|
|
|
* @copyright (c) 2009-2013 Open Source Billing
|
|
|
|
* @license http://dev.osbill.net/license.html
|
|
|
|
*/
|
|
|
|
abstract class Model_Product_Plugin extends ORM_OSB {
|
|
|
|
// Reset any sorting that may be defined in our parent
|
|
|
|
protected $_sorting = array();
|
|
|
|
|
2013-10-28 23:36:57 +00:00
|
|
|
/**
|
|
|
|
* The cost of this service
|
|
|
|
*/
|
|
|
|
abstract public function cost($annual=FALSE);
|
|
|
|
|
2013-11-14 11:50:35 +00:00
|
|
|
/**
|
|
|
|
* Return the name of the plugin
|
|
|
|
*/
|
|
|
|
protected function plugin() {
|
|
|
|
return strtolower(preg_replace('/(.*)_([a-zA-Z]+)$/',"$2",get_class($this)));
|
|
|
|
}
|
2013-11-27 00:22:20 +00:00
|
|
|
|
2013-11-28 06:41:34 +00:00
|
|
|
/**
|
|
|
|
* Get all the products using this plugin
|
|
|
|
*/
|
|
|
|
public function products($active=FALSE) {
|
|
|
|
$x = ORM::factory('Product')
|
|
|
|
->where('prod_plugin_file','=',$this->plugin())
|
|
|
|
->and_where('prod_plugin_data','=',$this);
|
|
|
|
|
|
|
|
if ($active)
|
|
|
|
$x->where_active();
|
|
|
|
|
|
|
|
return $x->find_all();
|
|
|
|
}
|
|
|
|
|
2013-11-27 00:22:20 +00:00
|
|
|
/**
|
|
|
|
* Form info for admins to update with plugin data
|
|
|
|
*/
|
|
|
|
abstract public function render_edit();
|
|
|
|
|
2013-11-28 06:41:34 +00:00
|
|
|
/**
|
|
|
|
* Form used during service ordering
|
|
|
|
*/
|
|
|
|
public function render_order() {
|
|
|
|
return View::factory(sprintf('product/plugin/%s/order',$this->plugin()));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* View the details of the product
|
|
|
|
*/
|
|
|
|
public function render_view() {
|
|
|
|
return View::factory(sprintf('product/plugin/%s/view',$this->plugin()))->set('o',$this);
|
|
|
|
}
|
2013-11-27 00:22:20 +00:00
|
|
|
|
|
|
|
abstract public function supplier();
|
2013-10-10 02:44:53 +00:00
|
|
|
}
|
|
|
|
?>
|