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

48 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.
*
2013-03-19 22:35:19 +00:00
* @package Service
2010-11-29 22:41:08 +00:00
* @category Controllers/Task
* @author Deon George
2013-03-19 22:35:19 +00:00
* @copyright (c) 2009-2013 Open Source Billing
2010-11-29 22:41:08 +00:00
* @license http://dev.osbill.net/license.html
*/
2011-08-16 02:27:19 +00:00
class Controller_Task_Service extends Controller_Task {
private function _traffic_suppliers($active=FALSE) {
2013-04-20 01:40:44 +00:00
$suppliers = ORM::factory('ADSL_Supplier');
2012-08-01 12:43:33 +00:00
return $active ? $suppliers->list_active() : $suppliers->find_all();
}
2010-11-29 22:41:08 +00:00
/**
* List all services by their default checkout method
*/
public function action_gettraffic() {
2012-02-22 08:15:46 +00:00
foreach ($this->_traffic_suppliers(TRUE) as $aso) {
2012-11-09 23:13:57 +00:00
if (Minion_CLI::options('verbose'))
2012-02-22 08:15:46 +00:00
echo $aso->name."\n";
$traffic = Service_Traffic_Adsl::instance($aso->name)->update_traffic();
2012-02-22 08:15:46 +00:00
}
2010-11-29 22:41:08 +00:00
}
/**
* Charges for excess traffic usage
*/
public function action_chargetraffic() {
2012-01-01 09:41:42 +00:00
foreach ($this->_traffic_suppliers(TRUE) as $aso)
$traffic = Service_Traffic_Adsl::instance($aso->name)->charge_excess_traffic();
2010-11-29 22:41:08 +00:00
}
/**
* Send alerts to users when they exceed their traffic allowance
*/
public function action_alerttraffic() {
2012-01-01 09:41:42 +00:00
foreach ($this->_traffic_suppliers(TRUE) as $aso)
$traffic = Service_Traffic_Adsl::instance($aso->name)->alert_traffic();
2010-11-29 22:41:08 +00:00
}
}
?>