Fixed ADSL traffic collection, and migrated Task to Minion

This commit is contained in:
Deon George
2013-06-01 23:43:31 +10:00
parent d4168146ee
commit 1a40f95b30
10 changed files with 115 additions and 126 deletions

View File

@@ -63,7 +63,7 @@ class Controller_Admin_Product extends Controller_Product {
$pco = ORM::factory('Product_Category',$this->request->param('id'));
if (! $pco->loaded())
HTTP::redirect('welcome/index');
HTTP::redirect(URL::link('admin','product/list'));
if ($_POST)
$pco->values($_POST)->save();

View File

@@ -13,7 +13,6 @@
* + price_type: 0=One Time, 1=Recurring, 2=Trial
*/
class Model_Product extends ORM_OSB {
// @todo this doesnt have our site_id when getting the translation
protected $_has_many = array(
'product_translate'=>array('far_key'=>'id'),
'service'=>array('far_key'=>'id'),
@@ -42,7 +41,6 @@ class Model_Product extends ORM_OSB {
// Our attributes that are arrays, we'll convert/unconvert them
protected $_serialize_column = array(
'avail_category',
'price_group',
);
@@ -55,6 +53,34 @@ class Model_Product extends ORM_OSB {
return $x->loaded() ? $x->display($full ? 'description_full' : 'description_short') : 'No Description';
}
/**
* This will render the product feature summary information
*/
public function feature_summary() {
return (is_null($plugin = $this->plugin())) ? HTML::nbsp('') : $plugin->feature_summary();
}
/**
* Is price shown for a specific period
*
* @param $p int recurring schedule period
*/
public function is_price_shown($p) {
$x = $this->keyget('price_group',$p);
return (isset($x['show']) AND $x['show']) ? TRUE : FALSE;
}
/**
* Test if the product is a TRIAL product
* (price_type == 2)
*
* @return boolean
*/
public function is_trial() {
return ($this->price_type == 2) ? TRUE : FALSE;
}
/**
* Return the object of the product plugin
*/
@@ -114,18 +140,8 @@ class Model_Product extends ORM_OSB {
return $x->loaded() ? $x->display('name') : 'No Title';
}
/**
* Which categories is this product available in
*/
public function categories() {
return $this->avail_category;
}
/**
* This will render the product feature summary information
*/
public function feature_summary() {
return (is_null($plugin = $this->plugin())) ? HTML::nbsp('') : $plugin->feature_summary();
public function list_type($type) {
return $this->where('prod_plugin_file','=',$type)->find_all();
}
/**
@@ -133,9 +149,6 @@ class Model_Product extends ORM_OSB {
* @todo This needs to be tested with more than one price group enabled
*/
public function get_price_array() {
if (! $this->loaded())
throw new Kohana_Exception('Call to :method where no object loaded?',array(':method'=>__METHOD__));
// Figure out our eligable groups
// @todo Need to work out our default groups elsewhere, not in product
// All users are members of the all user group "0"
@@ -164,34 +177,6 @@ class Model_Product extends ORM_OSB {
return $price ? $price : array('0'=>array('price_base'=>0,'price_setup'=>0));
}
/**
* Test if the product is a TRIAL product
* (price_type == 2)
*
* @return boolean
*/
public function is_trial() {
if ($this->price_type == 2)
return TRUE;
else
return FALSE;
}
public function show_thumb() {
$mediapath = Route::get('default/media');
$thumbfile = sprintf('prod_thmb_%s',$this->id);
// @todo This needs to be optimised. By nice if find_files could return the HTML path too.
if (Kohana::find_file('media/img/thumbnails',$thumbfile,'png')) {
$thumb = $mediapath->uri(array('file'=>'img/thumbnails/'.$thumbfile.'.png'));
// @todo Change the ALT to the product name.
echo HTML::image($thumb,array('alt'=>_('Thumb Nail')));
} else
echo '';
}
/**
* Enable the plugin to store data
*/
@@ -202,15 +187,6 @@ class Model_Product extends ORM_OSB {
return $plugin->admin_update();
}
/**
* Is price shown for a specific period
*/
public function isPriceShown($p) {
$x = $this->keyget('price_group',$p);
return (isset($x['show']) AND $x['show']) ? TRUE : FALSE;
}
/**
* Return the configured price groups for this product
*/