diff --git a/library/NGNPro/Records/Gateways.php b/library/NGNPro/Records/Gateways.php index ea0ca64..7641477 100644 --- a/library/NGNPro/Records/Gateways.php +++ b/library/NGNPro/Records/Gateways.php @@ -1,544 +1,564 @@ array('type'=>'integer', - 'readonly' => true), - 'name' => array('type'=>'string'), - 'carrier_id' => array('type'=>'integer'), - 'transport' => array('type'=>'string'), - 'ip' => array('name'=>'IP or hostname', - 'type'=>'string'), - 'port' => array('type'=>'integer') - ); - - //var $transports=array('udp','tcp','tls'); - var $transports=array('udp'); + var $carriers = array(); + var $FieldsReadOnly = array( + 'reseller', + 'changeDate' + ); + + var $Fields = array( + 'id' => array('type'=>'integer', + 'readonly' => true), + 'name' => array('type'=>'string'), + 'carrier_id' => array('type'=>'integer'), + 'transport' => array('type'=>'string'), + 'ip' => array('name'=>'IP or hostname', + 'type'=>'string'), + 'port' => array('type'=>'integer') + ); + + //var $transports = array('udp','tcp','tls'); + var $transports = array('udp'); public function __construct($SoapEngine) { $this->filters = array( - 'id' => trim($_REQUEST['id_filter']), - 'name' => trim($_REQUEST['name_filter']), - 'carrier_id' => trim($_REQUEST['carrier_id_filter']) - ); - - $this->sortElements=array( - 'changeDate' => 'Change date', - 'name' => 'Gateway', - 'carrier_id' => 'Carrier', - 'ip' => 'Address' - ); + 'id' => trim($_REQUEST['id_filter']), + 'name' => trim($_REQUEST['name_filter']), + 'carrier_id' => trim($_REQUEST['carrier_id_filter']) + ); + + $this->sortElements = array( + 'changeDate' => 'Change date', + 'name' => 'Gateway', + 'carrier_id' => 'Carrier', + 'ip' => 'Address' + ); parent::__construct($SoapEngine); } - function listRecords() { + function listRecords() + { $this->getCarriers(); $this->showSeachForm(); // Insert credetials $this->SoapEngine->soapclient->addHeader($this->SoapEngine->SoapAuth); // Filter - $filter=array('id' => intval($this->filters['id']), - 'name' => $this->filters['name'], - 'carrier_id'=> intval($this->filters['carrier_id']), - 'customer' => intval($this->filters['customer']), - 'reseller' => intval($this->filters['reseller']) - ); + $filter = array( + 'id' => intval($this->filters['id']), + 'name' => $this->filters['name'], + 'carrier_id'=> intval($this->filters['carrier_id']), + 'customer' => intval($this->filters['customer']), + 'reseller' => intval($this->filters['reseller']) + ); // Range - $range=array('start' => intval($this->next), - 'count' => intval($this->maxrowsperpage) - ); + $range = array( + 'start' => intval($this->next), + 'count' => intval($this->maxrowsperpage) + ); // Order if (!$this->sorting['sortBy']) $this->sorting['sortBy'] = 'changeDate'; if (!$this->sorting['sortOrder']) $this->sorting['sortOrder'] = 'DESC'; - $orderBy = array('attribute' => $this->sorting['sortBy'], - 'direction' => $this->sorting['sortOrder'] - ); + $orderBy = array( + 'attribute' => $this->sorting['sortBy'], + 'direction' => $this->sorting['sortOrder'] + ); // Compose query - $Query=array('filter' => $filter, - 'orderBy' => $orderBy, - 'range' => $range - ); + $Query = array( + 'filter' => $filter, + 'orderBy' => $orderBy, + 'range' => $range + ); // Call function $this->log_action('getGateways'); - $result = $this->SoapEngine->soapclient->getGateways($Query); + $result = $this->SoapEngine->soapclient->getGateways($Query); - if ((new PEAR)->isError($result)) { - $error_msg = $result->getMessage(); - $error_fault= $result->getFault(); - $error_code = $result->getCode(); - $log=sprintf("SOAP request error from %s: %s (%s): %s",$this->SoapEngine->SOAPurl,$error_msg, $error_fault->detail->exception->errorcode,$error_fault->detail->exception->errorstring); - syslog(LOG_NOTICE, $log); + if ($this->checkLogSoapError($result, true)) { return false; } else { - $this->rows = $result->total; - print " -
-
Id | -Owner | -Gateway | -Carrier | -Name | -Address | -Rules | -Change date | -Actions | -
---|
Id | +Owner | +Gateway | +Carrier | +Name | +Address | +Rules | +Change date | +Actions | +
---|---|---|---|---|---|---|---|---|
%s | -%s | -%s | -%s | -%s | -%s:%s:%s | -Rules | -%s | -%s | -
%s | +%s | +%s | +%s | +%s | +%s:%s:%s | +Rules | +%s | +%s | +
Create a carrier first"; return false; } - printf ("