FreenetIS
 All Classes Namespaces Functions Variables Pages
Public Member Functions | Public Attributes | Protected Attributes | List of all members
Device_Model Class Reference
Inheritance diagram for Device_Model:
ORM

Public Member Functions

 get_all_devices ($params=array(), $user_id=NULL)
 Gets all devices from database.
 count_all_devices ($filter_sql= '')
 Count of all devices.
 get_all_dhcp_servers ($params=array())
 Gets filtered DHCP servers list.
 count_all_dhcp_servers ($filter_sql= '')
 Count filtered DHCP servers.
 get_devices_of_user ($user_id, $display_empty=TRUE, $limit_from=0, $limit_results=NULL, $order_by= 'ip_address', $order_by_direction= 'asc')
 Returns all devices of user.
 count_devices_of_user ($user_id=null)
 Function counts devices of user.
 get_member_devices_with_debt_payments ($member_id)
 Returns all member's devices with debt payments.
 sum_debt_payments_of_member ($member_id)
 Sums all debt payments of member.
 get_gateway_of_subnet ($subnet_id)
 Returns gateway of subnet.
 get_parent ($device_id=NULL)
 Gets parent of device.
 select_list_device ()
 Select list of user and their devices.
 select_list_device_with_user ($user_id=null)
 Select list of user and their devices.
 select_list_filtered_device_with_user ($filter_sql= '', $json=TRUE)
 Select list of user and their devices.
 get_all_devices_of_link ($link_id)
 Returns all devices of link.
 get_all_connected_to_device ($device_id)
 Returns all devices of link.
 get_all_devices_by_member ($member_id=NULL)
 Returns all devices of member.
 get_all_service_devices_of_subnets ($subnets=array())
 Returns all devices with service flag in given subnets.
 get_all_dependent_subnets ($device_id=NULL, $recursive=TRUE)
 Returns all dependent subnets.
 port_number_exists ($port_number, $device_id=NULL, $iface_id=NULL)
 Checks if port number exists on given device.
 get_next_port_number ($device_id=null)
 Gets next available port number for new port of device.
 has_ports ($device_id=null)
 Test whether device has any ports.
 get_export ($device_id=NULL)
 Returns full export of device as object.
 is_ip_address_of_device ($ip_address, $device_id=NULL)
 Test if given IP address belongs to device.

Public Attributes

 $arr_sql

Protected Attributes

 $has_many
 $belongs_to

Member Function Documentation

Device_Model::count_all_devices (   $filter_sql = '')

Count of all devices.

Parameters
array$filter_values
Returns
integer
Device_Model::count_all_dhcp_servers (   $filter_sql = '')

Count filtered DHCP servers.

Parameters
array$params
Returns
int
Device_Model::count_devices_of_user (   $user_id = null)

Function counts devices of user.

Parameters
integer$user_id
Returns
integer
Device_Model::get_all_connected_to_device (   $device_id)

Returns all devices of link.

Author
Michal Kliment
Parameters
integer$device_id
Returns
object
Device_Model::get_all_dependent_subnets (   $device_id = NULL,
  $recursive = TRUE 
)

Returns all dependent subnets.

Author
Michal Kliment
Parameters
type$device_id
type$recursive
Returns
type
Device_Model::get_all_devices (   $params = array(),
  $user_id = NULL 
)

Gets all devices from database.

Database query returns member's device parameters (id, name, type), owner of device (user name and surname), MAC addresses of interfaces, names of segments and ip addresses.

Parameters
array$params
integer$user_id
Returns
Mysql_Result
Device_Model::get_all_devices_by_member (   $member_id = NULL)

Returns all devices of member.

Author
Michal Kliment
Parameters
type$member_id
Returns
type
Device_Model::get_all_devices_of_link (   $link_id)

Returns all devices of link.

Author
Michal Kliment
Parameters
integer$segment_id
Returns
MySQL_Iterator object
Device_Model::get_all_dhcp_servers (   $params = array())

Gets filtered DHCP servers list.

Parameters
array$params
Returns
Mysql_Result
Device_Model::get_all_service_devices_of_subnets (   $subnets = array())

Returns all devices with service flag in given subnets.

Author
Michal Kliment
Parameters
type$subnets
Returns
boolean
Device_Model::get_devices_of_user (   $user_id,
  $display_empty = TRUE,
  $limit_from = 0,
  $limit_results = NULL,
  $order_by = 'ip_address',
  $order_by_direction = 'asc' 
)

Returns all devices of user.

Author
Michal Kliment
Parameters
int$user_id
bool$display_empty
int$limit_from
int$limit_results
string$order_by
string$order_by_direction
Returns
Mysql_Result
Device_Model::get_export (   $device_id = NULL)

Returns full export of device as object.

Author
Michal Kliment klime.nosp@m.nt@f.nosp@m.reene.nosp@m.tis..nosp@m.org
Parameters
type$device_id
Returns
type
Device_Model::get_gateway_of_subnet (   $subnet_id)

Returns gateway of subnet.

Author
Michal Kliment
Parameters
integer$subnet_id
Returns
Mysql_Result
Device_Model::get_member_devices_with_debt_payments (   $member_id)

Returns all member's devices with debt payments.

Author
Michal Kliment
Parameters
int$member_id
Returns
Mysql_Result
Device_Model::get_next_port_number (   $device_id = null)

Gets next available port number for new port of device.

Author
Ondřej Fibich
Parameters
integer$device_id
Returns
integer
Device_Model::get_parent (   $device_id = NULL)

Gets parent of device.

Parameters
integer$device_id
Returns
Mysql_Result
Device_Model::has_ports (   $device_id = null)

Test whether device has any ports.

Author
Michal Kliment
Parameters
type$device_id
Returns
type
Device_Model::is_ip_address_of_device (   $ip_address,
  $device_id = NULL 
)

Test if given IP address belongs to device.

Author
Michal Kliment klime.nosp@m.nt@f.nosp@m.reene.nosp@m.tis..nosp@m.org
Parameters
type$ip_address
type$device_id
Returns
boolean
Device_Model::port_number_exists (   $port_number,
  $device_id = NULL,
  $iface_id = NULL 
)

Checks if port number exists on given device.

Parameters
integer$port_number
integer$device_id
integer$iface_idIface for edit
Returns
boolean
Device_Model::select_list_device ( )

Select list of user and their devices.

Returns
array
Device_Model::select_list_device_with_user (   $user_id = null)

Select list of user and their devices.

Parameters
integer$user_idUser ID for filter only user's devices [optional]
Returns
array
Device_Model::select_list_filtered_device_with_user (   $filter_sql = '',
  $json = TRUE 
)

Select list of user and their devices.

Parameters
string$filter_sqlFilter query
boolean$jsonIndicator if JSON is enabled (change structure)
Returns
array
Device_Model::sum_debt_payments_of_member (   $member_id)

Sums all debt payments of member.

Author
Michal Kliment
Parameters
integer$member_id
Returns
integer

Member Data Documentation

Device_Model::$arr_sql
Initial value:
array
(
'id' => 'd.id',
'login' => 'u.login',
'device_name' => 'd.name',
'username' => 'concat(u.name,\' \',u.surname)',
'device_type' => 'd.type',
'member_id' => 'users.member_id',
)
Device_Model::$belongs_to
protected
Initial value:
array
(
'address_point', 'user'
)
Device_Model::$has_many
protected
Initial value:
array
(
'ifaces', 'device_admins', 'device_engineers', 'connection_requests', 'device_active_links'
)

The documentation for this class was generated from the following file: