This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
khosb/modules/service/classes/controller/task/service.php

54 lines
1.3 KiB
PHP
Raw Normal View History

2010-11-29 22:41:08 +00:00
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class provides OSB service task capabilities.
*
* @package OSB
* @subpackage Service
* @category Controllers/Task
* @author Deon George
* @copyright (c) 2010 Open Source Billing
* @license http://dev.osbill.net/license.html
*/
class Controller_Task_Service extends Controller_Template {
private function _traffic_suppliers($active=FALSE) {
$suppliers = ORM::factory('adsl_supplier');
return $active ? $suppliers->active() : $suppliers->find_all();
}
2010-11-29 22:41:08 +00:00
/**
* List all services by their default checkout method
*/
public function action_gettraffic() {
foreach ($this->_traffic_suppliers(TRUE) as $aso) {
$traffic = Service_Traffic_ADSL::instance($aso->name);
2010-11-29 22:41:08 +00:00
$traffic->update_traffic();
}
}
/**
* Charges for excess traffic usage
*/
public function action_chargetraffic() {
foreach ($this->_traffic_suppliers(TRUE) as $aso) {
$traffic = Service_Traffic_ADSL::instance($aso->name);
2010-11-29 22:41:08 +00:00
$traffic->charge_excess_traffic();
}
}
/**
* Send alerts to users when they exceed their traffic allowance
*/
public function action_alerttraffic() {
foreach ($this->_traffic_suppliers(TRUE) as $aso) {
$traffic = Service_Traffic_ADSL::instance($aso->name);
2010-11-29 22:41:08 +00:00
$traffic->alert_traffic();
}
}
}
?>